Enhance syntax of -fdbg-cnt.
[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 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
727 -mn_flash=@var{size} -mno-interrupts @gol
728 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
729 -mfract-convert-truncate @gol
730 -mshort-calls -nodevicelib @gol
731 -Waddr-space-convert -Wmisspelled-isr}
732
733 @emph{Blackfin Options}
734 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
735 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
736 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
737 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
738 -mno-id-shared-library -mshared-library-id=@var{n} @gol
739 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
740 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
741 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
742 -micplb}
743
744 @emph{C6X Options}
745 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
746 -msim -msdata=@var{sdata-type}}
747
748 @emph{CRIS Options}
749 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
750 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
751 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
752 -mstack-align -mdata-align -mconst-align @gol
753 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
754 -melf -maout -melinux -mlinux -sim -sim2 @gol
755 -mmul-bug-workaround -mno-mul-bug-workaround}
756
757 @emph{CR16 Options}
758 @gccoptlist{-mmac @gol
759 -mcr16cplus -mcr16c @gol
760 -msim -mint32 -mbit-ops
761 -mdata-model=@var{model}}
762
763 @emph{C-SKY Options}
764 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
765 -mbig-endian -EB -mlittle-endian -EL @gol
766 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
767 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
768 -mdsp -medsp -mvdsp @gol
769 -mdiv -msmart -mhigh-registers -manchor @gol
770 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
771 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
772
773 @emph{Darwin Options}
774 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
775 -arch_only -bind_at_load -bundle -bundle_loader @gol
776 -client_name -compatibility_version -current_version @gol
777 -dead_strip @gol
778 -dependency-file -dylib_file -dylinker_install_name @gol
779 -dynamic -dynamiclib -exported_symbols_list @gol
780 -filelist -flat_namespace -force_cpusubtype_ALL @gol
781 -force_flat_namespace -headerpad_max_install_names @gol
782 -iframework @gol
783 -image_base -init -install_name -keep_private_externs @gol
784 -multi_module -multiply_defined -multiply_defined_unused @gol
785 -noall_load -no_dead_strip_inits_and_terms @gol
786 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
787 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
788 -private_bundle -read_only_relocs -sectalign @gol
789 -sectobjectsymbols -whyload -seg1addr @gol
790 -sectcreate -sectobjectsymbols -sectorder @gol
791 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
792 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
793 -segprot -segs_read_only_addr -segs_read_write_addr @gol
794 -single_module -static -sub_library -sub_umbrella @gol
795 -twolevel_namespace -umbrella -undefined @gol
796 -unexported_symbols_list -weak_reference_mismatches @gol
797 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
798 -mkernel -mone-byte-bool}
799
800 @emph{DEC Alpha Options}
801 @gccoptlist{-mno-fp-regs -msoft-float @gol
802 -mieee -mieee-with-inexact -mieee-conformant @gol
803 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
804 -mtrap-precision=@var{mode} -mbuild-constants @gol
805 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
806 -mbwx -mmax -mfix -mcix @gol
807 -mfloat-vax -mfloat-ieee @gol
808 -mexplicit-relocs -msmall-data -mlarge-data @gol
809 -msmall-text -mlarge-text @gol
810 -mmemory-latency=@var{time}}
811
812 @emph{eBPF Options}
813 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
814 -mframe-limit=@var{bytes}}
815
816 @emph{FR30 Options}
817 @gccoptlist{-msmall-model -mno-lsim}
818
819 @emph{FT32 Options}
820 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
821
822 @emph{FRV Options}
823 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
824 -mhard-float -msoft-float @gol
825 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
826 -mdouble -mno-double @gol
827 -mmedia -mno-media -mmuladd -mno-muladd @gol
828 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
829 -mlinked-fp -mlong-calls -malign-labels @gol
830 -mlibrary-pic -macc-4 -macc-8 @gol
831 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
832 -moptimize-membar -mno-optimize-membar @gol
833 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
834 -mvliw-branch -mno-vliw-branch @gol
835 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
836 -mno-nested-cond-exec -mtomcat-stats @gol
837 -mTLS -mtls @gol
838 -mcpu=@var{cpu}}
839
840 @emph{GNU/Linux Options}
841 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
842 -tno-android-cc -tno-android-ld}
843
844 @emph{H8/300 Options}
845 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
846
847 @emph{HPPA Options}
848 @gccoptlist{-march=@var{architecture-type} @gol
849 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
850 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
851 -mfixed-range=@var{register-range} @gol
852 -mjump-in-delay -mlinker-opt -mlong-calls @gol
853 -mlong-load-store -mno-disable-fpregs @gol
854 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
855 -mno-jump-in-delay -mno-long-load-store @gol
856 -mno-portable-runtime -mno-soft-float @gol
857 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
858 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
859 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
860 -munix=@var{unix-std} -nolibdld -static -threads}
861
862 @emph{IA-64 Options}
863 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
864 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
865 -mconstant-gp -mauto-pic -mfused-madd @gol
866 -minline-float-divide-min-latency @gol
867 -minline-float-divide-max-throughput @gol
868 -mno-inline-float-divide @gol
869 -minline-int-divide-min-latency @gol
870 -minline-int-divide-max-throughput @gol
871 -mno-inline-int-divide @gol
872 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
873 -mno-inline-sqrt @gol
874 -mdwarf2-asm -mearly-stop-bits @gol
875 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
876 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
877 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
878 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
879 -msched-spec-ldc -msched-spec-control-ldc @gol
880 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
881 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
882 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
883 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
884
885 @emph{LM32 Options}
886 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
887 -msign-extend-enabled -muser-enabled}
888
889 @emph{M32R/D Options}
890 @gccoptlist{-m32r2 -m32rx -m32r @gol
891 -mdebug @gol
892 -malign-loops -mno-align-loops @gol
893 -missue-rate=@var{number} @gol
894 -mbranch-cost=@var{number} @gol
895 -mmodel=@var{code-size-model-type} @gol
896 -msdata=@var{sdata-type} @gol
897 -mno-flush-func -mflush-func=@var{name} @gol
898 -mno-flush-trap -mflush-trap=@var{number} @gol
899 -G @var{num}}
900
901 @emph{M32C Options}
902 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
903
904 @emph{M680x0 Options}
905 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
906 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
907 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
908 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
909 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
910 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
911 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
912 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
913 -mxgot -mno-xgot -mlong-jump-table-offsets}
914
915 @emph{MCore Options}
916 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
917 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
918 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
919 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
920 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
921
922 @emph{MeP Options}
923 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
924 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
925 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
926 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
927 -mtiny=@var{n}}
928
929 @emph{MicroBlaze Options}
930 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
931 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
932 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
933 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
934 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
935 -mpic-data-is-text-relative}
936
937 @emph{MIPS Options}
938 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
939 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
940 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
941 -mips16 -mno-mips16 -mflip-mips16 @gol
942 -minterlink-compressed -mno-interlink-compressed @gol
943 -minterlink-mips16 -mno-interlink-mips16 @gol
944 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
945 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
946 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
947 -mno-float -msingle-float -mdouble-float @gol
948 -modd-spreg -mno-odd-spreg @gol
949 -mabs=@var{mode} -mnan=@var{encoding} @gol
950 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
951 -mmcu -mmno-mcu @gol
952 -meva -mno-eva @gol
953 -mvirt -mno-virt @gol
954 -mxpa -mno-xpa @gol
955 -mcrc -mno-crc @gol
956 -mginv -mno-ginv @gol
957 -mmicromips -mno-micromips @gol
958 -mmsa -mno-msa @gol
959 -mloongson-mmi -mno-loongson-mmi @gol
960 -mloongson-ext -mno-loongson-ext @gol
961 -mloongson-ext2 -mno-loongson-ext2 @gol
962 -mfpu=@var{fpu-type} @gol
963 -msmartmips -mno-smartmips @gol
964 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
965 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
966 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
967 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
968 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
969 -membedded-data -mno-embedded-data @gol
970 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
971 -mcode-readable=@var{setting} @gol
972 -msplit-addresses -mno-split-addresses @gol
973 -mexplicit-relocs -mno-explicit-relocs @gol
974 -mcheck-zero-division -mno-check-zero-division @gol
975 -mdivide-traps -mdivide-breaks @gol
976 -mload-store-pairs -mno-load-store-pairs @gol
977 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
978 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
979 -mfix-24k -mno-fix-24k @gol
980 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
981 -mfix-r5900 -mno-fix-r5900 @gol
982 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
983 -mfix-vr4120 -mno-fix-vr4120 @gol
984 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
985 -mflush-func=@var{func} -mno-flush-func @gol
986 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
987 -mcompact-branches=@var{policy} @gol
988 -mfp-exceptions -mno-fp-exceptions @gol
989 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
990 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
991 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
992 -mframe-header-opt -mno-frame-header-opt}
993
994 @emph{MMIX Options}
995 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
996 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
997 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
998 -mno-base-addresses -msingle-exit -mno-single-exit}
999
1000 @emph{MN10300 Options}
1001 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1002 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1003 -mtune=@var{cpu-type} @gol
1004 -mreturn-pointer-on-d0 @gol
1005 -mno-crt0 -mrelax -mliw -msetlb}
1006
1007 @emph{Moxie Options}
1008 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1009
1010 @emph{MSP430 Options}
1011 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1012 -mwarn-mcu @gol
1013 -mcode-region= -mdata-region= @gol
1014 -msilicon-errata= -msilicon-errata-warn= @gol
1015 -mhwmult= -minrt -mtiny-printf}
1016
1017 @emph{NDS32 Options}
1018 @gccoptlist{-mbig-endian -mlittle-endian @gol
1019 -mreduced-regs -mfull-regs @gol
1020 -mcmov -mno-cmov @gol
1021 -mext-perf -mno-ext-perf @gol
1022 -mext-perf2 -mno-ext-perf2 @gol
1023 -mext-string -mno-ext-string @gol
1024 -mv3push -mno-v3push @gol
1025 -m16bit -mno-16bit @gol
1026 -misr-vector-size=@var{num} @gol
1027 -mcache-block-size=@var{num} @gol
1028 -march=@var{arch} @gol
1029 -mcmodel=@var{code-model} @gol
1030 -mctor-dtor -mrelax}
1031
1032 @emph{Nios II Options}
1033 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1034 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1035 -mel -meb @gol
1036 -mno-bypass-cache -mbypass-cache @gol
1037 -mno-cache-volatile -mcache-volatile @gol
1038 -mno-fast-sw-div -mfast-sw-div @gol
1039 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1040 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1041 -mcustom-fpu-cfg=@var{name} @gol
1042 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1043 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1044
1045 @emph{Nvidia PTX Options}
1046 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1047
1048 @emph{OpenRISC Options}
1049 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1050 -msoft-mul -msoft-div @gol
1051 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1052 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1053
1054 @emph{PDP-11 Options}
1055 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1056 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1057 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1058
1059 @emph{picoChip Options}
1060 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1061 -msymbol-as-address -mno-inefficient-warnings}
1062
1063 @emph{PowerPC Options}
1064 See RS/6000 and PowerPC Options.
1065
1066 @emph{PRU Options}
1067 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1068 -mabi=@var{variant} @gol}
1069
1070 @emph{RISC-V Options}
1071 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1072 -mplt -mno-plt @gol
1073 -mabi=@var{ABI-string} @gol
1074 -mfdiv -mno-fdiv @gol
1075 -mdiv -mno-div @gol
1076 -march=@var{ISA-string} @gol
1077 -mtune=@var{processor-string} @gol
1078 -mpreferred-stack-boundary=@var{num} @gol
1079 -msmall-data-limit=@var{N-bytes} @gol
1080 -msave-restore -mno-save-restore @gol
1081 -mstrict-align -mno-strict-align @gol
1082 -mcmodel=medlow -mcmodel=medany @gol
1083 -mexplicit-relocs -mno-explicit-relocs @gol
1084 -mrelax -mno-relax @gol
1085 -mriscv-attribute -mmo-riscv-attribute @gol
1086 -malign-data=@var{type}}
1087
1088 @emph{RL78 Options}
1089 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1090 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1091 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1092
1093 @emph{RS/6000 and PowerPC Options}
1094 @gccoptlist{-mcpu=@var{cpu-type} @gol
1095 -mtune=@var{cpu-type} @gol
1096 -mcmodel=@var{code-model} @gol
1097 -mpowerpc64 @gol
1098 -maltivec -mno-altivec @gol
1099 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1100 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1101 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1102 -mfprnd -mno-fprnd @gol
1103 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1104 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1105 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1106 -malign-power -malign-natural @gol
1107 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1108 -mupdate -mno-update @gol
1109 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1110 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1111 -mstrict-align -mno-strict-align -mrelocatable @gol
1112 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1113 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1114 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1115 -mprioritize-restricted-insns=@var{priority} @gol
1116 -msched-costly-dep=@var{dependence_type} @gol
1117 -minsert-sched-nops=@var{scheme} @gol
1118 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1119 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1120 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1121 -mtraceback=@var{traceback_type} @gol
1122 -maix-struct-return -msvr4-struct-return @gol
1123 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1124 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1125 -mblock-move-inline-limit=@var{num} @gol
1126 -mblock-compare-inline-limit=@var{num} @gol
1127 -mblock-compare-inline-loop-limit=@var{num} @gol
1128 -mstring-compare-inline-limit=@var{num} @gol
1129 -misel -mno-isel @gol
1130 -mvrsave -mno-vrsave @gol
1131 -mmulhw -mno-mulhw @gol
1132 -mdlmzb -mno-dlmzb @gol
1133 -mprototype -mno-prototype @gol
1134 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1135 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1136 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1137 -mno-recip-precision @gol
1138 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1139 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1140 -msave-toc-indirect -mno-save-toc-indirect @gol
1141 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1142 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1143 -mquad-memory -mno-quad-memory @gol
1144 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1145 -mcompat-align-parm -mno-compat-align-parm @gol
1146 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1147 -mgnu-attribute -mno-gnu-attribute @gol
1148 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1149 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1150
1151 @emph{RX Options}
1152 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1153 -mcpu=@gol
1154 -mbig-endian-data -mlittle-endian-data @gol
1155 -msmall-data @gol
1156 -msim -mno-sim@gol
1157 -mas100-syntax -mno-as100-syntax@gol
1158 -mrelax@gol
1159 -mmax-constant-size=@gol
1160 -mint-register=@gol
1161 -mpid@gol
1162 -mallow-string-insns -mno-allow-string-insns@gol
1163 -mjsr@gol
1164 -mno-warn-multiple-fast-interrupts@gol
1165 -msave-acc-in-interrupts}
1166
1167 @emph{S/390 and zSeries Options}
1168 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1169 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1170 -mlong-double-64 -mlong-double-128 @gol
1171 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1172 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1173 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1174 -mhtm -mvx -mzvector @gol
1175 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1176 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1177 -mhotpatch=@var{halfwords},@var{halfwords}}
1178
1179 @emph{Score Options}
1180 @gccoptlist{-meb -mel @gol
1181 -mnhwloop @gol
1182 -muls @gol
1183 -mmac @gol
1184 -mscore5 -mscore5u -mscore7 -mscore7d}
1185
1186 @emph{SH Options}
1187 @gccoptlist{-m1 -m2 -m2e @gol
1188 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1189 -m3 -m3e @gol
1190 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1191 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1192 -mb -ml -mdalign -mrelax @gol
1193 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1194 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1195 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1196 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1197 -maccumulate-outgoing-args @gol
1198 -matomic-model=@var{atomic-model} @gol
1199 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1200 -mcbranch-force-delay-slot @gol
1201 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1202 -mpretend-cmove -mtas}
1203
1204 @emph{Solaris 2 Options}
1205 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1206 -pthreads}
1207
1208 @emph{SPARC Options}
1209 @gccoptlist{-mcpu=@var{cpu-type} @gol
1210 -mtune=@var{cpu-type} @gol
1211 -mcmodel=@var{code-model} @gol
1212 -mmemory-model=@var{mem-model} @gol
1213 -m32 -m64 -mapp-regs -mno-app-regs @gol
1214 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1215 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1216 -mhard-quad-float -msoft-quad-float @gol
1217 -mstack-bias -mno-stack-bias @gol
1218 -mstd-struct-return -mno-std-struct-return @gol
1219 -munaligned-doubles -mno-unaligned-doubles @gol
1220 -muser-mode -mno-user-mode @gol
1221 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1222 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1223 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1224 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1225 -mpopc -mno-popc -msubxc -mno-subxc @gol
1226 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1227 -mlra -mno-lra}
1228
1229 @emph{System V Options}
1230 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1231
1232 @emph{TILE-Gx Options}
1233 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1234 -mcmodel=@var{code-model}}
1235
1236 @emph{TILEPro Options}
1237 @gccoptlist{-mcpu=@var{cpu} -m32}
1238
1239 @emph{V850 Options}
1240 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1241 -mprolog-function -mno-prolog-function -mspace @gol
1242 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1243 -mapp-regs -mno-app-regs @gol
1244 -mdisable-callt -mno-disable-callt @gol
1245 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1246 -mv850e -mv850 -mv850e3v5 @gol
1247 -mloop @gol
1248 -mrelax @gol
1249 -mlong-jumps @gol
1250 -msoft-float @gol
1251 -mhard-float @gol
1252 -mgcc-abi @gol
1253 -mrh850-abi @gol
1254 -mbig-switch}
1255
1256 @emph{VAX Options}
1257 @gccoptlist{-mg -mgnu -munix}
1258
1259 @emph{Visium Options}
1260 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1261 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1262
1263 @emph{VMS Options}
1264 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1265 -mpointer-size=@var{size}}
1266
1267 @emph{VxWorks Options}
1268 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1269 -Xbind-lazy -Xbind-now}
1270
1271 @emph{x86 Options}
1272 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1273 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1274 -mfpmath=@var{unit} @gol
1275 -masm=@var{dialect} -mno-fancy-math-387 @gol
1276 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1277 -mno-wide-multiply -mrtd -malign-double @gol
1278 -mpreferred-stack-boundary=@var{num} @gol
1279 -mincoming-stack-boundary=@var{num} @gol
1280 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1281 -mrecip -mrecip=@var{opt} @gol
1282 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1283 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1284 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1285 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1286 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1287 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1288 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1289 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1290 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1291 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1292 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1293 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1294 -mrdseed -msgx -mavx512vp2intersect@gol
1295 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1296 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1297 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1298 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1299 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1300 -mregparm=@var{num} -msseregparm @gol
1301 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1302 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1303 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1304 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1305 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1306 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1307 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1308 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1309 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1310 -mstack-protector-guard-reg=@var{reg} @gol
1311 -mstack-protector-guard-offset=@var{offset} @gol
1312 -mstack-protector-guard-symbol=@var{symbol} @gol
1313 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1314 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1315 -mindirect-branch-register}
1316
1317 @emph{x86 Windows Options}
1318 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1319 -mnop-fun-dllimport -mthread @gol
1320 -municode -mwin32 -mwindows -fno-set-stack-executable}
1321
1322 @emph{Xstormy16 Options}
1323 @gccoptlist{-msim}
1324
1325 @emph{Xtensa Options}
1326 @gccoptlist{-mconst16 -mno-const16 @gol
1327 -mfused-madd -mno-fused-madd @gol
1328 -mforce-no-pic @gol
1329 -mserialize-volatile -mno-serialize-volatile @gol
1330 -mtext-section-literals -mno-text-section-literals @gol
1331 -mauto-litpools -mno-auto-litpools @gol
1332 -mtarget-align -mno-target-align @gol
1333 -mlongcalls -mno-longcalls}
1334
1335 @emph{zSeries Options}
1336 See S/390 and zSeries Options.
1337 @end table
1338
1339
1340 @node Overall Options
1341 @section Options Controlling the Kind of Output
1342
1343 Compilation can involve up to four stages: preprocessing, compilation
1344 proper, assembly and linking, always in that order. GCC is capable of
1345 preprocessing and compiling several files either into several
1346 assembler input files, or into one assembler input file; then each
1347 assembler input file produces an object file, and linking combines all
1348 the object files (those newly compiled, and those specified as input)
1349 into an executable file.
1350
1351 @cindex file name suffix
1352 For any given input file, the file name suffix determines what kind of
1353 compilation is done:
1354
1355 @table @gcctabopt
1356 @item @var{file}.c
1357 C source code that must be preprocessed.
1358
1359 @item @var{file}.i
1360 C source code that should not be preprocessed.
1361
1362 @item @var{file}.ii
1363 C++ source code that should not be preprocessed.
1364
1365 @item @var{file}.m
1366 Objective-C source code. Note that you must link with the @file{libobjc}
1367 library to make an Objective-C program work.
1368
1369 @item @var{file}.mi
1370 Objective-C source code that should not be preprocessed.
1371
1372 @item @var{file}.mm
1373 @itemx @var{file}.M
1374 Objective-C++ source code. Note that you must link with the @file{libobjc}
1375 library to make an Objective-C++ program work. Note that @samp{.M} refers
1376 to a literal capital M@.
1377
1378 @item @var{file}.mii
1379 Objective-C++ source code that should not be preprocessed.
1380
1381 @item @var{file}.h
1382 C, C++, Objective-C or Objective-C++ header file to be turned into a
1383 precompiled header (default), or C, C++ header file to be turned into an
1384 Ada spec (via the @option{-fdump-ada-spec} switch).
1385
1386 @item @var{file}.cc
1387 @itemx @var{file}.cp
1388 @itemx @var{file}.cxx
1389 @itemx @var{file}.cpp
1390 @itemx @var{file}.CPP
1391 @itemx @var{file}.c++
1392 @itemx @var{file}.C
1393 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1394 the last two letters must both be literally @samp{x}. Likewise,
1395 @samp{.C} refers to a literal capital C@.
1396
1397 @item @var{file}.mm
1398 @itemx @var{file}.M
1399 Objective-C++ source code that must be preprocessed.
1400
1401 @item @var{file}.mii
1402 Objective-C++ source code that should not be preprocessed.
1403
1404 @item @var{file}.hh
1405 @itemx @var{file}.H
1406 @itemx @var{file}.hp
1407 @itemx @var{file}.hxx
1408 @itemx @var{file}.hpp
1409 @itemx @var{file}.HPP
1410 @itemx @var{file}.h++
1411 @itemx @var{file}.tcc
1412 C++ header file to be turned into a precompiled header or Ada spec.
1413
1414 @item @var{file}.f
1415 @itemx @var{file}.for
1416 @itemx @var{file}.ftn
1417 Fixed form Fortran source code that should not be preprocessed.
1418
1419 @item @var{file}.F
1420 @itemx @var{file}.FOR
1421 @itemx @var{file}.fpp
1422 @itemx @var{file}.FPP
1423 @itemx @var{file}.FTN
1424 Fixed form Fortran source code that must be preprocessed (with the traditional
1425 preprocessor).
1426
1427 @item @var{file}.f90
1428 @itemx @var{file}.f95
1429 @itemx @var{file}.f03
1430 @itemx @var{file}.f08
1431 Free form Fortran source code that should not be preprocessed.
1432
1433 @item @var{file}.F90
1434 @itemx @var{file}.F95
1435 @itemx @var{file}.F03
1436 @itemx @var{file}.F08
1437 Free form Fortran source code that must be preprocessed (with the
1438 traditional preprocessor).
1439
1440 @item @var{file}.go
1441 Go source code.
1442
1443 @item @var{file}.brig
1444 BRIG files (binary representation of HSAIL).
1445
1446 @item @var{file}.d
1447 D source code.
1448
1449 @item @var{file}.di
1450 D interface file.
1451
1452 @item @var{file}.dd
1453 D documentation code (Ddoc).
1454
1455 @item @var{file}.ads
1456 Ada source code file that contains a library unit declaration (a
1457 declaration of a package, subprogram, or generic, or a generic
1458 instantiation), or a library unit renaming declaration (a package,
1459 generic, or subprogram renaming declaration). Such files are also
1460 called @dfn{specs}.
1461
1462 @item @var{file}.adb
1463 Ada source code file containing a library unit body (a subprogram or
1464 package body). Such files are also called @dfn{bodies}.
1465
1466 @c GCC also knows about some suffixes for languages not yet included:
1467 @c Ratfor:
1468 @c @var{file}.r
1469
1470 @item @var{file}.s
1471 Assembler code.
1472
1473 @item @var{file}.S
1474 @itemx @var{file}.sx
1475 Assembler code that must be preprocessed.
1476
1477 @item @var{other}
1478 An object file to be fed straight into linking.
1479 Any file name with no recognized suffix is treated this way.
1480 @end table
1481
1482 @opindex x
1483 You can specify the input language explicitly with the @option{-x} option:
1484
1485 @table @gcctabopt
1486 @item -x @var{language}
1487 Specify explicitly the @var{language} for the following input files
1488 (rather than letting the compiler choose a default based on the file
1489 name suffix). This option applies to all following input files until
1490 the next @option{-x} option. Possible values for @var{language} are:
1491 @smallexample
1492 c c-header cpp-output
1493 c++ c++-header c++-cpp-output
1494 objective-c objective-c-header objective-c-cpp-output
1495 objective-c++ objective-c++-header objective-c++-cpp-output
1496 assembler assembler-with-cpp
1497 ada
1498 d
1499 f77 f77-cpp-input f95 f95-cpp-input
1500 go
1501 brig
1502 @end smallexample
1503
1504 @item -x none
1505 Turn off any specification of a language, so that subsequent files are
1506 handled according to their file name suffixes (as they are if @option{-x}
1507 has not been used at all).
1508 @end table
1509
1510 If you only want some of the stages of compilation, you can use
1511 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1512 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1513 @command{gcc} is to stop. Note that some combinations (for example,
1514 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1515
1516 @table @gcctabopt
1517 @item -c
1518 @opindex c
1519 Compile or assemble the source files, but do not link. The linking
1520 stage simply is not done. The ultimate output is in the form of an
1521 object file for each source file.
1522
1523 By default, the object file name for a source file is made by replacing
1524 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1525
1526 Unrecognized input files, not requiring compilation or assembly, are
1527 ignored.
1528
1529 @item -S
1530 @opindex S
1531 Stop after the stage of compilation proper; do not assemble. The output
1532 is in the form of an assembler code file for each non-assembler input
1533 file specified.
1534
1535 By default, the assembler file name for a source file is made by
1536 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1537
1538 Input files that don't require compilation are ignored.
1539
1540 @item -E
1541 @opindex E
1542 Stop after the preprocessing stage; do not run the compiler proper. The
1543 output is in the form of preprocessed source code, which is sent to the
1544 standard output.
1545
1546 Input files that don't require preprocessing are ignored.
1547
1548 @cindex output file option
1549 @item -o @var{file}
1550 @opindex o
1551 Place output in file @var{file}. This applies to whatever
1552 sort of output is being produced, whether it be an executable file,
1553 an object file, an assembler file or preprocessed C code.
1554
1555 If @option{-o} is not specified, the default is to put an executable
1556 file in @file{a.out}, the object file for
1557 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1558 assembler file in @file{@var{source}.s}, a precompiled header file in
1559 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1560 standard output.
1561
1562 @item -v
1563 @opindex v
1564 Print (on standard error output) the commands executed to run the stages
1565 of compilation. Also print the version number of the compiler driver
1566 program and of the preprocessor and the compiler proper.
1567
1568 @item -###
1569 @opindex ###
1570 Like @option{-v} except the commands are not executed and arguments
1571 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1572 This is useful for shell scripts to capture the driver-generated command lines.
1573
1574 @item --help
1575 @opindex help
1576 Print (on the standard output) a description of the command-line options
1577 understood by @command{gcc}. If the @option{-v} option is also specified
1578 then @option{--help} is also passed on to the various processes
1579 invoked by @command{gcc}, so that they can display the command-line options
1580 they accept. If the @option{-Wextra} option has also been specified
1581 (prior to the @option{--help} option), then command-line options that
1582 have no documentation associated with them are also displayed.
1583
1584 @item --target-help
1585 @opindex target-help
1586 Print (on the standard output) a description of target-specific command-line
1587 options for each tool. For some targets extra target-specific
1588 information may also be printed.
1589
1590 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1591 Print (on the standard output) a description of the command-line
1592 options understood by the compiler that fit into all specified classes
1593 and qualifiers. These are the supported classes:
1594
1595 @table @asis
1596 @item @samp{optimizers}
1597 Display all of the optimization options supported by the
1598 compiler.
1599
1600 @item @samp{warnings}
1601 Display all of the options controlling warning messages
1602 produced by the compiler.
1603
1604 @item @samp{target}
1605 Display target-specific options. Unlike the
1606 @option{--target-help} option however, target-specific options of the
1607 linker and assembler are not displayed. This is because those
1608 tools do not currently support the extended @option{--help=} syntax.
1609
1610 @item @samp{params}
1611 Display the values recognized by the @option{--param}
1612 option.
1613
1614 @item @var{language}
1615 Display the options supported for @var{language}, where
1616 @var{language} is the name of one of the languages supported in this
1617 version of GCC@.
1618
1619 @item @samp{common}
1620 Display the options that are common to all languages.
1621 @end table
1622
1623 These are the supported qualifiers:
1624
1625 @table @asis
1626 @item @samp{undocumented}
1627 Display only those options that are undocumented.
1628
1629 @item @samp{joined}
1630 Display options taking an argument that appears after an equal
1631 sign in the same continuous piece of text, such as:
1632 @samp{--help=target}.
1633
1634 @item @samp{separate}
1635 Display options taking an argument that appears as a separate word
1636 following the original option, such as: @samp{-o output-file}.
1637 @end table
1638
1639 Thus for example to display all the undocumented target-specific
1640 switches supported by the compiler, use:
1641
1642 @smallexample
1643 --help=target,undocumented
1644 @end smallexample
1645
1646 The sense of a qualifier can be inverted by prefixing it with the
1647 @samp{^} character, so for example to display all binary warning
1648 options (i.e., ones that are either on or off and that do not take an
1649 argument) that have a description, use:
1650
1651 @smallexample
1652 --help=warnings,^joined,^undocumented
1653 @end smallexample
1654
1655 The argument to @option{--help=} should not consist solely of inverted
1656 qualifiers.
1657
1658 Combining several classes is possible, although this usually
1659 restricts the output so much that there is nothing to display. One
1660 case where it does work, however, is when one of the classes is
1661 @var{target}. For example, to display all the target-specific
1662 optimization options, use:
1663
1664 @smallexample
1665 --help=target,optimizers
1666 @end smallexample
1667
1668 The @option{--help=} option can be repeated on the command line. Each
1669 successive use displays its requested class of options, skipping
1670 those that have already been displayed. If @option{--help} is also
1671 specified anywhere on the command line then this takes precedence
1672 over any @option{--help=} option.
1673
1674 If the @option{-Q} option appears on the command line before the
1675 @option{--help=} option, then the descriptive text displayed by
1676 @option{--help=} is changed. Instead of describing the displayed
1677 options, an indication is given as to whether the option is enabled,
1678 disabled or set to a specific value (assuming that the compiler
1679 knows this at the point where the @option{--help=} option is used).
1680
1681 Here is a truncated example from the ARM port of @command{gcc}:
1682
1683 @smallexample
1684 % gcc -Q -mabi=2 --help=target -c
1685 The following options are target specific:
1686 -mabi= 2
1687 -mabort-on-noreturn [disabled]
1688 -mapcs [disabled]
1689 @end smallexample
1690
1691 The output is sensitive to the effects of previous command-line
1692 options, so for example it is possible to find out which optimizations
1693 are enabled at @option{-O2} by using:
1694
1695 @smallexample
1696 -Q -O2 --help=optimizers
1697 @end smallexample
1698
1699 Alternatively you can discover which binary optimizations are enabled
1700 by @option{-O3} by using:
1701
1702 @smallexample
1703 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1704 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1705 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1706 @end smallexample
1707
1708 @item --version
1709 @opindex version
1710 Display the version number and copyrights of the invoked GCC@.
1711
1712 @item -pass-exit-codes
1713 @opindex pass-exit-codes
1714 Normally the @command{gcc} program exits with the code of 1 if any
1715 phase of the compiler returns a non-success return code. If you specify
1716 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1717 the numerically highest error produced by any phase returning an error
1718 indication. The C, C++, and Fortran front ends return 4 if an internal
1719 compiler error is encountered.
1720
1721 @item -pipe
1722 @opindex pipe
1723 Use pipes rather than temporary files for communication between the
1724 various stages of compilation. This fails to work on some systems where
1725 the assembler is unable to read from a pipe; but the GNU assembler has
1726 no trouble.
1727
1728 @item -specs=@var{file}
1729 @opindex specs
1730 Process @var{file} after the compiler reads in the standard @file{specs}
1731 file, in order to override the defaults which the @command{gcc} driver
1732 program uses when determining what switches to pass to @command{cc1},
1733 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1734 @option{-specs=@var{file}} can be specified on the command line, and they
1735 are processed in order, from left to right. @xref{Spec Files}, for
1736 information about the format of the @var{file}.
1737
1738 @item -wrapper
1739 @opindex wrapper
1740 Invoke all subcommands under a wrapper program. The name of the
1741 wrapper program and its parameters are passed as a comma separated
1742 list.
1743
1744 @smallexample
1745 gcc -c t.c -wrapper gdb,--args
1746 @end smallexample
1747
1748 @noindent
1749 This invokes all subprograms of @command{gcc} under
1750 @samp{gdb --args}, thus the invocation of @command{cc1} is
1751 @samp{gdb --args cc1 @dots{}}.
1752
1753 @item -ffile-prefix-map=@var{old}=@var{new}
1754 @opindex ffile-prefix-map
1755 When compiling files residing in directory @file{@var{old}}, record
1756 any references to them in the result of the compilation as if the
1757 files resided in directory @file{@var{new}} instead. Specifying this
1758 option is equivalent to specifying all the individual
1759 @option{-f*-prefix-map} options. This can be used to make reproducible
1760 builds that are location independent. See also
1761 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1762
1763 @item -fplugin=@var{name}.so
1764 @opindex fplugin
1765 Load the plugin code in file @var{name}.so, assumed to be a
1766 shared object to be dlopen'd by the compiler. The base name of
1767 the shared object file is used to identify the plugin for the
1768 purposes of argument parsing (See
1769 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1770 Each plugin should define the callback functions specified in the
1771 Plugins API.
1772
1773 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1774 @opindex fplugin-arg
1775 Define an argument called @var{key} with a value of @var{value}
1776 for the plugin called @var{name}.
1777
1778 @item -fdump-ada-spec@r{[}-slim@r{]}
1779 @opindex fdump-ada-spec
1780 For C and C++ source and include files, generate corresponding Ada specs.
1781 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1782 GNAT User's Guide}, which provides detailed documentation on this feature.
1783
1784 @item -fada-spec-parent=@var{unit}
1785 @opindex fada-spec-parent
1786 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1787 Ada specs as child units of parent @var{unit}.
1788
1789 @item -fdump-go-spec=@var{file}
1790 @opindex fdump-go-spec
1791 For input files in any language, generate corresponding Go
1792 declarations in @var{file}. This generates Go @code{const},
1793 @code{type}, @code{var}, and @code{func} declarations which may be a
1794 useful way to start writing a Go interface to code written in some
1795 other language.
1796
1797 @include @value{srcdir}/../libiberty/at-file.texi
1798 @end table
1799
1800 @node Invoking G++
1801 @section Compiling C++ Programs
1802
1803 @cindex suffixes for C++ source
1804 @cindex C++ source file suffixes
1805 C++ source files conventionally use one of the suffixes @samp{.C},
1806 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1807 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1808 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1809 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1810 files with these names and compiles them as C++ programs even if you
1811 call the compiler the same way as for compiling C programs (usually
1812 with the name @command{gcc}).
1813
1814 @findex g++
1815 @findex c++
1816 However, the use of @command{gcc} does not add the C++ library.
1817 @command{g++} is a program that calls GCC and automatically specifies linking
1818 against the C++ library. It treats @samp{.c},
1819 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1820 files unless @option{-x} is used. This program is also useful when
1821 precompiling a C header file with a @samp{.h} extension for use in C++
1822 compilations. On many systems, @command{g++} is also installed with
1823 the name @command{c++}.
1824
1825 @cindex invoking @command{g++}
1826 When you compile C++ programs, you may specify many of the same
1827 command-line options that you use for compiling programs in any
1828 language; or command-line options meaningful for C and related
1829 languages; or options that are meaningful only for C++ programs.
1830 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1831 explanations of options for languages related to C@.
1832 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1833 explanations of options that are meaningful only for C++ programs.
1834
1835 @node C Dialect Options
1836 @section Options Controlling C Dialect
1837 @cindex dialect options
1838 @cindex language dialect options
1839 @cindex options, dialect
1840
1841 The following options control the dialect of C (or languages derived
1842 from C, such as C++, Objective-C and Objective-C++) that the compiler
1843 accepts:
1844
1845 @table @gcctabopt
1846 @cindex ANSI support
1847 @cindex ISO support
1848 @item -ansi
1849 @opindex ansi
1850 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1851 equivalent to @option{-std=c++98}.
1852
1853 This turns off certain features of GCC that are incompatible with ISO
1854 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1855 such as the @code{asm} and @code{typeof} keywords, and
1856 predefined macros such as @code{unix} and @code{vax} that identify the
1857 type of system you are using. It also enables the undesirable and
1858 rarely used ISO trigraph feature. For the C compiler,
1859 it disables recognition of C++ style @samp{//} comments as well as
1860 the @code{inline} keyword.
1861
1862 The alternate keywords @code{__asm__}, @code{__extension__},
1863 @code{__inline__} and @code{__typeof__} continue to work despite
1864 @option{-ansi}. You would not want to use them in an ISO C program, of
1865 course, but it is useful to put them in header files that might be included
1866 in compilations done with @option{-ansi}. Alternate predefined macros
1867 such as @code{__unix__} and @code{__vax__} are also available, with or
1868 without @option{-ansi}.
1869
1870 The @option{-ansi} option does not cause non-ISO programs to be
1871 rejected gratuitously. For that, @option{-Wpedantic} is required in
1872 addition to @option{-ansi}. @xref{Warning Options}.
1873
1874 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1875 option is used. Some header files may notice this macro and refrain
1876 from declaring certain functions or defining certain macros that the
1877 ISO standard doesn't call for; this is to avoid interfering with any
1878 programs that might use these names for other things.
1879
1880 Functions that are normally built in but do not have semantics
1881 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1882 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1883 built-in functions provided by GCC}, for details of the functions
1884 affected.
1885
1886 @item -std=
1887 @opindex std
1888 Determine the language standard. @xref{Standards,,Language Standards
1889 Supported by GCC}, for details of these standard versions. This option
1890 is currently only supported when compiling C or C++.
1891
1892 The compiler can accept several base standards, such as @samp{c90} or
1893 @samp{c++98}, and GNU dialects of those standards, such as
1894 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1895 compiler accepts all programs following that standard plus those
1896 using GNU extensions that do not contradict it. For example,
1897 @option{-std=c90} turns off certain features of GCC that are
1898 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1899 keywords, but not other GNU extensions that do not have a meaning in
1900 ISO C90, such as omitting the middle term of a @code{?:}
1901 expression. On the other hand, when a GNU dialect of a standard is
1902 specified, all features supported by the compiler are enabled, even when
1903 those features change the meaning of the base standard. As a result, some
1904 strict-conforming programs may be rejected. The particular standard
1905 is used by @option{-Wpedantic} to identify which features are GNU
1906 extensions given that version of the standard. For example
1907 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1908 comments, while @option{-std=gnu99 -Wpedantic} does not.
1909
1910 A value for this option must be provided; possible values are
1911
1912 @table @samp
1913 @item c90
1914 @itemx c89
1915 @itemx iso9899:1990
1916 Support all ISO C90 programs (certain GNU extensions that conflict
1917 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1918
1919 @item iso9899:199409
1920 ISO C90 as modified in amendment 1.
1921
1922 @item c99
1923 @itemx c9x
1924 @itemx iso9899:1999
1925 @itemx iso9899:199x
1926 ISO C99. This standard is substantially completely supported, modulo
1927 bugs and floating-point issues
1928 (mainly but not entirely relating to optional C99 features from
1929 Annexes F and G). See
1930 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1931 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1932
1933 @item c11
1934 @itemx c1x
1935 @itemx iso9899:2011
1936 ISO C11, the 2011 revision of the ISO C standard. This standard is
1937 substantially completely supported, modulo bugs, floating-point issues
1938 (mainly but not entirely relating to optional C11 features from
1939 Annexes F and G) and the optional Annexes K (Bounds-checking
1940 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1941
1942 @item c17
1943 @itemx c18
1944 @itemx iso9899:2017
1945 @itemx iso9899:2018
1946 ISO C17, the 2017 revision of the ISO C standard
1947 (published in 2018). This standard is
1948 same as C11 except for corrections of defects (all of which are also
1949 applied with @option{-std=c11}) and a new value of
1950 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1951
1952 @item c2x
1953 The next version of the ISO C standard, still under development. The
1954 support for this version is experimental and incomplete.
1955
1956 @item gnu90
1957 @itemx gnu89
1958 GNU dialect of ISO C90 (including some C99 features).
1959
1960 @item gnu99
1961 @itemx gnu9x
1962 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1963
1964 @item gnu11
1965 @itemx gnu1x
1966 GNU dialect of ISO C11.
1967 The name @samp{gnu1x} is deprecated.
1968
1969 @item gnu17
1970 @itemx gnu18
1971 GNU dialect of ISO C17. This is the default for C code.
1972
1973 @item gnu2x
1974 The next version of the ISO C standard, still under development, plus
1975 GNU extensions. The support for this version is experimental and
1976 incomplete.
1977
1978 @item c++98
1979 @itemx c++03
1980 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1981 additional defect reports. Same as @option{-ansi} for C++ code.
1982
1983 @item gnu++98
1984 @itemx gnu++03
1985 GNU dialect of @option{-std=c++98}.
1986
1987 @item c++11
1988 @itemx c++0x
1989 The 2011 ISO C++ standard plus amendments.
1990 The name @samp{c++0x} is deprecated.
1991
1992 @item gnu++11
1993 @itemx gnu++0x
1994 GNU dialect of @option{-std=c++11}.
1995 The name @samp{gnu++0x} is deprecated.
1996
1997 @item c++14
1998 @itemx c++1y
1999 The 2014 ISO C++ standard plus amendments.
2000 The name @samp{c++1y} is deprecated.
2001
2002 @item gnu++14
2003 @itemx gnu++1y
2004 GNU dialect of @option{-std=c++14}.
2005 This is the default for C++ code.
2006 The name @samp{gnu++1y} is deprecated.
2007
2008 @item c++17
2009 @itemx c++1z
2010 The 2017 ISO C++ standard plus amendments.
2011 The name @samp{c++1z} is deprecated.
2012
2013 @item gnu++17
2014 @itemx gnu++1z
2015 GNU dialect of @option{-std=c++17}.
2016 The name @samp{gnu++1z} is deprecated.
2017
2018 @item c++2a
2019 The next revision of the ISO C++ standard, tentatively planned for
2020 2020. Support is highly experimental, and will almost certainly
2021 change in incompatible ways in future releases.
2022
2023 @item gnu++2a
2024 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2025 and will almost certainly change in incompatible ways in future
2026 releases.
2027 @end table
2028
2029 @item -fgnu89-inline
2030 @opindex fgnu89-inline
2031 The option @option{-fgnu89-inline} tells GCC to use the traditional
2032 GNU semantics for @code{inline} functions when in C99 mode.
2033 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2034 Using this option is roughly equivalent to adding the
2035 @code{gnu_inline} function attribute to all inline functions
2036 (@pxref{Function Attributes}).
2037
2038 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2039 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2040 specifies the default behavior).
2041 This option is not supported in @option{-std=c90} or
2042 @option{-std=gnu90} mode.
2043
2044 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2045 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2046 in effect for @code{inline} functions. @xref{Common Predefined
2047 Macros,,,cpp,The C Preprocessor}.
2048
2049 @item -fpermitted-flt-eval-methods=@var{style}
2050 @opindex fpermitted-flt-eval-methods
2051 @opindex fpermitted-flt-eval-methods=c11
2052 @opindex fpermitted-flt-eval-methods=ts-18661-3
2053 ISO/IEC TS 18661-3 defines new permissible values for
2054 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2055 a semantic type that is an interchange or extended format should be
2056 evaluated to the precision and range of that type. These new values are
2057 a superset of those permitted under C99/C11, which does not specify the
2058 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2059 conforming to C11 may not have been written expecting the possibility of
2060 the new values.
2061
2062 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2063 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2064 or the extended set of values specified in ISO/IEC TS 18661-3.
2065
2066 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2067
2068 The default when in a standards compliant mode (@option{-std=c11} or similar)
2069 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2070 dialect (@option{-std=gnu11} or similar) is
2071 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2072
2073 @item -aux-info @var{filename}
2074 @opindex aux-info
2075 Output to the given filename prototyped declarations for all functions
2076 declared and/or defined in a translation unit, including those in header
2077 files. This option is silently ignored in any language other than C@.
2078
2079 Besides declarations, the file indicates, in comments, the origin of
2080 each declaration (source file and line), whether the declaration was
2081 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2082 @samp{O} for old, respectively, in the first character after the line
2083 number and the colon), and whether it came from a declaration or a
2084 definition (@samp{C} or @samp{F}, respectively, in the following
2085 character). In the case of function definitions, a K&R-style list of
2086 arguments followed by their declarations is also provided, inside
2087 comments, after the declaration.
2088
2089 @item -fallow-parameterless-variadic-functions
2090 @opindex fallow-parameterless-variadic-functions
2091 Accept variadic functions without named parameters.
2092
2093 Although it is possible to define such a function, this is not very
2094 useful as it is not possible to read the arguments. This is only
2095 supported for C as this construct is allowed by C++.
2096
2097 @item -fno-asm
2098 @opindex fno-asm
2099 @opindex fasm
2100 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2101 keyword, so that code can use these words as identifiers. You can use
2102 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2103 instead. @option{-ansi} implies @option{-fno-asm}.
2104
2105 In C++, this switch only affects the @code{typeof} keyword, since
2106 @code{asm} and @code{inline} are standard keywords. You may want to
2107 use the @option{-fno-gnu-keywords} flag instead, which has the same
2108 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2109 switch only affects the @code{asm} and @code{typeof} keywords, since
2110 @code{inline} is a standard keyword in ISO C99.
2111
2112 @item -fno-builtin
2113 @itemx -fno-builtin-@var{function}
2114 @opindex fno-builtin
2115 @opindex fbuiltin
2116 @cindex built-in functions
2117 Don't recognize built-in functions that do not begin with
2118 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2119 functions provided by GCC}, for details of the functions affected,
2120 including those which are not built-in functions when @option{-ansi} or
2121 @option{-std} options for strict ISO C conformance are used because they
2122 do not have an ISO standard meaning.
2123
2124 GCC normally generates special code to handle certain built-in functions
2125 more efficiently; for instance, calls to @code{alloca} may become single
2126 instructions which adjust the stack directly, and calls to @code{memcpy}
2127 may become inline copy loops. The resulting code is often both smaller
2128 and faster, but since the function calls no longer appear as such, you
2129 cannot set a breakpoint on those calls, nor can you change the behavior
2130 of the functions by linking with a different library. In addition,
2131 when a function is recognized as a built-in function, GCC may use
2132 information about that function to warn about problems with calls to
2133 that function, or to generate more efficient code, even if the
2134 resulting code still contains calls to that function. For example,
2135 warnings are given with @option{-Wformat} for bad calls to
2136 @code{printf} when @code{printf} is built in and @code{strlen} is
2137 known not to modify global memory.
2138
2139 With the @option{-fno-builtin-@var{function}} option
2140 only the built-in function @var{function} is
2141 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2142 function is named that is not built-in in this version of GCC, this
2143 option is ignored. There is no corresponding
2144 @option{-fbuiltin-@var{function}} option; if you wish to enable
2145 built-in functions selectively when using @option{-fno-builtin} or
2146 @option{-ffreestanding}, you may define macros such as:
2147
2148 @smallexample
2149 #define abs(n) __builtin_abs ((n))
2150 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2151 @end smallexample
2152
2153 @item -fgimple
2154 @opindex fgimple
2155
2156 Enable parsing of function definitions marked with @code{__GIMPLE}.
2157 This is an experimental feature that allows unit testing of GIMPLE
2158 passes.
2159
2160 @item -fhosted
2161 @opindex fhosted
2162 @cindex hosted environment
2163
2164 Assert that compilation targets a hosted environment. This implies
2165 @option{-fbuiltin}. A hosted environment is one in which the
2166 entire standard library is available, and in which @code{main} has a return
2167 type of @code{int}. Examples are nearly everything except a kernel.
2168 This is equivalent to @option{-fno-freestanding}.
2169
2170 @item -ffreestanding
2171 @opindex ffreestanding
2172 @cindex hosted environment
2173
2174 Assert that compilation targets a freestanding environment. This
2175 implies @option{-fno-builtin}. A freestanding environment
2176 is one in which the standard library may not exist, and program startup may
2177 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2178 This is equivalent to @option{-fno-hosted}.
2179
2180 @xref{Standards,,Language Standards Supported by GCC}, for details of
2181 freestanding and hosted environments.
2182
2183 @item -fopenacc
2184 @opindex fopenacc
2185 @cindex OpenACC accelerator programming
2186 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2187 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2188 compiler generates accelerated code according to the OpenACC Application
2189 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2190 implies @option{-pthread}, and thus is only supported on targets that
2191 have support for @option{-pthread}.
2192
2193 @item -fopenacc-dim=@var{geom}
2194 @opindex fopenacc-dim
2195 @cindex OpenACC accelerator programming
2196 Specify default compute dimensions for parallel offload regions that do
2197 not explicitly specify. The @var{geom} value is a triple of
2198 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2199 can be omitted, to use a target-specific default value.
2200
2201 @item -fopenmp
2202 @opindex fopenmp
2203 @cindex OpenMP parallel
2204 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2205 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2206 compiler generates parallel code according to the OpenMP Application
2207 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2208 implies @option{-pthread}, and thus is only supported on targets that
2209 have support for @option{-pthread}. @option{-fopenmp} implies
2210 @option{-fopenmp-simd}.
2211
2212 @item -fopenmp-simd
2213 @opindex fopenmp-simd
2214 @cindex OpenMP SIMD
2215 @cindex SIMD
2216 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2217 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2218 are ignored.
2219
2220 @item -fgnu-tm
2221 @opindex fgnu-tm
2222 When the option @option{-fgnu-tm} is specified, the compiler
2223 generates code for the Linux variant of Intel's current Transactional
2224 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2225 an experimental feature whose interface may change in future versions
2226 of GCC, as the official specification changes. Please note that not
2227 all architectures are supported for this feature.
2228
2229 For more information on GCC's support for transactional memory,
2230 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2231 Transactional Memory Library}.
2232
2233 Note that the transactional memory feature is not supported with
2234 non-call exceptions (@option{-fnon-call-exceptions}).
2235
2236 @item -fms-extensions
2237 @opindex fms-extensions
2238 Accept some non-standard constructs used in Microsoft header files.
2239
2240 In C++ code, this allows member names in structures to be similar
2241 to previous types declarations.
2242
2243 @smallexample
2244 typedef int UOW;
2245 struct ABC @{
2246 UOW UOW;
2247 @};
2248 @end smallexample
2249
2250 Some cases of unnamed fields in structures and unions are only
2251 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2252 fields within structs/unions}, for details.
2253
2254 Note that this option is off for all targets except for x86
2255 targets using ms-abi.
2256
2257 @item -fplan9-extensions
2258 @opindex fplan9-extensions
2259 Accept some non-standard constructs used in Plan 9 code.
2260
2261 This enables @option{-fms-extensions}, permits passing pointers to
2262 structures with anonymous fields to functions that expect pointers to
2263 elements of the type of the field, and permits referring to anonymous
2264 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2265 struct/union fields within structs/unions}, for details. This is only
2266 supported for C, not C++.
2267
2268 @item -fcond-mismatch
2269 @opindex fcond-mismatch
2270 Allow conditional expressions with mismatched types in the second and
2271 third arguments. The value of such an expression is void. This option
2272 is not supported for C++.
2273
2274 @item -flax-vector-conversions
2275 @opindex flax-vector-conversions
2276 Allow implicit conversions between vectors with differing numbers of
2277 elements and/or incompatible element types. This option should not be
2278 used for new code.
2279
2280 @item -funsigned-char
2281 @opindex funsigned-char
2282 Let the type @code{char} be unsigned, like @code{unsigned char}.
2283
2284 Each kind of machine has a default for what @code{char} should
2285 be. It is either like @code{unsigned char} by default or like
2286 @code{signed char} by default.
2287
2288 Ideally, a portable program should always use @code{signed char} or
2289 @code{unsigned char} when it depends on the signedness of an object.
2290 But many programs have been written to use plain @code{char} and
2291 expect it to be signed, or expect it to be unsigned, depending on the
2292 machines they were written for. This option, and its inverse, let you
2293 make such a program work with the opposite default.
2294
2295 The type @code{char} is always a distinct type from each of
2296 @code{signed char} or @code{unsigned char}, even though its behavior
2297 is always just like one of those two.
2298
2299 @item -fsigned-char
2300 @opindex fsigned-char
2301 Let the type @code{char} be signed, like @code{signed char}.
2302
2303 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2304 the negative form of @option{-funsigned-char}. Likewise, the option
2305 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2306
2307 @item -fsigned-bitfields
2308 @itemx -funsigned-bitfields
2309 @itemx -fno-signed-bitfields
2310 @itemx -fno-unsigned-bitfields
2311 @opindex fsigned-bitfields
2312 @opindex funsigned-bitfields
2313 @opindex fno-signed-bitfields
2314 @opindex fno-unsigned-bitfields
2315 These options control whether a bit-field is signed or unsigned, when the
2316 declaration does not use either @code{signed} or @code{unsigned}. By
2317 default, such a bit-field is signed, because this is consistent: the
2318 basic integer types such as @code{int} are signed types.
2319
2320 @item -fsso-struct=@var{endianness}
2321 @opindex fsso-struct
2322 Set the default scalar storage order of structures and unions to the
2323 specified endianness. The accepted values are @samp{big-endian},
2324 @samp{little-endian} and @samp{native} for the native endianness of
2325 the target (the default). This option is not supported for C++.
2326
2327 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2328 code that is not binary compatible with code generated without it if the
2329 specified endianness is not the native endianness of the target.
2330 @end table
2331
2332 @node C++ Dialect Options
2333 @section Options Controlling C++ Dialect
2334
2335 @cindex compiler options, C++
2336 @cindex C++ options, command-line
2337 @cindex options, C++
2338 This section describes the command-line options that are only meaningful
2339 for C++ programs. You can also use most of the GNU compiler options
2340 regardless of what language your program is in. For example, you
2341 might compile a file @file{firstClass.C} like this:
2342
2343 @smallexample
2344 g++ -g -fstrict-enums -O -c firstClass.C
2345 @end smallexample
2346
2347 @noindent
2348 In this example, only @option{-fstrict-enums} is an option meant
2349 only for C++ programs; you can use the other options with any
2350 language supported by GCC@.
2351
2352 Some options for compiling C programs, such as @option{-std}, are also
2353 relevant for C++ programs.
2354 @xref{C Dialect Options,,Options Controlling C Dialect}.
2355
2356 Here is a list of options that are @emph{only} for compiling C++ programs:
2357
2358 @table @gcctabopt
2359
2360 @item -fabi-version=@var{n}
2361 @opindex fabi-version
2362 Use version @var{n} of the C++ ABI@. The default is version 0.
2363
2364 Version 0 refers to the version conforming most closely to
2365 the C++ ABI specification. Therefore, the ABI obtained using version 0
2366 will change in different versions of G++ as ABI bugs are fixed.
2367
2368 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2369
2370 Version 2 is the version of the C++ ABI that first appeared in G++
2371 3.4, and was the default through G++ 4.9.
2372
2373 Version 3 corrects an error in mangling a constant address as a
2374 template argument.
2375
2376 Version 4, which first appeared in G++ 4.5, implements a standard
2377 mangling for vector types.
2378
2379 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2380 attribute const/volatile on function pointer types, decltype of a
2381 plain decl, and use of a function parameter in the declaration of
2382 another parameter.
2383
2384 Version 6, which first appeared in G++ 4.7, corrects the promotion
2385 behavior of C++11 scoped enums and the mangling of template argument
2386 packs, const/static_cast, prefix ++ and --, and a class scope function
2387 used as a template argument.
2388
2389 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2390 builtin type and corrects the mangling of lambdas in default argument
2391 scope.
2392
2393 Version 8, which first appeared in G++ 4.9, corrects the substitution
2394 behavior of function types with function-cv-qualifiers.
2395
2396 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2397 @code{nullptr_t}.
2398
2399 Version 10, which first appeared in G++ 6.1, adds mangling of
2400 attributes that affect type identity, such as ia32 calling convention
2401 attributes (e.g.@: @samp{stdcall}).
2402
2403 Version 11, which first appeared in G++ 7, corrects the mangling of
2404 sizeof... expressions and operator names. For multiple entities with
2405 the same name within a function, that are declared in different scopes,
2406 the mangling now changes starting with the twelfth occurrence. It also
2407 implies @option{-fnew-inheriting-ctors}.
2408
2409 Version 12, which first appeared in G++ 8, corrects the calling
2410 conventions for empty classes on the x86_64 target and for classes
2411 with only deleted copy/move constructors. It accidentally changes the
2412 calling convention for classes with a deleted copy constructor and a
2413 trivial move constructor.
2414
2415 Version 13, which first appeared in G++ 8.2, fixes the accidental
2416 change in version 12.
2417
2418 Version 14, which first appeared in G++ 10, corrects the mangling of
2419 the nullptr expression.
2420
2421 See also @option{-Wabi}.
2422
2423 @item -fabi-compat-version=@var{n}
2424 @opindex fabi-compat-version
2425 On targets that support strong aliases, G++
2426 works around mangling changes by creating an alias with the correct
2427 mangled name when defining a symbol with an incorrect mangled name.
2428 This switch specifies which ABI version to use for the alias.
2429
2430 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2431 compatibility). If another ABI version is explicitly selected, this
2432 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2433 use @option{-fabi-compat-version=2}.
2434
2435 If this option is not provided but @option{-Wabi=@var{n}} is, that
2436 version is used for compatibility aliases. If this option is provided
2437 along with @option{-Wabi} (without the version), the version from this
2438 option is used for the warning.
2439
2440 @item -fno-access-control
2441 @opindex fno-access-control
2442 @opindex faccess-control
2443 Turn off all access checking. This switch is mainly useful for working
2444 around bugs in the access control code.
2445
2446 @item -faligned-new
2447 @opindex faligned-new
2448 Enable support for C++17 @code{new} of types that require more
2449 alignment than @code{void* ::operator new(std::size_t)} provides. A
2450 numeric argument such as @code{-faligned-new=32} can be used to
2451 specify how much alignment (in bytes) is provided by that function,
2452 but few users will need to override the default of
2453 @code{alignof(std::max_align_t)}.
2454
2455 This flag is enabled by default for @option{-std=c++17}.
2456
2457 @item -fchar8_t
2458 @itemx -fno-char8_t
2459 @opindex fchar8_t
2460 @opindex fno-char8_t
2461 Enable support for @code{char8_t} as adopted for C++2a. This includes
2462 the addition of a new @code{char8_t} fundamental type, changes to the
2463 types of UTF-8 string and character literals, new signatures for
2464 user-defined literals, associated standard library updates, and new
2465 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2466
2467 This option enables functions to be overloaded for ordinary and UTF-8
2468 strings:
2469
2470 @smallexample
2471 int f(const char *); // #1
2472 int f(const char8_t *); // #2
2473 int v1 = f("text"); // Calls #1
2474 int v2 = f(u8"text"); // Calls #2
2475 @end smallexample
2476
2477 @noindent
2478 and introduces new signatures for user-defined literals:
2479
2480 @smallexample
2481 int operator""_udl1(char8_t);
2482 int v3 = u8'x'_udl1;
2483 int operator""_udl2(const char8_t*, std::size_t);
2484 int v4 = u8"text"_udl2;
2485 template<typename T, T...> int operator""_udl3();
2486 int v5 = u8"text"_udl3;
2487 @end smallexample
2488
2489 @noindent
2490 The change to the types of UTF-8 string and character literals introduces
2491 incompatibilities with ISO C++11 and later standards. For example, the
2492 following code is well-formed under ISO C++11, but is ill-formed when
2493 @option{-fchar8_t} is specified.
2494
2495 @smallexample
2496 char ca[] = u8"xx"; // error: char-array initialized from wide
2497 // string
2498 const char *cp = u8"xx";// error: invalid conversion from
2499 // `const char8_t*' to `const char*'
2500 int f(const char*);
2501 auto v = f(u8"xx"); // error: invalid conversion from
2502 // `const char8_t*' to `const char*'
2503 std::string s@{u8"xx"@}; // error: no matching function for call to
2504 // `std::basic_string<char>::basic_string()'
2505 using namespace std::literals;
2506 s = u8"xx"s; // error: conversion from
2507 // `basic_string<char8_t>' to non-scalar
2508 // type `basic_string<char>' requested
2509 @end smallexample
2510
2511 @item -fcheck-new
2512 @opindex fcheck-new
2513 Check that the pointer returned by @code{operator new} is non-null
2514 before attempting to modify the storage allocated. This check is
2515 normally unnecessary because the C++ standard specifies that
2516 @code{operator new} only returns @code{0} if it is declared
2517 @code{throw()}, in which case the compiler always checks the
2518 return value even without this option. In all other cases, when
2519 @code{operator new} has a non-empty exception specification, memory
2520 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2521 @samp{new (nothrow)}.
2522
2523 @item -fconcepts
2524 @itemx -fconcepts-ts
2525 @opindex fconcepts
2526 @opindex fconcepts-ts
2527 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2528 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2529
2530 With @option{-std=c++2a} and above, Concepts are part of the language
2531 standard, so @option{-fconcepts} defaults to on. But the standard
2532 specification of Concepts differs significantly from the TS, so some
2533 constructs that were allowed in the TS but didn't make it into the
2534 standard can still be enabled by @option{-fconcepts-ts}.
2535
2536 @item -fconstexpr-depth=@var{n}
2537 @opindex fconstexpr-depth
2538 Set the maximum nested evaluation depth for C++11 constexpr functions
2539 to @var{n}. A limit is needed to detect endless recursion during
2540 constant expression evaluation. The minimum specified by the standard
2541 is 512.
2542
2543 @item -fconstexpr-cache-depth=@var{n}
2544 @opindex fconstexpr-cache-depth
2545 Set the maximum level of nested evaluation depth for C++11 constexpr
2546 functions that will be cached to @var{n}. This is a heuristic that
2547 trades off compilation speed (when the cache avoids repeated
2548 calculations) against memory consumption (when the cache grows very
2549 large from highly recursive evaluations). The default is 8. Very few
2550 users are likely to want to adjust it, but if your code does heavy
2551 constexpr calculations you might want to experiment to find which
2552 value works best for you.
2553
2554 @item -fconstexpr-loop-limit=@var{n}
2555 @opindex fconstexpr-loop-limit
2556 Set the maximum number of iterations for a loop in C++14 constexpr functions
2557 to @var{n}. A limit is needed to detect infinite loops during
2558 constant expression evaluation. The default is 262144 (1<<18).
2559
2560 @item -fconstexpr-ops-limit=@var{n}
2561 @opindex fconstexpr-ops-limit
2562 Set the maximum number of operations during a single constexpr evaluation.
2563 Even when number of iterations of a single loop is limited with the above limit,
2564 if there are several nested loops and each of them has many iterations but still
2565 smaller than the above limit, or if in a body of some loop or even outside
2566 of a loop too many expressions need to be evaluated, the resulting constexpr
2567 evaluation might take too long.
2568 The default is 33554432 (1<<25).
2569
2570 @item -fno-elide-constructors
2571 @opindex fno-elide-constructors
2572 @opindex felide-constructors
2573 The C++ standard allows an implementation to omit creating a temporary
2574 that is only used to initialize another object of the same type.
2575 Specifying this option disables that optimization, and forces G++ to
2576 call the copy constructor in all cases. This option also causes G++
2577 to call trivial member functions which otherwise would be expanded inline.
2578
2579 In C++17, the compiler is required to omit these temporaries, but this
2580 option still affects trivial member functions.
2581
2582 @item -fno-enforce-eh-specs
2583 @opindex fno-enforce-eh-specs
2584 @opindex fenforce-eh-specs
2585 Don't generate code to check for violation of exception specifications
2586 at run time. This option violates the C++ standard, but may be useful
2587 for reducing code size in production builds, much like defining
2588 @code{NDEBUG}. This does not give user code permission to throw
2589 exceptions in violation of the exception specifications; the compiler
2590 still optimizes based on the specifications, so throwing an
2591 unexpected exception results in undefined behavior at run time.
2592
2593 @item -fextern-tls-init
2594 @itemx -fno-extern-tls-init
2595 @opindex fextern-tls-init
2596 @opindex fno-extern-tls-init
2597 The C++11 and OpenMP standards allow @code{thread_local} and
2598 @code{threadprivate} variables to have dynamic (runtime)
2599 initialization. To support this, any use of such a variable goes
2600 through a wrapper function that performs any necessary initialization.
2601 When the use and definition of the variable are in the same
2602 translation unit, this overhead can be optimized away, but when the
2603 use is in a different translation unit there is significant overhead
2604 even if the variable doesn't actually need dynamic initialization. If
2605 the programmer can be sure that no use of the variable in a
2606 non-defining TU needs to trigger dynamic initialization (either
2607 because the variable is statically initialized, or a use of the
2608 variable in the defining TU will be executed before any uses in
2609 another TU), they can avoid this overhead with the
2610 @option{-fno-extern-tls-init} option.
2611
2612 On targets that support symbol aliases, the default is
2613 @option{-fextern-tls-init}. On targets that do not support symbol
2614 aliases, the default is @option{-fno-extern-tls-init}.
2615
2616 @item -fno-gnu-keywords
2617 @opindex fno-gnu-keywords
2618 @opindex fgnu-keywords
2619 Do not recognize @code{typeof} as a keyword, so that code can use this
2620 word as an identifier. You can use the keyword @code{__typeof__} instead.
2621 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2622 @option{-std=c++98}, @option{-std=c++11}, etc.
2623
2624 @item -fno-implicit-templates
2625 @opindex fno-implicit-templates
2626 @opindex fimplicit-templates
2627 Never emit code for non-inline templates that are instantiated
2628 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2629 If you use this option, you must take care to structure your code to
2630 include all the necessary explicit instantiations to avoid getting
2631 undefined symbols at link time.
2632 @xref{Template Instantiation}, for more information.
2633
2634 @item -fno-implicit-inline-templates
2635 @opindex fno-implicit-inline-templates
2636 @opindex fimplicit-inline-templates
2637 Don't emit code for implicit instantiations of inline templates, either.
2638 The default is to handle inlines differently so that compiles with and
2639 without optimization need the same set of explicit instantiations.
2640
2641 @item -fno-implement-inlines
2642 @opindex fno-implement-inlines
2643 @opindex fimplement-inlines
2644 To save space, do not emit out-of-line copies of inline functions
2645 controlled by @code{#pragma implementation}. This causes linker
2646 errors if these functions are not inlined everywhere they are called.
2647
2648 @item -fms-extensions
2649 @opindex fms-extensions
2650 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2651 int and getting a pointer to member function via non-standard syntax.
2652
2653 @item -fnew-inheriting-ctors
2654 @opindex fnew-inheriting-ctors
2655 Enable the P0136 adjustment to the semantics of C++11 constructor
2656 inheritance. This is part of C++17 but also considered to be a Defect
2657 Report against C++11 and C++14. This flag is enabled by default
2658 unless @option{-fabi-version=10} or lower is specified.
2659
2660 @item -fnew-ttp-matching
2661 @opindex fnew-ttp-matching
2662 Enable the P0522 resolution to Core issue 150, template template
2663 parameters and default arguments: this allows a template with default
2664 template arguments as an argument for a template template parameter
2665 with fewer template parameters. This flag is enabled by default for
2666 @option{-std=c++17}.
2667
2668 @item -fno-nonansi-builtins
2669 @opindex fno-nonansi-builtins
2670 @opindex fnonansi-builtins
2671 Disable built-in declarations of functions that are not mandated by
2672 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2673 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2674
2675 @item -fnothrow-opt
2676 @opindex fnothrow-opt
2677 Treat a @code{throw()} exception specification as if it were a
2678 @code{noexcept} specification to reduce or eliminate the text size
2679 overhead relative to a function with no exception specification. If
2680 the function has local variables of types with non-trivial
2681 destructors, the exception specification actually makes the
2682 function smaller because the EH cleanups for those variables can be
2683 optimized away. The semantic effect is that an exception thrown out of
2684 a function with such an exception specification results in a call
2685 to @code{terminate} rather than @code{unexpected}.
2686
2687 @item -fno-operator-names
2688 @opindex fno-operator-names
2689 @opindex foperator-names
2690 Do not treat the operator name keywords @code{and}, @code{bitand},
2691 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2692 synonyms as keywords.
2693
2694 @item -fno-optional-diags
2695 @opindex fno-optional-diags
2696 @opindex foptional-diags
2697 Disable diagnostics that the standard says a compiler does not need to
2698 issue. Currently, the only such diagnostic issued by G++ is the one for
2699 a name having multiple meanings within a class.
2700
2701 @item -fpermissive
2702 @opindex fpermissive
2703 Downgrade some diagnostics about nonconformant code from errors to
2704 warnings. Thus, using @option{-fpermissive} allows some
2705 nonconforming code to compile.
2706
2707 @item -fno-pretty-templates
2708 @opindex fno-pretty-templates
2709 @opindex fpretty-templates
2710 When an error message refers to a specialization of a function
2711 template, the compiler normally prints the signature of the
2712 template followed by the template arguments and any typedefs or
2713 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2714 rather than @code{void f(int)}) so that it's clear which template is
2715 involved. When an error message refers to a specialization of a class
2716 template, the compiler omits any template arguments that match
2717 the default template arguments for that template. If either of these
2718 behaviors make it harder to understand the error message rather than
2719 easier, you can use @option{-fno-pretty-templates} to disable them.
2720
2721 @item -fno-rtti
2722 @opindex fno-rtti
2723 @opindex frtti
2724 Disable generation of information about every class with virtual
2725 functions for use by the C++ run-time type identification features
2726 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2727 of the language, you can save some space by using this flag. Note that
2728 exception handling uses the same information, but G++ generates it as
2729 needed. The @code{dynamic_cast} operator can still be used for casts that
2730 do not require run-time type information, i.e.@: casts to @code{void *} or to
2731 unambiguous base classes.
2732
2733 Mixing code compiled with @option{-frtti} with that compiled with
2734 @option{-fno-rtti} may not work. For example, programs may
2735 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2736 for a class compiled with @option{-frtti}.
2737
2738 @item -fsized-deallocation
2739 @opindex fsized-deallocation
2740 Enable the built-in global declarations
2741 @smallexample
2742 void operator delete (void *, std::size_t) noexcept;
2743 void operator delete[] (void *, std::size_t) noexcept;
2744 @end smallexample
2745 as introduced in C++14. This is useful for user-defined replacement
2746 deallocation functions that, for example, use the size of the object
2747 to make deallocation faster. Enabled by default under
2748 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2749 warns about places that might want to add a definition.
2750
2751 @item -fstrict-enums
2752 @opindex fstrict-enums
2753 Allow the compiler to optimize using the assumption that a value of
2754 enumerated type can only be one of the values of the enumeration (as
2755 defined in the C++ standard; basically, a value that can be
2756 represented in the minimum number of bits needed to represent all the
2757 enumerators). This assumption may not be valid if the program uses a
2758 cast to convert an arbitrary integer value to the enumerated type.
2759
2760 @item -fstrong-eval-order
2761 @opindex fstrong-eval-order
2762 Evaluate member access, array subscripting, and shift expressions in
2763 left-to-right order, and evaluate assignment in right-to-left order,
2764 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2765 @option{-fstrong-eval-order=some} enables just the ordering of member
2766 access and shift expressions, and is the default without
2767 @option{-std=c++17}.
2768
2769 @item -ftemplate-backtrace-limit=@var{n}
2770 @opindex ftemplate-backtrace-limit
2771 Set the maximum number of template instantiation notes for a single
2772 warning or error to @var{n}. The default value is 10.
2773
2774 @item -ftemplate-depth=@var{n}
2775 @opindex ftemplate-depth
2776 Set the maximum instantiation depth for template classes to @var{n}.
2777 A limit on the template instantiation depth is needed to detect
2778 endless recursions during template class instantiation. ANSI/ISO C++
2779 conforming programs must not rely on a maximum depth greater than 17
2780 (changed to 1024 in C++11). The default value is 900, as the compiler
2781 can run out of stack space before hitting 1024 in some situations.
2782
2783 @item -fno-threadsafe-statics
2784 @opindex fno-threadsafe-statics
2785 @opindex fthreadsafe-statics
2786 Do not emit the extra code to use the routines specified in the C++
2787 ABI for thread-safe initialization of local statics. You can use this
2788 option to reduce code size slightly in code that doesn't need to be
2789 thread-safe.
2790
2791 @item -fuse-cxa-atexit
2792 @opindex fuse-cxa-atexit
2793 Register destructors for objects with static storage duration with the
2794 @code{__cxa_atexit} function rather than the @code{atexit} function.
2795 This option is required for fully standards-compliant handling of static
2796 destructors, but only works if your C library supports
2797 @code{__cxa_atexit}.
2798
2799 @item -fno-use-cxa-get-exception-ptr
2800 @opindex fno-use-cxa-get-exception-ptr
2801 @opindex fuse-cxa-get-exception-ptr
2802 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2803 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2804 if the runtime routine is not available.
2805
2806 @item -fvisibility-inlines-hidden
2807 @opindex fvisibility-inlines-hidden
2808 This switch declares that the user does not attempt to compare
2809 pointers to inline functions or methods where the addresses of the two functions
2810 are taken in different shared objects.
2811
2812 The effect of this is that GCC may, effectively, mark inline methods with
2813 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2814 appear in the export table of a DSO and do not require a PLT indirection
2815 when used within the DSO@. Enabling this option can have a dramatic effect
2816 on load and link times of a DSO as it massively reduces the size of the
2817 dynamic export table when the library makes heavy use of templates.
2818
2819 The behavior of this switch is not quite the same as marking the
2820 methods as hidden directly, because it does not affect static variables
2821 local to the function or cause the compiler to deduce that
2822 the function is defined in only one shared object.
2823
2824 You may mark a method as having a visibility explicitly to negate the
2825 effect of the switch for that method. For example, if you do want to
2826 compare pointers to a particular inline method, you might mark it as
2827 having default visibility. Marking the enclosing class with explicit
2828 visibility has no effect.
2829
2830 Explicitly instantiated inline methods are unaffected by this option
2831 as their linkage might otherwise cross a shared library boundary.
2832 @xref{Template Instantiation}.
2833
2834 @item -fvisibility-ms-compat
2835 @opindex fvisibility-ms-compat
2836 This flag attempts to use visibility settings to make GCC's C++
2837 linkage model compatible with that of Microsoft Visual Studio.
2838
2839 The flag makes these changes to GCC's linkage model:
2840
2841 @enumerate
2842 @item
2843 It sets the default visibility to @code{hidden}, like
2844 @option{-fvisibility=hidden}.
2845
2846 @item
2847 Types, but not their members, are not hidden by default.
2848
2849 @item
2850 The One Definition Rule is relaxed for types without explicit
2851 visibility specifications that are defined in more than one
2852 shared object: those declarations are permitted if they are
2853 permitted when this option is not used.
2854 @end enumerate
2855
2856 In new code it is better to use @option{-fvisibility=hidden} and
2857 export those classes that are intended to be externally visible.
2858 Unfortunately it is possible for code to rely, perhaps accidentally,
2859 on the Visual Studio behavior.
2860
2861 Among the consequences of these changes are that static data members
2862 of the same type with the same name but defined in different shared
2863 objects are different, so changing one does not change the other;
2864 and that pointers to function members defined in different shared
2865 objects may not compare equal. When this flag is given, it is a
2866 violation of the ODR to define types with the same name differently.
2867
2868 @item -fno-weak
2869 @opindex fno-weak
2870 @opindex fweak
2871 Do not use weak symbol support, even if it is provided by the linker.
2872 By default, G++ uses weak symbols if they are available. This
2873 option exists only for testing, and should not be used by end-users;
2874 it results in inferior code and has no benefits. This option may
2875 be removed in a future release of G++.
2876
2877 @item -nostdinc++
2878 @opindex nostdinc++
2879 Do not search for header files in the standard directories specific to
2880 C++, but do still search the other standard directories. (This option
2881 is used when building the C++ library.)
2882 @end table
2883
2884 In addition, these optimization, warning, and code generation options
2885 have meanings only for C++ programs:
2886
2887 @table @gcctabopt
2888 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2889 @opindex Wabi
2890 @opindex Wno-abi
2891 Warn when G++ it generates code that is probably not compatible with
2892 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2893 ABI with each major release, normally @option{-Wabi} will warn only if
2894 there is a check added later in a release series for an ABI issue
2895 discovered since the initial release. @option{-Wabi} will warn about
2896 more things if an older ABI version is selected (with
2897 @option{-fabi-version=@var{n}}).
2898
2899 @option{-Wabi} can also be used with an explicit version number to
2900 warn about compatibility with a particular @option{-fabi-version}
2901 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2902 @option{-fabi-version=2}.
2903
2904 If an explicit version number is provided and
2905 @option{-fabi-compat-version} is not specified, the version number
2906 from this option is used for compatibility aliases. If no explicit
2907 version number is provided with this option, but
2908 @option{-fabi-compat-version} is specified, that version number is
2909 used for ABI warnings.
2910
2911 Although an effort has been made to warn about
2912 all such cases, there are probably some cases that are not warned about,
2913 even though G++ is generating incompatible code. There may also be
2914 cases where warnings are emitted even though the code that is generated
2915 is compatible.
2916
2917 You should rewrite your code to avoid these warnings if you are
2918 concerned about the fact that code generated by G++ may not be binary
2919 compatible with code generated by other compilers.
2920
2921 Known incompatibilities in @option{-fabi-version=2} (which was the
2922 default from GCC 3.4 to 4.9) include:
2923
2924 @itemize @bullet
2925
2926 @item
2927 A template with a non-type template parameter of reference type was
2928 mangled incorrectly:
2929 @smallexample
2930 extern int N;
2931 template <int &> struct S @{@};
2932 void n (S<N>) @{2@}
2933 @end smallexample
2934
2935 This was fixed in @option{-fabi-version=3}.
2936
2937 @item
2938 SIMD vector types declared using @code{__attribute ((vector_size))} were
2939 mangled in a non-standard way that does not allow for overloading of
2940 functions taking vectors of different sizes.
2941
2942 The mangling was changed in @option{-fabi-version=4}.
2943
2944 @item
2945 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2946 qualifiers, and @code{decltype} of a plain declaration was folded away.
2947
2948 These mangling issues were fixed in @option{-fabi-version=5}.
2949
2950 @item
2951 Scoped enumerators passed as arguments to a variadic function are
2952 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2953 On most targets this does not actually affect the parameter passing
2954 ABI, as there is no way to pass an argument smaller than @code{int}.
2955
2956 Also, the ABI changed the mangling of template argument packs,
2957 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2958 a class scope function used as a template argument.
2959
2960 These issues were corrected in @option{-fabi-version=6}.
2961
2962 @item
2963 Lambdas in default argument scope were mangled incorrectly, and the
2964 ABI changed the mangling of @code{nullptr_t}.
2965
2966 These issues were corrected in @option{-fabi-version=7}.
2967
2968 @item
2969 When mangling a function type with function-cv-qualifiers, the
2970 un-qualified function type was incorrectly treated as a substitution
2971 candidate.
2972
2973 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2974
2975 @item
2976 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2977 unaligned accesses. Note that this did not affect the ABI of a
2978 function with a @code{nullptr_t} parameter, as parameters have a
2979 minimum alignment.
2980
2981 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2982
2983 @item
2984 Target-specific attributes that affect the identity of a type, such as
2985 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2986 did not affect the mangled name, leading to name collisions when
2987 function pointers were used as template arguments.
2988
2989 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2990
2991 @end itemize
2992
2993 It also warns about psABI-related changes. The known psABI changes at this
2994 point include:
2995
2996 @itemize @bullet
2997
2998 @item
2999 For SysV/x86-64, unions with @code{long double} members are
3000 passed in memory as specified in psABI. For example:
3001
3002 @smallexample
3003 union U @{
3004 long double ld;
3005 int i;
3006 @};
3007 @end smallexample
3008
3009 @noindent
3010 @code{union U} is always passed in memory.
3011
3012 @end itemize
3013
3014 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3015 @opindex Wabi-tag
3016 @opindex Wabi-tag
3017 Warn when a type with an ABI tag is used in a context that does not
3018 have that ABI tag. See @ref{C++ Attributes} for more information
3019 about ABI tags.
3020
3021 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3022 @opindex Wcomma-subscript
3023 @opindex Wno-comma-subscript
3024 Warn about uses of a comma expression within a subscripting expression.
3025 This usage was deprecated in C++2a. However, a comma expression wrapped
3026 in @code{( )} is not deprecated. Example:
3027
3028 @smallexample
3029 @group
3030 void f(int *a, int b, int c) @{
3031 a[b,c]; // deprecated
3032 a[(b,c)]; // OK
3033 @}
3034 @end group
3035 @end smallexample
3036
3037 Enabled by default with @option{-std=c++2a}.
3038
3039 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3040 @opindex Wctor-dtor-privacy
3041 @opindex Wno-ctor-dtor-privacy
3042 Warn when a class seems unusable because all the constructors or
3043 destructors in that class are private, and it has neither friends nor
3044 public static member functions. Also warn if there are no non-private
3045 methods, and there's at least one private member function that isn't
3046 a constructor or destructor.
3047
3048 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3049 @opindex Wdelete-non-virtual-dtor
3050 @opindex Wno-delete-non-virtual-dtor
3051 Warn when @code{delete} is used to destroy an instance of a class that
3052 has virtual functions and non-virtual destructor. It is unsafe to delete
3053 an instance of a derived class through a pointer to a base class if the
3054 base class does not have a virtual destructor. This warning is enabled
3055 by @option{-Wall}.
3056
3057 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3058 @opindex Wdeprecated-copy
3059 @opindex Wno-deprecated-copy
3060 Warn that the implicit declaration of a copy constructor or copy
3061 assignment operator is deprecated if the class has a user-provided
3062 copy constructor or copy assignment operator, in C++11 and up. This
3063 warning is enabled by @option{-Wextra}. With
3064 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3065 user-provided destructor.
3066
3067 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3068 @opindex Winit-list-lifetime
3069 @opindex Wno-init-list-lifetime
3070 Do not warn about uses of @code{std::initializer_list} that are likely
3071 to result in dangling pointers. Since the underlying array for an
3072 @code{initializer_list} is handled like a normal C++ temporary object,
3073 it is easy to inadvertently keep a pointer to the array past the end
3074 of the array's lifetime. For example:
3075
3076 @itemize @bullet
3077 @item
3078 If a function returns a temporary @code{initializer_list}, or a local
3079 @code{initializer_list} variable, the array's lifetime ends at the end
3080 of the return statement, so the value returned has a dangling pointer.
3081
3082 @item
3083 If a new-expression creates an @code{initializer_list}, the array only
3084 lives until the end of the enclosing full-expression, so the
3085 @code{initializer_list} in the heap has a dangling pointer.
3086
3087 @item
3088 When an @code{initializer_list} variable is assigned from a
3089 brace-enclosed initializer list, the temporary array created for the
3090 right side of the assignment only lives until the end of the
3091 full-expression, so at the next statement the @code{initializer_list}
3092 variable has a dangling pointer.
3093
3094 @smallexample
3095 // li's initial underlying array lives as long as li
3096 std::initializer_list<int> li = @{ 1,2,3 @};
3097 // assignment changes li to point to a temporary array
3098 li = @{ 4, 5 @};
3099 // now the temporary is gone and li has a dangling pointer
3100 int i = li.begin()[0] // undefined behavior
3101 @end smallexample
3102
3103 @item
3104 When a list constructor stores the @code{begin} pointer from the
3105 @code{initializer_list} argument, this doesn't extend the lifetime of
3106 the array, so if a class variable is constructed from a temporary
3107 @code{initializer_list}, the pointer is left dangling by the end of
3108 the variable declaration statement.
3109
3110 @end itemize
3111
3112 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3113 @opindex Wliteral-suffix
3114 @opindex Wno-literal-suffix
3115 Warn when a string or character literal is followed by a ud-suffix which does
3116 not begin with an underscore. As a conforming extension, GCC treats such
3117 suffixes as separate preprocessing tokens in order to maintain backwards
3118 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3119 For example:
3120
3121 @smallexample
3122 #define __STDC_FORMAT_MACROS
3123 #include <inttypes.h>
3124 #include <stdio.h>
3125
3126 int main() @{
3127 int64_t i64 = 123;
3128 printf("My int64: %" PRId64"\n", i64);
3129 @}
3130 @end smallexample
3131
3132 In this case, @code{PRId64} is treated as a separate preprocessing token.
3133
3134 Additionally, warn when a user-defined literal operator is declared with
3135 a literal suffix identifier that doesn't begin with an underscore. Literal
3136 suffix identifiers that don't begin with an underscore are reserved for
3137 future standardization.
3138
3139 This warning is enabled by default.
3140
3141 @item -Wlto-type-mismatch
3142 @opindex Wlto-type-mismatch
3143 @opindex Wno-lto-type-mismatch
3144
3145 During the link-time optimization warn about type mismatches in
3146 global declarations from different compilation units.
3147 Requires @option{-flto} to be enabled. Enabled by default.
3148
3149 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3150 @opindex Wnarrowing
3151 @opindex Wno-narrowing
3152 For C++11 and later standards, narrowing conversions are diagnosed by default,
3153 as required by the standard. A narrowing conversion from a constant produces
3154 an error, and a narrowing conversion from a non-constant produces a warning,
3155 but @option{-Wno-narrowing} suppresses the diagnostic.
3156 Note that this does not affect the meaning of well-formed code;
3157 narrowing conversions are still considered ill-formed in SFINAE contexts.
3158
3159 With @option{-Wnarrowing} in C++98, warn when a narrowing
3160 conversion prohibited by C++11 occurs within
3161 @samp{@{ @}}, e.g.
3162
3163 @smallexample
3164 int i = @{ 2.2 @}; // error: narrowing from double to int
3165 @end smallexample
3166
3167 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3168
3169 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3170 @opindex Wnoexcept
3171 @opindex Wno-noexcept
3172 Warn when a noexcept-expression evaluates to false because of a call
3173 to a function that does not have a non-throwing exception
3174 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3175 the compiler to never throw an exception.
3176
3177 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3178 @opindex Wnoexcept-type
3179 @opindex Wno-noexcept-type
3180 Warn if the C++17 feature making @code{noexcept} part of a function
3181 type changes the mangled name of a symbol relative to C++14. Enabled
3182 by @option{-Wabi} and @option{-Wc++17-compat}.
3183
3184 As an example:
3185
3186 @smallexample
3187 template <class T> void f(T t) @{ t(); @};
3188 void g() noexcept;
3189 void h() @{ f(g); @}
3190 @end smallexample
3191
3192 @noindent
3193 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3194 C++17 it calls @code{f<void(*)()noexcept>}.
3195
3196 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3197 @opindex Wclass-memaccess
3198 @opindex Wno-class-memaccess
3199 Warn when the destination of a call to a raw memory function such as
3200 @code{memset} or @code{memcpy} is an object of class type, and when writing
3201 into such an object might bypass the class non-trivial or deleted constructor
3202 or copy assignment, violate const-correctness or encapsulation, or corrupt
3203 virtual table pointers. Modifying the representation of such objects may
3204 violate invariants maintained by member functions of the class. For example,
3205 the call to @code{memset} below is undefined because it modifies a non-trivial
3206 class object and is, therefore, diagnosed. The safe way to either initialize
3207 or clear the storage of objects of such types is by using the appropriate
3208 constructor or assignment operator, if one is available.
3209 @smallexample
3210 std::string str = "abc";
3211 memset (&str, 0, sizeof str);
3212 @end smallexample
3213 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3214 Explicitly casting the pointer to the class object to @code{void *} or
3215 to a type that can be safely accessed by the raw memory function suppresses
3216 the warning.
3217
3218 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3219 @opindex Wnon-virtual-dtor
3220 @opindex Wno-non-virtual-dtor
3221 Warn when a class has virtual functions and an accessible non-virtual
3222 destructor itself or in an accessible polymorphic base class, in which
3223 case it is possible but unsafe to delete an instance of a derived
3224 class through a pointer to the class itself or base class. This
3225 warning is automatically enabled if @option{-Weffc++} is specified.
3226
3227 @item -Wregister @r{(C++ and Objective-C++ only)}
3228 @opindex Wregister
3229 @opindex Wno-register
3230 Warn on uses of the @code{register} storage class specifier, except
3231 when it is part of the GNU @ref{Explicit Register Variables} extension.
3232 The use of the @code{register} keyword as storage class specifier has
3233 been deprecated in C++11 and removed in C++17.
3234 Enabled by default with @option{-std=c++17}.
3235
3236 @item -Wreorder @r{(C++ and Objective-C++ only)}
3237 @opindex Wreorder
3238 @opindex Wno-reorder
3239 @cindex reordering, warning
3240 @cindex warning for reordering of member initializers
3241 Warn when the order of member initializers given in the code does not
3242 match the order in which they must be executed. For instance:
3243
3244 @smallexample
3245 struct A @{
3246 int i;
3247 int j;
3248 A(): j (0), i (1) @{ @}
3249 @};
3250 @end smallexample
3251
3252 @noindent
3253 The compiler rearranges the member initializers for @code{i}
3254 and @code{j} to match the declaration order of the members, emitting
3255 a warning to that effect. This warning is enabled by @option{-Wall}.
3256
3257 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3258 @opindex Wpessimizing-move
3259 @opindex Wno-pessimizing-move
3260 This warning warns when a call to @code{std::move} prevents copy
3261 elision. A typical scenario when copy elision can occur is when returning in
3262 a function with a class return type, when the expression being returned is the
3263 name of a non-volatile automatic object, and is not a function parameter, and
3264 has the same type as the function return type.
3265
3266 @smallexample
3267 struct T @{
3268 @dots{}
3269 @};
3270 T fn()
3271 @{
3272 T t;
3273 @dots{}
3274 return std::move (t);
3275 @}
3276 @end smallexample
3277
3278 But in this example, the @code{std::move} call prevents copy elision.
3279
3280 This warning is enabled by @option{-Wall}.
3281
3282 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3283 @opindex Wredundant-move
3284 @opindex Wno-redundant-move
3285 This warning warns about redundant calls to @code{std::move}; that is, when
3286 a move operation would have been performed even without the @code{std::move}
3287 call. This happens because the compiler is forced to treat the object as if
3288 it were an rvalue in certain situations such as returning a local variable,
3289 where copy elision isn't applicable. Consider:
3290
3291 @smallexample
3292 struct T @{
3293 @dots{}
3294 @};
3295 T fn(T t)
3296 @{
3297 @dots{}
3298 return std::move (t);
3299 @}
3300 @end smallexample
3301
3302 Here, the @code{std::move} call is redundant. Because G++ implements Core
3303 Issue 1579, another example is:
3304
3305 @smallexample
3306 struct T @{ // convertible to U
3307 @dots{}
3308 @};
3309 struct U @{
3310 @dots{}
3311 @};
3312 U fn()
3313 @{
3314 T t;
3315 @dots{}
3316 return std::move (t);
3317 @}
3318 @end smallexample
3319 In this example, copy elision isn't applicable because the type of the
3320 expression being returned and the function return type differ, yet G++
3321 treats the return value as if it were designated by an rvalue.
3322
3323 This warning is enabled by @option{-Wextra}.
3324
3325 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3326 @opindex fext-numeric-literals
3327 @opindex fno-ext-numeric-literals
3328 Accept imaginary, fixed-point, or machine-defined
3329 literal number suffixes as GNU extensions.
3330 When this option is turned off these suffixes are treated
3331 as C++11 user-defined literal numeric suffixes.
3332 This is on by default for all pre-C++11 dialects and all GNU dialects:
3333 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3334 @option{-std=gnu++14}.
3335 This option is off by default
3336 for ISO C++11 onwards (@option{-std=c++11}, ...).
3337 @end table
3338
3339 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3340
3341 @table @gcctabopt
3342 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3343 @opindex Weffc++
3344 @opindex Wno-effc++
3345 Warn about violations of the following style guidelines from Scott Meyers'
3346 @cite{Effective C++} series of books:
3347
3348 @itemize @bullet
3349 @item
3350 Define a copy constructor and an assignment operator for classes
3351 with dynamically-allocated memory.
3352
3353 @item
3354 Prefer initialization to assignment in constructors.
3355
3356 @item
3357 Have @code{operator=} return a reference to @code{*this}.
3358
3359 @item
3360 Don't try to return a reference when you must return an object.
3361
3362 @item
3363 Distinguish between prefix and postfix forms of increment and
3364 decrement operators.
3365
3366 @item
3367 Never overload @code{&&}, @code{||}, or @code{,}.
3368
3369 @end itemize
3370
3371 This option also enables @option{-Wnon-virtual-dtor}, which is also
3372 one of the effective C++ recommendations. However, the check is
3373 extended to warn about the lack of virtual destructor in accessible
3374 non-polymorphic bases classes too.
3375
3376 When selecting this option, be aware that the standard library
3377 headers do not obey all of these guidelines; use @samp{grep -v}
3378 to filter out those warnings.
3379
3380 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3381 @opindex Wstrict-null-sentinel
3382 @opindex Wno-strict-null-sentinel
3383 Warn about the use of an uncasted @code{NULL} as sentinel. When
3384 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3385 to @code{__null}. Although it is a null pointer constant rather than a
3386 null pointer, it is guaranteed to be of the same size as a pointer.
3387 But this use is not portable across different compilers.
3388
3389 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3390 @opindex Wno-non-template-friend
3391 @opindex Wnon-template-friend
3392 Disable warnings when non-template friend functions are declared
3393 within a template. In very old versions of GCC that predate implementation
3394 of the ISO standard, declarations such as
3395 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3396 could be interpreted as a particular specialization of a template
3397 function; the warning exists to diagnose compatibility problems,
3398 and is enabled by default.
3399
3400 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3401 @opindex Wold-style-cast
3402 @opindex Wno-old-style-cast
3403 Warn if an old-style (C-style) cast to a non-void type is used within
3404 a C++ program. The new-style casts (@code{dynamic_cast},
3405 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3406 less vulnerable to unintended effects and much easier to search for.
3407
3408 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3409 @opindex Woverloaded-virtual
3410 @opindex Wno-overloaded-virtual
3411 @cindex overloaded virtual function, warning
3412 @cindex warning for overloaded virtual function
3413 Warn when a function declaration hides virtual functions from a
3414 base class. For example, in:
3415
3416 @smallexample
3417 struct A @{
3418 virtual void f();
3419 @};
3420
3421 struct B: public A @{
3422 void f(int);
3423 @};
3424 @end smallexample
3425
3426 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3427 like:
3428
3429 @smallexample
3430 B* b;
3431 b->f();
3432 @end smallexample
3433
3434 @noindent
3435 fails to compile.
3436
3437 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3438 @opindex Wno-pmf-conversions
3439 @opindex Wpmf-conversions
3440 Disable the diagnostic for converting a bound pointer to member function
3441 to a plain pointer.
3442
3443 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3444 @opindex Wsign-promo
3445 @opindex Wno-sign-promo
3446 Warn when overload resolution chooses a promotion from unsigned or
3447 enumerated type to a signed type, over a conversion to an unsigned type of
3448 the same size. Previous versions of G++ tried to preserve
3449 unsignedness, but the standard mandates the current behavior.
3450
3451 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3452 @opindex Wtemplates
3453 @opindex Wno-templates
3454 Warn when a primary template declaration is encountered. Some coding
3455 rules disallow templates, and this may be used to enforce that rule.
3456 The warning is inactive inside a system header file, such as the STL, so
3457 one can still use the STL. One may also instantiate or specialize
3458 templates.
3459
3460 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3461 @opindex Wmultiple-inheritance
3462 @opindex Wno-multiple-inheritance
3463 Warn when a class is defined with multiple direct base classes. Some
3464 coding rules disallow multiple inheritance, and this may be used to
3465 enforce that rule. The warning is inactive inside a system header file,
3466 such as the STL, so one can still use the STL. One may also define
3467 classes that indirectly use multiple inheritance.
3468
3469 @item -Wvirtual-inheritance
3470 @opindex Wvirtual-inheritance
3471 @opindex Wno-virtual-inheritance
3472 Warn when a class is defined with a virtual direct base class. Some
3473 coding rules disallow multiple inheritance, and this may be used to
3474 enforce that rule. The warning is inactive inside a system header file,
3475 such as the STL, so one can still use the STL. One may also define
3476 classes that indirectly use virtual inheritance.
3477
3478 @item -Wnamespaces
3479 @opindex Wnamespaces
3480 @opindex Wno-namespaces
3481 Warn when a namespace definition is opened. Some coding rules disallow
3482 namespaces, and this may be used to enforce that rule. The warning is
3483 inactive inside a system header file, such as the STL, so one can still
3484 use the STL. One may also use using directives and qualified names.
3485
3486 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3487 @opindex Wterminate
3488 @opindex Wno-terminate
3489 Disable the warning about a throw-expression that will immediately
3490 result in a call to @code{terminate}.
3491
3492 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3493 @opindex Wno-class-conversion
3494 @opindex Wclass-conversion
3495 Disable the warning about the case when a conversion function converts an
3496 object to the same type, to a base class of that type, or to void; such
3497 a conversion function will never be called.
3498
3499 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3500 @opindex Wvolatile
3501 @opindex Wno-volatile
3502 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3503 postfix and prefix @code{++} and @code{--} expressions of
3504 @code{volatile}-qualified types, using simple assignments where the left
3505 operand is a @code{volatile}-qualified non-class type for their value,
3506 compound assignments where the left operand is a @code{volatile}-qualified
3507 non-class type, @code{volatile}-qualified function return type,
3508 @code{volatile}-qualified parameter type, and structured bindings of a
3509 @code{volatile}-qualified type. This usage was deprecated in C++20.
3510
3511 Enabled by default with @option{-std=c++2a}.
3512 @end table
3513
3514 @node Objective-C and Objective-C++ Dialect Options
3515 @section Options Controlling Objective-C and Objective-C++ Dialects
3516
3517 @cindex compiler options, Objective-C and Objective-C++
3518 @cindex Objective-C and Objective-C++ options, command-line
3519 @cindex options, Objective-C and Objective-C++
3520 (NOTE: This manual does not describe the Objective-C and Objective-C++
3521 languages themselves. @xref{Standards,,Language Standards
3522 Supported by GCC}, for references.)
3523
3524 This section describes the command-line options that are only meaningful
3525 for Objective-C and Objective-C++ programs. You can also use most of
3526 the language-independent GNU compiler options.
3527 For example, you might compile a file @file{some_class.m} like this:
3528
3529 @smallexample
3530 gcc -g -fgnu-runtime -O -c some_class.m
3531 @end smallexample
3532
3533 @noindent
3534 In this example, @option{-fgnu-runtime} is an option meant only for
3535 Objective-C and Objective-C++ programs; you can use the other options with
3536 any language supported by GCC@.
3537
3538 Note that since Objective-C is an extension of the C language, Objective-C
3539 compilations may also use options specific to the C front-end (e.g.,
3540 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3541 C++-specific options (e.g., @option{-Wabi}).
3542
3543 Here is a list of options that are @emph{only} for compiling Objective-C
3544 and Objective-C++ programs:
3545
3546 @table @gcctabopt
3547 @item -fconstant-string-class=@var{class-name}
3548 @opindex fconstant-string-class
3549 Use @var{class-name} as the name of the class to instantiate for each
3550 literal string specified with the syntax @code{@@"@dots{}"}. The default
3551 class name is @code{NXConstantString} if the GNU runtime is being used, and
3552 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3553 @option{-fconstant-cfstrings} option, if also present, overrides the
3554 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3555 to be laid out as constant CoreFoundation strings.
3556
3557 @item -fgnu-runtime
3558 @opindex fgnu-runtime
3559 Generate object code compatible with the standard GNU Objective-C
3560 runtime. This is the default for most types of systems.
3561
3562 @item -fnext-runtime
3563 @opindex fnext-runtime
3564 Generate output compatible with the NeXT runtime. This is the default
3565 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3566 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3567 used.
3568
3569 @item -fno-nil-receivers
3570 @opindex fno-nil-receivers
3571 @opindex fnil-receivers
3572 Assume that all Objective-C message dispatches (@code{[receiver
3573 message:arg]}) in this translation unit ensure that the receiver is
3574 not @code{nil}. This allows for more efficient entry points in the
3575 runtime to be used. This option is only available in conjunction with
3576 the NeXT runtime and ABI version 0 or 1.
3577
3578 @item -fobjc-abi-version=@var{n}
3579 @opindex fobjc-abi-version
3580 Use version @var{n} of the Objective-C ABI for the selected runtime.
3581 This option is currently supported only for the NeXT runtime. In that
3582 case, Version 0 is the traditional (32-bit) ABI without support for
3583 properties and other Objective-C 2.0 additions. Version 1 is the
3584 traditional (32-bit) ABI with support for properties and other
3585 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3586 nothing is specified, the default is Version 0 on 32-bit target
3587 machines, and Version 2 on 64-bit target machines.
3588
3589 @item -fobjc-call-cxx-cdtors
3590 @opindex fobjc-call-cxx-cdtors
3591 For each Objective-C class, check if any of its instance variables is a
3592 C++ object with a non-trivial default constructor. If so, synthesize a
3593 special @code{- (id) .cxx_construct} instance method which runs
3594 non-trivial default constructors on any such instance variables, in order,
3595 and then return @code{self}. Similarly, check if any instance variable
3596 is a C++ object with a non-trivial destructor, and if so, synthesize a
3597 special @code{- (void) .cxx_destruct} method which runs
3598 all such default destructors, in reverse order.
3599
3600 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3601 methods thusly generated only operate on instance variables
3602 declared in the current Objective-C class, and not those inherited
3603 from superclasses. It is the responsibility of the Objective-C
3604 runtime to invoke all such methods in an object's inheritance
3605 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3606 by the runtime immediately after a new object instance is allocated;
3607 the @code{- (void) .cxx_destruct} methods are invoked immediately
3608 before the runtime deallocates an object instance.
3609
3610 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3611 support for invoking the @code{- (id) .cxx_construct} and
3612 @code{- (void) .cxx_destruct} methods.
3613
3614 @item -fobjc-direct-dispatch
3615 @opindex fobjc-direct-dispatch
3616 Allow fast jumps to the message dispatcher. On Darwin this is
3617 accomplished via the comm page.
3618
3619 @item -fobjc-exceptions
3620 @opindex fobjc-exceptions
3621 Enable syntactic support for structured exception handling in
3622 Objective-C, similar to what is offered by C++. This option
3623 is required to use the Objective-C keywords @code{@@try},
3624 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3625 @code{@@synchronized}. This option is available with both the GNU
3626 runtime and the NeXT runtime (but not available in conjunction with
3627 the NeXT runtime on Mac OS X 10.2 and earlier).
3628
3629 @item -fobjc-gc
3630 @opindex fobjc-gc
3631 Enable garbage collection (GC) in Objective-C and Objective-C++
3632 programs. This option is only available with the NeXT runtime; the
3633 GNU runtime has a different garbage collection implementation that
3634 does not require special compiler flags.
3635
3636 @item -fobjc-nilcheck
3637 @opindex fobjc-nilcheck
3638 For the NeXT runtime with version 2 of the ABI, check for a nil
3639 receiver in method invocations before doing the actual method call.
3640 This is the default and can be disabled using
3641 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3642 checked for nil in this way no matter what this flag is set to.
3643 Currently this flag does nothing when the GNU runtime, or an older
3644 version of the NeXT runtime ABI, is used.
3645
3646 @item -fobjc-std=objc1
3647 @opindex fobjc-std
3648 Conform to the language syntax of Objective-C 1.0, the language
3649 recognized by GCC 4.0. This only affects the Objective-C additions to
3650 the C/C++ language; it does not affect conformance to C/C++ standards,
3651 which is controlled by the separate C/C++ dialect option flags. When
3652 this option is used with the Objective-C or Objective-C++ compiler,
3653 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3654 This is useful if you need to make sure that your Objective-C code can
3655 be compiled with older versions of GCC@.
3656
3657 @item -freplace-objc-classes
3658 @opindex freplace-objc-classes
3659 Emit a special marker instructing @command{ld(1)} not to statically link in
3660 the resulting object file, and allow @command{dyld(1)} to load it in at
3661 run time instead. This is used in conjunction with the Fix-and-Continue
3662 debugging mode, where the object file in question may be recompiled and
3663 dynamically reloaded in the course of program execution, without the need
3664 to restart the program itself. Currently, Fix-and-Continue functionality
3665 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3666 and later.
3667
3668 @item -fzero-link
3669 @opindex fzero-link
3670 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3671 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3672 compile time) with static class references that get initialized at load time,
3673 which improves run-time performance. Specifying the @option{-fzero-link} flag
3674 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3675 to be retained. This is useful in Zero-Link debugging mode, since it allows
3676 for individual class implementations to be modified during program execution.
3677 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3678 regardless of command-line options.
3679
3680 @item -fno-local-ivars
3681 @opindex fno-local-ivars
3682 @opindex flocal-ivars
3683 By default instance variables in Objective-C can be accessed as if
3684 they were local variables from within the methods of the class they're
3685 declared in. This can lead to shadowing between instance variables
3686 and other variables declared either locally inside a class method or
3687 globally with the same name. Specifying the @option{-fno-local-ivars}
3688 flag disables this behavior thus avoiding variable shadowing issues.
3689
3690 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3691 @opindex fivar-visibility
3692 Set the default instance variable visibility to the specified option
3693 so that instance variables declared outside the scope of any access
3694 modifier directives default to the specified visibility.
3695
3696 @item -gen-decls
3697 @opindex gen-decls
3698 Dump interface declarations for all classes seen in the source file to a
3699 file named @file{@var{sourcename}.decl}.
3700
3701 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3702 @opindex Wassign-intercept
3703 @opindex Wno-assign-intercept
3704 Warn whenever an Objective-C assignment is being intercepted by the
3705 garbage collector.
3706
3707 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3708 @opindex Wno-protocol
3709 @opindex Wprotocol
3710 If a class is declared to implement a protocol, a warning is issued for
3711 every method in the protocol that is not implemented by the class. The
3712 default behavior is to issue a warning for every method not explicitly
3713 implemented in the class, even if a method implementation is inherited
3714 from the superclass. If you use the @option{-Wno-protocol} option, then
3715 methods inherited from the superclass are considered to be implemented,
3716 and no warning is issued for them.
3717
3718 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3719 @opindex Wselector
3720 @opindex Wno-selector
3721 Warn if multiple methods of different types for the same selector are
3722 found during compilation. The check is performed on the list of methods
3723 in the final stage of compilation. Additionally, a check is performed
3724 for each selector appearing in a @code{@@selector(@dots{})}
3725 expression, and a corresponding method for that selector has been found
3726 during compilation. Because these checks scan the method table only at
3727 the end of compilation, these warnings are not produced if the final
3728 stage of compilation is not reached, for example because an error is
3729 found during compilation, or because the @option{-fsyntax-only} option is
3730 being used.
3731
3732 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3733 @opindex Wstrict-selector-match
3734 @opindex Wno-strict-selector-match
3735 Warn if multiple methods with differing argument and/or return types are
3736 found for a given selector when attempting to send a message using this
3737 selector to a receiver of type @code{id} or @code{Class}. When this flag
3738 is off (which is the default behavior), the compiler omits such warnings
3739 if any differences found are confined to types that share the same size
3740 and alignment.
3741
3742 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3743 @opindex Wundeclared-selector
3744 @opindex Wno-undeclared-selector
3745 Warn if a @code{@@selector(@dots{})} expression referring to an
3746 undeclared selector is found. A selector is considered undeclared if no
3747 method with that name has been declared before the
3748 @code{@@selector(@dots{})} expression, either explicitly in an
3749 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3750 an @code{@@implementation} section. This option always performs its
3751 checks as soon as a @code{@@selector(@dots{})} expression is found,
3752 while @option{-Wselector} only performs its checks in the final stage of
3753 compilation. This also enforces the coding style convention
3754 that methods and selectors must be declared before being used.
3755
3756 @item -print-objc-runtime-info
3757 @opindex print-objc-runtime-info
3758 Generate C header describing the largest structure that is passed by
3759 value, if any.
3760
3761 @end table
3762
3763 @node Diagnostic Message Formatting Options
3764 @section Options to Control Diagnostic Messages Formatting
3765 @cindex options to control diagnostics formatting
3766 @cindex diagnostic messages
3767 @cindex message formatting
3768
3769 Traditionally, diagnostic messages have been formatted irrespective of
3770 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3771 options described below
3772 to control the formatting algorithm for diagnostic messages,
3773 e.g.@: how many characters per line, how often source location
3774 information should be reported. Note that some language front ends may not
3775 honor these options.
3776
3777 @table @gcctabopt
3778 @item -fmessage-length=@var{n}
3779 @opindex fmessage-length
3780 Try to format error messages so that they fit on lines of about
3781 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3782 done; each error message appears on a single line. This is the
3783 default for all front ends.
3784
3785 Note - this option also affects the display of the @samp{#error} and
3786 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3787 function/type/variable attribute. It does not however affect the
3788 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3789
3790 @item -fdiagnostics-show-location=once
3791 @opindex fdiagnostics-show-location
3792 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3793 reporter to emit source location information @emph{once}; that is, in
3794 case the message is too long to fit on a single physical line and has to
3795 be wrapped, the source location won't be emitted (as prefix) again,
3796 over and over, in subsequent continuation lines. This is the default
3797 behavior.
3798
3799 @item -fdiagnostics-show-location=every-line
3800 Only meaningful in line-wrapping mode. Instructs the diagnostic
3801 messages reporter to emit the same source location information (as
3802 prefix) for physical lines that result from the process of breaking
3803 a message which is too long to fit on a single line.
3804
3805 @item -fdiagnostics-color[=@var{WHEN}]
3806 @itemx -fno-diagnostics-color
3807 @opindex fdiagnostics-color
3808 @cindex highlight, color
3809 @vindex GCC_COLORS @r{environment variable}
3810 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3811 or @samp{auto}. The default depends on how the compiler has been configured,
3812 it can be any of the above @var{WHEN} options or also @samp{never}
3813 if @env{GCC_COLORS} environment variable isn't present in the environment,
3814 and @samp{auto} otherwise.
3815 @samp{auto} means to use color only when the standard error is a terminal.
3816 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3817 aliases for @option{-fdiagnostics-color=always} and
3818 @option{-fdiagnostics-color=never}, respectively.
3819
3820 The colors are defined by the environment variable @env{GCC_COLORS}.
3821 Its value is a colon-separated list of capabilities and Select Graphic
3822 Rendition (SGR) substrings. SGR commands are interpreted by the
3823 terminal or terminal emulator. (See the section in the documentation
3824 of your text terminal for permitted values and their meanings as
3825 character attributes.) These substring values are integers in decimal
3826 representation and can be concatenated with semicolons.
3827 Common values to concatenate include
3828 @samp{1} for bold,
3829 @samp{4} for underline,
3830 @samp{5} for blink,
3831 @samp{7} for inverse,
3832 @samp{39} for default foreground color,
3833 @samp{30} to @samp{37} for foreground colors,
3834 @samp{90} to @samp{97} for 16-color mode foreground colors,
3835 @samp{38;5;0} to @samp{38;5;255}
3836 for 88-color and 256-color modes foreground colors,
3837 @samp{49} for default background color,
3838 @samp{40} to @samp{47} for background colors,
3839 @samp{100} to @samp{107} for 16-color mode background colors,
3840 and @samp{48;5;0} to @samp{48;5;255}
3841 for 88-color and 256-color modes background colors.
3842
3843 The default @env{GCC_COLORS} is
3844 @smallexample
3845 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3846 quote=01:fixit-insert=32:fixit-delete=31:\
3847 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3848 type-diff=01;32
3849 @end smallexample
3850 @noindent
3851 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3852 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3853 @samp{01} is bold, and @samp{31} is red.
3854 Setting @env{GCC_COLORS} to the empty string disables colors.
3855 Supported capabilities are as follows.
3856
3857 @table @code
3858 @item error=
3859 @vindex error GCC_COLORS @r{capability}
3860 SGR substring for error: markers.
3861
3862 @item warning=
3863 @vindex warning GCC_COLORS @r{capability}
3864 SGR substring for warning: markers.
3865
3866 @item note=
3867 @vindex note GCC_COLORS @r{capability}
3868 SGR substring for note: markers.
3869
3870 @item range1=
3871 @vindex range1 GCC_COLORS @r{capability}
3872 SGR substring for first additional range.
3873
3874 @item range2=
3875 @vindex range2 GCC_COLORS @r{capability}
3876 SGR substring for second additional range.
3877
3878 @item locus=
3879 @vindex locus GCC_COLORS @r{capability}
3880 SGR substring for location information, @samp{file:line} or
3881 @samp{file:line:column} etc.
3882
3883 @item quote=
3884 @vindex quote GCC_COLORS @r{capability}
3885 SGR substring for information printed within quotes.
3886
3887 @item fixit-insert=
3888 @vindex fixit-insert GCC_COLORS @r{capability}
3889 SGR substring for fix-it hints suggesting text to
3890 be inserted or replaced.
3891
3892 @item fixit-delete=
3893 @vindex fixit-delete GCC_COLORS @r{capability}
3894 SGR substring for fix-it hints suggesting text to
3895 be deleted.
3896
3897 @item diff-filename=
3898 @vindex diff-filename GCC_COLORS @r{capability}
3899 SGR substring for filename headers within generated patches.
3900
3901 @item diff-hunk=
3902 @vindex diff-hunk GCC_COLORS @r{capability}
3903 SGR substring for the starts of hunks within generated patches.
3904
3905 @item diff-delete=
3906 @vindex diff-delete GCC_COLORS @r{capability}
3907 SGR substring for deleted lines within generated patches.
3908
3909 @item diff-insert=
3910 @vindex diff-insert GCC_COLORS @r{capability}
3911 SGR substring for inserted lines within generated patches.
3912
3913 @item type-diff=
3914 @vindex type-diff GCC_COLORS @r{capability}
3915 SGR substring for highlighting mismatching types within template
3916 arguments in the C++ frontend.
3917 @end table
3918
3919 @item -fdiagnostics-urls[=@var{WHEN}]
3920 @opindex fdiagnostics-urls
3921 @cindex urls
3922 Use escape sequences to embed URLs in diagnostics. For example, when
3923 @option{-fdiagnostics-show-option} emits text showing the command-line
3924 option controlling a diagnostic, embed a URL for documentation of that
3925 option.
3926
3927 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
3928 The default is @samp{auto}, which means to use URL escape sequences only
3929 when the standard error is a terminal.
3930
3931 @item -fno-diagnostics-show-option
3932 @opindex fno-diagnostics-show-option
3933 @opindex fdiagnostics-show-option
3934 By default, each diagnostic emitted includes text indicating the
3935 command-line option that directly controls the diagnostic (if such an
3936 option is known to the diagnostic machinery). Specifying the
3937 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3938
3939 @item -fno-diagnostics-show-caret
3940 @opindex fno-diagnostics-show-caret
3941 @opindex fdiagnostics-show-caret
3942 By default, each diagnostic emitted includes the original source line
3943 and a caret @samp{^} indicating the column. This option suppresses this
3944 information. The source line is truncated to @var{n} characters, if
3945 the @option{-fmessage-length=n} option is given. When the output is done
3946 to the terminal, the width is limited to the width given by the
3947 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3948
3949 @item -fno-diagnostics-show-labels
3950 @opindex fno-diagnostics-show-labels
3951 @opindex fdiagnostics-show-labels
3952 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3953 diagnostics can label ranges of source code with pertinent information, such
3954 as the types of expressions:
3955
3956 @smallexample
3957 printf ("foo %s bar", long_i + long_j);
3958 ~^ ~~~~~~~~~~~~~~~
3959 | |
3960 char * long int
3961 @end smallexample
3962
3963 This option suppresses the printing of these labels (in the example above,
3964 the vertical bars and the ``char *'' and ``long int'' text).
3965
3966 @item -fno-diagnostics-show-line-numbers
3967 @opindex fno-diagnostics-show-line-numbers
3968 @opindex fdiagnostics-show-line-numbers
3969 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3970 a left margin is printed, showing line numbers. This option suppresses this
3971 left margin.
3972
3973 @item -fdiagnostics-minimum-margin-width=@var{width}
3974 @opindex fdiagnostics-minimum-margin-width
3975 This option controls the minimum width of the left margin printed by
3976 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3977
3978 @item -fdiagnostics-parseable-fixits
3979 @opindex fdiagnostics-parseable-fixits
3980 Emit fix-it hints in a machine-parseable format, suitable for consumption
3981 by IDEs. For each fix-it, a line will be printed after the relevant
3982 diagnostic, starting with the string ``fix-it:''. For example:
3983
3984 @smallexample
3985 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3986 @end smallexample
3987
3988 The location is expressed as a half-open range, expressed as a count of
3989 bytes, starting at byte 1 for the initial column. In the above example,
3990 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3991 given string:
3992
3993 @smallexample
3994 00000000011111111112222222222
3995 12345678901234567890123456789
3996 gtk_widget_showall (dlg);
3997 ^^^^^^^^^^^^^^^^^^
3998 gtk_widget_show_all
3999 @end smallexample
4000
4001 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4002 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4003 (e.g. vertical tab as ``\013'').
4004
4005 An empty replacement string indicates that the given range is to be removed.
4006 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4007 be inserted at the given position.
4008
4009 @item -fdiagnostics-generate-patch
4010 @opindex fdiagnostics-generate-patch
4011 Print fix-it hints to stderr in unified diff format, after any diagnostics
4012 are printed. For example:
4013
4014 @smallexample
4015 --- test.c
4016 +++ test.c
4017 @@ -42,5 +42,5 @@
4018
4019 void show_cb(GtkDialog *dlg)
4020 @{
4021 - gtk_widget_showall(dlg);
4022 + gtk_widget_show_all(dlg);
4023 @}
4024
4025 @end smallexample
4026
4027 The diff may or may not be colorized, following the same rules
4028 as for diagnostics (see @option{-fdiagnostics-color}).
4029
4030 @item -fdiagnostics-show-template-tree
4031 @opindex fdiagnostics-show-template-tree
4032
4033 In the C++ frontend, when printing diagnostics showing mismatching
4034 template types, such as:
4035
4036 @smallexample
4037 could not convert 'std::map<int, std::vector<double> >()'
4038 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4039 @end smallexample
4040
4041 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4042 tree-like structure showing the common and differing parts of the types,
4043 such as:
4044
4045 @smallexample
4046 map<
4047 [...],
4048 vector<
4049 [double != float]>>
4050 @end smallexample
4051
4052 The parts that differ are highlighted with color (``double'' and
4053 ``float'' in this case).
4054
4055 @item -fno-elide-type
4056 @opindex fno-elide-type
4057 @opindex felide-type
4058 By default when the C++ frontend prints diagnostics showing mismatching
4059 template types, common parts of the types are printed as ``[...]'' to
4060 simplify the error message. For example:
4061
4062 @smallexample
4063 could not convert 'std::map<int, std::vector<double> >()'
4064 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4065 @end smallexample
4066
4067 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4068 This flag also affects the output of the
4069 @option{-fdiagnostics-show-template-tree} flag.
4070
4071 @item -fno-show-column
4072 @opindex fno-show-column
4073 @opindex fshow-column
4074 Do not print column numbers in diagnostics. This may be necessary if
4075 diagnostics are being scanned by a program that does not understand the
4076 column numbers, such as @command{dejagnu}.
4077
4078 @item -fdiagnostics-format=@var{FORMAT}
4079 @opindex fdiagnostics-format
4080 Select a different format for printing diagnostics.
4081 @var{FORMAT} is @samp{text} or @samp{json}.
4082 The default is @samp{text}.
4083
4084 The @samp{json} format consists of a top-level JSON array containing JSON
4085 objects representing the diagnostics.
4086
4087 The JSON is emitted as one line, without formatting; the examples below
4088 have been formatted for clarity.
4089
4090 Diagnostics can have child diagnostics. For example, this error and note:
4091
4092 @smallexample
4093 misleading-indentation.c:15:3: warning: this 'if' clause does not
4094 guard... [-Wmisleading-indentation]
4095 15 | if (flag)
4096 | ^~
4097 misleading-indentation.c:17:5: note: ...this statement, but the latter
4098 is misleadingly indented as if it were guarded by the 'if'
4099 17 | y = 2;
4100 | ^
4101 @end smallexample
4102
4103 @noindent
4104 might be printed in JSON form (after formatting) like this:
4105
4106 @smallexample
4107 [
4108 @{
4109 "kind": "warning",
4110 "locations": [
4111 @{
4112 "caret": @{
4113 "column": 3,
4114 "file": "misleading-indentation.c",
4115 "line": 15
4116 @},
4117 "finish": @{
4118 "column": 4,
4119 "file": "misleading-indentation.c",
4120 "line": 15
4121 @}
4122 @}
4123 ],
4124 "message": "this \u2018if\u2019 clause does not guard...",
4125 "option": "-Wmisleading-indentation",
4126 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4127 "children": [
4128 @{
4129 "kind": "note",
4130 "locations": [
4131 @{
4132 "caret": @{
4133 "column": 5,
4134 "file": "misleading-indentation.c",
4135 "line": 17
4136 @}
4137 @}
4138 ],
4139 "message": "...this statement, but the latter is @dots{}"
4140 @}
4141 ]
4142 @},
4143 @dots{}
4144 ]
4145 @end smallexample
4146
4147 @noindent
4148 where the @code{note} is a child of the @code{warning}.
4149
4150 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4151 an @code{option} key describing the command-line option controlling the
4152 warning.
4153
4154 A diagnostic can contain zero or more locations. Each location has up
4155 to three positions within it: a @code{caret} position and optional
4156 @code{start} and @code{finish} positions. A location can also have
4157 an optional @code{label} string. For example, this error:
4158
4159 @smallexample
4160 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4161 'struct s'@} and 'T' @{aka 'struct t'@})
4162 64 | return callee_4a () + callee_4b ();
4163 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4164 | | |
4165 | | T @{aka struct t@}
4166 | S @{aka struct s@}
4167 @end smallexample
4168
4169 @noindent
4170 has three locations. Its primary location is at the ``+'' token at column
4171 23. It has two secondary locations, describing the left and right-hand sides
4172 of the expression, which have labels. It might be printed in JSON form as:
4173
4174 @smallexample
4175 @{
4176 "children": [],
4177 "kind": "error",
4178 "locations": [
4179 @{
4180 "caret": @{
4181 "column": 23, "file": "bad-binary-ops.c", "line": 64
4182 @}
4183 @},
4184 @{
4185 "caret": @{
4186 "column": 10, "file": "bad-binary-ops.c", "line": 64
4187 @},
4188 "finish": @{
4189 "column": 21, "file": "bad-binary-ops.c", "line": 64
4190 @},
4191 "label": "S @{aka struct s@}"
4192 @},
4193 @{
4194 "caret": @{
4195 "column": 25, "file": "bad-binary-ops.c", "line": 64
4196 @},
4197 "finish": @{
4198 "column": 36, "file": "bad-binary-ops.c", "line": 64
4199 @},
4200 "label": "T @{aka struct t@}"
4201 @}
4202 ],
4203 "message": "invalid operands to binary + @dots{}"
4204 @}
4205 @end smallexample
4206
4207 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4208 consisting of half-open intervals, similar to the output of
4209 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4210 with a replacement fix-it hint:
4211
4212 @smallexample
4213 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4214 mean 'color'?
4215 8 | return ptr->colour;
4216 | ^~~~~~
4217 | color
4218 @end smallexample
4219
4220 @noindent
4221 might be printed in JSON form as:
4222
4223 @smallexample
4224 @{
4225 "children": [],
4226 "fixits": [
4227 @{
4228 "next": @{
4229 "column": 21,
4230 "file": "demo.c",
4231 "line": 8
4232 @},
4233 "start": @{
4234 "column": 15,
4235 "file": "demo.c",
4236 "line": 8
4237 @},
4238 "string": "color"
4239 @}
4240 ],
4241 "kind": "error",
4242 "locations": [
4243 @{
4244 "caret": @{
4245 "column": 15,
4246 "file": "demo.c",
4247 "line": 8
4248 @},
4249 "finish": @{
4250 "column": 20,
4251 "file": "demo.c",
4252 "line": 8
4253 @}
4254 @}
4255 ],
4256 "message": "\u2018struct s\u2019 has no member named @dots{}"
4257 @}
4258 @end smallexample
4259
4260 @noindent
4261 where the fix-it hint suggests replacing the text from @code{start} up
4262 to but not including @code{next} with @code{string}'s value. Deletions
4263 are expressed via an empty value for @code{string}, insertions by
4264 having @code{start} equal @code{next}.
4265
4266 @end table
4267
4268 @node Warning Options
4269 @section Options to Request or Suppress Warnings
4270 @cindex options to control warnings
4271 @cindex warning messages
4272 @cindex messages, warning
4273 @cindex suppressing warnings
4274
4275 Warnings are diagnostic messages that report constructions that
4276 are not inherently erroneous but that are risky or suggest there
4277 may have been an error.
4278
4279 The following language-independent options do not enable specific
4280 warnings but control the kinds of diagnostics produced by GCC@.
4281
4282 @table @gcctabopt
4283 @cindex syntax checking
4284 @item -fsyntax-only
4285 @opindex fsyntax-only
4286 Check the code for syntax errors, but don't do anything beyond that.
4287
4288 @item -fmax-errors=@var{n}
4289 @opindex fmax-errors
4290 Limits the maximum number of error messages to @var{n}, at which point
4291 GCC bails out rather than attempting to continue processing the source
4292 code. If @var{n} is 0 (the default), there is no limit on the number
4293 of error messages produced. If @option{-Wfatal-errors} is also
4294 specified, then @option{-Wfatal-errors} takes precedence over this
4295 option.
4296
4297 @item -w
4298 @opindex w
4299 Inhibit all warning messages.
4300
4301 @item -Werror
4302 @opindex Werror
4303 @opindex Wno-error
4304 Make all warnings into errors.
4305
4306 @item -Werror=
4307 @opindex Werror=
4308 @opindex Wno-error=
4309 Make the specified warning into an error. The specifier for a warning
4310 is appended; for example @option{-Werror=switch} turns the warnings
4311 controlled by @option{-Wswitch} into errors. This switch takes a
4312 negative form, to be used to negate @option{-Werror} for specific
4313 warnings; for example @option{-Wno-error=switch} makes
4314 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4315 is in effect.
4316
4317 The warning message for each controllable warning includes the
4318 option that controls the warning. That option can then be used with
4319 @option{-Werror=} and @option{-Wno-error=} as described above.
4320 (Printing of the option in the warning message can be disabled using the
4321 @option{-fno-diagnostics-show-option} flag.)
4322
4323 Note that specifying @option{-Werror=}@var{foo} automatically implies
4324 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4325 imply anything.
4326
4327 @item -Wfatal-errors
4328 @opindex Wfatal-errors
4329 @opindex Wno-fatal-errors
4330 This option causes the compiler to abort compilation on the first error
4331 occurred rather than trying to keep going and printing further error
4332 messages.
4333
4334 @end table
4335
4336 You can request many specific warnings with options beginning with
4337 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4338 implicit declarations. Each of these specific warning options also
4339 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4340 example, @option{-Wno-implicit}. This manual lists only one of the
4341 two forms, whichever is not the default. For further
4342 language-specific options also refer to @ref{C++ Dialect Options} and
4343 @ref{Objective-C and Objective-C++ Dialect Options}.
4344
4345 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4346 options, such as @option{-Wunused}, which may turn on further options,
4347 such as @option{-Wunused-value}. The combined effect of positive and
4348 negative forms is that more specific options have priority over less
4349 specific ones, independently of their position in the command-line. For
4350 options of the same specificity, the last one takes effect. Options
4351 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4352 as if they appeared at the end of the command-line.
4353
4354 When an unrecognized warning option is requested (e.g.,
4355 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4356 that the option is not recognized. However, if the @option{-Wno-} form
4357 is used, the behavior is slightly different: no diagnostic is
4358 produced for @option{-Wno-unknown-warning} unless other diagnostics
4359 are being produced. This allows the use of new @option{-Wno-} options
4360 with old compilers, but if something goes wrong, the compiler
4361 warns that an unrecognized option is present.
4362
4363 @table @gcctabopt
4364 @item -Wpedantic
4365 @itemx -pedantic
4366 @opindex pedantic
4367 @opindex Wpedantic
4368 @opindex Wno-pedantic
4369 Issue all the warnings demanded by strict ISO C and ISO C++;
4370 reject all programs that use forbidden extensions, and some other
4371 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4372 version of the ISO C standard specified by any @option{-std} option used.
4373
4374 Valid ISO C and ISO C++ programs should compile properly with or without
4375 this option (though a rare few require @option{-ansi} or a
4376 @option{-std} option specifying the required version of ISO C)@. However,
4377 without this option, certain GNU extensions and traditional C and C++
4378 features are supported as well. With this option, they are rejected.
4379
4380 @option{-Wpedantic} does not cause warning messages for use of the
4381 alternate keywords whose names begin and end with @samp{__}. This alternate
4382 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4383 i.e. @samp{__intN__}.
4384 Pedantic warnings are also disabled in the expression that follows
4385 @code{__extension__}. However, only system header files should use
4386 these escape routes; application programs should avoid them.
4387 @xref{Alternate Keywords}.
4388
4389 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4390 C conformance. They soon find that it does not do quite what they want:
4391 it finds some non-ISO practices, but not all---only those for which
4392 ISO C @emph{requires} a diagnostic, and some others for which
4393 diagnostics have been added.
4394
4395 A feature to report any failure to conform to ISO C might be useful in
4396 some instances, but would require considerable additional work and would
4397 be quite different from @option{-Wpedantic}. We don't have plans to
4398 support such a feature in the near future.
4399
4400 Where the standard specified with @option{-std} represents a GNU
4401 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4402 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4403 extended dialect is based. Warnings from @option{-Wpedantic} are given
4404 where they are required by the base standard. (It does not make sense
4405 for such warnings to be given only for features not in the specified GNU
4406 C dialect, since by definition the GNU dialects of C include all
4407 features the compiler supports with the given option, and there would be
4408 nothing to warn about.)
4409
4410 @item -pedantic-errors
4411 @opindex pedantic-errors
4412 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4413 requires a diagnostic, in some cases where there is undefined behavior
4414 at compile-time and in some other cases that do not prevent compilation
4415 of programs that are valid according to the standard. This is not
4416 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4417 by this option and not enabled by the latter and vice versa.
4418
4419 @item -Wall
4420 @opindex Wall
4421 @opindex Wno-all
4422 This enables all the warnings about constructions that some users
4423 consider questionable, and that are easy to avoid (or modify to
4424 prevent the warning), even in conjunction with macros. This also
4425 enables some language-specific warnings described in @ref{C++ Dialect
4426 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4427
4428 @option{-Wall} turns on the following warning flags:
4429
4430 @gccoptlist{-Waddress @gol
4431 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4432 -Wbool-compare @gol
4433 -Wbool-operation @gol
4434 -Wc++11-compat -Wc++14-compat @gol
4435 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4436 -Wchar-subscripts @gol
4437 -Wcomment @gol
4438 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4439 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4440 -Wenum-conversion @r{in C/ObjC;} @gol
4441 -Wformat @gol
4442 -Wint-in-bool-context @gol
4443 -Wimplicit @r{(C and Objective-C only)} @gol
4444 -Wimplicit-int @r{(C and Objective-C only)} @gol
4445 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4446 -Winit-self @r{(only for C++)} @gol
4447 -Wzero-length-bounds @gol
4448 -Wlogical-not-parentheses @gol
4449 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4450 -Wmaybe-uninitialized @gol
4451 -Wmemset-elt-size @gol
4452 -Wmemset-transposed-args @gol
4453 -Wmisleading-indentation @r{(only for C/C++)} @gol
4454 -Wmissing-attributes @gol
4455 -Wmissing-braces @r{(only for C/ObjC)} @gol
4456 -Wmultistatement-macros @gol
4457 -Wnarrowing @r{(only for C++)} @gol
4458 -Wnonnull @gol
4459 -Wnonnull-compare @gol
4460 -Wopenmp-simd @gol
4461 -Wparentheses @gol
4462 -Wpessimizing-move @r{(only for C++)} @gol
4463 -Wpointer-sign @gol
4464 -Wreorder @gol
4465 -Wrestrict @gol
4466 -Wreturn-type @gol
4467 -Wsequence-point @gol
4468 -Wsign-compare @r{(only in C++)} @gol
4469 -Wsizeof-pointer-div @gol
4470 -Wsizeof-pointer-memaccess @gol
4471 -Wstrict-aliasing @gol
4472 -Wstrict-overflow=1 @gol
4473 -Wswitch @gol
4474 -Wtautological-compare @gol
4475 -Wtrigraphs @gol
4476 -Wuninitialized @gol
4477 -Wunknown-pragmas @gol
4478 -Wunused-function @gol
4479 -Wunused-label @gol
4480 -Wunused-value @gol
4481 -Wunused-variable @gol
4482 -Wvolatile-register-var}
4483
4484 Note that some warning flags are not implied by @option{-Wall}. Some of
4485 them warn about constructions that users generally do not consider
4486 questionable, but which occasionally you might wish to check for;
4487 others warn about constructions that are necessary or hard to avoid in
4488 some cases, and there is no simple way to modify the code to suppress
4489 the warning. Some of them are enabled by @option{-Wextra} but many of
4490 them must be enabled individually.
4491
4492 @item -Wextra
4493 @opindex W
4494 @opindex Wextra
4495 @opindex Wno-extra
4496 This enables some extra warning flags that are not enabled by
4497 @option{-Wall}. (This option used to be called @option{-W}. The older
4498 name is still supported, but the newer name is more descriptive.)
4499
4500 @gccoptlist{-Wclobbered @gol
4501 -Wcast-function-type @gol
4502 -Wdeprecated-copy @r{(C++ only)} @gol
4503 -Wempty-body @gol
4504 -Wignored-qualifiers @gol
4505 -Wimplicit-fallthrough=3 @gol
4506 -Wmissing-field-initializers @gol
4507 -Wmissing-parameter-type @r{(C only)} @gol
4508 -Wold-style-declaration @r{(C only)} @gol
4509 -Woverride-init @gol
4510 -Wsign-compare @r{(C only)} @gol
4511 -Wstring-compare @gol
4512 -Wredundant-move @r{(only for C++)} @gol
4513 -Wtype-limits @gol
4514 -Wuninitialized @gol
4515 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4516 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4517 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4518
4519
4520 The option @option{-Wextra} also prints warning messages for the
4521 following cases:
4522
4523 @itemize @bullet
4524
4525 @item
4526 A pointer is compared against integer zero with @code{<}, @code{<=},
4527 @code{>}, or @code{>=}.
4528
4529 @item
4530 (C++ only) An enumerator and a non-enumerator both appear in a
4531 conditional expression.
4532
4533 @item
4534 (C++ only) Ambiguous virtual bases.
4535
4536 @item
4537 (C++ only) Subscripting an array that has been declared @code{register}.
4538
4539 @item
4540 (C++ only) Taking the address of a variable that has been declared
4541 @code{register}.
4542
4543 @item
4544 (C++ only) A base class is not initialized in the copy constructor
4545 of a derived class.
4546
4547 @end itemize
4548
4549 @item -Wchar-subscripts
4550 @opindex Wchar-subscripts
4551 @opindex Wno-char-subscripts
4552 Warn if an array subscript has type @code{char}. This is a common cause
4553 of error, as programmers often forget that this type is signed on some
4554 machines.
4555 This warning is enabled by @option{-Wall}.
4556
4557 @item -Wno-coverage-mismatch
4558 @opindex Wno-coverage-mismatch
4559 @opindex Wcoverage-mismatch
4560 Warn if feedback profiles do not match when using the
4561 @option{-fprofile-use} option.
4562 If a source file is changed between compiling with @option{-fprofile-generate}
4563 and with @option{-fprofile-use}, the files with the profile feedback can fail
4564 to match the source file and GCC cannot use the profile feedback
4565 information. By default, this warning is enabled and is treated as an
4566 error. @option{-Wno-coverage-mismatch} can be used to disable the
4567 warning or @option{-Wno-error=coverage-mismatch} can be used to
4568 disable the error. Disabling the error for this warning can result in
4569 poorly optimized code and is useful only in the
4570 case of very minor changes such as bug fixes to an existing code-base.
4571 Completely disabling the warning is not recommended.
4572
4573 @item -Wno-cpp
4574 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4575
4576 Suppress warning messages emitted by @code{#warning} directives.
4577
4578 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4579 @opindex Wdouble-promotion
4580 @opindex Wno-double-promotion
4581 Give a warning when a value of type @code{float} is implicitly
4582 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4583 floating-point unit implement @code{float} in hardware, but emulate
4584 @code{double} in software. On such a machine, doing computations
4585 using @code{double} values is much more expensive because of the
4586 overhead required for software emulation.
4587
4588 It is easy to accidentally do computations with @code{double} because
4589 floating-point literals are implicitly of type @code{double}. For
4590 example, in:
4591 @smallexample
4592 @group
4593 float area(float radius)
4594 @{
4595 return 3.14159 * radius * radius;
4596 @}
4597 @end group
4598 @end smallexample
4599 the compiler performs the entire computation with @code{double}
4600 because the floating-point literal is a @code{double}.
4601
4602 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4603 @opindex Wduplicate-decl-specifier
4604 @opindex Wno-duplicate-decl-specifier
4605 Warn if a declaration has duplicate @code{const}, @code{volatile},
4606 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4607 @option{-Wall}.
4608
4609 @item -Wformat
4610 @itemx -Wformat=@var{n}
4611 @opindex Wformat
4612 @opindex Wno-format
4613 @opindex ffreestanding
4614 @opindex fno-builtin
4615 @opindex Wformat=
4616 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4617 the arguments supplied have types appropriate to the format string
4618 specified, and that the conversions specified in the format string make
4619 sense. This includes standard functions, and others specified by format
4620 attributes (@pxref{Function Attributes}), in the @code{printf},
4621 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4622 not in the C standard) families (or other target-specific families).
4623 Which functions are checked without format attributes having been
4624 specified depends on the standard version selected, and such checks of
4625 functions without the attribute specified are disabled by
4626 @option{-ffreestanding} or @option{-fno-builtin}.
4627
4628 The formats are checked against the format features supported by GNU
4629 libc version 2.2. These include all ISO C90 and C99 features, as well
4630 as features from the Single Unix Specification and some BSD and GNU
4631 extensions. Other library implementations may not support all these
4632 features; GCC does not support warning about features that go beyond a
4633 particular library's limitations. However, if @option{-Wpedantic} is used
4634 with @option{-Wformat}, warnings are given about format features not
4635 in the selected standard version (but not for @code{strfmon} formats,
4636 since those are not in any version of the C standard). @xref{C Dialect
4637 Options,,Options Controlling C Dialect}.
4638
4639 @table @gcctabopt
4640 @item -Wformat=1
4641 @itemx -Wformat
4642 @opindex Wformat
4643 @opindex Wformat=1
4644 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4645 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4646 @option{-Wformat} also checks for null format arguments for several
4647 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4648 aspects of this level of format checking can be disabled by the
4649 options: @option{-Wno-format-contains-nul},
4650 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4651 @option{-Wformat} is enabled by @option{-Wall}.
4652
4653 @item -Wno-format-contains-nul
4654 @opindex Wno-format-contains-nul
4655 @opindex Wformat-contains-nul
4656 If @option{-Wformat} is specified, do not warn about format strings that
4657 contain NUL bytes.
4658
4659 @item -Wno-format-extra-args
4660 @opindex Wno-format-extra-args
4661 @opindex Wformat-extra-args
4662 If @option{-Wformat} is specified, do not warn about excess arguments to a
4663 @code{printf} or @code{scanf} format function. The C standard specifies
4664 that such arguments are ignored.
4665
4666 Where the unused arguments lie between used arguments that are
4667 specified with @samp{$} operand number specifications, normally
4668 warnings are still given, since the implementation could not know what
4669 type to pass to @code{va_arg} to skip the unused arguments. However,
4670 in the case of @code{scanf} formats, this option suppresses the
4671 warning if the unused arguments are all pointers, since the Single
4672 Unix Specification says that such unused arguments are allowed.
4673
4674 @item -Wformat-overflow
4675 @itemx -Wformat-overflow=@var{level}
4676 @opindex Wformat-overflow
4677 @opindex Wno-format-overflow
4678 Warn about calls to formatted input/output functions such as @code{sprintf}
4679 and @code{vsprintf} that might overflow the destination buffer. When the
4680 exact number of bytes written by a format directive cannot be determined
4681 at compile-time it is estimated based on heuristics that depend on the
4682 @var{level} argument and on optimization. While enabling optimization
4683 will in most cases improve the accuracy of the warning, it may also
4684 result in false positives.
4685
4686 @table @gcctabopt
4687 @item -Wformat-overflow
4688 @itemx -Wformat-overflow=1
4689 @opindex Wformat-overflow
4690 @opindex Wno-format-overflow
4691 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4692 employs a conservative approach that warns only about calls that most
4693 likely overflow the buffer. At this level, numeric arguments to format
4694 directives with unknown values are assumed to have the value of one, and
4695 strings of unknown length to be empty. Numeric arguments that are known
4696 to be bounded to a subrange of their type, or string arguments whose output
4697 is bounded either by their directive's precision or by a finite set of
4698 string literals, are assumed to take on the value within the range that
4699 results in the most bytes on output. For example, the call to @code{sprintf}
4700 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4701 the terminating NUL character (@code{'\0'}) appended by the function
4702 to the destination buffer will be written past its end. Increasing
4703 the size of the buffer by a single byte is sufficient to avoid the
4704 warning, though it may not be sufficient to avoid the overflow.
4705
4706 @smallexample
4707 void f (int a, int b)
4708 @{
4709 char buf [13];
4710 sprintf (buf, "a = %i, b = %i\n", a, b);
4711 @}
4712 @end smallexample
4713
4714 @item -Wformat-overflow=2
4715 Level @var{2} warns also about calls that might overflow the destination
4716 buffer given an argument of sufficient length or magnitude. At level
4717 @var{2}, unknown numeric arguments are assumed to have the minimum
4718 representable value for signed types with a precision greater than 1, and
4719 the maximum representable value otherwise. Unknown string arguments whose
4720 length cannot be assumed to be bounded either by the directive's precision,
4721 or by a finite set of string literals they may evaluate to, or the character
4722 array they may point to, are assumed to be 1 character long.
4723
4724 At level @var{2}, the call in the example above is again diagnosed, but
4725 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4726 @code{%i} directive will write some of its digits beyond the end of
4727 the destination buffer. To make the call safe regardless of the values
4728 of the two variables, the size of the destination buffer must be increased
4729 to at least 34 bytes. GCC includes the minimum size of the buffer in
4730 an informational note following the warning.
4731
4732 An alternative to increasing the size of the destination buffer is to
4733 constrain the range of formatted values. The maximum length of string
4734 arguments can be bounded by specifying the precision in the format
4735 directive. When numeric arguments of format directives can be assumed
4736 to be bounded by less than the precision of their type, choosing
4737 an appropriate length modifier to the format specifier will reduce
4738 the required buffer size. For example, if @var{a} and @var{b} in the
4739 example above can be assumed to be within the precision of
4740 the @code{short int} type then using either the @code{%hi} format
4741 directive or casting the argument to @code{short} reduces the maximum
4742 required size of the buffer to 24 bytes.
4743
4744 @smallexample
4745 void f (int a, int b)
4746 @{
4747 char buf [23];
4748 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4749 @}
4750 @end smallexample
4751 @end table
4752
4753 @item -Wno-format-zero-length
4754 @opindex Wno-format-zero-length
4755 @opindex Wformat-zero-length
4756 If @option{-Wformat} is specified, do not warn about zero-length formats.
4757 The C standard specifies that zero-length formats are allowed.
4758
4759
4760 @item -Wformat=2
4761 @opindex Wformat=2
4762 Enable @option{-Wformat} plus additional format checks. Currently
4763 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4764 -Wformat-y2k}.
4765
4766 @item -Wformat-nonliteral
4767 @opindex Wformat-nonliteral
4768 @opindex Wno-format-nonliteral
4769 If @option{-Wformat} is specified, also warn if the format string is not a
4770 string literal and so cannot be checked, unless the format function
4771 takes its format arguments as a @code{va_list}.
4772
4773 @item -Wformat-security
4774 @opindex Wformat-security
4775 @opindex Wno-format-security
4776 If @option{-Wformat} is specified, also warn about uses of format
4777 functions that represent possible security problems. At present, this
4778 warns about calls to @code{printf} and @code{scanf} functions where the
4779 format string is not a string literal and there are no format arguments,
4780 as in @code{printf (foo);}. This may be a security hole if the format
4781 string came from untrusted input and contains @samp{%n}. (This is
4782 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4783 in future warnings may be added to @option{-Wformat-security} that are not
4784 included in @option{-Wformat-nonliteral}.)
4785
4786 @item -Wformat-signedness
4787 @opindex Wformat-signedness
4788 @opindex Wno-format-signedness
4789 If @option{-Wformat} is specified, also warn if the format string
4790 requires an unsigned argument and the argument is signed and vice versa.
4791
4792 @item -Wformat-truncation
4793 @itemx -Wformat-truncation=@var{level}
4794 @opindex Wformat-truncation
4795 @opindex Wno-format-truncation
4796 Warn about calls to formatted input/output functions such as @code{snprintf}
4797 and @code{vsnprintf} that might result in output truncation. When the exact
4798 number of bytes written by a format directive cannot be determined at
4799 compile-time it is estimated based on heuristics that depend on
4800 the @var{level} argument and on optimization. While enabling optimization
4801 will in most cases improve the accuracy of the warning, it may also result
4802 in false positives. Except as noted otherwise, the option uses the same
4803 logic @option{-Wformat-overflow}.
4804
4805 @table @gcctabopt
4806 @item -Wformat-truncation
4807 @itemx -Wformat-truncation=1
4808 @opindex Wformat-truncation
4809 @opindex Wno-format-truncation
4810 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4811 employs a conservative approach that warns only about calls to bounded
4812 functions whose return value is unused and that will most likely result
4813 in output truncation.
4814
4815 @item -Wformat-truncation=2
4816 Level @var{2} warns also about calls to bounded functions whose return
4817 value is used and that might result in truncation given an argument of
4818 sufficient length or magnitude.
4819 @end table
4820
4821 @item -Wformat-y2k
4822 @opindex Wformat-y2k
4823 @opindex Wno-format-y2k
4824 If @option{-Wformat} is specified, also warn about @code{strftime}
4825 formats that may yield only a two-digit year.
4826 @end table
4827
4828 @item -Wnonnull
4829 @opindex Wnonnull
4830 @opindex Wno-nonnull
4831 Warn about passing a null pointer for arguments marked as
4832 requiring a non-null value by the @code{nonnull} function attribute.
4833
4834 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4835 can be disabled with the @option{-Wno-nonnull} option.
4836
4837 @item -Wnonnull-compare
4838 @opindex Wnonnull-compare
4839 @opindex Wno-nonnull-compare
4840 Warn when comparing an argument marked with the @code{nonnull}
4841 function attribute against null inside the function.
4842
4843 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4844 can be disabled with the @option{-Wno-nonnull-compare} option.
4845
4846 @item -Wnull-dereference
4847 @opindex Wnull-dereference
4848 @opindex Wno-null-dereference
4849 Warn if the compiler detects paths that trigger erroneous or
4850 undefined behavior due to dereferencing a null pointer. This option
4851 is only active when @option{-fdelete-null-pointer-checks} is active,
4852 which is enabled by optimizations in most targets. The precision of
4853 the warnings depends on the optimization options used.
4854
4855 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4856 @opindex Winaccessible-base
4857 @opindex Wno-inaccessible-base
4858 Warn when a base class is inaccessible in a class derived from it due to
4859 ambiguity. The warning is enabled by default. Note the warning for virtual
4860 bases is enabled by the @option{-Wextra} option.
4861 @smallexample
4862 @group
4863 struct A @{ int a; @};
4864
4865 struct B : A @{ @};
4866
4867 struct C : B, A @{ @};
4868 @end group
4869 @end smallexample
4870
4871 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4872 @opindex Winit-self
4873 @opindex Wno-init-self
4874 Warn about uninitialized variables that are initialized with themselves.
4875 Note this option can only be used with the @option{-Wuninitialized} option.
4876
4877 For example, GCC warns about @code{i} being uninitialized in the
4878 following snippet only when @option{-Winit-self} has been specified:
4879 @smallexample
4880 @group
4881 int f()
4882 @{
4883 int i = i;
4884 return i;
4885 @}
4886 @end group
4887 @end smallexample
4888
4889 This warning is enabled by @option{-Wall} in C++.
4890
4891 @item -Wimplicit-int @r{(C and Objective-C only)}
4892 @opindex Wimplicit-int
4893 @opindex Wno-implicit-int
4894 Warn when a declaration does not specify a type.
4895 This warning is enabled by @option{-Wall}.
4896
4897 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4898 @opindex Wimplicit-function-declaration
4899 @opindex Wno-implicit-function-declaration
4900 Give a warning whenever a function is used before being declared. In
4901 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4902 enabled by default and it is made into an error by
4903 @option{-pedantic-errors}. This warning is also enabled by
4904 @option{-Wall}.
4905
4906 @item -Wimplicit @r{(C and Objective-C only)}
4907 @opindex Wimplicit
4908 @opindex Wno-implicit
4909 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4910 This warning is enabled by @option{-Wall}.
4911
4912 @item -Wimplicit-fallthrough
4913 @opindex Wimplicit-fallthrough
4914 @opindex Wno-implicit-fallthrough
4915 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4916 and @option{-Wno-implicit-fallthrough} is the same as
4917 @option{-Wimplicit-fallthrough=0}.
4918
4919 @item -Wimplicit-fallthrough=@var{n}
4920 @opindex Wimplicit-fallthrough=
4921 Warn when a switch case falls through. For example:
4922
4923 @smallexample
4924 @group
4925 switch (cond)
4926 @{
4927 case 1:
4928 a = 1;
4929 break;
4930 case 2:
4931 a = 2;
4932 case 3:
4933 a = 3;
4934 break;
4935 @}
4936 @end group
4937 @end smallexample
4938
4939 This warning does not warn when the last statement of a case cannot
4940 fall through, e.g. when there is a return statement or a call to function
4941 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4942 also takes into account control flow statements, such as ifs, and only
4943 warns when appropriate. E.g.@:
4944
4945 @smallexample
4946 @group
4947 switch (cond)
4948 @{
4949 case 1:
4950 if (i > 3) @{
4951 bar (5);
4952 break;
4953 @} else if (i < 1) @{
4954 bar (0);
4955 @} else
4956 return;
4957 default:
4958 @dots{}
4959 @}
4960 @end group
4961 @end smallexample
4962
4963 Since there are occasions where a switch case fall through is desirable,
4964 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4965 to be used along with a null statement to suppress this warning that
4966 would normally occur:
4967
4968 @smallexample
4969 @group
4970 switch (cond)
4971 @{
4972 case 1:
4973 bar (0);
4974 __attribute__ ((fallthrough));
4975 default:
4976 @dots{}
4977 @}
4978 @end group
4979 @end smallexample
4980
4981 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4982 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4983 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4984 Instead of these attributes, it is also possible to add a fallthrough comment
4985 to silence the warning. The whole body of the C or C++ style comment should
4986 match the given regular expressions listed below. The option argument @var{n}
4987 specifies what kind of comments are accepted:
4988
4989 @itemize @bullet
4990
4991 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4992
4993 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4994 expression, any comment is used as fallthrough comment.
4995
4996 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4997 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4998
4999 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5000 following regular expressions:
5001
5002 @itemize @bullet
5003
5004 @item @code{-fallthrough}
5005
5006 @item @code{@@fallthrough@@}
5007
5008 @item @code{lint -fallthrough[ \t]*}
5009
5010 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5011
5012 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5013
5014 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5015
5016 @end itemize
5017
5018 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5019 following regular expressions:
5020
5021 @itemize @bullet
5022
5023 @item @code{-fallthrough}
5024
5025 @item @code{@@fallthrough@@}
5026
5027 @item @code{lint -fallthrough[ \t]*}
5028
5029 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5030
5031 @end itemize
5032
5033 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5034 fallthrough comments, only attributes disable the warning.
5035
5036 @end itemize
5037
5038 The comment needs to be followed after optional whitespace and other comments
5039 by @code{case} or @code{default} keywords or by a user label that precedes some
5040 @code{case} or @code{default} label.
5041
5042 @smallexample
5043 @group
5044 switch (cond)
5045 @{
5046 case 1:
5047 bar (0);
5048 /* FALLTHRU */
5049 default:
5050 @dots{}
5051 @}
5052 @end group
5053 @end smallexample
5054
5055 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5056
5057 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5058 @opindex Wif-not-aligned
5059 @opindex Wno-if-not-aligned
5060 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5061 should be issued. This is enabled by default.
5062 Use @option{-Wno-if-not-aligned} to disable it.
5063
5064 @item -Wignored-qualifiers @r{(C and C++ only)}
5065 @opindex Wignored-qualifiers
5066 @opindex Wno-ignored-qualifiers
5067 Warn if the return type of a function has a type qualifier
5068 such as @code{const}. For ISO C such a type qualifier has no effect,
5069 since the value returned by a function is not an lvalue.
5070 For C++, the warning is only emitted for scalar types or @code{void}.
5071 ISO C prohibits qualified @code{void} return types on function
5072 definitions, so such return types always receive a warning
5073 even without this option.
5074
5075 This warning is also enabled by @option{-Wextra}.
5076
5077 @item -Wignored-attributes @r{(C and C++ only)}
5078 @opindex Wignored-attributes
5079 @opindex Wno-ignored-attributes
5080 Warn when an attribute is ignored. This is different from the
5081 @option{-Wattributes} option in that it warns whenever the compiler decides
5082 to drop an attribute, not that the attribute is either unknown, used in a
5083 wrong place, etc. This warning is enabled by default.
5084
5085 @item -Wmain
5086 @opindex Wmain
5087 @opindex Wno-main
5088 Warn if the type of @code{main} is suspicious. @code{main} should be
5089 a function with external linkage, returning int, taking either zero
5090 arguments, two, or three arguments of appropriate types. This warning
5091 is enabled by default in C++ and is enabled by either @option{-Wall}
5092 or @option{-Wpedantic}.
5093
5094 @item -Wmisleading-indentation @r{(C and C++ only)}
5095 @opindex Wmisleading-indentation
5096 @opindex Wno-misleading-indentation
5097 Warn when the indentation of the code does not reflect the block structure.
5098 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5099 @code{for} clauses with a guarded statement that does not use braces,
5100 followed by an unguarded statement with the same indentation.
5101
5102 In the following example, the call to ``bar'' is misleadingly indented as
5103 if it were guarded by the ``if'' conditional.
5104
5105 @smallexample
5106 if (some_condition ())
5107 foo ();
5108 bar (); /* Gotcha: this is not guarded by the "if". */
5109 @end smallexample
5110
5111 In the case of mixed tabs and spaces, the warning uses the
5112 @option{-ftabstop=} option to determine if the statements line up
5113 (defaulting to 8).
5114
5115 The warning is not issued for code involving multiline preprocessor logic
5116 such as the following example.
5117
5118 @smallexample
5119 if (flagA)
5120 foo (0);
5121 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5122 if (flagB)
5123 #endif
5124 foo (1);
5125 @end smallexample
5126
5127 The warning is not issued after a @code{#line} directive, since this
5128 typically indicates autogenerated code, and no assumptions can be made
5129 about the layout of the file that the directive references.
5130
5131 This warning is enabled by @option{-Wall} in C and C++.
5132
5133 @item -Wmissing-attributes
5134 @opindex Wmissing-attributes
5135 @opindex Wno-missing-attributes
5136 Warn when a declaration of a function is missing one or more attributes
5137 that a related function is declared with and whose absence may adversely
5138 affect the correctness or efficiency of generated code. For example,
5139 the warning is issued for declarations of aliases that use attributes
5140 to specify less restrictive requirements than those of their targets.
5141 This typically represents a potential optimization opportunity.
5142 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5143 issued when the alias is more restrictive than the target, which could
5144 lead to incorrect code generation.
5145 Attributes considered include @code{alloc_align}, @code{alloc_size},
5146 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5147 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5148 @code{returns_nonnull}, and @code{returns_twice}.
5149
5150 In C++, the warning is issued when an explicit specialization of a primary
5151 template declared with attribute @code{alloc_align}, @code{alloc_size},
5152 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5153 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5154 @code{error}, and @code{warning} suppress the warning.
5155 (@pxref{Function Attributes}).
5156
5157 You can use the @code{copy} attribute to apply the same
5158 set of attributes to a declaration as that on another declaration without
5159 explicitly enumerating the attributes. This attribute can be applied
5160 to declarations of functions (@pxref{Common Function Attributes}),
5161 variables (@pxref{Common Variable Attributes}), or types
5162 (@pxref{Common Type Attributes}).
5163
5164 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5165
5166 For example, since the declaration of the primary function template
5167 below makes use of both attribute @code{malloc} and @code{alloc_size}
5168 the declaration of the explicit specialization of the template is
5169 diagnosed because it is missing one of the attributes.
5170
5171 @smallexample
5172 template <class T>
5173 T* __attribute__ ((malloc, alloc_size (1)))
5174 allocate (size_t);
5175
5176 template <>
5177 void* __attribute__ ((malloc)) // missing alloc_size
5178 allocate<void> (size_t);
5179 @end smallexample
5180
5181 @item -Wmissing-braces
5182 @opindex Wmissing-braces
5183 @opindex Wno-missing-braces
5184 Warn if an aggregate or union initializer is not fully bracketed. In
5185 the following example, the initializer for @code{a} is not fully
5186 bracketed, but that for @code{b} is fully bracketed. This warning is
5187 enabled by @option{-Wall} in C.
5188
5189 @smallexample
5190 int a[2][2] = @{ 0, 1, 2, 3 @};
5191 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5192 @end smallexample
5193
5194 This warning is enabled by @option{-Wall}.
5195
5196 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5197 @opindex Wmissing-include-dirs
5198 @opindex Wno-missing-include-dirs
5199 Warn if a user-supplied include directory does not exist.
5200
5201 @item -Wmissing-profile
5202 @opindex Wmissing-profile
5203 @opindex Wno-missing-profile
5204 Warn if feedback profiles are missing when using the
5205 @option{-fprofile-use} option.
5206 This option diagnoses those cases where a new function or a new file is added
5207 to the user code between compiling with @option{-fprofile-generate} and with
5208 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5209 profile feedback data files do not contain any profile feedback information for
5210 the newly added function or file respectively. Also, in the case when profile
5211 count data (.gcda) files are removed, GCC cannot use any profile feedback
5212 information. In all these cases, warnings are issued to inform the user that a
5213 profile generation step is due. @option{-Wno-missing-profile} can be used to
5214 disable the warning. Ignoring the warning can result in poorly optimized code.
5215 Completely disabling the warning is not recommended and should be done only
5216 when non-existent profile data is justified.
5217
5218 @item -Wmultistatement-macros
5219 @opindex Wmultistatement-macros
5220 @opindex Wno-multistatement-macros
5221 Warn about unsafe multiple statement macros that appear to be guarded
5222 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5223 @code{while}, in which only the first statement is actually guarded after
5224 the macro is expanded.
5225
5226 For example:
5227
5228 @smallexample
5229 #define DOIT x++; y++
5230 if (c)
5231 DOIT;
5232 @end smallexample
5233
5234 will increment @code{y} unconditionally, not just when @code{c} holds.
5235 The can usually be fixed by wrapping the macro in a do-while loop:
5236 @smallexample
5237 #define DOIT do @{ x++; y++; @} while (0)
5238 if (c)
5239 DOIT;
5240 @end smallexample
5241
5242 This warning is enabled by @option{-Wall} in C and C++.
5243
5244 @item -Wparentheses
5245 @opindex Wparentheses
5246 @opindex Wno-parentheses
5247 Warn if parentheses are omitted in certain contexts, such
5248 as when there is an assignment in a context where a truth value
5249 is expected, or when operators are nested whose precedence people
5250 often get confused about.
5251
5252 Also warn if a comparison like @code{x<=y<=z} appears; this is
5253 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5254 interpretation from that of ordinary mathematical notation.
5255
5256 Also warn for dangerous uses of the GNU extension to
5257 @code{?:} with omitted middle operand. When the condition
5258 in the @code{?}: operator is a boolean expression, the omitted value is
5259 always 1. Often programmers expect it to be a value computed
5260 inside the conditional expression instead.
5261
5262 For C++ this also warns for some cases of unnecessary parentheses in
5263 declarations, which can indicate an attempt at a function call instead
5264 of a declaration:
5265 @smallexample
5266 @{
5267 // Declares a local variable called mymutex.
5268 std::unique_lock<std::mutex> (mymutex);
5269 // User meant std::unique_lock<std::mutex> lock (mymutex);
5270 @}
5271 @end smallexample
5272
5273 This warning is enabled by @option{-Wall}.
5274
5275 @item -Wsequence-point
5276 @opindex Wsequence-point
5277 @opindex Wno-sequence-point
5278 Warn about code that may have undefined semantics because of violations
5279 of sequence point rules in the C and C++ standards.
5280
5281 The C and C++ standards define the order in which expressions in a C/C++
5282 program are evaluated in terms of @dfn{sequence points}, which represent
5283 a partial ordering between the execution of parts of the program: those
5284 executed before the sequence point, and those executed after it. These
5285 occur after the evaluation of a full expression (one which is not part
5286 of a larger expression), after the evaluation of the first operand of a
5287 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5288 function is called (but after the evaluation of its arguments and the
5289 expression denoting the called function), and in certain other places.
5290 Other than as expressed by the sequence point rules, the order of
5291 evaluation of subexpressions of an expression is not specified. All
5292 these rules describe only a partial order rather than a total order,
5293 since, for example, if two functions are called within one expression
5294 with no sequence point between them, the order in which the functions
5295 are called is not specified. However, the standards committee have
5296 ruled that function calls do not overlap.
5297
5298 It is not specified when between sequence points modifications to the
5299 values of objects take effect. Programs whose behavior depends on this
5300 have undefined behavior; the C and C++ standards specify that ``Between
5301 the previous and next sequence point an object shall have its stored
5302 value modified at most once by the evaluation of an expression.
5303 Furthermore, the prior value shall be read only to determine the value
5304 to be stored.''. If a program breaks these rules, the results on any
5305 particular implementation are entirely unpredictable.
5306
5307 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5308 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5309 diagnosed by this option, and it may give an occasional false positive
5310 result, but in general it has been found fairly effective at detecting
5311 this sort of problem in programs.
5312
5313 The C++17 standard will define the order of evaluation of operands in
5314 more cases: in particular it requires that the right-hand side of an
5315 assignment be evaluated before the left-hand side, so the above
5316 examples are no longer undefined. But this warning will still warn
5317 about them, to help people avoid writing code that is undefined in C
5318 and earlier revisions of C++.
5319
5320 The standard is worded confusingly, therefore there is some debate
5321 over the precise meaning of the sequence point rules in subtle cases.
5322 Links to discussions of the problem, including proposed formal
5323 definitions, may be found on the GCC readings page, at
5324 @uref{http://gcc.gnu.org/@/readings.html}.
5325
5326 This warning is enabled by @option{-Wall} for C and C++.
5327
5328 @item -Wno-return-local-addr
5329 @opindex Wno-return-local-addr
5330 @opindex Wreturn-local-addr
5331 Do not warn about returning a pointer (or in C++, a reference) to a
5332 variable that goes out of scope after the function returns.
5333
5334 @item -Wreturn-type
5335 @opindex Wreturn-type
5336 @opindex Wno-return-type
5337 Warn whenever a function is defined with a return type that defaults
5338 to @code{int}. Also warn about any @code{return} statement with no
5339 return value in a function whose return type is not @code{void}
5340 (falling off the end of the function body is considered returning
5341 without a value).
5342
5343 For C only, warn about a @code{return} statement with an expression in a
5344 function whose return type is @code{void}, unless the expression type is
5345 also @code{void}. As a GNU extension, the latter case is accepted
5346 without a warning unless @option{-Wpedantic} is used. Attempting
5347 to use the return value of a non-@code{void} function other than @code{main}
5348 that flows off the end by reaching the closing curly brace that terminates
5349 the function is undefined.
5350
5351 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5352 than @code{main} results in undefined behavior even when the value of
5353 the function is not used.
5354
5355 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5356
5357 @item -Wshift-count-negative
5358 @opindex Wshift-count-negative
5359 @opindex Wno-shift-count-negative
5360 Warn if shift count is negative. This warning is enabled by default.
5361
5362 @item -Wshift-count-overflow
5363 @opindex Wshift-count-overflow
5364 @opindex Wno-shift-count-overflow
5365 Warn if shift count >= width of type. This warning is enabled by default.
5366
5367 @item -Wshift-negative-value
5368 @opindex Wshift-negative-value
5369 @opindex Wno-shift-negative-value
5370 Warn if left shifting a negative value. This warning is enabled by
5371 @option{-Wextra} in C99 and C++11 modes (and newer).
5372
5373 @item -Wshift-overflow
5374 @itemx -Wshift-overflow=@var{n}
5375 @opindex Wshift-overflow
5376 @opindex Wno-shift-overflow
5377 Warn about left shift overflows. This warning is enabled by
5378 default in C99 and C++11 modes (and newer).
5379
5380 @table @gcctabopt
5381 @item -Wshift-overflow=1
5382 This is the warning level of @option{-Wshift-overflow} and is enabled
5383 by default in C99 and C++11 modes (and newer). This warning level does
5384 not warn about left-shifting 1 into the sign bit. (However, in C, such
5385 an overflow is still rejected in contexts where an integer constant expression
5386 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5387 shifts always wrap.
5388
5389 @item -Wshift-overflow=2
5390 This warning level also warns about left-shifting 1 into the sign bit,
5391 unless C++14 mode (or newer) is active.
5392 @end table
5393
5394 @item -Wswitch
5395 @opindex Wswitch
5396 @opindex Wno-switch
5397 Warn whenever a @code{switch} statement has an index of enumerated type
5398 and lacks a @code{case} for one or more of the named codes of that
5399 enumeration. (The presence of a @code{default} label prevents this
5400 warning.) @code{case} labels outside the enumeration range also
5401 provoke warnings when this option is used (even if there is a
5402 @code{default} label).
5403 This warning is enabled by @option{-Wall}.
5404
5405 @item -Wswitch-default
5406 @opindex Wswitch-default
5407 @opindex Wno-switch-default
5408 Warn whenever a @code{switch} statement does not have a @code{default}
5409 case.
5410
5411 @item -Wswitch-enum
5412 @opindex Wswitch-enum
5413 @opindex Wno-switch-enum
5414 Warn whenever a @code{switch} statement has an index of enumerated type
5415 and lacks a @code{case} for one or more of the named codes of that
5416 enumeration. @code{case} labels outside the enumeration range also
5417 provoke warnings when this option is used. The only difference
5418 between @option{-Wswitch} and this option is that this option gives a
5419 warning about an omitted enumeration code even if there is a
5420 @code{default} label.
5421
5422 @item -Wswitch-bool
5423 @opindex Wswitch-bool
5424 @opindex Wno-switch-bool
5425 Warn whenever a @code{switch} statement has an index of boolean type
5426 and the case values are outside the range of a boolean type.
5427 It is possible to suppress this warning by casting the controlling
5428 expression to a type other than @code{bool}. For example:
5429 @smallexample
5430 @group
5431 switch ((int) (a == 4))
5432 @{
5433 @dots{}
5434 @}
5435 @end group
5436 @end smallexample
5437 This warning is enabled by default for C and C++ programs.
5438
5439 @item -Wswitch-outside-range
5440 @opindex Wswitch-outside-range
5441 @opindex Wno-switch-outside-range
5442 Warn whenever a @code{switch} case has a value that is outside of its
5443 respective type range. This warning is enabled by default for
5444 C and C++ programs.
5445
5446 @item -Wswitch-unreachable
5447 @opindex Wswitch-unreachable
5448 @opindex Wno-switch-unreachable
5449 Warn whenever a @code{switch} statement contains statements between the
5450 controlling expression and the first case label, which will never be
5451 executed. For example:
5452 @smallexample
5453 @group
5454 switch (cond)
5455 @{
5456 i = 15;
5457 @dots{}
5458 case 5:
5459 @dots{}
5460 @}
5461 @end group
5462 @end smallexample
5463 @option{-Wswitch-unreachable} does not warn if the statement between the
5464 controlling expression and the first case label is just a declaration:
5465 @smallexample
5466 @group
5467 switch (cond)
5468 @{
5469 int i;
5470 @dots{}
5471 case 5:
5472 i = 5;
5473 @dots{}
5474 @}
5475 @end group
5476 @end smallexample
5477 This warning is enabled by default for C and C++ programs.
5478
5479 @item -Wsync-nand @r{(C and C++ only)}
5480 @opindex Wsync-nand
5481 @opindex Wno-sync-nand
5482 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5483 built-in functions are used. These functions changed semantics in GCC 4.4.
5484
5485 @item -Wunused-but-set-parameter
5486 @opindex Wunused-but-set-parameter
5487 @opindex Wno-unused-but-set-parameter
5488 Warn whenever a function parameter is assigned to, but otherwise unused
5489 (aside from its declaration).
5490
5491 To suppress this warning use the @code{unused} attribute
5492 (@pxref{Variable Attributes}).
5493
5494 This warning is also enabled by @option{-Wunused} together with
5495 @option{-Wextra}.
5496
5497 @item -Wunused-but-set-variable
5498 @opindex Wunused-but-set-variable
5499 @opindex Wno-unused-but-set-variable
5500 Warn whenever a local variable is assigned to, but otherwise unused
5501 (aside from its declaration).
5502 This warning is enabled by @option{-Wall}.
5503
5504 To suppress this warning use the @code{unused} attribute
5505 (@pxref{Variable Attributes}).
5506
5507 This warning is also enabled by @option{-Wunused}, which is enabled
5508 by @option{-Wall}.
5509
5510 @item -Wunused-function
5511 @opindex Wunused-function
5512 @opindex Wno-unused-function
5513 Warn whenever a static function is declared but not defined or a
5514 non-inline static function is unused.
5515 This warning is enabled by @option{-Wall}.
5516
5517 @item -Wunused-label
5518 @opindex Wunused-label
5519 @opindex Wno-unused-label
5520 Warn whenever a label is declared but not used.
5521 This warning is enabled by @option{-Wall}.
5522
5523 To suppress this warning use the @code{unused} attribute
5524 (@pxref{Variable Attributes}).
5525
5526 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5527 @opindex Wunused-local-typedefs
5528 @opindex Wno-unused-local-typedefs
5529 Warn when a typedef locally defined in a function is not used.
5530 This warning is enabled by @option{-Wall}.
5531
5532 @item -Wunused-parameter
5533 @opindex Wunused-parameter
5534 @opindex Wno-unused-parameter
5535 Warn whenever a function parameter is unused aside from its declaration.
5536
5537 To suppress this warning use the @code{unused} attribute
5538 (@pxref{Variable Attributes}).
5539
5540 @item -Wno-unused-result
5541 @opindex Wunused-result
5542 @opindex Wno-unused-result
5543 Do not warn if a caller of a function marked with attribute
5544 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5545 its return value. The default is @option{-Wunused-result}.
5546
5547 @item -Wunused-variable
5548 @opindex Wunused-variable
5549 @opindex Wno-unused-variable
5550 Warn whenever a local or static variable is unused aside from its
5551 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5552 but not for C++. This warning is enabled by @option{-Wall}.
5553
5554 To suppress this warning use the @code{unused} attribute
5555 (@pxref{Variable Attributes}).
5556
5557 @item -Wunused-const-variable
5558 @itemx -Wunused-const-variable=@var{n}
5559 @opindex Wunused-const-variable
5560 @opindex Wno-unused-const-variable
5561 Warn whenever a constant static variable is unused aside from its declaration.
5562 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5563 for C, but not for C++. In C this declares variable storage, but in C++ this
5564 is not an error since const variables take the place of @code{#define}s.
5565
5566 To suppress this warning use the @code{unused} attribute
5567 (@pxref{Variable Attributes}).
5568
5569 @table @gcctabopt
5570 @item -Wunused-const-variable=1
5571 This is the warning level that is enabled by @option{-Wunused-variable} for
5572 C. It warns only about unused static const variables defined in the main
5573 compilation unit, but not about static const variables declared in any
5574 header included.
5575
5576 @item -Wunused-const-variable=2
5577 This warning level also warns for unused constant static variables in
5578 headers (excluding system headers). This is the warning level of
5579 @option{-Wunused-const-variable} and must be explicitly requested since
5580 in C++ this isn't an error and in C it might be harder to clean up all
5581 headers included.
5582 @end table
5583
5584 @item -Wunused-value
5585 @opindex Wunused-value
5586 @opindex Wno-unused-value
5587 Warn whenever a statement computes a result that is explicitly not
5588 used. To suppress this warning cast the unused expression to
5589 @code{void}. This includes an expression-statement or the left-hand
5590 side of a comma expression that contains no side effects. For example,
5591 an expression such as @code{x[i,j]} causes a warning, while
5592 @code{x[(void)i,j]} does not.
5593
5594 This warning is enabled by @option{-Wall}.
5595
5596 @item -Wunused
5597 @opindex Wunused
5598 @opindex Wno-unused
5599 All the above @option{-Wunused} options combined.
5600
5601 In order to get a warning about an unused function parameter, you must
5602 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5603 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5604
5605 @item -Wuninitialized
5606 @opindex Wuninitialized
5607 @opindex Wno-uninitialized
5608 Warn if an automatic variable is used without first being initialized.
5609 In C++, warn if a non-static reference or non-static @code{const}
5610 member appears in a class without constructors.
5611
5612 If you want to warn about code that uses the uninitialized value of the
5613 variable in its own initializer, use the @option{-Winit-self} option.
5614
5615 These warnings occur for individual uninitialized elements of
5616 structure, union or array variables as well as for variables that are
5617 uninitialized as a whole. They do not occur for variables or elements
5618 declared @code{volatile}. Because these warnings depend on
5619 optimization, the exact variables or elements for which there are
5620 warnings depend on the precise optimization options and version of GCC
5621 used.
5622
5623 Note that there may be no warning about a variable that is used only
5624 to compute a value that itself is never used, because such
5625 computations may be deleted by data flow analysis before the warnings
5626 are printed.
5627
5628 @item -Winvalid-memory-model
5629 @opindex Winvalid-memory-model
5630 @opindex Wno-invalid-memory-model
5631 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5632 and the C11 atomic generic functions with a memory consistency argument
5633 that is either invalid for the operation or outside the range of values
5634 of the @code{memory_order} enumeration. For example, since the
5635 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5636 defined for the relaxed, release, and sequentially consistent memory
5637 orders the following code is diagnosed:
5638
5639 @smallexample
5640 void store (int *i)
5641 @{
5642 __atomic_store_n (i, 0, memory_order_consume);
5643 @}
5644 @end smallexample
5645
5646 @option{-Winvalid-memory-model} is enabled by default.
5647
5648 @item -Wmaybe-uninitialized
5649 @opindex Wmaybe-uninitialized
5650 @opindex Wno-maybe-uninitialized
5651 For an automatic (i.e.@: local) variable, if there exists a path from the
5652 function entry to a use of the variable that is initialized, but there exist
5653 some other paths for which the variable is not initialized, the compiler
5654 emits a warning if it cannot prove the uninitialized paths are not
5655 executed at run time.
5656
5657 These warnings are only possible in optimizing compilation, because otherwise
5658 GCC does not keep track of the state of variables.
5659
5660 These warnings are made optional because GCC may not be able to determine when
5661 the code is correct in spite of appearing to have an error. Here is one
5662 example of how this can happen:
5663
5664 @smallexample
5665 @group
5666 @{
5667 int x;
5668 switch (y)
5669 @{
5670 case 1: x = 1;
5671 break;
5672 case 2: x = 4;
5673 break;
5674 case 3: x = 5;
5675 @}
5676 foo (x);
5677 @}
5678 @end group
5679 @end smallexample
5680
5681 @noindent
5682 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5683 always initialized, but GCC doesn't know this. To suppress the
5684 warning, you need to provide a default case with assert(0) or
5685 similar code.
5686
5687 @cindex @code{longjmp} warnings
5688 This option also warns when a non-volatile automatic variable might be
5689 changed by a call to @code{longjmp}.
5690 The compiler sees only the calls to @code{setjmp}. It cannot know
5691 where @code{longjmp} will be called; in fact, a signal handler could
5692 call it at any point in the code. As a result, you may get a warning
5693 even when there is in fact no problem because @code{longjmp} cannot
5694 in fact be called at the place that would cause a problem.
5695
5696 Some spurious warnings can be avoided if you declare all the functions
5697 you use that never return as @code{noreturn}. @xref{Function
5698 Attributes}.
5699
5700 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5701
5702 @item -Wunknown-pragmas
5703 @opindex Wunknown-pragmas
5704 @opindex Wno-unknown-pragmas
5705 @cindex warning for unknown pragmas
5706 @cindex unknown pragmas, warning
5707 @cindex pragmas, warning of unknown
5708 Warn when a @code{#pragma} directive is encountered that is not understood by
5709 GCC@. If this command-line option is used, warnings are even issued
5710 for unknown pragmas in system header files. This is not the case if
5711 the warnings are only enabled by the @option{-Wall} command-line option.
5712
5713 @item -Wno-pragmas
5714 @opindex Wno-pragmas
5715 @opindex Wpragmas
5716 Do not warn about misuses of pragmas, such as incorrect parameters,
5717 invalid syntax, or conflicts between pragmas. See also
5718 @option{-Wunknown-pragmas}.
5719
5720 @item -Wno-prio-ctor-dtor
5721 @opindex Wno-prio-ctor-dtor
5722 @opindex Wprio-ctor-dtor
5723 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5724 The use of constructor and destructor attributes allow you to assign a
5725 priority to the constructor/destructor to control its order of execution
5726 before @code{main} is called or after it returns. The priority values must be
5727 greater than 100 as the compiler reserves priority values between 0--100 for
5728 the implementation.
5729
5730 @item -Wstrict-aliasing
5731 @opindex Wstrict-aliasing
5732 @opindex Wno-strict-aliasing
5733 This option is only active when @option{-fstrict-aliasing} is active.
5734 It warns about code that might break the strict aliasing rules that the
5735 compiler is using for optimization. The warning does not catch all
5736 cases, but does attempt to catch the more common pitfalls. It is
5737 included in @option{-Wall}.
5738 It is equivalent to @option{-Wstrict-aliasing=3}
5739
5740 @item -Wstrict-aliasing=n
5741 @opindex Wstrict-aliasing=n
5742 This option is only active when @option{-fstrict-aliasing} is active.
5743 It warns about code that might break the strict aliasing rules that the
5744 compiler is using for optimization.
5745 Higher levels correspond to higher accuracy (fewer false positives).
5746 Higher levels also correspond to more effort, similar to the way @option{-O}
5747 works.
5748 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5749
5750 Level 1: Most aggressive, quick, least accurate.
5751 Possibly useful when higher levels
5752 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5753 false negatives. However, it has many false positives.
5754 Warns for all pointer conversions between possibly incompatible types,
5755 even if never dereferenced. Runs in the front end only.
5756
5757 Level 2: Aggressive, quick, not too precise.
5758 May still have many false positives (not as many as level 1 though),
5759 and few false negatives (but possibly more than level 1).
5760 Unlike level 1, it only warns when an address is taken. Warns about
5761 incomplete types. Runs in the front end only.
5762
5763 Level 3 (default for @option{-Wstrict-aliasing}):
5764 Should have very few false positives and few false
5765 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5766 Takes care of the common pun+dereference pattern in the front end:
5767 @code{*(int*)&some_float}.
5768 If optimization is enabled, it also runs in the back end, where it deals
5769 with multiple statement cases using flow-sensitive points-to information.
5770 Only warns when the converted pointer is dereferenced.
5771 Does not warn about incomplete types.
5772
5773 @item -Wstrict-overflow
5774 @itemx -Wstrict-overflow=@var{n}
5775 @opindex Wstrict-overflow
5776 @opindex Wno-strict-overflow
5777 This option is only active when signed overflow is undefined.
5778 It warns about cases where the compiler optimizes based on the
5779 assumption that signed overflow does not occur. Note that it does not
5780 warn about all cases where the code might overflow: it only warns
5781 about cases where the compiler implements some optimization. Thus
5782 this warning depends on the optimization level.
5783
5784 An optimization that assumes that signed overflow does not occur is
5785 perfectly safe if the values of the variables involved are such that
5786 overflow never does, in fact, occur. Therefore this warning can
5787 easily give a false positive: a warning about code that is not
5788 actually a problem. To help focus on important issues, several
5789 warning levels are defined. No warnings are issued for the use of
5790 undefined signed overflow when estimating how many iterations a loop
5791 requires, in particular when determining whether a loop will be
5792 executed at all.
5793
5794 @table @gcctabopt
5795 @item -Wstrict-overflow=1
5796 Warn about cases that are both questionable and easy to avoid. For
5797 example the compiler simplifies
5798 @code{x + 1 > x} to @code{1}. This level of
5799 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5800 are not, and must be explicitly requested.
5801
5802 @item -Wstrict-overflow=2
5803 Also warn about other cases where a comparison is simplified to a
5804 constant. For example: @code{abs (x) >= 0}. This can only be
5805 simplified when signed integer overflow is undefined, because
5806 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5807 zero. @option{-Wstrict-overflow} (with no level) is the same as
5808 @option{-Wstrict-overflow=2}.
5809
5810 @item -Wstrict-overflow=3
5811 Also warn about other cases where a comparison is simplified. For
5812 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5813
5814 @item -Wstrict-overflow=4
5815 Also warn about other simplifications not covered by the above cases.
5816 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5817
5818 @item -Wstrict-overflow=5
5819 Also warn about cases where the compiler reduces the magnitude of a
5820 constant involved in a comparison. For example: @code{x + 2 > y} is
5821 simplified to @code{x + 1 >= y}. This is reported only at the
5822 highest warning level because this simplification applies to many
5823 comparisons, so this warning level gives a very large number of
5824 false positives.
5825 @end table
5826
5827 @item -Wstring-compare
5828 @opindex Wstring-compare
5829 @opindex Wno-string-compare
5830 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
5831 determined to be either zero or non-zero in tests for such equality
5832 owing to the length of one argument being greater than the size of
5833 the array the other argument is stored in (or the bound in the case
5834 of @code{strncmp}). Such calls could be mistakes. For example,
5835 the call to @code{strcmp} below is diagnosed because its result is
5836 necessarily non-zero irrespective of the contents of the array @code{a}.
5837
5838 @smallexample
5839 extern char a[4];
5840 void f (char *d)
5841 @{
5842 strcpy (d, "string");
5843 @dots{}
5844 if (0 == strcmp (a, d)) // cannot be true
5845 puts ("a and d are the same");
5846 @}
5847 @end smallexample
5848
5849 @option{-Wstring-compare} is enabled by @option{-Wextra}.
5850
5851 @item -Wstringop-overflow
5852 @itemx -Wstringop-overflow=@var{type}
5853 @opindex Wstringop-overflow
5854 @opindex Wno-stringop-overflow
5855 Warn for calls to string manipulation functions such as @code{memcpy} and
5856 @code{strcpy} that are determined to overflow the destination buffer. The
5857 optional argument is one greater than the type of Object Size Checking to
5858 perform to determine the size of the destination. @xref{Object Size Checking}.
5859 The argument is meaningful only for functions that operate on character arrays
5860 but not for raw memory functions like @code{memcpy} which always make use
5861 of Object Size type-0. The option also warns for calls that specify a size
5862 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5863 The option produces the best results with optimization enabled but can detect
5864 a small subset of simple buffer overflows even without optimization in
5865 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5866 correspond to the standard functions. In any case, the option warns about
5867 just a subset of buffer overflows detected by the corresponding overflow
5868 checking built-ins. For example, the option will issue a warning for
5869 the @code{strcpy} call below because it copies at least 5 characters
5870 (the string @code{"blue"} including the terminating NUL) into the buffer
5871 of size 4.
5872
5873 @smallexample
5874 enum Color @{ blue, purple, yellow @};
5875 const char* f (enum Color clr)
5876 @{
5877 static char buf [4];
5878 const char *str;
5879 switch (clr)
5880 @{
5881 case blue: str = "blue"; break;
5882 case purple: str = "purple"; break;
5883 case yellow: str = "yellow"; break;
5884 @}
5885
5886 return strcpy (buf, str); // warning here
5887 @}
5888 @end smallexample
5889
5890 Option @option{-Wstringop-overflow=2} is enabled by default.
5891
5892 @table @gcctabopt
5893 @item -Wstringop-overflow
5894 @itemx -Wstringop-overflow=1
5895 @opindex Wstringop-overflow
5896 @opindex Wno-stringop-overflow
5897 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5898 to determine the sizes of destination objects. This is the default setting
5899 of the option. At this setting the option will not warn for writes past
5900 the end of subobjects of larger objects accessed by pointers unless the
5901 size of the largest surrounding object is known. When the destination may
5902 be one of several objects it is assumed to be the largest one of them. On
5903 Linux systems, when optimization is enabled at this setting the option warns
5904 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5905 a non-zero value.
5906
5907 @item -Wstringop-overflow=2
5908 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5909 to determine the sizes of destination objects. At this setting the option
5910 will warn about overflows when writing to members of the largest complete
5911 objects whose exact size is known. It will, however, not warn for excessive
5912 writes to the same members of unknown objects referenced by pointers since
5913 they may point to arrays containing unknown numbers of elements.
5914
5915 @item -Wstringop-overflow=3
5916 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5917 to determine the sizes of destination objects. At this setting the option
5918 warns about overflowing the smallest object or data member. This is the
5919 most restrictive setting of the option that may result in warnings for safe
5920 code.
5921
5922 @item -Wstringop-overflow=4
5923 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5924 to determine the sizes of destination objects. At this setting the option
5925 will warn about overflowing any data members, and when the destination is
5926 one of several objects it uses the size of the largest of them to decide
5927 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5928 setting of the option may result in warnings for benign code.
5929 @end table
5930
5931 @item -Wstringop-truncation
5932 @opindex Wstringop-truncation
5933 @opindex Wno-stringop-truncation
5934 Warn for calls to bounded string manipulation functions such as @code{strncat},
5935 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5936 or leave the destination unchanged.
5937
5938 In the following example, the call to @code{strncat} specifies a bound that
5939 is less than the length of the source string. As a result, the copy of
5940 the source will be truncated and so the call is diagnosed. To avoid the
5941 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5942
5943 @smallexample
5944 void append (char *buf, size_t bufsize)
5945 @{
5946 strncat (buf, ".txt", 3);
5947 @}
5948 @end smallexample
5949
5950 As another example, the following call to @code{strncpy} results in copying
5951 to @code{d} just the characters preceding the terminating NUL, without
5952 appending the NUL to the end. Assuming the result of @code{strncpy} is
5953 necessarily a NUL-terminated string is a common mistake, and so the call
5954 is diagnosed. To avoid the warning when the result is not expected to be
5955 NUL-terminated, call @code{memcpy} instead.
5956
5957 @smallexample
5958 void copy (char *d, const char *s)
5959 @{
5960 strncpy (d, s, strlen (s));
5961 @}
5962 @end smallexample
5963
5964 In the following example, the call to @code{strncpy} specifies the size
5965 of the destination buffer as the bound. If the length of the source
5966 string is equal to or greater than this size the result of the copy will
5967 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5968 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5969 element of the buffer to @code{NUL}.
5970
5971 @smallexample
5972 void copy (const char *s)
5973 @{
5974 char buf[80];
5975 strncpy (buf, s, sizeof buf);
5976 @dots{}
5977 @}
5978 @end smallexample
5979
5980 In situations where a character array is intended to store a sequence
5981 of bytes with no terminating @code{NUL} such an array may be annotated
5982 with attribute @code{nonstring} to avoid this warning. Such arrays,
5983 however, are not suitable arguments to functions that expect
5984 @code{NUL}-terminated strings. To help detect accidental misuses of
5985 such arrays GCC issues warnings unless it can prove that the use is
5986 safe. @xref{Common Variable Attributes}.
5987
5988 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5989 @opindex Wsuggest-attribute=
5990 @opindex Wno-suggest-attribute=
5991 Warn for cases where adding an attribute may be beneficial. The
5992 attributes currently supported are listed below.
5993
5994 @table @gcctabopt
5995 @item -Wsuggest-attribute=pure
5996 @itemx -Wsuggest-attribute=const
5997 @itemx -Wsuggest-attribute=noreturn
5998 @itemx -Wmissing-noreturn
5999 @itemx -Wsuggest-attribute=malloc
6000 @opindex Wsuggest-attribute=pure
6001 @opindex Wno-suggest-attribute=pure
6002 @opindex Wsuggest-attribute=const
6003 @opindex Wno-suggest-attribute=const
6004 @opindex Wsuggest-attribute=noreturn
6005 @opindex Wno-suggest-attribute=noreturn
6006 @opindex Wmissing-noreturn
6007 @opindex Wno-missing-noreturn
6008 @opindex Wsuggest-attribute=malloc
6009 @opindex Wno-suggest-attribute=malloc
6010
6011 Warn about functions that might be candidates for attributes
6012 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6013 only warns for functions visible in other compilation units or (in the case of
6014 @code{pure} and @code{const}) if it cannot prove that the function returns
6015 normally. A function returns normally if it doesn't contain an infinite loop or
6016 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6017 requires option @option{-fipa-pure-const}, which is enabled by default at
6018 @option{-O} and higher. Higher optimization levels improve the accuracy
6019 of the analysis.
6020
6021 @item -Wsuggest-attribute=format
6022 @itemx -Wmissing-format-attribute
6023 @opindex Wsuggest-attribute=format
6024 @opindex Wmissing-format-attribute
6025 @opindex Wno-suggest-attribute=format
6026 @opindex Wno-missing-format-attribute
6027 @opindex Wformat
6028 @opindex Wno-format
6029
6030 Warn about function pointers that might be candidates for @code{format}
6031 attributes. Note these are only possible candidates, not absolute ones.
6032 GCC guesses that function pointers with @code{format} attributes that
6033 are used in assignment, initialization, parameter passing or return
6034 statements should have a corresponding @code{format} attribute in the
6035 resulting type. I.e.@: the left-hand side of the assignment or
6036 initialization, the type of the parameter variable, or the return type
6037 of the containing function respectively should also have a @code{format}
6038 attribute to avoid the warning.
6039
6040 GCC also warns about function definitions that might be
6041 candidates for @code{format} attributes. Again, these are only
6042 possible candidates. GCC guesses that @code{format} attributes
6043 might be appropriate for any function that calls a function like
6044 @code{vprintf} or @code{vscanf}, but this might not always be the
6045 case, and some functions for which @code{format} attributes are
6046 appropriate may not be detected.
6047
6048 @item -Wsuggest-attribute=cold
6049 @opindex Wsuggest-attribute=cold
6050 @opindex Wno-suggest-attribute=cold
6051
6052 Warn about functions that might be candidates for @code{cold} attribute. This
6053 is based on static detection and generally will only warn about functions which
6054 always leads to a call to another @code{cold} function such as wrappers of
6055 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6056 @end table
6057
6058 @item -Wsuggest-final-types
6059 @opindex Wno-suggest-final-types
6060 @opindex Wsuggest-final-types
6061 Warn about types with virtual methods where code quality would be improved
6062 if the type were declared with the C++11 @code{final} specifier,
6063 or, if possible,
6064 declared in an anonymous namespace. This allows GCC to more aggressively
6065 devirtualize the polymorphic calls. This warning is more effective with
6066 link-time optimization,
6067 where the information about the class hierarchy graph is
6068 more complete.
6069
6070 @item -Wsuggest-final-methods
6071 @opindex Wno-suggest-final-methods
6072 @opindex Wsuggest-final-methods
6073 Warn about virtual methods where code quality would be improved if the method
6074 were declared with the C++11 @code{final} specifier,
6075 or, if possible, its type were
6076 declared in an anonymous namespace or with the @code{final} specifier.
6077 This warning is
6078 more effective with link-time optimization, where the information about the
6079 class hierarchy graph is more complete. It is recommended to first consider
6080 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6081 annotations.
6082
6083 @item -Wsuggest-override
6084 Warn about overriding virtual functions that are not marked with the override
6085 keyword.
6086
6087 @item -Walloc-zero
6088 @opindex Wno-alloc-zero
6089 @opindex Walloc-zero
6090 Warn about calls to allocation functions decorated with attribute
6091 @code{alloc_size} that specify zero bytes, including those to the built-in
6092 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6093 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6094 when called with a zero size differs among implementations (and in the case
6095 of @code{realloc} has been deprecated) relying on it may result in subtle
6096 portability bugs and should be avoided.
6097
6098 @item -Walloc-size-larger-than=@var{byte-size}
6099 @opindex Walloc-size-larger-than=
6100 @opindex Wno-alloc-size-larger-than
6101 Warn about calls to functions decorated with attribute @code{alloc_size}
6102 that attempt to allocate objects larger than the specified number of bytes,
6103 or where the result of the size computation in an integer type with infinite
6104 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6105 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6106 Warnings controlled by the option can be disabled either by specifying
6107 @var{byte-size} of @samp{SIZE_MAX} or more or by
6108 @option{-Wno-alloc-size-larger-than}.
6109 @xref{Function Attributes}.
6110
6111 @item -Wno-alloc-size-larger-than
6112 @opindex Wno-alloc-size-larger-than
6113 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6114 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6115 larger.
6116
6117 @item -Walloca
6118 @opindex Wno-alloca
6119 @opindex Walloca
6120 This option warns on all uses of @code{alloca} in the source.
6121
6122 @item -Walloca-larger-than=@var{byte-size}
6123 @opindex Walloca-larger-than=
6124 @opindex Wno-alloca-larger-than
6125 This option warns on calls to @code{alloca} with an integer argument whose
6126 value is either zero, or that is not bounded by a controlling predicate
6127 that limits its value to at most @var{byte-size}. It also warns for calls
6128 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6129 types are considered unbounded even if they appear to be constrained to
6130 the expected range.
6131
6132 For example, a bounded case of @code{alloca} could be:
6133
6134 @smallexample
6135 void func (size_t n)
6136 @{
6137 void *p;
6138 if (n <= 1000)
6139 p = alloca (n);
6140 else
6141 p = malloc (n);
6142 f (p);
6143 @}
6144 @end smallexample
6145
6146 In the above example, passing @code{-Walloca-larger-than=1000} would not
6147 issue a warning because the call to @code{alloca} is known to be at most
6148 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6149 the compiler would emit a warning.
6150
6151 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6152 controlling predicate constraining its integer argument. For example:
6153
6154 @smallexample
6155 void func ()
6156 @{
6157 void *p = alloca (n);
6158 f (p);
6159 @}
6160 @end smallexample
6161
6162 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6163 a warning, but this time because of the lack of bounds checking.
6164
6165 Note, that even seemingly correct code involving signed integers could
6166 cause a warning:
6167
6168 @smallexample
6169 void func (signed int n)
6170 @{
6171 if (n < 500)
6172 @{
6173 p = alloca (n);
6174 f (p);
6175 @}
6176 @}
6177 @end smallexample
6178
6179 In the above example, @var{n} could be negative, causing a larger than
6180 expected argument to be implicitly cast into the @code{alloca} call.
6181
6182 This option also warns when @code{alloca} is used in a loop.
6183
6184 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6185 but is usually only effective when @option{-ftree-vrp} is active (default
6186 for @option{-O2} and above).
6187
6188 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6189
6190 @item -Wno-alloca-larger-than
6191 @opindex Wno-alloca-larger-than
6192 Disable @option{-Walloca-larger-than=} warnings. The option is
6193 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6194
6195 @item -Warray-bounds
6196 @itemx -Warray-bounds=@var{n}
6197 @opindex Wno-array-bounds
6198 @opindex Warray-bounds
6199 This option is only active when @option{-ftree-vrp} is active
6200 (default for @option{-O2} and above). It warns about subscripts to arrays
6201 that are always out of bounds. This warning is enabled by @option{-Wall}.
6202
6203 @table @gcctabopt
6204 @item -Warray-bounds=1
6205 This is the warning level of @option{-Warray-bounds} and is enabled
6206 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6207
6208 @item -Warray-bounds=2
6209 This warning level also warns about out of bounds access for
6210 arrays at the end of a struct and for arrays accessed through
6211 pointers. This warning level may give a larger number of
6212 false positives and is deactivated by default.
6213 @end table
6214
6215 @item -Wattribute-alias=@var{n}
6216 @itemx -Wno-attribute-alias
6217 @opindex Wattribute-alias
6218 @opindex Wno-attribute-alias
6219 Warn about declarations using the @code{alias} and similar attributes whose
6220 target is incompatible with the type of the alias.
6221 @xref{Function Attributes,,Declaring Attributes of Functions}.
6222
6223 @table @gcctabopt
6224 @item -Wattribute-alias=1
6225 The default warning level of the @option{-Wattribute-alias} option diagnoses
6226 incompatibilities between the type of the alias declaration and that of its
6227 target. Such incompatibilities are typically indicative of bugs.
6228
6229 @item -Wattribute-alias=2
6230
6231 At this level @option{-Wattribute-alias} also diagnoses cases where
6232 the attributes of the alias declaration are more restrictive than the
6233 attributes applied to its target. These mismatches can potentially
6234 result in incorrect code generation. In other cases they may be
6235 benign and could be resolved simply by adding the missing attribute to
6236 the target. For comparison, see the @option{-Wmissing-attributes}
6237 option, which controls diagnostics when the alias declaration is less
6238 restrictive than the target, rather than more restrictive.
6239
6240 Attributes considered include @code{alloc_align}, @code{alloc_size},
6241 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6242 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6243 @code{returns_nonnull}, and @code{returns_twice}.
6244 @end table
6245
6246 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6247 This is the default. You can disable these warnings with either
6248 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6249
6250 @item -Wbool-compare
6251 @opindex Wno-bool-compare
6252 @opindex Wbool-compare
6253 Warn about boolean expression compared with an integer value different from
6254 @code{true}/@code{false}. For instance, the following comparison is
6255 always false:
6256 @smallexample
6257 int n = 5;
6258 @dots{}
6259 if ((n > 1) == 2) @{ @dots{} @}
6260 @end smallexample
6261 This warning is enabled by @option{-Wall}.
6262
6263 @item -Wbool-operation
6264 @opindex Wno-bool-operation
6265 @opindex Wbool-operation
6266 Warn about suspicious operations on expressions of a boolean type. For
6267 instance, bitwise negation of a boolean is very likely a bug in the program.
6268 For C, this warning also warns about incrementing or decrementing a boolean,
6269 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6270 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6271
6272 This warning is enabled by @option{-Wall}.
6273
6274 @item -Wduplicated-branches
6275 @opindex Wno-duplicated-branches
6276 @opindex Wduplicated-branches
6277 Warn when an if-else has identical branches. This warning detects cases like
6278 @smallexample
6279 if (p != NULL)
6280 return 0;
6281 else
6282 return 0;
6283 @end smallexample
6284 It doesn't warn when both branches contain just a null statement. This warning
6285 also warn for conditional operators:
6286 @smallexample
6287 int i = x ? *p : *p;
6288 @end smallexample
6289
6290 @item -Wduplicated-cond
6291 @opindex Wno-duplicated-cond
6292 @opindex Wduplicated-cond
6293 Warn about duplicated conditions in an if-else-if chain. For instance,
6294 warn for the following code:
6295 @smallexample
6296 if (p->q != NULL) @{ @dots{} @}
6297 else if (p->q != NULL) @{ @dots{} @}
6298 @end smallexample
6299
6300 @item -Wframe-address
6301 @opindex Wno-frame-address
6302 @opindex Wframe-address
6303 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6304 is called with an argument greater than 0. Such calls may return indeterminate
6305 values or crash the program. The warning is included in @option{-Wall}.
6306
6307 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6308 @opindex Wno-discarded-qualifiers
6309 @opindex Wdiscarded-qualifiers
6310 Do not warn if type qualifiers on pointers are being discarded.
6311 Typically, the compiler warns if a @code{const char *} variable is
6312 passed to a function that takes a @code{char *} parameter. This option
6313 can be used to suppress such a warning.
6314
6315 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6316 @opindex Wno-discarded-array-qualifiers
6317 @opindex Wdiscarded-array-qualifiers
6318 Do not warn if type qualifiers on arrays which are pointer targets
6319 are being discarded. Typically, the compiler warns if a
6320 @code{const int (*)[]} variable is passed to a function that
6321 takes a @code{int (*)[]} parameter. This option can be used to
6322 suppress such a warning.
6323
6324 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6325 @opindex Wno-incompatible-pointer-types
6326 @opindex Wincompatible-pointer-types
6327 Do not warn when there is a conversion between pointers that have incompatible
6328 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6329 which warns for pointer argument passing or assignment with different
6330 signedness.
6331
6332 @item -Wno-int-conversion @r{(C and Objective-C only)}
6333 @opindex Wno-int-conversion
6334 @opindex Wint-conversion
6335 Do not warn about incompatible integer to pointer and pointer to integer
6336 conversions. This warning is about implicit conversions; for explicit
6337 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6338 @option{-Wno-pointer-to-int-cast} may be used.
6339
6340 @item -Wzero-length-bounds
6341 @opindex Wzero-length-bounds
6342 @opindex Wzero-length-bounds
6343 Warn about accesses to elements of zero-length array members that might
6344 overlap other members of the same object. Declaring interior zero-length
6345 arrays is discouraged because accesses to them are undefined. See
6346 @xref{Zero Length}.
6347
6348 For example, the first two stores in function @code{bad} are diagnosed
6349 because the array elements overlap the subsequent members @code{b} and
6350 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
6351 because it is beyond the bounds of the enclosing object.
6352
6353 @smallexample
6354 struct X @{ int a[0]; int b, c; @};
6355 struct X x;
6356
6357 void bad (void)
6358 @{
6359 x.a[0] = 0; // -Wzero-length-bounds
6360 x.a[1] = 1; // -Wzero-length-bounds
6361 x.a[2] = 2; // -Warray-bounds
6362 @}
6363 @end smallexample
6364
6365 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6366
6367 @item -Wno-div-by-zero
6368 @opindex Wno-div-by-zero
6369 @opindex Wdiv-by-zero
6370 Do not warn about compile-time integer division by zero. Floating-point
6371 division by zero is not warned about, as it can be a legitimate way of
6372 obtaining infinities and NaNs.
6373
6374 @item -Wsystem-headers
6375 @opindex Wsystem-headers
6376 @opindex Wno-system-headers
6377 @cindex warnings from system headers
6378 @cindex system headers, warnings from
6379 Print warning messages for constructs found in system header files.
6380 Warnings from system headers are normally suppressed, on the assumption
6381 that they usually do not indicate real problems and would only make the
6382 compiler output harder to read. Using this command-line option tells
6383 GCC to emit warnings from system headers as if they occurred in user
6384 code. However, note that using @option{-Wall} in conjunction with this
6385 option does @emph{not} warn about unknown pragmas in system
6386 headers---for that, @option{-Wunknown-pragmas} must also be used.
6387
6388 @item -Wtautological-compare
6389 @opindex Wtautological-compare
6390 @opindex Wno-tautological-compare
6391 Warn if a self-comparison always evaluates to true or false. This
6392 warning detects various mistakes such as:
6393 @smallexample
6394 int i = 1;
6395 @dots{}
6396 if (i > i) @{ @dots{} @}
6397 @end smallexample
6398
6399 This warning also warns about bitwise comparisons that always evaluate
6400 to true or false, for instance:
6401 @smallexample
6402 if ((a & 16) == 10) @{ @dots{} @}
6403 @end smallexample
6404 will always be false.
6405
6406 This warning is enabled by @option{-Wall}.
6407
6408 @item -Wtrampolines
6409 @opindex Wtrampolines
6410 @opindex Wno-trampolines
6411 Warn about trampolines generated for pointers to nested functions.
6412 A trampoline is a small piece of data or code that is created at run
6413 time on the stack when the address of a nested function is taken, and is
6414 used to call the nested function indirectly. For some targets, it is
6415 made up of data only and thus requires no special treatment. But, for
6416 most targets, it is made up of code and thus requires the stack to be
6417 made executable in order for the program to work properly.
6418
6419 @item -Wfloat-equal
6420 @opindex Wfloat-equal
6421 @opindex Wno-float-equal
6422 Warn if floating-point values are used in equality comparisons.
6423
6424 The idea behind this is that sometimes it is convenient (for the
6425 programmer) to consider floating-point values as approximations to
6426 infinitely precise real numbers. If you are doing this, then you need
6427 to compute (by analyzing the code, or in some other way) the maximum or
6428 likely maximum error that the computation introduces, and allow for it
6429 when performing comparisons (and when producing output, but that's a
6430 different problem). In particular, instead of testing for equality, you
6431 should check to see whether the two values have ranges that overlap; and
6432 this is done with the relational operators, so equality comparisons are
6433 probably mistaken.
6434
6435 @item -Wtraditional @r{(C and Objective-C only)}
6436 @opindex Wtraditional
6437 @opindex Wno-traditional
6438 Warn about certain constructs that behave differently in traditional and
6439 ISO C@. Also warn about ISO C constructs that have no traditional C
6440 equivalent, and/or problematic constructs that should be avoided.
6441
6442 @itemize @bullet
6443 @item
6444 Macro parameters that appear within string literals in the macro body.
6445 In traditional C macro replacement takes place within string literals,
6446 but in ISO C it does not.
6447
6448 @item
6449 In traditional C, some preprocessor directives did not exist.
6450 Traditional preprocessors only considered a line to be a directive
6451 if the @samp{#} appeared in column 1 on the line. Therefore
6452 @option{-Wtraditional} warns about directives that traditional C
6453 understands but ignores because the @samp{#} does not appear as the
6454 first character on the line. It also suggests you hide directives like
6455 @code{#pragma} not understood by traditional C by indenting them. Some
6456 traditional implementations do not recognize @code{#elif}, so this option
6457 suggests avoiding it altogether.
6458
6459 @item
6460 A function-like macro that appears without arguments.
6461
6462 @item
6463 The unary plus operator.
6464
6465 @item
6466 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6467 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6468 constants.) Note, these suffixes appear in macros defined in the system
6469 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6470 Use of these macros in user code might normally lead to spurious
6471 warnings, however GCC's integrated preprocessor has enough context to
6472 avoid warning in these cases.
6473
6474 @item
6475 A function declared external in one block and then used after the end of
6476 the block.
6477
6478 @item
6479 A @code{switch} statement has an operand of type @code{long}.
6480
6481 @item
6482 A non-@code{static} function declaration follows a @code{static} one.
6483 This construct is not accepted by some traditional C compilers.
6484
6485 @item
6486 The ISO type of an integer constant has a different width or
6487 signedness from its traditional type. This warning is only issued if
6488 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6489 typically represent bit patterns, are not warned about.
6490
6491 @item
6492 Usage of ISO string concatenation is detected.
6493
6494 @item
6495 Initialization of automatic aggregates.
6496
6497 @item
6498 Identifier conflicts with labels. Traditional C lacks a separate
6499 namespace for labels.
6500
6501 @item
6502 Initialization of unions. If the initializer is zero, the warning is
6503 omitted. This is done under the assumption that the zero initializer in
6504 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6505 initializer warnings and relies on default initialization to zero in the
6506 traditional C case.
6507
6508 @item
6509 Conversions by prototypes between fixed/floating-point values and vice
6510 versa. The absence of these prototypes when compiling with traditional
6511 C causes serious problems. This is a subset of the possible
6512 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6513
6514 @item
6515 Use of ISO C style function definitions. This warning intentionally is
6516 @emph{not} issued for prototype declarations or variadic functions
6517 because these ISO C features appear in your code when using
6518 libiberty's traditional C compatibility macros, @code{PARAMS} and
6519 @code{VPARAMS}. This warning is also bypassed for nested functions
6520 because that feature is already a GCC extension and thus not relevant to
6521 traditional C compatibility.
6522 @end itemize
6523
6524 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6525 @opindex Wtraditional-conversion
6526 @opindex Wno-traditional-conversion
6527 Warn if a prototype causes a type conversion that is different from what
6528 would happen to the same argument in the absence of a prototype. This
6529 includes conversions of fixed point to floating and vice versa, and
6530 conversions changing the width or signedness of a fixed-point argument
6531 except when the same as the default promotion.
6532
6533 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6534 @opindex Wdeclaration-after-statement
6535 @opindex Wno-declaration-after-statement
6536 Warn when a declaration is found after a statement in a block. This
6537 construct, known from C++, was introduced with ISO C99 and is by default
6538 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6539
6540 @item -Wshadow
6541 @opindex Wshadow
6542 @opindex Wno-shadow
6543 Warn whenever a local variable or type declaration shadows another
6544 variable, parameter, type, class member (in C++), or instance variable
6545 (in Objective-C) or whenever a built-in function is shadowed. Note
6546 that in C++, the compiler warns if a local variable shadows an
6547 explicit typedef, but not if it shadows a struct/class/enum.
6548 If this warning is enabled, it includes also all instances of
6549 local shadowing. This means that @option{-Wno-shadow=local}
6550 and @option{-Wno-shadow=compatible-local} are ignored when
6551 @option{-Wshadow} is used.
6552 Same as @option{-Wshadow=global}.
6553
6554 @item -Wno-shadow-ivar @r{(Objective-C only)}
6555 @opindex Wno-shadow-ivar
6556 @opindex Wshadow-ivar
6557 Do not warn whenever a local variable shadows an instance variable in an
6558 Objective-C method.
6559
6560 @item -Wshadow=global
6561 @opindex Wshadow=global
6562 Warn for any shadowing.
6563 Same as @option{-Wshadow}.
6564
6565 @item -Wshadow=local
6566 @opindex Wshadow=local
6567 Warn when a local variable shadows another local variable or parameter.
6568
6569 @item -Wshadow=compatible-local
6570 @opindex Wshadow=compatible-local
6571 Warn when a local variable shadows another local variable or parameter
6572 whose type is compatible with that of the shadowing variable. In C++,
6573 type compatibility here means the type of the shadowing variable can be
6574 converted to that of the shadowed variable. The creation of this flag
6575 (in addition to @option{-Wshadow=local}) is based on the idea that when
6576 a local variable shadows another one of incompatible type, it is most
6577 likely intentional, not a bug or typo, as shown in the following example:
6578
6579 @smallexample
6580 @group
6581 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6582 @{
6583 for (int i = 0; i < N; ++i)
6584 @{
6585 ...
6586 @}
6587 ...
6588 @}
6589 @end group
6590 @end smallexample
6591
6592 Since the two variable @code{i} in the example above have incompatible types,
6593 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
6594 Because their types are incompatible, if a programmer accidentally uses one
6595 in place of the other, type checking is expected to catch that and emit an
6596 error or warning. Use of this flag instead of @option{-Wshadow=local} can
6597 possibly reduce the number of warnings triggered by intentional shadowing.
6598 Note that this also means that shadowing @code{const char *i} by
6599 @code{char *i} does not emit a warning.
6600
6601 This warning is also enabled by @option{-Wshadow=local}.
6602
6603 @item -Wlarger-than=@var{byte-size}
6604 @opindex Wlarger-than=
6605 @opindex Wlarger-than-@var{byte-size}
6606 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6607 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6608 Warnings controlled by the option can be disabled either by specifying
6609 @var{byte-size} of @samp{SIZE_MAX} or more or by
6610 @option{-Wno-larger-than}.
6611
6612 @item -Wno-larger-than
6613 @opindex Wno-larger-than
6614 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6615 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6616
6617 @item -Wframe-larger-than=@var{byte-size}
6618 @opindex Wframe-larger-than=
6619 @opindex Wno-frame-larger-than
6620 Warn if the size of a function frame exceeds @var{byte-size}.
6621 The computation done to determine the stack frame size is approximate
6622 and not conservative.
6623 The actual requirements may be somewhat greater than @var{byte-size}
6624 even if you do not get a warning. In addition, any space allocated
6625 via @code{alloca}, variable-length arrays, or related constructs
6626 is not included by the compiler when determining
6627 whether or not to issue a warning.
6628 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6629 Warnings controlled by the option can be disabled either by specifying
6630 @var{byte-size} of @samp{SIZE_MAX} or more or by
6631 @option{-Wno-frame-larger-than}.
6632
6633 @item -Wno-frame-larger-than
6634 @opindex Wno-frame-larger-than
6635 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6636 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6637
6638 @item -Wno-free-nonheap-object
6639 @opindex Wno-free-nonheap-object
6640 @opindex Wfree-nonheap-object
6641 Do not warn when attempting to free an object that was not allocated
6642 on the heap.
6643
6644 @item -Wstack-usage=@var{byte-size}
6645 @opindex Wstack-usage
6646 @opindex Wno-stack-usage
6647 Warn if the stack usage of a function might exceed @var{byte-size}.
6648 The computation done to determine the stack usage is conservative.
6649 Any space allocated via @code{alloca}, variable-length arrays, or related
6650 constructs is included by the compiler when determining whether or not to
6651 issue a warning.
6652
6653 The message is in keeping with the output of @option{-fstack-usage}.
6654
6655 @itemize
6656 @item
6657 If the stack usage is fully static but exceeds the specified amount, it's:
6658
6659 @smallexample
6660 warning: stack usage is 1120 bytes
6661 @end smallexample
6662 @item
6663 If the stack usage is (partly) dynamic but bounded, it's:
6664
6665 @smallexample
6666 warning: stack usage might be 1648 bytes
6667 @end smallexample
6668 @item
6669 If the stack usage is (partly) dynamic and not bounded, it's:
6670
6671 @smallexample
6672 warning: stack usage might be unbounded
6673 @end smallexample
6674 @end itemize
6675
6676 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6677 Warnings controlled by the option can be disabled either by specifying
6678 @var{byte-size} of @samp{SIZE_MAX} or more or by
6679 @option{-Wno-stack-usage}.
6680
6681 @item -Wno-stack-usage
6682 @opindex Wno-stack-usage
6683 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6684 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6685
6686 @item -Wunsafe-loop-optimizations
6687 @opindex Wunsafe-loop-optimizations
6688 @opindex Wno-unsafe-loop-optimizations
6689 Warn if the loop cannot be optimized because the compiler cannot
6690 assume anything on the bounds of the loop indices. With
6691 @option{-funsafe-loop-optimizations} warn if the compiler makes
6692 such assumptions.
6693
6694 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6695 @opindex Wno-pedantic-ms-format
6696 @opindex Wpedantic-ms-format
6697 When used in combination with @option{-Wformat}
6698 and @option{-pedantic} without GNU extensions, this option
6699 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6700 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6701 which depend on the MS runtime.
6702
6703 @item -Waligned-new
6704 @opindex Waligned-new
6705 @opindex Wno-aligned-new
6706 Warn about a new-expression of a type that requires greater alignment
6707 than the @code{alignof(std::max_align_t)} but uses an allocation
6708 function without an explicit alignment parameter. This option is
6709 enabled by @option{-Wall}.
6710
6711 Normally this only warns about global allocation functions, but
6712 @option{-Waligned-new=all} also warns about class member allocation
6713 functions.
6714
6715 @item -Wplacement-new
6716 @itemx -Wplacement-new=@var{n}
6717 @opindex Wplacement-new
6718 @opindex Wno-placement-new
6719 Warn about placement new expressions with undefined behavior, such as
6720 constructing an object in a buffer that is smaller than the type of
6721 the object. For example, the placement new expression below is diagnosed
6722 because it attempts to construct an array of 64 integers in a buffer only
6723 64 bytes large.
6724 @smallexample
6725 char buf [64];
6726 new (buf) int[64];
6727 @end smallexample
6728 This warning is enabled by default.
6729
6730 @table @gcctabopt
6731 @item -Wplacement-new=1
6732 This is the default warning level of @option{-Wplacement-new}. At this
6733 level the warning is not issued for some strictly undefined constructs that
6734 GCC allows as extensions for compatibility with legacy code. For example,
6735 the following @code{new} expression is not diagnosed at this level even
6736 though it has undefined behavior according to the C++ standard because
6737 it writes past the end of the one-element array.
6738 @smallexample
6739 struct S @{ int n, a[1]; @};
6740 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6741 new (s->a)int [32]();
6742 @end smallexample
6743
6744 @item -Wplacement-new=2
6745 At this level, in addition to diagnosing all the same constructs as at level
6746 1, a diagnostic is also issued for placement new expressions that construct
6747 an object in the last member of structure whose type is an array of a single
6748 element and whose size is less than the size of the object being constructed.
6749 While the previous example would be diagnosed, the following construct makes
6750 use of the flexible member array extension to avoid the warning at level 2.
6751 @smallexample
6752 struct S @{ int n, a[]; @};
6753 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6754 new (s->a)int [32]();
6755 @end smallexample
6756
6757 @end table
6758
6759 @item -Wpointer-arith
6760 @opindex Wpointer-arith
6761 @opindex Wno-pointer-arith
6762 Warn about anything that depends on the ``size of'' a function type or
6763 of @code{void}. GNU C assigns these types a size of 1, for
6764 convenience in calculations with @code{void *} pointers and pointers
6765 to functions. In C++, warn also when an arithmetic operation involves
6766 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6767
6768 @item -Wpointer-compare
6769 @opindex Wpointer-compare
6770 @opindex Wno-pointer-compare
6771 Warn if a pointer is compared with a zero character constant. This usually
6772 means that the pointer was meant to be dereferenced. For example:
6773
6774 @smallexample
6775 const char *p = foo ();
6776 if (p == '\0')
6777 return 42;
6778 @end smallexample
6779
6780 Note that the code above is invalid in C++11.
6781
6782 This warning is enabled by default.
6783
6784 @item -Wtype-limits
6785 @opindex Wtype-limits
6786 @opindex Wno-type-limits
6787 Warn if a comparison is always true or always false due to the limited
6788 range of the data type, but do not warn for constant expressions. For
6789 example, warn if an unsigned variable is compared against zero with
6790 @code{<} or @code{>=}. This warning is also enabled by
6791 @option{-Wextra}.
6792
6793 @item -Wabsolute-value @r{(C and Objective-C only)}
6794 @opindex Wabsolute-value
6795 @opindex Wno-absolute-value
6796 Warn for calls to standard functions that compute the absolute value
6797 of an argument when a more appropriate standard function is available.
6798 For example, calling @code{abs(3.14)} triggers the warning because the
6799 appropriate function to call to compute the absolute value of a double
6800 argument is @code{fabs}. The option also triggers warnings when the
6801 argument in a call to such a function has an unsigned type. This
6802 warning can be suppressed with an explicit type cast and it is also
6803 enabled by @option{-Wextra}.
6804
6805 @include cppwarnopts.texi
6806
6807 @item -Wbad-function-cast @r{(C and Objective-C only)}
6808 @opindex Wbad-function-cast
6809 @opindex Wno-bad-function-cast
6810 Warn when a function call is cast to a non-matching type.
6811 For example, warn if a call to a function returning an integer type
6812 is cast to a pointer type.
6813
6814 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6815 @opindex Wc90-c99-compat
6816 @opindex Wno-c90-c99-compat
6817 Warn about features not present in ISO C90, but present in ISO C99.
6818 For instance, warn about use of variable length arrays, @code{long long}
6819 type, @code{bool} type, compound literals, designated initializers, and so
6820 on. This option is independent of the standards mode. Warnings are disabled
6821 in the expression that follows @code{__extension__}.
6822
6823 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6824 @opindex Wc99-c11-compat
6825 @opindex Wno-c99-c11-compat
6826 Warn about features not present in ISO C99, but present in ISO C11.
6827 For instance, warn about use of anonymous structures and unions,
6828 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6829 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6830 and so on. This option is independent of the standards mode. Warnings are
6831 disabled in the expression that follows @code{__extension__}.
6832
6833 @item -Wc++-compat @r{(C and Objective-C only)}
6834 @opindex Wc++-compat
6835 @opindex Wno-c++-compat
6836 Warn about ISO C constructs that are outside of the common subset of
6837 ISO C and ISO C++, e.g.@: request for implicit conversion from
6838 @code{void *} to a pointer to non-@code{void} type.
6839
6840 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6841 @opindex Wc++11-compat
6842 @opindex Wno-c++11-compat
6843 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6844 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6845 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6846 enabled by @option{-Wall}.
6847
6848 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6849 @opindex Wc++14-compat
6850 @opindex Wno-c++14-compat
6851 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6852 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6853
6854 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6855 @opindex Wc++17-compat
6856 @opindex Wno-c++17-compat
6857 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6858 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6859
6860 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6861 @opindex Wc++20-compat
6862 @opindex Wno-c++20-compat
6863 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6864 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6865
6866 @item -Wcast-qual
6867 @opindex Wcast-qual
6868 @opindex Wno-cast-qual
6869 Warn whenever a pointer is cast so as to remove a type qualifier from
6870 the target type. For example, warn if a @code{const char *} is cast
6871 to an ordinary @code{char *}.
6872
6873 Also warn when making a cast that introduces a type qualifier in an
6874 unsafe way. For example, casting @code{char **} to @code{const char **}
6875 is unsafe, as in this example:
6876
6877 @smallexample
6878 /* p is char ** value. */
6879 const char **q = (const char **) p;
6880 /* Assignment of readonly string to const char * is OK. */
6881 *q = "string";
6882 /* Now char** pointer points to read-only memory. */
6883 **p = 'b';
6884 @end smallexample
6885
6886 @item -Wcast-align
6887 @opindex Wcast-align
6888 @opindex Wno-cast-align
6889 Warn whenever a pointer is cast such that the required alignment of the
6890 target is increased. For example, warn if a @code{char *} is cast to
6891 an @code{int *} on machines where integers can only be accessed at
6892 two- or four-byte boundaries.
6893
6894 @item -Wcast-align=strict
6895 @opindex Wcast-align=strict
6896 Warn whenever a pointer is cast such that the required alignment of the
6897 target is increased. For example, warn if a @code{char *} is cast to
6898 an @code{int *} regardless of the target machine.
6899
6900 @item -Wcast-function-type
6901 @opindex Wcast-function-type
6902 @opindex Wno-cast-function-type
6903 Warn when a function pointer is cast to an incompatible function pointer.
6904 In a cast involving function types with a variable argument list only
6905 the types of initial arguments that are provided are considered.
6906 Any parameter of pointer-type matches any other pointer-type. Any benign
6907 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6908 on ILP32 targets. Likewise type qualifiers are ignored. The function
6909 type @code{void (*) (void)} is special and matches everything, which can
6910 be used to suppress this warning.
6911 In a cast involving pointer to member types this warning warns whenever
6912 the type cast is changing the pointer to member type.
6913 This warning is enabled by @option{-Wextra}.
6914
6915 @item -Wwrite-strings
6916 @opindex Wwrite-strings
6917 @opindex Wno-write-strings
6918 When compiling C, give string constants the type @code{const
6919 char[@var{length}]} so that copying the address of one into a
6920 non-@code{const} @code{char *} pointer produces a warning. These
6921 warnings help you find at compile time code that can try to write
6922 into a string constant, but only if you have been very careful about
6923 using @code{const} in declarations and prototypes. Otherwise, it is
6924 just a nuisance. This is why we did not make @option{-Wall} request
6925 these warnings.
6926
6927 When compiling C++, warn about the deprecated conversion from string
6928 literals to @code{char *}. This warning is enabled by default for C++
6929 programs.
6930
6931 @item -Wcatch-value
6932 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6933 @opindex Wcatch-value
6934 @opindex Wno-catch-value
6935 Warn about catch handlers that do not catch via reference.
6936 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6937 warn about polymorphic class types that are caught by value.
6938 With @option{-Wcatch-value=2} warn about all class types that are caught
6939 by value. With @option{-Wcatch-value=3} warn about all types that are
6940 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6941
6942 @item -Wclobbered
6943 @opindex Wclobbered
6944 @opindex Wno-clobbered
6945 Warn for variables that might be changed by @code{longjmp} or
6946 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6947
6948 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6949 @opindex Wconditionally-supported
6950 @opindex Wno-conditionally-supported
6951 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6952
6953 @item -Wconversion
6954 @opindex Wconversion
6955 @opindex Wno-conversion
6956 Warn for implicit conversions that may alter a value. This includes
6957 conversions between real and integer, like @code{abs (x)} when
6958 @code{x} is @code{double}; conversions between signed and unsigned,
6959 like @code{unsigned ui = -1}; and conversions to smaller types, like
6960 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6961 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6962 changed by the conversion like in @code{abs (2.0)}. Warnings about
6963 conversions between signed and unsigned integers can be disabled by
6964 using @option{-Wno-sign-conversion}.
6965
6966 For C++, also warn for confusing overload resolution for user-defined
6967 conversions; and conversions that never use a type conversion
6968 operator: conversions to @code{void}, the same type, a base class or a
6969 reference to them. Warnings about conversions between signed and
6970 unsigned integers are disabled by default in C++ unless
6971 @option{-Wsign-conversion} is explicitly enabled.
6972
6973 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6974 @opindex Wconversion-null
6975 @opindex Wno-conversion-null
6976 Do not warn for conversions between @code{NULL} and non-pointer
6977 types. @option{-Wconversion-null} is enabled by default.
6978
6979 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6980 @opindex Wzero-as-null-pointer-constant
6981 @opindex Wno-zero-as-null-pointer-constant
6982 Warn when a literal @samp{0} is used as null pointer constant. This can
6983 be useful to facilitate the conversion to @code{nullptr} in C++11.
6984
6985 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6986 @opindex Wsubobject-linkage
6987 @opindex Wno-subobject-linkage
6988 Warn if a class type has a base or a field whose type uses the anonymous
6989 namespace or depends on a type with no linkage. If a type A depends on
6990 a type B with no or internal linkage, defining it in multiple
6991 translation units would be an ODR violation because the meaning of B
6992 is different in each translation unit. If A only appears in a single
6993 translation unit, the best way to silence the warning is to give it
6994 internal linkage by putting it in an anonymous namespace as well. The
6995 compiler doesn't give this warning for types defined in the main .C
6996 file, as those are unlikely to have multiple definitions.
6997 @option{-Wsubobject-linkage} is enabled by default.
6998
6999 @item -Wdangling-else
7000 @opindex Wdangling-else
7001 @opindex Wno-dangling-else
7002 Warn about constructions where there may be confusion to which
7003 @code{if} statement an @code{else} branch belongs. Here is an example of
7004 such a case:
7005
7006 @smallexample
7007 @group
7008 @{
7009 if (a)
7010 if (b)
7011 foo ();
7012 else
7013 bar ();
7014 @}
7015 @end group
7016 @end smallexample
7017
7018 In C/C++, every @code{else} branch belongs to the innermost possible
7019 @code{if} statement, which in this example is @code{if (b)}. This is
7020 often not what the programmer expected, as illustrated in the above
7021 example by indentation the programmer chose. When there is the
7022 potential for this confusion, GCC issues a warning when this flag
7023 is specified. To eliminate the warning, add explicit braces around
7024 the innermost @code{if} statement so there is no way the @code{else}
7025 can belong to the enclosing @code{if}. The resulting code
7026 looks like this:
7027
7028 @smallexample
7029 @group
7030 @{
7031 if (a)
7032 @{
7033 if (b)
7034 foo ();
7035 else
7036 bar ();
7037 @}
7038 @}
7039 @end group
7040 @end smallexample
7041
7042 This warning is enabled by @option{-Wparentheses}.
7043
7044 @item -Wdate-time
7045 @opindex Wdate-time
7046 @opindex Wno-date-time
7047 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7048 are encountered as they might prevent bit-wise-identical reproducible
7049 compilations.
7050
7051 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
7052 @opindex Wdelete-incomplete
7053 @opindex Wno-delete-incomplete
7054 Warn when deleting a pointer to incomplete type, which may cause
7055 undefined behavior at runtime. This warning is enabled by default.
7056
7057 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
7058 @opindex Wuseless-cast
7059 @opindex Wno-useless-cast
7060 Warn when an expression is casted to its own type.
7061
7062 @item -Wempty-body
7063 @opindex Wempty-body
7064 @opindex Wno-empty-body
7065 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7066 while} statement. This warning is also enabled by @option{-Wextra}.
7067
7068 @item -Wenum-compare
7069 @opindex Wenum-compare
7070 @opindex Wno-enum-compare
7071 Warn about a comparison between values of different enumerated types.
7072 In C++ enumerated type mismatches in conditional expressions are also
7073 diagnosed and the warning is enabled by default. In C this warning is
7074 enabled by @option{-Wall}.
7075
7076 @item -Wenum-conversion @r{(C, Objective-C only)}
7077 @opindex Wenum-conversion
7078 @opindex Wno-enum-conversion
7079 Warn when a value of enumerated type is implicitly converted to a
7080 different enumerated type. This warning is enabled by @option{-Wextra}.
7081
7082 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7083 @opindex Wextra-semi
7084 @opindex Wno-extra-semi
7085 Warn about redundant semicolon after in-class function definition.
7086
7087 @item -Wjump-misses-init @r{(C, Objective-C only)}
7088 @opindex Wjump-misses-init
7089 @opindex Wno-jump-misses-init
7090 Warn if a @code{goto} statement or a @code{switch} statement jumps
7091 forward across the initialization of a variable, or jumps backward to a
7092 label after the variable has been initialized. This only warns about
7093 variables that are initialized when they are declared. This warning is
7094 only supported for C and Objective-C; in C++ this sort of branch is an
7095 error in any case.
7096
7097 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7098 can be disabled with the @option{-Wno-jump-misses-init} option.
7099
7100 @item -Wsign-compare
7101 @opindex Wsign-compare
7102 @opindex Wno-sign-compare
7103 @cindex warning for comparison of signed and unsigned values
7104 @cindex comparison of signed and unsigned values, warning
7105 @cindex signed and unsigned values, comparison warning
7106 Warn when a comparison between signed and unsigned values could produce
7107 an incorrect result when the signed value is converted to unsigned.
7108 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7109 also enabled by @option{-Wextra}.
7110
7111 @item -Wsign-conversion
7112 @opindex Wsign-conversion
7113 @opindex Wno-sign-conversion
7114 Warn for implicit conversions that may change the sign of an integer
7115 value, like assigning a signed integer expression to an unsigned
7116 integer variable. An explicit cast silences the warning. In C, this
7117 option is enabled also by @option{-Wconversion}.
7118
7119 @item -Wfloat-conversion
7120 @opindex Wfloat-conversion
7121 @opindex Wno-float-conversion
7122 Warn for implicit conversions that reduce the precision of a real value.
7123 This includes conversions from real to integer, and from higher precision
7124 real to lower precision real values. This option is also enabled by
7125 @option{-Wconversion}.
7126
7127 @item -Wno-scalar-storage-order
7128 @opindex Wno-scalar-storage-order
7129 @opindex Wscalar-storage-order
7130 Do not warn on suspicious constructs involving reverse scalar storage order.
7131
7132 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7133 @opindex Wsized-deallocation
7134 @opindex Wno-sized-deallocation
7135 Warn about a definition of an unsized deallocation function
7136 @smallexample
7137 void operator delete (void *) noexcept;
7138 void operator delete[] (void *) noexcept;
7139 @end smallexample
7140 without a definition of the corresponding sized deallocation function
7141 @smallexample
7142 void operator delete (void *, std::size_t) noexcept;
7143 void operator delete[] (void *, std::size_t) noexcept;
7144 @end smallexample
7145 or vice versa. Enabled by @option{-Wextra} along with
7146 @option{-fsized-deallocation}.
7147
7148 @item -Wsizeof-pointer-div
7149 @opindex Wsizeof-pointer-div
7150 @opindex Wno-sizeof-pointer-div
7151 Warn for suspicious divisions of two sizeof expressions that divide
7152 the pointer size by the element size, which is the usual way to compute
7153 the array size but won't work out correctly with pointers. This warning
7154 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7155 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7156
7157 @item -Wsizeof-pointer-memaccess
7158 @opindex Wsizeof-pointer-memaccess
7159 @opindex Wno-sizeof-pointer-memaccess
7160 Warn for suspicious length parameters to certain string and memory built-in
7161 functions if the argument uses @code{sizeof}. This warning triggers for
7162 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7163 an array, but a pointer, and suggests a possible fix, or about
7164 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7165 also warns about calls to bounded string copy functions like @code{strncat}
7166 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7167 the source array. For example, in the following function the call to
7168 @code{strncat} specifies the size of the source string as the bound. That
7169 is almost certainly a mistake and so the call is diagnosed.
7170 @smallexample
7171 void make_file (const char *name)
7172 @{
7173 char path[PATH_MAX];
7174 strncpy (path, name, sizeof path - 1);
7175 strncat (path, ".text", sizeof ".text");
7176 @dots{}
7177 @}
7178 @end smallexample
7179
7180 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7181
7182 @item -Wsizeof-array-argument
7183 @opindex Wsizeof-array-argument
7184 @opindex Wno-sizeof-array-argument
7185 Warn when the @code{sizeof} operator is applied to a parameter that is
7186 declared as an array in a function definition. This warning is enabled by
7187 default for C and C++ programs.
7188
7189 @item -Wmemset-elt-size
7190 @opindex Wmemset-elt-size
7191 @opindex Wno-memset-elt-size
7192 Warn for suspicious calls to the @code{memset} built-in function, if the
7193 first argument references an array, and the third argument is a number
7194 equal to the number of elements, but not equal to the size of the array
7195 in memory. This indicates that the user has omitted a multiplication by
7196 the element size. This warning is enabled by @option{-Wall}.
7197
7198 @item -Wmemset-transposed-args
7199 @opindex Wmemset-transposed-args
7200 @opindex Wno-memset-transposed-args
7201 Warn for suspicious calls to the @code{memset} built-in function where
7202 the second argument is not zero and the third argument is zero. For
7203 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7204 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7205 is only emitted if the third argument is a literal zero. Otherwise, if
7206 it is an expression that is folded to zero, or a cast of zero to some
7207 type, it is far less likely that the arguments have been mistakenly
7208 transposed and no warning is emitted. This warning is enabled
7209 by @option{-Wall}.
7210
7211 @item -Waddress
7212 @opindex Waddress
7213 @opindex Wno-address
7214 Warn about suspicious uses of memory addresses. These include using
7215 the address of a function in a conditional expression, such as
7216 @code{void func(void); if (func)}, and comparisons against the memory
7217 address of a string literal, such as @code{if (x == "abc")}. Such
7218 uses typically indicate a programmer error: the address of a function
7219 always evaluates to true, so their use in a conditional usually
7220 indicate that the programmer forgot the parentheses in a function
7221 call; and comparisons against string literals result in unspecified
7222 behavior and are not portable in C, so they usually indicate that the
7223 programmer intended to use @code{strcmp}. This warning is enabled by
7224 @option{-Wall}.
7225
7226 @item -Waddress-of-packed-member
7227 @opindex Waddress-of-packed-member
7228 @opindex Wno-address-of-packed-member
7229 Warn when the address of packed member of struct or union is taken,
7230 which usually results in an unaligned pointer value. This is
7231 enabled by default.
7232
7233 @item -Wlogical-op
7234 @opindex Wlogical-op
7235 @opindex Wno-logical-op
7236 Warn about suspicious uses of logical operators in expressions.
7237 This includes using logical operators in contexts where a
7238 bit-wise operator is likely to be expected. Also warns when
7239 the operands of a logical operator are the same:
7240 @smallexample
7241 extern int a;
7242 if (a < 0 && a < 0) @{ @dots{} @}
7243 @end smallexample
7244
7245 @item -Wlogical-not-parentheses
7246 @opindex Wlogical-not-parentheses
7247 @opindex Wno-logical-not-parentheses
7248 Warn about logical not used on the left hand side operand of a comparison.
7249 This option does not warn if the right operand is considered to be a boolean
7250 expression. Its purpose is to detect suspicious code like the following:
7251 @smallexample
7252 int a;
7253 @dots{}
7254 if (!a > 1) @{ @dots{} @}
7255 @end smallexample
7256
7257 It is possible to suppress the warning by wrapping the LHS into
7258 parentheses:
7259 @smallexample
7260 if ((!a) > 1) @{ @dots{} @}
7261 @end smallexample
7262
7263 This warning is enabled by @option{-Wall}.
7264
7265 @item -Waggregate-return
7266 @opindex Waggregate-return
7267 @opindex Wno-aggregate-return
7268 Warn if any functions that return structures or unions are defined or
7269 called. (In languages where you can return an array, this also elicits
7270 a warning.)
7271
7272 @item -Wno-aggressive-loop-optimizations
7273 @opindex Wno-aggressive-loop-optimizations
7274 @opindex Waggressive-loop-optimizations
7275 Warn if in a loop with constant number of iterations the compiler detects
7276 undefined behavior in some statement during one or more of the iterations.
7277
7278 @item -Wno-attributes
7279 @opindex Wno-attributes
7280 @opindex Wattributes
7281 Do not warn if an unexpected @code{__attribute__} is used, such as
7282 unrecognized attributes, function attributes applied to variables,
7283 etc. This does not stop errors for incorrect use of supported
7284 attributes.
7285
7286 @item -Wno-builtin-declaration-mismatch
7287 @opindex Wno-builtin-declaration-mismatch
7288 @opindex Wbuiltin-declaration-mismatch
7289 Warn if a built-in function is declared with an incompatible signature
7290 or as a non-function, or when a built-in function declared with a type
7291 that does not include a prototype is called with arguments whose promoted
7292 types do not match those expected by the function. When @option{-Wextra}
7293 is specified, also warn when a built-in function that takes arguments is
7294 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7295 warning is enabled by default. To avoid the warning include the appropriate
7296 header to bring the prototypes of built-in functions into scope.
7297
7298 For example, the call to @code{memset} below is diagnosed by the warning
7299 because the function expects a value of type @code{size_t} as its argument
7300 but the type of @code{32} is @code{int}. With @option{-Wextra},
7301 the declaration of the function is diagnosed as well.
7302 @smallexample
7303 extern void* memset ();
7304 void f (void *d)
7305 @{
7306 memset (d, '\0', 32);
7307 @}
7308 @end smallexample
7309
7310 @item -Wno-builtin-macro-redefined
7311 @opindex Wno-builtin-macro-redefined
7312 @opindex Wbuiltin-macro-redefined
7313 Do not warn if certain built-in macros are redefined. This suppresses
7314 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7315 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7316
7317 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7318 @opindex Wstrict-prototypes
7319 @opindex Wno-strict-prototypes
7320 Warn if a function is declared or defined without specifying the
7321 argument types. (An old-style function definition is permitted without
7322 a warning if preceded by a declaration that specifies the argument
7323 types.)
7324
7325 @item -Wold-style-declaration @r{(C and Objective-C only)}
7326 @opindex Wold-style-declaration
7327 @opindex Wno-old-style-declaration
7328 Warn for obsolescent usages, according to the C Standard, in a
7329 declaration. For example, warn if storage-class specifiers like
7330 @code{static} are not the first things in a declaration. This warning
7331 is also enabled by @option{-Wextra}.
7332
7333 @item -Wold-style-definition @r{(C and Objective-C only)}
7334 @opindex Wold-style-definition
7335 @opindex Wno-old-style-definition
7336 Warn if an old-style function definition is used. A warning is given
7337 even if there is a previous prototype. A definition using @samp{()}
7338 is not considered an old-style definition in C2X mode, because it is
7339 equivalent to @samp{(void)} in that case, but is considered an
7340 old-style definition for older standards.
7341
7342 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7343 @opindex Wmissing-parameter-type
7344 @opindex Wno-missing-parameter-type
7345 A function parameter is declared without a type specifier in K&R-style
7346 functions:
7347
7348 @smallexample
7349 void foo(bar) @{ @}
7350 @end smallexample
7351
7352 This warning is also enabled by @option{-Wextra}.
7353
7354 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7355 @opindex Wmissing-prototypes
7356 @opindex Wno-missing-prototypes
7357 Warn if a global function is defined without a previous prototype
7358 declaration. This warning is issued even if the definition itself
7359 provides a prototype. Use this option to detect global functions
7360 that do not have a matching prototype declaration in a header file.
7361 This option is not valid for C++ because all function declarations
7362 provide prototypes and a non-matching declaration declares an
7363 overload rather than conflict with an earlier declaration.
7364 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7365
7366 @item -Wmissing-declarations
7367 @opindex Wmissing-declarations
7368 @opindex Wno-missing-declarations
7369 Warn if a global function is defined without a previous declaration.
7370 Do so even if the definition itself provides a prototype.
7371 Use this option to detect global functions that are not declared in
7372 header files. In C, no warnings are issued for functions with previous
7373 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7374 missing prototypes. In C++, no warnings are issued for function templates,
7375 or for inline functions, or for functions in anonymous namespaces.
7376
7377 @item -Wmissing-field-initializers
7378 @opindex Wmissing-field-initializers
7379 @opindex Wno-missing-field-initializers
7380 @opindex W
7381 @opindex Wextra
7382 @opindex Wno-extra
7383 Warn if a structure's initializer has some fields missing. For
7384 example, the following code causes such a warning, because
7385 @code{x.h} is implicitly zero:
7386
7387 @smallexample
7388 struct s @{ int f, g, h; @};
7389 struct s x = @{ 3, 4 @};
7390 @end smallexample
7391
7392 This option does not warn about designated initializers, so the following
7393 modification does not trigger a warning:
7394
7395 @smallexample
7396 struct s @{ int f, g, h; @};
7397 struct s x = @{ .f = 3, .g = 4 @};
7398 @end smallexample
7399
7400 In C this option does not warn about the universal zero initializer
7401 @samp{@{ 0 @}}:
7402
7403 @smallexample
7404 struct s @{ int f, g, h; @};
7405 struct s x = @{ 0 @};
7406 @end smallexample
7407
7408 Likewise, in C++ this option does not warn about the empty @{ @}
7409 initializer, for example:
7410
7411 @smallexample
7412 struct s @{ int f, g, h; @};
7413 s x = @{ @};
7414 @end smallexample
7415
7416 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7417 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7418
7419 @item -Wno-multichar
7420 @opindex Wno-multichar
7421 @opindex Wmultichar
7422 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7423 Usually they indicate a typo in the user's code, as they have
7424 implementation-defined values, and should not be used in portable code.
7425
7426 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7427 @opindex Wnormalized=
7428 @opindex Wnormalized
7429 @opindex Wno-normalized
7430 @cindex NFC
7431 @cindex NFKC
7432 @cindex character set, input normalization
7433 In ISO C and ISO C++, two identifiers are different if they are
7434 different sequences of characters. However, sometimes when characters
7435 outside the basic ASCII character set are used, you can have two
7436 different character sequences that look the same. To avoid confusion,
7437 the ISO 10646 standard sets out some @dfn{normalization rules} which
7438 when applied ensure that two sequences that look the same are turned into
7439 the same sequence. GCC can warn you if you are using identifiers that
7440 have not been normalized; this option controls that warning.
7441
7442 There are four levels of warning supported by GCC@. The default is
7443 @option{-Wnormalized=nfc}, which warns about any identifier that is
7444 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7445 recommended form for most uses. It is equivalent to
7446 @option{-Wnormalized}.
7447
7448 Unfortunately, there are some characters allowed in identifiers by
7449 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7450 identifiers. That is, there's no way to use these symbols in portable
7451 ISO C or C++ and have all your identifiers in NFC@.
7452 @option{-Wnormalized=id} suppresses the warning for these characters.
7453 It is hoped that future versions of the standards involved will correct
7454 this, which is why this option is not the default.
7455
7456 You can switch the warning off for all characters by writing
7457 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7458 only do this if you are using some other normalization scheme (like
7459 ``D''), because otherwise you can easily create bugs that are
7460 literally impossible to see.
7461
7462 Some characters in ISO 10646 have distinct meanings but look identical
7463 in some fonts or display methodologies, especially once formatting has
7464 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7465 LETTER N'', displays just like a regular @code{n} that has been
7466 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7467 normalization scheme to convert all these into a standard form as
7468 well, and GCC warns if your code is not in NFKC if you use
7469 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7470 about every identifier that contains the letter O because it might be
7471 confused with the digit 0, and so is not the default, but may be
7472 useful as a local coding convention if the programming environment
7473 cannot be fixed to display these characters distinctly.
7474
7475 @item -Wno-attribute-warning
7476 @opindex Wno-attribute-warning
7477 @opindex Wattribute-warning
7478 Do not warn about usage of functions (@pxref{Function Attributes})
7479 declared with @code{warning} attribute. By default, this warning is
7480 enabled. @option{-Wno-attribute-warning} can be used to disable the
7481 warning or @option{-Wno-error=attribute-warning} can be used to
7482 disable the error when compiled with @option{-Werror} flag.
7483
7484 @item -Wno-deprecated
7485 @opindex Wno-deprecated
7486 @opindex Wdeprecated
7487 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7488
7489 @item -Wno-deprecated-declarations
7490 @opindex Wno-deprecated-declarations
7491 @opindex Wdeprecated-declarations
7492 Do not warn about uses of functions (@pxref{Function Attributes}),
7493 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7494 Attributes}) marked as deprecated by using the @code{deprecated}
7495 attribute.
7496
7497 @item -Wno-overflow
7498 @opindex Wno-overflow
7499 @opindex Woverflow
7500 Do not warn about compile-time overflow in constant expressions.
7501
7502 @item -Wno-odr
7503 @opindex Wno-odr
7504 @opindex Wodr
7505 Warn about One Definition Rule violations during link-time optimization.
7506 Enabled by default.
7507
7508 @item -Wopenmp-simd
7509 @opindex Wopenmp-simd
7510 @opindex Wno-openmp-simd
7511 Warn if the vectorizer cost model overrides the OpenMP
7512 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7513 option can be used to relax the cost model.
7514
7515 @item -Woverride-init @r{(C and Objective-C only)}
7516 @opindex Woverride-init
7517 @opindex Wno-override-init
7518 @opindex W
7519 @opindex Wextra
7520 @opindex Wno-extra
7521 Warn if an initialized field without side effects is overridden when
7522 using designated initializers (@pxref{Designated Inits, , Designated
7523 Initializers}).
7524
7525 This warning is included in @option{-Wextra}. To get other
7526 @option{-Wextra} warnings without this one, use @option{-Wextra
7527 -Wno-override-init}.
7528
7529 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7530 @opindex Woverride-init-side-effects
7531 @opindex Wno-override-init-side-effects
7532 Warn if an initialized field with side effects is overridden when
7533 using designated initializers (@pxref{Designated Inits, , Designated
7534 Initializers}). This warning is enabled by default.
7535
7536 @item -Wpacked
7537 @opindex Wpacked
7538 @opindex Wno-packed
7539 Warn if a structure is given the packed attribute, but the packed
7540 attribute has no effect on the layout or size of the structure.
7541 Such structures may be mis-aligned for little benefit. For
7542 instance, in this code, the variable @code{f.x} in @code{struct bar}
7543 is misaligned even though @code{struct bar} does not itself
7544 have the packed attribute:
7545
7546 @smallexample
7547 @group
7548 struct foo @{
7549 int x;
7550 char a, b, c, d;
7551 @} __attribute__((packed));
7552 struct bar @{
7553 char z;
7554 struct foo f;
7555 @};
7556 @end group
7557 @end smallexample
7558
7559 @item -Wpacked-bitfield-compat
7560 @opindex Wpacked-bitfield-compat
7561 @opindex Wno-packed-bitfield-compat
7562 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7563 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7564 the change can lead to differences in the structure layout. GCC
7565 informs you when the offset of such a field has changed in GCC 4.4.
7566 For example there is no longer a 4-bit padding between field @code{a}
7567 and @code{b} in this structure:
7568
7569 @smallexample
7570 struct foo
7571 @{
7572 char a:4;
7573 char b:8;
7574 @} __attribute__ ((packed));
7575 @end smallexample
7576
7577 This warning is enabled by default. Use
7578 @option{-Wno-packed-bitfield-compat} to disable this warning.
7579
7580 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7581 @opindex Wpacked-not-aligned
7582 @opindex Wno-packed-not-aligned
7583 Warn if a structure field with explicitly specified alignment in a
7584 packed struct or union is misaligned. For example, a warning will
7585 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7586 'struct S' is less than 8}, in this code:
7587
7588 @smallexample
7589 @group
7590 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7591 struct __attribute__ ((packed)) S @{
7592 struct S8 s8;
7593 @};
7594 @end group
7595 @end smallexample
7596
7597 This warning is enabled by @option{-Wall}.
7598
7599 @item -Wpadded
7600 @opindex Wpadded
7601 @opindex Wno-padded
7602 Warn if padding is included in a structure, either to align an element
7603 of the structure or to align the whole structure. Sometimes when this
7604 happens it is possible to rearrange the fields of the structure to
7605 reduce the padding and so make the structure smaller.
7606
7607 @item -Wredundant-decls
7608 @opindex Wredundant-decls
7609 @opindex Wno-redundant-decls
7610 Warn if anything is declared more than once in the same scope, even in
7611 cases where multiple declaration is valid and changes nothing.
7612
7613 @item -Wno-restrict
7614 @opindex Wrestrict
7615 @opindex Wno-restrict
7616 Warn when an object referenced by a @code{restrict}-qualified parameter
7617 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7618 argument, or when copies between such objects overlap. For example,
7619 the call to the @code{strcpy} function below attempts to truncate the string
7620 by replacing its initial characters with the last four. However, because
7621 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7622 the call is diagnosed.
7623
7624 @smallexample
7625 void foo (void)
7626 @{
7627 char a[] = "abcd1234";
7628 strcpy (a, a + 4);
7629 @dots{}
7630 @}
7631 @end smallexample
7632 The @option{-Wrestrict} option detects some instances of simple overlap
7633 even without optimization but works best at @option{-O2} and above. It
7634 is included in @option{-Wall}.
7635
7636 @item -Wnested-externs @r{(C and Objective-C only)}
7637 @opindex Wnested-externs
7638 @opindex Wno-nested-externs
7639 Warn if an @code{extern} declaration is encountered within a function.
7640
7641 @item -Wno-inherited-variadic-ctor
7642 @opindex Winherited-variadic-ctor
7643 @opindex Wno-inherited-variadic-ctor
7644 Suppress warnings about use of C++11 inheriting constructors when the
7645 base class inherited from has a C variadic constructor; the warning is
7646 on by default because the ellipsis is not inherited.
7647
7648 @item -Winline
7649 @opindex Winline
7650 @opindex Wno-inline
7651 Warn if a function that is declared as inline cannot be inlined.
7652 Even with this option, the compiler does not warn about failures to
7653 inline functions declared in system headers.
7654
7655 The compiler uses a variety of heuristics to determine whether or not
7656 to inline a function. For example, the compiler takes into account
7657 the size of the function being inlined and the amount of inlining
7658 that has already been done in the current function. Therefore,
7659 seemingly insignificant changes in the source program can cause the
7660 warnings produced by @option{-Winline} to appear or disappear.
7661
7662 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7663 @opindex Wno-invalid-offsetof
7664 @opindex Winvalid-offsetof
7665 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7666 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7667 to a non-standard-layout type is undefined. In existing C++ implementations,
7668 however, @code{offsetof} typically gives meaningful results.
7669 This flag is for users who are aware that they are
7670 writing nonportable code and who have deliberately chosen to ignore the
7671 warning about it.
7672
7673 The restrictions on @code{offsetof} may be relaxed in a future version
7674 of the C++ standard.
7675
7676 @item -Wint-in-bool-context
7677 @opindex Wint-in-bool-context
7678 @opindex Wno-int-in-bool-context
7679 Warn for suspicious use of integer values where boolean values are expected,
7680 such as conditional expressions (?:) using non-boolean integer constants in
7681 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7682 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7683 for all kinds of multiplications regardless of the data type.
7684 This warning is enabled by @option{-Wall}.
7685
7686 @item -Wno-int-to-pointer-cast
7687 @opindex Wno-int-to-pointer-cast
7688 @opindex Wint-to-pointer-cast
7689 Suppress warnings from casts to pointer type of an integer of a
7690 different size. In C++, casting to a pointer type of smaller size is
7691 an error. @option{Wint-to-pointer-cast} is enabled by default.
7692
7693
7694 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7695 @opindex Wno-pointer-to-int-cast
7696 @opindex Wpointer-to-int-cast
7697 Suppress warnings from casts from a pointer to an integer type of a
7698 different size.
7699
7700 @item -Winvalid-pch
7701 @opindex Winvalid-pch
7702 @opindex Wno-invalid-pch
7703 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7704 the search path but cannot be used.
7705
7706 @item -Wlong-long
7707 @opindex Wlong-long
7708 @opindex Wno-long-long
7709 Warn if @code{long long} type is used. This is enabled by either
7710 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7711 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7712
7713 @item -Wvariadic-macros
7714 @opindex Wvariadic-macros
7715 @opindex Wno-variadic-macros
7716 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7717 alternate syntax is used in ISO C99 mode. This is enabled by either
7718 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7719 messages, use @option{-Wno-variadic-macros}.
7720
7721 @item -Wvarargs
7722 @opindex Wvarargs
7723 @opindex Wno-varargs
7724 Warn upon questionable usage of the macros used to handle variable
7725 arguments like @code{va_start}. This is default. To inhibit the
7726 warning messages, use @option{-Wno-varargs}.
7727
7728 @item -Wvector-operation-performance
7729 @opindex Wvector-operation-performance
7730 @opindex Wno-vector-operation-performance
7731 Warn if vector operation is not implemented via SIMD capabilities of the
7732 architecture. Mainly useful for the performance tuning.
7733 Vector operation can be implemented @code{piecewise}, which means that the
7734 scalar operation is performed on every vector element;
7735 @code{in parallel}, which means that the vector operation is implemented
7736 using scalars of wider type, which normally is more performance efficient;
7737 and @code{as a single scalar}, which means that vector fits into a
7738 scalar type.
7739
7740 @item -Wno-virtual-move-assign
7741 @opindex Wvirtual-move-assign
7742 @opindex Wno-virtual-move-assign
7743 Suppress warnings about inheriting from a virtual base with a
7744 non-trivial C++11 move assignment operator. This is dangerous because
7745 if the virtual base is reachable along more than one path, it is
7746 moved multiple times, which can mean both objects end up in the
7747 moved-from state. If the move assignment operator is written to avoid
7748 moving from a moved-from object, this warning can be disabled.
7749
7750 @item -Wvla
7751 @opindex Wvla
7752 @opindex Wno-vla
7753 Warn if a variable-length array is used in the code.
7754 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7755 the variable-length array.
7756
7757 @item -Wvla-larger-than=@var{byte-size}
7758 @opindex Wvla-larger-than=
7759 @opindex Wno-vla-larger-than
7760 If this option is used, the compiler will warn for declarations of
7761 variable-length arrays whose size is either unbounded, or bounded
7762 by an argument that allows the array size to exceed @var{byte-size}
7763 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7764 works, but with variable-length arrays.
7765
7766 Note that GCC may optimize small variable-length arrays of a known
7767 value into plain arrays, so this warning may not get triggered for
7768 such arrays.
7769
7770 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7771 is typically only effective when @option{-ftree-vrp} is active (default
7772 for @option{-O2} and above).
7773
7774 See also @option{-Walloca-larger-than=@var{byte-size}}.
7775
7776 @item -Wno-vla-larger-than
7777 @opindex Wno-vla-larger-than
7778 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7779 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7780
7781 @item -Wvolatile-register-var
7782 @opindex Wvolatile-register-var
7783 @opindex Wno-volatile-register-var
7784 Warn if a register variable is declared volatile. The volatile
7785 modifier does not inhibit all optimizations that may eliminate reads
7786 and/or writes to register variables. This warning is enabled by
7787 @option{-Wall}.
7788
7789 @item -Wdisabled-optimization
7790 @opindex Wdisabled-optimization
7791 @opindex Wno-disabled-optimization
7792 Warn if a requested optimization pass is disabled. This warning does
7793 not generally indicate that there is anything wrong with your code; it
7794 merely indicates that GCC's optimizers are unable to handle the code
7795 effectively. Often, the problem is that your code is too big or too
7796 complex; GCC refuses to optimize programs when the optimization
7797 itself is likely to take inordinate amounts of time.
7798
7799 @item -Wpointer-sign @r{(C and Objective-C only)}
7800 @opindex Wpointer-sign
7801 @opindex Wno-pointer-sign
7802 Warn for pointer argument passing or assignment with different signedness.
7803 This option is only supported for C and Objective-C@. It is implied by
7804 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7805 @option{-Wno-pointer-sign}.
7806
7807 @item -Wstack-protector
7808 @opindex Wstack-protector
7809 @opindex Wno-stack-protector
7810 This option is only active when @option{-fstack-protector} is active. It
7811 warns about functions that are not protected against stack smashing.
7812
7813 @item -Woverlength-strings
7814 @opindex Woverlength-strings
7815 @opindex Wno-overlength-strings
7816 Warn about string constants that are longer than the ``minimum
7817 maximum'' length specified in the C standard. Modern compilers
7818 generally allow string constants that are much longer than the
7819 standard's minimum limit, but very portable programs should avoid
7820 using longer strings.
7821
7822 The limit applies @emph{after} string constant concatenation, and does
7823 not count the trailing NUL@. In C90, the limit was 509 characters; in
7824 C99, it was raised to 4095. C++98 does not specify a normative
7825 minimum maximum, so we do not diagnose overlength strings in C++@.
7826
7827 This option is implied by @option{-Wpedantic}, and can be disabled with
7828 @option{-Wno-overlength-strings}.
7829
7830 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7831 @opindex Wunsuffixed-float-constants
7832 @opindex Wno-unsuffixed-float-constants
7833
7834 Issue a warning for any floating constant that does not have
7835 a suffix. When used together with @option{-Wsystem-headers} it
7836 warns about such constants in system header files. This can be useful
7837 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7838 from the decimal floating-point extension to C99.
7839
7840 @item -Wno-designated-init @r{(C and Objective-C only)}
7841 Suppress warnings when a positional initializer is used to initialize
7842 a structure that has been marked with the @code{designated_init}
7843 attribute.
7844
7845 @item -Whsa
7846 Issue a warning when HSAIL cannot be emitted for the compiled function or
7847 OpenMP construct.
7848
7849 @end table
7850
7851 @node Debugging Options
7852 @section Options for Debugging Your Program
7853 @cindex options, debugging
7854 @cindex debugging information options
7855
7856 To tell GCC to emit extra information for use by a debugger, in almost
7857 all cases you need only to add @option{-g} to your other options.
7858
7859 GCC allows you to use @option{-g} with
7860 @option{-O}. The shortcuts taken by optimized code may occasionally
7861 be surprising: some variables you declared may not exist
7862 at all; flow of control may briefly move where you did not expect it;
7863 some statements may not be executed because they compute constant
7864 results or their values are already at hand; some statements may
7865 execute in different places because they have been moved out of loops.
7866 Nevertheless it is possible to debug optimized output. This makes
7867 it reasonable to use the optimizer for programs that might have bugs.
7868
7869 If you are not using some other optimization option, consider
7870 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7871 With no @option{-O} option at all, some compiler passes that collect
7872 information useful for debugging do not run at all, so that
7873 @option{-Og} may result in a better debugging experience.
7874
7875 @table @gcctabopt
7876 @item -g
7877 @opindex g
7878 Produce debugging information in the operating system's native format
7879 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7880 information.
7881
7882 On most systems that use stabs format, @option{-g} enables use of extra
7883 debugging information that only GDB can use; this extra information
7884 makes debugging work better in GDB but probably makes other debuggers
7885 crash or
7886 refuse to read the program. If you want to control for certain whether
7887 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7888 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7889
7890 @item -ggdb
7891 @opindex ggdb
7892 Produce debugging information for use by GDB@. This means to use the
7893 most expressive format available (DWARF, stabs, or the native format
7894 if neither of those are supported), including GDB extensions if at all
7895 possible.
7896
7897 @item -gdwarf
7898 @itemx -gdwarf-@var{version}
7899 @opindex gdwarf
7900 Produce debugging information in DWARF format (if that is supported).
7901 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7902 for most targets is 4. DWARF Version 5 is only experimental.
7903
7904 Note that with DWARF Version 2, some ports require and always
7905 use some non-conflicting DWARF 3 extensions in the unwind tables.
7906
7907 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7908 for maximum benefit.
7909
7910 GCC no longer supports DWARF Version 1, which is substantially
7911 different than Version 2 and later. For historical reasons, some
7912 other DWARF-related options such as
7913 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7914 in their names, but apply to all currently-supported versions of DWARF.
7915
7916 @item -gstabs
7917 @opindex gstabs
7918 Produce debugging information in stabs format (if that is supported),
7919 without GDB extensions. This is the format used by DBX on most BSD
7920 systems. On MIPS, Alpha and System V Release 4 systems this option
7921 produces stabs debugging output that is not understood by DBX@.
7922 On System V Release 4 systems this option requires the GNU assembler.
7923
7924 @item -gstabs+
7925 @opindex gstabs+
7926 Produce debugging information in stabs format (if that is supported),
7927 using GNU extensions understood only by the GNU debugger (GDB)@. The
7928 use of these extensions is likely to make other debuggers crash or
7929 refuse to read the program.
7930
7931 @item -gxcoff
7932 @opindex gxcoff
7933 Produce debugging information in XCOFF format (if that is supported).
7934 This is the format used by the DBX debugger on IBM RS/6000 systems.
7935
7936 @item -gxcoff+
7937 @opindex gxcoff+
7938 Produce debugging information in XCOFF format (if that is supported),
7939 using GNU extensions understood only by the GNU debugger (GDB)@. The
7940 use of these extensions is likely to make other debuggers crash or
7941 refuse to read the program, and may cause assemblers other than the GNU
7942 assembler (GAS) to fail with an error.
7943
7944 @item -gvms
7945 @opindex gvms
7946 Produce debugging information in Alpha/VMS debug format (if that is
7947 supported). This is the format used by DEBUG on Alpha/VMS systems.
7948
7949 @item -g@var{level}
7950 @itemx -ggdb@var{level}
7951 @itemx -gstabs@var{level}
7952 @itemx -gxcoff@var{level}
7953 @itemx -gvms@var{level}
7954 Request debugging information and also use @var{level} to specify how
7955 much information. The default level is 2.
7956
7957 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7958 @option{-g}.
7959
7960 Level 1 produces minimal information, enough for making backtraces in
7961 parts of the program that you don't plan to debug. This includes
7962 descriptions of functions and external variables, and line number
7963 tables, but no information about local variables.
7964
7965 Level 3 includes extra information, such as all the macro definitions
7966 present in the program. Some debuggers support macro expansion when
7967 you use @option{-g3}.
7968
7969 If you use multiple @option{-g} options, with or without level numbers,
7970 the last such option is the one that is effective.
7971
7972 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7973 confusion with @option{-gdwarf-@var{level}}.
7974 Instead use an additional @option{-g@var{level}} option to change the
7975 debug level for DWARF.
7976
7977 @item -fno-eliminate-unused-debug-symbols
7978 @opindex feliminate-unused-debug-symbols
7979 @opindex fno-eliminate-unused-debug-symbols
7980 By default, no debug information is produced for symbols that are not actually
7981 used. Use this option if you want debug information for all symbols.
7982
7983 @item -femit-class-debug-always
7984 @opindex femit-class-debug-always
7985 Instead of emitting debugging information for a C++ class in only one
7986 object file, emit it in all object files using the class. This option
7987 should be used only with debuggers that are unable to handle the way GCC
7988 normally emits debugging information for classes because using this
7989 option increases the size of debugging information by as much as a
7990 factor of two.
7991
7992 @item -fno-merge-debug-strings
7993 @opindex fmerge-debug-strings
7994 @opindex fno-merge-debug-strings
7995 Direct the linker to not merge together strings in the debugging
7996 information that are identical in different object files. Merging is
7997 not supported by all assemblers or linkers. Merging decreases the size
7998 of the debug information in the output file at the cost of increasing
7999 link processing time. Merging is enabled by default.
8000
8001 @item -fdebug-prefix-map=@var{old}=@var{new}
8002 @opindex fdebug-prefix-map
8003 When compiling files residing in directory @file{@var{old}}, record
8004 debugging information describing them as if the files resided in
8005 directory @file{@var{new}} instead. This can be used to replace a
8006 build-time path with an install-time path in the debug info. It can
8007 also be used to change an absolute path to a relative path by using
8008 @file{.} for @var{new}. This can give more reproducible builds, which
8009 are location independent, but may require an extra command to tell GDB
8010 where to find the source files. See also @option{-ffile-prefix-map}.
8011
8012 @item -fvar-tracking
8013 @opindex fvar-tracking
8014 Run variable tracking pass. It computes where variables are stored at each
8015 position in code. Better debugging information is then generated
8016 (if the debugging information format supports this information).
8017
8018 It is enabled by default when compiling with optimization (@option{-Os},
8019 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8020 the debug info format supports it.
8021
8022 @item -fvar-tracking-assignments
8023 @opindex fvar-tracking-assignments
8024 @opindex fno-var-tracking-assignments
8025 Annotate assignments to user variables early in the compilation and
8026 attempt to carry the annotations over throughout the compilation all the
8027 way to the end, in an attempt to improve debug information while
8028 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
8029
8030 It can be enabled even if var-tracking is disabled, in which case
8031 annotations are created and maintained, but discarded at the end.
8032 By default, this flag is enabled together with @option{-fvar-tracking},
8033 except when selective scheduling is enabled.
8034
8035 @item -gsplit-dwarf
8036 @opindex gsplit-dwarf
8037 Separate as much DWARF debugging information as possible into a
8038 separate output file with the extension @file{.dwo}. This option allows
8039 the build system to avoid linking files with debug information. To
8040 be useful, this option requires a debugger capable of reading @file{.dwo}
8041 files.
8042
8043 @item -gdescribe-dies
8044 @opindex gdescribe-dies
8045 Add description attributes to some DWARF DIEs that have no name attribute,
8046 such as artificial variables, external references and call site
8047 parameter DIEs.
8048
8049 @item -gpubnames
8050 @opindex gpubnames
8051 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8052
8053 @item -ggnu-pubnames
8054 @opindex ggnu-pubnames
8055 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8056 suitable for conversion into a GDB@ index. This option is only useful
8057 with a linker that can produce GDB@ index version 7.
8058
8059 @item -fdebug-types-section
8060 @opindex fdebug-types-section
8061 @opindex fno-debug-types-section
8062 When using DWARF Version 4 or higher, type DIEs can be put into
8063 their own @code{.debug_types} section instead of making them part of the
8064 @code{.debug_info} section. It is more efficient to put them in a separate
8065 comdat section since the linker can then remove duplicates.
8066 But not all DWARF consumers support @code{.debug_types} sections yet
8067 and on some objects @code{.debug_types} produces larger instead of smaller
8068 debugging information.
8069
8070 @item -grecord-gcc-switches
8071 @itemx -gno-record-gcc-switches
8072 @opindex grecord-gcc-switches
8073 @opindex gno-record-gcc-switches
8074 This switch causes the command-line options used to invoke the
8075 compiler that may affect code generation to be appended to the
8076 DW_AT_producer attribute in DWARF debugging information. The options
8077 are concatenated with spaces separating them from each other and from
8078 the compiler version.
8079 It is enabled by default.
8080 See also @option{-frecord-gcc-switches} for another
8081 way of storing compiler options into the object file.
8082
8083 @item -gstrict-dwarf
8084 @opindex gstrict-dwarf
8085 Disallow using extensions of later DWARF standard version than selected
8086 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8087 DWARF extensions from later standard versions is allowed.
8088
8089 @item -gno-strict-dwarf
8090 @opindex gno-strict-dwarf
8091 Allow using extensions of later DWARF standard version than selected with
8092 @option{-gdwarf-@var{version}}.
8093
8094 @item -gas-loc-support
8095 @opindex gas-loc-support
8096 Inform the compiler that the assembler supports @code{.loc} directives.
8097 It may then use them for the assembler to generate DWARF2+ line number
8098 tables.
8099
8100 This is generally desirable, because assembler-generated line-number
8101 tables are a lot more compact than those the compiler can generate
8102 itself.
8103
8104 This option will be enabled by default if, at GCC configure time, the
8105 assembler was found to support such directives.
8106
8107 @item -gno-as-loc-support
8108 @opindex gno-as-loc-support
8109 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8110 line number tables are to be generated.
8111
8112 @item -gas-locview-support
8113 @opindex gas-locview-support
8114 Inform the compiler that the assembler supports @code{view} assignment
8115 and reset assertion checking in @code{.loc} directives.
8116
8117 This option will be enabled by default if, at GCC configure time, the
8118 assembler was found to support them.
8119
8120 @item -gno-as-locview-support
8121 Force GCC to assign view numbers internally, if
8122 @option{-gvariable-location-views} are explicitly requested.
8123
8124 @item -gcolumn-info
8125 @itemx -gno-column-info
8126 @opindex gcolumn-info
8127 @opindex gno-column-info
8128 Emit location column information into DWARF debugging information, rather
8129 than just file and line.
8130 This option is enabled by default.
8131
8132 @item -gstatement-frontiers
8133 @itemx -gno-statement-frontiers
8134 @opindex gstatement-frontiers
8135 @opindex gno-statement-frontiers
8136 This option causes GCC to create markers in the internal representation
8137 at the beginning of statements, and to keep them roughly in place
8138 throughout compilation, using them to guide the output of @code{is_stmt}
8139 markers in the line number table. This is enabled by default when
8140 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8141 @dots{}), and outputting DWARF 2 debug information at the normal level.
8142
8143 @item -gvariable-location-views
8144 @itemx -gvariable-location-views=incompat5
8145 @itemx -gno-variable-location-views
8146 @opindex gvariable-location-views
8147 @opindex gvariable-location-views=incompat5
8148 @opindex gno-variable-location-views
8149 Augment variable location lists with progressive view numbers implied
8150 from the line number table. This enables debug information consumers to
8151 inspect state at certain points of the program, even if no instructions
8152 associated with the corresponding source locations are present at that
8153 point. If the assembler lacks support for view numbers in line number
8154 tables, this will cause the compiler to emit the line number table,
8155 which generally makes them somewhat less compact. The augmented line
8156 number tables and location lists are fully backward-compatible, so they
8157 can be consumed by debug information consumers that are not aware of
8158 these augmentations, but they won't derive any benefit from them either.
8159
8160 This is enabled by default when outputting DWARF 2 debug information at
8161 the normal level, as long as there is assembler support,
8162 @option{-fvar-tracking-assignments} is enabled and
8163 @option{-gstrict-dwarf} is not. When assembler support is not
8164 available, this may still be enabled, but it will force GCC to output
8165 internal line number tables, and if
8166 @option{-ginternal-reset-location-views} is not enabled, that will most
8167 certainly lead to silently mismatching location views.
8168
8169 There is a proposed representation for view numbers that is not backward
8170 compatible with the location list format introduced in DWARF 5, that can
8171 be enabled with @option{-gvariable-location-views=incompat5}. This
8172 option may be removed in the future, is only provided as a reference
8173 implementation of the proposed representation. Debug information
8174 consumers are not expected to support this extended format, and they
8175 would be rendered unable to decode location lists using it.
8176
8177 @item -ginternal-reset-location-views
8178 @itemx -gnointernal-reset-location-views
8179 @opindex ginternal-reset-location-views
8180 @opindex gno-internal-reset-location-views
8181 Attempt to determine location views that can be omitted from location
8182 view lists. This requires the compiler to have very accurate insn
8183 length estimates, which isn't always the case, and it may cause
8184 incorrect view lists to be generated silently when using an assembler
8185 that does not support location view lists. The GNU assembler will flag
8186 any such error as a @code{view number mismatch}. This is only enabled
8187 on ports that define a reliable estimation function.
8188
8189 @item -ginline-points
8190 @itemx -gno-inline-points
8191 @opindex ginline-points
8192 @opindex gno-inline-points
8193 Generate extended debug information for inlined functions. Location
8194 view tracking markers are inserted at inlined entry points, so that
8195 address and view numbers can be computed and output in debug
8196 information. This can be enabled independently of location views, in
8197 which case the view numbers won't be output, but it can only be enabled
8198 along with statement frontiers, and it is only enabled by default if
8199 location views are enabled.
8200
8201 @item -gz@r{[}=@var{type}@r{]}
8202 @opindex gz
8203 Produce compressed debug sections in DWARF format, if that is supported.
8204 If @var{type} is not given, the default type depends on the capabilities
8205 of the assembler and linker used. @var{type} may be one of
8206 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8207 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8208 compression in traditional GNU format). If the linker doesn't support
8209 writing compressed debug sections, the option is rejected. Otherwise,
8210 if the assembler does not support them, @option{-gz} is silently ignored
8211 when producing object files.
8212
8213 @item -femit-struct-debug-baseonly
8214 @opindex femit-struct-debug-baseonly
8215 Emit debug information for struct-like types
8216 only when the base name of the compilation source file
8217 matches the base name of file in which the struct is defined.
8218
8219 This option substantially reduces the size of debugging information,
8220 but at significant potential loss in type information to the debugger.
8221 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8222 See @option{-femit-struct-debug-detailed} for more detailed control.
8223
8224 This option works only with DWARF debug output.
8225
8226 @item -femit-struct-debug-reduced
8227 @opindex femit-struct-debug-reduced
8228 Emit debug information for struct-like types
8229 only when the base name of the compilation source file
8230 matches the base name of file in which the type is defined,
8231 unless the struct is a template or defined in a system header.
8232
8233 This option significantly reduces the size of debugging information,
8234 with some potential loss in type information to the debugger.
8235 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8236 See @option{-femit-struct-debug-detailed} for more detailed control.
8237
8238 This option works only with DWARF debug output.
8239
8240 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8241 @opindex femit-struct-debug-detailed
8242 Specify the struct-like types
8243 for which the compiler generates debug information.
8244 The intent is to reduce duplicate struct debug information
8245 between different object files within the same program.
8246
8247 This option is a detailed version of
8248 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8249 which serves for most needs.
8250
8251 A specification has the syntax@*
8252 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8253
8254 The optional first word limits the specification to
8255 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8256 A struct type is used directly when it is the type of a variable, member.
8257 Indirect uses arise through pointers to structs.
8258 That is, when use of an incomplete struct is valid, the use is indirect.
8259 An example is
8260 @samp{struct one direct; struct two * indirect;}.
8261
8262 The optional second word limits the specification to
8263 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8264 Generic structs are a bit complicated to explain.
8265 For C++, these are non-explicit specializations of template classes,
8266 or non-template classes within the above.
8267 Other programming languages have generics,
8268 but @option{-femit-struct-debug-detailed} does not yet implement them.
8269
8270 The third word specifies the source files for those
8271 structs for which the compiler should emit debug information.
8272 The values @samp{none} and @samp{any} have the normal meaning.
8273 The value @samp{base} means that
8274 the base of name of the file in which the type declaration appears
8275 must match the base of the name of the main compilation file.
8276 In practice, this means that when compiling @file{foo.c}, debug information
8277 is generated for types declared in that file and @file{foo.h},
8278 but not other header files.
8279 The value @samp{sys} means those types satisfying @samp{base}
8280 or declared in system or compiler headers.
8281
8282 You may need to experiment to determine the best settings for your application.
8283
8284 The default is @option{-femit-struct-debug-detailed=all}.
8285
8286 This option works only with DWARF debug output.
8287
8288 @item -fno-dwarf2-cfi-asm
8289 @opindex fdwarf2-cfi-asm
8290 @opindex fno-dwarf2-cfi-asm
8291 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8292 instead of using GAS @code{.cfi_*} directives.
8293
8294 @item -fno-eliminate-unused-debug-types
8295 @opindex feliminate-unused-debug-types
8296 @opindex fno-eliminate-unused-debug-types
8297 Normally, when producing DWARF output, GCC avoids producing debug symbol
8298 output for types that are nowhere used in the source file being compiled.
8299 Sometimes it is useful to have GCC emit debugging
8300 information for all types declared in a compilation
8301 unit, regardless of whether or not they are actually used
8302 in that compilation unit, for example
8303 if, in the debugger, you want to cast a value to a type that is
8304 not actually used in your program (but is declared). More often,
8305 however, this results in a significant amount of wasted space.
8306 @end table
8307
8308 @node Optimize Options
8309 @section Options That Control Optimization
8310 @cindex optimize options
8311 @cindex options, optimization
8312
8313 These options control various sorts of optimizations.
8314
8315 Without any optimization option, the compiler's goal is to reduce the
8316 cost of compilation and to make debugging produce the expected
8317 results. Statements are independent: if you stop the program with a
8318 breakpoint between statements, you can then assign a new value to any
8319 variable or change the program counter to any other statement in the
8320 function and get exactly the results you expect from the source
8321 code.
8322
8323 Turning on optimization flags makes the compiler attempt to improve
8324 the performance and/or code size at the expense of compilation time
8325 and possibly the ability to debug the program.
8326
8327 The compiler performs optimization based on the knowledge it has of the
8328 program. Compiling multiple files at once to a single output file mode allows
8329 the compiler to use information gained from all of the files when compiling
8330 each of them.
8331
8332 Not all optimizations are controlled directly by a flag. Only
8333 optimizations that have a flag are listed in this section.
8334
8335 Most optimizations are completely disabled at @option{-O0} or if an
8336 @option{-O} level is not set on the command line, even if individual
8337 optimization flags are specified. Similarly, @option{-Og} suppresses
8338 many optimization passes.
8339
8340 Depending on the target and how GCC was configured, a slightly different
8341 set of optimizations may be enabled at each @option{-O} level than
8342 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8343 to find out the exact set of optimizations that are enabled at each level.
8344 @xref{Overall Options}, for examples.
8345
8346 @table @gcctabopt
8347 @item -O
8348 @itemx -O1
8349 @opindex O
8350 @opindex O1
8351 Optimize. Optimizing compilation takes somewhat more time, and a lot
8352 more memory for a large function.
8353
8354 With @option{-O}, the compiler tries to reduce code size and execution
8355 time, without performing any optimizations that take a great deal of
8356 compilation time.
8357
8358 @c Note that in addition to the default_options_table list in opts.c,
8359 @c several optimization flags default to true but control optimization
8360 @c passes that are explicitly disabled at -O0.
8361
8362 @option{-O} turns on the following optimization flags:
8363
8364 @c Please keep the following list alphabetized.
8365 @gccoptlist{-fauto-inc-dec @gol
8366 -fbranch-count-reg @gol
8367 -fcombine-stack-adjustments @gol
8368 -fcompare-elim @gol
8369 -fcprop-registers @gol
8370 -fdce @gol
8371 -fdefer-pop @gol
8372 -fdelayed-branch @gol
8373 -fdse @gol
8374 -fforward-propagate @gol
8375 -fguess-branch-probability @gol
8376 -fif-conversion @gol
8377 -fif-conversion2 @gol
8378 -finline-functions-called-once @gol
8379 -fipa-profile @gol
8380 -fipa-pure-const @gol
8381 -fipa-reference @gol
8382 -fipa-reference-addressable @gol
8383 -fmerge-constants @gol
8384 -fmove-loop-invariants @gol
8385 -fomit-frame-pointer @gol
8386 -freorder-blocks @gol
8387 -fshrink-wrap @gol
8388 -fshrink-wrap-separate @gol
8389 -fsplit-wide-types @gol
8390 -fssa-backprop @gol
8391 -fssa-phiopt @gol
8392 -ftree-bit-ccp @gol
8393 -ftree-ccp @gol
8394 -ftree-ch @gol
8395 -ftree-coalesce-vars @gol
8396 -ftree-copy-prop @gol
8397 -ftree-dce @gol
8398 -ftree-dominator-opts @gol
8399 -ftree-dse @gol
8400 -ftree-forwprop @gol
8401 -ftree-fre @gol
8402 -ftree-phiprop @gol
8403 -ftree-pta @gol
8404 -ftree-scev-cprop @gol
8405 -ftree-sink @gol
8406 -ftree-slsr @gol
8407 -ftree-sra @gol
8408 -ftree-ter @gol
8409 -funit-at-a-time}
8410
8411 @item -O2
8412 @opindex O2
8413 Optimize even more. GCC performs nearly all supported optimizations
8414 that do not involve a space-speed tradeoff.
8415 As compared to @option{-O}, this option increases both compilation time
8416 and the performance of the generated code.
8417
8418 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8419 also turns on the following optimization flags:
8420
8421 @c Please keep the following list alphabetized!
8422 @gccoptlist{-falign-functions -falign-jumps @gol
8423 -falign-labels -falign-loops @gol
8424 -fcaller-saves @gol
8425 -fcode-hoisting @gol
8426 -fcrossjumping @gol
8427 -fcse-follow-jumps -fcse-skip-blocks @gol
8428 -fdelete-null-pointer-checks @gol
8429 -fdevirtualize -fdevirtualize-speculatively @gol
8430 -fexpensive-optimizations @gol
8431 -ffinite-loops @gol
8432 -fgcse -fgcse-lm @gol
8433 -fhoist-adjacent-loads @gol
8434 -finline-functions @gol
8435 -finline-small-functions @gol
8436 -findirect-inlining @gol
8437 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8438 -fipa-ra -fipa-sra -fipa-vrp @gol
8439 -fisolate-erroneous-paths-dereference @gol
8440 -flra-remat @gol
8441 -foptimize-sibling-calls @gol
8442 -foptimize-strlen @gol
8443 -fpartial-inlining @gol
8444 -fpeephole2 @gol
8445 -freorder-blocks-algorithm=stc @gol
8446 -freorder-blocks-and-partition -freorder-functions @gol
8447 -frerun-cse-after-loop @gol
8448 -fschedule-insns -fschedule-insns2 @gol
8449 -fsched-interblock -fsched-spec @gol
8450 -fstore-merging @gol
8451 -fstrict-aliasing @gol
8452 -fthread-jumps @gol
8453 -ftree-builtin-call-dce @gol
8454 -ftree-pre @gol
8455 -ftree-switch-conversion -ftree-tail-merge @gol
8456 -ftree-vrp}
8457
8458 Please note the warning under @option{-fgcse} about
8459 invoking @option{-O2} on programs that use computed gotos.
8460
8461 @item -O3
8462 @opindex O3
8463 Optimize yet more. @option{-O3} turns on all optimizations specified
8464 by @option{-O2} and also turns on the following optimization flags:
8465
8466 @c Please keep the following list alphabetized!
8467 @gccoptlist{-fgcse-after-reload @gol
8468 -fipa-cp-clone
8469 -floop-interchange @gol
8470 -floop-unroll-and-jam @gol
8471 -fpeel-loops @gol
8472 -fpredictive-commoning @gol
8473 -fsplit-paths @gol
8474 -ftree-loop-distribute-patterns @gol
8475 -ftree-loop-distribution @gol
8476 -ftree-loop-vectorize @gol
8477 -ftree-partial-pre @gol
8478 -ftree-slp-vectorize @gol
8479 -funswitch-loops @gol
8480 -fvect-cost-model @gol
8481 -fversion-loops-for-strides}
8482
8483 @item -O0
8484 @opindex O0
8485 Reduce compilation time and make debugging produce the expected
8486 results. This is the default.
8487
8488 @item -Os
8489 @opindex Os
8490 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8491 except those that often increase code size:
8492
8493 @gccoptlist{-falign-functions -falign-jumps @gol
8494 -falign-labels -falign-loops @gol
8495 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8496
8497 It also enables @option{-finline-functions}, causes the compiler to tune for
8498 code size rather than execution speed, and performs further optimizations
8499 designed to reduce code size.
8500
8501 @item -Ofast
8502 @opindex Ofast
8503 Disregard strict standards compliance. @option{-Ofast} enables all
8504 @option{-O3} optimizations. It also enables optimizations that are not
8505 valid for all standard-compliant programs.
8506 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
8507 and the Fortran-specific @option{-fstack-arrays}, unless
8508 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
8509
8510 @item -Og
8511 @opindex Og
8512 Optimize debugging experience. @option{-Og} should be the optimization
8513 level of choice for the standard edit-compile-debug cycle, offering
8514 a reasonable level of optimization while maintaining fast compilation
8515 and a good debugging experience. It is a better choice than @option{-O0}
8516 for producing debuggable code because some compiler passes
8517 that collect debug information are disabled at @option{-O0}.
8518
8519 Like @option{-O0}, @option{-Og} completely disables a number of
8520 optimization passes so that individual options controlling them have
8521 no effect. Otherwise @option{-Og} enables all @option{-O1}
8522 optimization flags except for those that may interfere with debugging:
8523
8524 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8525 -fdse -fif-conversion -fif-conversion2 @gol
8526 -finline-functions-called-once @gol
8527 -fmove-loop-invariants -fssa-phiopt @gol
8528 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8529
8530 @end table
8531
8532 If you use multiple @option{-O} options, with or without level numbers,
8533 the last such option is the one that is effective.
8534
8535 Options of the form @option{-f@var{flag}} specify machine-independent
8536 flags. Most flags have both positive and negative forms; the negative
8537 form of @option{-ffoo} is @option{-fno-foo}. In the table
8538 below, only one of the forms is listed---the one you typically
8539 use. You can figure out the other form by either removing @samp{no-}
8540 or adding it.
8541
8542 The following options control specific optimizations. They are either
8543 activated by @option{-O} options or are related to ones that are. You
8544 can use the following flags in the rare cases when ``fine-tuning'' of
8545 optimizations to be performed is desired.
8546
8547 @table @gcctabopt
8548 @item -fno-defer-pop
8549 @opindex fno-defer-pop
8550 @opindex fdefer-pop
8551 For machines that must pop arguments after a function call, always pop
8552 the arguments as soon as each function returns.
8553 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8554 this allows the compiler to let arguments accumulate on the stack for several
8555 function calls and pop them all at once.
8556
8557 @item -fforward-propagate
8558 @opindex fforward-propagate
8559 Perform a forward propagation pass on RTL@. The pass tries to combine two
8560 instructions and checks if the result can be simplified. If loop unrolling
8561 is active, two passes are performed and the second is scheduled after
8562 loop unrolling.
8563
8564 This option is enabled by default at optimization levels @option{-O},
8565 @option{-O2}, @option{-O3}, @option{-Os}.
8566
8567 @item -ffp-contract=@var{style}
8568 @opindex ffp-contract
8569 @option{-ffp-contract=off} disables floating-point expression contraction.
8570 @option{-ffp-contract=fast} enables floating-point expression contraction
8571 such as forming of fused multiply-add operations if the target has
8572 native support for them.
8573 @option{-ffp-contract=on} enables floating-point expression contraction
8574 if allowed by the language standard. This is currently not implemented
8575 and treated equal to @option{-ffp-contract=off}.
8576
8577 The default is @option{-ffp-contract=fast}.
8578
8579 @item -fomit-frame-pointer
8580 @opindex fomit-frame-pointer
8581 Omit the frame pointer in functions that don't need one. This avoids the
8582 instructions to save, set up and restore the frame pointer; on many targets
8583 it also makes an extra register available.
8584
8585 On some targets this flag has no effect because the standard calling sequence
8586 always uses a frame pointer, so it cannot be omitted.
8587
8588 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8589 is used in all functions. Several targets always omit the frame pointer in
8590 leaf functions.
8591
8592 Enabled by default at @option{-O} and higher.
8593
8594 @item -foptimize-sibling-calls
8595 @opindex foptimize-sibling-calls
8596 Optimize sibling and tail recursive calls.
8597
8598 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8599
8600 @item -foptimize-strlen
8601 @opindex foptimize-strlen
8602 Optimize various standard C string functions (e.g.@: @code{strlen},
8603 @code{strchr} or @code{strcpy}) and
8604 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8605
8606 Enabled at levels @option{-O2}, @option{-O3}.
8607
8608 @item -fno-inline
8609 @opindex fno-inline
8610 @opindex finline
8611 Do not expand any functions inline apart from those marked with
8612 the @code{always_inline} attribute. This is the default when not
8613 optimizing.
8614
8615 Single functions can be exempted from inlining by marking them
8616 with the @code{noinline} attribute.
8617
8618 @item -finline-small-functions
8619 @opindex finline-small-functions
8620 Integrate functions into their callers when their body is smaller than expected
8621 function call code (so overall size of program gets smaller). The compiler
8622 heuristically decides which functions are simple enough to be worth integrating
8623 in this way. This inlining applies to all functions, even those not declared
8624 inline.
8625
8626 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8627
8628 @item -findirect-inlining
8629 @opindex findirect-inlining
8630 Inline also indirect calls that are discovered to be known at compile
8631 time thanks to previous inlining. This option has any effect only
8632 when inlining itself is turned on by the @option{-finline-functions}
8633 or @option{-finline-small-functions} options.
8634
8635 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8636
8637 @item -finline-functions
8638 @opindex finline-functions
8639 Consider all functions for inlining, even if they are not declared inline.
8640 The compiler heuristically decides which functions are worth integrating
8641 in this way.
8642
8643 If all calls to a given function are integrated, and the function is
8644 declared @code{static}, then the function is normally not output as
8645 assembler code in its own right.
8646
8647 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8648 by @option{-fprofile-use} and @option{-fauto-profile}.
8649
8650 @item -finline-functions-called-once
8651 @opindex finline-functions-called-once
8652 Consider all @code{static} functions called once for inlining into their
8653 caller even if they are not marked @code{inline}. If a call to a given
8654 function is integrated, then the function is not output as assembler code
8655 in its own right.
8656
8657 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8658 but not @option{-Og}.
8659
8660 @item -fearly-inlining
8661 @opindex fearly-inlining
8662 Inline functions marked by @code{always_inline} and functions whose body seems
8663 smaller than the function call overhead early before doing
8664 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8665 makes profiling significantly cheaper and usually inlining faster on programs
8666 having large chains of nested wrapper functions.
8667
8668 Enabled by default.
8669
8670 @item -fipa-sra
8671 @opindex fipa-sra
8672 Perform interprocedural scalar replacement of aggregates, removal of
8673 unused parameters and replacement of parameters passed by reference
8674 by parameters passed by value.
8675
8676 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8677
8678 @item -finline-limit=@var{n}
8679 @opindex finline-limit
8680 By default, GCC limits the size of functions that can be inlined. This flag
8681 allows coarse control of this limit. @var{n} is the size of functions that
8682 can be inlined in number of pseudo instructions.
8683
8684 Inlining is actually controlled by a number of parameters, which may be
8685 specified individually by using @option{--param @var{name}=@var{value}}.
8686 The @option{-finline-limit=@var{n}} option sets some of these parameters
8687 as follows:
8688
8689 @table @gcctabopt
8690 @item max-inline-insns-single
8691 is set to @var{n}/2.
8692 @item max-inline-insns-auto
8693 is set to @var{n}/2.
8694 @end table
8695
8696 See below for a documentation of the individual
8697 parameters controlling inlining and for the defaults of these parameters.
8698
8699 @emph{Note:} there may be no value to @option{-finline-limit} that results
8700 in default behavior.
8701
8702 @emph{Note:} pseudo instruction represents, in this particular context, an
8703 abstract measurement of function's size. In no way does it represent a count
8704 of assembly instructions and as such its exact meaning might change from one
8705 release to an another.
8706
8707 @item -fno-keep-inline-dllexport
8708 @opindex fno-keep-inline-dllexport
8709 @opindex fkeep-inline-dllexport
8710 This is a more fine-grained version of @option{-fkeep-inline-functions},
8711 which applies only to functions that are declared using the @code{dllexport}
8712 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8713 Functions}.
8714
8715 @item -fkeep-inline-functions
8716 @opindex fkeep-inline-functions
8717 In C, emit @code{static} functions that are declared @code{inline}
8718 into the object file, even if the function has been inlined into all
8719 of its callers. This switch does not affect functions using the
8720 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8721 inline functions into the object file.
8722
8723 @item -fkeep-static-functions
8724 @opindex fkeep-static-functions
8725 Emit @code{static} functions into the object file, even if the function
8726 is never used.
8727
8728 @item -fkeep-static-consts
8729 @opindex fkeep-static-consts
8730 Emit variables declared @code{static const} when optimization isn't turned
8731 on, even if the variables aren't referenced.
8732
8733 GCC enables this option by default. If you want to force the compiler to
8734 check if a variable is referenced, regardless of whether or not
8735 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8736
8737 @item -fmerge-constants
8738 @opindex fmerge-constants
8739 Attempt to merge identical constants (string constants and floating-point
8740 constants) across compilation units.
8741
8742 This option is the default for optimized compilation if the assembler and
8743 linker support it. Use @option{-fno-merge-constants} to inhibit this
8744 behavior.
8745
8746 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8747
8748 @item -fmerge-all-constants
8749 @opindex fmerge-all-constants
8750 Attempt to merge identical constants and identical variables.
8751
8752 This option implies @option{-fmerge-constants}. In addition to
8753 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8754 arrays or initialized constant variables with integral or floating-point
8755 types. Languages like C or C++ require each variable, including multiple
8756 instances of the same variable in recursive calls, to have distinct locations,
8757 so using this option results in non-conforming
8758 behavior.
8759
8760 @item -fmodulo-sched
8761 @opindex fmodulo-sched
8762 Perform swing modulo scheduling immediately before the first scheduling
8763 pass. This pass looks at innermost loops and reorders their
8764 instructions by overlapping different iterations.
8765
8766 @item -fmodulo-sched-allow-regmoves
8767 @opindex fmodulo-sched-allow-regmoves
8768 Perform more aggressive SMS-based modulo scheduling with register moves
8769 allowed. By setting this flag certain anti-dependences edges are
8770 deleted, which triggers the generation of reg-moves based on the
8771 life-range analysis. This option is effective only with
8772 @option{-fmodulo-sched} enabled.
8773
8774 @item -fno-branch-count-reg
8775 @opindex fno-branch-count-reg
8776 @opindex fbranch-count-reg
8777 Disable the optimization pass that scans for opportunities to use
8778 ``decrement and branch'' instructions on a count register instead of
8779 instruction sequences that decrement a register, compare it against zero, and
8780 then branch based upon the result. This option is only meaningful on
8781 architectures that support such instructions, which include x86, PowerPC,
8782 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8783 doesn't remove the decrement and branch instructions from the generated
8784 instruction stream introduced by other optimization passes.
8785
8786 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8787 except for @option{-Og}.
8788
8789 @item -fno-function-cse
8790 @opindex fno-function-cse
8791 @opindex ffunction-cse
8792 Do not put function addresses in registers; make each instruction that
8793 calls a constant function contain the function's address explicitly.
8794
8795 This option results in less efficient code, but some strange hacks
8796 that alter the assembler output may be confused by the optimizations
8797 performed when this option is not used.
8798
8799 The default is @option{-ffunction-cse}
8800
8801 @item -fno-zero-initialized-in-bss
8802 @opindex fno-zero-initialized-in-bss
8803 @opindex fzero-initialized-in-bss
8804 If the target supports a BSS section, GCC by default puts variables that
8805 are initialized to zero into BSS@. This can save space in the resulting
8806 code.
8807
8808 This option turns off this behavior because some programs explicitly
8809 rely on variables going to the data section---e.g., so that the
8810 resulting executable can find the beginning of that section and/or make
8811 assumptions based on that.
8812
8813 The default is @option{-fzero-initialized-in-bss}.
8814
8815 @item -fthread-jumps
8816 @opindex fthread-jumps
8817 Perform optimizations that check to see if a jump branches to a
8818 location where another comparison subsumed by the first is found. If
8819 so, the first branch is redirected to either the destination of the
8820 second branch or a point immediately following it, depending on whether
8821 the condition is known to be true or false.
8822
8823 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8824
8825 @item -fsplit-wide-types
8826 @opindex fsplit-wide-types
8827 When using a type that occupies multiple registers, such as @code{long
8828 long} on a 32-bit system, split the registers apart and allocate them
8829 independently. This normally generates better code for those types,
8830 but may make debugging more difficult.
8831
8832 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8833 @option{-Os}.
8834
8835 @item -fsplit-wide-types-early
8836 @opindex fsplit-wide-types-early
8837 Fully split wide types early, instead of very late.
8838 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8839
8840 This is the default on some targets.
8841
8842 @item -fcse-follow-jumps
8843 @opindex fcse-follow-jumps
8844 In common subexpression elimination (CSE), scan through jump instructions
8845 when the target of the jump is not reached by any other path. For
8846 example, when CSE encounters an @code{if} statement with an
8847 @code{else} clause, CSE follows the jump when the condition
8848 tested is false.
8849
8850 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8851
8852 @item -fcse-skip-blocks
8853 @opindex fcse-skip-blocks
8854 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8855 follow jumps that conditionally skip over blocks. When CSE
8856 encounters a simple @code{if} statement with no else clause,
8857 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8858 body of the @code{if}.
8859
8860 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8861
8862 @item -frerun-cse-after-loop
8863 @opindex frerun-cse-after-loop
8864 Re-run common subexpression elimination after loop optimizations are
8865 performed.
8866
8867 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8868
8869 @item -fgcse
8870 @opindex fgcse
8871 Perform a global common subexpression elimination pass.
8872 This pass also performs global constant and copy propagation.
8873
8874 @emph{Note:} When compiling a program using computed gotos, a GCC
8875 extension, you may get better run-time performance if you disable
8876 the global common subexpression elimination pass by adding
8877 @option{-fno-gcse} to the command line.
8878
8879 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8880
8881 @item -fgcse-lm
8882 @opindex fgcse-lm
8883 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8884 attempts to move loads that are only killed by stores into themselves. This
8885 allows a loop containing a load/store sequence to be changed to a load outside
8886 the loop, and a copy/store within the loop.
8887
8888 Enabled by default when @option{-fgcse} is enabled.
8889
8890 @item -fgcse-sm
8891 @opindex fgcse-sm
8892 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8893 global common subexpression elimination. This pass attempts to move
8894 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8895 loops containing a load/store sequence can be changed to a load before
8896 the loop and a store after the loop.
8897
8898 Not enabled at any optimization level.
8899
8900 @item -fgcse-las
8901 @opindex fgcse-las
8902 When @option{-fgcse-las} is enabled, the global common subexpression
8903 elimination pass eliminates redundant loads that come after stores to the
8904 same memory location (both partial and full redundancies).
8905
8906 Not enabled at any optimization level.
8907
8908 @item -fgcse-after-reload
8909 @opindex fgcse-after-reload
8910 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8911 pass is performed after reload. The purpose of this pass is to clean up
8912 redundant spilling.
8913
8914 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8915
8916 @item -faggressive-loop-optimizations
8917 @opindex faggressive-loop-optimizations
8918 This option tells the loop optimizer to use language constraints to
8919 derive bounds for the number of iterations of a loop. This assumes that
8920 loop code does not invoke undefined behavior by for example causing signed
8921 integer overflows or out-of-bound array accesses. The bounds for the
8922 number of iterations of a loop are used to guide loop unrolling and peeling
8923 and loop exit test optimizations.
8924 This option is enabled by default.
8925
8926 @item -funconstrained-commons
8927 @opindex funconstrained-commons
8928 This option tells the compiler that variables declared in common blocks
8929 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8930 prevents certain optimizations that depend on knowing the array bounds.
8931
8932 @item -fcrossjumping
8933 @opindex fcrossjumping
8934 Perform cross-jumping transformation.
8935 This transformation unifies equivalent code and saves code size. The
8936 resulting code may or may not perform better than without cross-jumping.
8937
8938 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8939
8940 @item -fauto-inc-dec
8941 @opindex fauto-inc-dec
8942 Combine increments or decrements of addresses with memory accesses.
8943 This pass is always skipped on architectures that do not have
8944 instructions to support this. Enabled by default at @option{-O} and
8945 higher on architectures that support this.
8946
8947 @item -fdce
8948 @opindex fdce
8949 Perform dead code elimination (DCE) on RTL@.
8950 Enabled by default at @option{-O} and higher.
8951
8952 @item -fdse
8953 @opindex fdse
8954 Perform dead store elimination (DSE) on RTL@.
8955 Enabled by default at @option{-O} and higher.
8956
8957 @item -fif-conversion
8958 @opindex fif-conversion
8959 Attempt to transform conditional jumps into branch-less equivalents. This
8960 includes use of conditional moves, min, max, set flags and abs instructions, and
8961 some tricks doable by standard arithmetics. The use of conditional execution
8962 on chips where it is available is controlled by @option{-fif-conversion2}.
8963
8964 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8965 not with @option{-Og}.
8966
8967 @item -fif-conversion2
8968 @opindex fif-conversion2
8969 Use conditional execution (where available) to transform conditional jumps into
8970 branch-less equivalents.
8971
8972 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8973 not with @option{-Og}.
8974
8975 @item -fdeclone-ctor-dtor
8976 @opindex fdeclone-ctor-dtor
8977 The C++ ABI requires multiple entry points for constructors and
8978 destructors: one for a base subobject, one for a complete object, and
8979 one for a virtual destructor that calls operator delete afterwards.
8980 For a hierarchy with virtual bases, the base and complete variants are
8981 clones, which means two copies of the function. With this option, the
8982 base and complete variants are changed to be thunks that call a common
8983 implementation.
8984
8985 Enabled by @option{-Os}.
8986
8987 @item -fdelete-null-pointer-checks
8988 @opindex fdelete-null-pointer-checks
8989 Assume that programs cannot safely dereference null pointers, and that
8990 no code or data element resides at address zero.
8991 This option enables simple constant
8992 folding optimizations at all optimization levels. In addition, other
8993 optimization passes in GCC use this flag to control global dataflow
8994 analyses that eliminate useless checks for null pointers; these assume
8995 that a memory access to address zero always results in a trap, so
8996 that if a pointer is checked after it has already been dereferenced,
8997 it cannot be null.
8998
8999 Note however that in some environments this assumption is not true.
9000 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
9001 for programs that depend on that behavior.
9002
9003 This option is enabled by default on most targets. On Nios II ELF, it
9004 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
9005
9006 Passes that use the dataflow information
9007 are enabled independently at different optimization levels.
9008
9009 @item -fdevirtualize
9010 @opindex fdevirtualize
9011 Attempt to convert calls to virtual functions to direct calls. This
9012 is done both within a procedure and interprocedurally as part of
9013 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9014 propagation (@option{-fipa-cp}).
9015 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9016
9017 @item -fdevirtualize-speculatively
9018 @opindex fdevirtualize-speculatively
9019 Attempt to convert calls to virtual functions to speculative direct calls.
9020 Based on the analysis of the type inheritance graph, determine for a given call
9021 the set of likely targets. If the set is small, preferably of size 1, change
9022 the call into a conditional deciding between direct and indirect calls. The
9023 speculative calls enable more optimizations, such as inlining. When they seem
9024 useless after further optimization, they are converted back into original form.
9025
9026 @item -fdevirtualize-at-ltrans
9027 @opindex fdevirtualize-at-ltrans
9028 Stream extra information needed for aggressive devirtualization when running
9029 the link-time optimizer in local transformation mode.
9030 This option enables more devirtualization but
9031 significantly increases the size of streamed data. For this reason it is
9032 disabled by default.
9033
9034 @item -fexpensive-optimizations
9035 @opindex fexpensive-optimizations
9036 Perform a number of minor optimizations that are relatively expensive.
9037
9038 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9039
9040 @item -free
9041 @opindex free
9042 Attempt to remove redundant extension instructions. This is especially
9043 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9044 registers after writing to their lower 32-bit half.
9045
9046 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9047 @option{-O3}, @option{-Os}.
9048
9049 @item -fno-lifetime-dse
9050 @opindex fno-lifetime-dse
9051 @opindex flifetime-dse
9052 In C++ the value of an object is only affected by changes within its
9053 lifetime: when the constructor begins, the object has an indeterminate
9054 value, and any changes during the lifetime of the object are dead when
9055 the object is destroyed. Normally dead store elimination will take
9056 advantage of this; if your code relies on the value of the object
9057 storage persisting beyond the lifetime of the object, you can use this
9058 flag to disable this optimization. To preserve stores before the
9059 constructor starts (e.g.@: because your operator new clears the object
9060 storage) but still treat the object as dead after the destructor you,
9061 can use @option{-flifetime-dse=1}. The default behavior can be
9062 explicitly selected with @option{-flifetime-dse=2}.
9063 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9064
9065 @item -flive-range-shrinkage
9066 @opindex flive-range-shrinkage
9067 Attempt to decrease register pressure through register live range
9068 shrinkage. This is helpful for fast processors with small or moderate
9069 size register sets.
9070
9071 @item -fira-algorithm=@var{algorithm}
9072 @opindex fira-algorithm
9073 Use the specified coloring algorithm for the integrated register
9074 allocator. The @var{algorithm} argument can be @samp{priority}, which
9075 specifies Chow's priority coloring, or @samp{CB}, which specifies
9076 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9077 for all architectures, but for those targets that do support it, it is
9078 the default because it generates better code.
9079
9080 @item -fira-region=@var{region}
9081 @opindex fira-region
9082 Use specified regions for the integrated register allocator. The
9083 @var{region} argument should be one of the following:
9084
9085 @table @samp
9086
9087 @item all
9088 Use all loops as register allocation regions.
9089 This can give the best results for machines with a small and/or
9090 irregular register set.
9091
9092 @item mixed
9093 Use all loops except for loops with small register pressure
9094 as the regions. This value usually gives
9095 the best results in most cases and for most architectures,
9096 and is enabled by default when compiling with optimization for speed
9097 (@option{-O}, @option{-O2}, @dots{}).
9098
9099 @item one
9100 Use all functions as a single region.
9101 This typically results in the smallest code size, and is enabled by default for
9102 @option{-Os} or @option{-O0}.
9103
9104 @end table
9105
9106 @item -fira-hoist-pressure
9107 @opindex fira-hoist-pressure
9108 Use IRA to evaluate register pressure in the code hoisting pass for
9109 decisions to hoist expressions. This option usually results in smaller
9110 code, but it can slow the compiler down.
9111
9112 This option is enabled at level @option{-Os} for all targets.
9113
9114 @item -fira-loop-pressure
9115 @opindex fira-loop-pressure
9116 Use IRA to evaluate register pressure in loops for decisions to move
9117 loop invariants. This option usually results in generation
9118 of faster and smaller code on machines with large register files (>= 32
9119 registers), but it can slow the compiler down.
9120
9121 This option is enabled at level @option{-O3} for some targets.
9122
9123 @item -fno-ira-share-save-slots
9124 @opindex fno-ira-share-save-slots
9125 @opindex fira-share-save-slots
9126 Disable sharing of stack slots used for saving call-used hard
9127 registers living through a call. Each hard register gets a
9128 separate stack slot, and as a result function stack frames are
9129 larger.
9130
9131 @item -fno-ira-share-spill-slots
9132 @opindex fno-ira-share-spill-slots
9133 @opindex fira-share-spill-slots
9134 Disable sharing of stack slots allocated for pseudo-registers. Each
9135 pseudo-register that does not get a hard register gets a separate
9136 stack slot, and as a result function stack frames are larger.
9137
9138 @item -flra-remat
9139 @opindex flra-remat
9140 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9141 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9142 values if it is profitable.
9143
9144 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9145
9146 @item -fdelayed-branch
9147 @opindex fdelayed-branch
9148 If supported for the target machine, attempt to reorder instructions
9149 to exploit instruction slots available after delayed branch
9150 instructions.
9151
9152 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9153 but not at @option{-Og}.
9154
9155 @item -fschedule-insns
9156 @opindex fschedule-insns
9157 If supported for the target machine, attempt to reorder instructions to
9158 eliminate execution stalls due to required data being unavailable. This
9159 helps machines that have slow floating point or memory load instructions
9160 by allowing other instructions to be issued until the result of the load
9161 or floating-point instruction is required.
9162
9163 Enabled at levels @option{-O2}, @option{-O3}.
9164
9165 @item -fschedule-insns2
9166 @opindex fschedule-insns2
9167 Similar to @option{-fschedule-insns}, but requests an additional pass of
9168 instruction scheduling after register allocation has been done. This is
9169 especially useful on machines with a relatively small number of
9170 registers and where memory load instructions take more than one cycle.
9171
9172 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9173
9174 @item -fno-sched-interblock
9175 @opindex fno-sched-interblock
9176 @opindex fsched-interblock
9177 Disable instruction scheduling across basic blocks, which
9178 is normally enabled when scheduling before register allocation, i.e.@:
9179 with @option{-fschedule-insns} or at @option{-O2} or higher.
9180
9181 @item -fno-sched-spec
9182 @opindex fno-sched-spec
9183 @opindex fsched-spec
9184 Disable speculative motion of non-load instructions, which
9185 is normally enabled when scheduling before register allocation, i.e.@:
9186 with @option{-fschedule-insns} or at @option{-O2} or higher.
9187
9188 @item -fsched-pressure
9189 @opindex fsched-pressure
9190 Enable register pressure sensitive insn scheduling before register
9191 allocation. This only makes sense when scheduling before register
9192 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9193 @option{-O2} or higher. Usage of this option can improve the
9194 generated code and decrease its size by preventing register pressure
9195 increase above the number of available hard registers and subsequent
9196 spills in register allocation.
9197
9198 @item -fsched-spec-load
9199 @opindex fsched-spec-load
9200 Allow speculative motion of some load instructions. This only makes
9201 sense when scheduling before register allocation, i.e.@: with
9202 @option{-fschedule-insns} or at @option{-O2} or higher.
9203
9204 @item -fsched-spec-load-dangerous
9205 @opindex fsched-spec-load-dangerous
9206 Allow speculative motion of more load instructions. This only makes
9207 sense when scheduling before register allocation, i.e.@: with
9208 @option{-fschedule-insns} or at @option{-O2} or higher.
9209
9210 @item -fsched-stalled-insns
9211 @itemx -fsched-stalled-insns=@var{n}
9212 @opindex fsched-stalled-insns
9213 Define how many insns (if any) can be moved prematurely from the queue
9214 of stalled insns into the ready list during the second scheduling pass.
9215 @option{-fno-sched-stalled-insns} means that no insns are moved
9216 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9217 on how many queued insns can be moved prematurely.
9218 @option{-fsched-stalled-insns} without a value is equivalent to
9219 @option{-fsched-stalled-insns=1}.
9220
9221 @item -fsched-stalled-insns-dep
9222 @itemx -fsched-stalled-insns-dep=@var{n}
9223 @opindex fsched-stalled-insns-dep
9224 Define how many insn groups (cycles) are examined for a dependency
9225 on a stalled insn that is a candidate for premature removal from the queue
9226 of stalled insns. This has an effect only during the second scheduling pass,
9227 and only if @option{-fsched-stalled-insns} is used.
9228 @option{-fno-sched-stalled-insns-dep} is equivalent to
9229 @option{-fsched-stalled-insns-dep=0}.
9230 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9231 @option{-fsched-stalled-insns-dep=1}.
9232
9233 @item -fsched2-use-superblocks
9234 @opindex fsched2-use-superblocks
9235 When scheduling after register allocation, use superblock scheduling.
9236 This allows motion across basic block boundaries,
9237 resulting in faster schedules. This option is experimental, as not all machine
9238 descriptions used by GCC model the CPU closely enough to avoid unreliable
9239 results from the algorithm.
9240
9241 This only makes sense when scheduling after register allocation, i.e.@: with
9242 @option{-fschedule-insns2} or at @option{-O2} or higher.
9243
9244 @item -fsched-group-heuristic
9245 @opindex fsched-group-heuristic
9246 Enable the group heuristic in the scheduler. This heuristic favors
9247 the instruction that belongs to a schedule group. This is enabled
9248 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9249 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9250
9251 @item -fsched-critical-path-heuristic
9252 @opindex fsched-critical-path-heuristic
9253 Enable the critical-path heuristic in the scheduler. This heuristic favors
9254 instructions on the critical path. This is enabled by default when
9255 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9256 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9257
9258 @item -fsched-spec-insn-heuristic
9259 @opindex fsched-spec-insn-heuristic
9260 Enable the speculative instruction heuristic in the scheduler. This
9261 heuristic favors speculative instructions with greater dependency weakness.
9262 This is enabled by default when scheduling is enabled, i.e.@:
9263 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9264 or at @option{-O2} or higher.
9265
9266 @item -fsched-rank-heuristic
9267 @opindex fsched-rank-heuristic
9268 Enable the rank heuristic in the scheduler. This heuristic favors
9269 the instruction belonging to a basic block with greater size or frequency.
9270 This is enabled by default when scheduling is enabled, i.e.@:
9271 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9272 at @option{-O2} or higher.
9273
9274 @item -fsched-last-insn-heuristic
9275 @opindex fsched-last-insn-heuristic
9276 Enable the last-instruction heuristic in the scheduler. This heuristic
9277 favors the instruction that is less dependent on the last instruction
9278 scheduled. This is enabled by default when scheduling is enabled,
9279 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9280 at @option{-O2} or higher.
9281
9282 @item -fsched-dep-count-heuristic
9283 @opindex fsched-dep-count-heuristic
9284 Enable the dependent-count heuristic in the scheduler. This heuristic
9285 favors the instruction that has more instructions depending on it.
9286 This is enabled by default when scheduling is enabled, i.e.@:
9287 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9288 at @option{-O2} or higher.
9289
9290 @item -freschedule-modulo-scheduled-loops
9291 @opindex freschedule-modulo-scheduled-loops
9292 Modulo scheduling is performed before traditional scheduling. If a loop
9293 is modulo scheduled, later scheduling passes may change its schedule.
9294 Use this option to control that behavior.
9295
9296 @item -fselective-scheduling
9297 @opindex fselective-scheduling
9298 Schedule instructions using selective scheduling algorithm. Selective
9299 scheduling runs instead of the first scheduler pass.
9300
9301 @item -fselective-scheduling2
9302 @opindex fselective-scheduling2
9303 Schedule instructions using selective scheduling algorithm. Selective
9304 scheduling runs instead of the second scheduler pass.
9305
9306 @item -fsel-sched-pipelining
9307 @opindex fsel-sched-pipelining
9308 Enable software pipelining of innermost loops during selective scheduling.
9309 This option has no effect unless one of @option{-fselective-scheduling} or
9310 @option{-fselective-scheduling2} is turned on.
9311
9312 @item -fsel-sched-pipelining-outer-loops
9313 @opindex fsel-sched-pipelining-outer-loops
9314 When pipelining loops during selective scheduling, also pipeline outer loops.
9315 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9316
9317 @item -fsemantic-interposition
9318 @opindex fsemantic-interposition
9319 Some object formats, like ELF, allow interposing of symbols by the
9320 dynamic linker.
9321 This means that for symbols exported from the DSO, the compiler cannot perform
9322 interprocedural propagation, inlining and other optimizations in anticipation
9323 that the function or variable in question may change. While this feature is
9324 useful, for example, to rewrite memory allocation functions by a debugging
9325 implementation, it is expensive in the terms of code quality.
9326 With @option{-fno-semantic-interposition} the compiler assumes that
9327 if interposition happens for functions the overwriting function will have
9328 precisely the same semantics (and side effects).
9329 Similarly if interposition happens
9330 for variables, the constructor of the variable will be the same. The flag
9331 has no effect for functions explicitly declared inline
9332 (where it is never allowed for interposition to change semantics)
9333 and for symbols explicitly declared weak.
9334
9335 @item -fshrink-wrap
9336 @opindex fshrink-wrap
9337 Emit function prologues only before parts of the function that need it,
9338 rather than at the top of the function. This flag is enabled by default at
9339 @option{-O} and higher.
9340
9341 @item -fshrink-wrap-separate
9342 @opindex fshrink-wrap-separate
9343 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9344 those parts are only executed when needed.
9345 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9346 is also turned on and the target supports this.
9347
9348 @item -fcaller-saves
9349 @opindex fcaller-saves
9350 Enable allocation of values to registers that are clobbered by
9351 function calls, by emitting extra instructions to save and restore the
9352 registers around such calls. Such allocation is done only when it
9353 seems to result in better code.
9354
9355 This option is always enabled by default on certain machines, usually
9356 those which have no call-preserved registers to use instead.
9357
9358 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9359
9360 @item -fcombine-stack-adjustments
9361 @opindex fcombine-stack-adjustments
9362 Tracks stack adjustments (pushes and pops) and stack memory references
9363 and then tries to find ways to combine them.
9364
9365 Enabled by default at @option{-O1} and higher.
9366
9367 @item -fipa-ra
9368 @opindex fipa-ra
9369 Use caller save registers for allocation if those registers are not used by
9370 any called function. In that case it is not necessary to save and restore
9371 them around calls. This is only possible if called functions are part of
9372 same compilation unit as current function and they are compiled before it.
9373
9374 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9375 is disabled if generated code will be instrumented for profiling
9376 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9377 exactly (this happens on targets that do not expose prologues
9378 and epilogues in RTL).
9379
9380 @item -fconserve-stack
9381 @opindex fconserve-stack
9382 Attempt to minimize stack usage. The compiler attempts to use less
9383 stack space, even if that makes the program slower. This option
9384 implies setting the @option{large-stack-frame} parameter to 100
9385 and the @option{large-stack-frame-growth} parameter to 400.
9386
9387 @item -ftree-reassoc
9388 @opindex ftree-reassoc
9389 Perform reassociation on trees. This flag is enabled by default
9390 at @option{-O} and higher.
9391
9392 @item -fcode-hoisting
9393 @opindex fcode-hoisting
9394 Perform code hoisting. Code hoisting tries to move the
9395 evaluation of expressions executed on all paths to the function exit
9396 as early as possible. This is especially useful as a code size
9397 optimization, but it often helps for code speed as well.
9398 This flag is enabled by default at @option{-O2} and higher.
9399
9400 @item -ftree-pre
9401 @opindex ftree-pre
9402 Perform partial redundancy elimination (PRE) on trees. This flag is
9403 enabled by default at @option{-O2} and @option{-O3}.
9404
9405 @item -ftree-partial-pre
9406 @opindex ftree-partial-pre
9407 Make partial redundancy elimination (PRE) more aggressive. This flag is
9408 enabled by default at @option{-O3}.
9409
9410 @item -ftree-forwprop
9411 @opindex ftree-forwprop
9412 Perform forward propagation on trees. This flag is enabled by default
9413 at @option{-O} and higher.
9414
9415 @item -ftree-fre
9416 @opindex ftree-fre
9417 Perform full redundancy elimination (FRE) on trees. The difference
9418 between FRE and PRE is that FRE only considers expressions
9419 that are computed on all paths leading to the redundant computation.
9420 This analysis is faster than PRE, though it exposes fewer redundancies.
9421 This flag is enabled by default at @option{-O} and higher.
9422
9423 @item -ftree-phiprop
9424 @opindex ftree-phiprop
9425 Perform hoisting of loads from conditional pointers on trees. This
9426 pass is enabled by default at @option{-O} and higher.
9427
9428 @item -fhoist-adjacent-loads
9429 @opindex fhoist-adjacent-loads
9430 Speculatively hoist loads from both branches of an if-then-else if the
9431 loads are from adjacent locations in the same structure and the target
9432 architecture has a conditional move instruction. This flag is enabled
9433 by default at @option{-O2} and higher.
9434
9435 @item -ftree-copy-prop
9436 @opindex ftree-copy-prop
9437 Perform copy propagation on trees. This pass eliminates unnecessary
9438 copy operations. This flag is enabled by default at @option{-O} and
9439 higher.
9440
9441 @item -fipa-pure-const
9442 @opindex fipa-pure-const
9443 Discover which functions are pure or constant.
9444 Enabled by default at @option{-O} and higher.
9445
9446 @item -fipa-reference
9447 @opindex fipa-reference
9448 Discover which static variables do not escape the
9449 compilation unit.
9450 Enabled by default at @option{-O} and higher.
9451
9452 @item -fipa-reference-addressable
9453 @opindex fipa-reference-addressable
9454 Discover read-only, write-only and non-addressable static variables.
9455 Enabled by default at @option{-O} and higher.
9456
9457 @item -fipa-stack-alignment
9458 @opindex fipa-stack-alignment
9459 Reduce stack alignment on call sites if possible.
9460 Enabled by default.
9461
9462 @item -fipa-pta
9463 @opindex fipa-pta
9464 Perform interprocedural pointer analysis and interprocedural modification
9465 and reference analysis. This option can cause excessive memory and
9466 compile-time usage on large compilation units. It is not enabled by
9467 default at any optimization level.
9468
9469 @item -fipa-profile
9470 @opindex fipa-profile
9471 Perform interprocedural profile propagation. The functions called only from
9472 cold functions are marked as cold. Also functions executed once (such as
9473 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9474 functions and loop less parts of functions executed once are then optimized for
9475 size.
9476 Enabled by default at @option{-O} and higher.
9477
9478 @item -fipa-cp
9479 @opindex fipa-cp
9480 Perform interprocedural constant propagation.
9481 This optimization analyzes the program to determine when values passed
9482 to functions are constants and then optimizes accordingly.
9483 This optimization can substantially increase performance
9484 if the application has constants passed to functions.
9485 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9486 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9487
9488 @item -fipa-cp-clone
9489 @opindex fipa-cp-clone
9490 Perform function cloning to make interprocedural constant propagation stronger.
9491 When enabled, interprocedural constant propagation performs function cloning
9492 when externally visible function can be called with constant arguments.
9493 Because this optimization can create multiple copies of functions,
9494 it may significantly increase code size
9495 (see @option{--param ipcp-unit-growth=@var{value}}).
9496 This flag is enabled by default at @option{-O3}.
9497 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9498
9499 @item -fipa-bit-cp
9500 @opindex fipa-bit-cp
9501 When enabled, perform interprocedural bitwise constant
9502 propagation. This flag is enabled by default at @option{-O2} and
9503 by @option{-fprofile-use} and @option{-fauto-profile}.
9504 It requires that @option{-fipa-cp} is enabled.
9505
9506 @item -fipa-vrp
9507 @opindex fipa-vrp
9508 When enabled, perform interprocedural propagation of value
9509 ranges. This flag is enabled by default at @option{-O2}. It requires
9510 that @option{-fipa-cp} is enabled.
9511
9512 @item -fipa-icf
9513 @opindex fipa-icf
9514 Perform Identical Code Folding for functions and read-only variables.
9515 The optimization reduces code size and may disturb unwind stacks by replacing
9516 a function by equivalent one with a different name. The optimization works
9517 more effectively with link-time optimization enabled.
9518
9519 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9520 works on different levels and thus the optimizations are not same - there are
9521 equivalences that are found only by GCC and equivalences found only by Gold.
9522
9523 This flag is enabled by default at @option{-O2} and @option{-Os}.
9524
9525 @item -flive-patching=@var{level}
9526 @opindex flive-patching
9527 Control GCC's optimizations to produce output suitable for live-patching.
9528
9529 If the compiler's optimization uses a function's body or information extracted
9530 from its body to optimize/change another function, the latter is called an
9531 impacted function of the former. If a function is patched, its impacted
9532 functions should be patched too.
9533
9534 The impacted functions are determined by the compiler's interprocedural
9535 optimizations. For example, a caller is impacted when inlining a function
9536 into its caller,
9537 cloning a function and changing its caller to call this new clone,
9538 or extracting a function's pureness/constness information to optimize
9539 its direct or indirect callers, etc.
9540
9541 Usually, the more IPA optimizations enabled, the larger the number of
9542 impacted functions for each function. In order to control the number of
9543 impacted functions and more easily compute the list of impacted function,
9544 IPA optimizations can be partially enabled at two different levels.
9545
9546 The @var{level} argument should be one of the following:
9547
9548 @table @samp
9549
9550 @item inline-clone
9551
9552 Only enable inlining and cloning optimizations, which includes inlining,
9553 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9554 As a result, when patching a function, all its callers and its clones'
9555 callers are impacted, therefore need to be patched as well.
9556
9557 @option{-flive-patching=inline-clone} disables the following optimization flags:
9558 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9559 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9560 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9561 -fipa-stack-alignment}
9562
9563 @item inline-only-static
9564
9565 Only enable inlining of static functions.
9566 As a result, when patching a static function, all its callers are impacted
9567 and so need to be patched as well.
9568
9569 In addition to all the flags that @option{-flive-patching=inline-clone}
9570 disables,
9571 @option{-flive-patching=inline-only-static} disables the following additional
9572 optimization flags:
9573 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9574
9575 @end table
9576
9577 When @option{-flive-patching} is specified without any value, the default value
9578 is @var{inline-clone}.
9579
9580 This flag is disabled by default.
9581
9582 Note that @option{-flive-patching} is not supported with link-time optimization
9583 (@option{-flto}).
9584
9585 @item -fisolate-erroneous-paths-dereference
9586 @opindex fisolate-erroneous-paths-dereference
9587 Detect paths that trigger erroneous or undefined behavior due to
9588 dereferencing a null pointer. Isolate those paths from the main control
9589 flow and turn the statement with erroneous or undefined behavior into a trap.
9590 This flag is enabled by default at @option{-O2} and higher and depends on
9591 @option{-fdelete-null-pointer-checks} also being enabled.
9592
9593 @item -fisolate-erroneous-paths-attribute
9594 @opindex fisolate-erroneous-paths-attribute
9595 Detect paths that trigger erroneous or undefined behavior due to a null value
9596 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9597 attribute. Isolate those paths from the main control flow and turn the
9598 statement with erroneous or undefined behavior into a trap. This is not
9599 currently enabled, but may be enabled by @option{-O2} in the future.
9600
9601 @item -ftree-sink
9602 @opindex ftree-sink
9603 Perform forward store motion on trees. This flag is
9604 enabled by default at @option{-O} and higher.
9605
9606 @item -ftree-bit-ccp
9607 @opindex ftree-bit-ccp
9608 Perform sparse conditional bit constant propagation on trees and propagate
9609 pointer alignment information.
9610 This pass only operates on local scalar variables and is enabled by default
9611 at @option{-O1} and higher, except for @option{-Og}.
9612 It requires that @option{-ftree-ccp} is enabled.
9613
9614 @item -ftree-ccp
9615 @opindex ftree-ccp
9616 Perform sparse conditional constant propagation (CCP) on trees. This
9617 pass only operates on local scalar variables and is enabled by default
9618 at @option{-O} and higher.
9619
9620 @item -fssa-backprop
9621 @opindex fssa-backprop
9622 Propagate information about uses of a value up the definition chain
9623 in order to simplify the definitions. For example, this pass strips
9624 sign operations if the sign of a value never matters. The flag is
9625 enabled by default at @option{-O} and higher.
9626
9627 @item -fssa-phiopt
9628 @opindex fssa-phiopt
9629 Perform pattern matching on SSA PHI nodes to optimize conditional
9630 code. This pass is enabled by default at @option{-O1} and higher,
9631 except for @option{-Og}.
9632
9633 @item -ftree-switch-conversion
9634 @opindex ftree-switch-conversion
9635 Perform conversion of simple initializations in a switch to
9636 initializations from a scalar array. This flag is enabled by default
9637 at @option{-O2} and higher.
9638
9639 @item -ftree-tail-merge
9640 @opindex ftree-tail-merge
9641 Look for identical code sequences. When found, replace one with a jump to the
9642 other. This optimization is known as tail merging or cross jumping. This flag
9643 is enabled by default at @option{-O2} and higher. The compilation time
9644 in this pass can
9645 be limited using @option{max-tail-merge-comparisons} parameter and
9646 @option{max-tail-merge-iterations} parameter.
9647
9648 @item -ftree-dce
9649 @opindex ftree-dce
9650 Perform dead code elimination (DCE) on trees. This flag is enabled by
9651 default at @option{-O} and higher.
9652
9653 @item -ftree-builtin-call-dce
9654 @opindex ftree-builtin-call-dce
9655 Perform conditional dead code elimination (DCE) for calls to built-in functions
9656 that may set @code{errno} but are otherwise free of side effects. This flag is
9657 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9658 specified.
9659
9660 @item -ffinite-loops
9661 @opindex ffinite-loops
9662 @opindex fno-finite-loops
9663 Assume that a loop with an exit will eventually take the exit and not loop
9664 indefinitely. This allows the compiler to remove loops that otherwise have
9665 no side-effects, not considering eventual endless looping as such.
9666
9667 This option is enabled by default at @option{-O2}.
9668
9669 @item -ftree-dominator-opts
9670 @opindex ftree-dominator-opts
9671 Perform a variety of simple scalar cleanups (constant/copy
9672 propagation, redundancy elimination, range propagation and expression
9673 simplification) based on a dominator tree traversal. This also
9674 performs jump threading (to reduce jumps to jumps). This flag is
9675 enabled by default at @option{-O} and higher.
9676
9677 @item -ftree-dse
9678 @opindex ftree-dse
9679 Perform dead store elimination (DSE) on trees. A dead store is a store into
9680 a memory location that is later overwritten by another store without
9681 any intervening loads. In this case the earlier store can be deleted. This
9682 flag is enabled by default at @option{-O} and higher.
9683
9684 @item -ftree-ch
9685 @opindex ftree-ch
9686 Perform loop header copying on trees. This is beneficial since it increases
9687 effectiveness of code motion optimizations. It also saves one jump. This flag
9688 is enabled by default at @option{-O} and higher. It is not enabled
9689 for @option{-Os}, since it usually increases code size.
9690
9691 @item -ftree-loop-optimize
9692 @opindex ftree-loop-optimize
9693 Perform loop optimizations on trees. This flag is enabled by default
9694 at @option{-O} and higher.
9695
9696 @item -ftree-loop-linear
9697 @itemx -floop-strip-mine
9698 @itemx -floop-block
9699 @opindex ftree-loop-linear
9700 @opindex floop-strip-mine
9701 @opindex floop-block
9702 Perform loop nest optimizations. Same as
9703 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9704 to be configured with @option{--with-isl} to enable the Graphite loop
9705 transformation infrastructure.
9706
9707 @item -fgraphite-identity
9708 @opindex fgraphite-identity
9709 Enable the identity transformation for graphite. For every SCoP we generate
9710 the polyhedral representation and transform it back to gimple. Using
9711 @option{-fgraphite-identity} we can check the costs or benefits of the
9712 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9713 are also performed by the code generator isl, like index splitting and
9714 dead code elimination in loops.
9715
9716 @item -floop-nest-optimize
9717 @opindex floop-nest-optimize
9718 Enable the isl based loop nest optimizer. This is a generic loop nest
9719 optimizer based on the Pluto optimization algorithms. It calculates a loop
9720 structure optimized for data-locality and parallelism. This option
9721 is experimental.
9722
9723 @item -floop-parallelize-all
9724 @opindex floop-parallelize-all
9725 Use the Graphite data dependence analysis to identify loops that can
9726 be parallelized. Parallelize all the loops that can be analyzed to
9727 not contain loop carried dependences without checking that it is
9728 profitable to parallelize the loops.
9729
9730 @item -ftree-coalesce-vars
9731 @opindex ftree-coalesce-vars
9732 While transforming the program out of the SSA representation, attempt to
9733 reduce copying by coalescing versions of different user-defined
9734 variables, instead of just compiler temporaries. This may severely
9735 limit the ability to debug an optimized program compiled with
9736 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9737 prevents SSA coalescing of user variables. This option is enabled by
9738 default if optimization is enabled, and it does very little otherwise.
9739
9740 @item -ftree-loop-if-convert
9741 @opindex ftree-loop-if-convert
9742 Attempt to transform conditional jumps in the innermost loops to
9743 branch-less equivalents. The intent is to remove control-flow from
9744 the innermost loops in order to improve the ability of the
9745 vectorization pass to handle these loops. This is enabled by default
9746 if vectorization is enabled.
9747
9748 @item -ftree-loop-distribution
9749 @opindex ftree-loop-distribution
9750 Perform loop distribution. This flag can improve cache performance on
9751 big loop bodies and allow further loop optimizations, like
9752 parallelization or vectorization, to take place. For example, the loop
9753 @smallexample
9754 DO I = 1, N
9755 A(I) = B(I) + C
9756 D(I) = E(I) * F
9757 ENDDO
9758 @end smallexample
9759 is transformed to
9760 @smallexample
9761 DO I = 1, N
9762 A(I) = B(I) + C
9763 ENDDO
9764 DO I = 1, N
9765 D(I) = E(I) * F
9766 ENDDO
9767 @end smallexample
9768 This flag is enabled by default at @option{-O3}.
9769 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9770
9771 @item -ftree-loop-distribute-patterns
9772 @opindex ftree-loop-distribute-patterns
9773 Perform loop distribution of patterns that can be code generated with
9774 calls to a library. This flag is enabled by default at @option{-O3}, and
9775 by @option{-fprofile-use} and @option{-fauto-profile}.
9776
9777 This pass distributes the initialization loops and generates a call to
9778 memset zero. For example, the loop
9779 @smallexample
9780 DO I = 1, N
9781 A(I) = 0
9782 B(I) = A(I) + I
9783 ENDDO
9784 @end smallexample
9785 is transformed to
9786 @smallexample
9787 DO I = 1, N
9788 A(I) = 0
9789 ENDDO
9790 DO I = 1, N
9791 B(I) = A(I) + I
9792 ENDDO
9793 @end smallexample
9794 and the initialization loop is transformed into a call to memset zero.
9795 This flag is enabled by default at @option{-O3}.
9796 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9797
9798 @item -floop-interchange
9799 @opindex floop-interchange
9800 Perform loop interchange outside of graphite. This flag can improve cache
9801 performance on loop nest and allow further loop optimizations, like
9802 vectorization, to take place. For example, the loop
9803 @smallexample
9804 for (int i = 0; i < N; i++)
9805 for (int j = 0; j < N; j++)
9806 for (int k = 0; k < N; k++)
9807 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9808 @end smallexample
9809 is transformed to
9810 @smallexample
9811 for (int i = 0; i < N; i++)
9812 for (int k = 0; k < N; k++)
9813 for (int j = 0; j < N; j++)
9814 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9815 @end smallexample
9816 This flag is enabled by default at @option{-O3}.
9817 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9818
9819 @item -floop-unroll-and-jam
9820 @opindex floop-unroll-and-jam
9821 Apply unroll and jam transformations on feasible loops. In a loop
9822 nest this unrolls the outer loop by some factor and fuses the resulting
9823 multiple inner loops. This flag is enabled by default at @option{-O3}.
9824 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9825
9826 @item -ftree-loop-im
9827 @opindex ftree-loop-im
9828 Perform loop invariant motion on trees. This pass moves only invariants that
9829 are hard to handle at RTL level (function calls, operations that expand to
9830 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9831 operands of conditions that are invariant out of the loop, so that we can use
9832 just trivial invariantness analysis in loop unswitching. The pass also includes
9833 store motion.
9834
9835 @item -ftree-loop-ivcanon
9836 @opindex ftree-loop-ivcanon
9837 Create a canonical counter for number of iterations in loops for which
9838 determining number of iterations requires complicated analysis. Later
9839 optimizations then may determine the number easily. Useful especially
9840 in connection with unrolling.
9841
9842 @item -ftree-scev-cprop
9843 @opindex ftree-scev-cprop
9844 Perform final value replacement. If a variable is modified in a loop
9845 in such a way that its value when exiting the loop can be determined using
9846 only its initial value and the number of loop iterations, replace uses of
9847 the final value by such a computation, provided it is sufficiently cheap.
9848 This reduces data dependencies and may allow further simplifications.
9849 Enabled by default at @option{-O} and higher.
9850
9851 @item -fivopts
9852 @opindex fivopts
9853 Perform induction variable optimizations (strength reduction, induction
9854 variable merging and induction variable elimination) on trees.
9855
9856 @item -ftree-parallelize-loops=n
9857 @opindex ftree-parallelize-loops
9858 Parallelize loops, i.e., split their iteration space to run in n threads.
9859 This is only possible for loops whose iterations are independent
9860 and can be arbitrarily reordered. The optimization is only
9861 profitable on multiprocessor machines, for loops that are CPU-intensive,
9862 rather than constrained e.g.@: by memory bandwidth. This option
9863 implies @option{-pthread}, and thus is only supported on targets
9864 that have support for @option{-pthread}.
9865
9866 @item -ftree-pta
9867 @opindex ftree-pta
9868 Perform function-local points-to analysis on trees. This flag is
9869 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9870
9871 @item -ftree-sra
9872 @opindex ftree-sra
9873 Perform scalar replacement of aggregates. This pass replaces structure
9874 references with scalars to prevent committing structures to memory too
9875 early. This flag is enabled by default at @option{-O1} and higher,
9876 except for @option{-Og}.
9877
9878 @item -fstore-merging
9879 @opindex fstore-merging
9880 Perform merging of narrow stores to consecutive memory addresses. This pass
9881 merges contiguous stores of immediate values narrower than a word into fewer
9882 wider stores to reduce the number of instructions. This is enabled by default
9883 at @option{-O2} and higher as well as @option{-Os}.
9884
9885 @item -ftree-ter
9886 @opindex ftree-ter
9887 Perform temporary expression replacement during the SSA->normal phase. Single
9888 use/single def temporaries are replaced at their use location with their
9889 defining expression. This results in non-GIMPLE code, but gives the expanders
9890 much more complex trees to work on resulting in better RTL generation. This is
9891 enabled by default at @option{-O} and higher.
9892
9893 @item -ftree-slsr
9894 @opindex ftree-slsr
9895 Perform straight-line strength reduction on trees. This recognizes related
9896 expressions involving multiplications and replaces them by less expensive
9897 calculations when possible. This is enabled by default at @option{-O} and
9898 higher.
9899
9900 @item -ftree-vectorize
9901 @opindex ftree-vectorize
9902 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9903 and @option{-ftree-slp-vectorize} if not explicitly specified.
9904
9905 @item -ftree-loop-vectorize
9906 @opindex ftree-loop-vectorize
9907 Perform loop vectorization on trees. This flag is enabled by default at
9908 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9909 and @option{-fauto-profile}.
9910
9911 @item -ftree-slp-vectorize
9912 @opindex ftree-slp-vectorize
9913 Perform basic block vectorization on trees. This flag is enabled by default at
9914 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9915 and @option{-fauto-profile}.
9916
9917 @item -fvect-cost-model=@var{model}
9918 @opindex fvect-cost-model
9919 Alter the cost model used for vectorization. The @var{model} argument
9920 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9921 With the @samp{unlimited} model the vectorized code-path is assumed
9922 to be profitable while with the @samp{dynamic} model a runtime check
9923 guards the vectorized code-path to enable it only for iteration
9924 counts that will likely execute faster than when executing the original
9925 scalar loop. The @samp{cheap} model disables vectorization of
9926 loops where doing so would be cost prohibitive for example due to
9927 required runtime checks for data dependence or alignment but otherwise
9928 is equal to the @samp{dynamic} model.
9929 The default cost model depends on other optimization flags and is
9930 either @samp{dynamic} or @samp{cheap}.
9931
9932 @item -fsimd-cost-model=@var{model}
9933 @opindex fsimd-cost-model
9934 Alter the cost model used for vectorization of loops marked with the OpenMP
9935 simd directive. The @var{model} argument should be one of
9936 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9937 have the same meaning as described in @option{-fvect-cost-model} and by
9938 default a cost model defined with @option{-fvect-cost-model} is used.
9939
9940 @item -ftree-vrp
9941 @opindex ftree-vrp
9942 Perform Value Range Propagation on trees. This is similar to the
9943 constant propagation pass, but instead of values, ranges of values are
9944 propagated. This allows the optimizers to remove unnecessary range
9945 checks like array bound checks and null pointer checks. This is
9946 enabled by default at @option{-O2} and higher. Null pointer check
9947 elimination is only done if @option{-fdelete-null-pointer-checks} is
9948 enabled.
9949
9950 @item -fsplit-paths
9951 @opindex fsplit-paths
9952 Split paths leading to loop backedges. This can improve dead code
9953 elimination and common subexpression elimination. This is enabled by
9954 default at @option{-O3} and above.
9955
9956 @item -fsplit-ivs-in-unroller
9957 @opindex fsplit-ivs-in-unroller
9958 Enables expression of values of induction variables in later iterations
9959 of the unrolled loop using the value in the first iteration. This breaks
9960 long dependency chains, thus improving efficiency of the scheduling passes.
9961
9962 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9963 same effect. However, that is not reliable in cases where the loop body
9964 is more complicated than a single basic block. It also does not work at all
9965 on some architectures due to restrictions in the CSE pass.
9966
9967 This optimization is enabled by default.
9968
9969 @item -fvariable-expansion-in-unroller
9970 @opindex fvariable-expansion-in-unroller
9971 With this option, the compiler creates multiple copies of some
9972 local variables when unrolling a loop, which can result in superior code.
9973
9974 This optimization is enabled by default for PowerPC targets, but disabled
9975 by default otherwise.
9976
9977 @item -fpartial-inlining
9978 @opindex fpartial-inlining
9979 Inline parts of functions. This option has any effect only
9980 when inlining itself is turned on by the @option{-finline-functions}
9981 or @option{-finline-small-functions} options.
9982
9983 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9984
9985 @item -fpredictive-commoning
9986 @opindex fpredictive-commoning
9987 Perform predictive commoning optimization, i.e., reusing computations
9988 (especially memory loads and stores) performed in previous
9989 iterations of loops.
9990
9991 This option is enabled at level @option{-O3}.
9992 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9993
9994 @item -fprefetch-loop-arrays
9995 @opindex fprefetch-loop-arrays
9996 If supported by the target machine, generate instructions to prefetch
9997 memory to improve the performance of loops that access large arrays.
9998
9999 This option may generate better or worse code; results are highly
10000 dependent on the structure of loops within the source code.
10001
10002 Disabled at level @option{-Os}.
10003
10004 @item -fno-printf-return-value
10005 @opindex fno-printf-return-value
10006 @opindex fprintf-return-value
10007 Do not substitute constants for known return value of formatted output
10008 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10009 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
10010 transformation allows GCC to optimize or even eliminate branches based
10011 on the known return value of these functions called with arguments that
10012 are either constant, or whose values are known to be in a range that
10013 makes determining the exact return value possible. For example, when
10014 @option{-fprintf-return-value} is in effect, both the branch and the
10015 body of the @code{if} statement (but not the call to @code{snprint})
10016 can be optimized away when @code{i} is a 32-bit or smaller integer
10017 because the return value is guaranteed to be at most 8.
10018
10019 @smallexample
10020 char buf[9];
10021 if (snprintf (buf, "%08x", i) >= sizeof buf)
10022 @dots{}
10023 @end smallexample
10024
10025 The @option{-fprintf-return-value} option relies on other optimizations
10026 and yields best results with @option{-O2} and above. It works in tandem
10027 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10028 options. The @option{-fprintf-return-value} option is enabled by default.
10029
10030 @item -fno-peephole
10031 @itemx -fno-peephole2
10032 @opindex fno-peephole
10033 @opindex fpeephole
10034 @opindex fno-peephole2
10035 @opindex fpeephole2
10036 Disable any machine-specific peephole optimizations. The difference
10037 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10038 are implemented in the compiler; some targets use one, some use the
10039 other, a few use both.
10040
10041 @option{-fpeephole} is enabled by default.
10042 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10043
10044 @item -fno-guess-branch-probability
10045 @opindex fno-guess-branch-probability
10046 @opindex fguess-branch-probability
10047 Do not guess branch probabilities using heuristics.
10048
10049 GCC uses heuristics to guess branch probabilities if they are
10050 not provided by profiling feedback (@option{-fprofile-arcs}). These
10051 heuristics are based on the control flow graph. If some branch probabilities
10052 are specified by @code{__builtin_expect}, then the heuristics are
10053 used to guess branch probabilities for the rest of the control flow graph,
10054 taking the @code{__builtin_expect} info into account. The interactions
10055 between the heuristics and @code{__builtin_expect} can be complex, and in
10056 some cases, it may be useful to disable the heuristics so that the effects
10057 of @code{__builtin_expect} are easier to understand.
10058
10059 It is also possible to specify expected probability of the expression
10060 with @code{__builtin_expect_with_probability} built-in function.
10061
10062 The default is @option{-fguess-branch-probability} at levels
10063 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10064
10065 @item -freorder-blocks
10066 @opindex freorder-blocks
10067 Reorder basic blocks in the compiled function in order to reduce number of
10068 taken branches and improve code locality.
10069
10070 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10071
10072 @item -freorder-blocks-algorithm=@var{algorithm}
10073 @opindex freorder-blocks-algorithm
10074 Use the specified algorithm for basic block reordering. The
10075 @var{algorithm} argument can be @samp{simple}, which does not increase
10076 code size (except sometimes due to secondary effects like alignment),
10077 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10078 put all often executed code together, minimizing the number of branches
10079 executed by making extra copies of code.
10080
10081 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10082 @samp{stc} at levels @option{-O2}, @option{-O3}.
10083
10084 @item -freorder-blocks-and-partition
10085 @opindex freorder-blocks-and-partition
10086 In addition to reordering basic blocks in the compiled function, in order
10087 to reduce number of taken branches, partitions hot and cold basic blocks
10088 into separate sections of the assembly and @file{.o} files, to improve
10089 paging and cache locality performance.
10090
10091 This optimization is automatically turned off in the presence of
10092 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10093 section attribute and on any architecture that does not support named
10094 sections. When @option{-fsplit-stack} is used this option is not
10095 enabled by default (to avoid linker errors), but may be enabled
10096 explicitly (if using a working linker).
10097
10098 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10099
10100 @item -freorder-functions
10101 @opindex freorder-functions
10102 Reorder functions in the object file in order to
10103 improve code locality. This is implemented by using special
10104 subsections @code{.text.hot} for most frequently executed functions and
10105 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10106 the linker so object file format must support named sections and linker must
10107 place them in a reasonable way.
10108
10109 This option isn't effective unless you either provide profile feedback
10110 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10111 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10112
10113 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10114
10115 @item -fstrict-aliasing
10116 @opindex fstrict-aliasing
10117 Allow the compiler to assume the strictest aliasing rules applicable to
10118 the language being compiled. For C (and C++), this activates
10119 optimizations based on the type of expressions. In particular, an
10120 object of one type is assumed never to reside at the same address as an
10121 object of a different type, unless the types are almost the same. For
10122 example, an @code{unsigned int} can alias an @code{int}, but not a
10123 @code{void*} or a @code{double}. A character type may alias any other
10124 type.
10125
10126 @anchor{Type-punning}Pay special attention to code like this:
10127 @smallexample
10128 union a_union @{
10129 int i;
10130 double d;
10131 @};
10132
10133 int f() @{
10134 union a_union t;
10135 t.d = 3.0;
10136 return t.i;
10137 @}
10138 @end smallexample
10139 The practice of reading from a different union member than the one most
10140 recently written to (called ``type-punning'') is common. Even with
10141 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10142 is accessed through the union type. So, the code above works as
10143 expected. @xref{Structures unions enumerations and bit-fields
10144 implementation}. However, this code might not:
10145 @smallexample
10146 int f() @{
10147 union a_union t;
10148 int* ip;
10149 t.d = 3.0;
10150 ip = &t.i;
10151 return *ip;
10152 @}
10153 @end smallexample
10154
10155 Similarly, access by taking the address, casting the resulting pointer
10156 and dereferencing the result has undefined behavior, even if the cast
10157 uses a union type, e.g.:
10158 @smallexample
10159 int f() @{
10160 double d = 3.0;
10161 return ((union a_union *) &d)->i;
10162 @}
10163 @end smallexample
10164
10165 The @option{-fstrict-aliasing} option is enabled at levels
10166 @option{-O2}, @option{-O3}, @option{-Os}.
10167
10168 @item -falign-functions
10169 @itemx -falign-functions=@var{n}
10170 @itemx -falign-functions=@var{n}:@var{m}
10171 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10172 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10173 @opindex falign-functions
10174 Align the start of functions to the next power-of-two greater than
10175 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10176 the first @var{m} bytes of the function can be fetched by the CPU
10177 without crossing an @var{n}-byte alignment boundary.
10178
10179 If @var{m} is not specified, it defaults to @var{n}.
10180
10181 Examples: @option{-falign-functions=32} aligns functions to the next
10182 32-byte boundary, @option{-falign-functions=24} aligns to the next
10183 32-byte boundary only if this can be done by skipping 23 bytes or less,
10184 @option{-falign-functions=32:7} aligns to the next
10185 32-byte boundary only if this can be done by skipping 6 bytes or less.
10186
10187 The second pair of @var{n2}:@var{m2} values allows you to specify
10188 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10189 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10190 otherwise aligns to the next 32-byte boundary if this can be done
10191 by skipping 2 bytes or less.
10192 If @var{m2} is not specified, it defaults to @var{n2}.
10193
10194 Some assemblers only support this flag when @var{n} is a power of two;
10195 in that case, it is rounded up.
10196
10197 @option{-fno-align-functions} and @option{-falign-functions=1} are
10198 equivalent and mean that functions are not aligned.
10199
10200 If @var{n} is not specified or is zero, use a machine-dependent default.
10201 The maximum allowed @var{n} option value is 65536.
10202
10203 Enabled at levels @option{-O2}, @option{-O3}.
10204
10205 @item -flimit-function-alignment
10206 If this option is enabled, the compiler tries to avoid unnecessarily
10207 overaligning functions. It attempts to instruct the assembler to align
10208 by the amount specified by @option{-falign-functions}, but not to
10209 skip more bytes than the size of the function.
10210
10211 @item -falign-labels
10212 @itemx -falign-labels=@var{n}
10213 @itemx -falign-labels=@var{n}:@var{m}
10214 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10215 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10216 @opindex falign-labels
10217 Align all branch targets to a power-of-two boundary.
10218
10219 Parameters of this option are analogous to the @option{-falign-functions} option.
10220 @option{-fno-align-labels} and @option{-falign-labels=1} are
10221 equivalent and mean that labels are not aligned.
10222
10223 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10224 are greater than this value, then their values are used instead.
10225
10226 If @var{n} is not specified or is zero, use a machine-dependent default
10227 which is very likely to be @samp{1}, meaning no alignment.
10228 The maximum allowed @var{n} option value is 65536.
10229
10230 Enabled at levels @option{-O2}, @option{-O3}.
10231
10232 @item -falign-loops
10233 @itemx -falign-loops=@var{n}
10234 @itemx -falign-loops=@var{n}:@var{m}
10235 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10236 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10237 @opindex falign-loops
10238 Align loops to a power-of-two boundary. If the loops are executed
10239 many times, this makes up for any execution of the dummy padding
10240 instructions.
10241
10242 Parameters of this option are analogous to the @option{-falign-functions} option.
10243 @option{-fno-align-loops} and @option{-falign-loops=1} are
10244 equivalent and mean that loops are not aligned.
10245 The maximum allowed @var{n} option value is 65536.
10246
10247 If @var{n} is not specified or is zero, use a machine-dependent default.
10248
10249 Enabled at levels @option{-O2}, @option{-O3}.
10250
10251 @item -falign-jumps
10252 @itemx -falign-jumps=@var{n}
10253 @itemx -falign-jumps=@var{n}:@var{m}
10254 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10255 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10256 @opindex falign-jumps
10257 Align branch targets to a power-of-two boundary, for branch targets
10258 where the targets can only be reached by jumping. In this case,
10259 no dummy operations need be executed.
10260
10261 Parameters of this option are analogous to the @option{-falign-functions} option.
10262 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10263 equivalent and mean that loops are not aligned.
10264
10265 If @var{n} is not specified or is zero, use a machine-dependent default.
10266 The maximum allowed @var{n} option value is 65536.
10267
10268 Enabled at levels @option{-O2}, @option{-O3}.
10269
10270 @item -fallow-store-data-races
10271 @opindex fallow-store-data-races
10272 Allow the compiler to introduce new data races on stores.
10273
10274 Enabled at level @option{-Ofast}.
10275
10276 @item -funit-at-a-time
10277 @opindex funit-at-a-time
10278 This option is left for compatibility reasons. @option{-funit-at-a-time}
10279 has no effect, while @option{-fno-unit-at-a-time} implies
10280 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10281
10282 Enabled by default.
10283
10284 @item -fno-toplevel-reorder
10285 @opindex fno-toplevel-reorder
10286 @opindex ftoplevel-reorder
10287 Do not reorder top-level functions, variables, and @code{asm}
10288 statements. Output them in the same order that they appear in the
10289 input file. When this option is used, unreferenced static variables
10290 are not removed. This option is intended to support existing code
10291 that relies on a particular ordering. For new code, it is better to
10292 use attributes when possible.
10293
10294 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10295 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10296 Additionally @option{-fno-toplevel-reorder} implies
10297 @option{-fno-section-anchors}.
10298
10299 @item -fweb
10300 @opindex fweb
10301 Constructs webs as commonly used for register allocation purposes and assign
10302 each web individual pseudo register. This allows the register allocation pass
10303 to operate on pseudos directly, but also strengthens several other optimization
10304 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10305 however, make debugging impossible, since variables no longer stay in a
10306 ``home register''.
10307
10308 Enabled by default with @option{-funroll-loops}.
10309
10310 @item -fwhole-program
10311 @opindex fwhole-program
10312 Assume that the current compilation unit represents the whole program being
10313 compiled. All public functions and variables with the exception of @code{main}
10314 and those merged by attribute @code{externally_visible} become static functions
10315 and in effect are optimized more aggressively by interprocedural optimizers.
10316
10317 This option should not be used in combination with @option{-flto}.
10318 Instead relying on a linker plugin should provide safer and more precise
10319 information.
10320
10321 @item -flto[=@var{n}]
10322 @opindex flto
10323 This option runs the standard link-time optimizer. When invoked
10324 with source code, it generates GIMPLE (one of GCC's internal
10325 representations) and writes it to special ELF sections in the object
10326 file. When the object files are linked together, all the function
10327 bodies are read from these ELF sections and instantiated as if they
10328 had been part of the same translation unit.
10329
10330 To use the link-time optimizer, @option{-flto} and optimization
10331 options should be specified at compile time and during the final link.
10332 It is recommended that you compile all the files participating in the
10333 same link with the same options and also specify those options at
10334 link time.
10335 For example:
10336
10337 @smallexample
10338 gcc -c -O2 -flto foo.c
10339 gcc -c -O2 -flto bar.c
10340 gcc -o myprog -flto -O2 foo.o bar.o
10341 @end smallexample
10342
10343 The first two invocations to GCC save a bytecode representation
10344 of GIMPLE into special ELF sections inside @file{foo.o} and
10345 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10346 @file{foo.o} and @file{bar.o}, merges the two files into a single
10347 internal image, and compiles the result as usual. Since both
10348 @file{foo.o} and @file{bar.o} are merged into a single image, this
10349 causes all the interprocedural analyses and optimizations in GCC to
10350 work across the two files as if they were a single one. This means,
10351 for example, that the inliner is able to inline functions in
10352 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10353
10354 Another (simpler) way to enable link-time optimization is:
10355
10356 @smallexample
10357 gcc -o myprog -flto -O2 foo.c bar.c
10358 @end smallexample
10359
10360 The above generates bytecode for @file{foo.c} and @file{bar.c},
10361 merges them together into a single GIMPLE representation and optimizes
10362 them as usual to produce @file{myprog}.
10363
10364 The important thing to keep in mind is that to enable link-time
10365 optimizations you need to use the GCC driver to perform the link step.
10366 GCC automatically performs link-time optimization if any of the
10367 objects involved were compiled with the @option{-flto} command-line option.
10368 You can always override
10369 the automatic decision to do link-time optimization
10370 by passing @option{-fno-lto} to the link command.
10371
10372 To make whole program optimization effective, it is necessary to make
10373 certain whole program assumptions. The compiler needs to know
10374 what functions and variables can be accessed by libraries and runtime
10375 outside of the link-time optimized unit. When supported by the linker,
10376 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10377 to the compiler about used and externally visible symbols. When
10378 the linker plugin is not available, @option{-fwhole-program} should be
10379 used to allow the compiler to make these assumptions, which leads
10380 to more aggressive optimization decisions.
10381
10382 When a file is compiled with @option{-flto} without
10383 @option{-fuse-linker-plugin}, the generated object file is larger than
10384 a regular object file because it contains GIMPLE bytecodes and the usual
10385 final code (see @option{-ffat-lto-objects}. This means that
10386 object files with LTO information can be linked as normal object
10387 files; if @option{-fno-lto} is passed to the linker, no
10388 interprocedural optimizations are applied. Note that when
10389 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10390 but you cannot perform a regular, non-LTO link on them.
10391
10392 When producing the final binary, GCC only
10393 applies link-time optimizations to those files that contain bytecode.
10394 Therefore, you can mix and match object files and libraries with
10395 GIMPLE bytecodes and final object code. GCC automatically selects
10396 which files to optimize in LTO mode and which files to link without
10397 further processing.
10398
10399 Generally, options specified at link time override those
10400 specified at compile time, although in some cases GCC attempts to infer
10401 link-time options from the settings used to compile the input files.
10402
10403 If you do not specify an optimization level option @option{-O} at
10404 link time, then GCC uses the highest optimization level
10405 used when compiling the object files. Note that it is generally
10406 ineffective to specify an optimization level option only at link time and
10407 not at compile time, for two reasons. First, compiling without
10408 optimization suppresses compiler passes that gather information
10409 needed for effective optimization at link time. Second, some early
10410 optimization passes can be performed only at compile time and
10411 not at link time.
10412
10413 There are some code generation flags preserved by GCC when
10414 generating bytecodes, as they need to be used during the final link.
10415 Currently, the following options and their settings are taken from
10416 the first object file that explicitly specifies them:
10417 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10418 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10419 and all the @option{-m} target flags.
10420
10421 Certain ABI-changing flags are required to match in all compilation units,
10422 and trying to override this at link time with a conflicting value
10423 is ignored. This includes options such as @option{-freg-struct-return}
10424 and @option{-fpcc-struct-return}.
10425
10426 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10427 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10428 are passed through to the link stage and merged conservatively for
10429 conflicting translation units. Specifically
10430 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10431 precedence; and for example @option{-ffp-contract=off} takes precedence
10432 over @option{-ffp-contract=fast}. You can override them at link time.
10433
10434 To enable debug info generation you need to supply @option{-g} at
10435 compile-time. If any of the input files at link time were built
10436 with debug info generation enabled the link will enable debug info
10437 generation as well. Any elaborate debug info settings
10438 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
10439 at the linker command line and mixing different settings in different
10440 translation units is discouraged.
10441
10442 If LTO encounters objects with C linkage declared with incompatible
10443 types in separate translation units to be linked together (undefined
10444 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10445 issued. The behavior is still undefined at run time. Similar
10446 diagnostics may be raised for other languages.
10447
10448 Another feature of LTO is that it is possible to apply interprocedural
10449 optimizations on files written in different languages:
10450
10451 @smallexample
10452 gcc -c -flto foo.c
10453 g++ -c -flto bar.cc
10454 gfortran -c -flto baz.f90
10455 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10456 @end smallexample
10457
10458 Notice that the final link is done with @command{g++} to get the C++
10459 runtime libraries and @option{-lgfortran} is added to get the Fortran
10460 runtime libraries. In general, when mixing languages in LTO mode, you
10461 should use the same link command options as when mixing languages in a
10462 regular (non-LTO) compilation.
10463
10464 If object files containing GIMPLE bytecode are stored in a library archive, say
10465 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10466 are using a linker with plugin support. To create static libraries suitable
10467 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10468 and @command{ranlib};
10469 to show the symbols of object files with GIMPLE bytecode, use
10470 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10471 and @command{nm} have been compiled with plugin support. At link time, use the
10472 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10473 the LTO optimization process:
10474
10475 @smallexample
10476 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10477 @end smallexample
10478
10479 With the linker plugin enabled, the linker extracts the needed
10480 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10481 to make them part of the aggregated GIMPLE image to be optimized.
10482
10483 If you are not using a linker with plugin support and/or do not
10484 enable the linker plugin, then the objects inside @file{libfoo.a}
10485 are extracted and linked as usual, but they do not participate
10486 in the LTO optimization process. In order to make a static library suitable
10487 for both LTO optimization and usual linkage, compile its object files with
10488 @option{-flto} @option{-ffat-lto-objects}.
10489
10490 Link-time optimizations do not require the presence of the whole program to
10491 operate. If the program does not require any symbols to be exported, it is
10492 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10493 the interprocedural optimizers to use more aggressive assumptions which may
10494 lead to improved optimization opportunities.
10495 Use of @option{-fwhole-program} is not needed when linker plugin is
10496 active (see @option{-fuse-linker-plugin}).
10497
10498 The current implementation of LTO makes no
10499 attempt to generate bytecode that is portable between different
10500 types of hosts. The bytecode files are versioned and there is a
10501 strict version check, so bytecode files generated in one version of
10502 GCC do not work with an older or newer version of GCC.
10503
10504 Link-time optimization does not work well with generation of debugging
10505 information on systems other than those using a combination of ELF and
10506 DWARF.
10507
10508 If you specify the optional @var{n}, the optimization and code
10509 generation done at link time is executed in parallel using @var{n}
10510 parallel jobs by utilizing an installed @command{make} program. The
10511 environment variable @env{MAKE} may be used to override the program
10512 used.
10513
10514 You can also specify @option{-flto=jobserver} to use GNU make's
10515 job server mode to determine the number of parallel jobs. This
10516 is useful when the Makefile calling GCC is already executing in parallel.
10517 You must prepend a @samp{+} to the command recipe in the parent Makefile
10518 for this to work. This option likely only works if @env{MAKE} is
10519 GNU make. Even without the option value, GCC tries to automatically
10520 detect a running GNU make's job server.
10521
10522 Use @option{-flto=auto} to use GNU make's job server, if available,
10523 or otherwise fall back to autodetection of the number of CPU threads
10524 present in your system.
10525
10526 @item -flto-partition=@var{alg}
10527 @opindex flto-partition
10528 Specify the partitioning algorithm used by the link-time optimizer.
10529 The value is either @samp{1to1} to specify a partitioning mirroring
10530 the original source files or @samp{balanced} to specify partitioning
10531 into equally sized chunks (whenever possible) or @samp{max} to create
10532 new partition for every symbol where possible. Specifying @samp{none}
10533 as an algorithm disables partitioning and streaming completely.
10534 The default value is @samp{balanced}. While @samp{1to1} can be used
10535 as an workaround for various code ordering issues, the @samp{max}
10536 partitioning is intended for internal testing only.
10537 The value @samp{one} specifies that exactly one partition should be
10538 used while the value @samp{none} bypasses partitioning and executes
10539 the link-time optimization step directly from the WPA phase.
10540
10541 @item -flto-compression-level=@var{n}
10542 @opindex flto-compression-level
10543 This option specifies the level of compression used for intermediate
10544 language written to LTO object files, and is only meaningful in
10545 conjunction with LTO mode (@option{-flto}). Valid
10546 values are 0 (no compression) to 9 (maximum compression). Values
10547 outside this range are clamped to either 0 or 9. If the option is not
10548 given, a default balanced compression setting is used.
10549
10550 @item -fuse-linker-plugin
10551 @opindex fuse-linker-plugin
10552 Enables the use of a linker plugin during link-time optimization. This
10553 option relies on plugin support in the linker, which is available in gold
10554 or in GNU ld 2.21 or newer.
10555
10556 This option enables the extraction of object files with GIMPLE bytecode out
10557 of library archives. This improves the quality of optimization by exposing
10558 more code to the link-time optimizer. This information specifies what
10559 symbols can be accessed externally (by non-LTO object or during dynamic
10560 linking). Resulting code quality improvements on binaries (and shared
10561 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10562 See @option{-flto} for a description of the effect of this flag and how to
10563 use it.
10564
10565 This option is enabled by default when LTO support in GCC is enabled
10566 and GCC was configured for use with
10567 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10568
10569 @item -ffat-lto-objects
10570 @opindex ffat-lto-objects
10571 Fat LTO objects are object files that contain both the intermediate language
10572 and the object code. This makes them usable for both LTO linking and normal
10573 linking. This option is effective only when compiling with @option{-flto}
10574 and is ignored at link time.
10575
10576 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10577 requires the complete toolchain to be aware of LTO. It requires a linker with
10578 linker plugin support for basic functionality. Additionally,
10579 @command{nm}, @command{ar} and @command{ranlib}
10580 need to support linker plugins to allow a full-featured build environment
10581 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10582 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10583 to these tools. With non fat LTO makefiles need to be modified to use them.
10584
10585 Note that modern binutils provide plugin auto-load mechanism.
10586 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10587 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10588 @command{gcc-ranlib}).
10589
10590 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10591 support.
10592
10593 @item -fcompare-elim
10594 @opindex fcompare-elim
10595 After register allocation and post-register allocation instruction splitting,
10596 identify arithmetic instructions that compute processor flags similar to a
10597 comparison operation based on that arithmetic. If possible, eliminate the
10598 explicit comparison operation.
10599
10600 This pass only applies to certain targets that cannot explicitly represent
10601 the comparison operation before register allocation is complete.
10602
10603 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10604
10605 @item -fcprop-registers
10606 @opindex fcprop-registers
10607 After register allocation and post-register allocation instruction splitting,
10608 perform a copy-propagation pass to try to reduce scheduling dependencies
10609 and occasionally eliminate the copy.
10610
10611 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10612
10613 @item -fprofile-correction
10614 @opindex fprofile-correction
10615 Profiles collected using an instrumented binary for multi-threaded programs may
10616 be inconsistent due to missed counter updates. When this option is specified,
10617 GCC uses heuristics to correct or smooth out such inconsistencies. By
10618 default, GCC emits an error message when an inconsistent profile is detected.
10619
10620 This option is enabled by @option{-fauto-profile}.
10621
10622 @item -fprofile-use
10623 @itemx -fprofile-use=@var{path}
10624 @opindex fprofile-use
10625 Enable profile feedback-directed optimizations,
10626 and the following optimizations, many of which
10627 are generally profitable only with profile feedback available:
10628
10629 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10630 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10631 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10632 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10633 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10634 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10635 -fprofile-reorder-functions}
10636
10637 Before you can use this option, you must first generate profiling information.
10638 @xref{Instrumentation Options}, for information about the
10639 @option{-fprofile-generate} option.
10640
10641 By default, GCC emits an error message if the feedback profiles do not
10642 match the source code. This error can be turned into a warning by using
10643 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10644 optimized code. Additionally, by default, GCC also emits a warning message if
10645 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10646
10647 If @var{path} is specified, GCC looks at the @var{path} to find
10648 the profile feedback data files. See @option{-fprofile-dir}.
10649
10650 @item -fauto-profile
10651 @itemx -fauto-profile=@var{path}
10652 @opindex fauto-profile
10653 Enable sampling-based feedback-directed optimizations,
10654 and the following optimizations,
10655 many of which are generally profitable only with profile feedback available:
10656
10657 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10658 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10659 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10660 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10661 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10662 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10663 -fprofile-correction}
10664
10665 @var{path} is the name of a file containing AutoFDO profile information.
10666 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10667
10668 Producing an AutoFDO profile data file requires running your program
10669 with the @command{perf} utility on a supported GNU/Linux target system.
10670 For more information, see @uref{https://perf.wiki.kernel.org/}.
10671
10672 E.g.
10673 @smallexample
10674 perf record -e br_inst_retired:near_taken -b -o perf.data \
10675 -- your_program
10676 @end smallexample
10677
10678 Then use the @command{create_gcov} tool to convert the raw profile data
10679 to a format that can be used by GCC.@ You must also supply the
10680 unstripped binary for your program to this tool.
10681 See @uref{https://github.com/google/autofdo}.
10682
10683 E.g.
10684 @smallexample
10685 create_gcov --binary=your_program.unstripped --profile=perf.data \
10686 --gcov=profile.afdo
10687 @end smallexample
10688 @end table
10689
10690 The following options control compiler behavior regarding floating-point
10691 arithmetic. These options trade off between speed and
10692 correctness. All must be specifically enabled.
10693
10694 @table @gcctabopt
10695 @item -ffloat-store
10696 @opindex ffloat-store
10697 Do not store floating-point variables in registers, and inhibit other
10698 options that might change whether a floating-point value is taken from a
10699 register or memory.
10700
10701 @cindex floating-point precision
10702 This option prevents undesirable excess precision on machines such as
10703 the 68000 where the floating registers (of the 68881) keep more
10704 precision than a @code{double} is supposed to have. Similarly for the
10705 x86 architecture. For most programs, the excess precision does only
10706 good, but a few programs rely on the precise definition of IEEE floating
10707 point. Use @option{-ffloat-store} for such programs, after modifying
10708 them to store all pertinent intermediate computations into variables.
10709
10710 @item -fexcess-precision=@var{style}
10711 @opindex fexcess-precision
10712 This option allows further control over excess precision on machines
10713 where floating-point operations occur in a format with more precision or
10714 range than the IEEE standard and interchange floating-point types. By
10715 default, @option{-fexcess-precision=fast} is in effect; this means that
10716 operations may be carried out in a wider precision than the types specified
10717 in the source if that would result in faster code, and it is unpredictable
10718 when rounding to the types specified in the source code takes place.
10719 When compiling C, if @option{-fexcess-precision=standard} is specified then
10720 excess precision follows the rules specified in ISO C99; in particular,
10721 both casts and assignments cause values to be rounded to their
10722 semantic types (whereas @option{-ffloat-store} only affects
10723 assignments). This option is enabled by default for C if a strict
10724 conformance option such as @option{-std=c99} is used.
10725 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10726 regardless of whether a strict conformance option is used.
10727
10728 @opindex mfpmath
10729 @option{-fexcess-precision=standard} is not implemented for languages
10730 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10731 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10732 semantics apply without excess precision, and in the latter, rounding
10733 is unpredictable.
10734
10735 @item -ffast-math
10736 @opindex ffast-math
10737 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10738 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10739 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10740 @option{-fexcess-precision=fast}.
10741
10742 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10743
10744 This option is not turned on by any @option{-O} option besides
10745 @option{-Ofast} since it can result in incorrect output for programs
10746 that depend on an exact implementation of IEEE or ISO rules/specifications
10747 for math functions. It may, however, yield faster code for programs
10748 that do not require the guarantees of these specifications.
10749
10750 @item -fno-math-errno
10751 @opindex fno-math-errno
10752 @opindex fmath-errno
10753 Do not set @code{errno} after calling math functions that are executed
10754 with a single instruction, e.g., @code{sqrt}. A program that relies on
10755 IEEE exceptions for math error handling may want to use this flag
10756 for speed while maintaining IEEE arithmetic compatibility.
10757
10758 This option is not turned on by any @option{-O} option since
10759 it can result in incorrect output for programs that depend on
10760 an exact implementation of IEEE or ISO rules/specifications for
10761 math functions. It may, however, yield faster code for programs
10762 that do not require the guarantees of these specifications.
10763
10764 The default is @option{-fmath-errno}.
10765
10766 On Darwin systems, the math library never sets @code{errno}. There is
10767 therefore no reason for the compiler to consider the possibility that
10768 it might, and @option{-fno-math-errno} is the default.
10769
10770 @item -funsafe-math-optimizations
10771 @opindex funsafe-math-optimizations
10772
10773 Allow optimizations for floating-point arithmetic that (a) assume
10774 that arguments and results are valid and (b) may violate IEEE or
10775 ANSI standards. When used at link time, it may include libraries
10776 or startup files that change the default FPU control word or other
10777 similar optimizations.
10778
10779 This option is not turned on by any @option{-O} option since
10780 it can result in incorrect output for programs that depend on
10781 an exact implementation of IEEE or ISO rules/specifications for
10782 math functions. It may, however, yield faster code for programs
10783 that do not require the guarantees of these specifications.
10784 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10785 @option{-fassociative-math} and @option{-freciprocal-math}.
10786
10787 The default is @option{-fno-unsafe-math-optimizations}.
10788
10789 @item -fassociative-math
10790 @opindex fassociative-math
10791
10792 Allow re-association of operands in series of floating-point operations.
10793 This violates the ISO C and C++ language standard by possibly changing
10794 computation result. NOTE: re-ordering may change the sign of zero as
10795 well as ignore NaNs and inhibit or create underflow or overflow (and
10796 thus cannot be used on code that relies on rounding behavior like
10797 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10798 and thus may not be used when ordered comparisons are required.
10799 This option requires that both @option{-fno-signed-zeros} and
10800 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10801 much sense with @option{-frounding-math}. For Fortran the option
10802 is automatically enabled when both @option{-fno-signed-zeros} and
10803 @option{-fno-trapping-math} are in effect.
10804
10805 The default is @option{-fno-associative-math}.
10806
10807 @item -freciprocal-math
10808 @opindex freciprocal-math
10809
10810 Allow the reciprocal of a value to be used instead of dividing by
10811 the value if this enables optimizations. For example @code{x / y}
10812 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10813 is subject to common subexpression elimination. Note that this loses
10814 precision and increases the number of flops operating on the value.
10815
10816 The default is @option{-fno-reciprocal-math}.
10817
10818 @item -ffinite-math-only
10819 @opindex ffinite-math-only
10820 Allow optimizations for floating-point arithmetic that assume
10821 that arguments and results are not NaNs or +-Infs.
10822
10823 This option is not turned on by any @option{-O} option since
10824 it can result in incorrect output for programs that depend on
10825 an exact implementation of IEEE or ISO rules/specifications for
10826 math functions. It may, however, yield faster code for programs
10827 that do not require the guarantees of these specifications.
10828
10829 The default is @option{-fno-finite-math-only}.
10830
10831 @item -fno-signed-zeros
10832 @opindex fno-signed-zeros
10833 @opindex fsigned-zeros
10834 Allow optimizations for floating-point arithmetic that ignore the
10835 signedness of zero. IEEE arithmetic specifies the behavior of
10836 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10837 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10838 This option implies that the sign of a zero result isn't significant.
10839
10840 The default is @option{-fsigned-zeros}.
10841
10842 @item -fno-trapping-math
10843 @opindex fno-trapping-math
10844 @opindex ftrapping-math
10845 Compile code assuming that floating-point operations cannot generate
10846 user-visible traps. These traps include division by zero, overflow,
10847 underflow, inexact result and invalid operation. This option requires
10848 that @option{-fno-signaling-nans} be in effect. Setting this option may
10849 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10850
10851 This option should never be turned on by any @option{-O} option since
10852 it can result in incorrect output for programs that depend on
10853 an exact implementation of IEEE or ISO rules/specifications for
10854 math functions.
10855
10856 The default is @option{-ftrapping-math}.
10857
10858 @item -frounding-math
10859 @opindex frounding-math
10860 Disable transformations and optimizations that assume default floating-point
10861 rounding behavior. This is round-to-zero for all floating point
10862 to integer conversions, and round-to-nearest for all other arithmetic
10863 truncations. This option should be specified for programs that change
10864 the FP rounding mode dynamically, or that may be executed with a
10865 non-default rounding mode. This option disables constant folding of
10866 floating-point expressions at compile time (which may be affected by
10867 rounding mode) and arithmetic transformations that are unsafe in the
10868 presence of sign-dependent rounding modes.
10869
10870 The default is @option{-fno-rounding-math}.
10871
10872 This option is experimental and does not currently guarantee to
10873 disable all GCC optimizations that are affected by rounding mode.
10874 Future versions of GCC may provide finer control of this setting
10875 using C99's @code{FENV_ACCESS} pragma. This command-line option
10876 will be used to specify the default state for @code{FENV_ACCESS}.
10877
10878 @item -fsignaling-nans
10879 @opindex fsignaling-nans
10880 Compile code assuming that IEEE signaling NaNs may generate user-visible
10881 traps during floating-point operations. Setting this option disables
10882 optimizations that may change the number of exceptions visible with
10883 signaling NaNs. This option implies @option{-ftrapping-math}.
10884
10885 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10886 be defined.
10887
10888 The default is @option{-fno-signaling-nans}.
10889
10890 This option is experimental and does not currently guarantee to
10891 disable all GCC optimizations that affect signaling NaN behavior.
10892
10893 @item -fno-fp-int-builtin-inexact
10894 @opindex fno-fp-int-builtin-inexact
10895 @opindex ffp-int-builtin-inexact
10896 Do not allow the built-in functions @code{ceil}, @code{floor},
10897 @code{round} and @code{trunc}, and their @code{float} and @code{long
10898 double} variants, to generate code that raises the ``inexact''
10899 floating-point exception for noninteger arguments. ISO C99 and C11
10900 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10901 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
10902 ISO C2X, does not allow these functions to do so.
10903
10904 The default is @option{-ffp-int-builtin-inexact}, allowing the
10905 exception to be raised, unless C2X or a later C standard is selected.
10906 This option does nothing unless @option{-ftrapping-math} is in effect.
10907
10908 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10909 generate a call to a library function then the ``inexact'' exception
10910 may be raised if the library implementation does not follow TS 18661.
10911
10912 @item -fsingle-precision-constant
10913 @opindex fsingle-precision-constant
10914 Treat floating-point constants as single precision instead of
10915 implicitly converting them to double-precision constants.
10916
10917 @item -fcx-limited-range
10918 @opindex fcx-limited-range
10919 When enabled, this option states that a range reduction step is not
10920 needed when performing complex division. Also, there is no checking
10921 whether the result of a complex multiplication or division is @code{NaN
10922 + I*NaN}, with an attempt to rescue the situation in that case. The
10923 default is @option{-fno-cx-limited-range}, but is enabled by
10924 @option{-ffast-math}.
10925
10926 This option controls the default setting of the ISO C99
10927 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10928 all languages.
10929
10930 @item -fcx-fortran-rules
10931 @opindex fcx-fortran-rules
10932 Complex multiplication and division follow Fortran rules. Range
10933 reduction is done as part of complex division, but there is no checking
10934 whether the result of a complex multiplication or division is @code{NaN
10935 + I*NaN}, with an attempt to rescue the situation in that case.
10936
10937 The default is @option{-fno-cx-fortran-rules}.
10938
10939 @end table
10940
10941 The following options control optimizations that may improve
10942 performance, but are not enabled by any @option{-O} options. This
10943 section includes experimental options that may produce broken code.
10944
10945 @table @gcctabopt
10946 @item -fbranch-probabilities
10947 @opindex fbranch-probabilities
10948 After running a program compiled with @option{-fprofile-arcs}
10949 (@pxref{Instrumentation Options}),
10950 you can compile it a second time using
10951 @option{-fbranch-probabilities}, to improve optimizations based on
10952 the number of times each branch was taken. When a program
10953 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10954 counts to a file called @file{@var{sourcename}.gcda} for each source
10955 file. The information in this data file is very dependent on the
10956 structure of the generated code, so you must use the same source code
10957 and the same optimization options for both compilations.
10958
10959 With @option{-fbranch-probabilities}, GCC puts a
10960 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10961 These can be used to improve optimization. Currently, they are only
10962 used in one place: in @file{reorg.c}, instead of guessing which path a
10963 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10964 exactly determine which path is taken more often.
10965
10966 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10967
10968 @item -fprofile-values
10969 @opindex fprofile-values
10970 If combined with @option{-fprofile-arcs}, it adds code so that some
10971 data about values of expressions in the program is gathered.
10972
10973 With @option{-fbranch-probabilities}, it reads back the data gathered
10974 from profiling values of expressions for usage in optimizations.
10975
10976 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10977 @option{-fauto-profile}.
10978
10979 @item -fprofile-reorder-functions
10980 @opindex fprofile-reorder-functions
10981 Function reordering based on profile instrumentation collects
10982 first time of execution of a function and orders these functions
10983 in ascending order.
10984
10985 Enabled with @option{-fprofile-use}.
10986
10987 @item -fvpt
10988 @opindex fvpt
10989 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10990 to add code to gather information about values of expressions.
10991
10992 With @option{-fbranch-probabilities}, it reads back the data gathered
10993 and actually performs the optimizations based on them.
10994 Currently the optimizations include specialization of division operations
10995 using the knowledge about the value of the denominator.
10996
10997 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10998
10999 @item -frename-registers
11000 @opindex frename-registers
11001 Attempt to avoid false dependencies in scheduled code by making use
11002 of registers left over after register allocation. This optimization
11003 most benefits processors with lots of registers. Depending on the
11004 debug information format adopted by the target, however, it can
11005 make debugging impossible, since variables no longer stay in
11006 a ``home register''.
11007
11008 Enabled by default with @option{-funroll-loops}.
11009
11010 @item -fschedule-fusion
11011 @opindex fschedule-fusion
11012 Performs a target dependent pass over the instruction stream to schedule
11013 instructions of same type together because target machine can execute them
11014 more efficiently if they are adjacent to each other in the instruction flow.
11015
11016 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11017
11018 @item -ftracer
11019 @opindex ftracer
11020 Perform tail duplication to enlarge superblock size. This transformation
11021 simplifies the control flow of the function allowing other optimizations to do
11022 a better job.
11023
11024 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11025
11026 @item -funroll-loops
11027 @opindex funroll-loops
11028 Unroll loops whose number of iterations can be determined at compile time or
11029 upon entry to the loop. @option{-funroll-loops} implies
11030 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11031 It also turns on complete loop peeling (i.e.@: complete removal of loops with
11032 a small constant number of iterations). This option makes code larger, and may
11033 or may not make it run faster.
11034
11035 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11036
11037 @item -funroll-all-loops
11038 @opindex funroll-all-loops
11039 Unroll all loops, even if their number of iterations is uncertain when
11040 the loop is entered. This usually makes programs run more slowly.
11041 @option{-funroll-all-loops} implies the same options as
11042 @option{-funroll-loops}.
11043
11044 @item -fpeel-loops
11045 @opindex fpeel-loops
11046 Peels loops for which there is enough information that they do not
11047 roll much (from profile feedback or static analysis). It also turns on
11048 complete loop peeling (i.e.@: complete removal of loops with small constant
11049 number of iterations).
11050
11051 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11052
11053 @item -fmove-loop-invariants
11054 @opindex fmove-loop-invariants
11055 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
11056 at level @option{-O1} and higher, except for @option{-Og}.
11057
11058 @item -fsplit-loops
11059 @opindex fsplit-loops
11060 Split a loop into two if it contains a condition that's always true
11061 for one side of the iteration space and false for the other.
11062
11063 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11064
11065 @item -funswitch-loops
11066 @opindex funswitch-loops
11067 Move branches with loop invariant conditions out of the loop, with duplicates
11068 of the loop on both branches (modified according to result of the condition).
11069
11070 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11071
11072 @item -fversion-loops-for-strides
11073 @opindex fversion-loops-for-strides
11074 If a loop iterates over an array with a variable stride, create another
11075 version of the loop that assumes the stride is always one. For example:
11076
11077 @smallexample
11078 for (int i = 0; i < n; ++i)
11079 x[i * stride] = @dots{};
11080 @end smallexample
11081
11082 becomes:
11083
11084 @smallexample
11085 if (stride == 1)
11086 for (int i = 0; i < n; ++i)
11087 x[i] = @dots{};
11088 else
11089 for (int i = 0; i < n; ++i)
11090 x[i * stride] = @dots{};
11091 @end smallexample
11092
11093 This is particularly useful for assumed-shape arrays in Fortran where
11094 (for example) it allows better vectorization assuming contiguous accesses.
11095 This flag is enabled by default at @option{-O3}.
11096 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11097
11098 @item -ffunction-sections
11099 @itemx -fdata-sections
11100 @opindex ffunction-sections
11101 @opindex fdata-sections
11102 Place each function or data item into its own section in the output
11103 file if the target supports arbitrary sections. The name of the
11104 function or the name of the data item determines the section's name
11105 in the output file.
11106
11107 Use these options on systems where the linker can perform optimizations to
11108 improve locality of reference in the instruction space. Most systems using the
11109 ELF object format have linkers with such optimizations. On AIX, the linker
11110 rearranges sections (CSECTs) based on the call graph. The performance impact
11111 varies.
11112
11113 Together with a linker garbage collection (linker @option{--gc-sections}
11114 option) these options may lead to smaller statically-linked executables (after
11115 stripping).
11116
11117 On ELF/DWARF systems these options do not degenerate the quality of the debug
11118 information. There could be issues with other object files/debug info formats.
11119
11120 Only use these options when there are significant benefits from doing so. When
11121 you specify these options, the assembler and linker create larger object and
11122 executable files and are also slower. These options affect code generation.
11123 They prevent optimizations by the compiler and assembler using relative
11124 locations inside a translation unit since the locations are unknown until
11125 link time. An example of such an optimization is relaxing calls to short call
11126 instructions.
11127
11128 @item -fstdarg-opt
11129 @opindex fstdarg-opt
11130 Optimize the prologue of variadic argument functions with respect to usage of
11131 those arguments.
11132
11133 @item -fsection-anchors
11134 @opindex fsection-anchors
11135 Try to reduce the number of symbolic address calculations by using
11136 shared ``anchor'' symbols to address nearby objects. This transformation
11137 can help to reduce the number of GOT entries and GOT accesses on some
11138 targets.
11139
11140 For example, the implementation of the following function @code{foo}:
11141
11142 @smallexample
11143 static int a, b, c;
11144 int foo (void) @{ return a + b + c; @}
11145 @end smallexample
11146
11147 @noindent
11148 usually calculates the addresses of all three variables, but if you
11149 compile it with @option{-fsection-anchors}, it accesses the variables
11150 from a common anchor point instead. The effect is similar to the
11151 following pseudocode (which isn't valid C):
11152
11153 @smallexample
11154 int foo (void)
11155 @{
11156 register int *xr = &x;
11157 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11158 @}
11159 @end smallexample
11160
11161 Not all targets support this option.
11162
11163 @item --param @var{name}=@var{value}
11164 @opindex param
11165 In some places, GCC uses various constants to control the amount of
11166 optimization that is done. For example, GCC does not inline functions
11167 that contain more than a certain number of instructions. You can
11168 control some of these constants on the command line using the
11169 @option{--param} option.
11170
11171 The names of specific parameters, and the meaning of the values, are
11172 tied to the internals of the compiler, and are subject to change
11173 without notice in future releases.
11174
11175 In order to get minimal, maximal and default value of a parameter,
11176 one can use @option{--help=param -Q} options.
11177
11178 In each case, the @var{value} is an integer. The allowable choices for
11179 @var{name} are:
11180
11181 @table @gcctabopt
11182 @item predictable-branch-outcome
11183 When branch is predicted to be taken with probability lower than this threshold
11184 (in percent), then it is considered well predictable.
11185
11186 @item max-rtl-if-conversion-insns
11187 RTL if-conversion tries to remove conditional branches around a block and
11188 replace them with conditionally executed instructions. This parameter
11189 gives the maximum number of instructions in a block which should be
11190 considered for if-conversion. The compiler will
11191 also use other heuristics to decide whether if-conversion is likely to be
11192 profitable.
11193
11194 @item max-rtl-if-conversion-predictable-cost
11195 @itemx max-rtl-if-conversion-unpredictable-cost
11196 RTL if-conversion will try to remove conditional branches around a block
11197 and replace them with conditionally executed instructions. These parameters
11198 give the maximum permissible cost for the sequence that would be generated
11199 by if-conversion depending on whether the branch is statically determined
11200 to be predictable or not. The units for this parameter are the same as
11201 those for the GCC internal seq_cost metric. The compiler will try to
11202 provide a reasonable default for this parameter using the BRANCH_COST
11203 target macro.
11204
11205 @item max-crossjump-edges
11206 The maximum number of incoming edges to consider for cross-jumping.
11207 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11208 the number of edges incoming to each block. Increasing values mean
11209 more aggressive optimization, making the compilation time increase with
11210 probably small improvement in executable size.
11211
11212 @item min-crossjump-insns
11213 The minimum number of instructions that must be matched at the end
11214 of two blocks before cross-jumping is performed on them. This
11215 value is ignored in the case where all instructions in the block being
11216 cross-jumped from are matched.
11217
11218 @item max-grow-copy-bb-insns
11219 The maximum code size expansion factor when copying basic blocks
11220 instead of jumping. The expansion is relative to a jump instruction.
11221
11222 @item max-goto-duplication-insns
11223 The maximum number of instructions to duplicate to a block that jumps
11224 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11225 passes, GCC factors computed gotos early in the compilation process,
11226 and unfactors them as late as possible. Only computed jumps at the
11227 end of a basic blocks with no more than max-goto-duplication-insns are
11228 unfactored.
11229
11230 @item max-delay-slot-insn-search
11231 The maximum number of instructions to consider when looking for an
11232 instruction to fill a delay slot. If more than this arbitrary number of
11233 instructions are searched, the time savings from filling the delay slot
11234 are minimal, so stop searching. Increasing values mean more
11235 aggressive optimization, making the compilation time increase with probably
11236 small improvement in execution time.
11237
11238 @item max-delay-slot-live-search
11239 When trying to fill delay slots, the maximum number of instructions to
11240 consider when searching for a block with valid live register
11241 information. Increasing this arbitrarily chosen value means more
11242 aggressive optimization, increasing the compilation time. This parameter
11243 should be removed when the delay slot code is rewritten to maintain the
11244 control-flow graph.
11245
11246 @item max-gcse-memory
11247 The approximate maximum amount of memory that can be allocated in
11248 order to perform the global common subexpression elimination
11249 optimization. If more memory than specified is required, the
11250 optimization is not done.
11251
11252 @item max-gcse-insertion-ratio
11253 If the ratio of expression insertions to deletions is larger than this value
11254 for any expression, then RTL PRE inserts or removes the expression and thus
11255 leaves partially redundant computations in the instruction stream.
11256
11257 @item max-pending-list-length
11258 The maximum number of pending dependencies scheduling allows
11259 before flushing the current state and starting over. Large functions
11260 with few branches or calls can create excessively large lists which
11261 needlessly consume memory and resources.
11262
11263 @item max-modulo-backtrack-attempts
11264 The maximum number of backtrack attempts the scheduler should make
11265 when modulo scheduling a loop. Larger values can exponentially increase
11266 compilation time.
11267
11268 @item max-inline-insns-single
11269 @item max-inline-insns-single-O2
11270 Several parameters control the tree inliner used in GCC@. This number sets the
11271 maximum number of instructions (counted in GCC's internal representation) in a
11272 single function that the tree inliner considers for inlining. This only
11273 affects functions declared inline and methods implemented in a class
11274 declaration (C++).
11275
11276 For functions compiled with optimization levels
11277 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-single} is
11278 applied. In other cases @option{max-inline-insns-single-O2} is applied.
11279
11280
11281 @item max-inline-insns-auto
11282 @item max-inline-insns-auto-O2
11283 When you use @option{-finline-functions} (included in @option{-O3}),
11284 a lot of functions that would otherwise not be considered for inlining
11285 by the compiler are investigated. To those functions, a different
11286 (more restrictive) limit compared to functions declared inline can
11287 be applied.
11288
11289 For functions compiled with optimization levels
11290 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
11291 applied. In other cases @option{max-inline-insns-auto-O2} is applied.
11292
11293 @item max-inline-insns-small
11294 This is bound applied to calls which are considered relevant with
11295 @option{-finline-small-functions}.
11296
11297 @item max-inline-insns-size
11298 This is bound applied to calls which are optimized for size. Small growth
11299 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11300
11301 @item uninlined-function-insns
11302 Number of instructions accounted by inliner for function overhead such as
11303 function prologue and epilogue.
11304
11305 @item uninlined-function-time
11306 Extra time accounted by inliner for function overhead such as time needed to
11307 execute function prologue and epilogue
11308
11309 @item inline-heuristics-hint-percent
11310 @item inline-heuristics-hint-percent-O2
11311 The scale (in percents) applied to @option{inline-insns-single},
11312 @option{inline-insns-single-O2}, @option{inline-insns-auto},
11313 @option{inline-insns-auto-O2} when inline heuristics hints that inlining is
11314 very profitable (will enable later optimizations).
11315
11316 For functions compiled with optimization levels
11317 @option{-O3} and @option{-Ofast} parameter
11318 @option{inline-heuristics-hint-percent} is applied. In other cases
11319 @option{inline-heuristics-hint-percent-O2} is applied.
11320
11321 @item uninlined-thunk-insns
11322 @item uninlined-thunk-time
11323 Same as @option{--param uninlined-function-insns} and
11324 @option{--param uninlined-function-time} but applied to function thunks
11325
11326 @item inline-min-speedup
11327 @item inline-min-speedup-O2
11328 When estimated performance improvement of caller + callee runtime exceeds this
11329 threshold (in percent), the function can be inlined regardless of the limit on
11330 @option{--param max-inline-insns-single} and @option{--param
11331 max-inline-insns-auto}.
11332
11333 For functions compiled with optimization levels
11334 @option{-O3} and @option{-Ofast} parameter @option{inline-min-speedup} is
11335 applied. In other cases @option{inline-min-speedup-O2} is applied.
11336
11337 @item large-function-insns
11338 The limit specifying really large functions. For functions larger than this
11339 limit after inlining, inlining is constrained by
11340 @option{--param large-function-growth}. This parameter is useful primarily
11341 to avoid extreme compilation time caused by non-linear algorithms used by the
11342 back end.
11343
11344 @item large-function-growth
11345 Specifies maximal growth of large function caused by inlining in percents.
11346 For example, parameter value 100 limits large function growth to 2.0 times
11347 the original size.
11348
11349 @item large-unit-insns
11350 The limit specifying large translation unit. Growth caused by inlining of
11351 units larger than this limit is limited by @option{--param inline-unit-growth}.
11352 For small units this might be too tight.
11353 For example, consider a unit consisting of function A
11354 that is inline and B that just calls A three times. If B is small relative to
11355 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11356 large units consisting of small inlineable functions, however, the overall unit
11357 growth limit is needed to avoid exponential explosion of code size. Thus for
11358 smaller units, the size is increased to @option{--param large-unit-insns}
11359 before applying @option{--param inline-unit-growth}.
11360
11361 @item inline-unit-growth
11362 Specifies maximal overall growth of the compilation unit caused by inlining.
11363 For example, parameter value 20 limits unit growth to 1.2 times the original
11364 size. Cold functions (either marked cold via an attribute or by profile
11365 feedback) are not accounted into the unit size.
11366
11367 @item ipcp-unit-growth
11368 Specifies maximal overall growth of the compilation unit caused by
11369 interprocedural constant propagation. For example, parameter value 10 limits
11370 unit growth to 1.1 times the original size.
11371
11372 @item large-stack-frame
11373 The limit specifying large stack frames. While inlining the algorithm is trying
11374 to not grow past this limit too much.
11375
11376 @item large-stack-frame-growth
11377 Specifies maximal growth of large stack frames caused by inlining in percents.
11378 For example, parameter value 1000 limits large stack frame growth to 11 times
11379 the original size.
11380
11381 @item max-inline-insns-recursive
11382 @itemx max-inline-insns-recursive-auto
11383 Specifies the maximum number of instructions an out-of-line copy of a
11384 self-recursive inline
11385 function can grow into by performing recursive inlining.
11386
11387 @option{--param max-inline-insns-recursive} applies to functions
11388 declared inline.
11389 For functions not declared inline, recursive inlining
11390 happens only when @option{-finline-functions} (included in @option{-O3}) is
11391 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11392
11393 @item max-inline-recursive-depth
11394 @itemx max-inline-recursive-depth-auto
11395 Specifies the maximum recursion depth used for recursive inlining.
11396
11397 @option{--param max-inline-recursive-depth} applies to functions
11398 declared inline. For functions not declared inline, recursive inlining
11399 happens only when @option{-finline-functions} (included in @option{-O3}) is
11400 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11401
11402 @item min-inline-recursive-probability
11403 Recursive inlining is profitable only for function having deep recursion
11404 in average and can hurt for function having little recursion depth by
11405 increasing the prologue size or complexity of function body to other
11406 optimizers.
11407
11408 When profile feedback is available (see @option{-fprofile-generate}) the actual
11409 recursion depth can be guessed from the probability that function recurses
11410 via a given call expression. This parameter limits inlining only to call
11411 expressions whose probability exceeds the given threshold (in percents).
11412
11413 @item early-inlining-insns
11414 @item early-inlining-insns-O2
11415 Specify growth that the early inliner can make. In effect it increases
11416 the amount of inlining for code having a large abstraction penalty.
11417
11418 For functions compiled with optimization levels
11419 @option{-O3} and @option{-Ofast} parameter @option{early-inlining-insns} is
11420 applied. In other cases @option{early-inlining-insns-O2} is applied.
11421
11422 @item max-early-inliner-iterations
11423 Limit of iterations of the early inliner. This basically bounds
11424 the number of nested indirect calls the early inliner can resolve.
11425 Deeper chains are still handled by late inlining.
11426
11427 @item comdat-sharing-probability
11428 Probability (in percent) that C++ inline function with comdat visibility
11429 are shared across multiple compilation units.
11430
11431 @item profile-func-internal-id
11432 A parameter to control whether to use function internal id in profile
11433 database lookup. If the value is 0, the compiler uses an id that
11434 is based on function assembler name and filename, which makes old profile
11435 data more tolerant to source changes such as function reordering etc.
11436
11437 @item min-vect-loop-bound
11438 The minimum number of iterations under which loops are not vectorized
11439 when @option{-ftree-vectorize} is used. The number of iterations after
11440 vectorization needs to be greater than the value specified by this option
11441 to allow vectorization.
11442
11443 @item gcse-cost-distance-ratio
11444 Scaling factor in calculation of maximum distance an expression
11445 can be moved by GCSE optimizations. This is currently supported only in the
11446 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11447 is with simple expressions, i.e., the expressions that have cost
11448 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11449 hoisting of simple expressions.
11450
11451 @item gcse-unrestricted-cost
11452 Cost, roughly measured as the cost of a single typical machine
11453 instruction, at which GCSE optimizations do not constrain
11454 the distance an expression can travel. This is currently
11455 supported only in the code hoisting pass. The lesser the cost,
11456 the more aggressive code hoisting is. Specifying 0
11457 allows all expressions to travel unrestricted distances.
11458
11459 @item max-hoist-depth
11460 The depth of search in the dominator tree for expressions to hoist.
11461 This is used to avoid quadratic behavior in hoisting algorithm.
11462 The value of 0 does not limit on the search, but may slow down compilation
11463 of huge functions.
11464
11465 @item max-tail-merge-comparisons
11466 The maximum amount of similar bbs to compare a bb with. This is used to
11467 avoid quadratic behavior in tree tail merging.
11468
11469 @item max-tail-merge-iterations
11470 The maximum amount of iterations of the pass over the function. This is used to
11471 limit compilation time in tree tail merging.
11472
11473 @item store-merging-allow-unaligned
11474 Allow the store merging pass to introduce unaligned stores if it is legal to
11475 do so.
11476
11477 @item max-stores-to-merge
11478 The maximum number of stores to attempt to merge into wider stores in the store
11479 merging pass.
11480
11481 @item max-unrolled-insns
11482 The maximum number of instructions that a loop may have to be unrolled.
11483 If a loop is unrolled, this parameter also determines how many times
11484 the loop code is unrolled.
11485
11486 @item max-average-unrolled-insns
11487 The maximum number of instructions biased by probabilities of their execution
11488 that a loop may have to be unrolled. If a loop is unrolled,
11489 this parameter also determines how many times the loop code is unrolled.
11490
11491 @item max-unroll-times
11492 The maximum number of unrollings of a single loop.
11493
11494 @item max-peeled-insns
11495 The maximum number of instructions that a loop may have to be peeled.
11496 If a loop is peeled, this parameter also determines how many times
11497 the loop code is peeled.
11498
11499 @item max-peel-times
11500 The maximum number of peelings of a single loop.
11501
11502 @item max-peel-branches
11503 The maximum number of branches on the hot path through the peeled sequence.
11504
11505 @item max-completely-peeled-insns
11506 The maximum number of insns of a completely peeled loop.
11507
11508 @item max-completely-peel-times
11509 The maximum number of iterations of a loop to be suitable for complete peeling.
11510
11511 @item max-completely-peel-loop-nest-depth
11512 The maximum depth of a loop nest suitable for complete peeling.
11513
11514 @item max-unswitch-insns
11515 The maximum number of insns of an unswitched loop.
11516
11517 @item max-unswitch-level
11518 The maximum number of branches unswitched in a single loop.
11519
11520 @item lim-expensive
11521 The minimum cost of an expensive expression in the loop invariant motion.
11522
11523 @item min-loop-cond-split-prob
11524 When FDO profile information is available, @option{min-loop-cond-split-prob}
11525 specifies minimum threshold for probability of semi-invariant condition
11526 statement to trigger loop split.
11527
11528 @item iv-consider-all-candidates-bound
11529 Bound on number of candidates for induction variables, below which
11530 all candidates are considered for each use in induction variable
11531 optimizations. If there are more candidates than this,
11532 only the most relevant ones are considered to avoid quadratic time complexity.
11533
11534 @item iv-max-considered-uses
11535 The induction variable optimizations give up on loops that contain more
11536 induction variable uses.
11537
11538 @item iv-always-prune-cand-set-bound
11539 If the number of candidates in the set is smaller than this value,
11540 always try to remove unnecessary ivs from the set
11541 when adding a new one.
11542
11543 @item avg-loop-niter
11544 Average number of iterations of a loop.
11545
11546 @item dse-max-object-size
11547 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11548 Larger values may result in larger compilation times.
11549
11550 @item dse-max-alias-queries-per-store
11551 Maximum number of queries into the alias oracle per store.
11552 Larger values result in larger compilation times and may result in more
11553 removed dead stores.
11554
11555 @item scev-max-expr-size
11556 Bound on size of expressions used in the scalar evolutions analyzer.
11557 Large expressions slow the analyzer.
11558
11559 @item scev-max-expr-complexity
11560 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11561 Complex expressions slow the analyzer.
11562
11563 @item max-tree-if-conversion-phi-args
11564 Maximum number of arguments in a PHI supported by TREE if conversion
11565 unless the loop is marked with simd pragma.
11566
11567 @item vect-max-version-for-alignment-checks
11568 The maximum number of run-time checks that can be performed when
11569 doing loop versioning for alignment in the vectorizer.
11570
11571 @item vect-max-version-for-alias-checks
11572 The maximum number of run-time checks that can be performed when
11573 doing loop versioning for alias in the vectorizer.
11574
11575 @item vect-max-peeling-for-alignment
11576 The maximum number of loop peels to enhance access alignment
11577 for vectorizer. Value -1 means no limit.
11578
11579 @item max-iterations-to-track
11580 The maximum number of iterations of a loop the brute-force algorithm
11581 for analysis of the number of iterations of the loop tries to evaluate.
11582
11583 @item hot-bb-count-fraction
11584 The denominator n of fraction 1/n of the maximal execution count of a
11585 basic block in the entire program that a basic block needs to at least
11586 have in order to be considered hot. The default is 10000, which means
11587 that a basic block is considered hot if its execution count is greater
11588 than 1/10000 of the maximal execution count. 0 means that it is never
11589 considered hot. Used in non-LTO mode.
11590
11591 @item hot-bb-count-ws-permille
11592 The number of most executed permilles, ranging from 0 to 1000, of the
11593 profiled execution of the entire program to which the execution count
11594 of a basic block must be part of in order to be considered hot. The
11595 default is 990, which means that a basic block is considered hot if
11596 its execution count contributes to the upper 990 permilles, or 99.0%,
11597 of the profiled execution of the entire program. 0 means that it is
11598 never considered hot. Used in LTO mode.
11599
11600 @item hot-bb-frequency-fraction
11601 The denominator n of fraction 1/n of the execution frequency of the
11602 entry block of a function that a basic block of this function needs
11603 to at least have in order to be considered hot. The default is 1000,
11604 which means that a basic block is considered hot in a function if it
11605 is executed more frequently than 1/1000 of the frequency of the entry
11606 block of the function. 0 means that it is never considered hot.
11607
11608 @item unlikely-bb-count-fraction
11609 The denominator n of fraction 1/n of the number of profiled runs of
11610 the entire program below which the execution count of a basic block
11611 must be in order for the basic block to be considered unlikely executed.
11612 The default is 20, which means that a basic block is considered unlikely
11613 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11614 the program. 0 means that it is always considered unlikely executed.
11615
11616 @item max-predicted-iterations
11617 The maximum number of loop iterations we predict statically. This is useful
11618 in cases where a function contains a single loop with known bound and
11619 another loop with unknown bound.
11620 The known number of iterations is predicted correctly, while
11621 the unknown number of iterations average to roughly 10. This means that the
11622 loop without bounds appears artificially cold relative to the other one.
11623
11624 @item builtin-expect-probability
11625 Control the probability of the expression having the specified value. This
11626 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11627
11628 @item builtin-string-cmp-inline-length
11629 The maximum length of a constant string for a builtin string cmp call
11630 eligible for inlining.
11631
11632 @item align-threshold
11633
11634 Select fraction of the maximal frequency of executions of a basic block in
11635 a function to align the basic block.
11636
11637 @item align-loop-iterations
11638
11639 A loop expected to iterate at least the selected number of iterations is
11640 aligned.
11641
11642 @item tracer-dynamic-coverage
11643 @itemx tracer-dynamic-coverage-feedback
11644
11645 This value is used to limit superblock formation once the given percentage of
11646 executed instructions is covered. This limits unnecessary code size
11647 expansion.
11648
11649 The @option{tracer-dynamic-coverage-feedback} parameter
11650 is used only when profile
11651 feedback is available. The real profiles (as opposed to statically estimated
11652 ones) are much less balanced allowing the threshold to be larger value.
11653
11654 @item tracer-max-code-growth
11655 Stop tail duplication once code growth has reached given percentage. This is
11656 a rather artificial limit, as most of the duplicates are eliminated later in
11657 cross jumping, so it may be set to much higher values than is the desired code
11658 growth.
11659
11660 @item tracer-min-branch-ratio
11661
11662 Stop reverse growth when the reverse probability of best edge is less than this
11663 threshold (in percent).
11664
11665 @item tracer-min-branch-probability
11666 @itemx tracer-min-branch-probability-feedback
11667
11668 Stop forward growth if the best edge has probability lower than this
11669 threshold.
11670
11671 Similarly to @option{tracer-dynamic-coverage} two parameters are
11672 provided. @option{tracer-min-branch-probability-feedback} is used for
11673 compilation with profile feedback and @option{tracer-min-branch-probability}
11674 compilation without. The value for compilation with profile feedback
11675 needs to be more conservative (higher) in order to make tracer
11676 effective.
11677
11678 @item stack-clash-protection-guard-size
11679 Specify the size of the operating system provided stack guard as
11680 2 raised to @var{num} bytes. Higher values may reduce the
11681 number of explicit probes, but a value larger than the operating system
11682 provided guard will leave code vulnerable to stack clash style attacks.
11683
11684 @item stack-clash-protection-probe-interval
11685 Stack clash protection involves probing stack space as it is allocated. This
11686 param controls the maximum distance between probes into the stack as 2 raised
11687 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11688 larger than the operating system provided guard will leave code vulnerable to
11689 stack clash style attacks.
11690
11691 @item max-cse-path-length
11692
11693 The maximum number of basic blocks on path that CSE considers.
11694
11695 @item max-cse-insns
11696 The maximum number of instructions CSE processes before flushing.
11697
11698 @item ggc-min-expand
11699
11700 GCC uses a garbage collector to manage its own memory allocation. This
11701 parameter specifies the minimum percentage by which the garbage
11702 collector's heap should be allowed to expand between collections.
11703 Tuning this may improve compilation speed; it has no effect on code
11704 generation.
11705
11706 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11707 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11708 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11709 GCC is not able to calculate RAM on a particular platform, the lower
11710 bound of 30% is used. Setting this parameter and
11711 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11712 every opportunity. This is extremely slow, but can be useful for
11713 debugging.
11714
11715 @item ggc-min-heapsize
11716
11717 Minimum size of the garbage collector's heap before it begins bothering
11718 to collect garbage. The first collection occurs after the heap expands
11719 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11720 tuning this may improve compilation speed, and has no effect on code
11721 generation.
11722
11723 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11724 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11725 with a lower bound of 4096 (four megabytes) and an upper bound of
11726 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11727 particular platform, the lower bound is used. Setting this parameter
11728 very large effectively disables garbage collection. Setting this
11729 parameter and @option{ggc-min-expand} to zero causes a full collection
11730 to occur at every opportunity.
11731
11732 @item max-reload-search-insns
11733 The maximum number of instruction reload should look backward for equivalent
11734 register. Increasing values mean more aggressive optimization, making the
11735 compilation time increase with probably slightly better performance.
11736
11737 @item max-cselib-memory-locations
11738 The maximum number of memory locations cselib should take into account.
11739 Increasing values mean more aggressive optimization, making the compilation time
11740 increase with probably slightly better performance.
11741
11742 @item max-sched-ready-insns
11743 The maximum number of instructions ready to be issued the scheduler should
11744 consider at any given time during the first scheduling pass. Increasing
11745 values mean more thorough searches, making the compilation time increase
11746 with probably little benefit.
11747
11748 @item max-sched-region-blocks
11749 The maximum number of blocks in a region to be considered for
11750 interblock scheduling.
11751
11752 @item max-pipeline-region-blocks
11753 The maximum number of blocks in a region to be considered for
11754 pipelining in the selective scheduler.
11755
11756 @item max-sched-region-insns
11757 The maximum number of insns in a region to be considered for
11758 interblock scheduling.
11759
11760 @item max-pipeline-region-insns
11761 The maximum number of insns in a region to be considered for
11762 pipelining in the selective scheduler.
11763
11764 @item min-spec-prob
11765 The minimum probability (in percents) of reaching a source block
11766 for interblock speculative scheduling.
11767
11768 @item max-sched-extend-regions-iters
11769 The maximum number of iterations through CFG to extend regions.
11770 A value of 0 disables region extensions.
11771
11772 @item max-sched-insn-conflict-delay
11773 The maximum conflict delay for an insn to be considered for speculative motion.
11774
11775 @item sched-spec-prob-cutoff
11776 The minimal probability of speculation success (in percents), so that
11777 speculative insns are scheduled.
11778
11779 @item sched-state-edge-prob-cutoff
11780 The minimum probability an edge must have for the scheduler to save its
11781 state across it.
11782
11783 @item sched-mem-true-dep-cost
11784 Minimal distance (in CPU cycles) between store and load targeting same
11785 memory locations.
11786
11787 @item selsched-max-lookahead
11788 The maximum size of the lookahead window of selective scheduling. It is a
11789 depth of search for available instructions.
11790
11791 @item selsched-max-sched-times
11792 The maximum number of times that an instruction is scheduled during
11793 selective scheduling. This is the limit on the number of iterations
11794 through which the instruction may be pipelined.
11795
11796 @item selsched-insns-to-rename
11797 The maximum number of best instructions in the ready list that are considered
11798 for renaming in the selective scheduler.
11799
11800 @item sms-min-sc
11801 The minimum value of stage count that swing modulo scheduler
11802 generates.
11803
11804 @item max-last-value-rtl
11805 The maximum size measured as number of RTLs that can be recorded in an expression
11806 in combiner for a pseudo register as last known value of that register.
11807
11808 @item max-combine-insns
11809 The maximum number of instructions the RTL combiner tries to combine.
11810
11811 @item integer-share-limit
11812 Small integer constants can use a shared data structure, reducing the
11813 compiler's memory usage and increasing its speed. This sets the maximum
11814 value of a shared integer constant.
11815
11816 @item ssp-buffer-size
11817 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11818 protection when @option{-fstack-protection} is used.
11819
11820 @item min-size-for-stack-sharing
11821 The minimum size of variables taking part in stack slot sharing when not
11822 optimizing.
11823
11824 @item max-jump-thread-duplication-stmts
11825 Maximum number of statements allowed in a block that needs to be
11826 duplicated when threading jumps.
11827
11828 @item max-fields-for-field-sensitive
11829 Maximum number of fields in a structure treated in
11830 a field sensitive manner during pointer analysis.
11831
11832 @item prefetch-latency
11833 Estimate on average number of instructions that are executed before
11834 prefetch finishes. The distance prefetched ahead is proportional
11835 to this constant. Increasing this number may also lead to less
11836 streams being prefetched (see @option{simultaneous-prefetches}).
11837
11838 @item simultaneous-prefetches
11839 Maximum number of prefetches that can run at the same time.
11840
11841 @item l1-cache-line-size
11842 The size of cache line in L1 data cache, in bytes.
11843
11844 @item l1-cache-size
11845 The size of L1 data cache, in kilobytes.
11846
11847 @item l2-cache-size
11848 The size of L2 data cache, in kilobytes.
11849
11850 @item prefetch-dynamic-strides
11851 Whether the loop array prefetch pass should issue software prefetch hints
11852 for strides that are non-constant. In some cases this may be
11853 beneficial, though the fact the stride is non-constant may make it
11854 hard to predict when there is clear benefit to issuing these hints.
11855
11856 Set to 1 if the prefetch hints should be issued for non-constant
11857 strides. Set to 0 if prefetch hints should be issued only for strides that
11858 are known to be constant and below @option{prefetch-minimum-stride}.
11859
11860 @item prefetch-minimum-stride
11861 Minimum constant stride, in bytes, to start using prefetch hints for. If
11862 the stride is less than this threshold, prefetch hints will not be issued.
11863
11864 This setting is useful for processors that have hardware prefetchers, in
11865 which case there may be conflicts between the hardware prefetchers and
11866 the software prefetchers. If the hardware prefetchers have a maximum
11867 stride they can handle, it should be used here to improve the use of
11868 software prefetchers.
11869
11870 A value of -1 means we don't have a threshold and therefore
11871 prefetch hints can be issued for any constant stride.
11872
11873 This setting is only useful for strides that are known and constant.
11874
11875 @item loop-interchange-max-num-stmts
11876 The maximum number of stmts in a loop to be interchanged.
11877
11878 @item loop-interchange-stride-ratio
11879 The minimum ratio between stride of two loops for interchange to be profitable.
11880
11881 @item min-insn-to-prefetch-ratio
11882 The minimum ratio between the number of instructions and the
11883 number of prefetches to enable prefetching in a loop.
11884
11885 @item prefetch-min-insn-to-mem-ratio
11886 The minimum ratio between the number of instructions and the
11887 number of memory references to enable prefetching in a loop.
11888
11889 @item use-canonical-types
11890 Whether the compiler should use the ``canonical'' type system.
11891 Should always be 1, which uses a more efficient internal
11892 mechanism for comparing types in C++ and Objective-C++. However, if
11893 bugs in the canonical type system are causing compilation failures,
11894 set this value to 0 to disable canonical types.
11895
11896 @item switch-conversion-max-branch-ratio
11897 Switch initialization conversion refuses to create arrays that are
11898 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11899 branches in the switch.
11900
11901 @item max-partial-antic-length
11902 Maximum length of the partial antic set computed during the tree
11903 partial redundancy elimination optimization (@option{-ftree-pre}) when
11904 optimizing at @option{-O3} and above. For some sorts of source code
11905 the enhanced partial redundancy elimination optimization can run away,
11906 consuming all of the memory available on the host machine. This
11907 parameter sets a limit on the length of the sets that are computed,
11908 which prevents the runaway behavior. Setting a value of 0 for
11909 this parameter allows an unlimited set length.
11910
11911 @item rpo-vn-max-loop-depth
11912 Maximum loop depth that is value-numbered optimistically.
11913 When the limit hits the innermost
11914 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11915 loop nest are value-numbered optimistically and the remaining ones not.
11916
11917 @item sccvn-max-alias-queries-per-access
11918 Maximum number of alias-oracle queries we perform when looking for
11919 redundancies for loads and stores. If this limit is hit the search
11920 is aborted and the load or store is not considered redundant. The
11921 number of queries is algorithmically limited to the number of
11922 stores on all paths from the load to the function entry.
11923
11924 @item ira-max-loops-num
11925 IRA uses regional register allocation by default. If a function
11926 contains more loops than the number given by this parameter, only at most
11927 the given number of the most frequently-executed loops form regions
11928 for regional register allocation.
11929
11930 @item ira-max-conflict-table-size
11931 Although IRA uses a sophisticated algorithm to compress the conflict
11932 table, the table can still require excessive amounts of memory for
11933 huge functions. If the conflict table for a function could be more
11934 than the size in MB given by this parameter, the register allocator
11935 instead uses a faster, simpler, and lower-quality
11936 algorithm that does not require building a pseudo-register conflict table.
11937
11938 @item ira-loop-reserved-regs
11939 IRA can be used to evaluate more accurate register pressure in loops
11940 for decisions to move loop invariants (see @option{-O3}). The number
11941 of available registers reserved for some other purposes is given
11942 by this parameter. Default of the parameter
11943 is the best found from numerous experiments.
11944
11945 @item lra-inheritance-ebb-probability-cutoff
11946 LRA tries to reuse values reloaded in registers in subsequent insns.
11947 This optimization is called inheritance. EBB is used as a region to
11948 do this optimization. The parameter defines a minimal fall-through
11949 edge probability in percentage used to add BB to inheritance EBB in
11950 LRA. The default value was chosen
11951 from numerous runs of SPEC2000 on x86-64.
11952
11953 @item loop-invariant-max-bbs-in-loop
11954 Loop invariant motion can be very expensive, both in compilation time and
11955 in amount of needed compile-time memory, with very large loops. Loops
11956 with more basic blocks than this parameter won't have loop invariant
11957 motion optimization performed on them.
11958
11959 @item loop-max-datarefs-for-datadeps
11960 Building data dependencies is expensive for very large loops. This
11961 parameter limits the number of data references in loops that are
11962 considered for data dependence analysis. These large loops are no
11963 handled by the optimizations using loop data dependencies.
11964
11965 @item max-vartrack-size
11966 Sets a maximum number of hash table slots to use during variable
11967 tracking dataflow analysis of any function. If this limit is exceeded
11968 with variable tracking at assignments enabled, analysis for that
11969 function is retried without it, after removing all debug insns from
11970 the function. If the limit is exceeded even without debug insns, var
11971 tracking analysis is completely disabled for the function. Setting
11972 the parameter to zero makes it unlimited.
11973
11974 @item max-vartrack-expr-depth
11975 Sets a maximum number of recursion levels when attempting to map
11976 variable names or debug temporaries to value expressions. This trades
11977 compilation time for more complete debug information. If this is set too
11978 low, value expressions that are available and could be represented in
11979 debug information may end up not being used; setting this higher may
11980 enable the compiler to find more complex debug expressions, but compile
11981 time and memory use may grow.
11982
11983 @item max-debug-marker-count
11984 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11985 markers) to avoid complexity explosion at inlining or expanding to RTL.
11986 If a function has more such gimple stmts than the set limit, such stmts
11987 will be dropped from the inlined copy of a function, and from its RTL
11988 expansion.
11989
11990 @item min-nondebug-insn-uid
11991 Use uids starting at this parameter for nondebug insns. The range below
11992 the parameter is reserved exclusively for debug insns created by
11993 @option{-fvar-tracking-assignments}, but debug insns may get
11994 (non-overlapping) uids above it if the reserved range is exhausted.
11995
11996 @item ipa-sra-ptr-growth-factor
11997 IPA-SRA replaces a pointer to an aggregate with one or more new
11998 parameters only when their cumulative size is less or equal to
11999 @option{ipa-sra-ptr-growth-factor} times the size of the original
12000 pointer parameter.
12001
12002 @item ipa-sra-max-replacements
12003 Maximum pieces of an aggregate that IPA-SRA tracks. As a
12004 consequence, it is also the maximum number of replacements of a formal
12005 parameter.
12006
12007 @item sra-max-scalarization-size-Ospeed
12008 @itemx sra-max-scalarization-size-Osize
12009 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12010 replace scalar parts of aggregates with uses of independent scalar
12011 variables. These parameters control the maximum size, in storage units,
12012 of aggregate which is considered for replacement when compiling for
12013 speed
12014 (@option{sra-max-scalarization-size-Ospeed}) or size
12015 (@option{sra-max-scalarization-size-Osize}) respectively.
12016
12017 @item tm-max-aggregate-size
12018 When making copies of thread-local variables in a transaction, this
12019 parameter specifies the size in bytes after which variables are
12020 saved with the logging functions as opposed to save/restore code
12021 sequence pairs. This option only applies when using
12022 @option{-fgnu-tm}.
12023
12024 @item graphite-max-nb-scop-params
12025 To avoid exponential effects in the Graphite loop transforms, the
12026 number of parameters in a Static Control Part (SCoP) is bounded.
12027 A value of zero can be used to lift
12028 the bound. A variable whose value is unknown at compilation time and
12029 defined outside a SCoP is a parameter of the SCoP.
12030
12031 @item loop-block-tile-size
12032 Loop blocking or strip mining transforms, enabled with
12033 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12034 loop in the loop nest by a given number of iterations. The strip
12035 length can be changed using the @option{loop-block-tile-size}
12036 parameter.
12037
12038 @item ipa-cp-value-list-size
12039 IPA-CP attempts to track all possible values and types passed to a function's
12040 parameter in order to propagate them and perform devirtualization.
12041 @option{ipa-cp-value-list-size} is the maximum number of values and types it
12042 stores per one formal parameter of a function.
12043
12044 @item ipa-cp-eval-threshold
12045 IPA-CP calculates its own score of cloning profitability heuristics
12046 and performs those cloning opportunities with scores that exceed
12047 @option{ipa-cp-eval-threshold}.
12048
12049 @item ipa-cp-recursion-penalty
12050 Percentage penalty the recursive functions will receive when they
12051 are evaluated for cloning.
12052
12053 @item ipa-cp-single-call-penalty
12054 Percentage penalty functions containing a single call to another
12055 function will receive when they are evaluated for cloning.
12056
12057 @item ipa-max-agg-items
12058 IPA-CP is also capable to propagate a number of scalar values passed
12059 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12060 number of such values per one parameter.
12061
12062 @item ipa-cp-loop-hint-bonus
12063 When IPA-CP determines that a cloning candidate would make the number
12064 of iterations of a loop known, it adds a bonus of
12065 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12066 the candidate.
12067
12068 @item ipa-max-aa-steps
12069 During its analysis of function bodies, IPA-CP employs alias analysis
12070 in order to track values pointed to by function parameters. In order
12071 not spend too much time analyzing huge functions, it gives up and
12072 consider all memory clobbered after examining
12073 @option{ipa-max-aa-steps} statements modifying memory.
12074
12075 @item ipa-max-switch-predicate-bounds
12076 Maximal number of boundary endpoints of case ranges of switch statement.
12077 For switch exceeding this limit, IPA-CP will not construct cloning cost
12078 predicate, which is used to estimate cloning benefit, for default case
12079 of the switch statement.
12080
12081 @item ipa-max-param-expr-ops
12082 IPA-CP will analyze conditional statement that references some function
12083 parameter to estimate benefit for cloning upon certain constant value.
12084 But if number of operations in a parameter expression exceeds
12085 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
12086 one, and is not handled by IPA analysis.
12087
12088 @item lto-partitions
12089 Specify desired number of partitions produced during WHOPR compilation.
12090 The number of partitions should exceed the number of CPUs used for compilation.
12091
12092 @item lto-min-partition
12093 Size of minimal partition for WHOPR (in estimated instructions).
12094 This prevents expenses of splitting very small programs into too many
12095 partitions.
12096
12097 @item lto-max-partition
12098 Size of max partition for WHOPR (in estimated instructions).
12099 to provide an upper bound for individual size of partition.
12100 Meant to be used only with balanced partitioning.
12101
12102 @item lto-max-streaming-parallelism
12103 Maximal number of parallel processes used for LTO streaming.
12104
12105 @item cxx-max-namespaces-for-diagnostic-help
12106 The maximum number of namespaces to consult for suggestions when C++
12107 name lookup fails for an identifier.
12108
12109 @item sink-frequency-threshold
12110 The maximum relative execution frequency (in percents) of the target block
12111 relative to a statement's original block to allow statement sinking of a
12112 statement. Larger numbers result in more aggressive statement sinking.
12113 A small positive adjustment is applied for
12114 statements with memory operands as those are even more profitable so sink.
12115
12116 @item max-stores-to-sink
12117 The maximum number of conditional store pairs that can be sunk. Set to 0
12118 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12119 (@option{-ftree-loop-if-convert}) is disabled.
12120
12121 @item case-values-threshold
12122 The smallest number of different values for which it is best to use a
12123 jump-table instead of a tree of conditional branches. If the value is
12124 0, use the default for the machine.
12125
12126 @item jump-table-max-growth-ratio-for-size
12127 The maximum code size growth ratio when expanding
12128 into a jump table (in percent). The parameter is used when
12129 optimizing for size.
12130
12131 @item jump-table-max-growth-ratio-for-speed
12132 The maximum code size growth ratio when expanding
12133 into a jump table (in percent). The parameter is used when
12134 optimizing for speed.
12135
12136 @item tree-reassoc-width
12137 Set the maximum number of instructions executed in parallel in
12138 reassociated tree. This parameter overrides target dependent
12139 heuristics used by default if has non zero value.
12140
12141 @item sched-pressure-algorithm
12142 Choose between the two available implementations of
12143 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12144 and is the more likely to prevent instructions from being reordered.
12145 Algorithm 2 was designed to be a compromise between the relatively
12146 conservative approach taken by algorithm 1 and the rather aggressive
12147 approach taken by the default scheduler. It relies more heavily on
12148 having a regular register file and accurate register pressure classes.
12149 See @file{haifa-sched.c} in the GCC sources for more details.
12150
12151 The default choice depends on the target.
12152
12153 @item max-slsr-cand-scan
12154 Set the maximum number of existing candidates that are considered when
12155 seeking a basis for a new straight-line strength reduction candidate.
12156
12157 @item asan-globals
12158 Enable buffer overflow detection for global objects. This kind
12159 of protection is enabled by default if you are using
12160 @option{-fsanitize=address} option.
12161 To disable global objects protection use @option{--param asan-globals=0}.
12162
12163 @item asan-stack
12164 Enable buffer overflow detection for stack objects. This kind of
12165 protection is enabled by default when using @option{-fsanitize=address}.
12166 To disable stack protection use @option{--param asan-stack=0} option.
12167
12168 @item asan-instrument-reads
12169 Enable buffer overflow detection for memory reads. This kind of
12170 protection is enabled by default when using @option{-fsanitize=address}.
12171 To disable memory reads protection use
12172 @option{--param asan-instrument-reads=0}.
12173
12174 @item asan-instrument-writes
12175 Enable buffer overflow detection for memory writes. This kind of
12176 protection is enabled by default when using @option{-fsanitize=address}.
12177 To disable memory writes protection use
12178 @option{--param asan-instrument-writes=0} option.
12179
12180 @item asan-memintrin
12181 Enable detection for built-in functions. This kind of protection
12182 is enabled by default when using @option{-fsanitize=address}.
12183 To disable built-in functions protection use
12184 @option{--param asan-memintrin=0}.
12185
12186 @item asan-use-after-return
12187 Enable detection of use-after-return. This kind of protection
12188 is enabled by default when using the @option{-fsanitize=address} option.
12189 To disable it use @option{--param asan-use-after-return=0}.
12190
12191 Note: By default the check is disabled at run time. To enable it,
12192 add @code{detect_stack_use_after_return=1} to the environment variable
12193 @env{ASAN_OPTIONS}.
12194
12195 @item asan-instrumentation-with-call-threshold
12196 If number of memory accesses in function being instrumented
12197 is greater or equal to this number, use callbacks instead of inline checks.
12198 E.g. to disable inline code use
12199 @option{--param asan-instrumentation-with-call-threshold=0}.
12200
12201 @item use-after-scope-direct-emission-threshold
12202 If the size of a local variable in bytes is smaller or equal to this
12203 number, directly poison (or unpoison) shadow memory instead of using
12204 run-time callbacks.
12205
12206 @item max-fsm-thread-path-insns
12207 Maximum number of instructions to copy when duplicating blocks on a
12208 finite state automaton jump thread path.
12209
12210 @item max-fsm-thread-length
12211 Maximum number of basic blocks on a finite state automaton jump thread
12212 path.
12213
12214 @item max-fsm-thread-paths
12215 Maximum number of new jump thread paths to create for a finite state
12216 automaton.
12217
12218 @item parloops-chunk-size
12219 Chunk size of omp schedule for loops parallelized by parloops.
12220
12221 @item parloops-schedule
12222 Schedule type of omp schedule for loops parallelized by parloops (static,
12223 dynamic, guided, auto, runtime).
12224
12225 @item parloops-min-per-thread
12226 The minimum number of iterations per thread of an innermost parallelized
12227 loop for which the parallelized variant is preferred over the single threaded
12228 one. Note that for a parallelized loop nest the
12229 minimum number of iterations of the outermost loop per thread is two.
12230
12231 @item max-ssa-name-query-depth
12232 Maximum depth of recursion when querying properties of SSA names in things
12233 like fold routines. One level of recursion corresponds to following a
12234 use-def chain.
12235
12236 @item hsa-gen-debug-stores
12237 Enable emission of special debug stores within HSA kernels which are
12238 then read and reported by libgomp plugin. Generation of these stores
12239 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12240 enable it.
12241
12242 @item max-speculative-devirt-maydefs
12243 The maximum number of may-defs we analyze when looking for a must-def
12244 specifying the dynamic type of an object that invokes a virtual call
12245 we may be able to devirtualize speculatively.
12246
12247 @item max-vrp-switch-assertions
12248 The maximum number of assertions to add along the default edge of a switch
12249 statement during VRP.
12250
12251 @item unroll-jam-min-percent
12252 The minimum percentage of memory references that must be optimized
12253 away for the unroll-and-jam transformation to be considered profitable.
12254
12255 @item unroll-jam-max-unroll
12256 The maximum number of times the outer loop should be unrolled by
12257 the unroll-and-jam transformation.
12258
12259 @item max-rtl-if-conversion-unpredictable-cost
12260 Maximum permissible cost for the sequence that would be generated
12261 by the RTL if-conversion pass for a branch that is considered unpredictable.
12262
12263 @item max-variable-expansions-in-unroller
12264 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12265 of times that an individual variable will be expanded during loop unrolling.
12266
12267 @item tracer-min-branch-probability-feedback
12268 Stop forward growth if the probability of best edge is less than
12269 this threshold (in percent). Used when profile feedback is available.
12270
12271 @item partial-inlining-entry-probability
12272 Maximum probability of the entry BB of split region
12273 (in percent relative to entry BB of the function)
12274 to make partial inlining happen.
12275
12276 @item max-tracked-strlens
12277 Maximum number of strings for which strlen optimization pass will
12278 track string lengths.
12279
12280 @item gcse-after-reload-partial-fraction
12281 The threshold ratio for performing partial redundancy
12282 elimination after reload.
12283
12284 @item gcse-after-reload-critical-fraction
12285 The threshold ratio of critical edges execution count that
12286 permit performing redundancy elimination after reload.
12287
12288 @item max-loop-header-insns
12289 The maximum number of insns in loop header duplicated
12290 by the copy loop headers pass.
12291
12292 @item vect-epilogues-nomask
12293 Enable loop epilogue vectorization using smaller vector size.
12294
12295 @item slp-max-insns-in-bb
12296 Maximum number of instructions in basic block to be
12297 considered for SLP vectorization.
12298
12299 @item avoid-fma-max-bits
12300 Maximum number of bits for which we avoid creating FMAs.
12301
12302 @item sms-loop-average-count-threshold
12303 A threshold on the average loop count considered by the swing modulo scheduler.
12304
12305 @item sms-dfa-history
12306 The number of cycles the swing modulo scheduler considers when checking
12307 conflicts using DFA.
12308
12309 @item max-inline-insns-recursive-auto
12310 The maximum number of instructions non-inline function
12311 can grow to via recursive inlining.
12312
12313 @item graphite-allow-codegen-errors
12314 Whether codegen errors should be ICEs when @option{-fchecking}.
12315
12316 @item sms-max-ii-factor
12317 A factor for tuning the upper bound that swing modulo scheduler
12318 uses for scheduling a loop.
12319
12320 @item lra-max-considered-reload-pseudos
12321 The max number of reload pseudos which are considered during
12322 spilling a non-reload pseudo.
12323
12324 @item max-pow-sqrt-depth
12325 Maximum depth of sqrt chains to use when synthesizing exponentiation
12326 by a real constant.
12327
12328 @item max-dse-active-local-stores
12329 Maximum number of active local stores in RTL dead store elimination.
12330
12331 @item asan-instrument-allocas
12332 Enable asan allocas/VLAs protection.
12333
12334 @item max-iterations-computation-cost
12335 Bound on the cost of an expression to compute the number of iterations.
12336
12337 @item max-isl-operations
12338 Maximum number of isl operations, 0 means unlimited.
12339
12340 @item graphite-max-arrays-per-scop
12341 Maximum number of arrays per scop.
12342
12343 @item max-vartrack-reverse-op-size
12344 Max. size of loc list for which reverse ops should be added.
12345
12346 @item tracer-dynamic-coverage-feedback
12347 The percentage of function, weighted by execution frequency,
12348 that must be covered by trace formation.
12349 Used when profile feedback is available.
12350
12351 @item max-inline-recursive-depth-auto
12352 The maximum depth of recursive inlining for non-inline functions.
12353
12354 @item fsm-scale-path-stmts
12355 Scale factor to apply to the number of statements in a threading path
12356 when comparing to the number of (scaled) blocks.
12357
12358 @item fsm-maximum-phi-arguments
12359 Maximum number of arguments a PHI may have before the FSM threader
12360 will not try to thread through its block.
12361
12362 @item uninit-control-dep-attempts
12363 Maximum number of nested calls to search for control dependencies
12364 during uninitialized variable analysis.
12365
12366 @item max-once-peeled-insns
12367 The maximum number of insns of a peeled loop that rolls only once.
12368
12369 @item sra-max-scalarization-size-Osize
12370 Maximum size, in storage units, of an aggregate
12371 which should be considered for scalarization when compiling for size.
12372
12373 @item fsm-scale-path-blocks
12374 Scale factor to apply to the number of blocks in a threading path
12375 when comparing to the number of (scaled) statements.
12376
12377 @item sched-autopref-queue-depth
12378 Hardware autoprefetcher scheduler model control flag.
12379 Number of lookahead cycles the model looks into; at '
12380 ' only enable instruction sorting heuristic.
12381
12382 @item loop-versioning-max-inner-insns
12383 The maximum number of instructions that an inner loop can have
12384 before the loop versioning pass considers it too big to copy.
12385
12386 @item loop-versioning-max-outer-insns
12387 The maximum number of instructions that an outer loop can have
12388 before the loop versioning pass considers it too big to copy,
12389 discounting any instructions in inner loops that directly benefit
12390 from versioning.
12391
12392 @item ssa-name-def-chain-limit
12393 The maximum number of SSA_NAME assignments to follow in determining
12394 a property of a variable such as its value. This limits the number
12395 of iterations or recursive calls GCC performs when optimizing certain
12396 statements or when determining their validity prior to issuing
12397 diagnostics.
12398
12399 @end table
12400 @end table
12401
12402 @node Instrumentation Options
12403 @section Program Instrumentation Options
12404 @cindex instrumentation options
12405 @cindex program instrumentation options
12406 @cindex run-time error checking options
12407 @cindex profiling options
12408 @cindex options, program instrumentation
12409 @cindex options, run-time error checking
12410 @cindex options, profiling
12411
12412 GCC supports a number of command-line options that control adding
12413 run-time instrumentation to the code it normally generates.
12414 For example, one purpose of instrumentation is collect profiling
12415 statistics for use in finding program hot spots, code coverage
12416 analysis, or profile-guided optimizations.
12417 Another class of program instrumentation is adding run-time checking
12418 to detect programming errors like invalid pointer
12419 dereferences or out-of-bounds array accesses, as well as deliberately
12420 hostile attacks such as stack smashing or C++ vtable hijacking.
12421 There is also a general hook which can be used to implement other
12422 forms of tracing or function-level instrumentation for debug or
12423 program analysis purposes.
12424
12425 @table @gcctabopt
12426 @cindex @command{prof}
12427 @cindex @command{gprof}
12428 @item -p
12429 @itemx -pg
12430 @opindex p
12431 @opindex pg
12432 Generate extra code to write profile information suitable for the
12433 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12434 (for @option{-pg}). You must use this option when compiling
12435 the source files you want data about, and you must also use it when
12436 linking.
12437
12438 You can use the function attribute @code{no_instrument_function} to
12439 suppress profiling of individual functions when compiling with these options.
12440 @xref{Common Function Attributes}.
12441
12442 @item -fprofile-arcs
12443 @opindex fprofile-arcs
12444 Add code so that program flow @dfn{arcs} are instrumented. During
12445 execution the program records how many times each branch and call is
12446 executed and how many times it is taken or returns. On targets that support
12447 constructors with priority support, profiling properly handles constructors,
12448 destructors and C++ constructors (and destructors) of classes which are used
12449 as a type of a global variable.
12450
12451 When the compiled
12452 program exits it saves this data to a file called
12453 @file{@var{auxname}.gcda} for each source file. The data may be used for
12454 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12455 test coverage analysis (@option{-ftest-coverage}). Each object file's
12456 @var{auxname} is generated from the name of the output file, if
12457 explicitly specified and it is not the final executable, otherwise it is
12458 the basename of the source file. In both cases any suffix is removed
12459 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12460 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12461 @xref{Cross-profiling}.
12462
12463 @cindex @command{gcov}
12464 @item --coverage
12465 @opindex coverage
12466
12467 This option is used to compile and link code instrumented for coverage
12468 analysis. The option is a synonym for @option{-fprofile-arcs}
12469 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12470 linking). See the documentation for those options for more details.
12471
12472 @itemize
12473
12474 @item
12475 Compile the source files with @option{-fprofile-arcs} plus optimization
12476 and code generation options. For test coverage analysis, use the
12477 additional @option{-ftest-coverage} option. You do not need to profile
12478 every source file in a program.
12479
12480 @item
12481 Compile the source files additionally with @option{-fprofile-abs-path}
12482 to create absolute path names in the @file{.gcno} files. This allows
12483 @command{gcov} to find the correct sources in projects where compilations
12484 occur with different working directories.
12485
12486 @item
12487 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12488 (the latter implies the former).
12489
12490 @item
12491 Run the program on a representative workload to generate the arc profile
12492 information. This may be repeated any number of times. You can run
12493 concurrent instances of your program, and provided that the file system
12494 supports locking, the data files will be correctly updated. Unless
12495 a strict ISO C dialect option is in effect, @code{fork} calls are
12496 detected and correctly handled without double counting.
12497
12498 @item
12499 For profile-directed optimizations, compile the source files again with
12500 the same optimization and code generation options plus
12501 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12502 Control Optimization}).
12503
12504 @item
12505 For test coverage analysis, use @command{gcov} to produce human readable
12506 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12507 @command{gcov} documentation for further information.
12508
12509 @end itemize
12510
12511 With @option{-fprofile-arcs}, for each function of your program GCC
12512 creates a program flow graph, then finds a spanning tree for the graph.
12513 Only arcs that are not on the spanning tree have to be instrumented: the
12514 compiler adds code to count the number of times that these arcs are
12515 executed. When an arc is the only exit or only entrance to a block, the
12516 instrumentation code can be added to the block; otherwise, a new basic
12517 block must be created to hold the instrumentation code.
12518
12519 @need 2000
12520 @item -ftest-coverage
12521 @opindex ftest-coverage
12522 Produce a notes file that the @command{gcov} code-coverage utility
12523 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12524 show program coverage. Each source file's note file is called
12525 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12526 above for a description of @var{auxname} and instructions on how to
12527 generate test coverage data. Coverage data matches the source files
12528 more closely if you do not optimize.
12529
12530 @item -fprofile-abs-path
12531 @opindex fprofile-abs-path
12532 Automatically convert relative source file names to absolute path names
12533 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12534 sources in projects where compilations occur with different working
12535 directories.
12536
12537 @item -fprofile-dir=@var{path}
12538 @opindex fprofile-dir
12539
12540 Set the directory to search for the profile data files in to @var{path}.
12541 This option affects only the profile data generated by
12542 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12543 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12544 and its related options. Both absolute and relative paths can be used.
12545 By default, GCC uses the current directory as @var{path}, thus the
12546 profile data file appears in the same directory as the object file.
12547 In order to prevent the file name clashing, if the object file name is
12548 not an absolute path, we mangle the absolute path of the
12549 @file{@var{sourcename}.gcda} file and use it as the file name of a
12550 @file{.gcda} file. See similar option @option{-fprofile-note}.
12551
12552 When an executable is run in a massive parallel environment, it is recommended
12553 to save profile to different folders. That can be done with variables
12554 in @var{path} that are exported during run-time:
12555
12556 @table @gcctabopt
12557
12558 @item %p
12559 process ID.
12560
12561 @item %q@{VAR@}
12562 value of environment variable @var{VAR}
12563
12564 @end table
12565
12566 @item -fprofile-generate
12567 @itemx -fprofile-generate=@var{path}
12568 @opindex fprofile-generate
12569
12570 Enable options usually used for instrumenting application to produce
12571 profile useful for later recompilation with profile feedback based
12572 optimization. You must use @option{-fprofile-generate} both when
12573 compiling and when linking your program.
12574
12575 The following options are enabled:
12576 @option{-fprofile-arcs}, @option{-fprofile-values},
12577 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12578
12579 If @var{path} is specified, GCC looks at the @var{path} to find
12580 the profile feedback data files. See @option{-fprofile-dir}.
12581
12582 To optimize the program based on the collected profile information, use
12583 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12584
12585 @item -fprofile-note=@var{path}
12586 @opindex fprofile-note
12587
12588 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12589 location. If you combine the option with multiple source files,
12590 the @file{.gcno} file will be overwritten.
12591
12592 @item -fprofile-update=@var{method}
12593 @opindex fprofile-update
12594
12595 Alter the update method for an application instrumented for profile
12596 feedback based optimization. The @var{method} argument should be one of
12597 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12598 The first one is useful for single-threaded applications,
12599 while the second one prevents profile corruption by emitting thread-safe code.
12600
12601 @strong{Warning:} When an application does not properly join all threads
12602 (or creates an detached thread), a profile file can be still corrupted.
12603
12604 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12605 when supported by a target, or to @samp{single} otherwise. The GCC driver
12606 automatically selects @samp{prefer-atomic} when @option{-pthread}
12607 is present in the command line.
12608
12609 @item -fprofile-filter-files=@var{regex}
12610 @opindex fprofile-filter-files
12611
12612 Instrument only functions from files where names match
12613 any regular expression (separated by a semi-colon).
12614
12615 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12616 only @file{main.c} and all C files starting with 'module'.
12617
12618 @item -fprofile-exclude-files=@var{regex}
12619 @opindex fprofile-exclude-files
12620
12621 Instrument only functions from files where names do not match
12622 all the regular expressions (separated by a semi-colon).
12623
12624 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12625 of all files that are located in @file{/usr/} folder.
12626
12627 @item -fsanitize=address
12628 @opindex fsanitize=address
12629 Enable AddressSanitizer, a fast memory error detector.
12630 Memory access instructions are instrumented to detect
12631 out-of-bounds and use-after-free bugs.
12632 The option enables @option{-fsanitize-address-use-after-scope}.
12633 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12634 more details. The run-time behavior can be influenced using the
12635 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12636 the available options are shown at startup of the instrumented program. See
12637 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12638 for a list of supported options.
12639 The option cannot be combined with @option{-fsanitize=thread}.
12640
12641 @item -fsanitize=kernel-address
12642 @opindex fsanitize=kernel-address
12643 Enable AddressSanitizer for Linux kernel.
12644 See @uref{https://github.com/google/kasan/wiki} for more details.
12645
12646 @item -fsanitize=pointer-compare
12647 @opindex fsanitize=pointer-compare
12648 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12649 The option must be combined with either @option{-fsanitize=kernel-address} or
12650 @option{-fsanitize=address}
12651 The option cannot be combined with @option{-fsanitize=thread}.
12652 Note: By default the check is disabled at run time. To enable it,
12653 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12654 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12655 invalid operation only when both pointers are non-null.
12656
12657 @item -fsanitize=pointer-subtract
12658 @opindex fsanitize=pointer-subtract
12659 Instrument subtraction with pointer operands.
12660 The option must be combined with either @option{-fsanitize=kernel-address} or
12661 @option{-fsanitize=address}
12662 The option cannot be combined with @option{-fsanitize=thread}.
12663 Note: By default the check is disabled at run time. To enable it,
12664 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12665 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12666 invalid operation only when both pointers are non-null.
12667
12668 @item -fsanitize=thread
12669 @opindex fsanitize=thread
12670 Enable ThreadSanitizer, a fast data race detector.
12671 Memory access instructions are instrumented to detect
12672 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12673 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12674 environment variable; see
12675 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12676 supported options.
12677 The option cannot be combined with @option{-fsanitize=address},
12678 @option{-fsanitize=leak}.
12679
12680 Note that sanitized atomic builtins cannot throw exceptions when
12681 operating on invalid memory addresses with non-call exceptions
12682 (@option{-fnon-call-exceptions}).
12683
12684 @item -fsanitize=leak
12685 @opindex fsanitize=leak
12686 Enable LeakSanitizer, a memory leak detector.
12687 This option only matters for linking of executables and
12688 the executable is linked against a library that overrides @code{malloc}
12689 and other allocator functions. See
12690 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12691 details. The run-time behavior can be influenced using the
12692 @env{LSAN_OPTIONS} environment variable.
12693 The option cannot be combined with @option{-fsanitize=thread}.
12694
12695 @item -fsanitize=undefined
12696 @opindex fsanitize=undefined
12697 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12698 Various computations are instrumented to detect undefined behavior
12699 at runtime. Current suboptions are:
12700
12701 @table @gcctabopt
12702
12703 @item -fsanitize=shift
12704 @opindex fsanitize=shift
12705 This option enables checking that the result of a shift operation is
12706 not undefined. Note that what exactly is considered undefined differs
12707 slightly between C and C++, as well as between ISO C90 and C99, etc.
12708 This option has two suboptions, @option{-fsanitize=shift-base} and
12709 @option{-fsanitize=shift-exponent}.
12710
12711 @item -fsanitize=shift-exponent
12712 @opindex fsanitize=shift-exponent
12713 This option enables checking that the second argument of a shift operation
12714 is not negative and is smaller than the precision of the promoted first
12715 argument.
12716
12717 @item -fsanitize=shift-base
12718 @opindex fsanitize=shift-base
12719 If the second argument of a shift operation is within range, check that the
12720 result of a shift operation is not undefined. Note that what exactly is
12721 considered undefined differs slightly between C and C++, as well as between
12722 ISO C90 and C99, etc.
12723
12724 @item -fsanitize=integer-divide-by-zero
12725 @opindex fsanitize=integer-divide-by-zero
12726 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12727
12728 @item -fsanitize=unreachable
12729 @opindex fsanitize=unreachable
12730 With this option, the compiler turns the @code{__builtin_unreachable}
12731 call into a diagnostics message call instead. When reaching the
12732 @code{__builtin_unreachable} call, the behavior is undefined.
12733
12734 @item -fsanitize=vla-bound
12735 @opindex fsanitize=vla-bound
12736 This option instructs the compiler to check that the size of a variable
12737 length array is positive.
12738
12739 @item -fsanitize=null
12740 @opindex fsanitize=null
12741 This option enables pointer checking. Particularly, the application
12742 built with this option turned on will issue an error message when it
12743 tries to dereference a NULL pointer, or if a reference (possibly an
12744 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12745 on an object pointed by a NULL pointer.
12746
12747 @item -fsanitize=return
12748 @opindex fsanitize=return
12749 This option enables return statement checking. Programs
12750 built with this option turned on will issue an error message
12751 when the end of a non-void function is reached without actually
12752 returning a value. This option works in C++ only.
12753
12754 @item -fsanitize=signed-integer-overflow
12755 @opindex fsanitize=signed-integer-overflow
12756 This option enables signed integer overflow checking. We check that
12757 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12758 does not overflow in the signed arithmetics. Note, integer promotion
12759 rules must be taken into account. That is, the following is not an
12760 overflow:
12761 @smallexample
12762 signed char a = SCHAR_MAX;
12763 a++;
12764 @end smallexample
12765
12766 @item -fsanitize=bounds
12767 @opindex fsanitize=bounds
12768 This option enables instrumentation of array bounds. Various out of bounds
12769 accesses are detected. Flexible array members, flexible array member-like
12770 arrays, and initializers of variables with static storage are not instrumented.
12771
12772 @item -fsanitize=bounds-strict
12773 @opindex fsanitize=bounds-strict
12774 This option enables strict instrumentation of array bounds. Most out of bounds
12775 accesses are detected, including flexible array members and flexible array
12776 member-like arrays. Initializers of variables with static storage are not
12777 instrumented.
12778
12779 @item -fsanitize=alignment
12780 @opindex fsanitize=alignment
12781
12782 This option enables checking of alignment of pointers when they are
12783 dereferenced, or when a reference is bound to insufficiently aligned target,
12784 or when a method or constructor is invoked on insufficiently aligned object.
12785
12786 @item -fsanitize=object-size
12787 @opindex fsanitize=object-size
12788 This option enables instrumentation of memory references using the
12789 @code{__builtin_object_size} function. Various out of bounds pointer
12790 accesses are detected.
12791
12792 @item -fsanitize=float-divide-by-zero
12793 @opindex fsanitize=float-divide-by-zero
12794 Detect floating-point division by zero. Unlike other similar options,
12795 @option{-fsanitize=float-divide-by-zero} is not enabled by
12796 @option{-fsanitize=undefined}, since floating-point division by zero can
12797 be a legitimate way of obtaining infinities and NaNs.
12798
12799 @item -fsanitize=float-cast-overflow
12800 @opindex fsanitize=float-cast-overflow
12801 This option enables floating-point type to integer conversion checking.
12802 We check that the result of the conversion does not overflow.
12803 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12804 not enabled by @option{-fsanitize=undefined}.
12805 This option does not work well with @code{FE_INVALID} exceptions enabled.
12806
12807 @item -fsanitize=nonnull-attribute
12808 @opindex fsanitize=nonnull-attribute
12809
12810 This option enables instrumentation of calls, checking whether null values
12811 are not passed to arguments marked as requiring a non-null value by the
12812 @code{nonnull} function attribute.
12813
12814 @item -fsanitize=returns-nonnull-attribute
12815 @opindex fsanitize=returns-nonnull-attribute
12816
12817 This option enables instrumentation of return statements in functions
12818 marked with @code{returns_nonnull} function attribute, to detect returning
12819 of null values from such functions.
12820
12821 @item -fsanitize=bool
12822 @opindex fsanitize=bool
12823
12824 This option enables instrumentation of loads from bool. If a value other
12825 than 0/1 is loaded, a run-time error is issued.
12826
12827 @item -fsanitize=enum
12828 @opindex fsanitize=enum
12829
12830 This option enables instrumentation of loads from an enum type. If
12831 a value outside the range of values for the enum type is loaded,
12832 a run-time error is issued.
12833
12834 @item -fsanitize=vptr
12835 @opindex fsanitize=vptr
12836
12837 This option enables instrumentation of C++ member function calls, member
12838 accesses and some conversions between pointers to base and derived classes,
12839 to verify the referenced object has the correct dynamic type.
12840
12841 @item -fsanitize=pointer-overflow
12842 @opindex fsanitize=pointer-overflow
12843
12844 This option enables instrumentation of pointer arithmetics. If the pointer
12845 arithmetics overflows, a run-time error is issued.
12846
12847 @item -fsanitize=builtin
12848 @opindex fsanitize=builtin
12849
12850 This option enables instrumentation of arguments to selected builtin
12851 functions. If an invalid value is passed to such arguments, a run-time
12852 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12853 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12854 by this option.
12855
12856 @end table
12857
12858 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12859 @option{-fsanitize=undefined} gives a diagnostic message.
12860 This currently works only for the C family of languages.
12861
12862 @item -fno-sanitize=all
12863 @opindex fno-sanitize=all
12864
12865 This option disables all previously enabled sanitizers.
12866 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12867 together.
12868
12869 @item -fasan-shadow-offset=@var{number}
12870 @opindex fasan-shadow-offset
12871 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12872 It is useful for experimenting with different shadow memory layouts in
12873 Kernel AddressSanitizer.
12874
12875 @item -fsanitize-sections=@var{s1},@var{s2},...
12876 @opindex fsanitize-sections
12877 Sanitize global variables in selected user-defined sections. @var{si} may
12878 contain wildcards.
12879
12880 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12881 @opindex fsanitize-recover
12882 @opindex fno-sanitize-recover
12883 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12884 mentioned in comma-separated list of @var{opts}. Enabling this option
12885 for a sanitizer component causes it to attempt to continue
12886 running the program as if no error happened. This means multiple
12887 runtime errors can be reported in a single program run, and the exit
12888 code of the program may indicate success even when errors
12889 have been reported. The @option{-fno-sanitize-recover=} option
12890 can be used to alter
12891 this behavior: only the first detected error is reported
12892 and program then exits with a non-zero exit code.
12893
12894 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12895 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12896 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12897 @option{-fsanitize=bounds-strict},
12898 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12899 For these sanitizers error recovery is turned on by default,
12900 except @option{-fsanitize=address}, for which this feature is experimental.
12901 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12902 accepted, the former enables recovery for all sanitizers that support it,
12903 the latter disables recovery for all sanitizers that support it.
12904
12905 Even if a recovery mode is turned on the compiler side, it needs to be also
12906 enabled on the runtime library side, otherwise the failures are still fatal.
12907 The runtime library defaults to @code{halt_on_error=0} for
12908 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12909 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12910 setting the @code{halt_on_error} flag in the corresponding environment variable.
12911
12912 Syntax without an explicit @var{opts} parameter is deprecated. It is
12913 equivalent to specifying an @var{opts} list of:
12914
12915 @smallexample
12916 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12917 @end smallexample
12918
12919 @item -fsanitize-address-use-after-scope
12920 @opindex fsanitize-address-use-after-scope
12921 Enable sanitization of local variables to detect use-after-scope bugs.
12922 The option sets @option{-fstack-reuse} to @samp{none}.
12923
12924 @item -fsanitize-undefined-trap-on-error
12925 @opindex fsanitize-undefined-trap-on-error
12926 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12927 report undefined behavior using @code{__builtin_trap} rather than
12928 a @code{libubsan} library routine. The advantage of this is that the
12929 @code{libubsan} library is not needed and is not linked in, so this
12930 is usable even in freestanding environments.
12931
12932 @item -fsanitize-coverage=trace-pc
12933 @opindex fsanitize-coverage=trace-pc
12934 Enable coverage-guided fuzzing code instrumentation.
12935 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12936
12937 @item -fsanitize-coverage=trace-cmp
12938 @opindex fsanitize-coverage=trace-cmp
12939 Enable dataflow guided fuzzing code instrumentation.
12940 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12941 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12942 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12943 variable or @code{__sanitizer_cov_trace_const_cmp1},
12944 @code{__sanitizer_cov_trace_const_cmp2},
12945 @code{__sanitizer_cov_trace_const_cmp4} or
12946 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12947 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12948 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12949 @code{__sanitizer_cov_trace_switch} for switch statements.
12950
12951 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12952 @opindex fcf-protection
12953 Enable code instrumentation of control-flow transfers to increase
12954 program security by checking that target addresses of control-flow
12955 transfer instructions (such as indirect function call, function return,
12956 indirect jump) are valid. This prevents diverting the flow of control
12957 to an unexpected target. This is intended to protect against such
12958 threats as Return-oriented Programming (ROP), and similarly
12959 call/jmp-oriented programming (COP/JOP).
12960
12961 The value @code{branch} tells the compiler to implement checking of
12962 validity of control-flow transfer at the point of indirect branch
12963 instructions, i.e.@: call/jmp instructions. The value @code{return}
12964 implements checking of validity at the point of returning from a
12965 function. The value @code{full} is an alias for specifying both
12966 @code{branch} and @code{return}. The value @code{none} turns off
12967 instrumentation.
12968
12969 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12970 used. The first bit of @code{__CET__} is set to 1 for the value
12971 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12972 the @code{return}.
12973
12974 You can also use the @code{nocf_check} attribute to identify
12975 which functions and calls should be skipped from instrumentation
12976 (@pxref{Function Attributes}).
12977
12978 Currently the x86 GNU/Linux target provides an implementation based
12979 on Intel Control-flow Enforcement Technology (CET).
12980
12981 @item -fstack-protector
12982 @opindex fstack-protector
12983 Emit extra code to check for buffer overflows, such as stack smashing
12984 attacks. This is done by adding a guard variable to functions with
12985 vulnerable objects. This includes functions that call @code{alloca}, and
12986 functions with buffers larger than 8 bytes. The guards are initialized
12987 when a function is entered and then checked when the function exits.
12988 If a guard check fails, an error message is printed and the program exits.
12989
12990 @item -fstack-protector-all
12991 @opindex fstack-protector-all
12992 Like @option{-fstack-protector} except that all functions are protected.
12993
12994 @item -fstack-protector-strong
12995 @opindex fstack-protector-strong
12996 Like @option{-fstack-protector} but includes additional functions to
12997 be protected --- those that have local array definitions, or have
12998 references to local frame addresses.
12999
13000 @item -fstack-protector-explicit
13001 @opindex fstack-protector-explicit
13002 Like @option{-fstack-protector} but only protects those functions which
13003 have the @code{stack_protect} attribute.
13004
13005 @item -fstack-check
13006 @opindex fstack-check
13007 Generate code to verify that you do not go beyond the boundary of the
13008 stack. You should specify this flag if you are running in an
13009 environment with multiple threads, but you only rarely need to specify it in
13010 a single-threaded environment since stack overflow is automatically
13011 detected on nearly all systems if there is only one stack.
13012
13013 Note that this switch does not actually cause checking to be done; the
13014 operating system or the language runtime must do that. The switch causes
13015 generation of code to ensure that they see the stack being extended.
13016
13017 You can additionally specify a string parameter: @samp{no} means no
13018 checking, @samp{generic} means force the use of old-style checking,
13019 @samp{specific} means use the best checking method and is equivalent
13020 to bare @option{-fstack-check}.
13021
13022 Old-style checking is a generic mechanism that requires no specific
13023 target support in the compiler but comes with the following drawbacks:
13024
13025 @enumerate
13026 @item
13027 Modified allocation strategy for large objects: they are always
13028 allocated dynamically if their size exceeds a fixed threshold. Note this
13029 may change the semantics of some code.
13030
13031 @item
13032 Fixed limit on the size of the static frame of functions: when it is
13033 topped by a particular function, stack checking is not reliable and
13034 a warning is issued by the compiler.
13035
13036 @item
13037 Inefficiency: because of both the modified allocation strategy and the
13038 generic implementation, code performance is hampered.
13039 @end enumerate
13040
13041 Note that old-style stack checking is also the fallback method for
13042 @samp{specific} if no target support has been added in the compiler.
13043
13044 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13045 and stack overflows. @samp{specific} is an excellent choice when compiling
13046 Ada code. It is not generally sufficient to protect against stack-clash
13047 attacks. To protect against those you want @samp{-fstack-clash-protection}.
13048
13049 @item -fstack-clash-protection
13050 @opindex fstack-clash-protection
13051 Generate code to prevent stack clash style attacks. When this option is
13052 enabled, the compiler will only allocate one page of stack space at a time
13053 and each page is accessed immediately after allocation. Thus, it prevents
13054 allocations from jumping over any stack guard page provided by the
13055 operating system.
13056
13057 Most targets do not fully support stack clash protection. However, on
13058 those targets @option{-fstack-clash-protection} will protect dynamic stack
13059 allocations. @option{-fstack-clash-protection} may also provide limited
13060 protection for static stack allocations if the target supports
13061 @option{-fstack-check=specific}.
13062
13063 @item -fstack-limit-register=@var{reg}
13064 @itemx -fstack-limit-symbol=@var{sym}
13065 @itemx -fno-stack-limit
13066 @opindex fstack-limit-register
13067 @opindex fstack-limit-symbol
13068 @opindex fno-stack-limit
13069 Generate code to ensure that the stack does not grow beyond a certain value,
13070 either the value of a register or the address of a symbol. If a larger
13071 stack is required, a signal is raised at run time. For most targets,
13072 the signal is raised before the stack overruns the boundary, so
13073 it is possible to catch the signal without taking special precautions.
13074
13075 For instance, if the stack starts at absolute address @samp{0x80000000}
13076 and grows downwards, you can use the flags
13077 @option{-fstack-limit-symbol=__stack_limit} and
13078 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13079 of 128KB@. Note that this may only work with the GNU linker.
13080
13081 You can locally override stack limit checking by using the
13082 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13083
13084 @item -fsplit-stack
13085 @opindex fsplit-stack
13086 Generate code to automatically split the stack before it overflows.
13087 The resulting program has a discontiguous stack which can only
13088 overflow if the program is unable to allocate any more memory. This
13089 is most useful when running threaded programs, as it is no longer
13090 necessary to calculate a good stack size to use for each thread. This
13091 is currently only implemented for the x86 targets running
13092 GNU/Linux.
13093
13094 When code compiled with @option{-fsplit-stack} calls code compiled
13095 without @option{-fsplit-stack}, there may not be much stack space
13096 available for the latter code to run. If compiling all code,
13097 including library code, with @option{-fsplit-stack} is not an option,
13098 then the linker can fix up these calls so that the code compiled
13099 without @option{-fsplit-stack} always has a large stack. Support for
13100 this is implemented in the gold linker in GNU binutils release 2.21
13101 and later.
13102
13103 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13104 @opindex fvtable-verify
13105 This option is only available when compiling C++ code.
13106 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13107 feature that verifies at run time, for every virtual call, that
13108 the vtable pointer through which the call is made is valid for the type of
13109 the object, and has not been corrupted or overwritten. If an invalid vtable
13110 pointer is detected at run time, an error is reported and execution of the
13111 program is immediately halted.
13112
13113 This option causes run-time data structures to be built at program startup,
13114 which are used for verifying the vtable pointers.
13115 The options @samp{std} and @samp{preinit}
13116 control the timing of when these data structures are built. In both cases the
13117 data structures are built before execution reaches @code{main}. Using
13118 @option{-fvtable-verify=std} causes the data structures to be built after
13119 shared libraries have been loaded and initialized.
13120 @option{-fvtable-verify=preinit} causes them to be built before shared
13121 libraries have been loaded and initialized.
13122
13123 If this option appears multiple times in the command line with different
13124 values specified, @samp{none} takes highest priority over both @samp{std} and
13125 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13126
13127 @item -fvtv-debug
13128 @opindex fvtv-debug
13129 When used in conjunction with @option{-fvtable-verify=std} or
13130 @option{-fvtable-verify=preinit}, causes debug versions of the
13131 runtime functions for the vtable verification feature to be called.
13132 This flag also causes the compiler to log information about which
13133 vtable pointers it finds for each class.
13134 This information is written to a file named @file{vtv_set_ptr_data.log}
13135 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13136 if that is defined or the current working directory otherwise.
13137
13138 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13139 file, be sure to delete any existing one.
13140
13141 @item -fvtv-counts
13142 @opindex fvtv-counts
13143 This is a debugging flag. When used in conjunction with
13144 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13145 causes the compiler to keep track of the total number of virtual calls
13146 it encounters and the number of verifications it inserts. It also
13147 counts the number of calls to certain run-time library functions
13148 that it inserts and logs this information for each compilation unit.
13149 The compiler writes this information to a file named
13150 @file{vtv_count_data.log} in the directory named by the environment
13151 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13152 directory otherwise. It also counts the size of the vtable pointer sets
13153 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13154 in the same directory.
13155
13156 Note: This feature @emph{appends} data to the log files. To get fresh log
13157 files, be sure to delete any existing ones.
13158
13159 @item -finstrument-functions
13160 @opindex finstrument-functions
13161 Generate instrumentation calls for entry and exit to functions. Just
13162 after function entry and just before function exit, the following
13163 profiling functions are called with the address of the current
13164 function and its call site. (On some platforms,
13165 @code{__builtin_return_address} does not work beyond the current
13166 function, so the call site information may not be available to the
13167 profiling functions otherwise.)
13168
13169 @smallexample
13170 void __cyg_profile_func_enter (void *this_fn,
13171 void *call_site);
13172 void __cyg_profile_func_exit (void *this_fn,
13173 void *call_site);
13174 @end smallexample
13175
13176 The first argument is the address of the start of the current function,
13177 which may be looked up exactly in the symbol table.
13178
13179 This instrumentation is also done for functions expanded inline in other
13180 functions. The profiling calls indicate where, conceptually, the
13181 inline function is entered and exited. This means that addressable
13182 versions of such functions must be available. If all your uses of a
13183 function are expanded inline, this may mean an additional expansion of
13184 code size. If you use @code{extern inline} in your C code, an
13185 addressable version of such functions must be provided. (This is
13186 normally the case anyway, but if you get lucky and the optimizer always
13187 expands the functions inline, you might have gotten away without
13188 providing static copies.)
13189
13190 A function may be given the attribute @code{no_instrument_function}, in
13191 which case this instrumentation is not done. This can be used, for
13192 example, for the profiling functions listed above, high-priority
13193 interrupt routines, and any functions from which the profiling functions
13194 cannot safely be called (perhaps signal handlers, if the profiling
13195 routines generate output or allocate memory).
13196 @xref{Common Function Attributes}.
13197
13198 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13199 @opindex finstrument-functions-exclude-file-list
13200
13201 Set the list of functions that are excluded from instrumentation (see
13202 the description of @option{-finstrument-functions}). If the file that
13203 contains a function definition matches with one of @var{file}, then
13204 that function is not instrumented. The match is done on substrings:
13205 if the @var{file} parameter is a substring of the file name, it is
13206 considered to be a match.
13207
13208 For example:
13209
13210 @smallexample
13211 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13212 @end smallexample
13213
13214 @noindent
13215 excludes any inline function defined in files whose pathnames
13216 contain @file{/bits/stl} or @file{include/sys}.
13217
13218 If, for some reason, you want to include letter @samp{,} in one of
13219 @var{sym}, write @samp{\,}. For example,
13220 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13221 (note the single quote surrounding the option).
13222
13223 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13224 @opindex finstrument-functions-exclude-function-list
13225
13226 This is similar to @option{-finstrument-functions-exclude-file-list},
13227 but this option sets the list of function names to be excluded from
13228 instrumentation. The function name to be matched is its user-visible
13229 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13230 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13231 match is done on substrings: if the @var{sym} parameter is a substring
13232 of the function name, it is considered to be a match. For C99 and C++
13233 extended identifiers, the function name must be given in UTF-8, not
13234 using universal character names.
13235
13236 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13237 @opindex fpatchable-function-entry
13238 Generate @var{N} NOPs right at the beginning
13239 of each function, with the function entry point before the @var{M}th NOP.
13240 If @var{M} is omitted, it defaults to @code{0} so the
13241 function entry points to the address just at the first NOP.
13242 The NOP instructions reserve extra space which can be used to patch in
13243 any desired instrumentation at run time, provided that the code segment
13244 is writable. The amount of space is controllable indirectly via
13245 the number of NOPs; the NOP instruction used corresponds to the instruction
13246 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13247 is target-specific and may also depend on the architecture variant and/or
13248 other compilation options.
13249
13250 For run-time identification, the starting addresses of these areas,
13251 which correspond to their respective function entries minus @var{M},
13252 are additionally collected in the @code{__patchable_function_entries}
13253 section of the resulting binary.
13254
13255 Note that the value of @code{__attribute__ ((patchable_function_entry
13256 (N,M)))} takes precedence over command-line option
13257 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13258 the area size or to remove it completely on a single function.
13259 If @code{N=0}, no pad location is recorded.
13260
13261 The NOP instructions are inserted at---and maybe before, depending on
13262 @var{M}---the function entry address, even before the prologue.
13263
13264 @end table
13265
13266
13267 @node Preprocessor Options
13268 @section Options Controlling the Preprocessor
13269 @cindex preprocessor options
13270 @cindex options, preprocessor
13271
13272 These options control the C preprocessor, which is run on each C source
13273 file before actual compilation.
13274
13275 If you use the @option{-E} option, nothing is done except preprocessing.
13276 Some of these options make sense only together with @option{-E} because
13277 they cause the preprocessor output to be unsuitable for actual
13278 compilation.
13279
13280 In addition to the options listed here, there are a number of options
13281 to control search paths for include files documented in
13282 @ref{Directory Options}.
13283 Options to control preprocessor diagnostics are listed in
13284 @ref{Warning Options}.
13285
13286 @table @gcctabopt
13287 @include cppopts.texi
13288
13289 @item -Wp,@var{option}
13290 @opindex Wp
13291 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13292 and pass @var{option} directly through to the preprocessor. If
13293 @var{option} contains commas, it is split into multiple options at the
13294 commas. However, many options are modified, translated or interpreted
13295 by the compiler driver before being passed to the preprocessor, and
13296 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13297 interface is undocumented and subject to change, so whenever possible
13298 you should avoid using @option{-Wp} and let the driver handle the
13299 options instead.
13300
13301 @item -Xpreprocessor @var{option}
13302 @opindex Xpreprocessor
13303 Pass @var{option} as an option to the preprocessor. You can use this to
13304 supply system-specific preprocessor options that GCC does not
13305 recognize.
13306
13307 If you want to pass an option that takes an argument, you must use
13308 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13309
13310 @item -no-integrated-cpp
13311 @opindex no-integrated-cpp
13312 Perform preprocessing as a separate pass before compilation.
13313 By default, GCC performs preprocessing as an integrated part of
13314 input tokenization and parsing.
13315 If this option is provided, the appropriate language front end
13316 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13317 and Objective-C, respectively) is instead invoked twice,
13318 once for preprocessing only and once for actual compilation
13319 of the preprocessed input.
13320 This option may be useful in conjunction with the @option{-B} or
13321 @option{-wrapper} options to specify an alternate preprocessor or
13322 perform additional processing of the program source between
13323 normal preprocessing and compilation.
13324
13325 @end table
13326
13327 @node Assembler Options
13328 @section Passing Options to the Assembler
13329
13330 @c prevent bad page break with this line
13331 You can pass options to the assembler.
13332
13333 @table @gcctabopt
13334 @item -Wa,@var{option}
13335 @opindex Wa
13336 Pass @var{option} as an option to the assembler. If @var{option}
13337 contains commas, it is split into multiple options at the commas.
13338
13339 @item -Xassembler @var{option}
13340 @opindex Xassembler
13341 Pass @var{option} as an option to the assembler. You can use this to
13342 supply system-specific assembler options that GCC does not
13343 recognize.
13344
13345 If you want to pass an option that takes an argument, you must use
13346 @option{-Xassembler} twice, once for the option and once for the argument.
13347
13348 @end table
13349
13350 @node Link Options
13351 @section Options for Linking
13352 @cindex link options
13353 @cindex options, linking
13354
13355 These options come into play when the compiler links object files into
13356 an executable output file. They are meaningless if the compiler is
13357 not doing a link step.
13358
13359 @table @gcctabopt
13360 @cindex file names
13361 @item @var{object-file-name}
13362 A file name that does not end in a special recognized suffix is
13363 considered to name an object file or library. (Object files are
13364 distinguished from libraries by the linker according to the file
13365 contents.) If linking is done, these object files are used as input
13366 to the linker.
13367
13368 @item -c
13369 @itemx -S
13370 @itemx -E
13371 @opindex c
13372 @opindex S
13373 @opindex E
13374 If any of these options is used, then the linker is not run, and
13375 object file names should not be used as arguments. @xref{Overall
13376 Options}.
13377
13378 @item -flinker-output=@var{type}
13379 @opindex flinker-output
13380 This option controls code generation of the link-time optimizer. By
13381 default the linker output is automatically determined by the linker
13382 plugin. For debugging the compiler and if incremental linking with a
13383 non-LTO object file is desired, it may be useful to control the type
13384 manually.
13385
13386 If @var{type} is @samp{exec}, code generation produces a static
13387 binary. In this case @option{-fpic} and @option{-fpie} are both
13388 disabled.
13389
13390 If @var{type} is @samp{dyn}, code generation produces a shared
13391 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13392 but not enabled automatically. This allows to build shared libraries
13393 without position-independent code on architectures where this is
13394 possible, i.e.@: on x86.
13395
13396 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13397 executable. This results in similar optimizations as @samp{exec}
13398 except that @option{-fpie} is not disabled if specified at compilation
13399 time.
13400
13401 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13402 done. The sections containing intermediate code for link-time optimization are
13403 merged, pre-optimized, and output to the resulting object file. In addition, if
13404 @option{-ffat-lto-objects} is specified, binary code is produced for future
13405 non-LTO linking. The object file produced by incremental linking is smaller
13406 than a static library produced from the same object files. At link time the
13407 result of incremental linking also loads faster than a static
13408 library assuming that the majority of objects in the library are used.
13409
13410 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13411 code generation is forced, a final binary is produced, and the intermediate
13412 code for later link-time optimization is stripped. When multiple object files
13413 are linked together the resulting code is better optimized than with
13414 link-time optimizations disabled (for example, cross-module inlining
13415 happens), but most of benefits of whole program optimizations are lost.
13416
13417 During the incremental link (by @option{-r}) the linker plugin defaults to
13418 @option{rel}. With current interfaces to GNU Binutils it is however not
13419 possible to incrementally link LTO objects and non-LTO objects into a single
13420 mixed object file. If any of object files in incremental link cannot
13421 be used for link-time optimization, the linker plugin issues a warning and
13422 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13423 recommended to link such objects into static library instead. Alternatively it
13424 is possible to use H.J. Lu's binutils with support for mixed objects.
13425
13426 @item -fuse-ld=bfd
13427 @opindex fuse-ld=bfd
13428 Use the @command{bfd} linker instead of the default linker.
13429
13430 @item -fuse-ld=gold
13431 @opindex fuse-ld=gold
13432 Use the @command{gold} linker instead of the default linker.
13433
13434 @item -fuse-ld=lld
13435 @opindex fuse-ld=lld
13436 Use the LLVM @command{lld} linker instead of the default linker.
13437
13438 @cindex Libraries
13439 @item -l@var{library}
13440 @itemx -l @var{library}
13441 @opindex l
13442 Search the library named @var{library} when linking. (The second
13443 alternative with the library as a separate argument is only for
13444 POSIX compliance and is not recommended.)
13445
13446 The @option{-l} option is passed directly to the linker by GCC. Refer
13447 to your linker documentation for exact details. The general
13448 description below applies to the GNU linker.
13449
13450 The linker searches a standard list of directories for the library.
13451 The directories searched include several standard system directories
13452 plus any that you specify with @option{-L}.
13453
13454 Static libraries are archives of object files, and have file names
13455 like @file{lib@var{library}.a}. Some targets also support shared
13456 libraries, which typically have names like @file{lib@var{library}.so}.
13457 If both static and shared libraries are found, the linker gives
13458 preference to linking with the shared library unless the
13459 @option{-static} option is used.
13460
13461 It makes a difference where in the command you write this option; the
13462 linker searches and processes libraries and object files in the order they
13463 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13464 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13465 to functions in @samp{z}, those functions may not be loaded.
13466
13467 @item -lobjc
13468 @opindex lobjc
13469 You need this special case of the @option{-l} option in order to
13470 link an Objective-C or Objective-C++ program.
13471
13472 @item -nostartfiles
13473 @opindex nostartfiles
13474 Do not use the standard system startup files when linking.
13475 The standard system libraries are used normally, unless @option{-nostdlib},
13476 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13477
13478 @item -nodefaultlibs
13479 @opindex nodefaultlibs
13480 Do not use the standard system libraries when linking.
13481 Only the libraries you specify are passed to the linker, and options
13482 specifying linkage of the system libraries, such as @option{-static-libgcc}
13483 or @option{-shared-libgcc}, are ignored.
13484 The standard startup files are used normally, unless @option{-nostartfiles}
13485 is used.
13486
13487 The compiler may generate calls to @code{memcmp},
13488 @code{memset}, @code{memcpy} and @code{memmove}.
13489 These entries are usually resolved by entries in
13490 libc. These entry points should be supplied through some other
13491 mechanism when this option is specified.
13492
13493 @item -nolibc
13494 @opindex nolibc
13495 Do not use the C library or system libraries tightly coupled with it when
13496 linking. Still link with the startup files, @file{libgcc} or toolchain
13497 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13498 or @file{libstdc++} unless options preventing their inclusion are used as
13499 well. This typically removes @option{-lc} from the link command line, as well
13500 as system libraries that normally go with it and become meaningless when
13501 absence of a C library is assumed, for example @option{-lpthread} or
13502 @option{-lm} in some configurations. This is intended for bare-board
13503 targets when there is indeed no C library available.
13504
13505 @item -nostdlib
13506 @opindex nostdlib
13507 Do not use the standard system startup files or libraries when linking.
13508 No startup files and only the libraries you specify are passed to
13509 the linker, and options specifying linkage of the system libraries, such as
13510 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13511
13512 The compiler may generate calls to @code{memcmp}, @code{memset},
13513 @code{memcpy} and @code{memmove}.
13514 These entries are usually resolved by entries in
13515 libc. These entry points should be supplied through some other
13516 mechanism when this option is specified.
13517
13518 @cindex @option{-lgcc}, use with @option{-nostdlib}
13519 @cindex @option{-nostdlib} and unresolved references
13520 @cindex unresolved references and @option{-nostdlib}
13521 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13522 @cindex @option{-nodefaultlibs} and unresolved references
13523 @cindex unresolved references and @option{-nodefaultlibs}
13524 One of the standard libraries bypassed by @option{-nostdlib} and
13525 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13526 which GCC uses to overcome shortcomings of particular machines, or special
13527 needs for some languages.
13528 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13529 Collection (GCC) Internals},
13530 for more discussion of @file{libgcc.a}.)
13531 In most cases, you need @file{libgcc.a} even when you want to avoid
13532 other standard libraries. In other words, when you specify @option{-nostdlib}
13533 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13534 This ensures that you have no unresolved references to internal GCC
13535 library subroutines.
13536 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13537 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13538 GNU Compiler Collection (GCC) Internals}.)
13539
13540 @item -e @var{entry}
13541 @itemx --entry=@var{entry}
13542 @opindex e
13543 @opindex entry
13544
13545 Specify that the program entry point is @var{entry}. The argument is
13546 interpreted by the linker; the GNU linker accepts either a symbol name
13547 or an address.
13548
13549 @item -pie
13550 @opindex pie
13551 Produce a dynamically linked position independent executable on targets
13552 that support it. For predictable results, you must also specify the same
13553 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13554 or model suboptions) when you specify this linker option.
13555
13556 @item -no-pie
13557 @opindex no-pie
13558 Don't produce a dynamically linked position independent executable.
13559
13560 @item -static-pie
13561 @opindex static-pie
13562 Produce a static position independent executable on targets that support
13563 it. A static position independent executable is similar to a static
13564 executable, but can be loaded at any address without a dynamic linker.
13565 For predictable results, you must also specify the same set of options
13566 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13567 suboptions) when you specify this linker option.
13568
13569 @item -pthread
13570 @opindex pthread
13571 Link with the POSIX threads library. This option is supported on
13572 GNU/Linux targets, most other Unix derivatives, and also on
13573 x86 Cygwin and MinGW targets. On some targets this option also sets
13574 flags for the preprocessor, so it should be used consistently for both
13575 compilation and linking.
13576
13577 @item -r
13578 @opindex r
13579 Produce a relocatable object as output. This is also known as partial
13580 linking.
13581
13582 @item -rdynamic
13583 @opindex rdynamic
13584 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13585 that support it. This instructs the linker to add all symbols, not
13586 only used ones, to the dynamic symbol table. This option is needed
13587 for some uses of @code{dlopen} or to allow obtaining backtraces
13588 from within a program.
13589
13590 @item -s
13591 @opindex s
13592 Remove all symbol table and relocation information from the executable.
13593
13594 @item -static
13595 @opindex static
13596 On systems that support dynamic linking, this overrides @option{-pie}
13597 and prevents linking with the shared libraries. On other systems, this
13598 option has no effect.
13599
13600 @item -shared
13601 @opindex shared
13602 Produce a shared object which can then be linked with other objects to
13603 form an executable. Not all systems support this option. For predictable
13604 results, you must also specify the same set of options used for compilation
13605 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13606 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13607 needs to build supplementary stub code for constructors to work. On
13608 multi-libbed systems, @samp{gcc -shared} must select the correct support
13609 libraries to link against. Failing to supply the correct flags may lead
13610 to subtle defects. Supplying them in cases where they are not necessary
13611 is innocuous.}
13612
13613 @item -shared-libgcc
13614 @itemx -static-libgcc
13615 @opindex shared-libgcc
13616 @opindex static-libgcc
13617 On systems that provide @file{libgcc} as a shared library, these options
13618 force the use of either the shared or static version, respectively.
13619 If no shared version of @file{libgcc} was built when the compiler was
13620 configured, these options have no effect.
13621
13622 There are several situations in which an application should use the
13623 shared @file{libgcc} instead of the static version. The most common
13624 of these is when the application wishes to throw and catch exceptions
13625 across different shared libraries. In that case, each of the libraries
13626 as well as the application itself should use the shared @file{libgcc}.
13627
13628 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13629 whenever you build a shared library or a main executable, because C++
13630 programs typically use exceptions, so this is the right thing to do.
13631
13632 If, instead, you use the GCC driver to create shared libraries, you may
13633 find that they are not always linked with the shared @file{libgcc}.
13634 If GCC finds, at its configuration time, that you have a non-GNU linker
13635 or a GNU linker that does not support option @option{--eh-frame-hdr},
13636 it links the shared version of @file{libgcc} into shared libraries
13637 by default. Otherwise, it takes advantage of the linker and optimizes
13638 away the linking with the shared version of @file{libgcc}, linking with
13639 the static version of libgcc by default. This allows exceptions to
13640 propagate through such shared libraries, without incurring relocation
13641 costs at library load time.
13642
13643 However, if a library or main executable is supposed to throw or catch
13644 exceptions, you must link it using the G++ driver, or using the option
13645 @option{-shared-libgcc}, such that it is linked with the shared
13646 @file{libgcc}.
13647
13648 @item -static-libasan
13649 @opindex static-libasan
13650 When the @option{-fsanitize=address} option is used to link a program,
13651 the GCC driver automatically links against @option{libasan}. If
13652 @file{libasan} is available as a shared library, and the @option{-static}
13653 option is not used, then this links against the shared version of
13654 @file{libasan}. The @option{-static-libasan} option directs the GCC
13655 driver to link @file{libasan} statically, without necessarily linking
13656 other libraries statically.
13657
13658 @item -static-libtsan
13659 @opindex static-libtsan
13660 When the @option{-fsanitize=thread} option is used to link a program,
13661 the GCC driver automatically links against @option{libtsan}. If
13662 @file{libtsan} is available as a shared library, and the @option{-static}
13663 option is not used, then this links against the shared version of
13664 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13665 driver to link @file{libtsan} statically, without necessarily linking
13666 other libraries statically.
13667
13668 @item -static-liblsan
13669 @opindex static-liblsan
13670 When the @option{-fsanitize=leak} option is used to link a program,
13671 the GCC driver automatically links against @option{liblsan}. If
13672 @file{liblsan} is available as a shared library, and the @option{-static}
13673 option is not used, then this links against the shared version of
13674 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13675 driver to link @file{liblsan} statically, without necessarily linking
13676 other libraries statically.
13677
13678 @item -static-libubsan
13679 @opindex static-libubsan
13680 When the @option{-fsanitize=undefined} option is used to link a program,
13681 the GCC driver automatically links against @option{libubsan}. If
13682 @file{libubsan} is available as a shared library, and the @option{-static}
13683 option is not used, then this links against the shared version of
13684 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13685 driver to link @file{libubsan} statically, without necessarily linking
13686 other libraries statically.
13687
13688 @item -static-libstdc++
13689 @opindex static-libstdc++
13690 When the @command{g++} program is used to link a C++ program, it
13691 normally automatically links against @option{libstdc++}. If
13692 @file{libstdc++} is available as a shared library, and the
13693 @option{-static} option is not used, then this links against the
13694 shared version of @file{libstdc++}. That is normally fine. However, it
13695 is sometimes useful to freeze the version of @file{libstdc++} used by
13696 the program without going all the way to a fully static link. The
13697 @option{-static-libstdc++} option directs the @command{g++} driver to
13698 link @file{libstdc++} statically, without necessarily linking other
13699 libraries statically.
13700
13701 @item -symbolic
13702 @opindex symbolic
13703 Bind references to global symbols when building a shared object. Warn
13704 about any unresolved references (unless overridden by the link editor
13705 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13706 this option.
13707
13708 @item -T @var{script}
13709 @opindex T
13710 @cindex linker script
13711 Use @var{script} as the linker script. This option is supported by most
13712 systems using the GNU linker. On some targets, such as bare-board
13713 targets without an operating system, the @option{-T} option may be required
13714 when linking to avoid references to undefined symbols.
13715
13716 @item -Xlinker @var{option}
13717 @opindex Xlinker
13718 Pass @var{option} as an option to the linker. You can use this to
13719 supply system-specific linker options that GCC does not recognize.
13720
13721 If you want to pass an option that takes a separate argument, you must use
13722 @option{-Xlinker} twice, once for the option and once for the argument.
13723 For example, to pass @option{-assert definitions}, you must write
13724 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13725 @option{-Xlinker "-assert definitions"}, because this passes the entire
13726 string as a single argument, which is not what the linker expects.
13727
13728 When using the GNU linker, it is usually more convenient to pass
13729 arguments to linker options using the @option{@var{option}=@var{value}}
13730 syntax than as separate arguments. For example, you can specify
13731 @option{-Xlinker -Map=output.map} rather than
13732 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13733 this syntax for command-line options.
13734
13735 @item -Wl,@var{option}
13736 @opindex Wl
13737 Pass @var{option} as an option to the linker. If @var{option} contains
13738 commas, it is split into multiple options at the commas. You can use this
13739 syntax to pass an argument to the option.
13740 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13741 linker. When using the GNU linker, you can also get the same effect with
13742 @option{-Wl,-Map=output.map}.
13743
13744 @item -u @var{symbol}
13745 @opindex u
13746 Pretend the symbol @var{symbol} is undefined, to force linking of
13747 library modules to define it. You can use @option{-u} multiple times with
13748 different symbols to force loading of additional library modules.
13749
13750 @item -z @var{keyword}
13751 @opindex z
13752 @option{-z} is passed directly on to the linker along with the keyword
13753 @var{keyword}. See the section in the documentation of your linker for
13754 permitted values and their meanings.
13755 @end table
13756
13757 @node Directory Options
13758 @section Options for Directory Search
13759 @cindex directory options
13760 @cindex options, directory search
13761 @cindex search path
13762
13763 These options specify directories to search for header files, for
13764 libraries and for parts of the compiler:
13765
13766 @table @gcctabopt
13767 @include cppdiropts.texi
13768
13769 @item -iplugindir=@var{dir}
13770 @opindex iplugindir=
13771 Set the directory to search for plugins that are passed
13772 by @option{-fplugin=@var{name}} instead of
13773 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13774 to be used by the user, but only passed by the driver.
13775
13776 @item -L@var{dir}
13777 @opindex L
13778 Add directory @var{dir} to the list of directories to be searched
13779 for @option{-l}.
13780
13781 @item -B@var{prefix}
13782 @opindex B
13783 This option specifies where to find the executables, libraries,
13784 include files, and data files of the compiler itself.
13785
13786 The compiler driver program runs one or more of the subprograms
13787 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13788 @var{prefix} as a prefix for each program it tries to run, both with and
13789 without @samp{@var{machine}/@var{version}/} for the corresponding target
13790 machine and compiler version.
13791
13792 For each subprogram to be run, the compiler driver first tries the
13793 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13794 is not specified, the driver tries two standard prefixes,
13795 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13796 those results in a file name that is found, the unmodified program
13797 name is searched for using the directories specified in your
13798 @env{PATH} environment variable.
13799
13800 The compiler checks to see if the path provided by @option{-B}
13801 refers to a directory, and if necessary it adds a directory
13802 separator character at the end of the path.
13803
13804 @option{-B} prefixes that effectively specify directory names also apply
13805 to libraries in the linker, because the compiler translates these
13806 options into @option{-L} options for the linker. They also apply to
13807 include files in the preprocessor, because the compiler translates these
13808 options into @option{-isystem} options for the preprocessor. In this case,
13809 the compiler appends @samp{include} to the prefix.
13810
13811 The runtime support file @file{libgcc.a} can also be searched for using
13812 the @option{-B} prefix, if needed. If it is not found there, the two
13813 standard prefixes above are tried, and that is all. The file is left
13814 out of the link if it is not found by those means.
13815
13816 Another way to specify a prefix much like the @option{-B} prefix is to use
13817 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13818 Variables}.
13819
13820 As a special kludge, if the path provided by @option{-B} is
13821 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13822 9, then it is replaced by @file{[dir/]include}. This is to help
13823 with boot-strapping the compiler.
13824
13825 @item -no-canonical-prefixes
13826 @opindex no-canonical-prefixes
13827 Do not expand any symbolic links, resolve references to @samp{/../}
13828 or @samp{/./}, or make the path absolute when generating a relative
13829 prefix.
13830
13831 @item --sysroot=@var{dir}
13832 @opindex sysroot
13833 Use @var{dir} as the logical root directory for headers and libraries.
13834 For example, if the compiler normally searches for headers in
13835 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13836 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13837
13838 If you use both this option and the @option{-isysroot} option, then
13839 the @option{--sysroot} option applies to libraries, but the
13840 @option{-isysroot} option applies to header files.
13841
13842 The GNU linker (beginning with version 2.16) has the necessary support
13843 for this option. If your linker does not support this option, the
13844 header file aspect of @option{--sysroot} still works, but the
13845 library aspect does not.
13846
13847 @item --no-sysroot-suffix
13848 @opindex no-sysroot-suffix
13849 For some targets, a suffix is added to the root directory specified
13850 with @option{--sysroot}, depending on the other options used, so that
13851 headers may for example be found in
13852 @file{@var{dir}/@var{suffix}/usr/include} instead of
13853 @file{@var{dir}/usr/include}. This option disables the addition of
13854 such a suffix.
13855
13856 @end table
13857
13858 @node Code Gen Options
13859 @section Options for Code Generation Conventions
13860 @cindex code generation conventions
13861 @cindex options, code generation
13862 @cindex run-time options
13863
13864 These machine-independent options control the interface conventions
13865 used in code generation.
13866
13867 Most of them have both positive and negative forms; the negative form
13868 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13869 one of the forms is listed---the one that is not the default. You
13870 can figure out the other form by either removing @samp{no-} or adding
13871 it.
13872
13873 @table @gcctabopt
13874 @item -fstack-reuse=@var{reuse-level}
13875 @opindex fstack_reuse
13876 This option controls stack space reuse for user declared local/auto variables
13877 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13878 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13879 local variables and temporaries, @samp{named_vars} enables the reuse only for
13880 user defined local variables with names, and @samp{none} disables stack reuse
13881 completely. The default value is @samp{all}. The option is needed when the
13882 program extends the lifetime of a scoped local variable or a compiler generated
13883 temporary beyond the end point defined by the language. When a lifetime of
13884 a variable ends, and if the variable lives in memory, the optimizing compiler
13885 has the freedom to reuse its stack space with other temporaries or scoped
13886 local variables whose live range does not overlap with it. Legacy code extending
13887 local lifetime is likely to break with the stack reuse optimization.
13888
13889 For example,
13890
13891 @smallexample
13892 int *p;
13893 @{
13894 int local1;
13895
13896 p = &local1;
13897 local1 = 10;
13898 ....
13899 @}
13900 @{
13901 int local2;
13902 local2 = 20;
13903 ...
13904 @}
13905
13906 if (*p == 10) // out of scope use of local1
13907 @{
13908
13909 @}
13910 @end smallexample
13911
13912 Another example:
13913 @smallexample
13914
13915 struct A
13916 @{
13917 A(int k) : i(k), j(k) @{ @}
13918 int i;
13919 int j;
13920 @};
13921
13922 A *ap;
13923
13924 void foo(const A& ar)
13925 @{
13926 ap = &ar;
13927 @}
13928
13929 void bar()
13930 @{
13931 foo(A(10)); // temp object's lifetime ends when foo returns
13932
13933 @{
13934 A a(20);
13935 ....
13936 @}
13937 ap->i+= 10; // ap references out of scope temp whose space
13938 // is reused with a. What is the value of ap->i?
13939 @}
13940
13941 @end smallexample
13942
13943 The lifetime of a compiler generated temporary is well defined by the C++
13944 standard. When a lifetime of a temporary ends, and if the temporary lives
13945 in memory, the optimizing compiler has the freedom to reuse its stack
13946 space with other temporaries or scoped local variables whose live range
13947 does not overlap with it. However some of the legacy code relies on
13948 the behavior of older compilers in which temporaries' stack space is
13949 not reused, the aggressive stack reuse can lead to runtime errors. This
13950 option is used to control the temporary stack reuse optimization.
13951
13952 @item -ftrapv
13953 @opindex ftrapv
13954 This option generates traps for signed overflow on addition, subtraction,
13955 multiplication operations.
13956 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13957 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13958 @option{-fwrapv} being effective. Note that only active options override, so
13959 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13960 results in @option{-ftrapv} being effective.
13961
13962 @item -fwrapv
13963 @opindex fwrapv
13964 This option instructs the compiler to assume that signed arithmetic
13965 overflow of addition, subtraction and multiplication wraps around
13966 using twos-complement representation. This flag enables some optimizations
13967 and disables others.
13968 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13969 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13970 @option{-fwrapv} being effective. Note that only active options override, so
13971 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13972 results in @option{-ftrapv} being effective.
13973
13974 @item -fwrapv-pointer
13975 @opindex fwrapv-pointer
13976 This option instructs the compiler to assume that pointer arithmetic
13977 overflow on addition and subtraction wraps around using twos-complement
13978 representation. This flag disables some optimizations which assume
13979 pointer overflow is invalid.
13980
13981 @item -fstrict-overflow
13982 @opindex fstrict-overflow
13983 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13984 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13985
13986 @item -fexceptions
13987 @opindex fexceptions
13988 Enable exception handling. Generates extra code needed to propagate
13989 exceptions. For some targets, this implies GCC generates frame
13990 unwind information for all functions, which can produce significant data
13991 size overhead, although it does not affect execution. If you do not
13992 specify this option, GCC enables it by default for languages like
13993 C++ that normally require exception handling, and disables it for
13994 languages like C that do not normally require it. However, you may need
13995 to enable this option when compiling C code that needs to interoperate
13996 properly with exception handlers written in C++. You may also wish to
13997 disable this option if you are compiling older C++ programs that don't
13998 use exception handling.
13999
14000 @item -fnon-call-exceptions
14001 @opindex fnon-call-exceptions
14002 Generate code that allows trapping instructions to throw exceptions.
14003 Note that this requires platform-specific runtime support that does
14004 not exist everywhere. Moreover, it only allows @emph{trapping}
14005 instructions to throw exceptions, i.e.@: memory references or floating-point
14006 instructions. It does not allow exceptions to be thrown from
14007 arbitrary signal handlers such as @code{SIGALRM}.
14008
14009 @item -fdelete-dead-exceptions
14010 @opindex fdelete-dead-exceptions
14011 Consider that instructions that may throw exceptions but don't otherwise
14012 contribute to the execution of the program can be optimized away.
14013 This option is enabled by default for the Ada front end, as permitted by
14014 the Ada language specification.
14015 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14016
14017 @item -funwind-tables
14018 @opindex funwind-tables
14019 Similar to @option{-fexceptions}, except that it just generates any needed
14020 static data, but does not affect the generated code in any other way.
14021 You normally do not need to enable this option; instead, a language processor
14022 that needs this handling enables it on your behalf.
14023
14024 @item -fasynchronous-unwind-tables
14025 @opindex fasynchronous-unwind-tables
14026 Generate unwind table in DWARF format, if supported by target machine. The
14027 table is exact at each instruction boundary, so it can be used for stack
14028 unwinding from asynchronous events (such as debugger or garbage collector).
14029
14030 @item -fno-gnu-unique
14031 @opindex fno-gnu-unique
14032 @opindex fgnu-unique
14033 On systems with recent GNU assembler and C library, the C++ compiler
14034 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14035 of template static data members and static local variables in inline
14036 functions are unique even in the presence of @code{RTLD_LOCAL}; this
14037 is necessary to avoid problems with a library used by two different
14038 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
14039 therefore disagreeing with the other one about the binding of the
14040 symbol. But this causes @code{dlclose} to be ignored for affected
14041 DSOs; if your program relies on reinitialization of a DSO via
14042 @code{dlclose} and @code{dlopen}, you can use
14043 @option{-fno-gnu-unique}.
14044
14045 @item -fpcc-struct-return
14046 @opindex fpcc-struct-return
14047 Return ``short'' @code{struct} and @code{union} values in memory like
14048 longer ones, rather than in registers. This convention is less
14049 efficient, but it has the advantage of allowing intercallability between
14050 GCC-compiled files and files compiled with other compilers, particularly
14051 the Portable C Compiler (pcc).
14052
14053 The precise convention for returning structures in memory depends
14054 on the target configuration macros.
14055
14056 Short structures and unions are those whose size and alignment match
14057 that of some integer type.
14058
14059 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14060 switch is not binary compatible with code compiled with the
14061 @option{-freg-struct-return} switch.
14062 Use it to conform to a non-default application binary interface.
14063
14064 @item -freg-struct-return
14065 @opindex freg-struct-return
14066 Return @code{struct} and @code{union} values in registers when possible.
14067 This is more efficient for small structures than
14068 @option{-fpcc-struct-return}.
14069
14070 If you specify neither @option{-fpcc-struct-return} nor
14071 @option{-freg-struct-return}, GCC defaults to whichever convention is
14072 standard for the target. If there is no standard convention, GCC
14073 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14074 the principal compiler. In those cases, we can choose the standard, and
14075 we chose the more efficient register return alternative.
14076
14077 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14078 switch is not binary compatible with code compiled with the
14079 @option{-fpcc-struct-return} switch.
14080 Use it to conform to a non-default application binary interface.
14081
14082 @item -fshort-enums
14083 @opindex fshort-enums
14084 Allocate to an @code{enum} type only as many bytes as it needs for the
14085 declared range of possible values. Specifically, the @code{enum} type
14086 is equivalent to the smallest integer type that has enough room.
14087
14088 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14089 code that is not binary compatible with code generated without that switch.
14090 Use it to conform to a non-default application binary interface.
14091
14092 @item -fshort-wchar
14093 @opindex fshort-wchar
14094 Override the underlying type for @code{wchar_t} to be @code{short
14095 unsigned int} instead of the default for the target. This option is
14096 useful for building programs to run under WINE@.
14097
14098 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14099 code that is not binary compatible with code generated without that switch.
14100 Use it to conform to a non-default application binary interface.
14101
14102 @item -fno-common
14103 @opindex fno-common
14104 @opindex fcommon
14105 @cindex tentative definitions
14106 In C code, this option controls the placement of global variables
14107 defined without an initializer, known as @dfn{tentative definitions}
14108 in the C standard. Tentative definitions are distinct from declarations
14109 of a variable with the @code{extern} keyword, which do not allocate storage.
14110
14111 Unix C compilers have traditionally allocated storage for
14112 uninitialized global variables in a common block. This allows the
14113 linker to resolve all tentative definitions of the same variable
14114 in different compilation units to the same object, or to a non-tentative
14115 definition.
14116 This is the behavior specified by @option{-fcommon}, and is the default for
14117 GCC on most targets.
14118 On the other hand, this behavior is not required by ISO
14119 C, and on some targets may carry a speed or code size penalty on
14120 variable references.
14121
14122 The @option{-fno-common} option specifies that the compiler should instead
14123 place uninitialized global variables in the BSS section of the object file.
14124 This inhibits the merging of tentative definitions by the linker so
14125 you get a multiple-definition error if the same
14126 variable is defined in more than one compilation unit.
14127 Compiling with @option{-fno-common} is useful on targets for which
14128 it provides better performance, or if you wish to verify that the
14129 program will work on other systems that always treat uninitialized
14130 variable definitions this way.
14131
14132 @item -fno-ident
14133 @opindex fno-ident
14134 @opindex fident
14135 Ignore the @code{#ident} directive.
14136
14137 @item -finhibit-size-directive
14138 @opindex finhibit-size-directive
14139 Don't output a @code{.size} assembler directive, or anything else that
14140 would cause trouble if the function is split in the middle, and the
14141 two halves are placed at locations far apart in memory. This option is
14142 used when compiling @file{crtstuff.c}; you should not need to use it
14143 for anything else.
14144
14145 @item -fverbose-asm
14146 @opindex fverbose-asm
14147 Put extra commentary information in the generated assembly code to
14148 make it more readable. This option is generally only of use to those
14149 who actually need to read the generated assembly code (perhaps while
14150 debugging the compiler itself).
14151
14152 @option{-fno-verbose-asm}, the default, causes the
14153 extra information to be omitted and is useful when comparing two assembler
14154 files.
14155
14156 The added comments include:
14157
14158 @itemize @bullet
14159
14160 @item
14161 information on the compiler version and command-line options,
14162
14163 @item
14164 the source code lines associated with the assembly instructions,
14165 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14166
14167 @item
14168 hints on which high-level expressions correspond to
14169 the various assembly instruction operands.
14170
14171 @end itemize
14172
14173 For example, given this C source file:
14174
14175 @smallexample
14176 int test (int n)
14177 @{
14178 int i;
14179 int total = 0;
14180
14181 for (i = 0; i < n; i++)
14182 total += i * i;
14183
14184 return total;
14185 @}
14186 @end smallexample
14187
14188 compiling to (x86_64) assembly via @option{-S} and emitting the result
14189 direct to stdout via @option{-o} @option{-}
14190
14191 @smallexample
14192 gcc -S test.c -fverbose-asm -Os -o -
14193 @end smallexample
14194
14195 gives output similar to this:
14196
14197 @smallexample
14198 .file "test.c"
14199 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14200 [...snip...]
14201 # options passed:
14202 [...snip...]
14203
14204 .text
14205 .globl test
14206 .type test, @@function
14207 test:
14208 .LFB0:
14209 .cfi_startproc
14210 # test.c:4: int total = 0;
14211 xorl %eax, %eax # <retval>
14212 # test.c:6: for (i = 0; i < n; i++)
14213 xorl %edx, %edx # i
14214 .L2:
14215 # test.c:6: for (i = 0; i < n; i++)
14216 cmpl %edi, %edx # n, i
14217 jge .L5 #,
14218 # test.c:7: total += i * i;
14219 movl %edx, %ecx # i, tmp92
14220 imull %edx, %ecx # i, tmp92
14221 # test.c:6: for (i = 0; i < n; i++)
14222 incl %edx # i
14223 # test.c:7: total += i * i;
14224 addl %ecx, %eax # tmp92, <retval>
14225 jmp .L2 #
14226 .L5:
14227 # test.c:10: @}
14228 ret
14229 .cfi_endproc
14230 .LFE0:
14231 .size test, .-test
14232 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14233 .section .note.GNU-stack,"",@@progbits
14234 @end smallexample
14235
14236 The comments are intended for humans rather than machines and hence the
14237 precise format of the comments is subject to change.
14238
14239 @item -frecord-gcc-switches
14240 @opindex frecord-gcc-switches
14241 This switch causes the command line used to invoke the
14242 compiler to be recorded into the object file that is being created.
14243 This switch is only implemented on some targets and the exact format
14244 of the recording is target and binary file format dependent, but it
14245 usually takes the form of a section containing ASCII text. This
14246 switch is related to the @option{-fverbose-asm} switch, but that
14247 switch only records information in the assembler output file as
14248 comments, so it never reaches the object file.
14249 See also @option{-grecord-gcc-switches} for another
14250 way of storing compiler options into the object file.
14251
14252 @item -fpic
14253 @opindex fpic
14254 @cindex global offset table
14255 @cindex PIC
14256 Generate position-independent code (PIC) suitable for use in a shared
14257 library, if supported for the target machine. Such code accesses all
14258 constant addresses through a global offset table (GOT)@. The dynamic
14259 loader resolves the GOT entries when the program starts (the dynamic
14260 loader is not part of GCC; it is part of the operating system). If
14261 the GOT size for the linked executable exceeds a machine-specific
14262 maximum size, you get an error message from the linker indicating that
14263 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14264 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14265 on the m68k and RS/6000. The x86 has no such limit.)
14266
14267 Position-independent code requires special support, and therefore works
14268 only on certain machines. For the x86, GCC supports PIC for System V
14269 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14270 position-independent.
14271
14272 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14273 are defined to 1.
14274
14275 @item -fPIC
14276 @opindex fPIC
14277 If supported for the target machine, emit position-independent code,
14278 suitable for dynamic linking and avoiding any limit on the size of the
14279 global offset table. This option makes a difference on AArch64, m68k,
14280 PowerPC and SPARC@.
14281
14282 Position-independent code requires special support, and therefore works
14283 only on certain machines.
14284
14285 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14286 are defined to 2.
14287
14288 @item -fpie
14289 @itemx -fPIE
14290 @opindex fpie
14291 @opindex fPIE
14292 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14293 generated position-independent code can be only linked into executables.
14294 Usually these options are used to compile code that will be linked using
14295 the @option{-pie} GCC option.
14296
14297 @option{-fpie} and @option{-fPIE} both define the macros
14298 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14299 for @option{-fpie} and 2 for @option{-fPIE}.
14300
14301 @item -fno-plt
14302 @opindex fno-plt
14303 @opindex fplt
14304 Do not use the PLT for external function calls in position-independent code.
14305 Instead, load the callee address at call sites from the GOT and branch to it.
14306 This leads to more efficient code by eliminating PLT stubs and exposing
14307 GOT loads to optimizations. On architectures such as 32-bit x86 where
14308 PLT stubs expect the GOT pointer in a specific register, this gives more
14309 register allocation freedom to the compiler.
14310 Lazy binding requires use of the PLT;
14311 with @option{-fno-plt} all external symbols are resolved at load time.
14312
14313 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14314 through the PLT for specific external functions.
14315
14316 In position-dependent code, a few targets also convert calls to
14317 functions that are marked to not use the PLT to use the GOT instead.
14318
14319 @item -fno-jump-tables
14320 @opindex fno-jump-tables
14321 @opindex fjump-tables
14322 Do not use jump tables for switch statements even where it would be
14323 more efficient than other code generation strategies. This option is
14324 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14325 building code that forms part of a dynamic linker and cannot
14326 reference the address of a jump table. On some targets, jump tables
14327 do not require a GOT and this option is not needed.
14328
14329 @item -ffixed-@var{reg}
14330 @opindex ffixed
14331 Treat the register named @var{reg} as a fixed register; generated code
14332 should never refer to it (except perhaps as a stack pointer, frame
14333 pointer or in some other fixed role).
14334
14335 @var{reg} must be the name of a register. The register names accepted
14336 are machine-specific and are defined in the @code{REGISTER_NAMES}
14337 macro in the machine description macro file.
14338
14339 This flag does not have a negative form, because it specifies a
14340 three-way choice.
14341
14342 @item -fcall-used-@var{reg}
14343 @opindex fcall-used
14344 Treat the register named @var{reg} as an allocable register that is
14345 clobbered by function calls. It may be allocated for temporaries or
14346 variables that do not live across a call. Functions compiled this way
14347 do not save and restore the register @var{reg}.
14348
14349 It is an error to use this flag with the frame pointer or stack pointer.
14350 Use of this flag for other registers that have fixed pervasive roles in
14351 the machine's execution model produces disastrous results.
14352
14353 This flag does not have a negative form, because it specifies a
14354 three-way choice.
14355
14356 @item -fcall-saved-@var{reg}
14357 @opindex fcall-saved
14358 Treat the register named @var{reg} as an allocable register saved by
14359 functions. It may be allocated even for temporaries or variables that
14360 live across a call. Functions compiled this way save and restore
14361 the register @var{reg} if they use it.
14362
14363 It is an error to use this flag with the frame pointer or stack pointer.
14364 Use of this flag for other registers that have fixed pervasive roles in
14365 the machine's execution model produces disastrous results.
14366
14367 A different sort of disaster results from the use of this flag for
14368 a register in which function values may be returned.
14369
14370 This flag does not have a negative form, because it specifies a
14371 three-way choice.
14372
14373 @item -fpack-struct[=@var{n}]
14374 @opindex fpack-struct
14375 Without a value specified, pack all structure members together without
14376 holes. When a value is specified (which must be a small power of two), pack
14377 structure members according to this value, representing the maximum
14378 alignment (that is, objects with default alignment requirements larger than
14379 this are output potentially unaligned at the next fitting location.
14380
14381 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14382 code that is not binary compatible with code generated without that switch.
14383 Additionally, it makes the code suboptimal.
14384 Use it to conform to a non-default application binary interface.
14385
14386 @item -fleading-underscore
14387 @opindex fleading-underscore
14388 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14389 change the way C symbols are represented in the object file. One use
14390 is to help link with legacy assembly code.
14391
14392 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14393 generate code that is not binary compatible with code generated without that
14394 switch. Use it to conform to a non-default application binary interface.
14395 Not all targets provide complete support for this switch.
14396
14397 @item -ftls-model=@var{model}
14398 @opindex ftls-model
14399 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14400 The @var{model} argument should be one of @samp{global-dynamic},
14401 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14402 Note that the choice is subject to optimization: the compiler may use
14403 a more efficient model for symbols not visible outside of the translation
14404 unit, or if @option{-fpic} is not given on the command line.
14405
14406 The default without @option{-fpic} is @samp{initial-exec}; with
14407 @option{-fpic} the default is @samp{global-dynamic}.
14408
14409 @item -ftrampolines
14410 @opindex ftrampolines
14411 For targets that normally need trampolines for nested functions, always
14412 generate them instead of using descriptors. Otherwise, for targets that
14413 do not need them, like for example HP-PA or IA-64, do nothing.
14414
14415 A trampoline is a small piece of code that is created at run time on the
14416 stack when the address of a nested function is taken, and is used to call
14417 the nested function indirectly. Therefore, it requires the stack to be
14418 made executable in order for the program to work properly.
14419
14420 @option{-fno-trampolines} is enabled by default on a language by language
14421 basis to let the compiler avoid generating them, if it computes that this
14422 is safe, and replace them with descriptors. Descriptors are made up of data
14423 only, but the generated code must be prepared to deal with them. As of this
14424 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14425
14426 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14427 @option{-fno-trampolines} are not binary compatible if nested functions are
14428 present. This option must therefore be used on a program-wide basis and be
14429 manipulated with extreme care.
14430
14431 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14432 @opindex fvisibility
14433 Set the default ELF image symbol visibility to the specified option---all
14434 symbols are marked with this unless overridden within the code.
14435 Using this feature can very substantially improve linking and
14436 load times of shared object libraries, produce more optimized
14437 code, provide near-perfect API export and prevent symbol clashes.
14438 It is @strong{strongly} recommended that you use this in any shared objects
14439 you distribute.
14440
14441 Despite the nomenclature, @samp{default} always means public; i.e.,
14442 available to be linked against from outside the shared object.
14443 @samp{protected} and @samp{internal} are pretty useless in real-world
14444 usage so the only other commonly used option is @samp{hidden}.
14445 The default if @option{-fvisibility} isn't specified is
14446 @samp{default}, i.e., make every symbol public.
14447
14448 A good explanation of the benefits offered by ensuring ELF
14449 symbols have the correct visibility is given by ``How To Write
14450 Shared Libraries'' by Ulrich Drepper (which can be found at
14451 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14452 solution made possible by this option to marking things hidden when
14453 the default is public is to make the default hidden and mark things
14454 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14455 and @code{__attribute__ ((visibility("default")))} instead of
14456 @code{__declspec(dllexport)} you get almost identical semantics with
14457 identical syntax. This is a great boon to those working with
14458 cross-platform projects.
14459
14460 For those adding visibility support to existing code, you may find
14461 @code{#pragma GCC visibility} of use. This works by you enclosing
14462 the declarations you wish to set visibility for with (for example)
14463 @code{#pragma GCC visibility push(hidden)} and
14464 @code{#pragma GCC visibility pop}.
14465 Bear in mind that symbol visibility should be viewed @strong{as
14466 part of the API interface contract} and thus all new code should
14467 always specify visibility when it is not the default; i.e., declarations
14468 only for use within the local DSO should @strong{always} be marked explicitly
14469 as hidden as so to avoid PLT indirection overheads---making this
14470 abundantly clear also aids readability and self-documentation of the code.
14471 Note that due to ISO C++ specification requirements, @code{operator new} and
14472 @code{operator delete} must always be of default visibility.
14473
14474 Be aware that headers from outside your project, in particular system
14475 headers and headers from any other library you use, may not be
14476 expecting to be compiled with visibility other than the default. You
14477 may need to explicitly say @code{#pragma GCC visibility push(default)}
14478 before including any such headers.
14479
14480 @code{extern} declarations are not affected by @option{-fvisibility}, so
14481 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14482 no modifications. However, this means that calls to @code{extern}
14483 functions with no explicit visibility use the PLT, so it is more
14484 effective to use @code{__attribute ((visibility))} and/or
14485 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14486 declarations should be treated as hidden.
14487
14488 Note that @option{-fvisibility} does affect C++ vague linkage
14489 entities. This means that, for instance, an exception class that is
14490 be thrown between DSOs must be explicitly marked with default
14491 visibility so that the @samp{type_info} nodes are unified between
14492 the DSOs.
14493
14494 An overview of these techniques, their benefits and how to use them
14495 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14496
14497 @item -fstrict-volatile-bitfields
14498 @opindex fstrict-volatile-bitfields
14499 This option should be used if accesses to volatile bit-fields (or other
14500 structure fields, although the compiler usually honors those types
14501 anyway) should use a single access of the width of the
14502 field's type, aligned to a natural alignment if possible. For
14503 example, targets with memory-mapped peripheral registers might require
14504 all such accesses to be 16 bits wide; with this flag you can
14505 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14506 is 16 bits on these targets) to force GCC to use 16-bit accesses
14507 instead of, perhaps, a more efficient 32-bit access.
14508
14509 If this option is disabled, the compiler uses the most efficient
14510 instruction. In the previous example, that might be a 32-bit load
14511 instruction, even though that accesses bytes that do not contain
14512 any portion of the bit-field, or memory-mapped registers unrelated to
14513 the one being updated.
14514
14515 In some cases, such as when the @code{packed} attribute is applied to a
14516 structure field, it may not be possible to access the field with a single
14517 read or write that is correctly aligned for the target machine. In this
14518 case GCC falls back to generating multiple accesses rather than code that
14519 will fault or truncate the result at run time.
14520
14521 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14522 not allowed to touch non bit-field members. It is therefore recommended
14523 to define all bits of the field's type as bit-field members.
14524
14525 The default value of this option is determined by the application binary
14526 interface for the target processor.
14527
14528 @item -fsync-libcalls
14529 @opindex fsync-libcalls
14530 This option controls whether any out-of-line instance of the @code{__sync}
14531 family of functions may be used to implement the C++11 @code{__atomic}
14532 family of functions.
14533
14534 The default value of this option is enabled, thus the only useful form
14535 of the option is @option{-fno-sync-libcalls}. This option is used in
14536 the implementation of the @file{libatomic} runtime library.
14537
14538 @end table
14539
14540 @node Developer Options
14541 @section GCC Developer Options
14542 @cindex developer options
14543 @cindex debugging GCC
14544 @cindex debug dump options
14545 @cindex dump options
14546 @cindex compilation statistics
14547
14548 This section describes command-line options that are primarily of
14549 interest to GCC developers, including options to support compiler
14550 testing and investigation of compiler bugs and compile-time
14551 performance problems. This includes options that produce debug dumps
14552 at various points in the compilation; that print statistics such as
14553 memory use and execution time; and that print information about GCC's
14554 configuration, such as where it searches for libraries. You should
14555 rarely need to use any of these options for ordinary compilation and
14556 linking tasks.
14557
14558 Many developer options that cause GCC to dump output to a file take an
14559 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14560 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14561 error.
14562
14563 If @samp{=@var{filename}} is omitted, a default dump file name is
14564 constructed by concatenating the base dump file name, a pass number,
14565 phase letter, and pass name. The base dump file name is the name of
14566 output file produced by the compiler if explicitly specified and not
14567 an executable; otherwise it is the source file name.
14568 The pass number is determined by the order passes are registered with
14569 the compiler's pass manager.
14570 This is generally the same as the order of execution, but passes
14571 registered by plugins, target-specific passes, or passes that are
14572 otherwise registered late are numbered higher than the pass named
14573 @samp{final}, even if they are executed earlier. The phase letter is
14574 one of @samp{i} (inter-procedural analysis), @samp{l}
14575 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14576 The files are created in the directory of the output file.
14577
14578 @table @gcctabopt
14579
14580 @item -fcallgraph-info
14581 @itemx -fcallgraph-info=@var{MARKERS}
14582 @opindex fcallgraph-info
14583 Makes the compiler output callgraph information for the program, on a
14584 per-object-file basis. The information is generated in the common VCG
14585 format. It can be decorated with additional, per-node and/or per-edge
14586 information, if a list of comma-separated markers is additionally
14587 specified. When the @code{su} marker is specified, the callgraph is
14588 decorated with stack usage information; it is equivalent to
14589 @option{-fstack-usage}. When the @code{da} marker is specified, the
14590 callgraph is decorated with information about dynamically allocated
14591 objects.
14592
14593 When compiling with @option{-flto}, no callgraph information is output
14594 along with the object file. At LTO link time, @option{-fcallgraph-info}
14595 may generate multiple callgraph information files next to intermediate
14596 LTO output files.
14597
14598 @item -d@var{letters}
14599 @itemx -fdump-rtl-@var{pass}
14600 @itemx -fdump-rtl-@var{pass}=@var{filename}
14601 @opindex d
14602 @opindex fdump-rtl-@var{pass}
14603 Says to make debugging dumps during compilation at times specified by
14604 @var{letters}. This is used for debugging the RTL-based passes of the
14605 compiler.
14606
14607 Some @option{-d@var{letters}} switches have different meaning when
14608 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14609 for information about preprocessor-specific dump options.
14610
14611 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14612 @option{-d} option @var{letters}. Here are the possible
14613 letters for use in @var{pass} and @var{letters}, and their meanings:
14614
14615 @table @gcctabopt
14616
14617 @item -fdump-rtl-alignments
14618 @opindex fdump-rtl-alignments
14619 Dump after branch alignments have been computed.
14620
14621 @item -fdump-rtl-asmcons
14622 @opindex fdump-rtl-asmcons
14623 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14624
14625 @item -fdump-rtl-auto_inc_dec
14626 @opindex fdump-rtl-auto_inc_dec
14627 Dump after auto-inc-dec discovery. This pass is only run on
14628 architectures that have auto inc or auto dec instructions.
14629
14630 @item -fdump-rtl-barriers
14631 @opindex fdump-rtl-barriers
14632 Dump after cleaning up the barrier instructions.
14633
14634 @item -fdump-rtl-bbpart
14635 @opindex fdump-rtl-bbpart
14636 Dump after partitioning hot and cold basic blocks.
14637
14638 @item -fdump-rtl-bbro
14639 @opindex fdump-rtl-bbro
14640 Dump after block reordering.
14641
14642 @item -fdump-rtl-btl1
14643 @itemx -fdump-rtl-btl2
14644 @opindex fdump-rtl-btl2
14645 @opindex fdump-rtl-btl2
14646 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14647 after the two branch
14648 target load optimization passes.
14649
14650 @item -fdump-rtl-bypass
14651 @opindex fdump-rtl-bypass
14652 Dump after jump bypassing and control flow optimizations.
14653
14654 @item -fdump-rtl-combine
14655 @opindex fdump-rtl-combine
14656 Dump after the RTL instruction combination pass.
14657
14658 @item -fdump-rtl-compgotos
14659 @opindex fdump-rtl-compgotos
14660 Dump after duplicating the computed gotos.
14661
14662 @item -fdump-rtl-ce1
14663 @itemx -fdump-rtl-ce2
14664 @itemx -fdump-rtl-ce3
14665 @opindex fdump-rtl-ce1
14666 @opindex fdump-rtl-ce2
14667 @opindex fdump-rtl-ce3
14668 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14669 @option{-fdump-rtl-ce3} enable dumping after the three
14670 if conversion passes.
14671
14672 @item -fdump-rtl-cprop_hardreg
14673 @opindex fdump-rtl-cprop_hardreg
14674 Dump after hard register copy propagation.
14675
14676 @item -fdump-rtl-csa
14677 @opindex fdump-rtl-csa
14678 Dump after combining stack adjustments.
14679
14680 @item -fdump-rtl-cse1
14681 @itemx -fdump-rtl-cse2
14682 @opindex fdump-rtl-cse1
14683 @opindex fdump-rtl-cse2
14684 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14685 the two common subexpression elimination passes.
14686
14687 @item -fdump-rtl-dce
14688 @opindex fdump-rtl-dce
14689 Dump after the standalone dead code elimination passes.
14690
14691 @item -fdump-rtl-dbr
14692 @opindex fdump-rtl-dbr
14693 Dump after delayed branch scheduling.
14694
14695 @item -fdump-rtl-dce1
14696 @itemx -fdump-rtl-dce2
14697 @opindex fdump-rtl-dce1
14698 @opindex fdump-rtl-dce2
14699 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14700 the two dead store elimination passes.
14701
14702 @item -fdump-rtl-eh
14703 @opindex fdump-rtl-eh
14704 Dump after finalization of EH handling code.
14705
14706 @item -fdump-rtl-eh_ranges
14707 @opindex fdump-rtl-eh_ranges
14708 Dump after conversion of EH handling range regions.
14709
14710 @item -fdump-rtl-expand
14711 @opindex fdump-rtl-expand
14712 Dump after RTL generation.
14713
14714 @item -fdump-rtl-fwprop1
14715 @itemx -fdump-rtl-fwprop2
14716 @opindex fdump-rtl-fwprop1
14717 @opindex fdump-rtl-fwprop2
14718 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14719 dumping after the two forward propagation passes.
14720
14721 @item -fdump-rtl-gcse1
14722 @itemx -fdump-rtl-gcse2
14723 @opindex fdump-rtl-gcse1
14724 @opindex fdump-rtl-gcse2
14725 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14726 after global common subexpression elimination.
14727
14728 @item -fdump-rtl-init-regs
14729 @opindex fdump-rtl-init-regs
14730 Dump after the initialization of the registers.
14731
14732 @item -fdump-rtl-initvals
14733 @opindex fdump-rtl-initvals
14734 Dump after the computation of the initial value sets.
14735
14736 @item -fdump-rtl-into_cfglayout
14737 @opindex fdump-rtl-into_cfglayout
14738 Dump after converting to cfglayout mode.
14739
14740 @item -fdump-rtl-ira
14741 @opindex fdump-rtl-ira
14742 Dump after iterated register allocation.
14743
14744 @item -fdump-rtl-jump
14745 @opindex fdump-rtl-jump
14746 Dump after the second jump optimization.
14747
14748 @item -fdump-rtl-loop2
14749 @opindex fdump-rtl-loop2
14750 @option{-fdump-rtl-loop2} enables dumping after the rtl
14751 loop optimization passes.
14752
14753 @item -fdump-rtl-mach
14754 @opindex fdump-rtl-mach
14755 Dump after performing the machine dependent reorganization pass, if that
14756 pass exists.
14757
14758 @item -fdump-rtl-mode_sw
14759 @opindex fdump-rtl-mode_sw
14760 Dump after removing redundant mode switches.
14761
14762 @item -fdump-rtl-rnreg
14763 @opindex fdump-rtl-rnreg
14764 Dump after register renumbering.
14765
14766 @item -fdump-rtl-outof_cfglayout
14767 @opindex fdump-rtl-outof_cfglayout
14768 Dump after converting from cfglayout mode.
14769
14770 @item -fdump-rtl-peephole2
14771 @opindex fdump-rtl-peephole2
14772 Dump after the peephole pass.
14773
14774 @item -fdump-rtl-postreload
14775 @opindex fdump-rtl-postreload
14776 Dump after post-reload optimizations.
14777
14778 @item -fdump-rtl-pro_and_epilogue
14779 @opindex fdump-rtl-pro_and_epilogue
14780 Dump after generating the function prologues and epilogues.
14781
14782 @item -fdump-rtl-sched1
14783 @itemx -fdump-rtl-sched2
14784 @opindex fdump-rtl-sched1
14785 @opindex fdump-rtl-sched2
14786 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14787 after the basic block scheduling passes.
14788
14789 @item -fdump-rtl-ree
14790 @opindex fdump-rtl-ree
14791 Dump after sign/zero extension elimination.
14792
14793 @item -fdump-rtl-seqabstr
14794 @opindex fdump-rtl-seqabstr
14795 Dump after common sequence discovery.
14796
14797 @item -fdump-rtl-shorten
14798 @opindex fdump-rtl-shorten
14799 Dump after shortening branches.
14800
14801 @item -fdump-rtl-sibling
14802 @opindex fdump-rtl-sibling
14803 Dump after sibling call optimizations.
14804
14805 @item -fdump-rtl-split1
14806 @itemx -fdump-rtl-split2
14807 @itemx -fdump-rtl-split3
14808 @itemx -fdump-rtl-split4
14809 @itemx -fdump-rtl-split5
14810 @opindex fdump-rtl-split1
14811 @opindex fdump-rtl-split2
14812 @opindex fdump-rtl-split3
14813 @opindex fdump-rtl-split4
14814 @opindex fdump-rtl-split5
14815 These options enable dumping after five rounds of
14816 instruction splitting.
14817
14818 @item -fdump-rtl-sms
14819 @opindex fdump-rtl-sms
14820 Dump after modulo scheduling. This pass is only run on some
14821 architectures.
14822
14823 @item -fdump-rtl-stack
14824 @opindex fdump-rtl-stack
14825 Dump after conversion from GCC's ``flat register file'' registers to the
14826 x87's stack-like registers. This pass is only run on x86 variants.
14827
14828 @item -fdump-rtl-subreg1
14829 @itemx -fdump-rtl-subreg2
14830 @opindex fdump-rtl-subreg1
14831 @opindex fdump-rtl-subreg2
14832 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14833 the two subreg expansion passes.
14834
14835 @item -fdump-rtl-unshare
14836 @opindex fdump-rtl-unshare
14837 Dump after all rtl has been unshared.
14838
14839 @item -fdump-rtl-vartrack
14840 @opindex fdump-rtl-vartrack
14841 Dump after variable tracking.
14842
14843 @item -fdump-rtl-vregs
14844 @opindex fdump-rtl-vregs
14845 Dump after converting virtual registers to hard registers.
14846
14847 @item -fdump-rtl-web
14848 @opindex fdump-rtl-web
14849 Dump after live range splitting.
14850
14851 @item -fdump-rtl-regclass
14852 @itemx -fdump-rtl-subregs_of_mode_init
14853 @itemx -fdump-rtl-subregs_of_mode_finish
14854 @itemx -fdump-rtl-dfinit
14855 @itemx -fdump-rtl-dfinish
14856 @opindex fdump-rtl-regclass
14857 @opindex fdump-rtl-subregs_of_mode_init
14858 @opindex fdump-rtl-subregs_of_mode_finish
14859 @opindex fdump-rtl-dfinit
14860 @opindex fdump-rtl-dfinish
14861 These dumps are defined but always produce empty files.
14862
14863 @item -da
14864 @itemx -fdump-rtl-all
14865 @opindex da
14866 @opindex fdump-rtl-all
14867 Produce all the dumps listed above.
14868
14869 @item -dA
14870 @opindex dA
14871 Annotate the assembler output with miscellaneous debugging information.
14872
14873 @item -dD
14874 @opindex dD
14875 Dump all macro definitions, at the end of preprocessing, in addition to
14876 normal output.
14877
14878 @item -dH
14879 @opindex dH
14880 Produce a core dump whenever an error occurs.
14881
14882 @item -dp
14883 @opindex dp
14884 Annotate the assembler output with a comment indicating which
14885 pattern and alternative is used. The length and cost of each instruction are
14886 also printed.
14887
14888 @item -dP
14889 @opindex dP
14890 Dump the RTL in the assembler output as a comment before each instruction.
14891 Also turns on @option{-dp} annotation.
14892
14893 @item -dx
14894 @opindex dx
14895 Just generate RTL for a function instead of compiling it. Usually used
14896 with @option{-fdump-rtl-expand}.
14897 @end table
14898
14899 @item -fdump-debug
14900 @opindex fdump-debug
14901 Dump debugging information generated during the debug
14902 generation phase.
14903
14904 @item -fdump-earlydebug
14905 @opindex fdump-earlydebug
14906 Dump debugging information generated during the early debug
14907 generation phase.
14908
14909 @item -fdump-noaddr
14910 @opindex fdump-noaddr
14911 When doing debugging dumps, suppress address output. This makes it more
14912 feasible to use diff on debugging dumps for compiler invocations with
14913 different compiler binaries and/or different
14914 text / bss / data / heap / stack / dso start locations.
14915
14916 @item -freport-bug
14917 @opindex freport-bug
14918 Collect and dump debug information into a temporary file if an
14919 internal compiler error (ICE) occurs.
14920
14921 @item -fdump-unnumbered
14922 @opindex fdump-unnumbered
14923 When doing debugging dumps, suppress instruction numbers and address output.
14924 This makes it more feasible to use diff on debugging dumps for compiler
14925 invocations with different options, in particular with and without
14926 @option{-g}.
14927
14928 @item -fdump-unnumbered-links
14929 @opindex fdump-unnumbered-links
14930 When doing debugging dumps (see @option{-d} option above), suppress
14931 instruction numbers for the links to the previous and next instructions
14932 in a sequence.
14933
14934 @item -fdump-ipa-@var{switch}
14935 @itemx -fdump-ipa-@var{switch}-@var{options}
14936 @opindex fdump-ipa
14937 Control the dumping at various stages of inter-procedural analysis
14938 language tree to a file. The file name is generated by appending a
14939 switch specific suffix to the source file name, and the file is created
14940 in the same directory as the output file. The following dumps are
14941 possible:
14942
14943 @table @samp
14944 @item all
14945 Enables all inter-procedural analysis dumps.
14946
14947 @item cgraph
14948 Dumps information about call-graph optimization, unused function removal,
14949 and inlining decisions.
14950
14951 @item inline
14952 Dump after function inlining.
14953
14954 @end table
14955
14956 Additionally, the options @option{-optimized}, @option{-missed},
14957 @option{-note}, and @option{-all} can be provided, with the same meaning
14958 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14959
14960 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14961 information on callsites that were inlined, along with callsites
14962 that were not inlined.
14963
14964 By default, the dump will contain messages about successful
14965 optimizations (equivalent to @option{-optimized}) together with
14966 low-level details about the analysis.
14967
14968 @item -fdump-lang-all
14969 @itemx -fdump-lang-@var{switch}
14970 @itemx -fdump-lang-@var{switch}-@var{options}
14971 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14972 @opindex fdump-lang-all
14973 @opindex fdump-lang
14974 Control the dumping of language-specific information. The @var{options}
14975 and @var{filename} portions behave as described in the
14976 @option{-fdump-tree} option. The following @var{switch} values are
14977 accepted:
14978
14979 @table @samp
14980 @item all
14981
14982 Enable all language-specific dumps.
14983
14984 @item class
14985 Dump class hierarchy information. Virtual table information is emitted
14986 unless '@option{slim}' is specified. This option is applicable to C++ only.
14987
14988 @item raw
14989 Dump the raw internal tree data. This option is applicable to C++ only.
14990
14991 @end table
14992
14993 @item -fdump-passes
14994 @opindex fdump-passes
14995 Print on @file{stderr} the list of optimization passes that are turned
14996 on and off by the current command-line options.
14997
14998 @item -fdump-statistics-@var{option}
14999 @opindex fdump-statistics
15000 Enable and control dumping of pass statistics in a separate file. The
15001 file name is generated by appending a suffix ending in
15002 @samp{.statistics} to the source file name, and the file is created in
15003 the same directory as the output file. If the @samp{-@var{option}}
15004 form is used, @samp{-stats} causes counters to be summed over the
15005 whole compilation unit while @samp{-details} dumps every event as
15006 the passes generate them. The default with no option is to sum
15007 counters for each function compiled.
15008
15009 @item -fdump-tree-all
15010 @itemx -fdump-tree-@var{switch}
15011 @itemx -fdump-tree-@var{switch}-@var{options}
15012 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
15013 @opindex fdump-tree-all
15014 @opindex fdump-tree
15015 Control the dumping at various stages of processing the intermediate
15016 language tree to a file. If the @samp{-@var{options}}
15017 form is used, @var{options} is a list of @samp{-} separated options
15018 which control the details of the dump. Not all options are applicable
15019 to all dumps; those that are not meaningful are ignored. The
15020 following options are available
15021
15022 @table @samp
15023 @item address
15024 Print the address of each node. Usually this is not meaningful as it
15025 changes according to the environment and source file. Its primary use
15026 is for tying up a dump file with a debug environment.
15027 @item asmname
15028 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15029 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
15030 use working backward from mangled names in the assembly file.
15031 @item slim
15032 When dumping front-end intermediate representations, inhibit dumping
15033 of members of a scope or body of a function merely because that scope
15034 has been reached. Only dump such items when they are directly reachable
15035 by some other path.
15036
15037 When dumping pretty-printed trees, this option inhibits dumping the
15038 bodies of control structures.
15039
15040 When dumping RTL, print the RTL in slim (condensed) form instead of
15041 the default LISP-like representation.
15042 @item raw
15043 Print a raw representation of the tree. By default, trees are
15044 pretty-printed into a C-like representation.
15045 @item details
15046 Enable more detailed dumps (not honored by every dump option). Also
15047 include information from the optimization passes.
15048 @item stats
15049 Enable dumping various statistics about the pass (not honored by every dump
15050 option).
15051 @item blocks
15052 Enable showing basic block boundaries (disabled in raw dumps).
15053 @item graph
15054 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15055 dump a representation of the control flow graph suitable for viewing with
15056 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
15057 the file is pretty-printed as a subgraph, so that GraphViz can render them
15058 all in a single plot.
15059
15060 This option currently only works for RTL dumps, and the RTL is always
15061 dumped in slim form.
15062 @item vops
15063 Enable showing virtual operands for every statement.
15064 @item lineno
15065 Enable showing line numbers for statements.
15066 @item uid
15067 Enable showing the unique ID (@code{DECL_UID}) for each variable.
15068 @item verbose
15069 Enable showing the tree dump for each statement.
15070 @item eh
15071 Enable showing the EH region number holding each statement.
15072 @item scev
15073 Enable showing scalar evolution analysis details.
15074 @item optimized
15075 Enable showing optimization information (only available in certain
15076 passes).
15077 @item missed
15078 Enable showing missed optimization information (only available in certain
15079 passes).
15080 @item note
15081 Enable other detailed optimization information (only available in
15082 certain passes).
15083 @item all
15084 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15085 and @option{lineno}.
15086 @item optall
15087 Turn on all optimization options, i.e., @option{optimized},
15088 @option{missed}, and @option{note}.
15089 @end table
15090
15091 To determine what tree dumps are available or find the dump for a pass
15092 of interest follow the steps below.
15093
15094 @enumerate
15095 @item
15096 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15097 look for a code that corresponds to the pass you are interested in.
15098 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15099 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15100 The number at the end distinguishes distinct invocations of the same pass.
15101 @item
15102 To enable the creation of the dump file, append the pass code to
15103 the @option{-fdump-} option prefix and invoke GCC with it. For example,
15104 to enable the dump from the Early Value Range Propagation pass, invoke
15105 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
15106 specify the name of the dump file. If you don't specify one, GCC
15107 creates as described below.
15108 @item
15109 Find the pass dump in a file whose name is composed of three components
15110 separated by a period: the name of the source file GCC was invoked to
15111 compile, a numeric suffix indicating the pass number followed by the
15112 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15113 and finally the pass code. For example, the Early VRP pass dump might
15114 be in a file named @file{myfile.c.038t.evrp} in the current working
15115 directory. Note that the numeric codes are not stable and may change
15116 from one version of GCC to another.
15117 @end enumerate
15118
15119 @item -fopt-info
15120 @itemx -fopt-info-@var{options}
15121 @itemx -fopt-info-@var{options}=@var{filename}
15122 @opindex fopt-info
15123 Controls optimization dumps from various optimization passes. If the
15124 @samp{-@var{options}} form is used, @var{options} is a list of
15125 @samp{-} separated option keywords to select the dump details and
15126 optimizations.
15127
15128 The @var{options} can be divided into three groups:
15129 @enumerate
15130 @item
15131 options describing what kinds of messages should be emitted,
15132 @item
15133 options describing the verbosity of the dump, and
15134 @item
15135 options describing which optimizations should be included.
15136 @end enumerate
15137 The options from each group can be freely mixed as they are
15138 non-overlapping. However, in case of any conflicts,
15139 the later options override the earlier options on the command
15140 line.
15141
15142 The following options control which kinds of messages should be emitted:
15143
15144 @table @samp
15145 @item optimized
15146 Print information when an optimization is successfully applied. It is
15147 up to a pass to decide which information is relevant. For example, the
15148 vectorizer passes print the source location of loops which are
15149 successfully vectorized.
15150 @item missed
15151 Print information about missed optimizations. Individual passes
15152 control which information to include in the output.
15153 @item note
15154 Print verbose information about optimizations, such as certain
15155 transformations, more detailed messages about decisions etc.
15156 @item all
15157 Print detailed optimization information. This includes
15158 @samp{optimized}, @samp{missed}, and @samp{note}.
15159 @end table
15160
15161 The following option controls the dump verbosity:
15162
15163 @table @samp
15164 @item internals
15165 By default, only ``high-level'' messages are emitted. This option enables
15166 additional, more detailed, messages, which are likely to only be of interest
15167 to GCC developers.
15168 @end table
15169
15170 One or more of the following option keywords can be used to describe a
15171 group of optimizations:
15172
15173 @table @samp
15174 @item ipa
15175 Enable dumps from all interprocedural optimizations.
15176 @item loop
15177 Enable dumps from all loop optimizations.
15178 @item inline
15179 Enable dumps from all inlining optimizations.
15180 @item omp
15181 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15182 @item vec
15183 Enable dumps from all vectorization optimizations.
15184 @item optall
15185 Enable dumps from all optimizations. This is a superset of
15186 the optimization groups listed above.
15187 @end table
15188
15189 If @var{options} is
15190 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15191 about successful optimizations from all the passes, omitting messages
15192 that are treated as ``internals''.
15193
15194 If the @var{filename} is provided, then the dumps from all the
15195 applicable optimizations are concatenated into the @var{filename}.
15196 Otherwise the dump is output onto @file{stderr}. Though multiple
15197 @option{-fopt-info} options are accepted, only one of them can include
15198 a @var{filename}. If other filenames are provided then all but the
15199 first such option are ignored.
15200
15201 Note that the output @var{filename} is overwritten
15202 in case of multiple translation units. If a combined output from
15203 multiple translation units is desired, @file{stderr} should be used
15204 instead.
15205
15206 In the following example, the optimization info is output to
15207 @file{stderr}:
15208
15209 @smallexample
15210 gcc -O3 -fopt-info
15211 @end smallexample
15212
15213 This example:
15214 @smallexample
15215 gcc -O3 -fopt-info-missed=missed.all
15216 @end smallexample
15217
15218 @noindent
15219 outputs missed optimization report from all the passes into
15220 @file{missed.all}, and this one:
15221
15222 @smallexample
15223 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15224 @end smallexample
15225
15226 @noindent
15227 prints information about missed optimization opportunities from
15228 vectorization passes on @file{stderr}.
15229 Note that @option{-fopt-info-vec-missed} is equivalent to
15230 @option{-fopt-info-missed-vec}. The order of the optimization group
15231 names and message types listed after @option{-fopt-info} does not matter.
15232
15233 As another example,
15234 @smallexample
15235 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15236 @end smallexample
15237
15238 @noindent
15239 outputs information about missed optimizations as well as
15240 optimized locations from all the inlining passes into
15241 @file{inline.txt}.
15242
15243 Finally, consider:
15244
15245 @smallexample
15246 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15247 @end smallexample
15248
15249 @noindent
15250 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15251 in conflict since only one output file is allowed. In this case, only
15252 the first option takes effect and the subsequent options are
15253 ignored. Thus only @file{vec.miss} is produced which contains
15254 dumps from the vectorizer about missed opportunities.
15255
15256 @item -fsave-optimization-record
15257 @opindex fsave-optimization-record
15258 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15259 were performed, for those optimizations that support @option{-fopt-info}.
15260
15261 This option is experimental and the format of the data within the
15262 compressed JSON file is subject to change.
15263
15264 It is roughly equivalent to a machine-readable version of
15265 @option{-fopt-info-all}, as a collection of messages with source file,
15266 line number and column number, with the following additional data for
15267 each message:
15268
15269 @itemize @bullet
15270
15271 @item
15272 the execution count of the code being optimized, along with metadata about
15273 whether this was from actual profile data, or just an estimate, allowing
15274 consumers to prioritize messages by code hotness,
15275
15276 @item
15277 the function name of the code being optimized, where applicable,
15278
15279 @item
15280 the ``inlining chain'' for the code being optimized, so that when
15281 a function is inlined into several different places (which might
15282 themselves be inlined), the reader can distinguish between the copies,
15283
15284 @item
15285 objects identifying those parts of the message that refer to expressions,
15286 statements or symbol-table nodes, which of these categories they are, and,
15287 when available, their source code location,
15288
15289 @item
15290 the GCC pass that emitted the message, and
15291
15292 @item
15293 the location in GCC's own code from which the message was emitted
15294
15295 @end itemize
15296
15297 Additionally, some messages are logically nested within other
15298 messages, reflecting implementation details of the optimization
15299 passes.
15300
15301 @item -fsched-verbose=@var{n}
15302 @opindex fsched-verbose
15303 On targets that use instruction scheduling, this option controls the
15304 amount of debugging output the scheduler prints to the dump files.
15305
15306 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15307 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15308 For @var{n} greater than one, it also output basic block probabilities,
15309 detailed ready list information and unit/insn info. For @var{n} greater
15310 than two, it includes RTL at abort point, control-flow and regions info.
15311 And for @var{n} over four, @option{-fsched-verbose} also includes
15312 dependence info.
15313
15314
15315
15316 @item -fenable-@var{kind}-@var{pass}
15317 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15318 @opindex fdisable-
15319 @opindex fenable-
15320
15321 This is a set of options that are used to explicitly disable/enable
15322 optimization passes. These options are intended for use for debugging GCC.
15323 Compiler users should use regular options for enabling/disabling
15324 passes instead.
15325
15326 @table @gcctabopt
15327
15328 @item -fdisable-ipa-@var{pass}
15329 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15330 statically invoked in the compiler multiple times, the pass name should be
15331 appended with a sequential number starting from 1.
15332
15333 @item -fdisable-rtl-@var{pass}
15334 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15335 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15336 statically invoked in the compiler multiple times, the pass name should be
15337 appended with a sequential number starting from 1. @var{range-list} is a
15338 comma-separated list of function ranges or assembler names. Each range is a number
15339 pair separated by a colon. The range is inclusive in both ends. If the range
15340 is trivial, the number pair can be simplified as a single number. If the
15341 function's call graph node's @var{uid} falls within one of the specified ranges,
15342 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15343 function header of a dump file, and the pass names can be dumped by using
15344 option @option{-fdump-passes}.
15345
15346 @item -fdisable-tree-@var{pass}
15347 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15348 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15349 option arguments.
15350
15351 @item -fenable-ipa-@var{pass}
15352 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15353 statically invoked in the compiler multiple times, the pass name should be
15354 appended with a sequential number starting from 1.
15355
15356 @item -fenable-rtl-@var{pass}
15357 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15358 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15359 description and examples.
15360
15361 @item -fenable-tree-@var{pass}
15362 @itemx -fenable-tree-@var{pass}=@var{range-list}
15363 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15364 of option arguments.
15365
15366 @end table
15367
15368 Here are some examples showing uses of these options.
15369
15370 @smallexample
15371
15372 # disable ccp1 for all functions
15373 -fdisable-tree-ccp1
15374 # disable complete unroll for function whose cgraph node uid is 1
15375 -fenable-tree-cunroll=1
15376 # disable gcse2 for functions at the following ranges [1,1],
15377 # [300,400], and [400,1000]
15378 # disable gcse2 for functions foo and foo2
15379 -fdisable-rtl-gcse2=foo,foo2
15380 # disable early inlining
15381 -fdisable-tree-einline
15382 # disable ipa inlining
15383 -fdisable-ipa-inline
15384 # enable tree full unroll
15385 -fenable-tree-unroll
15386
15387 @end smallexample
15388
15389 @item -fchecking
15390 @itemx -fchecking=@var{n}
15391 @opindex fchecking
15392 @opindex fno-checking
15393 Enable internal consistency checking. The default depends on
15394 the compiler configuration. @option{-fchecking=2} enables further
15395 internal consistency checking that might affect code generation.
15396
15397 @item -frandom-seed=@var{string}
15398 @opindex frandom-seed
15399 This option provides a seed that GCC uses in place of
15400 random numbers in generating certain symbol names
15401 that have to be different in every compiled file. It is also used to
15402 place unique stamps in coverage data files and the object files that
15403 produce them. You can use the @option{-frandom-seed} option to produce
15404 reproducibly identical object files.
15405
15406 The @var{string} can either be a number (decimal, octal or hex) or an
15407 arbitrary string (in which case it's converted to a number by
15408 computing CRC32).
15409
15410 The @var{string} should be different for every file you compile.
15411
15412 @item -save-temps
15413 @itemx -save-temps=cwd
15414 @opindex save-temps
15415 Store the usual ``temporary'' intermediate files permanently; place them
15416 in the current directory and name them based on the source file. Thus,
15417 compiling @file{foo.c} with @option{-c -save-temps} produces files
15418 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15419 preprocessed @file{foo.i} output file even though the compiler now
15420 normally uses an integrated preprocessor.
15421
15422 When used in combination with the @option{-x} command-line option,
15423 @option{-save-temps} is sensible enough to avoid over writing an
15424 input source file with the same extension as an intermediate file.
15425 The corresponding intermediate file may be obtained by renaming the
15426 source file before using @option{-save-temps}.
15427
15428 If you invoke GCC in parallel, compiling several different source
15429 files that share a common base name in different subdirectories or the
15430 same source file compiled for multiple output destinations, it is
15431 likely that the different parallel compilers will interfere with each
15432 other, and overwrite the temporary files. For instance:
15433
15434 @smallexample
15435 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15436 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15437 @end smallexample
15438
15439 may result in @file{foo.i} and @file{foo.o} being written to
15440 simultaneously by both compilers.
15441
15442 @item -save-temps=obj
15443 @opindex save-temps=obj
15444 Store the usual ``temporary'' intermediate files permanently. If the
15445 @option{-o} option is used, the temporary files are based on the
15446 object file. If the @option{-o} option is not used, the
15447 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15448
15449 For example:
15450
15451 @smallexample
15452 gcc -save-temps=obj -c foo.c
15453 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15454 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15455 @end smallexample
15456
15457 @noindent
15458 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15459 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15460 @file{dir2/yfoobar.o}.
15461
15462 @item -time@r{[}=@var{file}@r{]}
15463 @opindex time
15464 Report the CPU time taken by each subprocess in the compilation
15465 sequence. For C source files, this is the compiler proper and assembler
15466 (plus the linker if linking is done).
15467
15468 Without the specification of an output file, the output looks like this:
15469
15470 @smallexample
15471 # cc1 0.12 0.01
15472 # as 0.00 0.01
15473 @end smallexample
15474
15475 The first number on each line is the ``user time'', that is time spent
15476 executing the program itself. The second number is ``system time'',
15477 time spent executing operating system routines on behalf of the program.
15478 Both numbers are in seconds.
15479
15480 With the specification of an output file, the output is appended to the
15481 named file, and it looks like this:
15482
15483 @smallexample
15484 0.12 0.01 cc1 @var{options}
15485 0.00 0.01 as @var{options}
15486 @end smallexample
15487
15488 The ``user time'' and the ``system time'' are moved before the program
15489 name, and the options passed to the program are displayed, so that one
15490 can later tell what file was being compiled, and with which options.
15491
15492 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15493 @opindex fdump-final-insns
15494 Dump the final internal representation (RTL) to @var{file}. If the
15495 optional argument is omitted (or if @var{file} is @code{.}), the name
15496 of the dump file is determined by appending @code{.gkd} to the
15497 compilation output file name.
15498
15499 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15500 @opindex fcompare-debug
15501 @opindex fno-compare-debug
15502 If no error occurs during compilation, run the compiler a second time,
15503 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15504 passed to the second compilation. Dump the final internal
15505 representation in both compilations, and print an error if they differ.
15506
15507 If the equal sign is omitted, the default @option{-gtoggle} is used.
15508
15509 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15510 and nonzero, implicitly enables @option{-fcompare-debug}. If
15511 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15512 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15513 is used.
15514
15515 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15516 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15517 of the final representation and the second compilation, preventing even
15518 @env{GCC_COMPARE_DEBUG} from taking effect.
15519
15520 To verify full coverage during @option{-fcompare-debug} testing, set
15521 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15522 which GCC rejects as an invalid option in any actual compilation
15523 (rather than preprocessing, assembly or linking). To get just a
15524 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15525 not overridden} will do.
15526
15527 @item -fcompare-debug-second
15528 @opindex fcompare-debug-second
15529 This option is implicitly passed to the compiler for the second
15530 compilation requested by @option{-fcompare-debug}, along with options to
15531 silence warnings, and omitting other options that would cause the compiler
15532 to produce output to files or to standard output as a side effect. Dump
15533 files and preserved temporary files are renamed so as to contain the
15534 @code{.gk} additional extension during the second compilation, to avoid
15535 overwriting those generated by the first.
15536
15537 When this option is passed to the compiler driver, it causes the
15538 @emph{first} compilation to be skipped, which makes it useful for little
15539 other than debugging the compiler proper.
15540
15541 @item -gtoggle
15542 @opindex gtoggle
15543 Turn off generation of debug info, if leaving out this option
15544 generates it, or turn it on at level 2 otherwise. The position of this
15545 argument in the command line does not matter; it takes effect after all
15546 other options are processed, and it does so only once, no matter how
15547 many times it is given. This is mainly intended to be used with
15548 @option{-fcompare-debug}.
15549
15550 @item -fvar-tracking-assignments-toggle
15551 @opindex fvar-tracking-assignments-toggle
15552 @opindex fno-var-tracking-assignments-toggle
15553 Toggle @option{-fvar-tracking-assignments}, in the same way that
15554 @option{-gtoggle} toggles @option{-g}.
15555
15556 @item -Q
15557 @opindex Q
15558 Makes the compiler print out each function name as it is compiled, and
15559 print some statistics about each pass when it finishes.
15560
15561 @item -ftime-report
15562 @opindex ftime-report
15563 Makes the compiler print some statistics about the time consumed by each
15564 pass when it finishes.
15565
15566 @item -ftime-report-details
15567 @opindex ftime-report-details
15568 Record the time consumed by infrastructure parts separately for each pass.
15569
15570 @item -fira-verbose=@var{n}
15571 @opindex fira-verbose
15572 Control the verbosity of the dump file for the integrated register allocator.
15573 The default value is 5. If the value @var{n} is greater or equal to 10,
15574 the dump output is sent to stderr using the same format as @var{n} minus 10.
15575
15576 @item -flto-report
15577 @opindex flto-report
15578 Prints a report with internal details on the workings of the link-time
15579 optimizer. The contents of this report vary from version to version.
15580 It is meant to be useful to GCC developers when processing object
15581 files in LTO mode (via @option{-flto}).
15582
15583 Disabled by default.
15584
15585 @item -flto-report-wpa
15586 @opindex flto-report-wpa
15587 Like @option{-flto-report}, but only print for the WPA phase of link-time
15588 optimization.
15589
15590 @item -fmem-report
15591 @opindex fmem-report
15592 Makes the compiler print some statistics about permanent memory
15593 allocation when it finishes.
15594
15595 @item -fmem-report-wpa
15596 @opindex fmem-report-wpa
15597 Makes the compiler print some statistics about permanent memory
15598 allocation for the WPA phase only.
15599
15600 @item -fpre-ipa-mem-report
15601 @opindex fpre-ipa-mem-report
15602 @item -fpost-ipa-mem-report
15603 @opindex fpost-ipa-mem-report
15604 Makes the compiler print some statistics about permanent memory
15605 allocation before or after interprocedural optimization.
15606
15607 @item -fprofile-report
15608 @opindex fprofile-report
15609 Makes the compiler print some statistics about consistency of the
15610 (estimated) profile and effect of individual passes.
15611
15612 @item -fstack-usage
15613 @opindex fstack-usage
15614 Makes the compiler output stack usage information for the program, on a
15615 per-function basis. The filename for the dump is made by appending
15616 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15617 the output file, if explicitly specified and it is not an executable,
15618 otherwise it is the basename of the source file. An entry is made up
15619 of three fields:
15620
15621 @itemize
15622 @item
15623 The name of the function.
15624 @item
15625 A number of bytes.
15626 @item
15627 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15628 @end itemize
15629
15630 The qualifier @code{static} means that the function manipulates the stack
15631 statically: a fixed number of bytes are allocated for the frame on function
15632 entry and released on function exit; no stack adjustments are otherwise made
15633 in the function. The second field is this fixed number of bytes.
15634
15635 The qualifier @code{dynamic} means that the function manipulates the stack
15636 dynamically: in addition to the static allocation described above, stack
15637 adjustments are made in the body of the function, for example to push/pop
15638 arguments around function calls. If the qualifier @code{bounded} is also
15639 present, the amount of these adjustments is bounded at compile time and
15640 the second field is an upper bound of the total amount of stack used by
15641 the function. If it is not present, the amount of these adjustments is
15642 not bounded at compile time and the second field only represents the
15643 bounded part.
15644
15645 @item -fstats
15646 @opindex fstats
15647 Emit statistics about front-end processing at the end of the compilation.
15648 This option is supported only by the C++ front end, and
15649 the information is generally only useful to the G++ development team.
15650
15651 @item -fdbg-cnt-list
15652 @opindex fdbg-cnt-list
15653 Print the name and the counter upper bound for all debug counters.
15654
15655
15656 @item -fdbg-cnt=@var{counter-value-list}
15657 @opindex fdbg-cnt
15658 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15659 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
15660 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
15661 the name of the counter and list of closed intervals.
15662 The @var{lower_bound} is optional and is zero
15663 initialized if not set.
15664 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
15665 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
15666 eleventh invocation.
15667 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15668
15669 @item -print-file-name=@var{library}
15670 @opindex print-file-name
15671 Print the full absolute name of the library file @var{library} that
15672 would be used when linking---and don't do anything else. With this
15673 option, GCC does not compile or link anything; it just prints the
15674 file name.
15675
15676 @item -print-multi-directory
15677 @opindex print-multi-directory
15678 Print the directory name corresponding to the multilib selected by any
15679 other switches present in the command line. This directory is supposed
15680 to exist in @env{GCC_EXEC_PREFIX}.
15681
15682 @item -print-multi-lib
15683 @opindex print-multi-lib
15684 Print the mapping from multilib directory names to compiler switches
15685 that enable them. The directory name is separated from the switches by
15686 @samp{;}, and each switch starts with an @samp{@@} instead of the
15687 @samp{-}, without spaces between multiple switches. This is supposed to
15688 ease shell processing.
15689
15690 @item -print-multi-os-directory
15691 @opindex print-multi-os-directory
15692 Print the path to OS libraries for the selected
15693 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15694 present in the @file{lib} subdirectory and no multilibs are used, this is
15695 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15696 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15697 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15698 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15699
15700 @item -print-multiarch
15701 @opindex print-multiarch
15702 Print the path to OS libraries for the selected multiarch,
15703 relative to some @file{lib} subdirectory.
15704
15705 @item -print-prog-name=@var{program}
15706 @opindex print-prog-name
15707 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15708
15709 @item -print-libgcc-file-name
15710 @opindex print-libgcc-file-name
15711 Same as @option{-print-file-name=libgcc.a}.
15712
15713 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15714 but you do want to link with @file{libgcc.a}. You can do:
15715
15716 @smallexample
15717 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15718 @end smallexample
15719
15720 @item -print-search-dirs
15721 @opindex print-search-dirs
15722 Print the name of the configured installation directory and a list of
15723 program and library directories @command{gcc} searches---and don't do anything else.
15724
15725 This is useful when @command{gcc} prints the error message
15726 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15727 To resolve this you either need to put @file{cpp0} and the other compiler
15728 components where @command{gcc} expects to find them, or you can set the environment
15729 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15730 Don't forget the trailing @samp{/}.
15731 @xref{Environment Variables}.
15732
15733 @item -print-sysroot
15734 @opindex print-sysroot
15735 Print the target sysroot directory that is used during
15736 compilation. This is the target sysroot specified either at configure
15737 time or using the @option{--sysroot} option, possibly with an extra
15738 suffix that depends on compilation options. If no target sysroot is
15739 specified, the option prints nothing.
15740
15741 @item -print-sysroot-headers-suffix
15742 @opindex print-sysroot-headers-suffix
15743 Print the suffix added to the target sysroot when searching for
15744 headers, or give an error if the compiler is not configured with such
15745 a suffix---and don't do anything else.
15746
15747 @item -dumpmachine
15748 @opindex dumpmachine
15749 Print the compiler's target machine (for example,
15750 @samp{i686-pc-linux-gnu})---and don't do anything else.
15751
15752 @item -dumpversion
15753 @opindex dumpversion
15754 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15755 anything else. This is the compiler version used in filesystem paths and
15756 specs. Depending on how the compiler has been configured it can be just
15757 a single number (major version), two numbers separated by a dot (major and
15758 minor version) or three numbers separated by dots (major, minor and patchlevel
15759 version).
15760
15761 @item -dumpfullversion
15762 @opindex dumpfullversion
15763 Print the full compiler version---and don't do anything else. The output is
15764 always three numbers separated by dots, major, minor and patchlevel version.
15765
15766 @item -dumpspecs
15767 @opindex dumpspecs
15768 Print the compiler's built-in specs---and don't do anything else. (This
15769 is used when GCC itself is being built.) @xref{Spec Files}.
15770 @end table
15771
15772 @node Submodel Options
15773 @section Machine-Dependent Options
15774 @cindex submodel options
15775 @cindex specifying hardware config
15776 @cindex hardware models and configurations, specifying
15777 @cindex target-dependent options
15778 @cindex machine-dependent options
15779
15780 Each target machine supported by GCC can have its own options---for
15781 example, to allow you to compile for a particular processor variant or
15782 ABI, or to control optimizations specific to that machine. By
15783 convention, the names of machine-specific options start with
15784 @samp{-m}.
15785
15786 Some configurations of the compiler also support additional target-specific
15787 options, usually for compatibility with other compilers on the same
15788 platform.
15789
15790 @c This list is ordered alphanumerically by subsection name.
15791 @c It should be the same order and spelling as these options are listed
15792 @c in Machine Dependent Options
15793
15794 @menu
15795 * AArch64 Options::
15796 * Adapteva Epiphany Options::
15797 * AMD GCN Options::
15798 * ARC Options::
15799 * ARM Options::
15800 * AVR Options::
15801 * Blackfin Options::
15802 * C6X Options::
15803 * CRIS Options::
15804 * CR16 Options::
15805 * C-SKY Options::
15806 * Darwin Options::
15807 * DEC Alpha Options::
15808 * eBPF Options::
15809 * FR30 Options::
15810 * FT32 Options::
15811 * FRV Options::
15812 * GNU/Linux Options::
15813 * H8/300 Options::
15814 * HPPA Options::
15815 * IA-64 Options::
15816 * LM32 Options::
15817 * M32C Options::
15818 * M32R/D Options::
15819 * M680x0 Options::
15820 * MCore Options::
15821 * MeP Options::
15822 * MicroBlaze Options::
15823 * MIPS Options::
15824 * MMIX Options::
15825 * MN10300 Options::
15826 * Moxie Options::
15827 * MSP430 Options::
15828 * NDS32 Options::
15829 * Nios II Options::
15830 * Nvidia PTX Options::
15831 * OpenRISC Options::
15832 * PDP-11 Options::
15833 * picoChip Options::
15834 * PowerPC Options::
15835 * PRU Options::
15836 * RISC-V Options::
15837 * RL78 Options::
15838 * RS/6000 and PowerPC Options::
15839 * RX Options::
15840 * S/390 and zSeries Options::
15841 * Score Options::
15842 * SH Options::
15843 * Solaris 2 Options::
15844 * SPARC Options::
15845 * System V Options::
15846 * TILE-Gx Options::
15847 * TILEPro Options::
15848 * V850 Options::
15849 * VAX Options::
15850 * Visium Options::
15851 * VMS Options::
15852 * VxWorks Options::
15853 * x86 Options::
15854 * x86 Windows Options::
15855 * Xstormy16 Options::
15856 * Xtensa Options::
15857 * zSeries Options::
15858 @end menu
15859
15860 @node AArch64 Options
15861 @subsection AArch64 Options
15862 @cindex AArch64 Options
15863
15864 These options are defined for AArch64 implementations:
15865
15866 @table @gcctabopt
15867
15868 @item -mabi=@var{name}
15869 @opindex mabi
15870 Generate code for the specified data model. Permissible values
15871 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15872 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15873 but long int and pointers are 64 bits.
15874
15875 The default depends on the specific target configuration. Note that
15876 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15877 entire program with the same ABI, and link with a compatible set of libraries.
15878
15879 @item -mbig-endian
15880 @opindex mbig-endian
15881 Generate big-endian code. This is the default when GCC is configured for an
15882 @samp{aarch64_be-*-*} target.
15883
15884 @item -mgeneral-regs-only
15885 @opindex mgeneral-regs-only
15886 Generate code which uses only the general-purpose registers. This will prevent
15887 the compiler from using floating-point and Advanced SIMD registers but will not
15888 impose any restrictions on the assembler.
15889
15890 @item -mlittle-endian
15891 @opindex mlittle-endian
15892 Generate little-endian code. This is the default when GCC is configured for an
15893 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15894
15895 @item -mcmodel=tiny
15896 @opindex mcmodel=tiny
15897 Generate code for the tiny code model. The program and its statically defined
15898 symbols must be within 1MB of each other. Programs can be statically or
15899 dynamically linked.
15900
15901 @item -mcmodel=small
15902 @opindex mcmodel=small
15903 Generate code for the small code model. The program and its statically defined
15904 symbols must be within 4GB of each other. Programs can be statically or
15905 dynamically linked. This is the default code model.
15906
15907 @item -mcmodel=large
15908 @opindex mcmodel=large
15909 Generate code for the large code model. This makes no assumptions about
15910 addresses and sizes of sections. Programs can be statically linked only.
15911
15912 @item -mstrict-align
15913 @itemx -mno-strict-align
15914 @opindex mstrict-align
15915 @opindex mno-strict-align
15916 Avoid or allow generating memory accesses that may not be aligned on a natural
15917 object boundary as described in the architecture specification.
15918
15919 @item -momit-leaf-frame-pointer
15920 @itemx -mno-omit-leaf-frame-pointer
15921 @opindex momit-leaf-frame-pointer
15922 @opindex mno-omit-leaf-frame-pointer
15923 Omit or keep the frame pointer in leaf functions. The former behavior is the
15924 default.
15925
15926 @item -mstack-protector-guard=@var{guard}
15927 @itemx -mstack-protector-guard-reg=@var{reg}
15928 @itemx -mstack-protector-guard-offset=@var{offset}
15929 @opindex mstack-protector-guard
15930 @opindex mstack-protector-guard-reg
15931 @opindex mstack-protector-guard-offset
15932 Generate stack protection code using canary at @var{guard}. Supported
15933 locations are @samp{global} for a global canary or @samp{sysreg} for a
15934 canary in an appropriate system register.
15935
15936 With the latter choice the options
15937 @option{-mstack-protector-guard-reg=@var{reg}} and
15938 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15939 which system register to use as base register for reading the canary,
15940 and from what offset from that base register. There is no default
15941 register or offset as this is entirely for use within the Linux
15942 kernel.
15943
15944 @item -mstack-protector-guard=@var{guard}
15945 @itemx -mstack-protector-guard-reg=@var{reg}
15946 @itemx -mstack-protector-guard-offset=@var{offset}
15947 @opindex mstack-protector-guard
15948 @opindex mstack-protector-guard-reg
15949 @opindex mstack-protector-guard-offset
15950 Generate stack protection code using canary at @var{guard}. Supported
15951 locations are @samp{global} for a global canary or @samp{sysreg} for a
15952 canary in an appropriate system register.
15953
15954 With the latter choice the options
15955 @option{-mstack-protector-guard-reg=@var{reg}} and
15956 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15957 which system register to use as base register for reading the canary,
15958 and from what offset from that base register. There is no default
15959 register or offset as this is entirely for use within the Linux
15960 kernel.
15961
15962 @item -mtls-dialect=desc
15963 @opindex mtls-dialect=desc
15964 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15965 of TLS variables. This is the default.
15966
15967 @item -mtls-dialect=traditional
15968 @opindex mtls-dialect=traditional
15969 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15970 of TLS variables.
15971
15972 @item -mtls-size=@var{size}
15973 @opindex mtls-size
15974 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15975 This option requires binutils 2.26 or newer.
15976
15977 @item -mfix-cortex-a53-835769
15978 @itemx -mno-fix-cortex-a53-835769
15979 @opindex mfix-cortex-a53-835769
15980 @opindex mno-fix-cortex-a53-835769
15981 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15982 This involves inserting a NOP instruction between memory instructions and
15983 64-bit integer multiply-accumulate instructions.
15984
15985 @item -mfix-cortex-a53-843419
15986 @itemx -mno-fix-cortex-a53-843419
15987 @opindex mfix-cortex-a53-843419
15988 @opindex mno-fix-cortex-a53-843419
15989 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15990 This erratum workaround is made at link time and this will only pass the
15991 corresponding flag to the linker.
15992
15993 @item -mlow-precision-recip-sqrt
15994 @itemx -mno-low-precision-recip-sqrt
15995 @opindex mlow-precision-recip-sqrt
15996 @opindex mno-low-precision-recip-sqrt
15997 Enable or disable the reciprocal square root approximation.
15998 This option only has an effect if @option{-ffast-math} or
15999 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16000 precision of reciprocal square root results to about 16 bits for
16001 single precision and to 32 bits for double precision.
16002
16003 @item -mlow-precision-sqrt
16004 @itemx -mno-low-precision-sqrt
16005 @opindex mlow-precision-sqrt
16006 @opindex mno-low-precision-sqrt
16007 Enable or disable the square root approximation.
16008 This option only has an effect if @option{-ffast-math} or
16009 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16010 precision of square root results to about 16 bits for
16011 single precision and to 32 bits for double precision.
16012 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
16013
16014 @item -mlow-precision-div
16015 @itemx -mno-low-precision-div
16016 @opindex mlow-precision-div
16017 @opindex mno-low-precision-div
16018 Enable or disable the division approximation.
16019 This option only has an effect if @option{-ffast-math} or
16020 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16021 precision of division results to about 16 bits for
16022 single precision and to 32 bits for double precision.
16023
16024 @item -mtrack-speculation
16025 @itemx -mno-track-speculation
16026 Enable or disable generation of additional code to track speculative
16027 execution through conditional branches. The tracking state can then
16028 be used by the compiler when expanding calls to
16029 @code{__builtin_speculation_safe_copy} to permit a more efficient code
16030 sequence to be generated.
16031
16032 @item -moutline-atomics
16033 @itemx -mno-outline-atomics
16034 Enable or disable calls to out-of-line helpers to implement atomic operations.
16035 These helpers will, at runtime, determine if the LSE instructions from
16036 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16037 instructions that are present in the base ARMv8.0 ISA.
16038
16039 This option is only applicable when compiling for the base ARMv8.0
16040 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
16041 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16042 used directly. The same applies when using @option{-mcpu=} when the
16043 selected cpu supports the @samp{lse} feature.
16044
16045 @item -march=@var{name}
16046 @opindex march
16047 Specify the name of the target architecture and, optionally, one or
16048 more feature modifiers. This option has the form
16049 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16050
16051 The permissible values for @var{arch} are @samp{armv8-a},
16052 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
16053 @samp{armv8.5-a} or @var{native}.
16054
16055 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
16056 support for the ARMv8.5-A architecture extensions.
16057
16058 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
16059 support for the ARMv8.4-A architecture extensions.
16060
16061 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
16062 support for the ARMv8.3-A architecture extensions.
16063
16064 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
16065 support for the ARMv8.2-A architecture extensions.
16066
16067 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
16068 support for the ARMv8.1-A architecture extension. In particular, it
16069 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
16070
16071 The value @samp{native} is available on native AArch64 GNU/Linux and
16072 causes the compiler to pick the architecture of the host system. This
16073 option has no effect if the compiler is unable to recognize the
16074 architecture of the host system,
16075
16076 The permissible values for @var{feature} are listed in the sub-section
16077 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16078 Feature Modifiers}. Where conflicting feature modifiers are
16079 specified, the right-most feature is used.
16080
16081 GCC uses @var{name} to determine what kind of instructions it can emit
16082 when generating assembly code. If @option{-march} is specified
16083 without either of @option{-mtune} or @option{-mcpu} also being
16084 specified, the code is tuned to perform well across a range of target
16085 processors implementing the target architecture.
16086
16087 @item -mtune=@var{name}
16088 @opindex mtune
16089 Specify the name of the target processor for which GCC should tune the
16090 performance of the code. Permissible values for this option are:
16091 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16092 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16093 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16094 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16095 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16096 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16097 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16098 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
16099 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16100 @samp{thunderxt83}, @samp{thunderx2t99},
16101 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16102 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16103 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16104 @samp{native}.
16105
16106 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16107 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16108 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16109 should tune for a big.LITTLE system.
16110
16111 Additionally on native AArch64 GNU/Linux systems the value
16112 @samp{native} tunes performance to the host system. This option has no effect
16113 if the compiler is unable to recognize the processor of the host system.
16114
16115 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16116 are specified, the code is tuned to perform well across a range
16117 of target processors.
16118
16119 This option cannot be suffixed by feature modifiers.
16120
16121 @item -mcpu=@var{name}
16122 @opindex mcpu
16123 Specify the name of the target processor, optionally suffixed by one
16124 or more feature modifiers. This option has the form
16125 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16126 the permissible values for @var{cpu} are the same as those available
16127 for @option{-mtune}. The permissible values for @var{feature} are
16128 documented in the sub-section on
16129 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16130 Feature Modifiers}. Where conflicting feature modifiers are
16131 specified, the right-most feature is used.
16132
16133 GCC uses @var{name} to determine what kind of instructions it can emit when
16134 generating assembly code (as if by @option{-march}) and to determine
16135 the target processor for which to tune for performance (as if
16136 by @option{-mtune}). Where this option is used in conjunction
16137 with @option{-march} or @option{-mtune}, those options take precedence
16138 over the appropriate part of this option.
16139
16140 @item -moverride=@var{string}
16141 @opindex moverride
16142 Override tuning decisions made by the back-end in response to a
16143 @option{-mtune=} switch. The syntax, semantics, and accepted values
16144 for @var{string} in this option are not guaranteed to be consistent
16145 across releases.
16146
16147 This option is only intended to be useful when developing GCC.
16148
16149 @item -mverbose-cost-dump
16150 @opindex mverbose-cost-dump
16151 Enable verbose cost model dumping in the debug dump files. This option is
16152 provided for use in debugging the compiler.
16153
16154 @item -mpc-relative-literal-loads
16155 @itemx -mno-pc-relative-literal-loads
16156 @opindex mpc-relative-literal-loads
16157 @opindex mno-pc-relative-literal-loads
16158 Enable or disable PC-relative literal loads. With this option literal pools are
16159 accessed using a single instruction and emitted after each function. This
16160 limits the maximum size of functions to 1MB. This is enabled by default for
16161 @option{-mcmodel=tiny}.
16162
16163 @item -msign-return-address=@var{scope}
16164 @opindex msign-return-address
16165 Select the function scope on which return address signing will be applied.
16166 Permissible values are @samp{none}, which disables return address signing,
16167 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16168 functions, and @samp{all}, which enables pointer signing for all functions. The
16169 default value is @samp{none}. This option has been deprecated by
16170 -mbranch-protection.
16171
16172 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16173 @opindex mbranch-protection
16174 Select the branch protection features to use.
16175 @samp{none} is the default and turns off all types of branch protection.
16176 @samp{standard} turns on all types of branch protection features. If a feature
16177 has additional tuning options, then @samp{standard} sets it to its standard
16178 level.
16179 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16180 level: signing functions that save the return address to memory (non-leaf
16181 functions will practically always do this) using the a-key. The optional
16182 argument @samp{leaf} can be used to extend the signing to include leaf
16183 functions. The optional argument @samp{b-key} can be used to sign the functions
16184 with the B-key instead of the A-key.
16185 @samp{bti} turns on branch target identification mechanism.
16186
16187 @item -msve-vector-bits=@var{bits}
16188 @opindex msve-vector-bits
16189 Specify the number of bits in an SVE vector register. This option only has
16190 an effect when SVE is enabled.
16191
16192 GCC supports two forms of SVE code generation: ``vector-length
16193 agnostic'' output that works with any size of vector register and
16194 ``vector-length specific'' output that allows GCC to make assumptions
16195 about the vector length when it is useful for optimization reasons.
16196 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16197 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16198 Specifying @samp{scalable} selects vector-length agnostic
16199 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16200 agnostic output. All other values generate vector-length specific code.
16201 The behavior of these values may change in future releases and no value except
16202 @samp{scalable} should be relied on for producing code that is portable across
16203 different hardware SVE vector lengths.
16204
16205 The default is @samp{-msve-vector-bits=scalable}, which produces
16206 vector-length agnostic code.
16207 @end table
16208
16209 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16210 @anchor{aarch64-feature-modifiers}
16211 @cindex @option{-march} feature modifiers
16212 @cindex @option{-mcpu} feature modifiers
16213 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16214 the following and their inverses @option{no@var{feature}}:
16215
16216 @table @samp
16217 @item crc
16218 Enable CRC extension. This is on by default for
16219 @option{-march=armv8.1-a}.
16220 @item crypto
16221 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16222 instructions.
16223 @item fp
16224 Enable floating-point instructions. This is on by default for all possible
16225 values for options @option{-march} and @option{-mcpu}.
16226 @item simd
16227 Enable Advanced SIMD instructions. This also enables floating-point
16228 instructions. This is on by default for all possible values for options
16229 @option{-march} and @option{-mcpu}.
16230 @item sve
16231 Enable Scalable Vector Extension instructions. This also enables Advanced
16232 SIMD and floating-point instructions.
16233 @item lse
16234 Enable Large System Extension instructions. This is on by default for
16235 @option{-march=armv8.1-a}.
16236 @item rdma
16237 Enable Round Double Multiply Accumulate instructions. This is on by default
16238 for @option{-march=armv8.1-a}.
16239 @item fp16
16240 Enable FP16 extension. This also enables floating-point instructions.
16241 @item fp16fml
16242 Enable FP16 fmla extension. This also enables FP16 extensions and
16243 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.
16244
16245 @item rcpc
16246 Enable the RcPc extension. This does not change code generation from GCC,
16247 but is passed on to the assembler, enabling inline asm statements to use
16248 instructions from the RcPc extension.
16249 @item dotprod
16250 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16251 @item aes
16252 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16253 SIMD instructions.
16254 @item sha2
16255 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16256 @item sha3
16257 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16258 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16259 @item sm4
16260 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16261 Use of this option with architectures prior to Armv8.2-A is not supported.
16262 @item profile
16263 Enable the Statistical Profiling extension. This option is only to enable the
16264 extension at the assembler level and does not affect code generation.
16265 @item rng
16266 Enable the Armv8.5-a Random Number instructions. This option is only to
16267 enable the extension at the assembler level and does not affect code
16268 generation.
16269 @item memtag
16270 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16271 enable the extension at the assembler level and does not affect code
16272 generation.
16273 @item sb
16274 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16275 enable the extension at the assembler level and does not affect code
16276 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16277 @item ssbs
16278 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16279 is only to enable the extension at the assembler level and does not affect code
16280 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16281 @item predres
16282 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16283 This option is only to enable the extension at the assembler level and does
16284 not affect code generation. This option is enabled by default for
16285 @item sve2
16286 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16287 instructions.
16288 @item sve2-bitperm
16289 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16290 @item sve2-sm4
16291 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16292 @item sve2-aes
16293 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16294 @item sve2-sha3
16295 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16296 @option{-march=armv8.5-a}.
16297 @item tme
16298 Enable the Transactional Memory Extension.
16299
16300 @end table
16301
16302 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16303 which implies @option{fp}.
16304 Conversely, @option{nofp} implies @option{nosimd}, which implies
16305 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16306
16307 @node Adapteva Epiphany Options
16308 @subsection Adapteva Epiphany Options
16309
16310 These @samp{-m} options are defined for Adapteva Epiphany:
16311
16312 @table @gcctabopt
16313 @item -mhalf-reg-file
16314 @opindex mhalf-reg-file
16315 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16316 That allows code to run on hardware variants that lack these registers.
16317
16318 @item -mprefer-short-insn-regs
16319 @opindex mprefer-short-insn-regs
16320 Preferentially allocate registers that allow short instruction generation.
16321 This can result in increased instruction count, so this may either reduce or
16322 increase overall code size.
16323
16324 @item -mbranch-cost=@var{num}
16325 @opindex mbranch-cost
16326 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16327 This cost is only a heuristic and is not guaranteed to produce
16328 consistent results across releases.
16329
16330 @item -mcmove
16331 @opindex mcmove
16332 Enable the generation of conditional moves.
16333
16334 @item -mnops=@var{num}
16335 @opindex mnops
16336 Emit @var{num} NOPs before every other generated instruction.
16337
16338 @item -mno-soft-cmpsf
16339 @opindex mno-soft-cmpsf
16340 @opindex msoft-cmpsf
16341 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16342 and test the flags. This is faster than a software comparison, but can
16343 get incorrect results in the presence of NaNs, or when two different small
16344 numbers are compared such that their difference is calculated as zero.
16345 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16346 software comparisons.
16347
16348 @item -mstack-offset=@var{num}
16349 @opindex mstack-offset
16350 Set the offset between the top of the stack and the stack pointer.
16351 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16352 can be used by leaf functions without stack allocation.
16353 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16354 Note also that this option changes the ABI; compiling a program with a
16355 different stack offset than the libraries have been compiled with
16356 generally does not work.
16357 This option can be useful if you want to evaluate if a different stack
16358 offset would give you better code, but to actually use a different stack
16359 offset to build working programs, it is recommended to configure the
16360 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16361
16362 @item -mno-round-nearest
16363 @opindex mno-round-nearest
16364 @opindex mround-nearest
16365 Make the scheduler assume that the rounding mode has been set to
16366 truncating. The default is @option{-mround-nearest}.
16367
16368 @item -mlong-calls
16369 @opindex mlong-calls
16370 If not otherwise specified by an attribute, assume all calls might be beyond
16371 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16372 function address into a register before performing a (otherwise direct) call.
16373 This is the default.
16374
16375 @item -mshort-calls
16376 @opindex short-calls
16377 If not otherwise specified by an attribute, assume all direct calls are
16378 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16379 for direct calls. The default is @option{-mlong-calls}.
16380
16381 @item -msmall16
16382 @opindex msmall16
16383 Assume addresses can be loaded as 16-bit unsigned values. This does not
16384 apply to function addresses for which @option{-mlong-calls} semantics
16385 are in effect.
16386
16387 @item -mfp-mode=@var{mode}
16388 @opindex mfp-mode
16389 Set the prevailing mode of the floating-point unit.
16390 This determines the floating-point mode that is provided and expected
16391 at function call and return time. Making this mode match the mode you
16392 predominantly need at function start can make your programs smaller and
16393 faster by avoiding unnecessary mode switches.
16394
16395 @var{mode} can be set to one the following values:
16396
16397 @table @samp
16398 @item caller
16399 Any mode at function entry is valid, and retained or restored when
16400 the function returns, and when it calls other functions.
16401 This mode is useful for compiling libraries or other compilation units
16402 you might want to incorporate into different programs with different
16403 prevailing FPU modes, and the convenience of being able to use a single
16404 object file outweighs the size and speed overhead for any extra
16405 mode switching that might be needed, compared with what would be needed
16406 with a more specific choice of prevailing FPU mode.
16407
16408 @item truncate
16409 This is the mode used for floating-point calculations with
16410 truncating (i.e.@: round towards zero) rounding mode. That includes
16411 conversion from floating point to integer.
16412
16413 @item round-nearest
16414 This is the mode used for floating-point calculations with
16415 round-to-nearest-or-even rounding mode.
16416
16417 @item int
16418 This is the mode used to perform integer calculations in the FPU, e.g.@:
16419 integer multiply, or integer multiply-and-accumulate.
16420 @end table
16421
16422 The default is @option{-mfp-mode=caller}
16423
16424 @item -mno-split-lohi
16425 @itemx -mno-postinc
16426 @itemx -mno-postmodify
16427 @opindex mno-split-lohi
16428 @opindex msplit-lohi
16429 @opindex mno-postinc
16430 @opindex mpostinc
16431 @opindex mno-postmodify
16432 @opindex mpostmodify
16433 Code generation tweaks that disable, respectively, splitting of 32-bit
16434 loads, generation of post-increment addresses, and generation of
16435 post-modify addresses. The defaults are @option{msplit-lohi},
16436 @option{-mpost-inc}, and @option{-mpost-modify}.
16437
16438 @item -mnovect-double
16439 @opindex mno-vect-double
16440 @opindex mvect-double
16441 Change the preferred SIMD mode to SImode. The default is
16442 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16443
16444 @item -max-vect-align=@var{num}
16445 @opindex max-vect-align
16446 The maximum alignment for SIMD vector mode types.
16447 @var{num} may be 4 or 8. The default is 8.
16448 Note that this is an ABI change, even though many library function
16449 interfaces are unaffected if they don't use SIMD vector modes
16450 in places that affect size and/or alignment of relevant types.
16451
16452 @item -msplit-vecmove-early
16453 @opindex msplit-vecmove-early
16454 Split vector moves into single word moves before reload. In theory this
16455 can give better register allocation, but so far the reverse seems to be
16456 generally the case.
16457
16458 @item -m1reg-@var{reg}
16459 @opindex m1reg-
16460 Specify a register to hold the constant @minus{}1, which makes loading small negative
16461 constants and certain bitmasks faster.
16462 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16463 which specify use of that register as a fixed register,
16464 and @samp{none}, which means that no register is used for this
16465 purpose. The default is @option{-m1reg-none}.
16466
16467 @end table
16468
16469 @node AMD GCN Options
16470 @subsection AMD GCN Options
16471 @cindex AMD GCN Options
16472
16473 These options are defined specifically for the AMD GCN port.
16474
16475 @table @gcctabopt
16476
16477 @item -march=@var{gpu}
16478 @opindex march
16479 @itemx -mtune=@var{gpu}
16480 @opindex mtune
16481 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16482 are
16483
16484 @table @samp
16485 @opindex fiji
16486 @item fiji
16487 Compile for GCN3 Fiji devices (gfx803).
16488
16489 @item gfx900
16490 Compile for GCN5 Vega 10 devices (gfx900).
16491
16492 @item gfx906
16493 Compile for GCN5 Vega 20 devices (gfx906).
16494
16495 @end table
16496
16497 @item -mstack-size=@var{bytes}
16498 @opindex mstack-size
16499 Specify how many @var{bytes} of stack space will be requested for each GPU
16500 thread (wave-front). Beware that there may be many threads and limited memory
16501 available. The size of the stack allocation may also have an impact on
16502 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16503 1MB otherwise.
16504
16505 @end table
16506
16507 @node ARC Options
16508 @subsection ARC Options
16509 @cindex ARC options
16510
16511 The following options control the architecture variant for which code
16512 is being compiled:
16513
16514 @c architecture variants
16515 @table @gcctabopt
16516
16517 @item -mbarrel-shifter
16518 @opindex mbarrel-shifter
16519 Generate instructions supported by barrel shifter. This is the default
16520 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16521
16522 @item -mjli-always
16523 @opindex mjli-alawys
16524 Force to call a function using jli_s instruction. This option is
16525 valid only for ARCv2 architecture.
16526
16527 @item -mcpu=@var{cpu}
16528 @opindex mcpu
16529 Set architecture type, register usage, and instruction scheduling
16530 parameters for @var{cpu}. There are also shortcut alias options
16531 available for backward compatibility and convenience. Supported
16532 values for @var{cpu} are
16533
16534 @table @samp
16535 @opindex mA6
16536 @opindex mARC600
16537 @item arc600
16538 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16539
16540 @item arc601
16541 @opindex mARC601
16542 Compile for ARC601. Alias: @option{-mARC601}.
16543
16544 @item arc700
16545 @opindex mA7
16546 @opindex mARC700
16547 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16548 This is the default when configured with @option{--with-cpu=arc700}@.
16549
16550 @item arcem
16551 Compile for ARC EM.
16552
16553 @item archs
16554 Compile for ARC HS.
16555
16556 @item em
16557 Compile for ARC EM CPU with no hardware extensions.
16558
16559 @item em4
16560 Compile for ARC EM4 CPU.
16561
16562 @item em4_dmips
16563 Compile for ARC EM4 DMIPS CPU.
16564
16565 @item em4_fpus
16566 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16567 extension.
16568
16569 @item em4_fpuda
16570 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16571 double assist instructions.
16572
16573 @item hs
16574 Compile for ARC HS CPU with no hardware extensions except the atomic
16575 instructions.
16576
16577 @item hs34
16578 Compile for ARC HS34 CPU.
16579
16580 @item hs38
16581 Compile for ARC HS38 CPU.
16582
16583 @item hs38_linux
16584 Compile for ARC HS38 CPU with all hardware extensions on.
16585
16586 @item arc600_norm
16587 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16588
16589 @item arc600_mul32x16
16590 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16591 instructions enabled.
16592
16593 @item arc600_mul64
16594 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16595 instructions enabled.
16596
16597 @item arc601_norm
16598 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16599
16600 @item arc601_mul32x16
16601 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16602 instructions enabled.
16603
16604 @item arc601_mul64
16605 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16606 instructions enabled.
16607
16608 @item nps400
16609 Compile for ARC 700 on NPS400 chip.
16610
16611 @item em_mini
16612 Compile for ARC EM minimalist configuration featuring reduced register
16613 set.
16614
16615 @end table
16616
16617 @item -mdpfp
16618 @opindex mdpfp
16619 @itemx -mdpfp-compact
16620 @opindex mdpfp-compact
16621 Generate double-precision FPX instructions, tuned for the compact
16622 implementation.
16623
16624 @item -mdpfp-fast
16625 @opindex mdpfp-fast
16626 Generate double-precision FPX instructions, tuned for the fast
16627 implementation.
16628
16629 @item -mno-dpfp-lrsr
16630 @opindex mno-dpfp-lrsr
16631 Disable @code{lr} and @code{sr} instructions from using FPX extension
16632 aux registers.
16633
16634 @item -mea
16635 @opindex mea
16636 Generate extended arithmetic instructions. Currently only
16637 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16638 supported. Only valid for @option{-mcpu=ARC700}.
16639
16640 @item -mno-mpy
16641 @opindex mno-mpy
16642 @opindex mmpy
16643 Do not generate @code{mpy}-family instructions for ARC700. This option is
16644 deprecated.
16645
16646 @item -mmul32x16
16647 @opindex mmul32x16
16648 Generate 32x16-bit multiply and multiply-accumulate instructions.
16649
16650 @item -mmul64
16651 @opindex mmul64
16652 Generate @code{mul64} and @code{mulu64} instructions.
16653 Only valid for @option{-mcpu=ARC600}.
16654
16655 @item -mnorm
16656 @opindex mnorm
16657 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16658 is in effect.
16659
16660 @item -mspfp
16661 @opindex mspfp
16662 @itemx -mspfp-compact
16663 @opindex mspfp-compact
16664 Generate single-precision FPX instructions, tuned for the compact
16665 implementation.
16666
16667 @item -mspfp-fast
16668 @opindex mspfp-fast
16669 Generate single-precision FPX instructions, tuned for the fast
16670 implementation.
16671
16672 @item -msimd
16673 @opindex msimd
16674 Enable generation of ARC SIMD instructions via target-specific
16675 builtins. Only valid for @option{-mcpu=ARC700}.
16676
16677 @item -msoft-float
16678 @opindex msoft-float
16679 This option ignored; it is provided for compatibility purposes only.
16680 Software floating-point code is emitted by default, and this default
16681 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16682 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16683 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16684
16685 @item -mswap
16686 @opindex mswap
16687 Generate @code{swap} instructions.
16688
16689 @item -matomic
16690 @opindex matomic
16691 This enables use of the locked load/store conditional extension to implement
16692 atomic memory built-in functions. Not available for ARC 6xx or ARC
16693 EM cores.
16694
16695 @item -mdiv-rem
16696 @opindex mdiv-rem
16697 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16698
16699 @item -mcode-density
16700 @opindex mcode-density
16701 Enable code density instructions for ARC EM.
16702 This option is on by default for ARC HS.
16703
16704 @item -mll64
16705 @opindex mll64
16706 Enable double load/store operations for ARC HS cores.
16707
16708 @item -mtp-regno=@var{regno}
16709 @opindex mtp-regno
16710 Specify thread pointer register number.
16711
16712 @item -mmpy-option=@var{multo}
16713 @opindex mmpy-option
16714 Compile ARCv2 code with a multiplier design option. You can specify
16715 the option using either a string or numeric value for @var{multo}.
16716 @samp{wlh1} is the default value. The recognized values are:
16717
16718 @table @samp
16719 @item 0
16720 @itemx none
16721 No multiplier available.
16722
16723 @item 1
16724 @itemx w
16725 16x16 multiplier, fully pipelined.
16726 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16727
16728 @item 2
16729 @itemx wlh1
16730 32x32 multiplier, fully
16731 pipelined (1 stage). The following instructions are additionally
16732 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16733
16734 @item 3
16735 @itemx wlh2
16736 32x32 multiplier, fully pipelined
16737 (2 stages). The following instructions are additionally enabled: @code{mpy},
16738 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16739
16740 @item 4
16741 @itemx wlh3
16742 Two 16x16 multipliers, blocking,
16743 sequential. The following instructions are additionally enabled: @code{mpy},
16744 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16745
16746 @item 5
16747 @itemx wlh4
16748 One 16x16 multiplier, blocking,
16749 sequential. The following instructions are additionally enabled: @code{mpy},
16750 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16751
16752 @item 6
16753 @itemx wlh5
16754 One 32x4 multiplier, blocking,
16755 sequential. The following instructions are additionally enabled: @code{mpy},
16756 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16757
16758 @item 7
16759 @itemx plus_dmpy
16760 ARC HS SIMD support.
16761
16762 @item 8
16763 @itemx plus_macd
16764 ARC HS SIMD support.
16765
16766 @item 9
16767 @itemx plus_qmacw
16768 ARC HS SIMD support.
16769
16770 @end table
16771
16772 This option is only available for ARCv2 cores@.
16773
16774 @item -mfpu=@var{fpu}
16775 @opindex mfpu
16776 Enables support for specific floating-point hardware extensions for ARCv2
16777 cores. Supported values for @var{fpu} are:
16778
16779 @table @samp
16780
16781 @item fpus
16782 Enables support for single-precision floating-point hardware
16783 extensions@.
16784
16785 @item fpud
16786 Enables support for double-precision floating-point hardware
16787 extensions. The single-precision floating-point extension is also
16788 enabled. Not available for ARC EM@.
16789
16790 @item fpuda
16791 Enables support for double-precision floating-point hardware
16792 extensions using double-precision assist instructions. The single-precision
16793 floating-point extension is also enabled. This option is
16794 only available for ARC EM@.
16795
16796 @item fpuda_div
16797 Enables support for double-precision floating-point hardware
16798 extensions using double-precision assist instructions.
16799 The single-precision floating-point, square-root, and divide
16800 extensions are also enabled. This option is
16801 only available for ARC EM@.
16802
16803 @item fpuda_fma
16804 Enables support for double-precision floating-point hardware
16805 extensions using double-precision assist instructions.
16806 The single-precision floating-point and fused multiply and add
16807 hardware extensions are also enabled. This option is
16808 only available for ARC EM@.
16809
16810 @item fpuda_all
16811 Enables support for double-precision floating-point hardware
16812 extensions using double-precision assist instructions.
16813 All single-precision floating-point hardware extensions are also
16814 enabled. This option is only available for ARC EM@.
16815
16816 @item fpus_div
16817 Enables support for single-precision floating-point, square-root and divide
16818 hardware extensions@.
16819
16820 @item fpud_div
16821 Enables support for double-precision floating-point, square-root and divide
16822 hardware extensions. This option
16823 includes option @samp{fpus_div}. Not available for ARC EM@.
16824
16825 @item fpus_fma
16826 Enables support for single-precision floating-point and
16827 fused multiply and add hardware extensions@.
16828
16829 @item fpud_fma
16830 Enables support for double-precision floating-point and
16831 fused multiply and add hardware extensions. This option
16832 includes option @samp{fpus_fma}. Not available for ARC EM@.
16833
16834 @item fpus_all
16835 Enables support for all single-precision floating-point hardware
16836 extensions@.
16837
16838 @item fpud_all
16839 Enables support for all single- and double-precision floating-point
16840 hardware extensions. Not available for ARC EM@.
16841
16842 @end table
16843
16844 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16845 @opindex mirq-ctrl-saved
16846 Specifies general-purposes registers that the processor automatically
16847 saves/restores on interrupt entry and exit. @var{register-range} is
16848 specified as two registers separated by a dash. The register range
16849 always starts with @code{r0}, the upper limit is @code{fp} register.
16850 @var{blink} and @var{lp_count} are optional. This option is only
16851 valid for ARC EM and ARC HS cores.
16852
16853 @item -mrgf-banked-regs=@var{number}
16854 @opindex mrgf-banked-regs
16855 Specifies the number of registers replicated in second register bank
16856 on entry to fast interrupt. Fast interrupts are interrupts with the
16857 highest priority level P0. These interrupts save only PC and STATUS32
16858 registers to avoid memory transactions during interrupt entry and exit
16859 sequences. Use this option when you are using fast interrupts in an
16860 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16861
16862 @item -mlpc-width=@var{width}
16863 @opindex mlpc-width
16864 Specify the width of the @code{lp_count} register. Valid values for
16865 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16866 fixed to 32 bits. If the width is less than 32, the compiler does not
16867 attempt to transform loops in your program to use the zero-delay loop
16868 mechanism unless it is known that the @code{lp_count} register can
16869 hold the required loop-counter value. Depending on the width
16870 specified, the compiler and run-time library might continue to use the
16871 loop mechanism for various needs. This option defines macro
16872 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16873
16874 @item -mrf16
16875 @opindex mrf16
16876 This option instructs the compiler to generate code for a 16-entry
16877 register file. This option defines the @code{__ARC_RF16__}
16878 preprocessor macro.
16879
16880 @item -mbranch-index
16881 @opindex mbranch-index
16882 Enable use of @code{bi} or @code{bih} instructions to implement jump
16883 tables.
16884
16885 @end table
16886
16887 The following options are passed through to the assembler, and also
16888 define preprocessor macro symbols.
16889
16890 @c Flags used by the assembler, but for which we define preprocessor
16891 @c macro symbols as well.
16892 @table @gcctabopt
16893 @item -mdsp-packa
16894 @opindex mdsp-packa
16895 Passed down to the assembler to enable the DSP Pack A extensions.
16896 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16897 deprecated.
16898
16899 @item -mdvbf
16900 @opindex mdvbf
16901 Passed down to the assembler to enable the dual Viterbi butterfly
16902 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16903 option is deprecated.
16904
16905 @c ARC700 4.10 extension instruction
16906 @item -mlock
16907 @opindex mlock
16908 Passed down to the assembler to enable the locked load/store
16909 conditional extension. Also sets the preprocessor symbol
16910 @code{__Xlock}.
16911
16912 @item -mmac-d16
16913 @opindex mmac-d16
16914 Passed down to the assembler. Also sets the preprocessor symbol
16915 @code{__Xxmac_d16}. This option is deprecated.
16916
16917 @item -mmac-24
16918 @opindex mmac-24
16919 Passed down to the assembler. Also sets the preprocessor symbol
16920 @code{__Xxmac_24}. This option is deprecated.
16921
16922 @c ARC700 4.10 extension instruction
16923 @item -mrtsc
16924 @opindex mrtsc
16925 Passed down to the assembler to enable the 64-bit time-stamp counter
16926 extension instruction. Also sets the preprocessor symbol
16927 @code{__Xrtsc}. This option is deprecated.
16928
16929 @c ARC700 4.10 extension instruction
16930 @item -mswape
16931 @opindex mswape
16932 Passed down to the assembler to enable the swap byte ordering
16933 extension instruction. Also sets the preprocessor symbol
16934 @code{__Xswape}.
16935
16936 @item -mtelephony
16937 @opindex mtelephony
16938 Passed down to the assembler to enable dual- and single-operand
16939 instructions for telephony. Also sets the preprocessor symbol
16940 @code{__Xtelephony}. This option is deprecated.
16941
16942 @item -mxy
16943 @opindex mxy
16944 Passed down to the assembler to enable the XY memory extension. Also
16945 sets the preprocessor symbol @code{__Xxy}.
16946
16947 @end table
16948
16949 The following options control how the assembly code is annotated:
16950
16951 @c Assembly annotation options
16952 @table @gcctabopt
16953 @item -misize
16954 @opindex misize
16955 Annotate assembler instructions with estimated addresses.
16956
16957 @item -mannotate-align
16958 @opindex mannotate-align
16959 Explain what alignment considerations lead to the decision to make an
16960 instruction short or long.
16961
16962 @end table
16963
16964 The following options are passed through to the linker:
16965
16966 @c options passed through to the linker
16967 @table @gcctabopt
16968 @item -marclinux
16969 @opindex marclinux
16970 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16971 This option is enabled by default in tool chains built for
16972 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16973 when profiling is not requested.
16974
16975 @item -marclinux_prof
16976 @opindex marclinux_prof
16977 Passed through to the linker, to specify use of the
16978 @code{arclinux_prof} emulation. This option is enabled by default in
16979 tool chains built for @w{@code{arc-linux-uclibc}} and
16980 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16981
16982 @end table
16983
16984 The following options control the semantics of generated code:
16985
16986 @c semantically relevant code generation options
16987 @table @gcctabopt
16988 @item -mlong-calls
16989 @opindex mlong-calls
16990 Generate calls as register indirect calls, thus providing access
16991 to the full 32-bit address range.
16992
16993 @item -mmedium-calls
16994 @opindex mmedium-calls
16995 Don't use less than 25-bit addressing range for calls, which is the
16996 offset available for an unconditional branch-and-link
16997 instruction. Conditional execution of function calls is suppressed, to
16998 allow use of the 25-bit range, rather than the 21-bit range with
16999 conditional branch-and-link. This is the default for tool chains built
17000 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
17001
17002 @item -G @var{num}
17003 @opindex G
17004 Put definitions of externally-visible data in a small data section if
17005 that data is no bigger than @var{num} bytes. The default value of
17006 @var{num} is 4 for any ARC configuration, or 8 when we have double
17007 load/store operations.
17008
17009 @item -mno-sdata
17010 @opindex mno-sdata
17011 @opindex msdata
17012 Do not generate sdata references. This is the default for tool chains
17013 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
17014 targets.
17015
17016 @item -mvolatile-cache
17017 @opindex mvolatile-cache
17018 Use ordinarily cached memory accesses for volatile references. This is the
17019 default.
17020
17021 @item -mno-volatile-cache
17022 @opindex mno-volatile-cache
17023 @opindex mvolatile-cache
17024 Enable cache bypass for volatile references.
17025
17026 @end table
17027
17028 The following options fine tune code generation:
17029 @c code generation tuning options
17030 @table @gcctabopt
17031 @item -malign-call
17032 @opindex malign-call
17033 Do alignment optimizations for call instructions.
17034
17035 @item -mauto-modify-reg
17036 @opindex mauto-modify-reg
17037 Enable the use of pre/post modify with register displacement.
17038
17039 @item -mbbit-peephole
17040 @opindex mbbit-peephole
17041 Enable bbit peephole2.
17042
17043 @item -mno-brcc
17044 @opindex mno-brcc
17045 This option disables a target-specific pass in @file{arc_reorg} to
17046 generate compare-and-branch (@code{br@var{cc}}) instructions.
17047 It has no effect on
17048 generation of these instructions driven by the combiner pass.
17049
17050 @item -mcase-vector-pcrel
17051 @opindex mcase-vector-pcrel
17052 Use PC-relative switch case tables to enable case table shortening.
17053 This is the default for @option{-Os}.
17054
17055 @item -mcompact-casesi
17056 @opindex mcompact-casesi
17057 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
17058 and only available for ARCv1 cores. This option is deprecated.
17059
17060 @item -mno-cond-exec
17061 @opindex mno-cond-exec
17062 Disable the ARCompact-specific pass to generate conditional
17063 execution instructions.
17064
17065 Due to delay slot scheduling and interactions between operand numbers,
17066 literal sizes, instruction lengths, and the support for conditional execution,
17067 the target-independent pass to generate conditional execution is often lacking,
17068 so the ARC port has kept a special pass around that tries to find more
17069 conditional execution generation opportunities after register allocation,
17070 branch shortening, and delay slot scheduling have been done. This pass
17071 generally, but not always, improves performance and code size, at the cost of
17072 extra compilation time, which is why there is an option to switch it off.
17073 If you have a problem with call instructions exceeding their allowable
17074 offset range because they are conditionalized, you should consider using
17075 @option{-mmedium-calls} instead.
17076
17077 @item -mearly-cbranchsi
17078 @opindex mearly-cbranchsi
17079 Enable pre-reload use of the @code{cbranchsi} pattern.
17080
17081 @item -mexpand-adddi
17082 @opindex mexpand-adddi
17083 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17084 @code{add.f}, @code{adc} etc. This option is deprecated.
17085
17086 @item -mindexed-loads
17087 @opindex mindexed-loads
17088 Enable the use of indexed loads. This can be problematic because some
17089 optimizers then assume that indexed stores exist, which is not
17090 the case.
17091
17092 @item -mlra
17093 @opindex mlra
17094 Enable Local Register Allocation. This is still experimental for ARC,
17095 so by default the compiler uses standard reload
17096 (i.e.@: @option{-mno-lra}).
17097
17098 @item -mlra-priority-none
17099 @opindex mlra-priority-none
17100 Don't indicate any priority for target registers.
17101
17102 @item -mlra-priority-compact
17103 @opindex mlra-priority-compact
17104 Indicate target register priority for r0..r3 / r12..r15.
17105
17106 @item -mlra-priority-noncompact
17107 @opindex mlra-priority-noncompact
17108 Reduce target register priority for r0..r3 / r12..r15.
17109
17110 @item -mmillicode
17111 @opindex mmillicode
17112 When optimizing for size (using @option{-Os}), prologues and epilogues
17113 that have to save or restore a large number of registers are often
17114 shortened by using call to a special function in libgcc; this is
17115 referred to as a @emph{millicode} call. As these calls can pose
17116 performance issues, and/or cause linking issues when linking in a
17117 nonstandard way, this option is provided to turn on or off millicode
17118 call generation.
17119
17120 @item -mcode-density-frame
17121 @opindex mcode-density-frame
17122 This option enable the compiler to emit @code{enter} and @code{leave}
17123 instructions. These instructions are only valid for CPUs with
17124 code-density feature.
17125
17126 @item -mmixed-code
17127 @opindex mmixed-code
17128 Tweak register allocation to help 16-bit instruction generation.
17129 This generally has the effect of decreasing the average instruction size
17130 while increasing the instruction count.
17131
17132 @item -mq-class
17133 @opindex mq-class
17134 Enable @samp{q} instruction alternatives.
17135 This is the default for @option{-Os}.
17136
17137 @item -mRcq
17138 @opindex mRcq
17139 Enable @samp{Rcq} constraint handling.
17140 Most short code generation depends on this.
17141 This is the default.
17142
17143 @item -mRcw
17144 @opindex mRcw
17145 Enable @samp{Rcw} constraint handling.
17146 Most ccfsm condexec mostly depends on this.
17147 This is the default.
17148
17149 @item -msize-level=@var{level}
17150 @opindex msize-level
17151 Fine-tune size optimization with regards to instruction lengths and alignment.
17152 The recognized values for @var{level} are:
17153 @table @samp
17154 @item 0
17155 No size optimization. This level is deprecated and treated like @samp{1}.
17156
17157 @item 1
17158 Short instructions are used opportunistically.
17159
17160 @item 2
17161 In addition, alignment of loops and of code after barriers are dropped.
17162
17163 @item 3
17164 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17165
17166 @end table
17167
17168 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17169 the behavior when this is not set is equivalent to level @samp{1}.
17170
17171 @item -mtune=@var{cpu}
17172 @opindex mtune
17173 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17174 by @option{-mcpu=}.
17175
17176 Supported values for @var{cpu} are
17177
17178 @table @samp
17179 @item ARC600
17180 Tune for ARC600 CPU.
17181
17182 @item ARC601
17183 Tune for ARC601 CPU.
17184
17185 @item ARC700
17186 Tune for ARC700 CPU with standard multiplier block.
17187
17188 @item ARC700-xmac
17189 Tune for ARC700 CPU with XMAC block.
17190
17191 @item ARC725D
17192 Tune for ARC725D CPU.
17193
17194 @item ARC750D
17195 Tune for ARC750D CPU.
17196
17197 @end table
17198
17199 @item -mmultcost=@var{num}
17200 @opindex mmultcost
17201 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17202 normal instruction.
17203
17204 @item -munalign-prob-threshold=@var{probability}
17205 @opindex munalign-prob-threshold
17206 Set probability threshold for unaligning branches.
17207 When tuning for @samp{ARC700} and optimizing for speed, branches without
17208 filled delay slot are preferably emitted unaligned and long, unless
17209 profiling indicates that the probability for the branch to be taken
17210 is below @var{probability}. @xref{Cross-profiling}.
17211 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17212
17213 @end table
17214
17215 The following options are maintained for backward compatibility, but
17216 are now deprecated and will be removed in a future release:
17217
17218 @c Deprecated options
17219 @table @gcctabopt
17220
17221 @item -margonaut
17222 @opindex margonaut
17223 Obsolete FPX.
17224
17225 @item -mbig-endian
17226 @opindex mbig-endian
17227 @itemx -EB
17228 @opindex EB
17229 Compile code for big-endian targets. Use of these options is now
17230 deprecated. Big-endian code is supported by configuring GCC to build
17231 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17232 for which big endian is the default.
17233
17234 @item -mlittle-endian
17235 @opindex mlittle-endian
17236 @itemx -EL
17237 @opindex EL
17238 Compile code for little-endian targets. Use of these options is now
17239 deprecated. Little-endian code is supported by configuring GCC to build
17240 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17241 for which little endian is the default.
17242
17243 @item -mbarrel_shifter
17244 @opindex mbarrel_shifter
17245 Replaced by @option{-mbarrel-shifter}.
17246
17247 @item -mdpfp_compact
17248 @opindex mdpfp_compact
17249 Replaced by @option{-mdpfp-compact}.
17250
17251 @item -mdpfp_fast
17252 @opindex mdpfp_fast
17253 Replaced by @option{-mdpfp-fast}.
17254
17255 @item -mdsp_packa
17256 @opindex mdsp_packa
17257 Replaced by @option{-mdsp-packa}.
17258
17259 @item -mEA
17260 @opindex mEA
17261 Replaced by @option{-mea}.
17262
17263 @item -mmac_24
17264 @opindex mmac_24
17265 Replaced by @option{-mmac-24}.
17266
17267 @item -mmac_d16
17268 @opindex mmac_d16
17269 Replaced by @option{-mmac-d16}.
17270
17271 @item -mspfp_compact
17272 @opindex mspfp_compact
17273 Replaced by @option{-mspfp-compact}.
17274
17275 @item -mspfp_fast
17276 @opindex mspfp_fast
17277 Replaced by @option{-mspfp-fast}.
17278
17279 @item -mtune=@var{cpu}
17280 @opindex mtune
17281 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17282 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17283 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17284
17285 @item -multcost=@var{num}
17286 @opindex multcost
17287 Replaced by @option{-mmultcost}.
17288
17289 @end table
17290
17291 @node ARM Options
17292 @subsection ARM Options
17293 @cindex ARM options
17294
17295 These @samp{-m} options are defined for the ARM port:
17296
17297 @table @gcctabopt
17298 @item -mabi=@var{name}
17299 @opindex mabi
17300 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17301 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17302
17303 @item -mapcs-frame
17304 @opindex mapcs-frame
17305 Generate a stack frame that is compliant with the ARM Procedure Call
17306 Standard for all functions, even if this is not strictly necessary for
17307 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17308 with this option causes the stack frames not to be generated for
17309 leaf functions. The default is @option{-mno-apcs-frame}.
17310 This option is deprecated.
17311
17312 @item -mapcs
17313 @opindex mapcs
17314 This is a synonym for @option{-mapcs-frame} and is deprecated.
17315
17316 @ignore
17317 @c not currently implemented
17318 @item -mapcs-stack-check
17319 @opindex mapcs-stack-check
17320 Generate code to check the amount of stack space available upon entry to
17321 every function (that actually uses some stack space). If there is
17322 insufficient space available then either the function
17323 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17324 called, depending upon the amount of stack space required. The runtime
17325 system is required to provide these functions. The default is
17326 @option{-mno-apcs-stack-check}, since this produces smaller code.
17327
17328 @c not currently implemented
17329 @item -mapcs-reentrant
17330 @opindex mapcs-reentrant
17331 Generate reentrant, position-independent code. The default is
17332 @option{-mno-apcs-reentrant}.
17333 @end ignore
17334
17335 @item -mthumb-interwork
17336 @opindex mthumb-interwork
17337 Generate code that supports calling between the ARM and Thumb
17338 instruction sets. Without this option, on pre-v5 architectures, the
17339 two instruction sets cannot be reliably used inside one program. The
17340 default is @option{-mno-thumb-interwork}, since slightly larger code
17341 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17342 configurations this option is meaningless.
17343
17344 @item -mno-sched-prolog
17345 @opindex mno-sched-prolog
17346 @opindex msched-prolog
17347 Prevent the reordering of instructions in the function prologue, or the
17348 merging of those instruction with the instructions in the function's
17349 body. This means that all functions start with a recognizable set
17350 of instructions (or in fact one of a choice from a small set of
17351 different function prologues), and this information can be used to
17352 locate the start of functions inside an executable piece of code. The
17353 default is @option{-msched-prolog}.
17354
17355 @item -mfloat-abi=@var{name}
17356 @opindex mfloat-abi
17357 Specifies which floating-point ABI to use. Permissible values
17358 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17359
17360 Specifying @samp{soft} causes GCC to generate output containing
17361 library calls for floating-point operations.
17362 @samp{softfp} allows the generation of code using hardware floating-point
17363 instructions, but still uses the soft-float calling conventions.
17364 @samp{hard} allows generation of floating-point instructions
17365 and uses FPU-specific calling conventions.
17366
17367 The default depends on the specific target configuration. Note that
17368 the hard-float and soft-float ABIs are not link-compatible; you must
17369 compile your entire program with the same ABI, and link with a
17370 compatible set of libraries.
17371
17372 @item -mgeneral-regs-only
17373 @opindex mgeneral-regs-only
17374 Generate code which uses only the general-purpose registers. This will prevent
17375 the compiler from using floating-point and Advanced SIMD registers but will not
17376 impose any restrictions on the assembler.
17377
17378 @item -mlittle-endian
17379 @opindex mlittle-endian
17380 Generate code for a processor running in little-endian mode. This is
17381 the default for all standard configurations.
17382
17383 @item -mbig-endian
17384 @opindex mbig-endian
17385 Generate code for a processor running in big-endian mode; the default is
17386 to compile code for a little-endian processor.
17387
17388 @item -mbe8
17389 @itemx -mbe32
17390 @opindex mbe8
17391 When linking a big-endian image select between BE8 and BE32 formats.
17392 The option has no effect for little-endian images and is ignored. The
17393 default is dependent on the selected target architecture. For ARMv6
17394 and later architectures the default is BE8, for older architectures
17395 the default is BE32. BE32 format has been deprecated by ARM.
17396
17397 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17398 @opindex march
17399 This specifies the name of the target ARM architecture. GCC uses this
17400 name to determine what kind of instructions it can emit when generating
17401 assembly code. This option can be used in conjunction with or instead
17402 of the @option{-mcpu=} option.
17403
17404 Permissible names are:
17405 @samp{armv4t},
17406 @samp{armv5t}, @samp{armv5te},
17407 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17408 @samp{armv6z}, @samp{armv6zk},
17409 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17410 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17411 @samp{armv8.4-a},
17412 @samp{armv8.5-a},
17413 @samp{armv7-r},
17414 @samp{armv8-r},
17415 @samp{armv6-m}, @samp{armv6s-m},
17416 @samp{armv7-m}, @samp{armv7e-m},
17417 @samp{armv8-m.base}, @samp{armv8-m.main},
17418 @samp{iwmmxt} and @samp{iwmmxt2}.
17419
17420 Additionally, the following architectures, which lack support for the
17421 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17422
17423 Many of the architectures support extensions. These can be added by
17424 appending @samp{+@var{extension}} to the architecture name. Extension
17425 options are processed in order and capabilities accumulate. An extension
17426 will also enable any necessary base extensions
17427 upon which it depends. For example, the @samp{+crypto} extension
17428 will always enable the @samp{+simd} extension. The exception to the
17429 additive construction is for extensions that are prefixed with
17430 @samp{+no@dots{}}: these extensions disable the specified option and
17431 any other extensions that may depend on the presence of that
17432 extension.
17433
17434 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17435 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17436 entirely disabled by the @samp{+nofp} option that follows it.
17437
17438 Most extension names are generically named, but have an effect that is
17439 dependent upon the architecture to which it is applied. For example,
17440 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17441 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17442 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17443 variant for @samp{armv8-a}.
17444
17445 The table below lists the supported extensions for each architecture.
17446 Architectures not mentioned do not support any extensions.
17447
17448 @table @samp
17449 @item armv5te
17450 @itemx armv6
17451 @itemx armv6j
17452 @itemx armv6k
17453 @itemx armv6kz
17454 @itemx armv6t2
17455 @itemx armv6z
17456 @itemx armv6zk
17457 @table @samp
17458 @item +fp
17459 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17460 used as an alias for this extension.
17461
17462 @item +nofp
17463 Disable the floating-point instructions.
17464 @end table
17465
17466 @item armv7
17467 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17468 @table @samp
17469 @item +fp
17470 The VFPv3 floating-point instructions, with 16 double-precision
17471 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17472 for this extension. Note that floating-point is not supported by the
17473 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17474 ARMv7-R architectures.
17475
17476 @item +nofp
17477 Disable the floating-point instructions.
17478 @end table
17479
17480 @item armv7-a
17481 @table @samp
17482 @item +mp
17483 The multiprocessing extension.
17484
17485 @item +sec
17486 The security extension.
17487
17488 @item +fp
17489 The VFPv3 floating-point instructions, with 16 double-precision
17490 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17491 for this extension.
17492
17493 @item +simd
17494 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17495 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17496 for this extension.
17497
17498 @item +vfpv3
17499 The VFPv3 floating-point instructions, with 32 double-precision
17500 registers.
17501
17502 @item +vfpv3-d16-fp16
17503 The VFPv3 floating-point instructions, with 16 double-precision
17504 registers and the half-precision floating-point conversion operations.
17505
17506 @item +vfpv3-fp16
17507 The VFPv3 floating-point instructions, with 32 double-precision
17508 registers and the half-precision floating-point conversion operations.
17509
17510 @item +vfpv4-d16
17511 The VFPv4 floating-point instructions, with 16 double-precision
17512 registers.
17513
17514 @item +vfpv4
17515 The VFPv4 floating-point instructions, with 32 double-precision
17516 registers.
17517
17518 @item +neon-fp16
17519 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17520 the half-precision floating-point conversion operations.
17521
17522 @item +neon-vfpv4
17523 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17524
17525 @item +nosimd
17526 Disable the Advanced SIMD instructions (does not disable floating point).
17527
17528 @item +nofp
17529 Disable the floating-point and Advanced SIMD instructions.
17530 @end table
17531
17532 @item armv7ve
17533 The extended version of the ARMv7-A architecture with support for
17534 virtualization.
17535 @table @samp
17536 @item +fp
17537 The VFPv4 floating-point instructions, with 16 double-precision registers.
17538 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17539
17540 @item +simd
17541 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17542 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17543
17544 @item +vfpv3-d16
17545 The VFPv3 floating-point instructions, with 16 double-precision
17546 registers.
17547
17548 @item +vfpv3
17549 The VFPv3 floating-point instructions, with 32 double-precision
17550 registers.
17551
17552 @item +vfpv3-d16-fp16
17553 The VFPv3 floating-point instructions, with 16 double-precision
17554 registers and the half-precision floating-point conversion operations.
17555
17556 @item +vfpv3-fp16
17557 The VFPv3 floating-point instructions, with 32 double-precision
17558 registers and the half-precision floating-point conversion operations.
17559
17560 @item +vfpv4-d16
17561 The VFPv4 floating-point instructions, with 16 double-precision
17562 registers.
17563
17564 @item +vfpv4
17565 The VFPv4 floating-point instructions, with 32 double-precision
17566 registers.
17567
17568 @item +neon
17569 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17570 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17571
17572 @item +neon-fp16
17573 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17574 the half-precision floating-point conversion operations.
17575
17576 @item +nosimd
17577 Disable the Advanced SIMD instructions (does not disable floating point).
17578
17579 @item +nofp
17580 Disable the floating-point and Advanced SIMD instructions.
17581 @end table
17582
17583 @item armv8-a
17584 @table @samp
17585 @item +crc
17586 The Cyclic Redundancy Check (CRC) instructions.
17587 @item +simd
17588 The ARMv8-A Advanced SIMD and floating-point instructions.
17589 @item +crypto
17590 The cryptographic instructions.
17591 @item +nocrypto
17592 Disable the cryptographic instructions.
17593 @item +nofp
17594 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17595 @item +sb
17596 Speculation Barrier Instruction.
17597 @item +predres
17598 Execution and Data Prediction Restriction Instructions.
17599 @end table
17600
17601 @item armv8.1-a
17602 @table @samp
17603 @item +simd
17604 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17605
17606 @item +crypto
17607 The cryptographic instructions. This also enables the Advanced SIMD and
17608 floating-point instructions.
17609
17610 @item +nocrypto
17611 Disable the cryptographic instructions.
17612
17613 @item +nofp
17614 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17615
17616 @item +sb
17617 Speculation Barrier Instruction.
17618
17619 @item +predres
17620 Execution and Data Prediction Restriction Instructions.
17621 @end table
17622
17623 @item armv8.2-a
17624 @itemx armv8.3-a
17625 @table @samp
17626 @item +fp16
17627 The half-precision floating-point data processing instructions.
17628 This also enables the Advanced SIMD and floating-point instructions.
17629
17630 @item +fp16fml
17631 The half-precision floating-point fmla extension. This also enables
17632 the half-precision floating-point extension and Advanced SIMD and
17633 floating-point instructions.
17634
17635 @item +simd
17636 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17637
17638 @item +crypto
17639 The cryptographic instructions. This also enables the Advanced SIMD and
17640 floating-point instructions.
17641
17642 @item +dotprod
17643 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17644
17645 @item +nocrypto
17646 Disable the cryptographic extension.
17647
17648 @item +nofp
17649 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17650
17651 @item +sb
17652 Speculation Barrier Instruction.
17653
17654 @item +predres
17655 Execution and Data Prediction Restriction Instructions.
17656 @end table
17657
17658 @item armv8.4-a
17659 @table @samp
17660 @item +fp16
17661 The half-precision floating-point data processing instructions.
17662 This also enables the Advanced SIMD and floating-point instructions as well
17663 as the Dot Product extension and the half-precision floating-point fmla
17664 extension.
17665
17666 @item +simd
17667 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17668 Dot Product extension.
17669
17670 @item +crypto
17671 The cryptographic instructions. This also enables the Advanced SIMD and
17672 floating-point instructions as well as the Dot Product extension.
17673
17674 @item +nocrypto
17675 Disable the cryptographic extension.
17676
17677 @item +nofp
17678 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17679
17680 @item +sb
17681 Speculation Barrier Instruction.
17682
17683 @item +predres
17684 Execution and Data Prediction Restriction Instructions.
17685 @end table
17686
17687 @item armv8.5-a
17688 @table @samp
17689 @item +fp16
17690 The half-precision floating-point data processing instructions.
17691 This also enables the Advanced SIMD and floating-point instructions as well
17692 as the Dot Product extension and the half-precision floating-point fmla
17693 extension.
17694
17695 @item +simd
17696 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17697 Dot Product extension.
17698
17699 @item +crypto
17700 The cryptographic instructions. This also enables the Advanced SIMD and
17701 floating-point instructions as well as the Dot Product extension.
17702
17703 @item +nocrypto
17704 Disable the cryptographic extension.
17705
17706 @item +nofp
17707 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17708 @end table
17709
17710 @item armv7-r
17711 @table @samp
17712 @item +fp.sp
17713 The single-precision VFPv3 floating-point instructions. The extension
17714 @samp{+vfpv3xd} can be used as an alias for this extension.
17715
17716 @item +fp
17717 The VFPv3 floating-point instructions with 16 double-precision registers.
17718 The extension +vfpv3-d16 can be used as an alias for this extension.
17719
17720 @item +vfpv3xd-d16-fp16
17721 The single-precision VFPv3 floating-point instructions with 16 double-precision
17722 registers and the half-precision floating-point conversion operations.
17723
17724 @item +vfpv3-d16-fp16
17725 The VFPv3 floating-point instructions with 16 double-precision
17726 registers and the half-precision floating-point conversion operations.
17727
17728 @item +nofp
17729 Disable the floating-point extension.
17730
17731 @item +idiv
17732 The ARM-state integer division instructions.
17733
17734 @item +noidiv
17735 Disable the ARM-state integer division extension.
17736 @end table
17737
17738 @item armv7e-m
17739 @table @samp
17740 @item +fp
17741 The single-precision VFPv4 floating-point instructions.
17742
17743 @item +fpv5
17744 The single-precision FPv5 floating-point instructions.
17745
17746 @item +fp.dp
17747 The single- and double-precision FPv5 floating-point instructions.
17748
17749 @item +nofp
17750 Disable the floating-point extensions.
17751 @end table
17752
17753 @item armv8-m.main
17754 @table @samp
17755 @item +dsp
17756 The DSP instructions.
17757
17758 @item +nodsp
17759 Disable the DSP extension.
17760
17761 @item +fp
17762 The single-precision floating-point instructions.
17763
17764 @item +fp.dp
17765 The single- and double-precision floating-point instructions.
17766
17767 @item +nofp
17768 Disable the floating-point extension.
17769 @end table
17770
17771 @item armv8-r
17772 @table @samp
17773 @item +crc
17774 The Cyclic Redundancy Check (CRC) instructions.
17775 @item +fp.sp
17776 The single-precision FPv5 floating-point instructions.
17777 @item +simd
17778 The ARMv8-A Advanced SIMD and floating-point instructions.
17779 @item +crypto
17780 The cryptographic instructions.
17781 @item +nocrypto
17782 Disable the cryptographic instructions.
17783 @item +nofp
17784 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17785 @end table
17786
17787 @end table
17788
17789 @option{-march=native} causes the compiler to auto-detect the architecture
17790 of the build computer. At present, this feature is only supported on
17791 GNU/Linux, and not all architectures are recognized. If the auto-detect
17792 is unsuccessful the option has no effect.
17793
17794 @item -mtune=@var{name}
17795 @opindex mtune
17796 This option specifies the name of the target ARM processor for
17797 which GCC should tune the performance of the code.
17798 For some ARM implementations better performance can be obtained by using
17799 this option.
17800 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17801 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17802 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17803 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17804 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17805 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17806 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17807 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17808 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17809 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17810 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17811 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17812 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17813 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17814 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17815 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17816 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17817 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17818 @samp{cortex-m35p},
17819 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17820 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17821 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17822 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17823 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17824
17825 Additionally, this option can specify that GCC should tune the performance
17826 of the code for a big.LITTLE system. Permissible names are:
17827 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17828 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17829 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17830 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17831
17832 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17833 performance for a blend of processors within architecture @var{arch}.
17834 The aim is to generate code that run well on the current most popular
17835 processors, balancing between optimizations that benefit some CPUs in the
17836 range, and avoiding performance pitfalls of other CPUs. The effects of
17837 this option may change in future GCC versions as CPU models come and go.
17838
17839 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17840 the extension options do not affect the tuning of the generated code.
17841
17842 @option{-mtune=native} causes the compiler to auto-detect the CPU
17843 of the build computer. At present, this feature is only supported on
17844 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17845 unsuccessful the option has no effect.
17846
17847 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17848 @opindex mcpu
17849 This specifies the name of the target ARM processor. GCC uses this name
17850 to derive the name of the target ARM architecture (as if specified
17851 by @option{-march}) and the ARM processor type for which to tune for
17852 performance (as if specified by @option{-mtune}). Where this option
17853 is used in conjunction with @option{-march} or @option{-mtune},
17854 those options take precedence over the appropriate part of this option.
17855
17856 Many of the supported CPUs implement optional architectural
17857 extensions. Where this is so the architectural extensions are
17858 normally enabled by default. If implementations that lack the
17859 extension exist, then the extension syntax can be used to disable
17860 those extensions that have been omitted. For floating-point and
17861 Advanced SIMD (Neon) instructions, the settings of the options
17862 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17863 floating-point and Advanced SIMD instructions will only be used if
17864 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17865 @option{-mfpu} other than @samp{auto} will override the available
17866 floating-point and SIMD extension instructions.
17867
17868 For example, @samp{cortex-a9} can be found in three major
17869 configurations: integer only, with just a floating-point unit or with
17870 floating-point and Advanced SIMD. The default is to enable all the
17871 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17872 be used to disable just the SIMD or both the SIMD and floating-point
17873 instructions respectively.
17874
17875 Permissible names for this option are the same as those for
17876 @option{-mtune}.
17877
17878 The following extension options are common to the listed CPUs:
17879
17880 @table @samp
17881 @item +nodsp
17882 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17883
17884 @item +nofp
17885 Disables the floating-point instructions on @samp{arm9e},
17886 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17887 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17888 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17889 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17890 Disables the floating-point and SIMD instructions on
17891 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17892 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17893 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17894 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17895 @samp{cortex-a53} and @samp{cortex-a55}.
17896
17897 @item +nofp.dp
17898 Disables the double-precision component of the floating-point instructions
17899 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17900 @samp{cortex-m7}.
17901
17902 @item +nosimd
17903 Disables the SIMD (but not floating-point) instructions on
17904 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17905 and @samp{cortex-a9}.
17906
17907 @item +crypto
17908 Enables the cryptographic instructions on @samp{cortex-a32},
17909 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17910 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17911 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17912 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17913 @samp{cortex-a75.cortex-a55}.
17914 @end table
17915
17916 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17917 VFPv3 with 16 double-precision registers. It supports the following
17918 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17919 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17920 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17921 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17922 the extensions to @option{-march=armv7-a}.
17923
17924 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17925 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17926 See @option{-mtune} for more information.
17927
17928 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17929 of the build computer. At present, this feature is only supported on
17930 GNU/Linux, and not all architectures are recognized. If the auto-detect
17931 is unsuccessful the option has no effect.
17932
17933 @item -mfpu=@var{name}
17934 @opindex mfpu
17935 This specifies what floating-point hardware (or hardware emulation) is
17936 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17937 @samp{vfpv3},
17938 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17939 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17940 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17941 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17942 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17943 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17944 is an alias for @samp{vfpv2}.
17945
17946 The setting @samp{auto} is the default and is special. It causes the
17947 compiler to select the floating-point and Advanced SIMD instructions
17948 based on the settings of @option{-mcpu} and @option{-march}.
17949
17950 If the selected floating-point hardware includes the NEON extension
17951 (e.g.@: @option{-mfpu=neon}), note that floating-point
17952 operations are not generated by GCC's auto-vectorization pass unless
17953 @option{-funsafe-math-optimizations} is also specified. This is
17954 because NEON hardware does not fully implement the IEEE 754 standard for
17955 floating-point arithmetic (in particular denormal values are treated as
17956 zero), so the use of NEON instructions may lead to a loss of precision.
17957
17958 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}).
17959
17960 @item -mfp16-format=@var{name}
17961 @opindex mfp16-format
17962 Specify the format of the @code{__fp16} half-precision floating-point type.
17963 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17964 the default is @samp{none}, in which case the @code{__fp16} type is not
17965 defined. @xref{Half-Precision}, for more information.
17966
17967 @item -mstructure-size-boundary=@var{n}
17968 @opindex mstructure-size-boundary
17969 The sizes of all structures and unions are rounded up to a multiple
17970 of the number of bits set by this option. Permissible values are 8, 32
17971 and 64. The default value varies for different toolchains. For the COFF
17972 targeted toolchain the default value is 8. A value of 64 is only allowed
17973 if the underlying ABI supports it.
17974
17975 Specifying a larger number can produce faster, more efficient code, but
17976 can also increase the size of the program. Different values are potentially
17977 incompatible. Code compiled with one value cannot necessarily expect to
17978 work with code or libraries compiled with another value, if they exchange
17979 information using structures or unions.
17980
17981 This option is deprecated.
17982
17983 @item -mabort-on-noreturn
17984 @opindex mabort-on-noreturn
17985 Generate a call to the function @code{abort} at the end of a
17986 @code{noreturn} function. It is executed if the function tries to
17987 return.
17988
17989 @item -mlong-calls
17990 @itemx -mno-long-calls
17991 @opindex mlong-calls
17992 @opindex mno-long-calls
17993 Tells the compiler to perform function calls by first loading the
17994 address of the function into a register and then performing a subroutine
17995 call on this register. This switch is needed if the target function
17996 lies outside of the 64-megabyte addressing range of the offset-based
17997 version of subroutine call instruction.
17998
17999 Even if this switch is enabled, not all function calls are turned
18000 into long calls. The heuristic is that static functions, functions
18001 that have the @code{short_call} attribute, functions that are inside
18002 the scope of a @code{#pragma no_long_calls} directive, and functions whose
18003 definitions have already been compiled within the current compilation
18004 unit are not turned into long calls. The exceptions to this rule are
18005 that weak function definitions, functions with the @code{long_call}
18006 attribute or the @code{section} attribute, and functions that are within
18007 the scope of a @code{#pragma long_calls} directive are always
18008 turned into long calls.
18009
18010 This feature is not enabled by default. Specifying
18011 @option{-mno-long-calls} restores the default behavior, as does
18012 placing the function calls within the scope of a @code{#pragma
18013 long_calls_off} directive. Note these switches have no effect on how
18014 the compiler generates code to handle function calls via function
18015 pointers.
18016
18017 @item -msingle-pic-base
18018 @opindex msingle-pic-base
18019 Treat the register used for PIC addressing as read-only, rather than
18020 loading it in the prologue for each function. The runtime system is
18021 responsible for initializing this register with an appropriate value
18022 before execution begins.
18023
18024 @item -mpic-register=@var{reg}
18025 @opindex mpic-register
18026 Specify the register to be used for PIC addressing.
18027 For standard PIC base case, the default is any suitable register
18028 determined by compiler. For single PIC base case, the default is
18029 @samp{R9} if target is EABI based or stack-checking is enabled,
18030 otherwise the default is @samp{R10}.
18031
18032 @item -mpic-data-is-text-relative
18033 @opindex mpic-data-is-text-relative
18034 Assume that the displacement between the text and data segments is fixed
18035 at static link time. This permits using PC-relative addressing
18036 operations to access data known to be in the data segment. For
18037 non-VxWorks RTP targets, this option is enabled by default. When
18038 disabled on such targets, it will enable @option{-msingle-pic-base} by
18039 default.
18040
18041 @item -mpoke-function-name
18042 @opindex mpoke-function-name
18043 Write the name of each function into the text section, directly
18044 preceding the function prologue. The generated code is similar to this:
18045
18046 @smallexample
18047 t0
18048 .ascii "arm_poke_function_name", 0
18049 .align
18050 t1
18051 .word 0xff000000 + (t1 - t0)
18052 arm_poke_function_name
18053 mov ip, sp
18054 stmfd sp!, @{fp, ip, lr, pc@}
18055 sub fp, ip, #4
18056 @end smallexample
18057
18058 When performing a stack backtrace, code can inspect the value of
18059 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
18060 location @code{pc - 12} and the top 8 bits are set, then we know that
18061 there is a function name embedded immediately preceding this location
18062 and has length @code{((pc[-3]) & 0xff000000)}.
18063
18064 @item -mthumb
18065 @itemx -marm
18066 @opindex marm
18067 @opindex mthumb
18068
18069 Select between generating code that executes in ARM and Thumb
18070 states. The default for most configurations is to generate code
18071 that executes in ARM state, but the default can be changed by
18072 configuring GCC with the @option{--with-mode=}@var{state}
18073 configure option.
18074
18075 You can also override the ARM and Thumb mode for each function
18076 by using the @code{target("thumb")} and @code{target("arm")} function attributes
18077 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
18078
18079 @item -mflip-thumb
18080 @opindex mflip-thumb
18081 Switch ARM/Thumb modes on alternating functions.
18082 This option is provided for regression testing of mixed Thumb/ARM code
18083 generation, and is not intended for ordinary use in compiling code.
18084
18085 @item -mtpcs-frame
18086 @opindex mtpcs-frame
18087 Generate a stack frame that is compliant with the Thumb Procedure Call
18088 Standard for all non-leaf functions. (A leaf function is one that does
18089 not call any other functions.) The default is @option{-mno-tpcs-frame}.
18090
18091 @item -mtpcs-leaf-frame
18092 @opindex mtpcs-leaf-frame
18093 Generate a stack frame that is compliant with the Thumb Procedure Call
18094 Standard for all leaf functions. (A leaf function is one that does
18095 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
18096
18097 @item -mcallee-super-interworking
18098 @opindex mcallee-super-interworking
18099 Gives all externally visible functions in the file being compiled an ARM
18100 instruction set header which switches to Thumb mode before executing the
18101 rest of the function. This allows these functions to be called from
18102 non-interworking code. This option is not valid in AAPCS configurations
18103 because interworking is enabled by default.
18104
18105 @item -mcaller-super-interworking
18106 @opindex mcaller-super-interworking
18107 Allows calls via function pointers (including virtual functions) to
18108 execute correctly regardless of whether the target code has been
18109 compiled for interworking or not. There is a small overhead in the cost
18110 of executing a function pointer if this option is enabled. This option
18111 is not valid in AAPCS configurations because interworking is enabled
18112 by default.
18113
18114 @item -mtp=@var{name}
18115 @opindex mtp
18116 Specify the access model for the thread local storage pointer. The valid
18117 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
18118 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
18119 (supported in the arm6k architecture), and @samp{auto}, which uses the
18120 best available method for the selected processor. The default setting is
18121 @samp{auto}.
18122
18123 @item -mtls-dialect=@var{dialect}
18124 @opindex mtls-dialect
18125 Specify the dialect to use for accessing thread local storage. Two
18126 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
18127 @samp{gnu} dialect selects the original GNU scheme for supporting
18128 local and global dynamic TLS models. The @samp{gnu2} dialect
18129 selects the GNU descriptor scheme, which provides better performance
18130 for shared libraries. The GNU descriptor scheme is compatible with
18131 the original scheme, but does require new assembler, linker and
18132 library support. Initial and local exec TLS models are unaffected by
18133 this option and always use the original scheme.
18134
18135 @item -mword-relocations
18136 @opindex mword-relocations
18137 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18138 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18139 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18140 is specified. This option conflicts with @option{-mslow-flash-data}.
18141
18142 @item -mfix-cortex-m3-ldrd
18143 @opindex mfix-cortex-m3-ldrd
18144 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18145 with overlapping destination and base registers are used. This option avoids
18146 generating these instructions. This option is enabled by default when
18147 @option{-mcpu=cortex-m3} is specified.
18148
18149 @item -munaligned-access
18150 @itemx -mno-unaligned-access
18151 @opindex munaligned-access
18152 @opindex mno-unaligned-access
18153 Enables (or disables) reading and writing of 16- and 32- bit values
18154 from addresses that are not 16- or 32- bit aligned. By default
18155 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18156 ARMv8-M Baseline architectures, and enabled for all other
18157 architectures. If unaligned access is not enabled then words in packed
18158 data structures are accessed a byte at a time.
18159
18160 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18161 generated object file to either true or false, depending upon the
18162 setting of this option. If unaligned access is enabled then the
18163 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18164 defined.
18165
18166 @item -mneon-for-64bits
18167 @opindex mneon-for-64bits
18168 This option is deprecated and has no effect.
18169
18170 @item -mslow-flash-data
18171 @opindex mslow-flash-data
18172 Assume loading data from flash is slower than fetching instruction.
18173 Therefore literal load is minimized for better performance.
18174 This option is only supported when compiling for ARMv7 M-profile and
18175 off by default. It conflicts with @option{-mword-relocations}.
18176
18177 @item -masm-syntax-unified
18178 @opindex masm-syntax-unified
18179 Assume inline assembler is using unified asm syntax. The default is
18180 currently off which implies divided syntax. This option has no impact
18181 on Thumb2. However, this may change in future releases of GCC.
18182 Divided syntax should be considered deprecated.
18183
18184 @item -mrestrict-it
18185 @opindex mrestrict-it
18186 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18187 IT blocks can only contain a single 16-bit instruction from a select
18188 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18189
18190 @item -mprint-tune-info
18191 @opindex mprint-tune-info
18192 Print CPU tuning information as comment in assembler file. This is
18193 an option used only for regression testing of the compiler and not
18194 intended for ordinary use in compiling code. This option is disabled
18195 by default.
18196
18197 @item -mverbose-cost-dump
18198 @opindex mverbose-cost-dump
18199 Enable verbose cost model dumping in the debug dump files. This option is
18200 provided for use in debugging the compiler.
18201
18202 @item -mpure-code
18203 @opindex mpure-code
18204 Do not allow constant data to be placed in code sections.
18205 Additionally, when compiling for ELF object format give all text sections the
18206 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18207 is only available when generating non-pic code for M-profile targets with the
18208 MOVT instruction.
18209
18210 @item -mcmse
18211 @opindex mcmse
18212 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18213 Development Tools Engineering Specification", which can be found on
18214 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18215
18216 @item -mfdpic
18217 @itemx -mno-fdpic
18218 @opindex mfdpic
18219 @opindex mno-fdpic
18220 Select the FDPIC ABI, which uses 64-bit function descriptors to
18221 represent pointers to functions. When the compiler is configured for
18222 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18223 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18224 provided. On other targets, it only enables the FDPIC-specific code
18225 generation features, and the user should explicitly provide the
18226 PIC/PIE-related options as needed.
18227
18228 Note that static linking is not supported because it would still
18229 involve the dynamic linker when the program self-relocates. If such
18230 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18231
18232 The opposite @option{-mno-fdpic} option is useful (and required) to
18233 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18234 toolchain as the one used to build the userland programs.
18235
18236 @end table
18237
18238 @node AVR Options
18239 @subsection AVR Options
18240 @cindex AVR Options
18241
18242 These options are defined for AVR implementations:
18243
18244 @table @gcctabopt
18245 @item -mmcu=@var{mcu}
18246 @opindex mmcu
18247 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18248
18249 The default for this option is@tie{}@samp{avr2}.
18250
18251 GCC supports the following AVR devices and ISAs:
18252
18253 @include avr-mmcu.texi
18254
18255 @item -mabsdata
18256 @opindex mabsdata
18257
18258 Assume that all data in static storage can be accessed by LDS / STS
18259 instructions. This option has only an effect on reduced Tiny devices like
18260 ATtiny40. See also the @code{absdata}
18261 @ref{AVR Variable Attributes,variable attribute}.
18262
18263 @item -maccumulate-args
18264 @opindex maccumulate-args
18265 Accumulate outgoing function arguments and acquire/release the needed
18266 stack space for outgoing function arguments once in function
18267 prologue/epilogue. Without this option, outgoing arguments are pushed
18268 before calling a function and popped afterwards.
18269
18270 Popping the arguments after the function call can be expensive on
18271 AVR so that accumulating the stack space might lead to smaller
18272 executables because arguments need not be removed from the
18273 stack after such a function call.
18274
18275 This option can lead to reduced code size for functions that perform
18276 several calls to functions that get their arguments on the stack like
18277 calls to printf-like functions.
18278
18279 @item -mbranch-cost=@var{cost}
18280 @opindex mbranch-cost
18281 Set the branch costs for conditional branch instructions to
18282 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18283 integers. The default branch cost is 0.
18284
18285 @item -mcall-prologues
18286 @opindex mcall-prologues
18287 Functions prologues/epilogues are expanded as calls to appropriate
18288 subroutines. Code size is smaller.
18289
18290 @item -mdouble=@var{bits}
18291 @itemx -mlong-double=@var{bits}
18292 @opindex mdouble
18293 @opindex mlong-double
18294 Set the size (in bits) of the @code{double} or @code{long double} type,
18295 respectively. Possible values for @var{bits} are 32 an 64.
18296 Whether or not a specific value for @var{bits} is allowed depends on
18297 the @code{--with--double=} and @code{--with-long-double=}
18298 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
18299 and the same applies for the default values of the options.
18300
18301 @item -mgas-isr-prologues
18302 @opindex mgas-isr-prologues
18303 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18304 instruction supported by GNU Binutils.
18305 If this option is on, the feature can still be disabled for individual
18306 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18307 function attribute. This feature is activated per default
18308 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18309 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18310
18311 @item -mint8
18312 @opindex mint8
18313 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18314 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18315 and @code{long long} is 4 bytes. Please note that this option does not
18316 conform to the C standards, but it results in smaller code
18317 size.
18318
18319 @item -mmain-is-OS_task
18320 @opindex mmain-is-OS_task
18321 Do not save registers in @code{main}. The effect is the same like
18322 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18323 to @code{main}. It is activated per default if optimization is on.
18324
18325 @item -mn-flash=@var{num}
18326 @opindex mn-flash
18327 Assume that the flash memory has a size of
18328 @var{num} times 64@tie{}KiB.
18329
18330 @item -mno-interrupts
18331 @opindex mno-interrupts
18332 Generated code is not compatible with hardware interrupts.
18333 Code size is smaller.
18334
18335 @item -mrelax
18336 @opindex mrelax
18337 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18338 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18339 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18340 the assembler's command line and the @option{--relax} option to the
18341 linker's command line.
18342
18343 Jump relaxing is performed by the linker because jump offsets are not
18344 known before code is located. Therefore, the assembler code generated by the
18345 compiler is the same, but the instructions in the executable may
18346 differ from instructions in the assembler code.
18347
18348 Relaxing must be turned on if linker stubs are needed, see the
18349 section on @code{EIND} and linker stubs below.
18350
18351 @item -mrmw
18352 @opindex mrmw
18353 Assume that the device supports the Read-Modify-Write
18354 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18355
18356 @item -mshort-calls
18357 @opindex mshort-calls
18358
18359 Assume that @code{RJMP} and @code{RCALL} can target the whole
18360 program memory.
18361
18362 This option is used internally for multilib selection. It is
18363 not an optimization option, and you don't need to set it by hand.
18364
18365 @item -msp8
18366 @opindex msp8
18367 Treat the stack pointer register as an 8-bit register,
18368 i.e.@: assume the high byte of the stack pointer is zero.
18369 In general, you don't need to set this option by hand.
18370
18371 This option is used internally by the compiler to select and
18372 build multilibs for architectures @code{avr2} and @code{avr25}.
18373 These architectures mix devices with and without @code{SPH}.
18374 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18375 the compiler driver adds or removes this option from the compiler
18376 proper's command line, because the compiler then knows if the device
18377 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18378 register or not.
18379
18380 @item -mstrict-X
18381 @opindex mstrict-X
18382 Use address register @code{X} in a way proposed by the hardware. This means
18383 that @code{X} is only used in indirect, post-increment or
18384 pre-decrement addressing.
18385
18386 Without this option, the @code{X} register may be used in the same way
18387 as @code{Y} or @code{Z} which then is emulated by additional
18388 instructions.
18389 For example, loading a value with @code{X+const} addressing with a
18390 small non-negative @code{const < 64} to a register @var{Rn} is
18391 performed as
18392
18393 @example
18394 adiw r26, const ; X += const
18395 ld @var{Rn}, X ; @var{Rn} = *X
18396 sbiw r26, const ; X -= const
18397 @end example
18398
18399 @item -mtiny-stack
18400 @opindex mtiny-stack
18401 Only change the lower 8@tie{}bits of the stack pointer.
18402
18403 @item -mfract-convert-truncate
18404 @opindex mfract-convert-truncate
18405 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18406
18407 @item -nodevicelib
18408 @opindex nodevicelib
18409 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18410
18411 @item -Waddr-space-convert
18412 @opindex Waddr-space-convert
18413 @opindex Wno-addr-space-convert
18414 Warn about conversions between address spaces in the case where the
18415 resulting address space is not contained in the incoming address space.
18416
18417 @item -Wmisspelled-isr
18418 @opindex Wmisspelled-isr
18419 @opindex Wno-misspelled-isr
18420 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18421 Enabled by default.
18422 @end table
18423
18424 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18425 @cindex @code{EIND}
18426 Pointers in the implementation are 16@tie{}bits wide.
18427 The address of a function or label is represented as word address so
18428 that indirect jumps and calls can target any code address in the
18429 range of 64@tie{}Ki words.
18430
18431 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18432 bytes of program memory space, there is a special function register called
18433 @code{EIND} that serves as most significant part of the target address
18434 when @code{EICALL} or @code{EIJMP} instructions are used.
18435
18436 Indirect jumps and calls on these devices are handled as follows by
18437 the compiler and are subject to some limitations:
18438
18439 @itemize @bullet
18440
18441 @item
18442 The compiler never sets @code{EIND}.
18443
18444 @item
18445 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18446 instructions or might read @code{EIND} directly in order to emulate an
18447 indirect call/jump by means of a @code{RET} instruction.
18448
18449 @item
18450 The compiler assumes that @code{EIND} never changes during the startup
18451 code or during the application. In particular, @code{EIND} is not
18452 saved/restored in function or interrupt service routine
18453 prologue/epilogue.
18454
18455 @item
18456 For indirect calls to functions and computed goto, the linker
18457 generates @emph{stubs}. Stubs are jump pads sometimes also called
18458 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18459 The stub contains a direct jump to the desired address.
18460
18461 @item
18462 Linker relaxation must be turned on so that the linker generates
18463 the stubs correctly in all situations. See the compiler option
18464 @option{-mrelax} and the linker option @option{--relax}.
18465 There are corner cases where the linker is supposed to generate stubs
18466 but aborts without relaxation and without a helpful error message.
18467
18468 @item
18469 The default linker script is arranged for code with @code{EIND = 0}.
18470 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18471 linker script has to be used in order to place the sections whose
18472 name start with @code{.trampolines} into the segment where @code{EIND}
18473 points to.
18474
18475 @item
18476 The startup code from libgcc never sets @code{EIND}.
18477 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18478 For the impact of AVR-LibC on @code{EIND}, see the
18479 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18480
18481 @item
18482 It is legitimate for user-specific startup code to set up @code{EIND}
18483 early, for example by means of initialization code located in
18484 section @code{.init3}. Such code runs prior to general startup code
18485 that initializes RAM and calls constructors, but after the bit
18486 of startup code from AVR-LibC that sets @code{EIND} to the segment
18487 where the vector table is located.
18488 @example
18489 #include <avr/io.h>
18490
18491 static void
18492 __attribute__((section(".init3"),naked,used,no_instrument_function))
18493 init3_set_eind (void)
18494 @{
18495 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18496 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18497 @}
18498 @end example
18499
18500 @noindent
18501 The @code{__trampolines_start} symbol is defined in the linker script.
18502
18503 @item
18504 Stubs are generated automatically by the linker if
18505 the following two conditions are met:
18506 @itemize @minus
18507
18508 @item The address of a label is taken by means of the @code{gs} modifier
18509 (short for @emph{generate stubs}) like so:
18510 @example
18511 LDI r24, lo8(gs(@var{func}))
18512 LDI r25, hi8(gs(@var{func}))
18513 @end example
18514 @item The final location of that label is in a code segment
18515 @emph{outside} the segment where the stubs are located.
18516 @end itemize
18517
18518 @item
18519 The compiler emits such @code{gs} modifiers for code labels in the
18520 following situations:
18521 @itemize @minus
18522 @item Taking address of a function or code label.
18523 @item Computed goto.
18524 @item If prologue-save function is used, see @option{-mcall-prologues}
18525 command-line option.
18526 @item Switch/case dispatch tables. If you do not want such dispatch
18527 tables you can specify the @option{-fno-jump-tables} command-line option.
18528 @item C and C++ constructors/destructors called during startup/shutdown.
18529 @item If the tools hit a @code{gs()} modifier explained above.
18530 @end itemize
18531
18532 @item
18533 Jumping to non-symbolic addresses like so is @emph{not} supported:
18534
18535 @example
18536 int main (void)
18537 @{
18538 /* Call function at word address 0x2 */
18539 return ((int(*)(void)) 0x2)();
18540 @}
18541 @end example
18542
18543 Instead, a stub has to be set up, i.e.@: the function has to be called
18544 through a symbol (@code{func_4} in the example):
18545
18546 @example
18547 int main (void)
18548 @{
18549 extern int func_4 (void);
18550
18551 /* Call function at byte address 0x4 */
18552 return func_4();
18553 @}
18554 @end example
18555
18556 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18557 Alternatively, @code{func_4} can be defined in the linker script.
18558 @end itemize
18559
18560 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18561 @cindex @code{RAMPD}
18562 @cindex @code{RAMPX}
18563 @cindex @code{RAMPY}
18564 @cindex @code{RAMPZ}
18565 Some AVR devices support memories larger than the 64@tie{}KiB range
18566 that can be accessed with 16-bit pointers. To access memory locations
18567 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18568 register is used as high part of the address:
18569 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18570 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18571 register, respectively, to get a wide address. Similarly,
18572 @code{RAMPD} is used together with direct addressing.
18573
18574 @itemize
18575 @item
18576 The startup code initializes the @code{RAMP} special function
18577 registers with zero.
18578
18579 @item
18580 If a @ref{AVR Named Address Spaces,named address space} other than
18581 generic or @code{__flash} is used, then @code{RAMPZ} is set
18582 as needed before the operation.
18583
18584 @item
18585 If the device supports RAM larger than 64@tie{}KiB and the compiler
18586 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18587 is reset to zero after the operation.
18588
18589 @item
18590 If the device comes with a specific @code{RAMP} register, the ISR
18591 prologue/epilogue saves/restores that SFR and initializes it with
18592 zero in case the ISR code might (implicitly) use it.
18593
18594 @item
18595 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18596 If you use inline assembler to read from locations outside the
18597 16-bit address range and change one of the @code{RAMP} registers,
18598 you must reset it to zero after the access.
18599
18600 @end itemize
18601
18602 @subsubsection AVR Built-in Macros
18603
18604 GCC defines several built-in macros so that the user code can test
18605 for the presence or absence of features. Almost any of the following
18606 built-in macros are deduced from device capabilities and thus
18607 triggered by the @option{-mmcu=} command-line option.
18608
18609 For even more AVR-specific built-in macros see
18610 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18611
18612 @table @code
18613
18614 @item __AVR_ARCH__
18615 Build-in macro that resolves to a decimal number that identifies the
18616 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18617 Possible values are:
18618
18619 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18620 @code{4}, @code{5}, @code{51}, @code{6}
18621
18622 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18623 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18624
18625 respectively and
18626
18627 @code{100},
18628 @code{102}, @code{103}, @code{104},
18629 @code{105}, @code{106}, @code{107}
18630
18631 for @var{mcu}=@code{avrtiny},
18632 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18633 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18634 If @var{mcu} specifies a device, this built-in macro is set
18635 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18636 defined to @code{4}.
18637
18638 @item __AVR_@var{Device}__
18639 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18640 the device's name. For example, @option{-mmcu=atmega8} defines the
18641 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18642 @code{__AVR_ATtiny261A__}, etc.
18643
18644 The built-in macros' names follow
18645 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18646 the device name as from the AVR user manual. The difference between
18647 @var{Device} in the built-in macro and @var{device} in
18648 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18649
18650 If @var{device} is not a device but only a core architecture like
18651 @samp{avr51}, this macro is not defined.
18652
18653 @item __AVR_DEVICE_NAME__
18654 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18655 the device's name. For example, with @option{-mmcu=atmega8} the macro
18656 is defined to @code{atmega8}.
18657
18658 If @var{device} is not a device but only a core architecture like
18659 @samp{avr51}, this macro is not defined.
18660
18661 @item __AVR_XMEGA__
18662 The device / architecture belongs to the XMEGA family of devices.
18663
18664 @item __AVR_HAVE_ELPM__
18665 The device has the @code{ELPM} instruction.
18666
18667 @item __AVR_HAVE_ELPMX__
18668 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18669 R@var{n},Z+} instructions.
18670
18671 @item __AVR_HAVE_MOVW__
18672 The device has the @code{MOVW} instruction to perform 16-bit
18673 register-register moves.
18674
18675 @item __AVR_HAVE_LPMX__
18676 The device has the @code{LPM R@var{n},Z} and
18677 @code{LPM R@var{n},Z+} instructions.
18678
18679 @item __AVR_HAVE_MUL__
18680 The device has a hardware multiplier.
18681
18682 @item __AVR_HAVE_JMP_CALL__
18683 The device has the @code{JMP} and @code{CALL} instructions.
18684 This is the case for devices with more than 8@tie{}KiB of program
18685 memory.
18686
18687 @item __AVR_HAVE_EIJMP_EICALL__
18688 @itemx __AVR_3_BYTE_PC__
18689 The device has the @code{EIJMP} and @code{EICALL} instructions.
18690 This is the case for devices with more than 128@tie{}KiB of program memory.
18691 This also means that the program counter
18692 (PC) is 3@tie{}bytes wide.
18693
18694 @item __AVR_2_BYTE_PC__
18695 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18696 with up to 128@tie{}KiB of program memory.
18697
18698 @item __AVR_HAVE_8BIT_SP__
18699 @itemx __AVR_HAVE_16BIT_SP__
18700 The stack pointer (SP) register is treated as 8-bit respectively
18701 16-bit register by the compiler.
18702 The definition of these macros is affected by @option{-mtiny-stack}.
18703
18704 @item __AVR_HAVE_SPH__
18705 @itemx __AVR_SP8__
18706 The device has the SPH (high part of stack pointer) special function
18707 register or has an 8-bit stack pointer, respectively.
18708 The definition of these macros is affected by @option{-mmcu=} and
18709 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18710 by @option{-msp8}.
18711
18712 @item __AVR_HAVE_RAMPD__
18713 @itemx __AVR_HAVE_RAMPX__
18714 @itemx __AVR_HAVE_RAMPY__
18715 @itemx __AVR_HAVE_RAMPZ__
18716 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18717 @code{RAMPZ} special function register, respectively.
18718
18719 @item __NO_INTERRUPTS__
18720 This macro reflects the @option{-mno-interrupts} command-line option.
18721
18722 @item __AVR_ERRATA_SKIP__
18723 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18724 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18725 instructions because of a hardware erratum. Skip instructions are
18726 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18727 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18728 set.
18729
18730 @item __AVR_ISA_RMW__
18731 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18732
18733 @item __AVR_SFR_OFFSET__=@var{offset}
18734 Instructions that can address I/O special function registers directly
18735 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18736 address as if addressed by an instruction to access RAM like @code{LD}
18737 or @code{STS}. This offset depends on the device architecture and has
18738 to be subtracted from the RAM address in order to get the
18739 respective I/O@tie{}address.
18740
18741 @item __AVR_SHORT_CALLS__
18742 The @option{-mshort-calls} command line option is set.
18743
18744 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18745 Some devices support reading from flash memory by means of @code{LD*}
18746 instructions. The flash memory is seen in the data address space
18747 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18748 is not defined, this feature is not available. If defined,
18749 the address space is linear and there is no need to put
18750 @code{.rodata} into RAM. This is handled by the default linker
18751 description file, and is currently available for
18752 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18753 there is no need to use address spaces like @code{__flash} or
18754 features like attribute @code{progmem} and @code{pgm_read_*}.
18755
18756 @item __WITH_AVRLIBC__
18757 The compiler is configured to be used together with AVR-Libc.
18758 See the @option{--with-avrlibc} configure option.
18759
18760 @end table
18761
18762 @node Blackfin Options
18763 @subsection Blackfin Options
18764 @cindex Blackfin Options
18765
18766 @table @gcctabopt
18767 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18768 @opindex mcpu=
18769 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18770 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18771 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18772 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18773 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18774 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18775 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18776 @samp{bf561}, @samp{bf592}.
18777
18778 The optional @var{sirevision} specifies the silicon revision of the target
18779 Blackfin processor. Any workarounds available for the targeted silicon revision
18780 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18781 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18782 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18783 hexadecimal digits representing the major and minor numbers in the silicon
18784 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18785 is not defined. If @var{sirevision} is @samp{any}, the
18786 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18787 If this optional @var{sirevision} is not used, GCC assumes the latest known
18788 silicon revision of the targeted Blackfin processor.
18789
18790 GCC defines a preprocessor macro for the specified @var{cpu}.
18791 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18792 provided by libgloss to be linked in if @option{-msim} is not given.
18793
18794 Without this option, @samp{bf532} is used as the processor by default.
18795
18796 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18797 only the preprocessor macro is defined.
18798
18799 @item -msim
18800 @opindex msim
18801 Specifies that the program will be run on the simulator. This causes
18802 the simulator BSP provided by libgloss to be linked in. This option
18803 has effect only for @samp{bfin-elf} toolchain.
18804 Certain other options, such as @option{-mid-shared-library} and
18805 @option{-mfdpic}, imply @option{-msim}.
18806
18807 @item -momit-leaf-frame-pointer
18808 @opindex momit-leaf-frame-pointer
18809 Don't keep the frame pointer in a register for leaf functions. This
18810 avoids the instructions to save, set up and restore frame pointers and
18811 makes an extra register available in leaf functions.
18812
18813 @item -mspecld-anomaly
18814 @opindex mspecld-anomaly
18815 When enabled, the compiler ensures that the generated code does not
18816 contain speculative loads after jump instructions. If this option is used,
18817 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18818
18819 @item -mno-specld-anomaly
18820 @opindex mno-specld-anomaly
18821 @opindex mspecld-anomaly
18822 Don't generate extra code to prevent speculative loads from occurring.
18823
18824 @item -mcsync-anomaly
18825 @opindex mcsync-anomaly
18826 When enabled, the compiler ensures that the generated code does not
18827 contain CSYNC or SSYNC instructions too soon after conditional branches.
18828 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18829
18830 @item -mno-csync-anomaly
18831 @opindex mno-csync-anomaly
18832 @opindex mcsync-anomaly
18833 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18834 occurring too soon after a conditional branch.
18835
18836 @item -mlow64k
18837 @opindex mlow64k
18838 When enabled, the compiler is free to take advantage of the knowledge that
18839 the entire program fits into the low 64k of memory.
18840
18841 @item -mno-low64k
18842 @opindex mno-low64k
18843 Assume that the program is arbitrarily large. This is the default.
18844
18845 @item -mstack-check-l1
18846 @opindex mstack-check-l1
18847 Do stack checking using information placed into L1 scratchpad memory by the
18848 uClinux kernel.
18849
18850 @item -mid-shared-library
18851 @opindex mid-shared-library
18852 Generate code that supports shared libraries via the library ID method.
18853 This allows for execute in place and shared libraries in an environment
18854 without virtual memory management. This option implies @option{-fPIC}.
18855 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18856
18857 @item -mno-id-shared-library
18858 @opindex mno-id-shared-library
18859 @opindex mid-shared-library
18860 Generate code that doesn't assume ID-based shared libraries are being used.
18861 This is the default.
18862
18863 @item -mleaf-id-shared-library
18864 @opindex mleaf-id-shared-library
18865 Generate code that supports shared libraries via the library ID method,
18866 but assumes that this library or executable won't link against any other
18867 ID shared libraries. That allows the compiler to use faster code for jumps
18868 and calls.
18869
18870 @item -mno-leaf-id-shared-library
18871 @opindex mno-leaf-id-shared-library
18872 @opindex mleaf-id-shared-library
18873 Do not assume that the code being compiled won't link against any ID shared
18874 libraries. Slower code is generated for jump and call insns.
18875
18876 @item -mshared-library-id=n
18877 @opindex mshared-library-id
18878 Specifies the identification number of the ID-based shared library being
18879 compiled. Specifying a value of 0 generates more compact code; specifying
18880 other values forces the allocation of that number to the current
18881 library but is no more space- or time-efficient than omitting this option.
18882
18883 @item -msep-data
18884 @opindex msep-data
18885 Generate code that allows the data segment to be located in a different
18886 area of memory from the text segment. This allows for execute in place in
18887 an environment without virtual memory management by eliminating relocations
18888 against the text section.
18889
18890 @item -mno-sep-data
18891 @opindex mno-sep-data
18892 @opindex msep-data
18893 Generate code that assumes that the data segment follows the text segment.
18894 This is the default.
18895
18896 @item -mlong-calls
18897 @itemx -mno-long-calls
18898 @opindex mlong-calls
18899 @opindex mno-long-calls
18900 Tells the compiler to perform function calls by first loading the
18901 address of the function into a register and then performing a subroutine
18902 call on this register. This switch is needed if the target function
18903 lies outside of the 24-bit addressing range of the offset-based
18904 version of subroutine call instruction.
18905
18906 This feature is not enabled by default. Specifying
18907 @option{-mno-long-calls} restores the default behavior. Note these
18908 switches have no effect on how the compiler generates code to handle
18909 function calls via function pointers.
18910
18911 @item -mfast-fp
18912 @opindex mfast-fp
18913 Link with the fast floating-point library. This library relaxes some of
18914 the IEEE floating-point standard's rules for checking inputs against
18915 Not-a-Number (NAN), in the interest of performance.
18916
18917 @item -minline-plt
18918 @opindex minline-plt
18919 Enable inlining of PLT entries in function calls to functions that are
18920 not known to bind locally. It has no effect without @option{-mfdpic}.
18921
18922 @item -mmulticore
18923 @opindex mmulticore
18924 Build a standalone application for multicore Blackfin processors.
18925 This option causes proper start files and link scripts supporting
18926 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18927 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18928
18929 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18930 selects the one-application-per-core programming model. Without
18931 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18932 programming model is used. In this model, the main function of Core B
18933 should be named as @code{coreb_main}.
18934
18935 If this option is not used, the single-core application programming
18936 model is used.
18937
18938 @item -mcorea
18939 @opindex mcorea
18940 Build a standalone application for Core A of BF561 when using
18941 the one-application-per-core programming model. Proper start files
18942 and link scripts are used to support Core A, and the macro
18943 @code{__BFIN_COREA} is defined.
18944 This option can only be used in conjunction with @option{-mmulticore}.
18945
18946 @item -mcoreb
18947 @opindex mcoreb
18948 Build a standalone application for Core B of BF561 when using
18949 the one-application-per-core programming model. Proper start files
18950 and link scripts are used to support Core B, and the macro
18951 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18952 should be used instead of @code{main}.
18953 This option can only be used in conjunction with @option{-mmulticore}.
18954
18955 @item -msdram
18956 @opindex msdram
18957 Build a standalone application for SDRAM. Proper start files and
18958 link scripts are used to put the application into SDRAM, and the macro
18959 @code{__BFIN_SDRAM} is defined.
18960 The loader should initialize SDRAM before loading the application.
18961
18962 @item -micplb
18963 @opindex micplb
18964 Assume that ICPLBs are enabled at run time. This has an effect on certain
18965 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18966 are enabled; for standalone applications the default is off.
18967 @end table
18968
18969 @node C6X Options
18970 @subsection C6X Options
18971 @cindex C6X Options
18972
18973 @table @gcctabopt
18974 @item -march=@var{name}
18975 @opindex march
18976 This specifies the name of the target architecture. GCC uses this
18977 name to determine what kind of instructions it can emit when generating
18978 assembly code. Permissible names are: @samp{c62x},
18979 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18980
18981 @item -mbig-endian
18982 @opindex mbig-endian
18983 Generate code for a big-endian target.
18984
18985 @item -mlittle-endian
18986 @opindex mlittle-endian
18987 Generate code for a little-endian target. This is the default.
18988
18989 @item -msim
18990 @opindex msim
18991 Choose startup files and linker script suitable for the simulator.
18992
18993 @item -msdata=default
18994 @opindex msdata=default
18995 Put small global and static data in the @code{.neardata} section,
18996 which is pointed to by register @code{B14}. Put small uninitialized
18997 global and static data in the @code{.bss} section, which is adjacent
18998 to the @code{.neardata} section. Put small read-only data into the
18999 @code{.rodata} section. The corresponding sections used for large
19000 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
19001
19002 @item -msdata=all
19003 @opindex msdata=all
19004 Put all data, not just small objects, into the sections reserved for
19005 small data, and use addressing relative to the @code{B14} register to
19006 access them.
19007
19008 @item -msdata=none
19009 @opindex msdata=none
19010 Make no use of the sections reserved for small data, and use absolute
19011 addresses to access all data. Put all initialized global and static
19012 data in the @code{.fardata} section, and all uninitialized data in the
19013 @code{.far} section. Put all constant data into the @code{.const}
19014 section.
19015 @end table
19016
19017 @node CRIS Options
19018 @subsection CRIS Options
19019 @cindex CRIS Options
19020
19021 These options are defined specifically for the CRIS ports.
19022
19023 @table @gcctabopt
19024 @item -march=@var{architecture-type}
19025 @itemx -mcpu=@var{architecture-type}
19026 @opindex march
19027 @opindex mcpu
19028 Generate code for the specified architecture. The choices for
19029 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
19030 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
19031 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
19032 @samp{v10}.
19033
19034 @item -mtune=@var{architecture-type}
19035 @opindex mtune
19036 Tune to @var{architecture-type} everything applicable about the generated
19037 code, except for the ABI and the set of available instructions. The
19038 choices for @var{architecture-type} are the same as for
19039 @option{-march=@var{architecture-type}}.
19040
19041 @item -mmax-stack-frame=@var{n}
19042 @opindex mmax-stack-frame
19043 Warn when the stack frame of a function exceeds @var{n} bytes.
19044
19045 @item -metrax4
19046 @itemx -metrax100
19047 @opindex metrax4
19048 @opindex metrax100
19049 The options @option{-metrax4} and @option{-metrax100} are synonyms for
19050 @option{-march=v3} and @option{-march=v8} respectively.
19051
19052 @item -mmul-bug-workaround
19053 @itemx -mno-mul-bug-workaround
19054 @opindex mmul-bug-workaround
19055 @opindex mno-mul-bug-workaround
19056 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
19057 models where it applies. This option is active by default.
19058
19059 @item -mpdebug
19060 @opindex mpdebug
19061 Enable CRIS-specific verbose debug-related information in the assembly
19062 code. This option also has the effect of turning off the @samp{#NO_APP}
19063 formatted-code indicator to the assembler at the beginning of the
19064 assembly file.
19065
19066 @item -mcc-init
19067 @opindex mcc-init
19068 Do not use condition-code results from previous instruction; always emit
19069 compare and test instructions before use of condition codes.
19070
19071 @item -mno-side-effects
19072 @opindex mno-side-effects
19073 @opindex mside-effects
19074 Do not emit instructions with side effects in addressing modes other than
19075 post-increment.
19076
19077 @item -mstack-align
19078 @itemx -mno-stack-align
19079 @itemx -mdata-align
19080 @itemx -mno-data-align
19081 @itemx -mconst-align
19082 @itemx -mno-const-align
19083 @opindex mstack-align
19084 @opindex mno-stack-align
19085 @opindex mdata-align
19086 @opindex mno-data-align
19087 @opindex mconst-align
19088 @opindex mno-const-align
19089 These options (@samp{no-} options) arrange (eliminate arrangements) for the
19090 stack frame, individual data and constants to be aligned for the maximum
19091 single data access size for the chosen CPU model. The default is to
19092 arrange for 32-bit alignment. ABI details such as structure layout are
19093 not affected by these options.
19094
19095 @item -m32-bit
19096 @itemx -m16-bit
19097 @itemx -m8-bit
19098 @opindex m32-bit
19099 @opindex m16-bit
19100 @opindex m8-bit
19101 Similar to the stack- data- and const-align options above, these options
19102 arrange for stack frame, writable data and constants to all be 32-bit,
19103 16-bit or 8-bit aligned. The default is 32-bit alignment.
19104
19105 @item -mno-prologue-epilogue
19106 @itemx -mprologue-epilogue
19107 @opindex mno-prologue-epilogue
19108 @opindex mprologue-epilogue
19109 With @option{-mno-prologue-epilogue}, the normal function prologue and
19110 epilogue which set up the stack frame are omitted and no return
19111 instructions or return sequences are generated in the code. Use this
19112 option only together with visual inspection of the compiled code: no
19113 warnings or errors are generated when call-saved registers must be saved,
19114 or storage for local variables needs to be allocated.
19115
19116 @item -mno-gotplt
19117 @itemx -mgotplt
19118 @opindex mno-gotplt
19119 @opindex mgotplt
19120 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
19121 instruction sequences that load addresses for functions from the PLT part
19122 of the GOT rather than (traditional on other architectures) calls to the
19123 PLT@. The default is @option{-mgotplt}.
19124
19125 @item -melf
19126 @opindex melf
19127 Legacy no-op option only recognized with the cris-axis-elf and
19128 cris-axis-linux-gnu targets.
19129
19130 @item -mlinux
19131 @opindex mlinux
19132 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
19133
19134 @item -sim
19135 @opindex sim
19136 This option, recognized for the cris-axis-elf, arranges
19137 to link with input-output functions from a simulator library. Code,
19138 initialized data and zero-initialized data are allocated consecutively.
19139
19140 @item -sim2
19141 @opindex sim2
19142 Like @option{-sim}, but pass linker options to locate initialized data at
19143 0x40000000 and zero-initialized data at 0x80000000.
19144 @end table
19145
19146 @node CR16 Options
19147 @subsection CR16 Options
19148 @cindex CR16 Options
19149
19150 These options are defined specifically for the CR16 ports.
19151
19152 @table @gcctabopt
19153
19154 @item -mmac
19155 @opindex mmac
19156 Enable the use of multiply-accumulate instructions. Disabled by default.
19157
19158 @item -mcr16cplus
19159 @itemx -mcr16c
19160 @opindex mcr16cplus
19161 @opindex mcr16c
19162 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19163 is default.
19164
19165 @item -msim
19166 @opindex msim
19167 Links the library libsim.a which is in compatible with simulator. Applicable
19168 to ELF compiler only.
19169
19170 @item -mint32
19171 @opindex mint32
19172 Choose integer type as 32-bit wide.
19173
19174 @item -mbit-ops
19175 @opindex mbit-ops
19176 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
19177
19178 @item -mdata-model=@var{model}
19179 @opindex mdata-model
19180 Choose a data model. The choices for @var{model} are @samp{near},
19181 @samp{far} or @samp{medium}. @samp{medium} is default.
19182 However, @samp{far} is not valid with @option{-mcr16c}, as the
19183 CR16C architecture does not support the far data model.
19184 @end table
19185
19186 @node C-SKY Options
19187 @subsection C-SKY Options
19188 @cindex C-SKY Options
19189
19190 GCC supports these options when compiling for C-SKY V2 processors.
19191
19192 @table @gcctabopt
19193
19194 @item -march=@var{arch}
19195 @opindex march=
19196 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19197 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19198 The default is @samp{ck810}.
19199
19200 @item -mcpu=@var{cpu}
19201 @opindex mcpu=
19202 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19203 @samp{ck801}, @samp{ck801t},
19204 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19205 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19206 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19207 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19208 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19209 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19210 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19211 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19212 @samp{ck803eftr1}, @samp{ck803efhtr1},
19213 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19214 @samp{ck803sef}, @samp{ck803seft},
19215 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19216 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19217 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19218 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19219
19220 @item -mbig-endian
19221 @opindex mbig-endian
19222 @itemx -EB
19223 @opindex EB
19224 @itemx -mlittle-endian
19225 @opindex mlittle-endian
19226 @itemx -EL
19227 @opindex EL
19228
19229 Select big- or little-endian code. The default is little-endian.
19230
19231 @item -mhard-float
19232 @opindex mhard-float
19233 @itemx -msoft-float
19234 @opindex msoft-float
19235
19236 Select hardware or software floating-point implementations.
19237 The default is soft float.
19238
19239 @item -mdouble-float
19240 @itemx -mno-double-float
19241 @opindex mdouble-float
19242 When @option{-mhard-float} is in effect, enable generation of
19243 double-precision float instructions. This is the default except
19244 when compiling for CK803.
19245
19246 @item -mfdivdu
19247 @itemx -mno-fdivdu
19248 @opindex mfdivdu
19249 When @option{-mhard-float} is in effect, enable generation of
19250 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19251 This is the default except when compiling for CK803.
19252
19253 @item -mfpu=@var{fpu}
19254 @opindex mfpu=
19255 Select the floating-point processor. This option can only be used with
19256 @option{-mhard-float}.
19257 Values for @var{fpu} are
19258 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19259 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19260 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19261
19262 @item -melrw
19263 @itemx -mno-elrw
19264 @opindex melrw
19265 Enable the extended @code{lrw} instruction. This option defaults to on
19266 for CK801 and off otherwise.
19267
19268 @item -mistack
19269 @itemx -mno-istack
19270 @opindex mistack
19271 Enable interrupt stack instructions; the default is off.
19272
19273 The @option{-mistack} option is required to handle the
19274 @code{interrupt} and @code{isr} function attributes
19275 (@pxref{C-SKY Function Attributes}).
19276
19277 @item -mmp
19278 @opindex mmp
19279 Enable multiprocessor instructions; the default is off.
19280
19281 @item -mcp
19282 @opindex mcp
19283 Enable coprocessor instructions; the default is off.
19284
19285 @item -mcache
19286 @opindex mcache
19287 Enable coprocessor instructions; the default is off.
19288
19289 @item -msecurity
19290 @opindex msecurity
19291 Enable C-SKY security instructions; the default is off.
19292
19293 @item -mtrust
19294 @opindex mtrust
19295 Enable C-SKY trust instructions; the default is off.
19296
19297 @item -mdsp
19298 @opindex mdsp
19299 @itemx -medsp
19300 @opindex medsp
19301 @itemx -mvdsp
19302 @opindex mvdsp
19303 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19304 All of these options default to off.
19305
19306 @item -mdiv
19307 @itemx -mno-div
19308 @opindex mdiv
19309 Generate divide instructions. Default is off.
19310
19311 @item -msmart
19312 @itemx -mno-smart
19313 @opindex msmart
19314 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19315 use of 16-bit instructions. This option is ignored for CK801 where this
19316 is the required behavior, and it defaults to on for CK802.
19317 For other targets, the default is off.
19318
19319 @item -mhigh-registers
19320 @itemx -mno-high-registers
19321 @opindex mhigh-registers
19322 Generate code using the high registers numbered 16-31. This option
19323 is not supported on CK801, CK802, or CK803, and is enabled by default
19324 for other processors.
19325
19326 @item -manchor
19327 @itemx -mno-anchor
19328 @opindex manchor
19329 Generate code using global anchor symbol addresses.
19330
19331 @item -mpushpop
19332 @itemx -mno-pushpop
19333 @opindex mpushpop
19334 Generate code using @code{push} and @code{pop} instructions. This option
19335 defaults to on.
19336
19337 @item -mmultiple-stld
19338 @itemx -mstm
19339 @itemx -mno-multiple-stld
19340 @itemx -mno-stm
19341 @opindex mmultiple-stld
19342 Generate code using @code{stm} and @code{ldm} instructions. This option
19343 isn't supported on CK801 but is enabled by default on other processors.
19344
19345 @item -mconstpool
19346 @itemx -mno-constpool
19347 @opindex mconstpool
19348 Create constant pools in the compiler instead of deferring it to the
19349 assembler. This option is the default and required for correct code
19350 generation on CK801 and CK802, and is optional on other processors.
19351
19352 @item -mstack-size
19353 @item -mno-stack-size
19354 @opindex mstack-size
19355 Emit @code{.stack_size} directives for each function in the assembly
19356 output. This option defaults to off.
19357
19358 @item -mccrt
19359 @itemx -mno-ccrt
19360 @opindex mccrt
19361 Generate code for the C-SKY compiler runtime instead of libgcc. This
19362 option defaults to off.
19363
19364 @item -mbranch-cost=@var{n}
19365 @opindex mbranch-cost=
19366 Set the branch costs to roughly @code{n} instructions. The default is 1.
19367
19368 @item -msched-prolog
19369 @itemx -mno-sched-prolog
19370 @opindex msched-prolog
19371 Permit scheduling of function prologue and epilogue sequences. Using
19372 this option can result in code that is not compliant with the C-SKY V2 ABI
19373 prologue requirements and that cannot be debugged or backtraced.
19374 It is disabled by default.
19375
19376 @end table
19377
19378 @node Darwin Options
19379 @subsection Darwin Options
19380 @cindex Darwin options
19381
19382 These options are defined for all architectures running the Darwin operating
19383 system.
19384
19385 FSF GCC on Darwin does not create ``fat'' object files; it creates
19386 an object file for the single architecture that GCC was built to
19387 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19388 @option{-arch} options are used; it does so by running the compiler or
19389 linker multiple times and joining the results together with
19390 @file{lipo}.
19391
19392 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19393 @samp{i686}) is determined by the flags that specify the ISA
19394 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19395 @option{-force_cpusubtype_ALL} option can be used to override this.
19396
19397 The Darwin tools vary in their behavior when presented with an ISA
19398 mismatch. The assembler, @file{as}, only permits instructions to
19399 be used that are valid for the subtype of the file it is generating,
19400 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19401 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19402 and prints an error if asked to create a shared library with a less
19403 restrictive subtype than its input files (for instance, trying to put
19404 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19405 for executables, @command{ld}, quietly gives the executable the most
19406 restrictive subtype of any of its input files.
19407
19408 @table @gcctabopt
19409 @item -F@var{dir}
19410 @opindex F
19411 Add the framework directory @var{dir} to the head of the list of
19412 directories to be searched for header files. These directories are
19413 interleaved with those specified by @option{-I} options and are
19414 scanned in a left-to-right order.
19415
19416 A framework directory is a directory with frameworks in it. A
19417 framework is a directory with a @file{Headers} and/or
19418 @file{PrivateHeaders} directory contained directly in it that ends
19419 in @file{.framework}. The name of a framework is the name of this
19420 directory excluding the @file{.framework}. Headers associated with
19421 the framework are found in one of those two directories, with
19422 @file{Headers} being searched first. A subframework is a framework
19423 directory that is in a framework's @file{Frameworks} directory.
19424 Includes of subframework headers can only appear in a header of a
19425 framework that contains the subframework, or in a sibling subframework
19426 header. Two subframeworks are siblings if they occur in the same
19427 framework. A subframework should not have the same name as a
19428 framework; a warning is issued if this is violated. Currently a
19429 subframework cannot have subframeworks; in the future, the mechanism
19430 may be extended to support this. The standard frameworks can be found
19431 in @file{/System/Library/Frameworks} and
19432 @file{/Library/Frameworks}. An example include looks like
19433 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19434 the name of the framework and @file{header.h} is found in the
19435 @file{PrivateHeaders} or @file{Headers} directory.
19436
19437 @item -iframework@var{dir}
19438 @opindex iframework
19439 Like @option{-F} except the directory is a treated as a system
19440 directory. The main difference between this @option{-iframework} and
19441 @option{-F} is that with @option{-iframework} the compiler does not
19442 warn about constructs contained within header files found via
19443 @var{dir}. This option is valid only for the C family of languages.
19444
19445 @item -gused
19446 @opindex gused
19447 Emit debugging information for symbols that are used. For stabs
19448 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19449 This is by default ON@.
19450
19451 @item -gfull
19452 @opindex gfull
19453 Emit debugging information for all symbols and types.
19454
19455 @item -mmacosx-version-min=@var{version}
19456 The earliest version of MacOS X that this executable will run on
19457 is @var{version}. Typical values of @var{version} include @code{10.1},
19458 @code{10.2}, and @code{10.3.9}.
19459
19460 If the compiler was built to use the system's headers by default,
19461 then the default for this option is the system version on which the
19462 compiler is running, otherwise the default is to make choices that
19463 are compatible with as many systems and code bases as possible.
19464
19465 @item -mkernel
19466 @opindex mkernel
19467 Enable kernel development mode. The @option{-mkernel} option sets
19468 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19469 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19470 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19471 applicable. This mode also sets @option{-mno-altivec},
19472 @option{-msoft-float}, @option{-fno-builtin} and
19473 @option{-mlong-branch} for PowerPC targets.
19474
19475 @item -mone-byte-bool
19476 @opindex mone-byte-bool
19477 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19478 By default @code{sizeof(bool)} is @code{4} when compiling for
19479 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19480 option has no effect on x86.
19481
19482 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19483 to generate code that is not binary compatible with code generated
19484 without that switch. Using this switch may require recompiling all
19485 other modules in a program, including system libraries. Use this
19486 switch to conform to a non-default data model.
19487
19488 @item -mfix-and-continue
19489 @itemx -ffix-and-continue
19490 @itemx -findirect-data
19491 @opindex mfix-and-continue
19492 @opindex ffix-and-continue
19493 @opindex findirect-data
19494 Generate code suitable for fast turnaround development, such as to
19495 allow GDB to dynamically load @file{.o} files into already-running
19496 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19497 are provided for backwards compatibility.
19498
19499 @item -all_load
19500 @opindex all_load
19501 Loads all members of static archive libraries.
19502 See man ld(1) for more information.
19503
19504 @item -arch_errors_fatal
19505 @opindex arch_errors_fatal
19506 Cause the errors having to do with files that have the wrong architecture
19507 to be fatal.
19508
19509 @item -bind_at_load
19510 @opindex bind_at_load
19511 Causes the output file to be marked such that the dynamic linker will
19512 bind all undefined references when the file is loaded or launched.
19513
19514 @item -bundle
19515 @opindex bundle
19516 Produce a Mach-o bundle format file.
19517 See man ld(1) for more information.
19518
19519 @item -bundle_loader @var{executable}
19520 @opindex bundle_loader
19521 This option specifies the @var{executable} that will load the build
19522 output file being linked. See man ld(1) for more information.
19523
19524 @item -dynamiclib
19525 @opindex dynamiclib
19526 When passed this option, GCC produces a dynamic library instead of
19527 an executable when linking, using the Darwin @file{libtool} command.
19528
19529 @item -force_cpusubtype_ALL
19530 @opindex force_cpusubtype_ALL
19531 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19532 one controlled by the @option{-mcpu} or @option{-march} option.
19533
19534 @item -allowable_client @var{client_name}
19535 @itemx -client_name
19536 @itemx -compatibility_version
19537 @itemx -current_version
19538 @itemx -dead_strip
19539 @itemx -dependency-file
19540 @itemx -dylib_file
19541 @itemx -dylinker_install_name
19542 @itemx -dynamic
19543 @itemx -exported_symbols_list
19544 @itemx -filelist
19545 @need 800
19546 @itemx -flat_namespace
19547 @itemx -force_flat_namespace
19548 @itemx -headerpad_max_install_names
19549 @itemx -image_base
19550 @itemx -init
19551 @itemx -install_name
19552 @itemx -keep_private_externs
19553 @itemx -multi_module
19554 @itemx -multiply_defined
19555 @itemx -multiply_defined_unused
19556 @need 800
19557 @itemx -noall_load
19558 @itemx -no_dead_strip_inits_and_terms
19559 @itemx -nofixprebinding
19560 @itemx -nomultidefs
19561 @itemx -noprebind
19562 @itemx -noseglinkedit
19563 @itemx -pagezero_size
19564 @itemx -prebind
19565 @itemx -prebind_all_twolevel_modules
19566 @itemx -private_bundle
19567 @need 800
19568 @itemx -read_only_relocs
19569 @itemx -sectalign
19570 @itemx -sectobjectsymbols
19571 @itemx -whyload
19572 @itemx -seg1addr
19573 @itemx -sectcreate
19574 @itemx -sectobjectsymbols
19575 @itemx -sectorder
19576 @itemx -segaddr
19577 @itemx -segs_read_only_addr
19578 @need 800
19579 @itemx -segs_read_write_addr
19580 @itemx -seg_addr_table
19581 @itemx -seg_addr_table_filename
19582 @itemx -seglinkedit
19583 @itemx -segprot
19584 @itemx -segs_read_only_addr
19585 @itemx -segs_read_write_addr
19586 @itemx -single_module
19587 @itemx -static
19588 @itemx -sub_library
19589 @need 800
19590 @itemx -sub_umbrella
19591 @itemx -twolevel_namespace
19592 @itemx -umbrella
19593 @itemx -undefined
19594 @itemx -unexported_symbols_list
19595 @itemx -weak_reference_mismatches
19596 @itemx -whatsloaded
19597 @opindex allowable_client
19598 @opindex client_name
19599 @opindex compatibility_version
19600 @opindex current_version
19601 @opindex dead_strip
19602 @opindex dependency-file
19603 @opindex dylib_file
19604 @opindex dylinker_install_name
19605 @opindex dynamic
19606 @opindex exported_symbols_list
19607 @opindex filelist
19608 @opindex flat_namespace
19609 @opindex force_flat_namespace
19610 @opindex headerpad_max_install_names
19611 @opindex image_base
19612 @opindex init
19613 @opindex install_name
19614 @opindex keep_private_externs
19615 @opindex multi_module
19616 @opindex multiply_defined
19617 @opindex multiply_defined_unused
19618 @opindex noall_load
19619 @opindex no_dead_strip_inits_and_terms
19620 @opindex nofixprebinding
19621 @opindex nomultidefs
19622 @opindex noprebind
19623 @opindex noseglinkedit
19624 @opindex pagezero_size
19625 @opindex prebind
19626 @opindex prebind_all_twolevel_modules
19627 @opindex private_bundle
19628 @opindex read_only_relocs
19629 @opindex sectalign
19630 @opindex sectobjectsymbols
19631 @opindex whyload
19632 @opindex seg1addr
19633 @opindex sectcreate
19634 @opindex sectobjectsymbols
19635 @opindex sectorder
19636 @opindex segaddr
19637 @opindex segs_read_only_addr
19638 @opindex segs_read_write_addr
19639 @opindex seg_addr_table
19640 @opindex seg_addr_table_filename
19641 @opindex seglinkedit
19642 @opindex segprot
19643 @opindex segs_read_only_addr
19644 @opindex segs_read_write_addr
19645 @opindex single_module
19646 @opindex static
19647 @opindex sub_library
19648 @opindex sub_umbrella
19649 @opindex twolevel_namespace
19650 @opindex umbrella
19651 @opindex undefined
19652 @opindex unexported_symbols_list
19653 @opindex weak_reference_mismatches
19654 @opindex whatsloaded
19655 These options are passed to the Darwin linker. The Darwin linker man page
19656 describes them in detail.
19657 @end table
19658
19659 @node DEC Alpha Options
19660 @subsection DEC Alpha Options
19661
19662 These @samp{-m} options are defined for the DEC Alpha implementations:
19663
19664 @table @gcctabopt
19665 @item -mno-soft-float
19666 @itemx -msoft-float
19667 @opindex mno-soft-float
19668 @opindex msoft-float
19669 Use (do not use) the hardware floating-point instructions for
19670 floating-point operations. When @option{-msoft-float} is specified,
19671 functions in @file{libgcc.a} are used to perform floating-point
19672 operations. Unless they are replaced by routines that emulate the
19673 floating-point operations, or compiled in such a way as to call such
19674 emulations routines, these routines issue floating-point
19675 operations. If you are compiling for an Alpha without floating-point
19676 operations, you must ensure that the library is built so as not to call
19677 them.
19678
19679 Note that Alpha implementations without floating-point operations are
19680 required to have floating-point registers.
19681
19682 @item -mfp-reg
19683 @itemx -mno-fp-regs
19684 @opindex mfp-reg
19685 @opindex mno-fp-regs
19686 Generate code that uses (does not use) the floating-point register set.
19687 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19688 register set is not used, floating-point operands are passed in integer
19689 registers as if they were integers and floating-point results are passed
19690 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19691 so any function with a floating-point argument or return value called by code
19692 compiled with @option{-mno-fp-regs} must also be compiled with that
19693 option.
19694
19695 A typical use of this option is building a kernel that does not use,
19696 and hence need not save and restore, any floating-point registers.
19697
19698 @item -mieee
19699 @opindex mieee
19700 The Alpha architecture implements floating-point hardware optimized for
19701 maximum performance. It is mostly compliant with the IEEE floating-point
19702 standard. However, for full compliance, software assistance is
19703 required. This option generates code fully IEEE-compliant code
19704 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19705 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19706 defined during compilation. The resulting code is less efficient but is
19707 able to correctly support denormalized numbers and exceptional IEEE
19708 values such as not-a-number and plus/minus infinity. Other Alpha
19709 compilers call this option @option{-ieee_with_no_inexact}.
19710
19711 @item -mieee-with-inexact
19712 @opindex mieee-with-inexact
19713 This is like @option{-mieee} except the generated code also maintains
19714 the IEEE @var{inexact-flag}. Turning on this option causes the
19715 generated code to implement fully-compliant IEEE math. In addition to
19716 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19717 macro. On some Alpha implementations the resulting code may execute
19718 significantly slower than the code generated by default. Since there is
19719 very little code that depends on the @var{inexact-flag}, you should
19720 normally not specify this option. Other Alpha compilers call this
19721 option @option{-ieee_with_inexact}.
19722
19723 @item -mfp-trap-mode=@var{trap-mode}
19724 @opindex mfp-trap-mode
19725 This option controls what floating-point related traps are enabled.
19726 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19727 The trap mode can be set to one of four values:
19728
19729 @table @samp
19730 @item n
19731 This is the default (normal) setting. The only traps that are enabled
19732 are the ones that cannot be disabled in software (e.g., division by zero
19733 trap).
19734
19735 @item u
19736 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19737 as well.
19738
19739 @item su
19740 Like @samp{u}, but the instructions are marked to be safe for software
19741 completion (see Alpha architecture manual for details).
19742
19743 @item sui
19744 Like @samp{su}, but inexact traps are enabled as well.
19745 @end table
19746
19747 @item -mfp-rounding-mode=@var{rounding-mode}
19748 @opindex mfp-rounding-mode
19749 Selects the IEEE rounding mode. Other Alpha compilers call this option
19750 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19751 of:
19752
19753 @table @samp
19754 @item n
19755 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19756 the nearest machine number or towards the even machine number in case
19757 of a tie.
19758
19759 @item m
19760 Round towards minus infinity.
19761
19762 @item c
19763 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19764
19765 @item d
19766 Dynamic rounding mode. A field in the floating-point control register
19767 (@var{fpcr}, see Alpha architecture reference manual) controls the
19768 rounding mode in effect. The C library initializes this register for
19769 rounding towards plus infinity. Thus, unless your program modifies the
19770 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19771 @end table
19772
19773 @item -mtrap-precision=@var{trap-precision}
19774 @opindex mtrap-precision
19775 In the Alpha architecture, floating-point traps are imprecise. This
19776 means without software assistance it is impossible to recover from a
19777 floating trap and program execution normally needs to be terminated.
19778 GCC can generate code that can assist operating system trap handlers
19779 in determining the exact location that caused a floating-point trap.
19780 Depending on the requirements of an application, different levels of
19781 precisions can be selected:
19782
19783 @table @samp
19784 @item p
19785 Program precision. This option is the default and means a trap handler
19786 can only identify which program caused a floating-point exception.
19787
19788 @item f
19789 Function precision. The trap handler can determine the function that
19790 caused a floating-point exception.
19791
19792 @item i
19793 Instruction precision. The trap handler can determine the exact
19794 instruction that caused a floating-point exception.
19795 @end table
19796
19797 Other Alpha compilers provide the equivalent options called
19798 @option{-scope_safe} and @option{-resumption_safe}.
19799
19800 @item -mieee-conformant
19801 @opindex mieee-conformant
19802 This option marks the generated code as IEEE conformant. You must not
19803 use this option unless you also specify @option{-mtrap-precision=i} and either
19804 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19805 is to emit the line @samp{.eflag 48} in the function prologue of the
19806 generated assembly file.
19807
19808 @item -mbuild-constants
19809 @opindex mbuild-constants
19810 Normally GCC examines a 32- or 64-bit integer constant to
19811 see if it can construct it from smaller constants in two or three
19812 instructions. If it cannot, it outputs the constant as a literal and
19813 generates code to load it from the data segment at run time.
19814
19815 Use this option to require GCC to construct @emph{all} integer constants
19816 using code, even if it takes more instructions (the maximum is six).
19817
19818 You typically use this option to build a shared library dynamic
19819 loader. Itself a shared library, it must relocate itself in memory
19820 before it can find the variables and constants in its own data segment.
19821
19822 @item -mbwx
19823 @itemx -mno-bwx
19824 @itemx -mcix
19825 @itemx -mno-cix
19826 @itemx -mfix
19827 @itemx -mno-fix
19828 @itemx -mmax
19829 @itemx -mno-max
19830 @opindex mbwx
19831 @opindex mno-bwx
19832 @opindex mcix
19833 @opindex mno-cix
19834 @opindex mfix
19835 @opindex mno-fix
19836 @opindex mmax
19837 @opindex mno-max
19838 Indicate whether GCC should generate code to use the optional BWX,
19839 CIX, FIX and MAX instruction sets. The default is to use the instruction
19840 sets supported by the CPU type specified via @option{-mcpu=} option or that
19841 of the CPU on which GCC was built if none is specified.
19842
19843 @item -mfloat-vax
19844 @itemx -mfloat-ieee
19845 @opindex mfloat-vax
19846 @opindex mfloat-ieee
19847 Generate code that uses (does not use) VAX F and G floating-point
19848 arithmetic instead of IEEE single and double precision.
19849
19850 @item -mexplicit-relocs
19851 @itemx -mno-explicit-relocs
19852 @opindex mexplicit-relocs
19853 @opindex mno-explicit-relocs
19854 Older Alpha assemblers provided no way to generate symbol relocations
19855 except via assembler macros. Use of these macros does not allow
19856 optimal instruction scheduling. GNU binutils as of version 2.12
19857 supports a new syntax that allows the compiler to explicitly mark
19858 which relocations should apply to which instructions. This option
19859 is mostly useful for debugging, as GCC detects the capabilities of
19860 the assembler when it is built and sets the default accordingly.
19861
19862 @item -msmall-data
19863 @itemx -mlarge-data
19864 @opindex msmall-data
19865 @opindex mlarge-data
19866 When @option{-mexplicit-relocs} is in effect, static data is
19867 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19868 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19869 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19870 16-bit relocations off of the @code{$gp} register. This limits the
19871 size of the small data area to 64KB, but allows the variables to be
19872 directly accessed via a single instruction.
19873
19874 The default is @option{-mlarge-data}. With this option the data area
19875 is limited to just below 2GB@. Programs that require more than 2GB of
19876 data must use @code{malloc} or @code{mmap} to allocate the data in the
19877 heap instead of in the program's data segment.
19878
19879 When generating code for shared libraries, @option{-fpic} implies
19880 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19881
19882 @item -msmall-text
19883 @itemx -mlarge-text
19884 @opindex msmall-text
19885 @opindex mlarge-text
19886 When @option{-msmall-text} is used, the compiler assumes that the
19887 code of the entire program (or shared library) fits in 4MB, and is
19888 thus reachable with a branch instruction. When @option{-msmall-data}
19889 is used, the compiler can assume that all local symbols share the
19890 same @code{$gp} value, and thus reduce the number of instructions
19891 required for a function call from 4 to 1.
19892
19893 The default is @option{-mlarge-text}.
19894
19895 @item -mcpu=@var{cpu_type}
19896 @opindex mcpu
19897 Set the instruction set and instruction scheduling parameters for
19898 machine type @var{cpu_type}. You can specify either the @samp{EV}
19899 style name or the corresponding chip number. GCC supports scheduling
19900 parameters for the EV4, EV5 and EV6 family of processors and
19901 chooses the default values for the instruction set from the processor
19902 you specify. If you do not specify a processor type, GCC defaults
19903 to the processor on which the compiler was built.
19904
19905 Supported values for @var{cpu_type} are
19906
19907 @table @samp
19908 @item ev4
19909 @itemx ev45
19910 @itemx 21064
19911 Schedules as an EV4 and has no instruction set extensions.
19912
19913 @item ev5
19914 @itemx 21164
19915 Schedules as an EV5 and has no instruction set extensions.
19916
19917 @item ev56
19918 @itemx 21164a
19919 Schedules as an EV5 and supports the BWX extension.
19920
19921 @item pca56
19922 @itemx 21164pc
19923 @itemx 21164PC
19924 Schedules as an EV5 and supports the BWX and MAX extensions.
19925
19926 @item ev6
19927 @itemx 21264
19928 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19929
19930 @item ev67
19931 @itemx 21264a
19932 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19933 @end table
19934
19935 Native toolchains also support the value @samp{native},
19936 which selects the best architecture option for the host processor.
19937 @option{-mcpu=native} has no effect if GCC does not recognize
19938 the processor.
19939
19940 @item -mtune=@var{cpu_type}
19941 @opindex mtune
19942 Set only the instruction scheduling parameters for machine type
19943 @var{cpu_type}. The instruction set is not changed.
19944
19945 Native toolchains also support the value @samp{native},
19946 which selects the best architecture option for the host processor.
19947 @option{-mtune=native} has no effect if GCC does not recognize
19948 the processor.
19949
19950 @item -mmemory-latency=@var{time}
19951 @opindex mmemory-latency
19952 Sets the latency the scheduler should assume for typical memory
19953 references as seen by the application. This number is highly
19954 dependent on the memory access patterns used by the application
19955 and the size of the external cache on the machine.
19956
19957 Valid options for @var{time} are
19958
19959 @table @samp
19960 @item @var{number}
19961 A decimal number representing clock cycles.
19962
19963 @item L1
19964 @itemx L2
19965 @itemx L3
19966 @itemx main
19967 The compiler contains estimates of the number of clock cycles for
19968 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19969 (also called Dcache, Scache, and Bcache), as well as to main memory.
19970 Note that L3 is only valid for EV5.
19971
19972 @end table
19973 @end table
19974
19975 @node eBPF Options
19976 @subsection eBPF Options
19977 @cindex eBPF Options
19978
19979 @table @gcctabopt
19980 @item -mframe-limit=@var{bytes}
19981 This specifies the hard limit for frame sizes, in bytes. Currently,
19982 the value that can be specified should be less than or equal to
19983 @samp{32767}. Defaults to whatever limit is imposed by the version of
19984 the Linux kernel targeted.
19985
19986 @item -mkernel=@var{version}
19987 @opindex mkernel
19988 This specifies the minimum version of the kernel that will run the
19989 compiled program. GCC uses this version to determine which
19990 instructions to use, what kernel helpers to allow, etc. Currently,
19991 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19992 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19993 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19994 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19995 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19996 @samp{5.2}, @samp{latest} and @samp{native}.
19997
19998 @item -mbig-endian
19999 @opindex mbig-endian
20000 Generate code for a big-endian target.
20001
20002 @item -mlittle-endian
20003 @opindex mlittle-endian
20004 Generate code for a little-endian target. This is the default.
20005 @end table
20006
20007 @node FR30 Options
20008 @subsection FR30 Options
20009 @cindex FR30 Options
20010
20011 These options are defined specifically for the FR30 port.
20012
20013 @table @gcctabopt
20014
20015 @item -msmall-model
20016 @opindex msmall-model
20017 Use the small address space model. This can produce smaller code, but
20018 it does assume that all symbolic values and addresses fit into a
20019 20-bit range.
20020
20021 @item -mno-lsim
20022 @opindex mno-lsim
20023 Assume that runtime support has been provided and so there is no need
20024 to include the simulator library (@file{libsim.a}) on the linker
20025 command line.
20026
20027 @end table
20028
20029 @node FT32 Options
20030 @subsection FT32 Options
20031 @cindex FT32 Options
20032
20033 These options are defined specifically for the FT32 port.
20034
20035 @table @gcctabopt
20036
20037 @item -msim
20038 @opindex msim
20039 Specifies that the program will be run on the simulator. This causes
20040 an alternate runtime startup and library to be linked.
20041 You must not use this option when generating programs that will run on
20042 real hardware; you must provide your own runtime library for whatever
20043 I/O functions are needed.
20044
20045 @item -mlra
20046 @opindex mlra
20047 Enable Local Register Allocation. This is still experimental for FT32,
20048 so by default the compiler uses standard reload.
20049
20050 @item -mnodiv
20051 @opindex mnodiv
20052 Do not use div and mod instructions.
20053
20054 @item -mft32b
20055 @opindex mft32b
20056 Enable use of the extended instructions of the FT32B processor.
20057
20058 @item -mcompress
20059 @opindex mcompress
20060 Compress all code using the Ft32B code compression scheme.
20061
20062 @item -mnopm
20063 @opindex mnopm
20064 Do not generate code that reads program memory.
20065
20066 @end table
20067
20068 @node FRV Options
20069 @subsection FRV Options
20070 @cindex FRV Options
20071
20072 @table @gcctabopt
20073 @item -mgpr-32
20074 @opindex mgpr-32
20075
20076 Only use the first 32 general-purpose registers.
20077
20078 @item -mgpr-64
20079 @opindex mgpr-64
20080
20081 Use all 64 general-purpose registers.
20082
20083 @item -mfpr-32
20084 @opindex mfpr-32
20085
20086 Use only the first 32 floating-point registers.
20087
20088 @item -mfpr-64
20089 @opindex mfpr-64
20090
20091 Use all 64 floating-point registers.
20092
20093 @item -mhard-float
20094 @opindex mhard-float
20095
20096 Use hardware instructions for floating-point operations.
20097
20098 @item -msoft-float
20099 @opindex msoft-float
20100
20101 Use library routines for floating-point operations.
20102
20103 @item -malloc-cc
20104 @opindex malloc-cc
20105
20106 Dynamically allocate condition code registers.
20107
20108 @item -mfixed-cc
20109 @opindex mfixed-cc
20110
20111 Do not try to dynamically allocate condition code registers, only
20112 use @code{icc0} and @code{fcc0}.
20113
20114 @item -mdword
20115 @opindex mdword
20116
20117 Change ABI to use double word insns.
20118
20119 @item -mno-dword
20120 @opindex mno-dword
20121 @opindex mdword
20122
20123 Do not use double word instructions.
20124
20125 @item -mdouble
20126 @opindex mdouble
20127
20128 Use floating-point double instructions.
20129
20130 @item -mno-double
20131 @opindex mno-double
20132
20133 Do not use floating-point double instructions.
20134
20135 @item -mmedia
20136 @opindex mmedia
20137
20138 Use media instructions.
20139
20140 @item -mno-media
20141 @opindex mno-media
20142
20143 Do not use media instructions.
20144
20145 @item -mmuladd
20146 @opindex mmuladd
20147
20148 Use multiply and add/subtract instructions.
20149
20150 @item -mno-muladd
20151 @opindex mno-muladd
20152
20153 Do not use multiply and add/subtract instructions.
20154
20155 @item -mfdpic
20156 @opindex mfdpic
20157
20158 Select the FDPIC ABI, which uses function descriptors to represent
20159 pointers to functions. Without any PIC/PIE-related options, it
20160 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
20161 assumes GOT entries and small data are within a 12-bit range from the
20162 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
20163 are computed with 32 bits.
20164 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20165
20166 @item -minline-plt
20167 @opindex minline-plt
20168
20169 Enable inlining of PLT entries in function calls to functions that are
20170 not known to bind locally. It has no effect without @option{-mfdpic}.
20171 It's enabled by default if optimizing for speed and compiling for
20172 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
20173 optimization option such as @option{-O3} or above is present in the
20174 command line.
20175
20176 @item -mTLS
20177 @opindex mTLS
20178
20179 Assume a large TLS segment when generating thread-local code.
20180
20181 @item -mtls
20182 @opindex mtls
20183
20184 Do not assume a large TLS segment when generating thread-local code.
20185
20186 @item -mgprel-ro
20187 @opindex mgprel-ro
20188
20189 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20190 that is known to be in read-only sections. It's enabled by default,
20191 except for @option{-fpic} or @option{-fpie}: even though it may help
20192 make the global offset table smaller, it trades 1 instruction for 4.
20193 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20194 one of which may be shared by multiple symbols, and it avoids the need
20195 for a GOT entry for the referenced symbol, so it's more likely to be a
20196 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
20197
20198 @item -multilib-library-pic
20199 @opindex multilib-library-pic
20200
20201 Link with the (library, not FD) pic libraries. It's implied by
20202 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20203 @option{-fpic} without @option{-mfdpic}. You should never have to use
20204 it explicitly.
20205
20206 @item -mlinked-fp
20207 @opindex mlinked-fp
20208
20209 Follow the EABI requirement of always creating a frame pointer whenever
20210 a stack frame is allocated. This option is enabled by default and can
20211 be disabled with @option{-mno-linked-fp}.
20212
20213 @item -mlong-calls
20214 @opindex mlong-calls
20215
20216 Use indirect addressing to call functions outside the current
20217 compilation unit. This allows the functions to be placed anywhere
20218 within the 32-bit address space.
20219
20220 @item -malign-labels
20221 @opindex malign-labels
20222
20223 Try to align labels to an 8-byte boundary by inserting NOPs into the
20224 previous packet. This option only has an effect when VLIW packing
20225 is enabled. It doesn't create new packets; it merely adds NOPs to
20226 existing ones.
20227
20228 @item -mlibrary-pic
20229 @opindex mlibrary-pic
20230
20231 Generate position-independent EABI code.
20232
20233 @item -macc-4
20234 @opindex macc-4
20235
20236 Use only the first four media accumulator registers.
20237
20238 @item -macc-8
20239 @opindex macc-8
20240
20241 Use all eight media accumulator registers.
20242
20243 @item -mpack
20244 @opindex mpack
20245
20246 Pack VLIW instructions.
20247
20248 @item -mno-pack
20249 @opindex mno-pack
20250
20251 Do not pack VLIW instructions.
20252
20253 @item -mno-eflags
20254 @opindex mno-eflags
20255
20256 Do not mark ABI switches in e_flags.
20257
20258 @item -mcond-move
20259 @opindex mcond-move
20260
20261 Enable the use of conditional-move instructions (default).
20262
20263 This switch is mainly for debugging the compiler and will likely be removed
20264 in a future version.
20265
20266 @item -mno-cond-move
20267 @opindex mno-cond-move
20268
20269 Disable the use of conditional-move instructions.
20270
20271 This switch is mainly for debugging the compiler and will likely be removed
20272 in a future version.
20273
20274 @item -mscc
20275 @opindex mscc
20276
20277 Enable the use of conditional set instructions (default).
20278
20279 This switch is mainly for debugging the compiler and will likely be removed
20280 in a future version.
20281
20282 @item -mno-scc
20283 @opindex mno-scc
20284
20285 Disable the use of conditional set instructions.
20286
20287 This switch is mainly for debugging the compiler and will likely be removed
20288 in a future version.
20289
20290 @item -mcond-exec
20291 @opindex mcond-exec
20292
20293 Enable the use of conditional execution (default).
20294
20295 This switch is mainly for debugging the compiler and will likely be removed
20296 in a future version.
20297
20298 @item -mno-cond-exec
20299 @opindex mno-cond-exec
20300
20301 Disable the use of conditional execution.
20302
20303 This switch is mainly for debugging the compiler and will likely be removed
20304 in a future version.
20305
20306 @item -mvliw-branch
20307 @opindex mvliw-branch
20308
20309 Run a pass to pack branches into VLIW instructions (default).
20310
20311 This switch is mainly for debugging the compiler and will likely be removed
20312 in a future version.
20313
20314 @item -mno-vliw-branch
20315 @opindex mno-vliw-branch
20316
20317 Do not run a pass to pack branches into VLIW instructions.
20318
20319 This switch is mainly for debugging the compiler and will likely be removed
20320 in a future version.
20321
20322 @item -mmulti-cond-exec
20323 @opindex mmulti-cond-exec
20324
20325 Enable optimization of @code{&&} and @code{||} in conditional execution
20326 (default).
20327
20328 This switch is mainly for debugging the compiler and will likely be removed
20329 in a future version.
20330
20331 @item -mno-multi-cond-exec
20332 @opindex mno-multi-cond-exec
20333
20334 Disable optimization of @code{&&} and @code{||} in conditional execution.
20335
20336 This switch is mainly for debugging the compiler and will likely be removed
20337 in a future version.
20338
20339 @item -mnested-cond-exec
20340 @opindex mnested-cond-exec
20341
20342 Enable nested conditional execution optimizations (default).
20343
20344 This switch is mainly for debugging the compiler and will likely be removed
20345 in a future version.
20346
20347 @item -mno-nested-cond-exec
20348 @opindex mno-nested-cond-exec
20349
20350 Disable nested conditional execution optimizations.
20351
20352 This switch is mainly for debugging the compiler and will likely be removed
20353 in a future version.
20354
20355 @item -moptimize-membar
20356 @opindex moptimize-membar
20357
20358 This switch removes redundant @code{membar} instructions from the
20359 compiler-generated code. It is enabled by default.
20360
20361 @item -mno-optimize-membar
20362 @opindex mno-optimize-membar
20363 @opindex moptimize-membar
20364
20365 This switch disables the automatic removal of redundant @code{membar}
20366 instructions from the generated code.
20367
20368 @item -mtomcat-stats
20369 @opindex mtomcat-stats
20370
20371 Cause gas to print out tomcat statistics.
20372
20373 @item -mcpu=@var{cpu}
20374 @opindex mcpu
20375
20376 Select the processor type for which to generate code. Possible values are
20377 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20378 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20379
20380 @end table
20381
20382 @node GNU/Linux Options
20383 @subsection GNU/Linux Options
20384
20385 These @samp{-m} options are defined for GNU/Linux targets:
20386
20387 @table @gcctabopt
20388 @item -mglibc
20389 @opindex mglibc
20390 Use the GNU C library. This is the default except
20391 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20392 @samp{*-*-linux-*android*} targets.
20393
20394 @item -muclibc
20395 @opindex muclibc
20396 Use uClibc C library. This is the default on
20397 @samp{*-*-linux-*uclibc*} targets.
20398
20399 @item -mmusl
20400 @opindex mmusl
20401 Use the musl C library. This is the default on
20402 @samp{*-*-linux-*musl*} targets.
20403
20404 @item -mbionic
20405 @opindex mbionic
20406 Use Bionic C library. This is the default on
20407 @samp{*-*-linux-*android*} targets.
20408
20409 @item -mandroid
20410 @opindex mandroid
20411 Compile code compatible with Android platform. This is the default on
20412 @samp{*-*-linux-*android*} targets.
20413
20414 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20415 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20416 this option makes the GCC driver pass Android-specific options to the linker.
20417 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20418 to be defined.
20419
20420 @item -tno-android-cc
20421 @opindex tno-android-cc
20422 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20423 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20424 @option{-fno-rtti} by default.
20425
20426 @item -tno-android-ld
20427 @opindex tno-android-ld
20428 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20429 linking options to the linker.
20430
20431 @end table
20432
20433 @node H8/300 Options
20434 @subsection H8/300 Options
20435
20436 These @samp{-m} options are defined for the H8/300 implementations:
20437
20438 @table @gcctabopt
20439 @item -mrelax
20440 @opindex mrelax
20441 Shorten some address references at link time, when possible; uses the
20442 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20443 ld, Using ld}, for a fuller description.
20444
20445 @item -mh
20446 @opindex mh
20447 Generate code for the H8/300H@.
20448
20449 @item -ms
20450 @opindex ms
20451 Generate code for the H8S@.
20452
20453 @item -mn
20454 @opindex mn
20455 Generate code for the H8S and H8/300H in the normal mode. This switch
20456 must be used either with @option{-mh} or @option{-ms}.
20457
20458 @item -ms2600
20459 @opindex ms2600
20460 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20461
20462 @item -mexr
20463 @opindex mexr
20464 Extended registers are stored on stack before execution of function
20465 with monitor attribute. Default option is @option{-mexr}.
20466 This option is valid only for H8S targets.
20467
20468 @item -mno-exr
20469 @opindex mno-exr
20470 @opindex mexr
20471 Extended registers are not stored on stack before execution of function
20472 with monitor attribute. Default option is @option{-mno-exr}.
20473 This option is valid only for H8S targets.
20474
20475 @item -mint32
20476 @opindex mint32
20477 Make @code{int} data 32 bits by default.
20478
20479 @item -malign-300
20480 @opindex malign-300
20481 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20482 The default for the H8/300H and H8S is to align longs and floats on
20483 4-byte boundaries.
20484 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20485 This option has no effect on the H8/300.
20486 @end table
20487
20488 @node HPPA Options
20489 @subsection HPPA Options
20490 @cindex HPPA Options
20491
20492 These @samp{-m} options are defined for the HPPA family of computers:
20493
20494 @table @gcctabopt
20495 @item -march=@var{architecture-type}
20496 @opindex march
20497 Generate code for the specified architecture. The choices for
20498 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20499 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20500 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20501 architecture option for your machine. Code compiled for lower numbered
20502 architectures runs on higher numbered architectures, but not the
20503 other way around.
20504
20505 @item -mpa-risc-1-0
20506 @itemx -mpa-risc-1-1
20507 @itemx -mpa-risc-2-0
20508 @opindex mpa-risc-1-0
20509 @opindex mpa-risc-1-1
20510 @opindex mpa-risc-2-0
20511 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20512
20513 @item -mcaller-copies
20514 @opindex mcaller-copies
20515 The caller copies function arguments passed by hidden reference. This
20516 option should be used with care as it is not compatible with the default
20517 32-bit runtime. However, only aggregates larger than eight bytes are
20518 passed by hidden reference and the option provides better compatibility
20519 with OpenMP.
20520
20521 @item -mjump-in-delay
20522 @opindex mjump-in-delay
20523 This option is ignored and provided for compatibility purposes only.
20524
20525 @item -mdisable-fpregs
20526 @opindex mdisable-fpregs
20527 Prevent floating-point registers from being used in any manner. This is
20528 necessary for compiling kernels that perform lazy context switching of
20529 floating-point registers. If you use this option and attempt to perform
20530 floating-point operations, the compiler aborts.
20531
20532 @item -mdisable-indexing
20533 @opindex mdisable-indexing
20534 Prevent the compiler from using indexing address modes. This avoids some
20535 rather obscure problems when compiling MIG generated code under MACH@.
20536
20537 @item -mno-space-regs
20538 @opindex mno-space-regs
20539 @opindex mspace-regs
20540 Generate code that assumes the target has no space registers. This allows
20541 GCC to generate faster indirect calls and use unscaled index address modes.
20542
20543 Such code is suitable for level 0 PA systems and kernels.
20544
20545 @item -mfast-indirect-calls
20546 @opindex mfast-indirect-calls
20547 Generate code that assumes calls never cross space boundaries. This
20548 allows GCC to emit code that performs faster indirect calls.
20549
20550 This option does not work in the presence of shared libraries or nested
20551 functions.
20552
20553 @item -mfixed-range=@var{register-range}
20554 @opindex mfixed-range
20555 Generate code treating the given register range as fixed registers.
20556 A fixed register is one that the register allocator cannot use. This is
20557 useful when compiling kernel code. A register range is specified as
20558 two registers separated by a dash. Multiple register ranges can be
20559 specified separated by a comma.
20560
20561 @item -mlong-load-store
20562 @opindex mlong-load-store
20563 Generate 3-instruction load and store sequences as sometimes required by
20564 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20565 the HP compilers.
20566
20567 @item -mportable-runtime
20568 @opindex mportable-runtime
20569 Use the portable calling conventions proposed by HP for ELF systems.
20570
20571 @item -mgas
20572 @opindex mgas
20573 Enable the use of assembler directives only GAS understands.
20574
20575 @item -mschedule=@var{cpu-type}
20576 @opindex mschedule
20577 Schedule code according to the constraints for the machine type
20578 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20579 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20580 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20581 proper scheduling option for your machine. The default scheduling is
20582 @samp{8000}.
20583
20584 @item -mlinker-opt
20585 @opindex mlinker-opt
20586 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20587 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20588 linkers in which they give bogus error messages when linking some programs.
20589
20590 @item -msoft-float
20591 @opindex msoft-float
20592 Generate output containing library calls for floating point.
20593 @strong{Warning:} the requisite libraries are not available for all HPPA
20594 targets. Normally the facilities of the machine's usual C compiler are
20595 used, but this cannot be done directly in cross-compilation. You must make
20596 your own arrangements to provide suitable library functions for
20597 cross-compilation.
20598
20599 @option{-msoft-float} changes the calling convention in the output file;
20600 therefore, it is only useful if you compile @emph{all} of a program with
20601 this option. In particular, you need to compile @file{libgcc.a}, the
20602 library that comes with GCC, with @option{-msoft-float} in order for
20603 this to work.
20604
20605 @item -msio
20606 @opindex msio
20607 Generate the predefine, @code{_SIO}, for server IO@. The default is
20608 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20609 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20610 options are available under HP-UX and HI-UX@.
20611
20612 @item -mgnu-ld
20613 @opindex mgnu-ld
20614 Use options specific to GNU @command{ld}.
20615 This passes @option{-shared} to @command{ld} when
20616 building a shared library. It is the default when GCC is configured,
20617 explicitly or implicitly, with the GNU linker. This option does not
20618 affect which @command{ld} is called; it only changes what parameters
20619 are passed to that @command{ld}.
20620 The @command{ld} that is called is determined by the
20621 @option{--with-ld} configure option, GCC's program search path, and
20622 finally by the user's @env{PATH}. The linker used by GCC can be printed
20623 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20624 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20625
20626 @item -mhp-ld
20627 @opindex mhp-ld
20628 Use options specific to HP @command{ld}.
20629 This passes @option{-b} to @command{ld} when building
20630 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20631 links. It is the default when GCC is configured, explicitly or
20632 implicitly, with the HP linker. This option does not affect
20633 which @command{ld} is called; it only changes what parameters are passed to that
20634 @command{ld}.
20635 The @command{ld} that is called is determined by the @option{--with-ld}
20636 configure option, GCC's program search path, and finally by the user's
20637 @env{PATH}. The linker used by GCC can be printed using @samp{which
20638 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20639 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20640
20641 @item -mlong-calls
20642 @opindex mno-long-calls
20643 @opindex mlong-calls
20644 Generate code that uses long call sequences. This ensures that a call
20645 is always able to reach linker generated stubs. The default is to generate
20646 long calls only when the distance from the call site to the beginning
20647 of the function or translation unit, as the case may be, exceeds a
20648 predefined limit set by the branch type being used. The limits for
20649 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20650 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20651 240,000 bytes.
20652
20653 Distances are measured from the beginning of functions when using the
20654 @option{-ffunction-sections} option, or when using the @option{-mgas}
20655 and @option{-mno-portable-runtime} options together under HP-UX with
20656 the SOM linker.
20657
20658 It is normally not desirable to use this option as it degrades
20659 performance. However, it may be useful in large applications,
20660 particularly when partial linking is used to build the application.
20661
20662 The types of long calls used depends on the capabilities of the
20663 assembler and linker, and the type of code being generated. The
20664 impact on systems that support long absolute calls, and long pic
20665 symbol-difference or pc-relative calls should be relatively small.
20666 However, an indirect call is used on 32-bit ELF systems in pic code
20667 and it is quite long.
20668
20669 @item -munix=@var{unix-std}
20670 @opindex march
20671 Generate compiler predefines and select a startfile for the specified
20672 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20673 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20674 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20675 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20676 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20677 and later.
20678
20679 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20680 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20681 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20682 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20683 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20684 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20685
20686 It is @emph{important} to note that this option changes the interfaces
20687 for various library routines. It also affects the operational behavior
20688 of the C library. Thus, @emph{extreme} care is needed in using this
20689 option.
20690
20691 Library code that is intended to operate with more than one UNIX
20692 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20693 as appropriate. Most GNU software doesn't provide this capability.
20694
20695 @item -nolibdld
20696 @opindex nolibdld
20697 Suppress the generation of link options to search libdld.sl when the
20698 @option{-static} option is specified on HP-UX 10 and later.
20699
20700 @item -static
20701 @opindex static
20702 The HP-UX implementation of setlocale in libc has a dependency on
20703 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20704 when the @option{-static} option is specified, special link options
20705 are needed to resolve this dependency.
20706
20707 On HP-UX 10 and later, the GCC driver adds the necessary options to
20708 link with libdld.sl when the @option{-static} option is specified.
20709 This causes the resulting binary to be dynamic. On the 64-bit port,
20710 the linkers generate dynamic binaries by default in any case. The
20711 @option{-nolibdld} option can be used to prevent the GCC driver from
20712 adding these link options.
20713
20714 @item -threads
20715 @opindex threads
20716 Add support for multithreading with the @dfn{dce thread} library
20717 under HP-UX@. This option sets flags for both the preprocessor and
20718 linker.
20719 @end table
20720
20721 @node IA-64 Options
20722 @subsection IA-64 Options
20723 @cindex IA-64 Options
20724
20725 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20726
20727 @table @gcctabopt
20728 @item -mbig-endian
20729 @opindex mbig-endian
20730 Generate code for a big-endian target. This is the default for HP-UX@.
20731
20732 @item -mlittle-endian
20733 @opindex mlittle-endian
20734 Generate code for a little-endian target. This is the default for AIX5
20735 and GNU/Linux.
20736
20737 @item -mgnu-as
20738 @itemx -mno-gnu-as
20739 @opindex mgnu-as
20740 @opindex mno-gnu-as
20741 Generate (or don't) code for the GNU assembler. This is the default.
20742 @c Also, this is the default if the configure option @option{--with-gnu-as}
20743 @c is used.
20744
20745 @item -mgnu-ld
20746 @itemx -mno-gnu-ld
20747 @opindex mgnu-ld
20748 @opindex mno-gnu-ld
20749 Generate (or don't) code for the GNU linker. This is the default.
20750 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20751 @c is used.
20752
20753 @item -mno-pic
20754 @opindex mno-pic
20755 Generate code that does not use a global pointer register. The result
20756 is not position independent code, and violates the IA-64 ABI@.
20757
20758 @item -mvolatile-asm-stop
20759 @itemx -mno-volatile-asm-stop
20760 @opindex mvolatile-asm-stop
20761 @opindex mno-volatile-asm-stop
20762 Generate (or don't) a stop bit immediately before and after volatile asm
20763 statements.
20764
20765 @item -mregister-names
20766 @itemx -mno-register-names
20767 @opindex mregister-names
20768 @opindex mno-register-names
20769 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20770 the stacked registers. This may make assembler output more readable.
20771
20772 @item -mno-sdata
20773 @itemx -msdata
20774 @opindex mno-sdata
20775 @opindex msdata
20776 Disable (or enable) optimizations that use the small data section. This may
20777 be useful for working around optimizer bugs.
20778
20779 @item -mconstant-gp
20780 @opindex mconstant-gp
20781 Generate code that uses a single constant global pointer value. This is
20782 useful when compiling kernel code.
20783
20784 @item -mauto-pic
20785 @opindex mauto-pic
20786 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20787 This is useful when compiling firmware code.
20788
20789 @item -minline-float-divide-min-latency
20790 @opindex minline-float-divide-min-latency
20791 Generate code for inline divides of floating-point values
20792 using the minimum latency algorithm.
20793
20794 @item -minline-float-divide-max-throughput
20795 @opindex minline-float-divide-max-throughput
20796 Generate code for inline divides of floating-point values
20797 using the maximum throughput algorithm.
20798
20799 @item -mno-inline-float-divide
20800 @opindex mno-inline-float-divide
20801 Do not generate inline code for divides of floating-point values.
20802
20803 @item -minline-int-divide-min-latency
20804 @opindex minline-int-divide-min-latency
20805 Generate code for inline divides of integer values
20806 using the minimum latency algorithm.
20807
20808 @item -minline-int-divide-max-throughput
20809 @opindex minline-int-divide-max-throughput
20810 Generate code for inline divides of integer values
20811 using the maximum throughput algorithm.
20812
20813 @item -mno-inline-int-divide
20814 @opindex mno-inline-int-divide
20815 @opindex minline-int-divide
20816 Do not generate inline code for divides of integer values.
20817
20818 @item -minline-sqrt-min-latency
20819 @opindex minline-sqrt-min-latency
20820 Generate code for inline square roots
20821 using the minimum latency algorithm.
20822
20823 @item -minline-sqrt-max-throughput
20824 @opindex minline-sqrt-max-throughput
20825 Generate code for inline square roots
20826 using the maximum throughput algorithm.
20827
20828 @item -mno-inline-sqrt
20829 @opindex mno-inline-sqrt
20830 Do not generate inline code for @code{sqrt}.
20831
20832 @item -mfused-madd
20833 @itemx -mno-fused-madd
20834 @opindex mfused-madd
20835 @opindex mno-fused-madd
20836 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20837 instructions. The default is to use these instructions.
20838
20839 @item -mno-dwarf2-asm
20840 @itemx -mdwarf2-asm
20841 @opindex mno-dwarf2-asm
20842 @opindex mdwarf2-asm
20843 Don't (or do) generate assembler code for the DWARF line number debugging
20844 info. This may be useful when not using the GNU assembler.
20845
20846 @item -mearly-stop-bits
20847 @itemx -mno-early-stop-bits
20848 @opindex mearly-stop-bits
20849 @opindex mno-early-stop-bits
20850 Allow stop bits to be placed earlier than immediately preceding the
20851 instruction that triggered the stop bit. This can improve instruction
20852 scheduling, but does not always do so.
20853
20854 @item -mfixed-range=@var{register-range}
20855 @opindex mfixed-range
20856 Generate code treating the given register range as fixed registers.
20857 A fixed register is one that the register allocator cannot use. This is
20858 useful when compiling kernel code. A register range is specified as
20859 two registers separated by a dash. Multiple register ranges can be
20860 specified separated by a comma.
20861
20862 @item -mtls-size=@var{tls-size}
20863 @opindex mtls-size
20864 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20865 64.
20866
20867 @item -mtune=@var{cpu-type}
20868 @opindex mtune
20869 Tune the instruction scheduling for a particular CPU, Valid values are
20870 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20871 and @samp{mckinley}.
20872
20873 @item -milp32
20874 @itemx -mlp64
20875 @opindex milp32
20876 @opindex mlp64
20877 Generate code for a 32-bit or 64-bit environment.
20878 The 32-bit environment sets int, long and pointer to 32 bits.
20879 The 64-bit environment sets int to 32 bits and long and pointer
20880 to 64 bits. These are HP-UX specific flags.
20881
20882 @item -mno-sched-br-data-spec
20883 @itemx -msched-br-data-spec
20884 @opindex mno-sched-br-data-spec
20885 @opindex msched-br-data-spec
20886 (Dis/En)able data speculative scheduling before reload.
20887 This results in generation of @code{ld.a} instructions and
20888 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20889 The default setting is disabled.
20890
20891 @item -msched-ar-data-spec
20892 @itemx -mno-sched-ar-data-spec
20893 @opindex msched-ar-data-spec
20894 @opindex mno-sched-ar-data-spec
20895 (En/Dis)able data speculative scheduling after reload.
20896 This results in generation of @code{ld.a} instructions and
20897 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20898 The default setting is enabled.
20899
20900 @item -mno-sched-control-spec
20901 @itemx -msched-control-spec
20902 @opindex mno-sched-control-spec
20903 @opindex msched-control-spec
20904 (Dis/En)able control speculative scheduling. This feature is
20905 available only during region scheduling (i.e.@: before reload).
20906 This results in generation of the @code{ld.s} instructions and
20907 the corresponding check instructions @code{chk.s}.
20908 The default setting is disabled.
20909
20910 @item -msched-br-in-data-spec
20911 @itemx -mno-sched-br-in-data-spec
20912 @opindex msched-br-in-data-spec
20913 @opindex mno-sched-br-in-data-spec
20914 (En/Dis)able speculative scheduling of the instructions that
20915 are dependent on the data speculative loads before reload.
20916 This is effective only with @option{-msched-br-data-spec} enabled.
20917 The default setting is enabled.
20918
20919 @item -msched-ar-in-data-spec
20920 @itemx -mno-sched-ar-in-data-spec
20921 @opindex msched-ar-in-data-spec
20922 @opindex mno-sched-ar-in-data-spec
20923 (En/Dis)able speculative scheduling of the instructions that
20924 are dependent on the data speculative loads after reload.
20925 This is effective only with @option{-msched-ar-data-spec} enabled.
20926 The default setting is enabled.
20927
20928 @item -msched-in-control-spec
20929 @itemx -mno-sched-in-control-spec
20930 @opindex msched-in-control-spec
20931 @opindex mno-sched-in-control-spec
20932 (En/Dis)able speculative scheduling of the instructions that
20933 are dependent on the control speculative loads.
20934 This is effective only with @option{-msched-control-spec} enabled.
20935 The default setting is enabled.
20936
20937 @item -mno-sched-prefer-non-data-spec-insns
20938 @itemx -msched-prefer-non-data-spec-insns
20939 @opindex mno-sched-prefer-non-data-spec-insns
20940 @opindex msched-prefer-non-data-spec-insns
20941 If enabled, data-speculative instructions are chosen for schedule
20942 only if there are no other choices at the moment. This makes
20943 the use of the data speculation much more conservative.
20944 The default setting is disabled.
20945
20946 @item -mno-sched-prefer-non-control-spec-insns
20947 @itemx -msched-prefer-non-control-spec-insns
20948 @opindex mno-sched-prefer-non-control-spec-insns
20949 @opindex msched-prefer-non-control-spec-insns
20950 If enabled, control-speculative instructions are chosen for schedule
20951 only if there are no other choices at the moment. This makes
20952 the use of the control speculation much more conservative.
20953 The default setting is disabled.
20954
20955 @item -mno-sched-count-spec-in-critical-path
20956 @itemx -msched-count-spec-in-critical-path
20957 @opindex mno-sched-count-spec-in-critical-path
20958 @opindex msched-count-spec-in-critical-path
20959 If enabled, speculative dependencies are considered during
20960 computation of the instructions priorities. This makes the use of the
20961 speculation a bit more conservative.
20962 The default setting is disabled.
20963
20964 @item -msched-spec-ldc
20965 @opindex msched-spec-ldc
20966 Use a simple data speculation check. This option is on by default.
20967
20968 @item -msched-control-spec-ldc
20969 @opindex msched-spec-ldc
20970 Use a simple check for control speculation. This option is on by default.
20971
20972 @item -msched-stop-bits-after-every-cycle
20973 @opindex msched-stop-bits-after-every-cycle
20974 Place a stop bit after every cycle when scheduling. This option is on
20975 by default.
20976
20977 @item -msched-fp-mem-deps-zero-cost
20978 @opindex msched-fp-mem-deps-zero-cost
20979 Assume that floating-point stores and loads are not likely to cause a conflict
20980 when placed into the same instruction group. This option is disabled by
20981 default.
20982
20983 @item -msel-sched-dont-check-control-spec
20984 @opindex msel-sched-dont-check-control-spec
20985 Generate checks for control speculation in selective scheduling.
20986 This flag is disabled by default.
20987
20988 @item -msched-max-memory-insns=@var{max-insns}
20989 @opindex msched-max-memory-insns
20990 Limit on the number of memory insns per instruction group, giving lower
20991 priority to subsequent memory insns attempting to schedule in the same
20992 instruction group. Frequently useful to prevent cache bank conflicts.
20993 The default value is 1.
20994
20995 @item -msched-max-memory-insns-hard-limit
20996 @opindex msched-max-memory-insns-hard-limit
20997 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20998 disallowing more than that number in an instruction group.
20999 Otherwise, the limit is ``soft'', meaning that non-memory operations
21000 are preferred when the limit is reached, but memory operations may still
21001 be scheduled.
21002
21003 @end table
21004
21005 @node LM32 Options
21006 @subsection LM32 Options
21007 @cindex LM32 options
21008
21009 These @option{-m} options are defined for the LatticeMico32 architecture:
21010
21011 @table @gcctabopt
21012 @item -mbarrel-shift-enabled
21013 @opindex mbarrel-shift-enabled
21014 Enable barrel-shift instructions.
21015
21016 @item -mdivide-enabled
21017 @opindex mdivide-enabled
21018 Enable divide and modulus instructions.
21019
21020 @item -mmultiply-enabled
21021 @opindex multiply-enabled
21022 Enable multiply instructions.
21023
21024 @item -msign-extend-enabled
21025 @opindex msign-extend-enabled
21026 Enable sign extend instructions.
21027
21028 @item -muser-enabled
21029 @opindex muser-enabled
21030 Enable user-defined instructions.
21031
21032 @end table
21033
21034 @node M32C Options
21035 @subsection M32C Options
21036 @cindex M32C options
21037
21038 @table @gcctabopt
21039 @item -mcpu=@var{name}
21040 @opindex mcpu=
21041 Select the CPU for which code is generated. @var{name} may be one of
21042 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
21043 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
21044 the M32C/80 series.
21045
21046 @item -msim
21047 @opindex msim
21048 Specifies that the program will be run on the simulator. This causes
21049 an alternate runtime library to be linked in which supports, for
21050 example, file I/O@. You must not use this option when generating
21051 programs that will run on real hardware; you must provide your own
21052 runtime library for whatever I/O functions are needed.
21053
21054 @item -memregs=@var{number}
21055 @opindex memregs=
21056 Specifies the number of memory-based pseudo-registers GCC uses
21057 during code generation. These pseudo-registers are used like real
21058 registers, so there is a tradeoff between GCC's ability to fit the
21059 code into available registers, and the performance penalty of using
21060 memory instead of registers. Note that all modules in a program must
21061 be compiled with the same value for this option. Because of that, you
21062 must not use this option with GCC's default runtime libraries.
21063
21064 @end table
21065
21066 @node M32R/D Options
21067 @subsection M32R/D Options
21068 @cindex M32R/D options
21069
21070 These @option{-m} options are defined for Renesas M32R/D architectures:
21071
21072 @table @gcctabopt
21073 @item -m32r2
21074 @opindex m32r2
21075 Generate code for the M32R/2@.
21076
21077 @item -m32rx
21078 @opindex m32rx
21079 Generate code for the M32R/X@.
21080
21081 @item -m32r
21082 @opindex m32r
21083 Generate code for the M32R@. This is the default.
21084
21085 @item -mmodel=small
21086 @opindex mmodel=small
21087 Assume all objects live in the lower 16MB of memory (so that their addresses
21088 can be loaded with the @code{ld24} instruction), and assume all subroutines
21089 are reachable with the @code{bl} instruction.
21090 This is the default.
21091
21092 The addressability of a particular object can be set with the
21093 @code{model} attribute.
21094
21095 @item -mmodel=medium
21096 @opindex mmodel=medium
21097 Assume objects may be anywhere in the 32-bit address space (the compiler
21098 generates @code{seth/add3} instructions to load their addresses), and
21099 assume all subroutines are reachable with the @code{bl} instruction.
21100
21101 @item -mmodel=large
21102 @opindex mmodel=large
21103 Assume objects may be anywhere in the 32-bit address space (the compiler
21104 generates @code{seth/add3} instructions to load their addresses), and
21105 assume subroutines may not be reachable with the @code{bl} instruction
21106 (the compiler generates the much slower @code{seth/add3/jl}
21107 instruction sequence).
21108
21109 @item -msdata=none
21110 @opindex msdata=none
21111 Disable use of the small data area. Variables are put into
21112 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
21113 @code{section} attribute has been specified).
21114 This is the default.
21115
21116 The small data area consists of sections @code{.sdata} and @code{.sbss}.
21117 Objects may be explicitly put in the small data area with the
21118 @code{section} attribute using one of these sections.
21119
21120 @item -msdata=sdata
21121 @opindex msdata=sdata
21122 Put small global and static data in the small data area, but do not
21123 generate special code to reference them.
21124
21125 @item -msdata=use
21126 @opindex msdata=use
21127 Put small global and static data in the small data area, and generate
21128 special instructions to reference them.
21129
21130 @item -G @var{num}
21131 @opindex G
21132 @cindex smaller data references
21133 Put global and static objects less than or equal to @var{num} bytes
21134 into the small data or BSS sections instead of the normal data or BSS
21135 sections. The default value of @var{num} is 8.
21136 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
21137 for this option to have any effect.
21138
21139 All modules should be compiled with the same @option{-G @var{num}} value.
21140 Compiling with different values of @var{num} may or may not work; if it
21141 doesn't the linker gives an error message---incorrect code is not
21142 generated.
21143
21144 @item -mdebug
21145 @opindex mdebug
21146 Makes the M32R-specific code in the compiler display some statistics
21147 that might help in debugging programs.
21148
21149 @item -malign-loops
21150 @opindex malign-loops
21151 Align all loops to a 32-byte boundary.
21152
21153 @item -mno-align-loops
21154 @opindex mno-align-loops
21155 Do not enforce a 32-byte alignment for loops. This is the default.
21156
21157 @item -missue-rate=@var{number}
21158 @opindex missue-rate=@var{number}
21159 Issue @var{number} instructions per cycle. @var{number} can only be 1
21160 or 2.
21161
21162 @item -mbranch-cost=@var{number}
21163 @opindex mbranch-cost=@var{number}
21164 @var{number} can only be 1 or 2. If it is 1 then branches are
21165 preferred over conditional code, if it is 2, then the opposite applies.
21166
21167 @item -mflush-trap=@var{number}
21168 @opindex mflush-trap=@var{number}
21169 Specifies the trap number to use to flush the cache. The default is
21170 12. Valid numbers are between 0 and 15 inclusive.
21171
21172 @item -mno-flush-trap
21173 @opindex mno-flush-trap
21174 Specifies that the cache cannot be flushed by using a trap.
21175
21176 @item -mflush-func=@var{name}
21177 @opindex mflush-func=@var{name}
21178 Specifies the name of the operating system function to call to flush
21179 the cache. The default is @samp{_flush_cache}, but a function call
21180 is only used if a trap is not available.
21181
21182 @item -mno-flush-func
21183 @opindex mno-flush-func
21184 Indicates that there is no OS function for flushing the cache.
21185
21186 @end table
21187
21188 @node M680x0 Options
21189 @subsection M680x0 Options
21190 @cindex M680x0 options
21191
21192 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21193 The default settings depend on which architecture was selected when
21194 the compiler was configured; the defaults for the most common choices
21195 are given below.
21196
21197 @table @gcctabopt
21198 @item -march=@var{arch}
21199 @opindex march
21200 Generate code for a specific M680x0 or ColdFire instruction set
21201 architecture. Permissible values of @var{arch} for M680x0
21202 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21203 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
21204 architectures are selected according to Freescale's ISA classification
21205 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21206 @samp{isab} and @samp{isac}.
21207
21208 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21209 code for a ColdFire target. The @var{arch} in this macro is one of the
21210 @option{-march} arguments given above.
21211
21212 When used together, @option{-march} and @option{-mtune} select code
21213 that runs on a family of similar processors but that is optimized
21214 for a particular microarchitecture.
21215
21216 @item -mcpu=@var{cpu}
21217 @opindex mcpu
21218 Generate code for a specific M680x0 or ColdFire processor.
21219 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21220 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21221 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21222 below, which also classifies the CPUs into families:
21223
21224 @multitable @columnfractions 0.20 0.80
21225 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21226 @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}
21227 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21228 @item @samp{5206e} @tab @samp{5206e}
21229 @item @samp{5208} @tab @samp{5207} @samp{5208}
21230 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21231 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21232 @item @samp{5216} @tab @samp{5214} @samp{5216}
21233 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21234 @item @samp{5225} @tab @samp{5224} @samp{5225}
21235 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21236 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21237 @item @samp{5249} @tab @samp{5249}
21238 @item @samp{5250} @tab @samp{5250}
21239 @item @samp{5271} @tab @samp{5270} @samp{5271}
21240 @item @samp{5272} @tab @samp{5272}
21241 @item @samp{5275} @tab @samp{5274} @samp{5275}
21242 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21243 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21244 @item @samp{5307} @tab @samp{5307}
21245 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21246 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21247 @item @samp{5407} @tab @samp{5407}
21248 @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}
21249 @end multitable
21250
21251 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21252 @var{arch} is compatible with @var{cpu}. Other combinations of
21253 @option{-mcpu} and @option{-march} are rejected.
21254
21255 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21256 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21257 where the value of @var{family} is given by the table above.
21258
21259 @item -mtune=@var{tune}
21260 @opindex mtune
21261 Tune the code for a particular microarchitecture within the
21262 constraints set by @option{-march} and @option{-mcpu}.
21263 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21264 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21265 and @samp{cpu32}. The ColdFire microarchitectures
21266 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21267
21268 You can also use @option{-mtune=68020-40} for code that needs
21269 to run relatively well on 68020, 68030 and 68040 targets.
21270 @option{-mtune=68020-60} is similar but includes 68060 targets
21271 as well. These two options select the same tuning decisions as
21272 @option{-m68020-40} and @option{-m68020-60} respectively.
21273
21274 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21275 when tuning for 680x0 architecture @var{arch}. It also defines
21276 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21277 option is used. If GCC is tuning for a range of architectures,
21278 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21279 it defines the macros for every architecture in the range.
21280
21281 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21282 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21283 of the arguments given above.
21284
21285 @item -m68000
21286 @itemx -mc68000
21287 @opindex m68000
21288 @opindex mc68000
21289 Generate output for a 68000. This is the default
21290 when the compiler is configured for 68000-based systems.
21291 It is equivalent to @option{-march=68000}.
21292
21293 Use this option for microcontrollers with a 68000 or EC000 core,
21294 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21295
21296 @item -m68010
21297 @opindex m68010
21298 Generate output for a 68010. This is the default
21299 when the compiler is configured for 68010-based systems.
21300 It is equivalent to @option{-march=68010}.
21301
21302 @item -m68020
21303 @itemx -mc68020
21304 @opindex m68020
21305 @opindex mc68020
21306 Generate output for a 68020. This is the default
21307 when the compiler is configured for 68020-based systems.
21308 It is equivalent to @option{-march=68020}.
21309
21310 @item -m68030
21311 @opindex m68030
21312 Generate output for a 68030. This is the default when the compiler is
21313 configured for 68030-based systems. It is equivalent to
21314 @option{-march=68030}.
21315
21316 @item -m68040
21317 @opindex m68040
21318 Generate output for a 68040. This is the default when the compiler is
21319 configured for 68040-based systems. It is equivalent to
21320 @option{-march=68040}.
21321
21322 This option inhibits the use of 68881/68882 instructions that have to be
21323 emulated by software on the 68040. Use this option if your 68040 does not
21324 have code to emulate those instructions.
21325
21326 @item -m68060
21327 @opindex m68060
21328 Generate output for a 68060. This is the default when the compiler is
21329 configured for 68060-based systems. It is equivalent to
21330 @option{-march=68060}.
21331
21332 This option inhibits the use of 68020 and 68881/68882 instructions that
21333 have to be emulated by software on the 68060. Use this option if your 68060
21334 does not have code to emulate those instructions.
21335
21336 @item -mcpu32
21337 @opindex mcpu32
21338 Generate output for a CPU32. This is the default
21339 when the compiler is configured for CPU32-based systems.
21340 It is equivalent to @option{-march=cpu32}.
21341
21342 Use this option for microcontrollers with a
21343 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21344 68336, 68340, 68341, 68349 and 68360.
21345
21346 @item -m5200
21347 @opindex m5200
21348 Generate output for a 520X ColdFire CPU@. This is the default
21349 when the compiler is configured for 520X-based systems.
21350 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21351 in favor of that option.
21352
21353 Use this option for microcontroller with a 5200 core, including
21354 the MCF5202, MCF5203, MCF5204 and MCF5206.
21355
21356 @item -m5206e
21357 @opindex m5206e
21358 Generate output for a 5206e ColdFire CPU@. The option is now
21359 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21360
21361 @item -m528x
21362 @opindex m528x
21363 Generate output for a member of the ColdFire 528X family.
21364 The option is now deprecated in favor of the equivalent
21365 @option{-mcpu=528x}.
21366
21367 @item -m5307
21368 @opindex m5307
21369 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21370 in favor of the equivalent @option{-mcpu=5307}.
21371
21372 @item -m5407
21373 @opindex m5407
21374 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21375 in favor of the equivalent @option{-mcpu=5407}.
21376
21377 @item -mcfv4e
21378 @opindex mcfv4e
21379 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21380 This includes use of hardware floating-point instructions.
21381 The option is equivalent to @option{-mcpu=547x}, and is now
21382 deprecated in favor of that option.
21383
21384 @item -m68020-40
21385 @opindex m68020-40
21386 Generate output for a 68040, without using any of the new instructions.
21387 This results in code that can run relatively efficiently on either a
21388 68020/68881 or a 68030 or a 68040. The generated code does use the
21389 68881 instructions that are emulated on the 68040.
21390
21391 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21392
21393 @item -m68020-60
21394 @opindex m68020-60
21395 Generate output for a 68060, without using any of the new instructions.
21396 This results in code that can run relatively efficiently on either a
21397 68020/68881 or a 68030 or a 68040. The generated code does use the
21398 68881 instructions that are emulated on the 68060.
21399
21400 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21401
21402 @item -mhard-float
21403 @itemx -m68881
21404 @opindex mhard-float
21405 @opindex m68881
21406 Generate floating-point instructions. This is the default for 68020
21407 and above, and for ColdFire devices that have an FPU@. It defines the
21408 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21409 on ColdFire targets.
21410
21411 @item -msoft-float
21412 @opindex msoft-float
21413 Do not generate floating-point instructions; use library calls instead.
21414 This is the default for 68000, 68010, and 68832 targets. It is also
21415 the default for ColdFire devices that have no FPU.
21416
21417 @item -mdiv
21418 @itemx -mno-div
21419 @opindex mdiv
21420 @opindex mno-div
21421 Generate (do not generate) ColdFire hardware divide and remainder
21422 instructions. If @option{-march} is used without @option{-mcpu},
21423 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21424 architectures. Otherwise, the default is taken from the target CPU
21425 (either the default CPU, or the one specified by @option{-mcpu}). For
21426 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21427 @option{-mcpu=5206e}.
21428
21429 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21430
21431 @item -mshort
21432 @opindex mshort
21433 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21434 Additionally, parameters passed on the stack are also aligned to a
21435 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21436
21437 @item -mno-short
21438 @opindex mno-short
21439 Do not consider type @code{int} to be 16 bits wide. This is the default.
21440
21441 @item -mnobitfield
21442 @itemx -mno-bitfield
21443 @opindex mnobitfield
21444 @opindex mno-bitfield
21445 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21446 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21447
21448 @item -mbitfield
21449 @opindex mbitfield
21450 Do use the bit-field instructions. The @option{-m68020} option implies
21451 @option{-mbitfield}. This is the default if you use a configuration
21452 designed for a 68020.
21453
21454 @item -mrtd
21455 @opindex mrtd
21456 Use a different function-calling convention, in which functions
21457 that take a fixed number of arguments return with the @code{rtd}
21458 instruction, which pops their arguments while returning. This
21459 saves one instruction in the caller since there is no need to pop
21460 the arguments there.
21461
21462 This calling convention is incompatible with the one normally
21463 used on Unix, so you cannot use it if you need to call libraries
21464 compiled with the Unix compiler.
21465
21466 Also, you must provide function prototypes for all functions that
21467 take variable numbers of arguments (including @code{printf});
21468 otherwise incorrect code is generated for calls to those
21469 functions.
21470
21471 In addition, seriously incorrect code results if you call a
21472 function with too many arguments. (Normally, extra arguments are
21473 harmlessly ignored.)
21474
21475 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21476 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21477
21478 The default is @option{-mno-rtd}.
21479
21480 @item -malign-int
21481 @itemx -mno-align-int
21482 @opindex malign-int
21483 @opindex mno-align-int
21484 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21485 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21486 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21487 Aligning variables on 32-bit boundaries produces code that runs somewhat
21488 faster on processors with 32-bit busses at the expense of more memory.
21489
21490 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21491 aligns structures containing the above types differently than
21492 most published application binary interface specifications for the m68k.
21493
21494 @item -mpcrel
21495 @opindex mpcrel
21496 Use the pc-relative addressing mode of the 68000 directly, instead of
21497 using a global offset table. At present, this option implies @option{-fpic},
21498 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21499 not presently supported with @option{-mpcrel}, though this could be supported for
21500 68020 and higher processors.
21501
21502 @item -mno-strict-align
21503 @itemx -mstrict-align
21504 @opindex mno-strict-align
21505 @opindex mstrict-align
21506 Do not (do) assume that unaligned memory references are handled by
21507 the system.
21508
21509 @item -msep-data
21510 Generate code that allows the data segment to be located in a different
21511 area of memory from the text segment. This allows for execute-in-place in
21512 an environment without virtual memory management. This option implies
21513 @option{-fPIC}.
21514
21515 @item -mno-sep-data
21516 Generate code that assumes that the data segment follows the text segment.
21517 This is the default.
21518
21519 @item -mid-shared-library
21520 Generate code that supports shared libraries via the library ID method.
21521 This allows for execute-in-place and shared libraries in an environment
21522 without virtual memory management. This option implies @option{-fPIC}.
21523
21524 @item -mno-id-shared-library
21525 Generate code that doesn't assume ID-based shared libraries are being used.
21526 This is the default.
21527
21528 @item -mshared-library-id=n
21529 Specifies the identification number of the ID-based shared library being
21530 compiled. Specifying a value of 0 generates more compact code; specifying
21531 other values forces the allocation of that number to the current
21532 library, but is no more space- or time-efficient than omitting this option.
21533
21534 @item -mxgot
21535 @itemx -mno-xgot
21536 @opindex mxgot
21537 @opindex mno-xgot
21538 When generating position-independent code for ColdFire, generate code
21539 that works if the GOT has more than 8192 entries. This code is
21540 larger and slower than code generated without this option. On M680x0
21541 processors, this option is not needed; @option{-fPIC} suffices.
21542
21543 GCC normally uses a single instruction to load values from the GOT@.
21544 While this is relatively efficient, it only works if the GOT
21545 is smaller than about 64k. Anything larger causes the linker
21546 to report an error such as:
21547
21548 @cindex relocation truncated to fit (ColdFire)
21549 @smallexample
21550 relocation truncated to fit: R_68K_GOT16O foobar
21551 @end smallexample
21552
21553 If this happens, you should recompile your code with @option{-mxgot}.
21554 It should then work with very large GOTs. However, code generated with
21555 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21556 the value of a global symbol.
21557
21558 Note that some linkers, including newer versions of the GNU linker,
21559 can create multiple GOTs and sort GOT entries. If you have such a linker,
21560 you should only need to use @option{-mxgot} when compiling a single
21561 object file that accesses more than 8192 GOT entries. Very few do.
21562
21563 These options have no effect unless GCC is generating
21564 position-independent code.
21565
21566 @item -mlong-jump-table-offsets
21567 @opindex mlong-jump-table-offsets
21568 Use 32-bit offsets in @code{switch} tables. The default is to use
21569 16-bit offsets.
21570
21571 @end table
21572
21573 @node MCore Options
21574 @subsection MCore Options
21575 @cindex MCore options
21576
21577 These are the @samp{-m} options defined for the Motorola M*Core
21578 processors.
21579
21580 @table @gcctabopt
21581
21582 @item -mhardlit
21583 @itemx -mno-hardlit
21584 @opindex mhardlit
21585 @opindex mno-hardlit
21586 Inline constants into the code stream if it can be done in two
21587 instructions or less.
21588
21589 @item -mdiv
21590 @itemx -mno-div
21591 @opindex mdiv
21592 @opindex mno-div
21593 Use the divide instruction. (Enabled by default).
21594
21595 @item -mrelax-immediate
21596 @itemx -mno-relax-immediate
21597 @opindex mrelax-immediate
21598 @opindex mno-relax-immediate
21599 Allow arbitrary-sized immediates in bit operations.
21600
21601 @item -mwide-bitfields
21602 @itemx -mno-wide-bitfields
21603 @opindex mwide-bitfields
21604 @opindex mno-wide-bitfields
21605 Always treat bit-fields as @code{int}-sized.
21606
21607 @item -m4byte-functions
21608 @itemx -mno-4byte-functions
21609 @opindex m4byte-functions
21610 @opindex mno-4byte-functions
21611 Force all functions to be aligned to a 4-byte boundary.
21612
21613 @item -mcallgraph-data
21614 @itemx -mno-callgraph-data
21615 @opindex mcallgraph-data
21616 @opindex mno-callgraph-data
21617 Emit callgraph information.
21618
21619 @item -mslow-bytes
21620 @itemx -mno-slow-bytes
21621 @opindex mslow-bytes
21622 @opindex mno-slow-bytes
21623 Prefer word access when reading byte quantities.
21624
21625 @item -mlittle-endian
21626 @itemx -mbig-endian
21627 @opindex mlittle-endian
21628 @opindex mbig-endian
21629 Generate code for a little-endian target.
21630
21631 @item -m210
21632 @itemx -m340
21633 @opindex m210
21634 @opindex m340
21635 Generate code for the 210 processor.
21636
21637 @item -mno-lsim
21638 @opindex mno-lsim
21639 Assume that runtime support has been provided and so omit the
21640 simulator library (@file{libsim.a)} from the linker command line.
21641
21642 @item -mstack-increment=@var{size}
21643 @opindex mstack-increment
21644 Set the maximum amount for a single stack increment operation. Large
21645 values can increase the speed of programs that contain functions
21646 that need a large amount of stack space, but they can also trigger a
21647 segmentation fault if the stack is extended too much. The default
21648 value is 0x1000.
21649
21650 @end table
21651
21652 @node MeP Options
21653 @subsection MeP Options
21654 @cindex MeP options
21655
21656 @table @gcctabopt
21657
21658 @item -mabsdiff
21659 @opindex mabsdiff
21660 Enables the @code{abs} instruction, which is the absolute difference
21661 between two registers.
21662
21663 @item -mall-opts
21664 @opindex mall-opts
21665 Enables all the optional instructions---average, multiply, divide, bit
21666 operations, leading zero, absolute difference, min/max, clip, and
21667 saturation.
21668
21669
21670 @item -maverage
21671 @opindex maverage
21672 Enables the @code{ave} instruction, which computes the average of two
21673 registers.
21674
21675 @item -mbased=@var{n}
21676 @opindex mbased=
21677 Variables of size @var{n} bytes or smaller are placed in the
21678 @code{.based} section by default. Based variables use the @code{$tp}
21679 register as a base register, and there is a 128-byte limit to the
21680 @code{.based} section.
21681
21682 @item -mbitops
21683 @opindex mbitops
21684 Enables the bit operation instructions---bit test (@code{btstm}), set
21685 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21686 test-and-set (@code{tas}).
21687
21688 @item -mc=@var{name}
21689 @opindex mc=
21690 Selects which section constant data is placed in. @var{name} may
21691 be @samp{tiny}, @samp{near}, or @samp{far}.
21692
21693 @item -mclip
21694 @opindex mclip
21695 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21696 useful unless you also provide @option{-mminmax}.
21697
21698 @item -mconfig=@var{name}
21699 @opindex mconfig=
21700 Selects one of the built-in core configurations. Each MeP chip has
21701 one or more modules in it; each module has a core CPU and a variety of
21702 coprocessors, optional instructions, and peripherals. The
21703 @code{MeP-Integrator} tool, not part of GCC, provides these
21704 configurations through this option; using this option is the same as
21705 using all the corresponding command-line options. The default
21706 configuration is @samp{default}.
21707
21708 @item -mcop
21709 @opindex mcop
21710 Enables the coprocessor instructions. By default, this is a 32-bit
21711 coprocessor. Note that the coprocessor is normally enabled via the
21712 @option{-mconfig=} option.
21713
21714 @item -mcop32
21715 @opindex mcop32
21716 Enables the 32-bit coprocessor's instructions.
21717
21718 @item -mcop64
21719 @opindex mcop64
21720 Enables the 64-bit coprocessor's instructions.
21721
21722 @item -mivc2
21723 @opindex mivc2
21724 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21725
21726 @item -mdc
21727 @opindex mdc
21728 Causes constant variables to be placed in the @code{.near} section.
21729
21730 @item -mdiv
21731 @opindex mdiv
21732 Enables the @code{div} and @code{divu} instructions.
21733
21734 @item -meb
21735 @opindex meb
21736 Generate big-endian code.
21737
21738 @item -mel
21739 @opindex mel
21740 Generate little-endian code.
21741
21742 @item -mio-volatile
21743 @opindex mio-volatile
21744 Tells the compiler that any variable marked with the @code{io}
21745 attribute is to be considered volatile.
21746
21747 @item -ml
21748 @opindex ml
21749 Causes variables to be assigned to the @code{.far} section by default.
21750
21751 @item -mleadz
21752 @opindex mleadz
21753 Enables the @code{leadz} (leading zero) instruction.
21754
21755 @item -mm
21756 @opindex mm
21757 Causes variables to be assigned to the @code{.near} section by default.
21758
21759 @item -mminmax
21760 @opindex mminmax
21761 Enables the @code{min} and @code{max} instructions.
21762
21763 @item -mmult
21764 @opindex mmult
21765 Enables the multiplication and multiply-accumulate instructions.
21766
21767 @item -mno-opts
21768 @opindex mno-opts
21769 Disables all the optional instructions enabled by @option{-mall-opts}.
21770
21771 @item -mrepeat
21772 @opindex mrepeat
21773 Enables the @code{repeat} and @code{erepeat} instructions, used for
21774 low-overhead looping.
21775
21776 @item -ms
21777 @opindex ms
21778 Causes all variables to default to the @code{.tiny} section. Note
21779 that there is a 65536-byte limit to this section. Accesses to these
21780 variables use the @code{%gp} base register.
21781
21782 @item -msatur
21783 @opindex msatur
21784 Enables the saturation instructions. Note that the compiler does not
21785 currently generate these itself, but this option is included for
21786 compatibility with other tools, like @code{as}.
21787
21788 @item -msdram
21789 @opindex msdram
21790 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21791
21792 @item -msim
21793 @opindex msim
21794 Link the simulator run-time libraries.
21795
21796 @item -msimnovec
21797 @opindex msimnovec
21798 Link the simulator runtime libraries, excluding built-in support
21799 for reset and exception vectors and tables.
21800
21801 @item -mtf
21802 @opindex mtf
21803 Causes all functions to default to the @code{.far} section. Without
21804 this option, functions default to the @code{.near} section.
21805
21806 @item -mtiny=@var{n}
21807 @opindex mtiny=
21808 Variables that are @var{n} bytes or smaller are allocated to the
21809 @code{.tiny} section. These variables use the @code{$gp} base
21810 register. The default for this option is 4, but note that there's a
21811 65536-byte limit to the @code{.tiny} section.
21812
21813 @end table
21814
21815 @node MicroBlaze Options
21816 @subsection MicroBlaze Options
21817 @cindex MicroBlaze Options
21818
21819 @table @gcctabopt
21820
21821 @item -msoft-float
21822 @opindex msoft-float
21823 Use software emulation for floating point (default).
21824
21825 @item -mhard-float
21826 @opindex mhard-float
21827 Use hardware floating-point instructions.
21828
21829 @item -mmemcpy
21830 @opindex mmemcpy
21831 Do not optimize block moves, use @code{memcpy}.
21832
21833 @item -mno-clearbss
21834 @opindex mno-clearbss
21835 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21836
21837 @item -mcpu=@var{cpu-type}
21838 @opindex mcpu=
21839 Use features of, and schedule code for, the given CPU.
21840 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21841 where @var{X} is a major version, @var{YY} is the minor version, and
21842 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21843 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21844
21845 @item -mxl-soft-mul
21846 @opindex mxl-soft-mul
21847 Use software multiply emulation (default).
21848
21849 @item -mxl-soft-div
21850 @opindex mxl-soft-div
21851 Use software emulation for divides (default).
21852
21853 @item -mxl-barrel-shift
21854 @opindex mxl-barrel-shift
21855 Use the hardware barrel shifter.
21856
21857 @item -mxl-pattern-compare
21858 @opindex mxl-pattern-compare
21859 Use pattern compare instructions.
21860
21861 @item -msmall-divides
21862 @opindex msmall-divides
21863 Use table lookup optimization for small signed integer divisions.
21864
21865 @item -mxl-stack-check
21866 @opindex mxl-stack-check
21867 This option is deprecated. Use @option{-fstack-check} instead.
21868
21869 @item -mxl-gp-opt
21870 @opindex mxl-gp-opt
21871 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21872
21873 @item -mxl-multiply-high
21874 @opindex mxl-multiply-high
21875 Use multiply high instructions for high part of 32x32 multiply.
21876
21877 @item -mxl-float-convert
21878 @opindex mxl-float-convert
21879 Use hardware floating-point conversion instructions.
21880
21881 @item -mxl-float-sqrt
21882 @opindex mxl-float-sqrt
21883 Use hardware floating-point square root instruction.
21884
21885 @item -mbig-endian
21886 @opindex mbig-endian
21887 Generate code for a big-endian target.
21888
21889 @item -mlittle-endian
21890 @opindex mlittle-endian
21891 Generate code for a little-endian target.
21892
21893 @item -mxl-reorder
21894 @opindex mxl-reorder
21895 Use reorder instructions (swap and byte reversed load/store).
21896
21897 @item -mxl-mode-@var{app-model}
21898 Select application model @var{app-model}. Valid models are
21899 @table @samp
21900 @item executable
21901 normal executable (default), uses startup code @file{crt0.o}.
21902
21903 @item -mpic-data-is-text-relative
21904 @opindex mpic-data-is-text-relative
21905 Assume that the displacement between the text and data segments is fixed
21906 at static link time. This allows data to be referenced by offset from start of
21907 text address instead of GOT since PC-relative addressing is not supported.
21908
21909 @item xmdstub
21910 for use with Xilinx Microprocessor Debugger (XMD) based
21911 software intrusive debug agent called xmdstub. This uses startup file
21912 @file{crt1.o} and sets the start address of the program to 0x800.
21913
21914 @item bootstrap
21915 for applications that are loaded using a bootloader.
21916 This model uses startup file @file{crt2.o} which does not contain a processor
21917 reset vector handler. This is suitable for transferring control on a
21918 processor reset to the bootloader rather than the application.
21919
21920 @item novectors
21921 for applications that do not require any of the
21922 MicroBlaze vectors. This option may be useful for applications running
21923 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21924 @end table
21925
21926 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21927 @option{-mxl-mode-@var{app-model}}.
21928
21929 @end table
21930
21931 @node MIPS Options
21932 @subsection MIPS Options
21933 @cindex MIPS options
21934
21935 @table @gcctabopt
21936
21937 @item -EB
21938 @opindex EB
21939 Generate big-endian code.
21940
21941 @item -EL
21942 @opindex EL
21943 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21944 configurations.
21945
21946 @item -march=@var{arch}
21947 @opindex march
21948 Generate code that runs on @var{arch}, which can be the name of a
21949 generic MIPS ISA, or the name of a particular processor.
21950 The ISA names are:
21951 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21952 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21953 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21954 @samp{mips64r5} and @samp{mips64r6}.
21955 The processor names are:
21956 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21957 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21958 @samp{5kc}, @samp{5kf},
21959 @samp{20kc},
21960 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21961 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21962 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21963 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21964 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21965 @samp{i6400}, @samp{i6500},
21966 @samp{interaptiv},
21967 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21968 @samp{gs464e}, @samp{gs264e},
21969 @samp{m4k},
21970 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21971 @samp{m5100}, @samp{m5101},
21972 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21973 @samp{orion},
21974 @samp{p5600}, @samp{p6600},
21975 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21976 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21977 @samp{r6000}, @samp{r8000},
21978 @samp{rm7000}, @samp{rm9000},
21979 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21980 @samp{sb1},
21981 @samp{sr71000},
21982 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21983 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21984 @samp{xlr} and @samp{xlp}.
21985 The special value @samp{from-abi} selects the
21986 most compatible architecture for the selected ABI (that is,
21987 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21988
21989 The native Linux/GNU toolchain also supports the value @samp{native},
21990 which selects the best architecture option for the host processor.
21991 @option{-march=native} has no effect if GCC does not recognize
21992 the processor.
21993
21994 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21995 (for example, @option{-march=r2k}). Prefixes are optional, and
21996 @samp{vr} may be written @samp{r}.
21997
21998 Names of the form @samp{@var{n}f2_1} refer to processors with
21999 FPUs clocked at half the rate of the core, names of the form
22000 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
22001 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
22002 processors with FPUs clocked a ratio of 3:2 with respect to the core.
22003 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
22004 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
22005 accepted as synonyms for @samp{@var{n}f1_1}.
22006
22007 GCC defines two macros based on the value of this option. The first
22008 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
22009 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
22010 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
22011 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
22012 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
22013
22014 Note that the @code{_MIPS_ARCH} macro uses the processor names given
22015 above. In other words, it has the full prefix and does not
22016 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
22017 the macro names the resolved architecture (either @code{"mips1"} or
22018 @code{"mips3"}). It names the default architecture when no
22019 @option{-march} option is given.
22020
22021 @item -mtune=@var{arch}
22022 @opindex mtune
22023 Optimize for @var{arch}. Among other things, this option controls
22024 the way instructions are scheduled, and the perceived cost of arithmetic
22025 operations. The list of @var{arch} values is the same as for
22026 @option{-march}.
22027
22028 When this option is not used, GCC optimizes for the processor
22029 specified by @option{-march}. By using @option{-march} and
22030 @option{-mtune} together, it is possible to generate code that
22031 runs on a family of processors, but optimize the code for one
22032 particular member of that family.
22033
22034 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
22035 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
22036 @option{-march} ones described above.
22037
22038 @item -mips1
22039 @opindex mips1
22040 Equivalent to @option{-march=mips1}.
22041
22042 @item -mips2
22043 @opindex mips2
22044 Equivalent to @option{-march=mips2}.
22045
22046 @item -mips3
22047 @opindex mips3
22048 Equivalent to @option{-march=mips3}.
22049
22050 @item -mips4
22051 @opindex mips4
22052 Equivalent to @option{-march=mips4}.
22053
22054 @item -mips32
22055 @opindex mips32
22056 Equivalent to @option{-march=mips32}.
22057
22058 @item -mips32r3
22059 @opindex mips32r3
22060 Equivalent to @option{-march=mips32r3}.
22061
22062 @item -mips32r5
22063 @opindex mips32r5
22064 Equivalent to @option{-march=mips32r5}.
22065
22066 @item -mips32r6
22067 @opindex mips32r6
22068 Equivalent to @option{-march=mips32r6}.
22069
22070 @item -mips64
22071 @opindex mips64
22072 Equivalent to @option{-march=mips64}.
22073
22074 @item -mips64r2
22075 @opindex mips64r2
22076 Equivalent to @option{-march=mips64r2}.
22077
22078 @item -mips64r3
22079 @opindex mips64r3
22080 Equivalent to @option{-march=mips64r3}.
22081
22082 @item -mips64r5
22083 @opindex mips64r5
22084 Equivalent to @option{-march=mips64r5}.
22085
22086 @item -mips64r6
22087 @opindex mips64r6
22088 Equivalent to @option{-march=mips64r6}.
22089
22090 @item -mips16
22091 @itemx -mno-mips16
22092 @opindex mips16
22093 @opindex mno-mips16
22094 Generate (do not generate) MIPS16 code. If GCC is targeting a
22095 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
22096
22097 MIPS16 code generation can also be controlled on a per-function basis
22098 by means of @code{mips16} and @code{nomips16} attributes.
22099 @xref{Function Attributes}, for more information.
22100
22101 @item -mflip-mips16
22102 @opindex mflip-mips16
22103 Generate MIPS16 code on alternating functions. This option is provided
22104 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
22105 not intended for ordinary use in compiling user code.
22106
22107 @item -minterlink-compressed
22108 @itemx -mno-interlink-compressed
22109 @opindex minterlink-compressed
22110 @opindex mno-interlink-compressed
22111 Require (do not require) that code using the standard (uncompressed) MIPS ISA
22112 be link-compatible with MIPS16 and microMIPS code, and vice versa.
22113
22114 For example, code using the standard ISA encoding cannot jump directly
22115 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
22116 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
22117 knows that the target of the jump is not compressed.
22118
22119 @item -minterlink-mips16
22120 @itemx -mno-interlink-mips16
22121 @opindex minterlink-mips16
22122 @opindex mno-interlink-mips16
22123 Aliases of @option{-minterlink-compressed} and
22124 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
22125 and are retained for backwards compatibility.
22126
22127 @item -mabi=32
22128 @itemx -mabi=o64
22129 @itemx -mabi=n32
22130 @itemx -mabi=64
22131 @itemx -mabi=eabi
22132 @opindex mabi=32
22133 @opindex mabi=o64
22134 @opindex mabi=n32
22135 @opindex mabi=64
22136 @opindex mabi=eabi
22137 Generate code for the given ABI@.
22138
22139 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22140 generates 64-bit code when you select a 64-bit architecture, but you
22141 can use @option{-mgp32} to get 32-bit code instead.
22142
22143 For information about the O64 ABI, see
22144 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
22145
22146 GCC supports a variant of the o32 ABI in which floating-point registers
22147 are 64 rather than 32 bits wide. You can select this combination with
22148 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
22149 and @code{mfhc1} instructions and is therefore only supported for
22150 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22151
22152 The register assignments for arguments and return values remain the
22153 same, but each scalar value is passed in a single 64-bit register
22154 rather than a pair of 32-bit registers. For example, scalar
22155 floating-point values are returned in @samp{$f0} only, not a
22156 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
22157 remains the same in that the even-numbered double-precision registers
22158 are saved.
22159
22160 Two additional variants of the o32 ABI are supported to enable
22161 a transition from 32-bit to 64-bit registers. These are FPXX
22162 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
22163 The FPXX extension mandates that all code must execute correctly
22164 when run using 32-bit or 64-bit registers. The code can be interlinked
22165 with either FP32 or FP64, but not both.
22166 The FP64A extension is similar to the FP64 extension but forbids the
22167 use of odd-numbered single-precision registers. This can be used
22168 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
22169 processors and allows both FP32 and FP64A code to interlink and
22170 run in the same process without changing FPU modes.
22171
22172 @item -mabicalls
22173 @itemx -mno-abicalls
22174 @opindex mabicalls
22175 @opindex mno-abicalls
22176 Generate (do not generate) code that is suitable for SVR4-style
22177 dynamic objects. @option{-mabicalls} is the default for SVR4-based
22178 systems.
22179
22180 @item -mshared
22181 @itemx -mno-shared
22182 Generate (do not generate) code that is fully position-independent,
22183 and that can therefore be linked into shared libraries. This option
22184 only affects @option{-mabicalls}.
22185
22186 All @option{-mabicalls} code has traditionally been position-independent,
22187 regardless of options like @option{-fPIC} and @option{-fpic}. However,
22188 as an extension, the GNU toolchain allows executables to use absolute
22189 accesses for locally-binding symbols. It can also use shorter GP
22190 initialization sequences and generate direct calls to locally-defined
22191 functions. This mode is selected by @option{-mno-shared}.
22192
22193 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22194 objects that can only be linked by the GNU linker. However, the option
22195 does not affect the ABI of the final executable; it only affects the ABI
22196 of relocatable objects. Using @option{-mno-shared} generally makes
22197 executables both smaller and quicker.
22198
22199 @option{-mshared} is the default.
22200
22201 @item -mplt
22202 @itemx -mno-plt
22203 @opindex mplt
22204 @opindex mno-plt
22205 Assume (do not assume) that the static and dynamic linkers
22206 support PLTs and copy relocations. This option only affects
22207 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
22208 has no effect without @option{-msym32}.
22209
22210 You can make @option{-mplt} the default by configuring
22211 GCC with @option{--with-mips-plt}. The default is
22212 @option{-mno-plt} otherwise.
22213
22214 @item -mxgot
22215 @itemx -mno-xgot
22216 @opindex mxgot
22217 @opindex mno-xgot
22218 Lift (do not lift) the usual restrictions on the size of the global
22219 offset table.
22220
22221 GCC normally uses a single instruction to load values from the GOT@.
22222 While this is relatively efficient, it only works if the GOT
22223 is smaller than about 64k. Anything larger causes the linker
22224 to report an error such as:
22225
22226 @cindex relocation truncated to fit (MIPS)
22227 @smallexample
22228 relocation truncated to fit: R_MIPS_GOT16 foobar
22229 @end smallexample
22230
22231 If this happens, you should recompile your code with @option{-mxgot}.
22232 This works with very large GOTs, although the code is also
22233 less efficient, since it takes three instructions to fetch the
22234 value of a global symbol.
22235
22236 Note that some linkers can create multiple GOTs. If you have such a
22237 linker, you should only need to use @option{-mxgot} when a single object
22238 file accesses more than 64k's worth of GOT entries. Very few do.
22239
22240 These options have no effect unless GCC is generating position
22241 independent code.
22242
22243 @item -mgp32
22244 @opindex mgp32
22245 Assume that general-purpose registers are 32 bits wide.
22246
22247 @item -mgp64
22248 @opindex mgp64
22249 Assume that general-purpose registers are 64 bits wide.
22250
22251 @item -mfp32
22252 @opindex mfp32
22253 Assume that floating-point registers are 32 bits wide.
22254
22255 @item -mfp64
22256 @opindex mfp64
22257 Assume that floating-point registers are 64 bits wide.
22258
22259 @item -mfpxx
22260 @opindex mfpxx
22261 Do not assume the width of floating-point registers.
22262
22263 @item -mhard-float
22264 @opindex mhard-float
22265 Use floating-point coprocessor instructions.
22266
22267 @item -msoft-float
22268 @opindex msoft-float
22269 Do not use floating-point coprocessor instructions. Implement
22270 floating-point calculations using library calls instead.
22271
22272 @item -mno-float
22273 @opindex mno-float
22274 Equivalent to @option{-msoft-float}, but additionally asserts that the
22275 program being compiled does not perform any floating-point operations.
22276 This option is presently supported only by some bare-metal MIPS
22277 configurations, where it may select a special set of libraries
22278 that lack all floating-point support (including, for example, the
22279 floating-point @code{printf} formats).
22280 If code compiled with @option{-mno-float} accidentally contains
22281 floating-point operations, it is likely to suffer a link-time
22282 or run-time failure.
22283
22284 @item -msingle-float
22285 @opindex msingle-float
22286 Assume that the floating-point coprocessor only supports single-precision
22287 operations.
22288
22289 @item -mdouble-float
22290 @opindex mdouble-float
22291 Assume that the floating-point coprocessor supports double-precision
22292 operations. This is the default.
22293
22294 @item -modd-spreg
22295 @itemx -mno-odd-spreg
22296 @opindex modd-spreg
22297 @opindex mno-odd-spreg
22298 Enable the use of odd-numbered single-precision floating-point registers
22299 for the o32 ABI. This is the default for processors that are known to
22300 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22301 is set by default.
22302
22303 @item -mabs=2008
22304 @itemx -mabs=legacy
22305 @opindex mabs=2008
22306 @opindex mabs=legacy
22307 These options control the treatment of the special not-a-number (NaN)
22308 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22309 @code{neg.@i{fmt}} machine instructions.
22310
22311 By default or when @option{-mabs=legacy} is used the legacy
22312 treatment is selected. In this case these instructions are considered
22313 arithmetic and avoided where correct operation is required and the
22314 input operand might be a NaN. A longer sequence of instructions that
22315 manipulate the sign bit of floating-point datum manually is used
22316 instead unless the @option{-ffinite-math-only} option has also been
22317 specified.
22318
22319 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22320 this case these instructions are considered non-arithmetic and therefore
22321 operating correctly in all cases, including in particular where the
22322 input operand is a NaN. These instructions are therefore always used
22323 for the respective operations.
22324
22325 @item -mnan=2008
22326 @itemx -mnan=legacy
22327 @opindex mnan=2008
22328 @opindex mnan=legacy
22329 These options control the encoding of the special not-a-number (NaN)
22330 IEEE 754 floating-point data.
22331
22332 The @option{-mnan=legacy} option selects the legacy encoding. In this
22333 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22334 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22335 by the first bit of their trailing significand field being 1.
22336
22337 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22338 this case qNaNs are denoted by the first bit of their trailing
22339 significand field being 1, whereas sNaNs are denoted by the first bit of
22340 their trailing significand field being 0.
22341
22342 The default is @option{-mnan=legacy} unless GCC has been configured with
22343 @option{--with-nan=2008}.
22344
22345 @item -mllsc
22346 @itemx -mno-llsc
22347 @opindex mllsc
22348 @opindex mno-llsc
22349 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22350 implement atomic memory built-in functions. When neither option is
22351 specified, GCC uses the instructions if the target architecture
22352 supports them.
22353
22354 @option{-mllsc} is useful if the runtime environment can emulate the
22355 instructions and @option{-mno-llsc} can be useful when compiling for
22356 nonstandard ISAs. You can make either option the default by
22357 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22358 respectively. @option{--with-llsc} is the default for some
22359 configurations; see the installation documentation for details.
22360
22361 @item -mdsp
22362 @itemx -mno-dsp
22363 @opindex mdsp
22364 @opindex mno-dsp
22365 Use (do not use) revision 1 of the MIPS DSP ASE@.
22366 @xref{MIPS DSP Built-in Functions}. This option defines the
22367 preprocessor macro @code{__mips_dsp}. It also defines
22368 @code{__mips_dsp_rev} to 1.
22369
22370 @item -mdspr2
22371 @itemx -mno-dspr2
22372 @opindex mdspr2
22373 @opindex mno-dspr2
22374 Use (do not use) revision 2 of the MIPS DSP ASE@.
22375 @xref{MIPS DSP Built-in Functions}. This option defines the
22376 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22377 It also defines @code{__mips_dsp_rev} to 2.
22378
22379 @item -msmartmips
22380 @itemx -mno-smartmips
22381 @opindex msmartmips
22382 @opindex mno-smartmips
22383 Use (do not use) the MIPS SmartMIPS ASE.
22384
22385 @item -mpaired-single
22386 @itemx -mno-paired-single
22387 @opindex mpaired-single
22388 @opindex mno-paired-single
22389 Use (do not use) paired-single floating-point instructions.
22390 @xref{MIPS Paired-Single Support}. This option requires
22391 hardware floating-point support to be enabled.
22392
22393 @item -mdmx
22394 @itemx -mno-mdmx
22395 @opindex mdmx
22396 @opindex mno-mdmx
22397 Use (do not use) MIPS Digital Media Extension instructions.
22398 This option can only be used when generating 64-bit code and requires
22399 hardware floating-point support to be enabled.
22400
22401 @item -mips3d
22402 @itemx -mno-mips3d
22403 @opindex mips3d
22404 @opindex mno-mips3d
22405 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22406 The option @option{-mips3d} implies @option{-mpaired-single}.
22407
22408 @item -mmicromips
22409 @itemx -mno-micromips
22410 @opindex mmicromips
22411 @opindex mno-mmicromips
22412 Generate (do not generate) microMIPS code.
22413
22414 MicroMIPS code generation can also be controlled on a per-function basis
22415 by means of @code{micromips} and @code{nomicromips} attributes.
22416 @xref{Function Attributes}, for more information.
22417
22418 @item -mmt
22419 @itemx -mno-mt
22420 @opindex mmt
22421 @opindex mno-mt
22422 Use (do not use) MT Multithreading instructions.
22423
22424 @item -mmcu
22425 @itemx -mno-mcu
22426 @opindex mmcu
22427 @opindex mno-mcu
22428 Use (do not use) the MIPS MCU ASE instructions.
22429
22430 @item -meva
22431 @itemx -mno-eva
22432 @opindex meva
22433 @opindex mno-eva
22434 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22435
22436 @item -mvirt
22437 @itemx -mno-virt
22438 @opindex mvirt
22439 @opindex mno-virt
22440 Use (do not use) the MIPS Virtualization (VZ) instructions.
22441
22442 @item -mxpa
22443 @itemx -mno-xpa
22444 @opindex mxpa
22445 @opindex mno-xpa
22446 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22447
22448 @item -mcrc
22449 @itemx -mno-crc
22450 @opindex mcrc
22451 @opindex mno-crc
22452 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22453
22454 @item -mginv
22455 @itemx -mno-ginv
22456 @opindex mginv
22457 @opindex mno-ginv
22458 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22459
22460 @item -mloongson-mmi
22461 @itemx -mno-loongson-mmi
22462 @opindex mloongson-mmi
22463 @opindex mno-loongson-mmi
22464 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22465
22466 @item -mloongson-ext
22467 @itemx -mno-loongson-ext
22468 @opindex mloongson-ext
22469 @opindex mno-loongson-ext
22470 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22471
22472 @item -mloongson-ext2
22473 @itemx -mno-loongson-ext2
22474 @opindex mloongson-ext2
22475 @opindex mno-loongson-ext2
22476 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22477
22478 @item -mlong64
22479 @opindex mlong64
22480 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22481 an explanation of the default and the way that the pointer size is
22482 determined.
22483
22484 @item -mlong32
22485 @opindex mlong32
22486 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22487
22488 The default size of @code{int}s, @code{long}s and pointers depends on
22489 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22490 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22491 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22492 or the same size as integer registers, whichever is smaller.
22493
22494 @item -msym32
22495 @itemx -mno-sym32
22496 @opindex msym32
22497 @opindex mno-sym32
22498 Assume (do not assume) that all symbols have 32-bit values, regardless
22499 of the selected ABI@. This option is useful in combination with
22500 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22501 to generate shorter and faster references to symbolic addresses.
22502
22503 @item -G @var{num}
22504 @opindex G
22505 Put definitions of externally-visible data in a small data section
22506 if that data is no bigger than @var{num} bytes. GCC can then generate
22507 more efficient accesses to the data; see @option{-mgpopt} for details.
22508
22509 The default @option{-G} option depends on the configuration.
22510
22511 @item -mlocal-sdata
22512 @itemx -mno-local-sdata
22513 @opindex mlocal-sdata
22514 @opindex mno-local-sdata
22515 Extend (do not extend) the @option{-G} behavior to local data too,
22516 such as to static variables in C@. @option{-mlocal-sdata} is the
22517 default for all configurations.
22518
22519 If the linker complains that an application is using too much small data,
22520 you might want to try rebuilding the less performance-critical parts with
22521 @option{-mno-local-sdata}. You might also want to build large
22522 libraries with @option{-mno-local-sdata}, so that the libraries leave
22523 more room for the main program.
22524
22525 @item -mextern-sdata
22526 @itemx -mno-extern-sdata
22527 @opindex mextern-sdata
22528 @opindex mno-extern-sdata
22529 Assume (do not assume) that externally-defined data is in
22530 a small data section if the size of that data is within the @option{-G} limit.
22531 @option{-mextern-sdata} is the default for all configurations.
22532
22533 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22534 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22535 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22536 is placed in a small data section. If @var{Var} is defined by another
22537 module, you must either compile that module with a high-enough
22538 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22539 definition. If @var{Var} is common, you must link the application
22540 with a high-enough @option{-G} setting.
22541
22542 The easiest way of satisfying these restrictions is to compile
22543 and link every module with the same @option{-G} option. However,
22544 you may wish to build a library that supports several different
22545 small data limits. You can do this by compiling the library with
22546 the highest supported @option{-G} setting and additionally using
22547 @option{-mno-extern-sdata} to stop the library from making assumptions
22548 about externally-defined data.
22549
22550 @item -mgpopt
22551 @itemx -mno-gpopt
22552 @opindex mgpopt
22553 @opindex mno-gpopt
22554 Use (do not use) GP-relative accesses for symbols that are known to be
22555 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22556 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22557 configurations.
22558
22559 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22560 might not hold the value of @code{_gp}. For example, if the code is
22561 part of a library that might be used in a boot monitor, programs that
22562 call boot monitor routines pass an unknown value in @code{$gp}.
22563 (In such situations, the boot monitor itself is usually compiled
22564 with @option{-G0}.)
22565
22566 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22567 @option{-mno-extern-sdata}.
22568
22569 @item -membedded-data
22570 @itemx -mno-embedded-data
22571 @opindex membedded-data
22572 @opindex mno-embedded-data
22573 Allocate variables to the read-only data section first if possible, then
22574 next in the small data section if possible, otherwise in data. This gives
22575 slightly slower code than the default, but reduces the amount of RAM required
22576 when executing, and thus may be preferred for some embedded systems.
22577
22578 @item -muninit-const-in-rodata
22579 @itemx -mno-uninit-const-in-rodata
22580 @opindex muninit-const-in-rodata
22581 @opindex mno-uninit-const-in-rodata
22582 Put uninitialized @code{const} variables in the read-only data section.
22583 This option is only meaningful in conjunction with @option{-membedded-data}.
22584
22585 @item -mcode-readable=@var{setting}
22586 @opindex mcode-readable
22587 Specify whether GCC may generate code that reads from executable sections.
22588 There are three possible settings:
22589
22590 @table @gcctabopt
22591 @item -mcode-readable=yes
22592 Instructions may freely access executable sections. This is the
22593 default setting.
22594
22595 @item -mcode-readable=pcrel
22596 MIPS16 PC-relative load instructions can access executable sections,
22597 but other instructions must not do so. This option is useful on 4KSc
22598 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22599 It is also useful on processors that can be configured to have a dual
22600 instruction/data SRAM interface and that, like the M4K, automatically
22601 redirect PC-relative loads to the instruction RAM.
22602
22603 @item -mcode-readable=no
22604 Instructions must not access executable sections. This option can be
22605 useful on targets that are configured to have a dual instruction/data
22606 SRAM interface but that (unlike the M4K) do not automatically redirect
22607 PC-relative loads to the instruction RAM.
22608 @end table
22609
22610 @item -msplit-addresses
22611 @itemx -mno-split-addresses
22612 @opindex msplit-addresses
22613 @opindex mno-split-addresses
22614 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22615 relocation operators. This option has been superseded by
22616 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22617
22618 @item -mexplicit-relocs
22619 @itemx -mno-explicit-relocs
22620 @opindex mexplicit-relocs
22621 @opindex mno-explicit-relocs
22622 Use (do not use) assembler relocation operators when dealing with symbolic
22623 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22624 is to use assembler macros instead.
22625
22626 @option{-mexplicit-relocs} is the default if GCC was configured
22627 to use an assembler that supports relocation operators.
22628
22629 @item -mcheck-zero-division
22630 @itemx -mno-check-zero-division
22631 @opindex mcheck-zero-division
22632 @opindex mno-check-zero-division
22633 Trap (do not trap) on integer division by zero.
22634
22635 The default is @option{-mcheck-zero-division}.
22636
22637 @item -mdivide-traps
22638 @itemx -mdivide-breaks
22639 @opindex mdivide-traps
22640 @opindex mdivide-breaks
22641 MIPS systems check for division by zero by generating either a
22642 conditional trap or a break instruction. Using traps results in
22643 smaller code, but is only supported on MIPS II and later. Also, some
22644 versions of the Linux kernel have a bug that prevents trap from
22645 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22646 allow conditional traps on architectures that support them and
22647 @option{-mdivide-breaks} to force the use of breaks.
22648
22649 The default is usually @option{-mdivide-traps}, but this can be
22650 overridden at configure time using @option{--with-divide=breaks}.
22651 Divide-by-zero checks can be completely disabled using
22652 @option{-mno-check-zero-division}.
22653
22654 @item -mload-store-pairs
22655 @itemx -mno-load-store-pairs
22656 @opindex mload-store-pairs
22657 @opindex mno-load-store-pairs
22658 Enable (disable) an optimization that pairs consecutive load or store
22659 instructions to enable load/store bonding. This option is enabled by
22660 default but only takes effect when the selected architecture is known
22661 to support bonding.
22662
22663 @item -mmemcpy
22664 @itemx -mno-memcpy
22665 @opindex mmemcpy
22666 @opindex mno-memcpy
22667 Force (do not force) the use of @code{memcpy} for non-trivial block
22668 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22669 most constant-sized copies.
22670
22671 @item -mlong-calls
22672 @itemx -mno-long-calls
22673 @opindex mlong-calls
22674 @opindex mno-long-calls
22675 Disable (do not disable) use of the @code{jal} instruction. Calling
22676 functions using @code{jal} is more efficient but requires the caller
22677 and callee to be in the same 256 megabyte segment.
22678
22679 This option has no effect on abicalls code. The default is
22680 @option{-mno-long-calls}.
22681
22682 @item -mmad
22683 @itemx -mno-mad
22684 @opindex mmad
22685 @opindex mno-mad
22686 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22687 instructions, as provided by the R4650 ISA@.
22688
22689 @item -mimadd
22690 @itemx -mno-imadd
22691 @opindex mimadd
22692 @opindex mno-imadd
22693 Enable (disable) use of the @code{madd} and @code{msub} integer
22694 instructions. The default is @option{-mimadd} on architectures
22695 that support @code{madd} and @code{msub} except for the 74k
22696 architecture where it was found to generate slower code.
22697
22698 @item -mfused-madd
22699 @itemx -mno-fused-madd
22700 @opindex mfused-madd
22701 @opindex mno-fused-madd
22702 Enable (disable) use of the floating-point multiply-accumulate
22703 instructions, when they are available. The default is
22704 @option{-mfused-madd}.
22705
22706 On the R8000 CPU when multiply-accumulate instructions are used,
22707 the intermediate product is calculated to infinite precision
22708 and is not subject to the FCSR Flush to Zero bit. This may be
22709 undesirable in some circumstances. On other processors the result
22710 is numerically identical to the equivalent computation using
22711 separate multiply, add, subtract and negate instructions.
22712
22713 @item -nocpp
22714 @opindex nocpp
22715 Tell the MIPS assembler to not run its preprocessor over user
22716 assembler files (with a @samp{.s} suffix) when assembling them.
22717
22718 @item -mfix-24k
22719 @itemx -mno-fix-24k
22720 @opindex mfix-24k
22721 @opindex mno-fix-24k
22722 Work around the 24K E48 (lost data on stores during refill) errata.
22723 The workarounds are implemented by the assembler rather than by GCC@.
22724
22725 @item -mfix-r4000
22726 @itemx -mno-fix-r4000
22727 @opindex mfix-r4000
22728 @opindex mno-fix-r4000
22729 Work around certain R4000 CPU errata:
22730 @itemize @minus
22731 @item
22732 A double-word or a variable shift may give an incorrect result if executed
22733 immediately after starting an integer division.
22734 @item
22735 A double-word or a variable shift may give an incorrect result if executed
22736 while an integer multiplication is in progress.
22737 @item
22738 An integer division may give an incorrect result if started in a delay slot
22739 of a taken branch or a jump.
22740 @end itemize
22741
22742 @item -mfix-r4400
22743 @itemx -mno-fix-r4400
22744 @opindex mfix-r4400
22745 @opindex mno-fix-r4400
22746 Work around certain R4400 CPU errata:
22747 @itemize @minus
22748 @item
22749 A double-word or a variable shift may give an incorrect result if executed
22750 immediately after starting an integer division.
22751 @end itemize
22752
22753 @item -mfix-r10000
22754 @itemx -mno-fix-r10000
22755 @opindex mfix-r10000
22756 @opindex mno-fix-r10000
22757 Work around certain R10000 errata:
22758 @itemize @minus
22759 @item
22760 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22761 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22762 @end itemize
22763
22764 This option can only be used if the target architecture supports
22765 branch-likely instructions. @option{-mfix-r10000} is the default when
22766 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22767 otherwise.
22768
22769 @item -mfix-r5900
22770 @itemx -mno-fix-r5900
22771 @opindex mfix-r5900
22772 Do not attempt to schedule the preceding instruction into the delay slot
22773 of a branch instruction placed at the end of a short loop of six
22774 instructions or fewer and always schedule a @code{nop} instruction there
22775 instead. The short loop bug under certain conditions causes loops to
22776 execute only once or twice, due to a hardware bug in the R5900 chip. The
22777 workaround is implemented by the assembler rather than by GCC@.
22778
22779 @item -mfix-rm7000
22780 @itemx -mno-fix-rm7000
22781 @opindex mfix-rm7000
22782 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22783 workarounds are implemented by the assembler rather than by GCC@.
22784
22785 @item -mfix-vr4120
22786 @itemx -mno-fix-vr4120
22787 @opindex mfix-vr4120
22788 Work around certain VR4120 errata:
22789 @itemize @minus
22790 @item
22791 @code{dmultu} does not always produce the correct result.
22792 @item
22793 @code{div} and @code{ddiv} do not always produce the correct result if one
22794 of the operands is negative.
22795 @end itemize
22796 The workarounds for the division errata rely on special functions in
22797 @file{libgcc.a}. At present, these functions are only provided by
22798 the @code{mips64vr*-elf} configurations.
22799
22800 Other VR4120 errata require a NOP to be inserted between certain pairs of
22801 instructions. These errata are handled by the assembler, not by GCC itself.
22802
22803 @item -mfix-vr4130
22804 @opindex mfix-vr4130
22805 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22806 workarounds are implemented by the assembler rather than by GCC,
22807 although GCC avoids using @code{mflo} and @code{mfhi} if the
22808 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22809 instructions are available instead.
22810
22811 @item -mfix-sb1
22812 @itemx -mno-fix-sb1
22813 @opindex mfix-sb1
22814 Work around certain SB-1 CPU core errata.
22815 (This flag currently works around the SB-1 revision 2
22816 ``F1'' and ``F2'' floating-point errata.)
22817
22818 @item -mr10k-cache-barrier=@var{setting}
22819 @opindex mr10k-cache-barrier
22820 Specify whether GCC should insert cache barriers to avoid the
22821 side effects of speculation on R10K processors.
22822
22823 In common with many processors, the R10K tries to predict the outcome
22824 of a conditional branch and speculatively executes instructions from
22825 the ``taken'' branch. It later aborts these instructions if the
22826 predicted outcome is wrong. However, on the R10K, even aborted
22827 instructions can have side effects.
22828
22829 This problem only affects kernel stores and, depending on the system,
22830 kernel loads. As an example, a speculatively-executed store may load
22831 the target memory into cache and mark the cache line as dirty, even if
22832 the store itself is later aborted. If a DMA operation writes to the
22833 same area of memory before the ``dirty'' line is flushed, the cached
22834 data overwrites the DMA-ed data. See the R10K processor manual
22835 for a full description, including other potential problems.
22836
22837 One workaround is to insert cache barrier instructions before every memory
22838 access that might be speculatively executed and that might have side
22839 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22840 controls GCC's implementation of this workaround. It assumes that
22841 aborted accesses to any byte in the following regions does not have
22842 side effects:
22843
22844 @enumerate
22845 @item
22846 the memory occupied by the current function's stack frame;
22847
22848 @item
22849 the memory occupied by an incoming stack argument;
22850
22851 @item
22852 the memory occupied by an object with a link-time-constant address.
22853 @end enumerate
22854
22855 It is the kernel's responsibility to ensure that speculative
22856 accesses to these regions are indeed safe.
22857
22858 If the input program contains a function declaration such as:
22859
22860 @smallexample
22861 void foo (void);
22862 @end smallexample
22863
22864 then the implementation of @code{foo} must allow @code{j foo} and
22865 @code{jal foo} to be executed speculatively. GCC honors this
22866 restriction for functions it compiles itself. It expects non-GCC
22867 functions (such as hand-written assembly code) to do the same.
22868
22869 The option has three forms:
22870
22871 @table @gcctabopt
22872 @item -mr10k-cache-barrier=load-store
22873 Insert a cache barrier before a load or store that might be
22874 speculatively executed and that might have side effects even
22875 if aborted.
22876
22877 @item -mr10k-cache-barrier=store
22878 Insert a cache barrier before a store that might be speculatively
22879 executed and that might have side effects even if aborted.
22880
22881 @item -mr10k-cache-barrier=none
22882 Disable the insertion of cache barriers. This is the default setting.
22883 @end table
22884
22885 @item -mflush-func=@var{func}
22886 @itemx -mno-flush-func
22887 @opindex mflush-func
22888 Specifies the function to call to flush the I and D caches, or to not
22889 call any such function. If called, the function must take the same
22890 arguments as the common @code{_flush_func}, that is, the address of the
22891 memory range for which the cache is being flushed, the size of the
22892 memory range, and the number 3 (to flush both caches). The default
22893 depends on the target GCC was configured for, but commonly is either
22894 @code{_flush_func} or @code{__cpu_flush}.
22895
22896 @item mbranch-cost=@var{num}
22897 @opindex mbranch-cost
22898 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22899 This cost is only a heuristic and is not guaranteed to produce
22900 consistent results across releases. A zero cost redundantly selects
22901 the default, which is based on the @option{-mtune} setting.
22902
22903 @item -mbranch-likely
22904 @itemx -mno-branch-likely
22905 @opindex mbranch-likely
22906 @opindex mno-branch-likely
22907 Enable or disable use of Branch Likely instructions, regardless of the
22908 default for the selected architecture. By default, Branch Likely
22909 instructions may be generated if they are supported by the selected
22910 architecture. An exception is for the MIPS32 and MIPS64 architectures
22911 and processors that implement those architectures; for those, Branch
22912 Likely instructions are not be generated by default because the MIPS32
22913 and MIPS64 architectures specifically deprecate their use.
22914
22915 @item -mcompact-branches=never
22916 @itemx -mcompact-branches=optimal
22917 @itemx -mcompact-branches=always
22918 @opindex mcompact-branches=never
22919 @opindex mcompact-branches=optimal
22920 @opindex mcompact-branches=always
22921 These options control which form of branches will be generated. The
22922 default is @option{-mcompact-branches=optimal}.
22923
22924 The @option{-mcompact-branches=never} option ensures that compact branch
22925 instructions will never be generated.
22926
22927 The @option{-mcompact-branches=always} option ensures that a compact
22928 branch instruction will be generated if available. If a compact branch
22929 instruction is not available, a delay slot form of the branch will be
22930 used instead.
22931
22932 This option is supported from MIPS Release 6 onwards.
22933
22934 The @option{-mcompact-branches=optimal} option will cause a delay slot
22935 branch to be used if one is available in the current ISA and the delay
22936 slot is successfully filled. If the delay slot is not filled, a compact
22937 branch will be chosen if one is available.
22938
22939 @item -mfp-exceptions
22940 @itemx -mno-fp-exceptions
22941 @opindex mfp-exceptions
22942 Specifies whether FP exceptions are enabled. This affects how
22943 FP instructions are scheduled for some processors.
22944 The default is that FP exceptions are
22945 enabled.
22946
22947 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22948 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22949 FP pipe.
22950
22951 @item -mvr4130-align
22952 @itemx -mno-vr4130-align
22953 @opindex mvr4130-align
22954 The VR4130 pipeline is two-way superscalar, but can only issue two
22955 instructions together if the first one is 8-byte aligned. When this
22956 option is enabled, GCC aligns pairs of instructions that it
22957 thinks should execute in parallel.
22958
22959 This option only has an effect when optimizing for the VR4130.
22960 It normally makes code faster, but at the expense of making it bigger.
22961 It is enabled by default at optimization level @option{-O3}.
22962
22963 @item -msynci
22964 @itemx -mno-synci
22965 @opindex msynci
22966 Enable (disable) generation of @code{synci} instructions on
22967 architectures that support it. The @code{synci} instructions (if
22968 enabled) are generated when @code{__builtin___clear_cache} is
22969 compiled.
22970
22971 This option defaults to @option{-mno-synci}, but the default can be
22972 overridden by configuring GCC with @option{--with-synci}.
22973
22974 When compiling code for single processor systems, it is generally safe
22975 to use @code{synci}. However, on many multi-core (SMP) systems, it
22976 does not invalidate the instruction caches on all cores and may lead
22977 to undefined behavior.
22978
22979 @item -mrelax-pic-calls
22980 @itemx -mno-relax-pic-calls
22981 @opindex mrelax-pic-calls
22982 Try to turn PIC calls that are normally dispatched via register
22983 @code{$25} into direct calls. This is only possible if the linker can
22984 resolve the destination at link time and if the destination is within
22985 range for a direct call.
22986
22987 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22988 an assembler and a linker that support the @code{.reloc} assembly
22989 directive and @option{-mexplicit-relocs} is in effect. With
22990 @option{-mno-explicit-relocs}, this optimization can be performed by the
22991 assembler and the linker alone without help from the compiler.
22992
22993 @item -mmcount-ra-address
22994 @itemx -mno-mcount-ra-address
22995 @opindex mmcount-ra-address
22996 @opindex mno-mcount-ra-address
22997 Emit (do not emit) code that allows @code{_mcount} to modify the
22998 calling function's return address. When enabled, this option extends
22999 the usual @code{_mcount} interface with a new @var{ra-address}
23000 parameter, which has type @code{intptr_t *} and is passed in register
23001 @code{$12}. @code{_mcount} can then modify the return address by
23002 doing both of the following:
23003 @itemize
23004 @item
23005 Returning the new address in register @code{$31}.
23006 @item
23007 Storing the new address in @code{*@var{ra-address}},
23008 if @var{ra-address} is nonnull.
23009 @end itemize
23010
23011 The default is @option{-mno-mcount-ra-address}.
23012
23013 @item -mframe-header-opt
23014 @itemx -mno-frame-header-opt
23015 @opindex mframe-header-opt
23016 Enable (disable) frame header optimization in the o32 ABI. When using the
23017 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
23018 function to write out register arguments. When enabled, this optimization
23019 will suppress the allocation of the frame header if it can be determined that
23020 it is unused.
23021
23022 This optimization is off by default at all optimization levels.
23023
23024 @item -mlxc1-sxc1
23025 @itemx -mno-lxc1-sxc1
23026 @opindex mlxc1-sxc1
23027 When applicable, enable (disable) the generation of @code{lwxc1},
23028 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
23029
23030 @item -mmadd4
23031 @itemx -mno-madd4
23032 @opindex mmadd4
23033 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
23034 @code{madd.d} and related instructions. Enabled by default.
23035
23036 @end table
23037
23038 @node MMIX Options
23039 @subsection MMIX Options
23040 @cindex MMIX Options
23041
23042 These options are defined for the MMIX:
23043
23044 @table @gcctabopt
23045 @item -mlibfuncs
23046 @itemx -mno-libfuncs
23047 @opindex mlibfuncs
23048 @opindex mno-libfuncs
23049 Specify that intrinsic library functions are being compiled, passing all
23050 values in registers, no matter the size.
23051
23052 @item -mepsilon
23053 @itemx -mno-epsilon
23054 @opindex mepsilon
23055 @opindex mno-epsilon
23056 Generate floating-point comparison instructions that compare with respect
23057 to the @code{rE} epsilon register.
23058
23059 @item -mabi=mmixware
23060 @itemx -mabi=gnu
23061 @opindex mabi=mmixware
23062 @opindex mabi=gnu
23063 Generate code that passes function parameters and return values that (in
23064 the called function) are seen as registers @code{$0} and up, as opposed to
23065 the GNU ABI which uses global registers @code{$231} and up.
23066
23067 @item -mzero-extend
23068 @itemx -mno-zero-extend
23069 @opindex mzero-extend
23070 @opindex mno-zero-extend
23071 When reading data from memory in sizes shorter than 64 bits, use (do not
23072 use) zero-extending load instructions by default, rather than
23073 sign-extending ones.
23074
23075 @item -mknuthdiv
23076 @itemx -mno-knuthdiv
23077 @opindex mknuthdiv
23078 @opindex mno-knuthdiv
23079 Make the result of a division yielding a remainder have the same sign as
23080 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
23081 remainder follows the sign of the dividend. Both methods are
23082 arithmetically valid, the latter being almost exclusively used.
23083
23084 @item -mtoplevel-symbols
23085 @itemx -mno-toplevel-symbols
23086 @opindex mtoplevel-symbols
23087 @opindex mno-toplevel-symbols
23088 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
23089 code can be used with the @code{PREFIX} assembly directive.
23090
23091 @item -melf
23092 @opindex melf
23093 Generate an executable in the ELF format, rather than the default
23094 @samp{mmo} format used by the @command{mmix} simulator.
23095
23096 @item -mbranch-predict
23097 @itemx -mno-branch-predict
23098 @opindex mbranch-predict
23099 @opindex mno-branch-predict
23100 Use (do not use) the probable-branch instructions, when static branch
23101 prediction indicates a probable branch.
23102
23103 @item -mbase-addresses
23104 @itemx -mno-base-addresses
23105 @opindex mbase-addresses
23106 @opindex mno-base-addresses
23107 Generate (do not generate) code that uses @emph{base addresses}. Using a
23108 base address automatically generates a request (handled by the assembler
23109 and the linker) for a constant to be set up in a global register. The
23110 register is used for one or more base address requests within the range 0
23111 to 255 from the value held in the register. The generally leads to short
23112 and fast code, but the number of different data items that can be
23113 addressed is limited. This means that a program that uses lots of static
23114 data may require @option{-mno-base-addresses}.
23115
23116 @item -msingle-exit
23117 @itemx -mno-single-exit
23118 @opindex msingle-exit
23119 @opindex mno-single-exit
23120 Force (do not force) generated code to have a single exit point in each
23121 function.
23122 @end table
23123
23124 @node MN10300 Options
23125 @subsection MN10300 Options
23126 @cindex MN10300 options
23127
23128 These @option{-m} options are defined for Matsushita MN10300 architectures:
23129
23130 @table @gcctabopt
23131 @item -mmult-bug
23132 @opindex mmult-bug
23133 Generate code to avoid bugs in the multiply instructions for the MN10300
23134 processors. This is the default.
23135
23136 @item -mno-mult-bug
23137 @opindex mno-mult-bug
23138 Do not generate code to avoid bugs in the multiply instructions for the
23139 MN10300 processors.
23140
23141 @item -mam33
23142 @opindex mam33
23143 Generate code using features specific to the AM33 processor.
23144
23145 @item -mno-am33
23146 @opindex mno-am33
23147 Do not generate code using features specific to the AM33 processor. This
23148 is the default.
23149
23150 @item -mam33-2
23151 @opindex mam33-2
23152 Generate code using features specific to the AM33/2.0 processor.
23153
23154 @item -mam34
23155 @opindex mam34
23156 Generate code using features specific to the AM34 processor.
23157
23158 @item -mtune=@var{cpu-type}
23159 @opindex mtune
23160 Use the timing characteristics of the indicated CPU type when
23161 scheduling instructions. This does not change the targeted processor
23162 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
23163 @samp{am33-2} or @samp{am34}.
23164
23165 @item -mreturn-pointer-on-d0
23166 @opindex mreturn-pointer-on-d0
23167 When generating a function that returns a pointer, return the pointer
23168 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
23169 only in @code{a0}, and attempts to call such functions without a prototype
23170 result in errors. Note that this option is on by default; use
23171 @option{-mno-return-pointer-on-d0} to disable it.
23172
23173 @item -mno-crt0
23174 @opindex mno-crt0
23175 Do not link in the C run-time initialization object file.
23176
23177 @item -mrelax
23178 @opindex mrelax
23179 Indicate to the linker that it should perform a relaxation optimization pass
23180 to shorten branches, calls and absolute memory addresses. This option only
23181 has an effect when used on the command line for the final link step.
23182
23183 This option makes symbolic debugging impossible.
23184
23185 @item -mliw
23186 @opindex mliw
23187 Allow the compiler to generate @emph{Long Instruction Word}
23188 instructions if the target is the @samp{AM33} or later. This is the
23189 default. This option defines the preprocessor macro @code{__LIW__}.
23190
23191 @item -mno-liw
23192 @opindex mno-liw
23193 Do not allow the compiler to generate @emph{Long Instruction Word}
23194 instructions. This option defines the preprocessor macro
23195 @code{__NO_LIW__}.
23196
23197 @item -msetlb
23198 @opindex msetlb
23199 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23200 instructions if the target is the @samp{AM33} or later. This is the
23201 default. This option defines the preprocessor macro @code{__SETLB__}.
23202
23203 @item -mno-setlb
23204 @opindex mno-setlb
23205 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23206 instructions. This option defines the preprocessor macro
23207 @code{__NO_SETLB__}.
23208
23209 @end table
23210
23211 @node Moxie Options
23212 @subsection Moxie Options
23213 @cindex Moxie Options
23214
23215 @table @gcctabopt
23216
23217 @item -meb
23218 @opindex meb
23219 Generate big-endian code. This is the default for @samp{moxie-*-*}
23220 configurations.
23221
23222 @item -mel
23223 @opindex mel
23224 Generate little-endian code.
23225
23226 @item -mmul.x
23227 @opindex mmul.x
23228 Generate mul.x and umul.x instructions. This is the default for
23229 @samp{moxiebox-*-*} configurations.
23230
23231 @item -mno-crt0
23232 @opindex mno-crt0
23233 Do not link in the C run-time initialization object file.
23234
23235 @end table
23236
23237 @node MSP430 Options
23238 @subsection MSP430 Options
23239 @cindex MSP430 Options
23240
23241 These options are defined for the MSP430:
23242
23243 @table @gcctabopt
23244
23245 @item -masm-hex
23246 @opindex masm-hex
23247 Force assembly output to always use hex constants. Normally such
23248 constants are signed decimals, but this option is available for
23249 testsuite and/or aesthetic purposes.
23250
23251 @item -mmcu=
23252 @opindex mmcu=
23253 Select the MCU to target. This is used to create a C preprocessor
23254 symbol based upon the MCU name, converted to upper case and pre- and
23255 post-fixed with @samp{__}. This in turn is used by the
23256 @file{msp430.h} header file to select an MCU-specific supplementary
23257 header file.
23258
23259 The option also sets the ISA to use. If the MCU name is one that is
23260 known to only support the 430 ISA then that is selected, otherwise the
23261 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23262 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23263 name selects the 430X ISA.
23264
23265 In addition an MCU-specific linker script is added to the linker
23266 command line. The script's name is the name of the MCU with
23267 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23268 command line defines the C preprocessor symbol @code{__XXX__} and
23269 cause the linker to search for a script called @file{xxx.ld}.
23270
23271 The ISA and hardware multiply supported for the different MCUs is hard-coded
23272 into GCC. However, an external @samp{devices.csv} file can be used to
23273 extend device support beyond those that have been hard-coded.
23274
23275 GCC searches for the @samp{devices.csv} file using the following methods in the
23276 given precedence order, where the first method takes precendence over the
23277 second which takes precedence over the third.
23278
23279 @table @asis
23280 @item Include path specified with @code{-I} and @code{-L}
23281 @samp{devices.csv} will be searched for in each of the directories specified by
23282 include paths and linker library search paths.
23283 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
23284 Define the value of the global environment variable
23285 @samp{MSP430_GCC_INCLUDE_DIR}
23286 to the full path to the directory containing devices.csv, and GCC will search
23287 this directory for devices.csv. If devices.csv is found, this directory will
23288 also be registered as an include path, and linker library path. Header files
23289 and linker scripts in this directory can therefore be used without manually
23290 specifying @code{-I} and @code{-L} on the command line.
23291 @item The @samp{msp430-elf/include/devices} directory
23292 Finally, GCC will examine @samp{msp430-elf/include/devices} from the
23293 toolchain root directory. This directory does not exist in a default
23294 installation, but if the user has created it and copied @samp{devices.csv}
23295 there, then the MCU data will be read. As above, this directory will
23296 also be registered as an include path, and linker library path.
23297
23298 @end table
23299 If none of the above search methods find @samp{devices.csv}, then the
23300 hard-coded MCU data is used.
23301
23302
23303 @item -mwarn-mcu
23304 @itemx -mno-warn-mcu
23305 @opindex mwarn-mcu
23306 @opindex mno-warn-mcu
23307 This option enables or disables warnings about conflicts between the
23308 MCU name specified by the @option{-mmcu} option and the ISA set by the
23309 @option{-mcpu} option and/or the hardware multiply support set by the
23310 @option{-mhwmult} option. It also toggles warnings about unrecognized
23311 MCU names. This option is on by default.
23312
23313 @item -mcpu=
23314 @opindex mcpu=
23315 Specifies the ISA to use. Accepted values are @samp{msp430},
23316 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23317 @option{-mmcu=} option should be used to select the ISA.
23318
23319 @item -msim
23320 @opindex msim
23321 Link to the simulator runtime libraries and linker script. Overrides
23322 any scripts that would be selected by the @option{-mmcu=} option.
23323
23324 @item -mlarge
23325 @opindex mlarge
23326 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23327
23328 @item -msmall
23329 @opindex msmall
23330 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23331
23332 @item -mrelax
23333 @opindex mrelax
23334 This option is passed to the assembler and linker, and allows the
23335 linker to perform certain optimizations that cannot be done until
23336 the final link.
23337
23338 @item mhwmult=
23339 @opindex mhwmult=
23340 Describes the type of hardware multiply supported by the target.
23341 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23342 for the original 16-bit-only multiply supported by early MCUs.
23343 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23344 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23345 A value of @samp{auto} can also be given. This tells GCC to deduce
23346 the hardware multiply support based upon the MCU name provided by the
23347 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23348 the MCU name is not recognized then no hardware multiply support is
23349 assumed. @code{auto} is the default setting.
23350
23351 Hardware multiplies are normally performed by calling a library
23352 routine. This saves space in the generated code. When compiling at
23353 @option{-O3} or higher however the hardware multiplier is invoked
23354 inline. This makes for bigger, but faster code.
23355
23356 The hardware multiply routines disable interrupts whilst running and
23357 restore the previous interrupt state when they finish. This makes
23358 them safe to use inside interrupt handlers as well as in normal code.
23359
23360 @item -minrt
23361 @opindex minrt
23362 Enable the use of a minimum runtime environment - no static
23363 initializers or constructors. This is intended for memory-constrained
23364 devices. The compiler includes special symbols in some objects
23365 that tell the linker and runtime which code fragments are required.
23366
23367 @item -mtiny-printf
23368 @opindex mtiny-printf
23369 Enable reduced code size @code{printf} and @code{puts} library functions.
23370 The @samp{tiny} implementations of these functions are not reentrant, so
23371 must be used with caution in multi-threaded applications.
23372
23373 Support for streams has been removed and the string to be printed will
23374 always be sent to stdout via the @code{write} syscall. The string is not
23375 buffered before it is sent to write.
23376
23377 This option requires Newlib Nano IO, so GCC must be configured with
23378 @samp{--enable-newlib-nano-formatted-io}.
23379
23380 @item -mcode-region=
23381 @itemx -mdata-region=
23382 @opindex mcode-region
23383 @opindex mdata-region
23384 These options tell the compiler where to place functions and data that
23385 do not have one of the @code{lower}, @code{upper}, @code{either} or
23386 @code{section} attributes. Possible values are @code{lower},
23387 @code{upper}, @code{either} or @code{any}. The first three behave
23388 like the corresponding attribute. The fourth possible value -
23389 @code{any} - is the default. It leaves placement entirely up to the
23390 linker script and how it assigns the standard sections
23391 (@code{.text}, @code{.data}, etc) to the memory regions.
23392
23393 @item -msilicon-errata=
23394 @opindex msilicon-errata
23395 This option passes on a request to assembler to enable the fixes for
23396 the named silicon errata.
23397
23398 @item -msilicon-errata-warn=
23399 @opindex msilicon-errata-warn
23400 This option passes on a request to the assembler to enable warning
23401 messages when a silicon errata might need to be applied.
23402
23403 @item -mwarn-devices-csv
23404 @itemx -mno-warn-devices-csv
23405 @opindex mwarn-devices-csv
23406 @opindex mno-warn-devices-csv
23407 Warn if @samp{devices.csv} is not found or there are problem parsing it
23408 (default: on).
23409
23410 @end table
23411
23412 @node NDS32 Options
23413 @subsection NDS32 Options
23414 @cindex NDS32 Options
23415
23416 These options are defined for NDS32 implementations:
23417
23418 @table @gcctabopt
23419
23420 @item -mbig-endian
23421 @opindex mbig-endian
23422 Generate code in big-endian mode.
23423
23424 @item -mlittle-endian
23425 @opindex mlittle-endian
23426 Generate code in little-endian mode.
23427
23428 @item -mreduced-regs
23429 @opindex mreduced-regs
23430 Use reduced-set registers for register allocation.
23431
23432 @item -mfull-regs
23433 @opindex mfull-regs
23434 Use full-set registers for register allocation.
23435
23436 @item -mcmov
23437 @opindex mcmov
23438 Generate conditional move instructions.
23439
23440 @item -mno-cmov
23441 @opindex mno-cmov
23442 Do not generate conditional move instructions.
23443
23444 @item -mext-perf
23445 @opindex mext-perf
23446 Generate performance extension instructions.
23447
23448 @item -mno-ext-perf
23449 @opindex mno-ext-perf
23450 Do not generate performance extension instructions.
23451
23452 @item -mext-perf2
23453 @opindex mext-perf2
23454 Generate performance extension 2 instructions.
23455
23456 @item -mno-ext-perf2
23457 @opindex mno-ext-perf2
23458 Do not generate performance extension 2 instructions.
23459
23460 @item -mext-string
23461 @opindex mext-string
23462 Generate string extension instructions.
23463
23464 @item -mno-ext-string
23465 @opindex mno-ext-string
23466 Do not generate string extension instructions.
23467
23468 @item -mv3push
23469 @opindex mv3push
23470 Generate v3 push25/pop25 instructions.
23471
23472 @item -mno-v3push
23473 @opindex mno-v3push
23474 Do not generate v3 push25/pop25 instructions.
23475
23476 @item -m16-bit
23477 @opindex m16-bit
23478 Generate 16-bit instructions.
23479
23480 @item -mno-16-bit
23481 @opindex mno-16-bit
23482 Do not generate 16-bit instructions.
23483
23484 @item -misr-vector-size=@var{num}
23485 @opindex misr-vector-size
23486 Specify the size of each interrupt vector, which must be 4 or 16.
23487
23488 @item -mcache-block-size=@var{num}
23489 @opindex mcache-block-size
23490 Specify the size of each cache block,
23491 which must be a power of 2 between 4 and 512.
23492
23493 @item -march=@var{arch}
23494 @opindex march
23495 Specify the name of the target architecture.
23496
23497 @item -mcmodel=@var{code-model}
23498 @opindex mcmodel
23499 Set the code model to one of
23500 @table @asis
23501 @item @samp{small}
23502 All the data and read-only data segments must be within 512KB addressing space.
23503 The text segment must be within 16MB addressing space.
23504 @item @samp{medium}
23505 The data segment must be within 512KB while the read-only data segment can be
23506 within 4GB addressing space. The text segment should be still within 16MB
23507 addressing space.
23508 @item @samp{large}
23509 All the text and data segments can be within 4GB addressing space.
23510 @end table
23511
23512 @item -mctor-dtor
23513 @opindex mctor-dtor
23514 Enable constructor/destructor feature.
23515
23516 @item -mrelax
23517 @opindex mrelax
23518 Guide linker to relax instructions.
23519
23520 @end table
23521
23522 @node Nios II Options
23523 @subsection Nios II Options
23524 @cindex Nios II options
23525 @cindex Altera Nios II options
23526
23527 These are the options defined for the Altera Nios II processor.
23528
23529 @table @gcctabopt
23530
23531 @item -G @var{num}
23532 @opindex G
23533 @cindex smaller data references
23534 Put global and static objects less than or equal to @var{num} bytes
23535 into the small data or BSS sections instead of the normal data or BSS
23536 sections. The default value of @var{num} is 8.
23537
23538 @item -mgpopt=@var{option}
23539 @itemx -mgpopt
23540 @itemx -mno-gpopt
23541 @opindex mgpopt
23542 @opindex mno-gpopt
23543 Generate (do not generate) GP-relative accesses. The following
23544 @var{option} names are recognized:
23545
23546 @table @samp
23547
23548 @item none
23549 Do not generate GP-relative accesses.
23550
23551 @item local
23552 Generate GP-relative accesses for small data objects that are not
23553 external, weak, or uninitialized common symbols.
23554 Also use GP-relative addressing for objects that
23555 have been explicitly placed in a small data section via a @code{section}
23556 attribute.
23557
23558 @item global
23559 As for @samp{local}, but also generate GP-relative accesses for
23560 small data objects that are external, weak, or common. If you use this option,
23561 you must ensure that all parts of your program (including libraries) are
23562 compiled with the same @option{-G} setting.
23563
23564 @item data
23565 Generate GP-relative accesses for all data objects in the program. If you
23566 use this option, the entire data and BSS segments
23567 of your program must fit in 64K of memory and you must use an appropriate
23568 linker script to allocate them within the addressable range of the
23569 global pointer.
23570
23571 @item all
23572 Generate GP-relative addresses for function pointers as well as data
23573 pointers. If you use this option, the entire text, data, and BSS segments
23574 of your program must fit in 64K of memory and you must use an appropriate
23575 linker script to allocate them within the addressable range of the
23576 global pointer.
23577
23578 @end table
23579
23580 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23581 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23582
23583 The default is @option{-mgpopt} except when @option{-fpic} or
23584 @option{-fPIC} is specified to generate position-independent code.
23585 Note that the Nios II ABI does not permit GP-relative accesses from
23586 shared libraries.
23587
23588 You may need to specify @option{-mno-gpopt} explicitly when building
23589 programs that include large amounts of small data, including large
23590 GOT data sections. In this case, the 16-bit offset for GP-relative
23591 addressing may not be large enough to allow access to the entire
23592 small data section.
23593
23594 @item -mgprel-sec=@var{regexp}
23595 @opindex mgprel-sec
23596 This option specifies additional section names that can be accessed via
23597 GP-relative addressing. It is most useful in conjunction with
23598 @code{section} attributes on variable declarations
23599 (@pxref{Common Variable Attributes}) and a custom linker script.
23600 The @var{regexp} is a POSIX Extended Regular Expression.
23601
23602 This option does not affect the behavior of the @option{-G} option, and
23603 the specified sections are in addition to the standard @code{.sdata}
23604 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23605
23606 @item -mr0rel-sec=@var{regexp}
23607 @opindex mr0rel-sec
23608 This option specifies names of sections that can be accessed via a
23609 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23610 of the 32-bit address space. It is most useful in conjunction with
23611 @code{section} attributes on variable declarations
23612 (@pxref{Common Variable Attributes}) and a custom linker script.
23613 The @var{regexp} is a POSIX Extended Regular Expression.
23614
23615 In contrast to the use of GP-relative addressing for small data,
23616 zero-based addressing is never generated by default and there are no
23617 conventional section names used in standard linker scripts for sections
23618 in the low or high areas of memory.
23619
23620 @item -mel
23621 @itemx -meb
23622 @opindex mel
23623 @opindex meb
23624 Generate little-endian (default) or big-endian (experimental) code,
23625 respectively.
23626
23627 @item -march=@var{arch}
23628 @opindex march
23629 This specifies the name of the target Nios II architecture. GCC uses this
23630 name to determine what kind of instructions it can emit when generating
23631 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23632
23633 The preprocessor macro @code{__nios2_arch__} is available to programs,
23634 with value 1 or 2, indicating the targeted ISA level.
23635
23636 @item -mbypass-cache
23637 @itemx -mno-bypass-cache
23638 @opindex mno-bypass-cache
23639 @opindex mbypass-cache
23640 Force all load and store instructions to always bypass cache by
23641 using I/O variants of the instructions. The default is not to
23642 bypass the cache.
23643
23644 @item -mno-cache-volatile
23645 @itemx -mcache-volatile
23646 @opindex mcache-volatile
23647 @opindex mno-cache-volatile
23648 Volatile memory access bypass the cache using the I/O variants of
23649 the load and store instructions. The default is not to bypass the cache.
23650
23651 @item -mno-fast-sw-div
23652 @itemx -mfast-sw-div
23653 @opindex mno-fast-sw-div
23654 @opindex mfast-sw-div
23655 Do not use table-based fast divide for small numbers. The default
23656 is to use the fast divide at @option{-O3} and above.
23657
23658 @item -mno-hw-mul
23659 @itemx -mhw-mul
23660 @itemx -mno-hw-mulx
23661 @itemx -mhw-mulx
23662 @itemx -mno-hw-div
23663 @itemx -mhw-div
23664 @opindex mno-hw-mul
23665 @opindex mhw-mul
23666 @opindex mno-hw-mulx
23667 @opindex mhw-mulx
23668 @opindex mno-hw-div
23669 @opindex mhw-div
23670 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23671 instructions by the compiler. The default is to emit @code{mul}
23672 and not emit @code{div} and @code{mulx}.
23673
23674 @item -mbmx
23675 @itemx -mno-bmx
23676 @itemx -mcdx
23677 @itemx -mno-cdx
23678 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23679 CDX (code density) instructions. Enabling these instructions also
23680 requires @option{-march=r2}. Since these instructions are optional
23681 extensions to the R2 architecture, the default is not to emit them.
23682
23683 @item -mcustom-@var{insn}=@var{N}
23684 @itemx -mno-custom-@var{insn}
23685 @opindex mcustom-@var{insn}
23686 @opindex mno-custom-@var{insn}
23687 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23688 custom instruction with encoding @var{N} when generating code that uses
23689 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23690 instruction 253 for single-precision floating-point add operations instead
23691 of the default behavior of using a library call.
23692
23693 The following values of @var{insn} are supported. Except as otherwise
23694 noted, floating-point operations are expected to be implemented with
23695 normal IEEE 754 semantics and correspond directly to the C operators or the
23696 equivalent GCC built-in functions (@pxref{Other Builtins}).
23697
23698 Single-precision floating point:
23699 @table @asis
23700
23701 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23702 Binary arithmetic operations.
23703
23704 @item @samp{fnegs}
23705 Unary negation.
23706
23707 @item @samp{fabss}
23708 Unary absolute value.
23709
23710 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23711 Comparison operations.
23712
23713 @item @samp{fmins}, @samp{fmaxs}
23714 Floating-point minimum and maximum. These instructions are only
23715 generated if @option{-ffinite-math-only} is specified.
23716
23717 @item @samp{fsqrts}
23718 Unary square root operation.
23719
23720 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23721 Floating-point trigonometric and exponential functions. These instructions
23722 are only generated if @option{-funsafe-math-optimizations} is also specified.
23723
23724 @end table
23725
23726 Double-precision floating point:
23727 @table @asis
23728
23729 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23730 Binary arithmetic operations.
23731
23732 @item @samp{fnegd}
23733 Unary negation.
23734
23735 @item @samp{fabsd}
23736 Unary absolute value.
23737
23738 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23739 Comparison operations.
23740
23741 @item @samp{fmind}, @samp{fmaxd}
23742 Double-precision minimum and maximum. These instructions are only
23743 generated if @option{-ffinite-math-only} is specified.
23744
23745 @item @samp{fsqrtd}
23746 Unary square root operation.
23747
23748 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23749 Double-precision trigonometric and exponential functions. These instructions
23750 are only generated if @option{-funsafe-math-optimizations} is also specified.
23751
23752 @end table
23753
23754 Conversions:
23755 @table @asis
23756 @item @samp{fextsd}
23757 Conversion from single precision to double precision.
23758
23759 @item @samp{ftruncds}
23760 Conversion from double precision to single precision.
23761
23762 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23763 Conversion from floating point to signed or unsigned integer types, with
23764 truncation towards zero.
23765
23766 @item @samp{round}
23767 Conversion from single-precision floating point to signed integer,
23768 rounding to the nearest integer and ties away from zero.
23769 This corresponds to the @code{__builtin_lroundf} function when
23770 @option{-fno-math-errno} is used.
23771
23772 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23773 Conversion from signed or unsigned integer types to floating-point types.
23774
23775 @end table
23776
23777 In addition, all of the following transfer instructions for internal
23778 registers X and Y must be provided to use any of the double-precision
23779 floating-point instructions. Custom instructions taking two
23780 double-precision source operands expect the first operand in the
23781 64-bit register X. The other operand (or only operand of a unary
23782 operation) is given to the custom arithmetic instruction with the
23783 least significant half in source register @var{src1} and the most
23784 significant half in @var{src2}. A custom instruction that returns a
23785 double-precision result returns the most significant 32 bits in the
23786 destination register and the other half in 32-bit register Y.
23787 GCC automatically generates the necessary code sequences to write
23788 register X and/or read register Y when double-precision floating-point
23789 instructions are used.
23790
23791 @table @asis
23792
23793 @item @samp{fwrx}
23794 Write @var{src1} into the least significant half of X and @var{src2} into
23795 the most significant half of X.
23796
23797 @item @samp{fwry}
23798 Write @var{src1} into Y.
23799
23800 @item @samp{frdxhi}, @samp{frdxlo}
23801 Read the most or least (respectively) significant half of X and store it in
23802 @var{dest}.
23803
23804 @item @samp{frdy}
23805 Read the value of Y and store it into @var{dest}.
23806 @end table
23807
23808 Note that you can gain more local control over generation of Nios II custom
23809 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23810 and @code{target("no-custom-@var{insn}")} function attributes
23811 (@pxref{Function Attributes})
23812 or pragmas (@pxref{Function Specific Option Pragmas}).
23813
23814 @item -mcustom-fpu-cfg=@var{name}
23815 @opindex mcustom-fpu-cfg
23816
23817 This option enables a predefined, named set of custom instruction encodings
23818 (see @option{-mcustom-@var{insn}} above).
23819 Currently, the following sets are defined:
23820
23821 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23822 @gccoptlist{-mcustom-fmuls=252 @gol
23823 -mcustom-fadds=253 @gol
23824 -mcustom-fsubs=254 @gol
23825 -fsingle-precision-constant}
23826
23827 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23828 @gccoptlist{-mcustom-fmuls=252 @gol
23829 -mcustom-fadds=253 @gol
23830 -mcustom-fsubs=254 @gol
23831 -mcustom-fdivs=255 @gol
23832 -fsingle-precision-constant}
23833
23834 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23835 @gccoptlist{-mcustom-floatus=243 @gol
23836 -mcustom-fixsi=244 @gol
23837 -mcustom-floatis=245 @gol
23838 -mcustom-fcmpgts=246 @gol
23839 -mcustom-fcmples=249 @gol
23840 -mcustom-fcmpeqs=250 @gol
23841 -mcustom-fcmpnes=251 @gol
23842 -mcustom-fmuls=252 @gol
23843 -mcustom-fadds=253 @gol
23844 -mcustom-fsubs=254 @gol
23845 -mcustom-fdivs=255 @gol
23846 -fsingle-precision-constant}
23847
23848 Custom instruction assignments given by individual
23849 @option{-mcustom-@var{insn}=} options override those given by
23850 @option{-mcustom-fpu-cfg=}, regardless of the
23851 order of the options on the command line.
23852
23853 Note that you can gain more local control over selection of a FPU
23854 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23855 function attribute (@pxref{Function Attributes})
23856 or pragma (@pxref{Function Specific Option Pragmas}).
23857
23858 @end table
23859
23860 These additional @samp{-m} options are available for the Altera Nios II
23861 ELF (bare-metal) target:
23862
23863 @table @gcctabopt
23864
23865 @item -mhal
23866 @opindex mhal
23867 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23868 startup and termination code, and is typically used in conjunction with
23869 @option{-msys-crt0=} to specify the location of the alternate startup code
23870 provided by the HAL BSP.
23871
23872 @item -msmallc
23873 @opindex msmallc
23874 Link with a limited version of the C library, @option{-lsmallc}, rather than
23875 Newlib.
23876
23877 @item -msys-crt0=@var{startfile}
23878 @opindex msys-crt0
23879 @var{startfile} is the file name of the startfile (crt0) to use
23880 when linking. This option is only useful in conjunction with @option{-mhal}.
23881
23882 @item -msys-lib=@var{systemlib}
23883 @opindex msys-lib
23884 @var{systemlib} is the library name of the library that provides
23885 low-level system calls required by the C library,
23886 e.g.@: @code{read} and @code{write}.
23887 This option is typically used to link with a library provided by a HAL BSP.
23888
23889 @end table
23890
23891 @node Nvidia PTX Options
23892 @subsection Nvidia PTX Options
23893 @cindex Nvidia PTX options
23894 @cindex nvptx options
23895
23896 These options are defined for Nvidia PTX:
23897
23898 @table @gcctabopt
23899
23900 @item -m32
23901 @itemx -m64
23902 @opindex m32
23903 @opindex m64
23904 Generate code for 32-bit or 64-bit ABI.
23905
23906 @item -misa=@var{ISA-string}
23907 @opindex march
23908 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23909 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23910 @samp{sm_35}. The default ISA is sm_30.
23911
23912 @item -mmainkernel
23913 @opindex mmainkernel
23914 Link in code for a __main kernel. This is for stand-alone instead of
23915 offloading execution.
23916
23917 @item -moptimize
23918 @opindex moptimize
23919 Apply partitioned execution optimizations. This is the default when any
23920 level of optimization is selected.
23921
23922 @item -msoft-stack
23923 @opindex msoft-stack
23924 Generate code that does not use @code{.local} memory
23925 directly for stack storage. Instead, a per-warp stack pointer is
23926 maintained explicitly. This enables variable-length stack allocation (with
23927 variable-length arrays or @code{alloca}), and when global memory is used for
23928 underlying storage, makes it possible to access automatic variables from other
23929 threads, or with atomic instructions. This code generation variant is used
23930 for OpenMP offloading, but the option is exposed on its own for the purpose
23931 of testing the compiler; to generate code suitable for linking into programs
23932 using OpenMP offloading, use option @option{-mgomp}.
23933
23934 @item -muniform-simt
23935 @opindex muniform-simt
23936 Switch to code generation variant that allows to execute all threads in each
23937 warp, while maintaining memory state and side effects as if only one thread
23938 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23939 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23940 current lane index equals the master lane index), and the register being
23941 assigned is copied via a shuffle instruction from the master lane. Outside of
23942 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23943 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23944 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23945 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23946 with current lane index to compute the master lane index.
23947
23948 @item -mgomp
23949 @opindex mgomp
23950 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23951 @option{-muniform-simt} options, and selects corresponding multilib variant.
23952
23953 @end table
23954
23955 @node OpenRISC Options
23956 @subsection OpenRISC Options
23957 @cindex OpenRISC Options
23958
23959 These options are defined for OpenRISC:
23960
23961 @table @gcctabopt
23962
23963 @item -mboard=@var{name}
23964 @opindex mboard
23965 Configure a board specific runtime. This will be passed to the linker for
23966 newlib board library linking. The default is @code{or1ksim}.
23967
23968 @item -mnewlib
23969 @opindex mnewlib
23970 This option is ignored; it is for compatibility purposes only. This used to
23971 select linker and preprocessor options for use with newlib.
23972
23973 @item -msoft-div
23974 @itemx -mhard-div
23975 @opindex msoft-div
23976 @opindex mhard-div
23977 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23978 This default is hardware divide.
23979
23980 @item -msoft-mul
23981 @itemx -mhard-mul
23982 @opindex msoft-mul
23983 @opindex mhard-mul
23984 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23985 This default is hardware multiply.
23986
23987 @item -msoft-float
23988 @itemx -mhard-float
23989 @opindex msoft-float
23990 @opindex mhard-float
23991 Select software or hardware for floating point operations.
23992 The default is software.
23993
23994 @item -mdouble-float
23995 @opindex mdouble-float
23996 When @option{-mhard-float} is selected, enables generation of double-precision
23997 floating point instructions. By default functions from @file{libgcc} are used
23998 to perform double-precision floating point operations.
23999
24000 @item -munordered-float
24001 @opindex munordered-float
24002 When @option{-mhard-float} is selected, enables generation of unordered
24003 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
24004 functions from @file{libgcc} are used to perform unordered floating point
24005 compare and set flag operations.
24006
24007 @item -mcmov
24008 @opindex mcmov
24009 Enable generation of conditional move (@code{l.cmov}) instructions. By
24010 default the equivalent will be generated using using set and branch.
24011
24012 @item -mror
24013 @opindex mror
24014 Enable generation of rotate right (@code{l.ror}) instructions. By default
24015 functions from @file{libgcc} are used to perform rotate right operations.
24016
24017 @item -mrori
24018 @opindex mrori
24019 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
24020 By default functions from @file{libgcc} are used to perform rotate right with
24021 immediate operations.
24022
24023 @item -msext
24024 @opindex msext
24025 Enable generation of sign extension (@code{l.ext*}) instructions. By default
24026 memory loads are used to perform sign extension.
24027
24028 @item -msfimm
24029 @opindex msfimm
24030 Enable generation of compare and set flag with immediate (@code{l.sf*i})
24031 instructions. By default extra instructions will be generated to store the
24032 immediate to a register first.
24033
24034 @item -mshftimm
24035 @opindex mshftimm
24036 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
24037 @code{l.slli}) instructions. By default extra instructions will be generated
24038 to store the immediate to a register first.
24039
24040
24041 @end table
24042
24043 @node PDP-11 Options
24044 @subsection PDP-11 Options
24045 @cindex PDP-11 Options
24046
24047 These options are defined for the PDP-11:
24048
24049 @table @gcctabopt
24050 @item -mfpu
24051 @opindex mfpu
24052 Use hardware FPP floating point. This is the default. (FIS floating
24053 point on the PDP-11/40 is not supported.) Implies -m45.
24054
24055 @item -msoft-float
24056 @opindex msoft-float
24057 Do not use hardware floating point.
24058
24059 @item -mac0
24060 @opindex mac0
24061 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
24062
24063 @item -mno-ac0
24064 @opindex mno-ac0
24065 Return floating-point results in memory. This is the default.
24066
24067 @item -m40
24068 @opindex m40
24069 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
24070
24071 @item -m45
24072 @opindex m45
24073 Generate code for a PDP-11/45. This is the default.
24074
24075 @item -m10
24076 @opindex m10
24077 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
24078
24079 @item -mint16
24080 @itemx -mno-int32
24081 @opindex mint16
24082 @opindex mno-int32
24083 Use 16-bit @code{int}. This is the default.
24084
24085 @item -mint32
24086 @itemx -mno-int16
24087 @opindex mint32
24088 @opindex mno-int16
24089 Use 32-bit @code{int}.
24090
24091 @item -msplit
24092 @opindex msplit
24093 Target has split instruction and data space. Implies -m45.
24094
24095 @item -munix-asm
24096 @opindex munix-asm
24097 Use Unix assembler syntax.
24098
24099 @item -mdec-asm
24100 @opindex mdec-asm
24101 Use DEC assembler syntax.
24102
24103 @item -mgnu-asm
24104 @opindex mgnu-asm
24105 Use GNU assembler syntax. This is the default.
24106
24107 @item -mlra
24108 @opindex mlra
24109 Use the new LRA register allocator. By default, the old ``reload''
24110 allocator is used.
24111 @end table
24112
24113 @node picoChip Options
24114 @subsection picoChip Options
24115 @cindex picoChip options
24116
24117 These @samp{-m} options are defined for picoChip implementations:
24118
24119 @table @gcctabopt
24120
24121 @item -mae=@var{ae_type}
24122 @opindex mcpu
24123 Set the instruction set, register set, and instruction scheduling
24124 parameters for array element type @var{ae_type}. Supported values
24125 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
24126
24127 @option{-mae=ANY} selects a completely generic AE type. Code
24128 generated with this option runs on any of the other AE types. The
24129 code is not as efficient as it would be if compiled for a specific
24130 AE type, and some types of operation (e.g., multiplication) do not
24131 work properly on all types of AE.
24132
24133 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
24134 for compiled code, and is the default.
24135
24136 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
24137 option may suffer from poor performance of byte (char) manipulation,
24138 since the DSP AE does not provide hardware support for byte load/stores.
24139
24140 @item -msymbol-as-address
24141 Enable the compiler to directly use a symbol name as an address in a
24142 load/store instruction, without first loading it into a
24143 register. Typically, the use of this option generates larger
24144 programs, which run faster than when the option isn't used. However, the
24145 results vary from program to program, so it is left as a user option,
24146 rather than being permanently enabled.
24147
24148 @item -mno-inefficient-warnings
24149 Disables warnings about the generation of inefficient code. These
24150 warnings can be generated, for example, when compiling code that
24151 performs byte-level memory operations on the MAC AE type. The MAC AE has
24152 no hardware support for byte-level memory operations, so all byte
24153 load/stores must be synthesized from word load/store operations. This is
24154 inefficient and a warning is generated to indicate
24155 that you should rewrite the code to avoid byte operations, or to target
24156 an AE type that has the necessary hardware support. This option disables
24157 these warnings.
24158
24159 @end table
24160
24161 @node PowerPC Options
24162 @subsection PowerPC Options
24163 @cindex PowerPC options
24164
24165 These are listed under @xref{RS/6000 and PowerPC Options}.
24166
24167 @node PRU Options
24168 @subsection PRU Options
24169 @cindex PRU Options
24170
24171 These command-line options are defined for PRU target:
24172
24173 @table @gcctabopt
24174 @item -minrt
24175 @opindex minrt
24176 Link with a minimum runtime environment, with no support for static
24177 initializers and constructors. Using this option can significantly reduce
24178 the size of the final ELF binary. Beware that the compiler could still
24179 generate code with static initializers and constructors. It is up to the
24180 programmer to ensure that the source program will not use those features.
24181
24182 @item -mmcu=@var{mcu}
24183 @opindex mmcu
24184 Specify the PRU MCU variant to use. Check Newlib for the exact list of
24185 supported MCUs.
24186
24187 @item -mno-relax
24188 @opindex mno-relax
24189 Make GCC pass the @option{--no-relax} command-line option to the linker
24190 instead of the @option{--relax} option.
24191
24192 @item -mloop
24193 @opindex mloop
24194 Allow (or do not allow) GCC to use the LOOP instruction.
24195
24196 @item -mabi=@var{variant}
24197 @opindex mabi
24198 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
24199 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
24200 more naturally with certain GCC assumptions. These are the differences:
24201
24202 @table @samp
24203 @item Function Pointer Size
24204 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
24205 supports only 32-bit data and code pointers.
24206
24207 @item Optional Return Value Pointer
24208 Function return values larger than 64 bits are passed by using a hidden
24209 pointer as the first argument of the function. TI ABI, though, mandates that
24210 the pointer can be NULL in case the caller is not using the returned value.
24211 GNU always passes and expects a valid return value pointer.
24212
24213 @end table
24214
24215 The current @option{-mabi=ti} implementation simply raises a compile error
24216 when any of the above code constructs is detected. As a consequence
24217 the standard C library cannot be built and it is omitted when linking with
24218 @option{-mabi=ti}.
24219
24220 Relaxation is a GNU feature and for safety reasons is disabled when using
24221 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
24222 instructions, so the GNU linker cannot adjust them when shortening adjacent
24223 LDI32 pseudo instructions.
24224
24225 @end table
24226
24227 @node RISC-V Options
24228 @subsection RISC-V Options
24229 @cindex RISC-V Options
24230
24231 These command-line options are defined for RISC-V targets:
24232
24233 @table @gcctabopt
24234 @item -mbranch-cost=@var{n}
24235 @opindex mbranch-cost
24236 Set the cost of branches to roughly @var{n} instructions.
24237
24238 @item -mplt
24239 @itemx -mno-plt
24240 @opindex plt
24241 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24242 non-PIC. The default is @option{-mplt}.
24243
24244 @item -mabi=@var{ABI-string}
24245 @opindex mabi
24246 Specify integer and floating-point calling convention. @var{ABI-string}
24247 contains two parts: the size of integer types and the registers used for
24248 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24249 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24250 32-bit), and that floating-point values up to 64 bits wide are passed in F
24251 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24252 allows the compiler to generate code that uses the F and D extensions but only
24253 allows floating-point values up to 32 bits long to be passed in registers; or
24254 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24255 passed in registers.
24256
24257 The default for this argument is system dependent, users who want a specific
24258 calling convention should specify one explicitly. The valid calling
24259 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24260 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24261 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24262 invalid because the ABI requires 64-bit values be passed in F registers, but F
24263 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24264 only be used with the @samp{rv32e} architecture. This ABI is not well
24265 specified at present, and is subject to change.
24266
24267 @item -mfdiv
24268 @itemx -mno-fdiv
24269 @opindex mfdiv
24270 Do or don't use hardware floating-point divide and square root instructions.
24271 This requires the F or D extensions for floating-point registers. The default
24272 is to use them if the specified architecture has these instructions.
24273
24274 @item -mdiv
24275 @itemx -mno-div
24276 @opindex mdiv
24277 Do or don't use hardware instructions for integer division. This requires the
24278 M extension. The default is to use them if the specified architecture has
24279 these instructions.
24280
24281 @item -march=@var{ISA-string}
24282 @opindex march
24283 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24284 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24285 @samp{rv32imaf}.
24286
24287 @item -mtune=@var{processor-string}
24288 @opindex mtune
24289 Optimize the output for the given processor, specified by microarchitecture
24290 name. Permissible values for this option are: @samp{rocket},
24291 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24292 and @samp{size}.
24293
24294 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24295
24296 The @samp{size} choice is not intended for use by end-users. This is used
24297 when @option{-Os} is specified. It overrides the instruction cost info
24298 provided by @option{-mtune=}, but does not override the pipeline info. This
24299 helps reduce code size while still giving good performance.
24300
24301 @item -mpreferred-stack-boundary=@var{num}
24302 @opindex mpreferred-stack-boundary
24303 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24304 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24305 the default is 4 (16 bytes or 128-bits).
24306
24307 @strong{Warning:} If you use this switch, then you must build all modules with
24308 the same value, including any libraries. This includes the system libraries
24309 and startup modules.
24310
24311 @item -msmall-data-limit=@var{n}
24312 @opindex msmall-data-limit
24313 Put global and static data smaller than @var{n} bytes into a special section
24314 (on some targets).
24315
24316 @item -msave-restore
24317 @itemx -mno-save-restore
24318 @opindex msave-restore
24319 Do or don't use smaller but slower prologue and epilogue code that uses
24320 library function calls. The default is to use fast inline prologues and
24321 epilogues.
24322
24323 @item -mstrict-align
24324 @itemx -mno-strict-align
24325 @opindex mstrict-align
24326 Do not or do generate unaligned memory accesses. The default is set depending
24327 on whether the processor we are optimizing for supports fast unaligned access
24328 or not.
24329
24330 @item -mcmodel=medlow
24331 @opindex mcmodel=medlow
24332 Generate code for the medium-low code model. The program and its statically
24333 defined symbols must lie within a single 2 GiB address range and must lie
24334 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24335 statically or dynamically linked. This is the default code model.
24336
24337 @item -mcmodel=medany
24338 @opindex mcmodel=medany
24339 Generate code for the medium-any code model. The program and its statically
24340 defined symbols must be within any single 2 GiB address range. Programs can be
24341 statically or dynamically linked.
24342
24343 @item -mexplicit-relocs
24344 @itemx -mno-exlicit-relocs
24345 Use or do not use assembler relocation operators when dealing with symbolic
24346 addresses. The alternative is to use assembler macros instead, which may
24347 limit optimization.
24348
24349 @item -mrelax
24350 @itemx -mno-relax
24351 Take advantage of linker relaxations to reduce the number of instructions
24352 required to materialize symbol addresses. The default is to take advantage of
24353 linker relaxations.
24354
24355 @item -memit-attribute
24356 @itemx -mno-emit-attribute
24357 Emit (do not emit) RISC-V attribute to record extra information into ELF
24358 objects. This feature requires at least binutils 2.32.
24359
24360 @item -malign-data=@var{type}
24361 @opindex malign-data
24362 Control how GCC aligns variables and constants of array, structure, or union
24363 types. Supported values for @var{type} are @samp{xlen} which uses x register
24364 width as the alignment value, and @samp{natural} which uses natural alignment.
24365 @samp{xlen} is the default.
24366 @end table
24367
24368 @node RL78 Options
24369 @subsection RL78 Options
24370 @cindex RL78 Options
24371
24372 @table @gcctabopt
24373
24374 @item -msim
24375 @opindex msim
24376 Links in additional target libraries to support operation within a
24377 simulator.
24378
24379 @item -mmul=none
24380 @itemx -mmul=g10
24381 @itemx -mmul=g13
24382 @itemx -mmul=g14
24383 @itemx -mmul=rl78
24384 @opindex mmul
24385 Specifies the type of hardware multiplication and division support to
24386 be used. The simplest is @code{none}, which uses software for both
24387 multiplication and division. This is the default. The @code{g13}
24388 value is for the hardware multiply/divide peripheral found on the
24389 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24390 the multiplication and division instructions supported by the RL78/G14
24391 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24392 the value @code{mg10} is an alias for @code{none}.
24393
24394 In addition a C preprocessor macro is defined, based upon the setting
24395 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24396 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24397
24398 @item -mcpu=g10
24399 @itemx -mcpu=g13
24400 @itemx -mcpu=g14
24401 @itemx -mcpu=rl78
24402 @opindex mcpu
24403 Specifies the RL78 core to target. The default is the G14 core, also
24404 known as an S3 core or just RL78. The G13 or S2 core does not have
24405 multiply or divide instructions, instead it uses a hardware peripheral
24406 for these operations. The G10 or S1 core does not have register
24407 banks, so it uses a different calling convention.
24408
24409 If this option is set it also selects the type of hardware multiply
24410 support to use, unless this is overridden by an explicit
24411 @option{-mmul=none} option on the command line. Thus specifying
24412 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24413 peripheral and specifying @option{-mcpu=g10} disables the use of
24414 hardware multiplications altogether.
24415
24416 Note, although the RL78/G14 core is the default target, specifying
24417 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24418 change the behavior of the toolchain since it also enables G14
24419 hardware multiply support. If these options are not specified on the
24420 command line then software multiplication routines will be used even
24421 though the code targets the RL78 core. This is for backwards
24422 compatibility with older toolchains which did not have hardware
24423 multiply and divide support.
24424
24425 In addition a C preprocessor macro is defined, based upon the setting
24426 of this option. Possible values are: @code{__RL78_G10__},
24427 @code{__RL78_G13__} or @code{__RL78_G14__}.
24428
24429 @item -mg10
24430 @itemx -mg13
24431 @itemx -mg14
24432 @itemx -mrl78
24433 @opindex mg10
24434 @opindex mg13
24435 @opindex mg14
24436 @opindex mrl78
24437 These are aliases for the corresponding @option{-mcpu=} option. They
24438 are provided for backwards compatibility.
24439
24440 @item -mallregs
24441 @opindex mallregs
24442 Allow the compiler to use all of the available registers. By default
24443 registers @code{r24..r31} are reserved for use in interrupt handlers.
24444 With this option enabled these registers can be used in ordinary
24445 functions as well.
24446
24447 @item -m64bit-doubles
24448 @itemx -m32bit-doubles
24449 @opindex m64bit-doubles
24450 @opindex m32bit-doubles
24451 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24452 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24453 @option{-m32bit-doubles}.
24454
24455 @item -msave-mduc-in-interrupts
24456 @itemx -mno-save-mduc-in-interrupts
24457 @opindex msave-mduc-in-interrupts
24458 @opindex mno-save-mduc-in-interrupts
24459 Specifies that interrupt handler functions should preserve the
24460 MDUC registers. This is only necessary if normal code might use
24461 the MDUC registers, for example because it performs multiplication
24462 and division operations. The default is to ignore the MDUC registers
24463 as this makes the interrupt handlers faster. The target option -mg13
24464 needs to be passed for this to work as this feature is only available
24465 on the G13 target (S2 core). The MDUC registers will only be saved
24466 if the interrupt handler performs a multiplication or division
24467 operation or it calls another function.
24468
24469 @end table
24470
24471 @node RS/6000 and PowerPC Options
24472 @subsection IBM RS/6000 and PowerPC Options
24473 @cindex RS/6000 and PowerPC Options
24474 @cindex IBM RS/6000 and PowerPC Options
24475
24476 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24477 @table @gcctabopt
24478 @item -mpowerpc-gpopt
24479 @itemx -mno-powerpc-gpopt
24480 @itemx -mpowerpc-gfxopt
24481 @itemx -mno-powerpc-gfxopt
24482 @need 800
24483 @itemx -mpowerpc64
24484 @itemx -mno-powerpc64
24485 @itemx -mmfcrf
24486 @itemx -mno-mfcrf
24487 @itemx -mpopcntb
24488 @itemx -mno-popcntb
24489 @itemx -mpopcntd
24490 @itemx -mno-popcntd
24491 @itemx -mfprnd
24492 @itemx -mno-fprnd
24493 @need 800
24494 @itemx -mcmpb
24495 @itemx -mno-cmpb
24496 @itemx -mhard-dfp
24497 @itemx -mno-hard-dfp
24498 @opindex mpowerpc-gpopt
24499 @opindex mno-powerpc-gpopt
24500 @opindex mpowerpc-gfxopt
24501 @opindex mno-powerpc-gfxopt
24502 @opindex mpowerpc64
24503 @opindex mno-powerpc64
24504 @opindex mmfcrf
24505 @opindex mno-mfcrf
24506 @opindex mpopcntb
24507 @opindex mno-popcntb
24508 @opindex mpopcntd
24509 @opindex mno-popcntd
24510 @opindex mfprnd
24511 @opindex mno-fprnd
24512 @opindex mcmpb
24513 @opindex mno-cmpb
24514 @opindex mhard-dfp
24515 @opindex mno-hard-dfp
24516 You use these options to specify which instructions are available on the
24517 processor you are using. The default value of these options is
24518 determined when configuring GCC@. Specifying the
24519 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24520 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24521 rather than the options listed above.
24522
24523 Specifying @option{-mpowerpc-gpopt} allows
24524 GCC to use the optional PowerPC architecture instructions in the
24525 General Purpose group, including floating-point square root. Specifying
24526 @option{-mpowerpc-gfxopt} allows GCC to
24527 use the optional PowerPC architecture instructions in the Graphics
24528 group, including floating-point select.
24529
24530 The @option{-mmfcrf} option allows GCC to generate the move from
24531 condition register field instruction implemented on the POWER4
24532 processor and other processors that support the PowerPC V2.01
24533 architecture.
24534 The @option{-mpopcntb} option allows GCC to generate the popcount and
24535 double-precision FP reciprocal estimate instruction implemented on the
24536 POWER5 processor and other processors that support the PowerPC V2.02
24537 architecture.
24538 The @option{-mpopcntd} option allows GCC to generate the popcount
24539 instruction implemented on the POWER7 processor and other processors
24540 that support the PowerPC V2.06 architecture.
24541 The @option{-mfprnd} option allows GCC to generate the FP round to
24542 integer instructions implemented on the POWER5+ processor and other
24543 processors that support the PowerPC V2.03 architecture.
24544 The @option{-mcmpb} option allows GCC to generate the compare bytes
24545 instruction implemented on the POWER6 processor and other processors
24546 that support the PowerPC V2.05 architecture.
24547 The @option{-mhard-dfp} option allows GCC to generate the decimal
24548 floating-point instructions implemented on some POWER processors.
24549
24550 The @option{-mpowerpc64} option allows GCC to generate the additional
24551 64-bit instructions that are found in the full PowerPC64 architecture
24552 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24553 @option{-mno-powerpc64}.
24554
24555 @item -mcpu=@var{cpu_type}
24556 @opindex mcpu
24557 Set architecture type, register usage, and
24558 instruction scheduling parameters for machine type @var{cpu_type}.
24559 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24560 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24561 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24562 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24563 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24564 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24565 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24566 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24567 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24568 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24569 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24570 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24571
24572 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24573 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24574 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24575 architecture machine types, with an appropriate, generic processor
24576 model assumed for scheduling purposes.
24577
24578 Specifying @samp{native} as cpu type detects and selects the
24579 architecture option that corresponds to the host processor of the
24580 system performing the compilation.
24581 @option{-mcpu=native} has no effect if GCC does not recognize the
24582 processor.
24583
24584 The other options specify a specific processor. Code generated under
24585 those options runs best on that processor, and may not run at all on
24586 others.
24587
24588 The @option{-mcpu} options automatically enable or disable the
24589 following options:
24590
24591 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24592 -mpopcntb -mpopcntd -mpowerpc64 @gol
24593 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24594 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24595 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24596 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24597
24598 The particular options set for any particular CPU varies between
24599 compiler versions, depending on what setting seems to produce optimal
24600 code for that CPU; it doesn't necessarily reflect the actual hardware's
24601 capabilities. If you wish to set an individual option to a particular
24602 value, you may specify it after the @option{-mcpu} option, like
24603 @option{-mcpu=970 -mno-altivec}.
24604
24605 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24606 not enabled or disabled by the @option{-mcpu} option at present because
24607 AIX does not have full support for these options. You may still
24608 enable or disable them individually if you're sure it'll work in your
24609 environment.
24610
24611 @item -mtune=@var{cpu_type}
24612 @opindex mtune
24613 Set the instruction scheduling parameters for machine type
24614 @var{cpu_type}, but do not set the architecture type or register usage,
24615 as @option{-mcpu=@var{cpu_type}} does. The same
24616 values for @var{cpu_type} are used for @option{-mtune} as for
24617 @option{-mcpu}. If both are specified, the code generated uses the
24618 architecture and registers set by @option{-mcpu}, but the
24619 scheduling parameters set by @option{-mtune}.
24620
24621 @item -mcmodel=small
24622 @opindex mcmodel=small
24623 Generate PowerPC64 code for the small model: The TOC is limited to
24624 64k.
24625
24626 @item -mcmodel=medium
24627 @opindex mcmodel=medium
24628 Generate PowerPC64 code for the medium model: The TOC and other static
24629 data may be up to a total of 4G in size. This is the default for 64-bit
24630 Linux.
24631
24632 @item -mcmodel=large
24633 @opindex mcmodel=large
24634 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24635 in size. Other data and code is only limited by the 64-bit address
24636 space.
24637
24638 @item -maltivec
24639 @itemx -mno-altivec
24640 @opindex maltivec
24641 @opindex mno-altivec
24642 Generate code that uses (does not use) AltiVec instructions, and also
24643 enable the use of built-in functions that allow more direct access to
24644 the AltiVec instruction set. You may also need to set
24645 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24646 enhancements.
24647
24648 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24649 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24650 match array element order corresponding to the endianness of the
24651 target. That is, element zero identifies the leftmost element in a
24652 vector register when targeting a big-endian platform, and identifies
24653 the rightmost element in a vector register when targeting a
24654 little-endian platform.
24655
24656 @item -mvrsave
24657 @itemx -mno-vrsave
24658 @opindex mvrsave
24659 @opindex mno-vrsave
24660 Generate VRSAVE instructions when generating AltiVec code.
24661
24662 @item -msecure-plt
24663 @opindex msecure-plt
24664 Generate code that allows @command{ld} and @command{ld.so}
24665 to build executables and shared
24666 libraries with non-executable @code{.plt} and @code{.got} sections.
24667 This is a PowerPC
24668 32-bit SYSV ABI option.
24669
24670 @item -mbss-plt
24671 @opindex mbss-plt
24672 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24673 fills in, and
24674 requires @code{.plt} and @code{.got}
24675 sections that are both writable and executable.
24676 This is a PowerPC 32-bit SYSV ABI option.
24677
24678 @item -misel
24679 @itemx -mno-isel
24680 @opindex misel
24681 @opindex mno-isel
24682 This switch enables or disables the generation of ISEL instructions.
24683
24684 @item -mvsx
24685 @itemx -mno-vsx
24686 @opindex mvsx
24687 @opindex mno-vsx
24688 Generate code that uses (does not use) vector/scalar (VSX)
24689 instructions, and also enable the use of built-in functions that allow
24690 more direct access to the VSX instruction set.
24691
24692 @item -mcrypto
24693 @itemx -mno-crypto
24694 @opindex mcrypto
24695 @opindex mno-crypto
24696 Enable the use (disable) of the built-in functions that allow direct
24697 access to the cryptographic instructions that were added in version
24698 2.07 of the PowerPC ISA.
24699
24700 @item -mhtm
24701 @itemx -mno-htm
24702 @opindex mhtm
24703 @opindex mno-htm
24704 Enable (disable) the use of the built-in functions that allow direct
24705 access to the Hardware Transactional Memory (HTM) instructions that
24706 were added in version 2.07 of the PowerPC ISA.
24707
24708 @item -mpower8-fusion
24709 @itemx -mno-power8-fusion
24710 @opindex mpower8-fusion
24711 @opindex mno-power8-fusion
24712 Generate code that keeps (does not keeps) some integer operations
24713 adjacent so that the instructions can be fused together on power8 and
24714 later processors.
24715
24716 @item -mpower8-vector
24717 @itemx -mno-power8-vector
24718 @opindex mpower8-vector
24719 @opindex mno-power8-vector
24720 Generate code that uses (does not use) the vector and scalar
24721 instructions that were added in version 2.07 of the PowerPC ISA. Also
24722 enable the use of built-in functions that allow more direct access to
24723 the vector instructions.
24724
24725 @item -mquad-memory
24726 @itemx -mno-quad-memory
24727 @opindex mquad-memory
24728 @opindex mno-quad-memory
24729 Generate code that uses (does not use) the non-atomic quad word memory
24730 instructions. The @option{-mquad-memory} option requires use of
24731 64-bit mode.
24732
24733 @item -mquad-memory-atomic
24734 @itemx -mno-quad-memory-atomic
24735 @opindex mquad-memory-atomic
24736 @opindex mno-quad-memory-atomic
24737 Generate code that uses (does not use) the atomic quad word memory
24738 instructions. The @option{-mquad-memory-atomic} option requires use of
24739 64-bit mode.
24740
24741 @item -mfloat128
24742 @itemx -mno-float128
24743 @opindex mfloat128
24744 @opindex mno-float128
24745 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24746 and use either software emulation for IEEE 128-bit floating point or
24747 hardware instructions.
24748
24749 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24750 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24751 use the IEEE 128-bit floating point support. The IEEE 128-bit
24752 floating point support only works on PowerPC Linux systems.
24753
24754 The default for @option{-mfloat128} is enabled on PowerPC Linux
24755 systems using the VSX instruction set, and disabled on other systems.
24756
24757 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24758 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24759 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24760 floating point instructions. Otherwise, if you do not specify to
24761 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24762 system, IEEE 128-bit floating point will be done with software
24763 emulation.
24764
24765 @item -mfloat128-hardware
24766 @itemx -mno-float128-hardware
24767 @opindex mfloat128-hardware
24768 @opindex mno-float128-hardware
24769 Enable/disable using ISA 3.0 hardware instructions to support the
24770 @var{__float128} data type.
24771
24772 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24773 Linux systems using the ISA 3.0 instruction set, and disabled on other
24774 systems.
24775
24776 @item -m32
24777 @itemx -m64
24778 @opindex m32
24779 @opindex m64
24780 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24781 targets (including GNU/Linux). The 32-bit environment sets int, long
24782 and pointer to 32 bits and generates code that runs on any PowerPC
24783 variant. The 64-bit environment sets int to 32 bits and long and
24784 pointer to 64 bits, and generates code for PowerPC64, as for
24785 @option{-mpowerpc64}.
24786
24787 @item -mfull-toc
24788 @itemx -mno-fp-in-toc
24789 @itemx -mno-sum-in-toc
24790 @itemx -mminimal-toc
24791 @opindex mfull-toc
24792 @opindex mno-fp-in-toc
24793 @opindex mno-sum-in-toc
24794 @opindex mminimal-toc
24795 Modify generation of the TOC (Table Of Contents), which is created for
24796 every executable file. The @option{-mfull-toc} option is selected by
24797 default. In that case, GCC allocates at least one TOC entry for
24798 each unique non-automatic variable reference in your program. GCC
24799 also places floating-point constants in the TOC@. However, only
24800 16,384 entries are available in the TOC@.
24801
24802 If you receive a linker error message that saying you have overflowed
24803 the available TOC space, you can reduce the amount of TOC space used
24804 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24805 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24806 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24807 generate code to calculate the sum of an address and a constant at
24808 run time instead of putting that sum into the TOC@. You may specify one
24809 or both of these options. Each causes GCC to produce very slightly
24810 slower and larger code at the expense of conserving TOC space.
24811
24812 If you still run out of space in the TOC even when you specify both of
24813 these options, specify @option{-mminimal-toc} instead. This option causes
24814 GCC to make only one TOC entry for every file. When you specify this
24815 option, GCC produces code that is slower and larger but which
24816 uses extremely little TOC space. You may wish to use this option
24817 only on files that contain less frequently-executed code.
24818
24819 @item -maix64
24820 @itemx -maix32
24821 @opindex maix64
24822 @opindex maix32
24823 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24824 @code{long} type, and the infrastructure needed to support them.
24825 Specifying @option{-maix64} implies @option{-mpowerpc64},
24826 while @option{-maix32} disables the 64-bit ABI and
24827 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24828
24829 @item -mxl-compat
24830 @itemx -mno-xl-compat
24831 @opindex mxl-compat
24832 @opindex mno-xl-compat
24833 Produce code that conforms more closely to IBM XL compiler semantics
24834 when using AIX-compatible ABI@. Pass floating-point arguments to
24835 prototyped functions beyond the register save area (RSA) on the stack
24836 in addition to argument FPRs. Do not assume that most significant
24837 double in 128-bit long double value is properly rounded when comparing
24838 values and converting to double. Use XL symbol names for long double
24839 support routines.
24840
24841 The AIX calling convention was extended but not initially documented to
24842 handle an obscure K&R C case of calling a function that takes the
24843 address of its arguments with fewer arguments than declared. IBM XL
24844 compilers access floating-point arguments that do not fit in the
24845 RSA from the stack when a subroutine is compiled without
24846 optimization. Because always storing floating-point arguments on the
24847 stack is inefficient and rarely needed, this option is not enabled by
24848 default and only is necessary when calling subroutines compiled by IBM
24849 XL compilers without optimization.
24850
24851 @item -mpe
24852 @opindex mpe
24853 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24854 application written to use message passing with special startup code to
24855 enable the application to run. The system must have PE installed in the
24856 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24857 must be overridden with the @option{-specs=} option to specify the
24858 appropriate directory location. The Parallel Environment does not
24859 support threads, so the @option{-mpe} option and the @option{-pthread}
24860 option are incompatible.
24861
24862 @item -malign-natural
24863 @itemx -malign-power
24864 @opindex malign-natural
24865 @opindex malign-power
24866 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24867 @option{-malign-natural} overrides the ABI-defined alignment of larger
24868 types, such as floating-point doubles, on their natural size-based boundary.
24869 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24870 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24871
24872 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24873 is not supported.
24874
24875 @item -msoft-float
24876 @itemx -mhard-float
24877 @opindex msoft-float
24878 @opindex mhard-float
24879 Generate code that does not use (uses) the floating-point register set.
24880 Software floating-point emulation is provided if you use the
24881 @option{-msoft-float} option, and pass the option to GCC when linking.
24882
24883 @item -mmultiple
24884 @itemx -mno-multiple
24885 @opindex mmultiple
24886 @opindex mno-multiple
24887 Generate code that uses (does not use) the load multiple word
24888 instructions and the store multiple word instructions. These
24889 instructions are generated by default on POWER systems, and not
24890 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24891 PowerPC systems, since those instructions do not work when the
24892 processor is in little-endian mode. The exceptions are PPC740 and
24893 PPC750 which permit these instructions in little-endian mode.
24894
24895 @item -mupdate
24896 @itemx -mno-update
24897 @opindex mupdate
24898 @opindex mno-update
24899 Generate code that uses (does not use) the load or store instructions
24900 that update the base register to the address of the calculated memory
24901 location. These instructions are generated by default. If you use
24902 @option{-mno-update}, there is a small window between the time that the
24903 stack pointer is updated and the address of the previous frame is
24904 stored, which means code that walks the stack frame across interrupts or
24905 signals may get corrupted data.
24906
24907 @item -mavoid-indexed-addresses
24908 @itemx -mno-avoid-indexed-addresses
24909 @opindex mavoid-indexed-addresses
24910 @opindex mno-avoid-indexed-addresses
24911 Generate code that tries to avoid (not avoid) the use of indexed load
24912 or store instructions. These instructions can incur a performance
24913 penalty on Power6 processors in certain situations, such as when
24914 stepping through large arrays that cross a 16M boundary. This option
24915 is enabled by default when targeting Power6 and disabled otherwise.
24916
24917 @item -mfused-madd
24918 @itemx -mno-fused-madd
24919 @opindex mfused-madd
24920 @opindex mno-fused-madd
24921 Generate code that uses (does not use) the floating-point multiply and
24922 accumulate instructions. These instructions are generated by default
24923 if hardware floating point is used. The machine-dependent
24924 @option{-mfused-madd} option is now mapped to the machine-independent
24925 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24926 mapped to @option{-ffp-contract=off}.
24927
24928 @item -mmulhw
24929 @itemx -mno-mulhw
24930 @opindex mmulhw
24931 @opindex mno-mulhw
24932 Generate code that uses (does not use) the half-word multiply and
24933 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24934 These instructions are generated by default when targeting those
24935 processors.
24936
24937 @item -mdlmzb
24938 @itemx -mno-dlmzb
24939 @opindex mdlmzb
24940 @opindex mno-dlmzb
24941 Generate code that uses (does not use) the string-search @samp{dlmzb}
24942 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24943 generated by default when targeting those processors.
24944
24945 @item -mno-bit-align
24946 @itemx -mbit-align
24947 @opindex mno-bit-align
24948 @opindex mbit-align
24949 On System V.4 and embedded PowerPC systems do not (do) force structures
24950 and unions that contain bit-fields to be aligned to the base type of the
24951 bit-field.
24952
24953 For example, by default a structure containing nothing but 8
24954 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24955 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24956 the structure is aligned to a 1-byte boundary and is 1 byte in
24957 size.
24958
24959 @item -mno-strict-align
24960 @itemx -mstrict-align
24961 @opindex mno-strict-align
24962 @opindex mstrict-align
24963 On System V.4 and embedded PowerPC systems do not (do) assume that
24964 unaligned memory references are handled by the system.
24965
24966 @item -mrelocatable
24967 @itemx -mno-relocatable
24968 @opindex mrelocatable
24969 @opindex mno-relocatable
24970 Generate code that allows (does not allow) a static executable to be
24971 relocated to a different address at run time. A simple embedded
24972 PowerPC system loader should relocate the entire contents of
24973 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24974 a table of 32-bit addresses generated by this option. For this to
24975 work, all objects linked together must be compiled with
24976 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24977 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24978
24979 @item -mrelocatable-lib
24980 @itemx -mno-relocatable-lib
24981 @opindex mrelocatable-lib
24982 @opindex mno-relocatable-lib
24983 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24984 @code{.fixup} section to allow static executables to be relocated at
24985 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24986 alignment of @option{-mrelocatable}. Objects compiled with
24987 @option{-mrelocatable-lib} may be linked with objects compiled with
24988 any combination of the @option{-mrelocatable} options.
24989
24990 @item -mno-toc
24991 @itemx -mtoc
24992 @opindex mno-toc
24993 @opindex mtoc
24994 On System V.4 and embedded PowerPC systems do not (do) assume that
24995 register 2 contains a pointer to a global area pointing to the addresses
24996 used in the program.
24997
24998 @item -mlittle
24999 @itemx -mlittle-endian
25000 @opindex mlittle
25001 @opindex mlittle-endian
25002 On System V.4 and embedded PowerPC systems compile code for the
25003 processor in little-endian mode. The @option{-mlittle-endian} option is
25004 the same as @option{-mlittle}.
25005
25006 @item -mbig
25007 @itemx -mbig-endian
25008 @opindex mbig
25009 @opindex mbig-endian
25010 On System V.4 and embedded PowerPC systems compile code for the
25011 processor in big-endian mode. The @option{-mbig-endian} option is
25012 the same as @option{-mbig}.
25013
25014 @item -mdynamic-no-pic
25015 @opindex mdynamic-no-pic
25016 On Darwin and Mac OS X systems, compile code so that it is not
25017 relocatable, but that its external references are relocatable. The
25018 resulting code is suitable for applications, but not shared
25019 libraries.
25020
25021 @item -msingle-pic-base
25022 @opindex msingle-pic-base
25023 Treat the register used for PIC addressing as read-only, rather than
25024 loading it in the prologue for each function. The runtime system is
25025 responsible for initializing this register with an appropriate value
25026 before execution begins.
25027
25028 @item -mprioritize-restricted-insns=@var{priority}
25029 @opindex mprioritize-restricted-insns
25030 This option controls the priority that is assigned to
25031 dispatch-slot restricted instructions during the second scheduling
25032 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
25033 or @samp{2} to assign no, highest, or second-highest (respectively)
25034 priority to dispatch-slot restricted
25035 instructions.
25036
25037 @item -msched-costly-dep=@var{dependence_type}
25038 @opindex msched-costly-dep
25039 This option controls which dependences are considered costly
25040 by the target during instruction scheduling. The argument
25041 @var{dependence_type} takes one of the following values:
25042
25043 @table @asis
25044 @item @samp{no}
25045 No dependence is costly.
25046
25047 @item @samp{all}
25048 All dependences are costly.
25049
25050 @item @samp{true_store_to_load}
25051 A true dependence from store to load is costly.
25052
25053 @item @samp{store_to_load}
25054 Any dependence from store to load is costly.
25055
25056 @item @var{number}
25057 Any dependence for which the latency is greater than or equal to
25058 @var{number} is costly.
25059 @end table
25060
25061 @item -minsert-sched-nops=@var{scheme}
25062 @opindex minsert-sched-nops
25063 This option controls which NOP insertion scheme is used during
25064 the second scheduling pass. The argument @var{scheme} takes one of the
25065 following values:
25066
25067 @table @asis
25068 @item @samp{no}
25069 Don't insert NOPs.
25070
25071 @item @samp{pad}
25072 Pad with NOPs any dispatch group that has vacant issue slots,
25073 according to the scheduler's grouping.
25074
25075 @item @samp{regroup_exact}
25076 Insert NOPs to force costly dependent insns into
25077 separate groups. Insert exactly as many NOPs as needed to force an insn
25078 to a new group, according to the estimated processor grouping.
25079
25080 @item @var{number}
25081 Insert NOPs to force costly dependent insns into
25082 separate groups. Insert @var{number} NOPs to force an insn to a new group.
25083 @end table
25084
25085 @item -mcall-sysv
25086 @opindex mcall-sysv
25087 On System V.4 and embedded PowerPC systems compile code using calling
25088 conventions that adhere to the March 1995 draft of the System V
25089 Application Binary Interface, PowerPC processor supplement. This is the
25090 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
25091
25092 @item -mcall-sysv-eabi
25093 @itemx -mcall-eabi
25094 @opindex mcall-sysv-eabi
25095 @opindex mcall-eabi
25096 Specify both @option{-mcall-sysv} and @option{-meabi} options.
25097
25098 @item -mcall-sysv-noeabi
25099 @opindex mcall-sysv-noeabi
25100 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
25101
25102 @item -mcall-aixdesc
25103 @opindex m
25104 On System V.4 and embedded PowerPC systems compile code for the AIX
25105 operating system.
25106
25107 @item -mcall-linux
25108 @opindex mcall-linux
25109 On System V.4 and embedded PowerPC systems compile code for the
25110 Linux-based GNU system.
25111
25112 @item -mcall-freebsd
25113 @opindex mcall-freebsd
25114 On System V.4 and embedded PowerPC systems compile code for the
25115 FreeBSD operating system.
25116
25117 @item -mcall-netbsd
25118 @opindex mcall-netbsd
25119 On System V.4 and embedded PowerPC systems compile code for the
25120 NetBSD operating system.
25121
25122 @item -mcall-openbsd
25123 @opindex mcall-netbsd
25124 On System V.4 and embedded PowerPC systems compile code for the
25125 OpenBSD operating system.
25126
25127 @item -mtraceback=@var{traceback_type}
25128 @opindex mtraceback
25129 Select the type of traceback table. Valid values for @var{traceback_type}
25130 are @samp{full}, @samp{part}, and @samp{no}.
25131
25132 @item -maix-struct-return
25133 @opindex maix-struct-return
25134 Return all structures in memory (as specified by the AIX ABI)@.
25135
25136 @item -msvr4-struct-return
25137 @opindex msvr4-struct-return
25138 Return structures smaller than 8 bytes in registers (as specified by the
25139 SVR4 ABI)@.
25140
25141 @item -mabi=@var{abi-type}
25142 @opindex mabi
25143 Extend the current ABI with a particular extension, or remove such extension.
25144 Valid values are @samp{altivec}, @samp{no-altivec},
25145 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25146 @samp{elfv1}, @samp{elfv2}@.
25147
25148 @item -mabi=ibmlongdouble
25149 @opindex mabi=ibmlongdouble
25150 Change the current ABI to use IBM extended-precision long double.
25151 This is not likely to work if your system defaults to using IEEE
25152 extended-precision long double. If you change the long double type
25153 from IEEE extended-precision, the compiler will issue a warning unless
25154 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25155 to be enabled.
25156
25157 @item -mabi=ieeelongdouble
25158 @opindex mabi=ieeelongdouble
25159 Change the current ABI to use IEEE extended-precision long double.
25160 This is not likely to work if your system defaults to using IBM
25161 extended-precision long double. If you change the long double type
25162 from IBM extended-precision, the compiler will issue a warning unless
25163 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25164 to be enabled.
25165
25166 @item -mabi=elfv1
25167 @opindex mabi=elfv1
25168 Change the current ABI to use the ELFv1 ABI.
25169 This is the default ABI for big-endian PowerPC 64-bit Linux.
25170 Overriding the default ABI requires special system support and is
25171 likely to fail in spectacular ways.
25172
25173 @item -mabi=elfv2
25174 @opindex mabi=elfv2
25175 Change the current ABI to use the ELFv2 ABI.
25176 This is the default ABI for little-endian PowerPC 64-bit Linux.
25177 Overriding the default ABI requires special system support and is
25178 likely to fail in spectacular ways.
25179
25180 @item -mgnu-attribute
25181 @itemx -mno-gnu-attribute
25182 @opindex mgnu-attribute
25183 @opindex mno-gnu-attribute
25184 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25185 .gnu.attributes section that specify ABI variations in function
25186 parameters or return values.
25187
25188 @item -mprototype
25189 @itemx -mno-prototype
25190 @opindex mprototype
25191 @opindex mno-prototype
25192 On System V.4 and embedded PowerPC systems assume that all calls to
25193 variable argument functions are properly prototyped. Otherwise, the
25194 compiler must insert an instruction before every non-prototyped call to
25195 set or clear bit 6 of the condition code register (@code{CR}) to
25196 indicate whether floating-point values are passed in the floating-point
25197 registers in case the function takes variable arguments. With
25198 @option{-mprototype}, only calls to prototyped variable argument functions
25199 set or clear the bit.
25200
25201 @item -msim
25202 @opindex msim
25203 On embedded PowerPC systems, assume that the startup module is called
25204 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25205 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25206 configurations.
25207
25208 @item -mmvme
25209 @opindex mmvme
25210 On embedded PowerPC systems, assume that the startup module is called
25211 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25212 @file{libc.a}.
25213
25214 @item -mads
25215 @opindex mads
25216 On embedded PowerPC systems, assume that the startup module is called
25217 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25218 @file{libc.a}.
25219
25220 @item -myellowknife
25221 @opindex myellowknife
25222 On embedded PowerPC systems, assume that the startup module is called
25223 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25224 @file{libc.a}.
25225
25226 @item -mvxworks
25227 @opindex mvxworks
25228 On System V.4 and embedded PowerPC systems, specify that you are
25229 compiling for a VxWorks system.
25230
25231 @item -memb
25232 @opindex memb
25233 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25234 header to indicate that @samp{eabi} extended relocations are used.
25235
25236 @item -meabi
25237 @itemx -mno-eabi
25238 @opindex meabi
25239 @opindex mno-eabi
25240 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25241 Embedded Applications Binary Interface (EABI), which is a set of
25242 modifications to the System V.4 specifications. Selecting @option{-meabi}
25243 means that the stack is aligned to an 8-byte boundary, a function
25244 @code{__eabi} is called from @code{main} to set up the EABI
25245 environment, and the @option{-msdata} option can use both @code{r2} and
25246 @code{r13} to point to two separate small data areas. Selecting
25247 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25248 no EABI initialization function is called from @code{main}, and the
25249 @option{-msdata} option only uses @code{r13} to point to a single
25250 small data area. The @option{-meabi} option is on by default if you
25251 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25252
25253 @item -msdata=eabi
25254 @opindex msdata=eabi
25255 On System V.4 and embedded PowerPC systems, put small initialized
25256 @code{const} global and static data in the @code{.sdata2} section, which
25257 is pointed to by register @code{r2}. Put small initialized
25258 non-@code{const} global and static data in the @code{.sdata} section,
25259 which is pointed to by register @code{r13}. Put small uninitialized
25260 global and static data in the @code{.sbss} section, which is adjacent to
25261 the @code{.sdata} section. The @option{-msdata=eabi} option is
25262 incompatible with the @option{-mrelocatable} option. The
25263 @option{-msdata=eabi} option also sets the @option{-memb} option.
25264
25265 @item -msdata=sysv
25266 @opindex msdata=sysv
25267 On System V.4 and embedded PowerPC systems, put small global and static
25268 data in the @code{.sdata} section, which is pointed to by register
25269 @code{r13}. Put small uninitialized global and static data in the
25270 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25271 The @option{-msdata=sysv} option is incompatible with the
25272 @option{-mrelocatable} option.
25273
25274 @item -msdata=default
25275 @itemx -msdata
25276 @opindex msdata=default
25277 @opindex msdata
25278 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25279 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25280 same as @option{-msdata=sysv}.
25281
25282 @item -msdata=data
25283 @opindex msdata=data
25284 On System V.4 and embedded PowerPC systems, put small global
25285 data in the @code{.sdata} section. Put small uninitialized global
25286 data in the @code{.sbss} section. Do not use register @code{r13}
25287 to address small data however. This is the default behavior unless
25288 other @option{-msdata} options are used.
25289
25290 @item -msdata=none
25291 @itemx -mno-sdata
25292 @opindex msdata=none
25293 @opindex mno-sdata
25294 On embedded PowerPC systems, put all initialized global and static data
25295 in the @code{.data} section, and all uninitialized data in the
25296 @code{.bss} section.
25297
25298 @item -mreadonly-in-sdata
25299 @opindex mreadonly-in-sdata
25300 @opindex mno-readonly-in-sdata
25301 Put read-only objects in the @code{.sdata} section as well. This is the
25302 default.
25303
25304 @item -mblock-move-inline-limit=@var{num}
25305 @opindex mblock-move-inline-limit
25306 Inline all block moves (such as calls to @code{memcpy} or structure
25307 copies) less than or equal to @var{num} bytes. The minimum value for
25308 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25309 targets. The default value is target-specific.
25310
25311 @item -mblock-compare-inline-limit=@var{num}
25312 @opindex mblock-compare-inline-limit
25313 Generate non-looping inline code for all block compares (such as calls
25314 to @code{memcmp} or structure compares) less than or equal to @var{num}
25315 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25316 block compare is disabled. The default value is target-specific.
25317
25318 @item -mblock-compare-inline-loop-limit=@var{num}
25319 @opindex mblock-compare-inline-loop-limit
25320 Generate an inline expansion using loop code for all block compares that
25321 are less than or equal to @var{num} bytes, but greater than the limit
25322 for non-loop inline block compare expansion. If the block length is not
25323 constant, at most @var{num} bytes will be compared before @code{memcmp}
25324 is called to compare the remainder of the block. The default value is
25325 target-specific.
25326
25327 @item -mstring-compare-inline-limit=@var{num}
25328 @opindex mstring-compare-inline-limit
25329 Compare at most @var{num} string bytes with inline code.
25330 If the difference or end of string is not found at the
25331 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25332 take care of the rest of the comparison. The default is 64 bytes.
25333
25334 @item -G @var{num}
25335 @opindex G
25336 @cindex smaller data references (PowerPC)
25337 @cindex .sdata/.sdata2 references (PowerPC)
25338 On embedded PowerPC systems, put global and static items less than or
25339 equal to @var{num} bytes into the small data or BSS sections instead of
25340 the normal data or BSS section. By default, @var{num} is 8. The
25341 @option{-G @var{num}} switch is also passed to the linker.
25342 All modules should be compiled with the same @option{-G @var{num}} value.
25343
25344 @item -mregnames
25345 @itemx -mno-regnames
25346 @opindex mregnames
25347 @opindex mno-regnames
25348 On System V.4 and embedded PowerPC systems do (do not) emit register
25349 names in the assembly language output using symbolic forms.
25350
25351 @item -mlongcall
25352 @itemx -mno-longcall
25353 @opindex mlongcall
25354 @opindex mno-longcall
25355 By default assume that all calls are far away so that a longer and more
25356 expensive calling sequence is required. This is required for calls
25357 farther than 32 megabytes (33,554,432 bytes) from the current location.
25358 A short call is generated if the compiler knows
25359 the call cannot be that far away. This setting can be overridden by
25360 the @code{shortcall} function attribute, or by @code{#pragma
25361 longcall(0)}.
25362
25363 Some linkers are capable of detecting out-of-range calls and generating
25364 glue code on the fly. On these systems, long calls are unnecessary and
25365 generate slower code. As of this writing, the AIX linker can do this,
25366 as can the GNU linker for PowerPC/64. It is planned to add this feature
25367 to the GNU linker for 32-bit PowerPC systems as well.
25368
25369 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25370 GCC can generate long calls using an inline PLT call sequence (see
25371 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25372 ELFv1 (big-endian) do not support inline PLT calls.
25373
25374 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25375 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25376 addresses represent the callee and the branch island. The
25377 Darwin/PPC linker prefers the first address and generates a @code{bl
25378 callee} if the PPC @code{bl} instruction reaches the callee directly;
25379 otherwise, the linker generates @code{bl L42} to call the branch
25380 island. The branch island is appended to the body of the
25381 calling function; it computes the full 32-bit address of the callee
25382 and jumps to it.
25383
25384 On Mach-O (Darwin) systems, this option directs the compiler emit to
25385 the glue for every direct call, and the Darwin linker decides whether
25386 to use or discard it.
25387
25388 In the future, GCC may ignore all longcall specifications
25389 when the linker is known to generate glue.
25390
25391 @item -mpltseq
25392 @itemx -mno-pltseq
25393 @opindex mpltseq
25394 @opindex mno-pltseq
25395 Implement (do not implement) -fno-plt and long calls using an inline
25396 PLT call sequence that supports lazy linking and long calls to
25397 functions in dlopen'd shared libraries. Inline PLT calls are only
25398 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25399 linkers, and are enabled by default if the support is detected when
25400 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25401 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25402 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25403 linked together.
25404
25405 @item -mtls-markers
25406 @itemx -mno-tls-markers
25407 @opindex mtls-markers
25408 @opindex mno-tls-markers
25409 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25410 specifying the function argument. The relocation allows the linker to
25411 reliably associate function call with argument setup instructions for
25412 TLS optimization, which in turn allows GCC to better schedule the
25413 sequence.
25414
25415 @item -mrecip
25416 @itemx -mno-recip
25417 @opindex mrecip
25418 This option enables use of the reciprocal estimate and
25419 reciprocal square root estimate instructions with additional
25420 Newton-Raphson steps to increase precision instead of doing a divide or
25421 square root and divide for floating-point arguments. You should use
25422 the @option{-ffast-math} option when using @option{-mrecip} (or at
25423 least @option{-funsafe-math-optimizations},
25424 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25425 @option{-fno-trapping-math}). Note that while the throughput of the
25426 sequence is generally higher than the throughput of the non-reciprocal
25427 instruction, the precision of the sequence can be decreased by up to 2
25428 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25429 roots.
25430
25431 @item -mrecip=@var{opt}
25432 @opindex mrecip=opt
25433 This option controls which reciprocal estimate instructions
25434 may be used. @var{opt} is a comma-separated list of options, which may
25435 be preceded by a @code{!} to invert the option:
25436
25437 @table @samp
25438
25439 @item all
25440 Enable all estimate instructions.
25441
25442 @item default
25443 Enable the default instructions, equivalent to @option{-mrecip}.
25444
25445 @item none
25446 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25447
25448 @item div
25449 Enable the reciprocal approximation instructions for both
25450 single and double precision.
25451
25452 @item divf
25453 Enable the single-precision reciprocal approximation instructions.
25454
25455 @item divd
25456 Enable the double-precision reciprocal approximation instructions.
25457
25458 @item rsqrt
25459 Enable the reciprocal square root approximation instructions for both
25460 single and double precision.
25461
25462 @item rsqrtf
25463 Enable the single-precision reciprocal square root approximation instructions.
25464
25465 @item rsqrtd
25466 Enable the double-precision reciprocal square root approximation instructions.
25467
25468 @end table
25469
25470 So, for example, @option{-mrecip=all,!rsqrtd} enables
25471 all of the reciprocal estimate instructions, except for the
25472 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25473 which handle the double-precision reciprocal square root calculations.
25474
25475 @item -mrecip-precision
25476 @itemx -mno-recip-precision
25477 @opindex mrecip-precision
25478 Assume (do not assume) that the reciprocal estimate instructions
25479 provide higher-precision estimates than is mandated by the PowerPC
25480 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25481 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25482 The double-precision square root estimate instructions are not generated by
25483 default on low-precision machines, since they do not provide an
25484 estimate that converges after three steps.
25485
25486 @item -mveclibabi=@var{type}
25487 @opindex mveclibabi
25488 Specifies the ABI type to use for vectorizing intrinsics using an
25489 external library. The only type supported at present is @samp{mass},
25490 which specifies to use IBM's Mathematical Acceleration Subsystem
25491 (MASS) libraries for vectorizing intrinsics using external libraries.
25492 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25493 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25494 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25495 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25496 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25497 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25498 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25499 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25500 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25501 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25502 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25503 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25504 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25505 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25506 for power7. Both @option{-ftree-vectorize} and
25507 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25508 libraries must be specified at link time.
25509
25510 @item -mfriz
25511 @itemx -mno-friz
25512 @opindex mfriz
25513 Generate (do not generate) the @code{friz} instruction when the
25514 @option{-funsafe-math-optimizations} option is used to optimize
25515 rounding of floating-point values to 64-bit integer and back to floating
25516 point. The @code{friz} instruction does not return the same value if
25517 the floating-point number is too large to fit in an integer.
25518
25519 @item -mpointers-to-nested-functions
25520 @itemx -mno-pointers-to-nested-functions
25521 @opindex mpointers-to-nested-functions
25522 Generate (do not generate) code to load up the static chain register
25523 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25524 systems where a function pointer points to a 3-word descriptor giving
25525 the function address, TOC value to be loaded in register @code{r2}, and
25526 static chain value to be loaded in register @code{r11}. The
25527 @option{-mpointers-to-nested-functions} is on by default. You cannot
25528 call through pointers to nested functions or pointers
25529 to functions compiled in other languages that use the static chain if
25530 you use @option{-mno-pointers-to-nested-functions}.
25531
25532 @item -msave-toc-indirect
25533 @itemx -mno-save-toc-indirect
25534 @opindex msave-toc-indirect
25535 Generate (do not generate) code to save the TOC value in the reserved
25536 stack location in the function prologue if the function calls through
25537 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25538 saved in the prologue, it is saved just before the call through the
25539 pointer. The @option{-mno-save-toc-indirect} option is the default.
25540
25541 @item -mcompat-align-parm
25542 @itemx -mno-compat-align-parm
25543 @opindex mcompat-align-parm
25544 Generate (do not generate) code to pass structure parameters with a
25545 maximum alignment of 64 bits, for compatibility with older versions
25546 of GCC.
25547
25548 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25549 structure parameter on a 128-bit boundary when that structure contained
25550 a member requiring 128-bit alignment. This is corrected in more
25551 recent versions of GCC. This option may be used to generate code
25552 that is compatible with functions compiled with older versions of
25553 GCC.
25554
25555 The @option{-mno-compat-align-parm} option is the default.
25556
25557 @item -mstack-protector-guard=@var{guard}
25558 @itemx -mstack-protector-guard-reg=@var{reg}
25559 @itemx -mstack-protector-guard-offset=@var{offset}
25560 @itemx -mstack-protector-guard-symbol=@var{symbol}
25561 @opindex mstack-protector-guard
25562 @opindex mstack-protector-guard-reg
25563 @opindex mstack-protector-guard-offset
25564 @opindex mstack-protector-guard-symbol
25565 Generate stack protection code using canary at @var{guard}. Supported
25566 locations are @samp{global} for global canary or @samp{tls} for per-thread
25567 canary in the TLS block (the default with GNU libc version 2.4 or later).
25568
25569 With the latter choice the options
25570 @option{-mstack-protector-guard-reg=@var{reg}} and
25571 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25572 which register to use as base register for reading the canary, and from what
25573 offset from that base register. The default for those is as specified in the
25574 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25575 the offset with a symbol reference to a canary in the TLS block.
25576
25577 @item -mpcrel
25578 @itemx -mno-pcrel
25579 @opindex mpcrel
25580 @opindex mno-pcrel
25581 Generate (do not generate) pc-relative addressing when the option
25582 @option{-mcpu=future} is used.
25583 @end table
25584
25585 @node RX Options
25586 @subsection RX Options
25587 @cindex RX Options
25588
25589 These command-line options are defined for RX targets:
25590
25591 @table @gcctabopt
25592 @item -m64bit-doubles
25593 @itemx -m32bit-doubles
25594 @opindex m64bit-doubles
25595 @opindex m32bit-doubles
25596 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25597 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25598 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25599 works on 32-bit values, which is why the default is
25600 @option{-m32bit-doubles}.
25601
25602 @item -fpu
25603 @itemx -nofpu
25604 @opindex fpu
25605 @opindex nofpu
25606 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25607 floating-point hardware. The default is enabled for the RX600
25608 series and disabled for the RX200 series.
25609
25610 Floating-point instructions are only generated for 32-bit floating-point
25611 values, however, so the FPU hardware is not used for doubles if the
25612 @option{-m64bit-doubles} option is used.
25613
25614 @emph{Note} If the @option{-fpu} option is enabled then
25615 @option{-funsafe-math-optimizations} is also enabled automatically.
25616 This is because the RX FPU instructions are themselves unsafe.
25617
25618 @item -mcpu=@var{name}
25619 @opindex mcpu
25620 Selects the type of RX CPU to be targeted. Currently three types are
25621 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25622 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25623
25624 The only difference between @samp{RX600} and @samp{RX610} is that the
25625 @samp{RX610} does not support the @code{MVTIPL} instruction.
25626
25627 The @samp{RX200} series does not have a hardware floating-point unit
25628 and so @option{-nofpu} is enabled by default when this type is
25629 selected.
25630
25631 @item -mbig-endian-data
25632 @itemx -mlittle-endian-data
25633 @opindex mbig-endian-data
25634 @opindex mlittle-endian-data
25635 Store data (but not code) in the big-endian format. The default is
25636 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25637 format.
25638
25639 @item -msmall-data-limit=@var{N}
25640 @opindex msmall-data-limit
25641 Specifies the maximum size in bytes of global and static variables
25642 which can be placed into the small data area. Using the small data
25643 area can lead to smaller and faster code, but the size of area is
25644 limited and it is up to the programmer to ensure that the area does
25645 not overflow. Also when the small data area is used one of the RX's
25646 registers (usually @code{r13}) is reserved for use pointing to this
25647 area, so it is no longer available for use by the compiler. This
25648 could result in slower and/or larger code if variables are pushed onto
25649 the stack instead of being held in this register.
25650
25651 Note, common variables (variables that have not been initialized) and
25652 constants are not placed into the small data area as they are assigned
25653 to other sections in the output executable.
25654
25655 The default value is zero, which disables this feature. Note, this
25656 feature is not enabled by default with higher optimization levels
25657 (@option{-O2} etc) because of the potentially detrimental effects of
25658 reserving a register. It is up to the programmer to experiment and
25659 discover whether this feature is of benefit to their program. See the
25660 description of the @option{-mpid} option for a description of how the
25661 actual register to hold the small data area pointer is chosen.
25662
25663 @item -msim
25664 @itemx -mno-sim
25665 @opindex msim
25666 @opindex mno-sim
25667 Use the simulator runtime. The default is to use the libgloss
25668 board-specific runtime.
25669
25670 @item -mas100-syntax
25671 @itemx -mno-as100-syntax
25672 @opindex mas100-syntax
25673 @opindex mno-as100-syntax
25674 When generating assembler output use a syntax that is compatible with
25675 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25676 assembler, but it has some restrictions so it is not generated by default.
25677
25678 @item -mmax-constant-size=@var{N}
25679 @opindex mmax-constant-size
25680 Specifies the maximum size, in bytes, of a constant that can be used as
25681 an operand in a RX instruction. Although the RX instruction set does
25682 allow constants of up to 4 bytes in length to be used in instructions,
25683 a longer value equates to a longer instruction. Thus in some
25684 circumstances it can be beneficial to restrict the size of constants
25685 that are used in instructions. Constants that are too big are instead
25686 placed into a constant pool and referenced via register indirection.
25687
25688 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25689 or 4 means that constants of any size are allowed.
25690
25691 @item -mrelax
25692 @opindex mrelax
25693 Enable linker relaxation. Linker relaxation is a process whereby the
25694 linker attempts to reduce the size of a program by finding shorter
25695 versions of various instructions. Disabled by default.
25696
25697 @item -mint-register=@var{N}
25698 @opindex mint-register
25699 Specify the number of registers to reserve for fast interrupt handler
25700 functions. The value @var{N} can be between 0 and 4. A value of 1
25701 means that register @code{r13} is reserved for the exclusive use
25702 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25703 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25704 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25705 A value of 0, the default, does not reserve any registers.
25706
25707 @item -msave-acc-in-interrupts
25708 @opindex msave-acc-in-interrupts
25709 Specifies that interrupt handler functions should preserve the
25710 accumulator register. This is only necessary if normal code might use
25711 the accumulator register, for example because it performs 64-bit
25712 multiplications. The default is to ignore the accumulator as this
25713 makes the interrupt handlers faster.
25714
25715 @item -mpid
25716 @itemx -mno-pid
25717 @opindex mpid
25718 @opindex mno-pid
25719 Enables the generation of position independent data. When enabled any
25720 access to constant data is done via an offset from a base address
25721 held in a register. This allows the location of constant data to be
25722 determined at run time without requiring the executable to be
25723 relocated, which is a benefit to embedded applications with tight
25724 memory constraints. Data that can be modified is not affected by this
25725 option.
25726
25727 Note, using this feature reserves a register, usually @code{r13}, for
25728 the constant data base address. This can result in slower and/or
25729 larger code, especially in complicated functions.
25730
25731 The actual register chosen to hold the constant data base address
25732 depends upon whether the @option{-msmall-data-limit} and/or the
25733 @option{-mint-register} command-line options are enabled. Starting
25734 with register @code{r13} and proceeding downwards, registers are
25735 allocated first to satisfy the requirements of @option{-mint-register},
25736 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25737 is possible for the small data area register to be @code{r8} if both
25738 @option{-mint-register=4} and @option{-mpid} are specified on the
25739 command line.
25740
25741 By default this feature is not enabled. The default can be restored
25742 via the @option{-mno-pid} command-line option.
25743
25744 @item -mno-warn-multiple-fast-interrupts
25745 @itemx -mwarn-multiple-fast-interrupts
25746 @opindex mno-warn-multiple-fast-interrupts
25747 @opindex mwarn-multiple-fast-interrupts
25748 Prevents GCC from issuing a warning message if it finds more than one
25749 fast interrupt handler when it is compiling a file. The default is to
25750 issue a warning for each extra fast interrupt handler found, as the RX
25751 only supports one such interrupt.
25752
25753 @item -mallow-string-insns
25754 @itemx -mno-allow-string-insns
25755 @opindex mallow-string-insns
25756 @opindex mno-allow-string-insns
25757 Enables or disables the use of the string manipulation instructions
25758 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25759 @code{SWHILE} and also the @code{RMPA} instruction. These
25760 instructions may prefetch data, which is not safe to do if accessing
25761 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25762 for more information).
25763
25764 The default is to allow these instructions, but it is not possible for
25765 GCC to reliably detect all circumstances where a string instruction
25766 might be used to access an I/O register, so their use cannot be
25767 disabled automatically. Instead it is reliant upon the programmer to
25768 use the @option{-mno-allow-string-insns} option if their program
25769 accesses I/O space.
25770
25771 When the instructions are enabled GCC defines the C preprocessor
25772 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25773 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25774
25775 @item -mjsr
25776 @itemx -mno-jsr
25777 @opindex mjsr
25778 @opindex mno-jsr
25779 Use only (or not only) @code{JSR} instructions to access functions.
25780 This option can be used when code size exceeds the range of @code{BSR}
25781 instructions. Note that @option{-mno-jsr} does not mean to not use
25782 @code{JSR} but instead means that any type of branch may be used.
25783 @end table
25784
25785 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25786 has special significance to the RX port when used with the
25787 @code{interrupt} function attribute. This attribute indicates a
25788 function intended to process fast interrupts. GCC ensures
25789 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25790 and/or @code{r13} and only provided that the normal use of the
25791 corresponding registers have been restricted via the
25792 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25793 options.
25794
25795 @node S/390 and zSeries Options
25796 @subsection S/390 and zSeries Options
25797 @cindex S/390 and zSeries Options
25798
25799 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25800
25801 @table @gcctabopt
25802 @item -mhard-float
25803 @itemx -msoft-float
25804 @opindex mhard-float
25805 @opindex msoft-float
25806 Use (do not use) the hardware floating-point instructions and registers
25807 for floating-point operations. When @option{-msoft-float} is specified,
25808 functions in @file{libgcc.a} are used to perform floating-point
25809 operations. When @option{-mhard-float} is specified, the compiler
25810 generates IEEE floating-point instructions. This is the default.
25811
25812 @item -mhard-dfp
25813 @itemx -mno-hard-dfp
25814 @opindex mhard-dfp
25815 @opindex mno-hard-dfp
25816 Use (do not use) the hardware decimal-floating-point instructions for
25817 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25818 specified, functions in @file{libgcc.a} are used to perform
25819 decimal-floating-point operations. When @option{-mhard-dfp} is
25820 specified, the compiler generates decimal-floating-point hardware
25821 instructions. This is the default for @option{-march=z9-ec} or higher.
25822
25823 @item -mlong-double-64
25824 @itemx -mlong-double-128
25825 @opindex mlong-double-64
25826 @opindex mlong-double-128
25827 These switches control the size of @code{long double} type. A size
25828 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25829 type. This is the default.
25830
25831 @item -mbackchain
25832 @itemx -mno-backchain
25833 @opindex mbackchain
25834 @opindex mno-backchain
25835 Store (do not store) the address of the caller's frame as backchain pointer
25836 into the callee's stack frame.
25837 A backchain may be needed to allow debugging using tools that do not understand
25838 DWARF call frame information.
25839 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25840 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25841 the backchain is placed into the topmost word of the 96/160 byte register
25842 save area.
25843
25844 In general, code compiled with @option{-mbackchain} is call-compatible with
25845 code compiled with @option{-mmo-backchain}; however, use of the backchain
25846 for debugging purposes usually requires that the whole binary is built with
25847 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25848 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25849 to build a linux kernel use @option{-msoft-float}.
25850
25851 The default is to not maintain the backchain.
25852
25853 @item -mpacked-stack
25854 @itemx -mno-packed-stack
25855 @opindex mpacked-stack
25856 @opindex mno-packed-stack
25857 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25858 specified, the compiler uses the all fields of the 96/160 byte register save
25859 area only for their default purpose; unused fields still take up stack space.
25860 When @option{-mpacked-stack} is specified, register save slots are densely
25861 packed at the top of the register save area; unused space is reused for other
25862 purposes, allowing for more efficient use of the available stack space.
25863 However, when @option{-mbackchain} is also in effect, the topmost word of
25864 the save area is always used to store the backchain, and the return address
25865 register is always saved two words below the backchain.
25866
25867 As long as the stack frame backchain is not used, code generated with
25868 @option{-mpacked-stack} is call-compatible with code generated with
25869 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25870 S/390 or zSeries generated code that uses the stack frame backchain at run
25871 time, not just for debugging purposes. Such code is not call-compatible
25872 with code compiled with @option{-mpacked-stack}. Also, note that the
25873 combination of @option{-mbackchain},
25874 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25875 to build a linux kernel use @option{-msoft-float}.
25876
25877 The default is to not use the packed stack layout.
25878
25879 @item -msmall-exec
25880 @itemx -mno-small-exec
25881 @opindex msmall-exec
25882 @opindex mno-small-exec
25883 Generate (or do not generate) code using the @code{bras} instruction
25884 to do subroutine calls.
25885 This only works reliably if the total executable size does not
25886 exceed 64k. The default is to use the @code{basr} instruction instead,
25887 which does not have this limitation.
25888
25889 @item -m64
25890 @itemx -m31
25891 @opindex m64
25892 @opindex m31
25893 When @option{-m31} is specified, generate code compliant to the
25894 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25895 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25896 particular to generate 64-bit instructions. For the @samp{s390}
25897 targets, the default is @option{-m31}, while the @samp{s390x}
25898 targets default to @option{-m64}.
25899
25900 @item -mzarch
25901 @itemx -mesa
25902 @opindex mzarch
25903 @opindex mesa
25904 When @option{-mzarch} is specified, generate code using the
25905 instructions available on z/Architecture.
25906 When @option{-mesa} is specified, generate code using the
25907 instructions available on ESA/390. Note that @option{-mesa} is
25908 not possible with @option{-m64}.
25909 When generating code compliant to the GNU/Linux for S/390 ABI,
25910 the default is @option{-mesa}. When generating code compliant
25911 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25912
25913 @item -mhtm
25914 @itemx -mno-htm
25915 @opindex mhtm
25916 @opindex mno-htm
25917 The @option{-mhtm} option enables a set of builtins making use of
25918 instructions available with the transactional execution facility
25919 introduced with the IBM zEnterprise EC12 machine generation
25920 @ref{S/390 System z Built-in Functions}.
25921 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25922
25923 @item -mvx
25924 @itemx -mno-vx
25925 @opindex mvx
25926 @opindex mno-vx
25927 When @option{-mvx} is specified, generate code using the instructions
25928 available with the vector extension facility introduced with the IBM
25929 z13 machine generation.
25930 This option changes the ABI for some vector type values with regard to
25931 alignment and calling conventions. In case vector type values are
25932 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25933 command will be added to mark the resulting binary with the ABI used.
25934 @option{-mvx} is enabled by default when using @option{-march=z13}.
25935
25936 @item -mzvector
25937 @itemx -mno-zvector
25938 @opindex mzvector
25939 @opindex mno-zvector
25940 The @option{-mzvector} option enables vector language extensions and
25941 builtins using instructions available with the vector extension
25942 facility introduced with the IBM z13 machine generation.
25943 This option adds support for @samp{vector} to be used as a keyword to
25944 define vector type variables and arguments. @samp{vector} is only
25945 available when GNU extensions are enabled. It will not be expanded
25946 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25947 In addition to the GCC low-level builtins @option{-mzvector} enables
25948 a set of builtins added for compatibility with AltiVec-style
25949 implementations like Power and Cell. In order to make use of these
25950 builtins the header file @file{vecintrin.h} needs to be included.
25951 @option{-mzvector} is disabled by default.
25952
25953 @item -mmvcle
25954 @itemx -mno-mvcle
25955 @opindex mmvcle
25956 @opindex mno-mvcle
25957 Generate (or do not generate) code using the @code{mvcle} instruction
25958 to perform block moves. When @option{-mno-mvcle} is specified,
25959 use a @code{mvc} loop instead. This is the default unless optimizing for
25960 size.
25961
25962 @item -mdebug
25963 @itemx -mno-debug
25964 @opindex mdebug
25965 @opindex mno-debug
25966 Print (or do not print) additional debug information when compiling.
25967 The default is to not print debug information.
25968
25969 @item -march=@var{cpu-type}
25970 @opindex march
25971 Generate code that runs on @var{cpu-type}, which is the name of a
25972 system representing a certain processor type. Possible values for
25973 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25974 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25975 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25976 @samp{z14}/@samp{arch12}, and @samp{native}.
25977
25978 The default is @option{-march=z900}.
25979
25980 Specifying @samp{native} as cpu type can be used to select the best
25981 architecture option for the host processor.
25982 @option{-march=native} has no effect if GCC does not recognize the
25983 processor.
25984
25985 @item -mtune=@var{cpu-type}
25986 @opindex mtune
25987 Tune to @var{cpu-type} everything applicable about the generated code,
25988 except for the ABI and the set of available instructions.
25989 The list of @var{cpu-type} values is the same as for @option{-march}.
25990 The default is the value used for @option{-march}.
25991
25992 @item -mtpf-trace
25993 @itemx -mno-tpf-trace
25994 @opindex mtpf-trace
25995 @opindex mno-tpf-trace
25996 Generate code that adds (does not add) in TPF OS specific branches to trace
25997 routines in the operating system. This option is off by default, even
25998 when compiling for the TPF OS@.
25999
26000 @item -mfused-madd
26001 @itemx -mno-fused-madd
26002 @opindex mfused-madd
26003 @opindex mno-fused-madd
26004 Generate code that uses (does not use) the floating-point multiply and
26005 accumulate instructions. These instructions are generated by default if
26006 hardware floating point is used.
26007
26008 @item -mwarn-framesize=@var{framesize}
26009 @opindex mwarn-framesize
26010 Emit a warning if the current function exceeds the given frame size. Because
26011 this is a compile-time check it doesn't need to be a real problem when the program
26012 runs. It is intended to identify functions that most probably cause
26013 a stack overflow. It is useful to be used in an environment with limited stack
26014 size e.g.@: the linux kernel.
26015
26016 @item -mwarn-dynamicstack
26017 @opindex mwarn-dynamicstack
26018 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
26019 arrays. This is generally a bad idea with a limited stack size.
26020
26021 @item -mstack-guard=@var{stack-guard}
26022 @itemx -mstack-size=@var{stack-size}
26023 @opindex mstack-guard
26024 @opindex mstack-size
26025 If these options are provided the S/390 back end emits additional instructions in
26026 the function prologue that trigger a trap if the stack size is @var{stack-guard}
26027 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
26028 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
26029 the frame size of the compiled function is chosen.
26030 These options are intended to be used to help debugging stack overflow problems.
26031 The additionally emitted code causes only little overhead and hence can also be
26032 used in production-like systems without greater performance degradation. The given
26033 values have to be exact powers of 2 and @var{stack-size} has to be greater than
26034 @var{stack-guard} without exceeding 64k.
26035 In order to be efficient the extra code makes the assumption that the stack starts
26036 at an address aligned to the value given by @var{stack-size}.
26037 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
26038
26039 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
26040 @opindex mhotpatch
26041 If the hotpatch option is enabled, a ``hot-patching'' function
26042 prologue is generated for all functions in the compilation unit.
26043 The funtion label is prepended with the given number of two-byte
26044 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
26045 the label, 2 * @var{post-halfwords} bytes are appended, using the
26046 largest NOP like instructions the architecture allows (maximum
26047 1000000).
26048
26049 If both arguments are zero, hotpatching is disabled.
26050
26051 This option can be overridden for individual functions with the
26052 @code{hotpatch} attribute.
26053 @end table
26054
26055 @node Score Options
26056 @subsection Score Options
26057 @cindex Score Options
26058
26059 These options are defined for Score implementations:
26060
26061 @table @gcctabopt
26062 @item -meb
26063 @opindex meb
26064 Compile code for big-endian mode. This is the default.
26065
26066 @item -mel
26067 @opindex mel
26068 Compile code for little-endian mode.
26069
26070 @item -mnhwloop
26071 @opindex mnhwloop
26072 Disable generation of @code{bcnz} instructions.
26073
26074 @item -muls
26075 @opindex muls
26076 Enable generation of unaligned load and store instructions.
26077
26078 @item -mmac
26079 @opindex mmac
26080 Enable the use of multiply-accumulate instructions. Disabled by default.
26081
26082 @item -mscore5
26083 @opindex mscore5
26084 Specify the SCORE5 as the target architecture.
26085
26086 @item -mscore5u
26087 @opindex mscore5u
26088 Specify the SCORE5U of the target architecture.
26089
26090 @item -mscore7
26091 @opindex mscore7
26092 Specify the SCORE7 as the target architecture. This is the default.
26093
26094 @item -mscore7d
26095 @opindex mscore7d
26096 Specify the SCORE7D as the target architecture.
26097 @end table
26098
26099 @node SH Options
26100 @subsection SH Options
26101
26102 These @samp{-m} options are defined for the SH implementations:
26103
26104 @table @gcctabopt
26105 @item -m1
26106 @opindex m1
26107 Generate code for the SH1.
26108
26109 @item -m2
26110 @opindex m2
26111 Generate code for the SH2.
26112
26113 @item -m2e
26114 Generate code for the SH2e.
26115
26116 @item -m2a-nofpu
26117 @opindex m2a-nofpu
26118 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26119 that the floating-point unit is not used.
26120
26121 @item -m2a-single-only
26122 @opindex m2a-single-only
26123 Generate code for the SH2a-FPU, in such a way that no double-precision
26124 floating-point operations are used.
26125
26126 @item -m2a-single
26127 @opindex m2a-single
26128 Generate code for the SH2a-FPU assuming the floating-point unit is in
26129 single-precision mode by default.
26130
26131 @item -m2a
26132 @opindex m2a
26133 Generate code for the SH2a-FPU assuming the floating-point unit is in
26134 double-precision mode by default.
26135
26136 @item -m3
26137 @opindex m3
26138 Generate code for the SH3.
26139
26140 @item -m3e
26141 @opindex m3e
26142 Generate code for the SH3e.
26143
26144 @item -m4-nofpu
26145 @opindex m4-nofpu
26146 Generate code for the SH4 without a floating-point unit.
26147
26148 @item -m4-single-only
26149 @opindex m4-single-only
26150 Generate code for the SH4 with a floating-point unit that only
26151 supports single-precision arithmetic.
26152
26153 @item -m4-single
26154 @opindex m4-single
26155 Generate code for the SH4 assuming the floating-point unit is in
26156 single-precision mode by default.
26157
26158 @item -m4
26159 @opindex m4
26160 Generate code for the SH4.
26161
26162 @item -m4-100
26163 @opindex m4-100
26164 Generate code for SH4-100.
26165
26166 @item -m4-100-nofpu
26167 @opindex m4-100-nofpu
26168 Generate code for SH4-100 in such a way that the
26169 floating-point unit is not used.
26170
26171 @item -m4-100-single
26172 @opindex m4-100-single
26173 Generate code for SH4-100 assuming the floating-point unit is in
26174 single-precision mode by default.
26175
26176 @item -m4-100-single-only
26177 @opindex m4-100-single-only
26178 Generate code for SH4-100 in such a way that no double-precision
26179 floating-point operations are used.
26180
26181 @item -m4-200
26182 @opindex m4-200
26183 Generate code for SH4-200.
26184
26185 @item -m4-200-nofpu
26186 @opindex m4-200-nofpu
26187 Generate code for SH4-200 without in such a way that the
26188 floating-point unit is not used.
26189
26190 @item -m4-200-single
26191 @opindex m4-200-single
26192 Generate code for SH4-200 assuming the floating-point unit is in
26193 single-precision mode by default.
26194
26195 @item -m4-200-single-only
26196 @opindex m4-200-single-only
26197 Generate code for SH4-200 in such a way that no double-precision
26198 floating-point operations are used.
26199
26200 @item -m4-300
26201 @opindex m4-300
26202 Generate code for SH4-300.
26203
26204 @item -m4-300-nofpu
26205 @opindex m4-300-nofpu
26206 Generate code for SH4-300 without in such a way that the
26207 floating-point unit is not used.
26208
26209 @item -m4-300-single
26210 @opindex m4-300-single
26211 Generate code for SH4-300 in such a way that no double-precision
26212 floating-point operations are used.
26213
26214 @item -m4-300-single-only
26215 @opindex m4-300-single-only
26216 Generate code for SH4-300 in such a way that no double-precision
26217 floating-point operations are used.
26218
26219 @item -m4-340
26220 @opindex m4-340
26221 Generate code for SH4-340 (no MMU, no FPU).
26222
26223 @item -m4-500
26224 @opindex m4-500
26225 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26226 assembler.
26227
26228 @item -m4a-nofpu
26229 @opindex m4a-nofpu
26230 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26231 floating-point unit is not used.
26232
26233 @item -m4a-single-only
26234 @opindex m4a-single-only
26235 Generate code for the SH4a, in such a way that no double-precision
26236 floating-point operations are used.
26237
26238 @item -m4a-single
26239 @opindex m4a-single
26240 Generate code for the SH4a assuming the floating-point unit is in
26241 single-precision mode by default.
26242
26243 @item -m4a
26244 @opindex m4a
26245 Generate code for the SH4a.
26246
26247 @item -m4al
26248 @opindex m4al
26249 Same as @option{-m4a-nofpu}, except that it implicitly passes
26250 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26251 instructions at the moment.
26252
26253 @item -mb
26254 @opindex mb
26255 Compile code for the processor in big-endian mode.
26256
26257 @item -ml
26258 @opindex ml
26259 Compile code for the processor in little-endian mode.
26260
26261 @item -mdalign
26262 @opindex mdalign
26263 Align doubles at 64-bit boundaries. Note that this changes the calling
26264 conventions, and thus some functions from the standard C library do
26265 not work unless you recompile it first with @option{-mdalign}.
26266
26267 @item -mrelax
26268 @opindex mrelax
26269 Shorten some address references at link time, when possible; uses the
26270 linker option @option{-relax}.
26271
26272 @item -mbigtable
26273 @opindex mbigtable
26274 Use 32-bit offsets in @code{switch} tables. The default is to use
26275 16-bit offsets.
26276
26277 @item -mbitops
26278 @opindex mbitops
26279 Enable the use of bit manipulation instructions on SH2A.
26280
26281 @item -mfmovd
26282 @opindex mfmovd
26283 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26284 alignment constraints.
26285
26286 @item -mrenesas
26287 @opindex mrenesas
26288 Comply with the calling conventions defined by Renesas.
26289
26290 @item -mno-renesas
26291 @opindex mno-renesas
26292 Comply with the calling conventions defined for GCC before the Renesas
26293 conventions were available. This option is the default for all
26294 targets of the SH toolchain.
26295
26296 @item -mnomacsave
26297 @opindex mnomacsave
26298 Mark the @code{MAC} register as call-clobbered, even if
26299 @option{-mrenesas} is given.
26300
26301 @item -mieee
26302 @itemx -mno-ieee
26303 @opindex mieee
26304 @opindex mno-ieee
26305 Control the IEEE compliance of floating-point comparisons, which affects the
26306 handling of cases where the result of a comparison is unordered. By default
26307 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26308 enabled @option{-mno-ieee} is implicitly set, which results in faster
26309 floating-point greater-equal and less-equal comparisons. The implicit settings
26310 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26311
26312 @item -minline-ic_invalidate
26313 @opindex minline-ic_invalidate
26314 Inline code to invalidate instruction cache entries after setting up
26315 nested function trampolines.
26316 This option has no effect if @option{-musermode} is in effect and the selected
26317 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26318 instruction.
26319 If the selected code generation option does not allow the use of the @code{icbi}
26320 instruction, and @option{-musermode} is not in effect, the inlined code
26321 manipulates the instruction cache address array directly with an associative
26322 write. This not only requires privileged mode at run time, but it also
26323 fails if the cache line had been mapped via the TLB and has become unmapped.
26324
26325 @item -misize
26326 @opindex misize
26327 Dump instruction size and location in the assembly code.
26328
26329 @item -mpadstruct
26330 @opindex mpadstruct
26331 This option is deprecated. It pads structures to multiple of 4 bytes,
26332 which is incompatible with the SH ABI@.
26333
26334 @item -matomic-model=@var{model}
26335 @opindex matomic-model=@var{model}
26336 Sets the model of atomic operations and additional parameters as a comma
26337 separated list. For details on the atomic built-in functions see
26338 @ref{__atomic Builtins}. The following models and parameters are supported:
26339
26340 @table @samp
26341
26342 @item none
26343 Disable compiler generated atomic sequences and emit library calls for atomic
26344 operations. This is the default if the target is not @code{sh*-*-linux*}.
26345
26346 @item soft-gusa
26347 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26348 built-in functions. The generated atomic sequences require additional support
26349 from the interrupt/exception handling code of the system and are only suitable
26350 for SH3* and SH4* single-core systems. This option is enabled by default when
26351 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26352 this option also partially utilizes the hardware atomic instructions
26353 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26354 @samp{strict} is specified.
26355
26356 @item soft-tcb
26357 Generate software atomic sequences that use a variable in the thread control
26358 block. This is a variation of the gUSA sequences which can also be used on
26359 SH1* and SH2* targets. The generated atomic sequences require additional
26360 support from the interrupt/exception handling code of the system and are only
26361 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26362 parameter has to be specified as well.
26363
26364 @item soft-imask
26365 Generate software atomic sequences that temporarily disable interrupts by
26366 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26367 in privileged mode and is only suitable for single-core systems. Additional
26368 support from the interrupt/exception handling code of the system is not
26369 required. This model is enabled by default when the target is
26370 @code{sh*-*-linux*} and SH1* or SH2*.
26371
26372 @item hard-llcs
26373 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26374 instructions only. This is only available on SH4A and is suitable for
26375 multi-core systems. Since the hardware instructions support only 32 bit atomic
26376 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26377 Code compiled with this option is also compatible with other software
26378 atomic model interrupt/exception handling systems if executed on an SH4A
26379 system. Additional support from the interrupt/exception handling code of the
26380 system is not required for this model.
26381
26382 @item gbr-offset=
26383 This parameter specifies the offset in bytes of the variable in the thread
26384 control block structure that should be used by the generated atomic sequences
26385 when the @samp{soft-tcb} model has been selected. For other models this
26386 parameter is ignored. The specified value must be an integer multiple of four
26387 and in the range 0-1020.
26388
26389 @item strict
26390 This parameter prevents mixed usage of multiple atomic models, even if they
26391 are compatible, and makes the compiler generate atomic sequences of the
26392 specified model only.
26393
26394 @end table
26395
26396 @item -mtas
26397 @opindex mtas
26398 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26399 Notice that depending on the particular hardware and software configuration
26400 this can degrade overall performance due to the operand cache line flushes
26401 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26402 processors the @code{tas.b} instruction must be used with caution since it
26403 can result in data corruption for certain cache configurations.
26404
26405 @item -mprefergot
26406 @opindex mprefergot
26407 When generating position-independent code, emit function calls using
26408 the Global Offset Table instead of the Procedure Linkage Table.
26409
26410 @item -musermode
26411 @itemx -mno-usermode
26412 @opindex musermode
26413 @opindex mno-usermode
26414 Don't allow (allow) the compiler generating privileged mode code. Specifying
26415 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26416 inlined code would not work in user mode. @option{-musermode} is the default
26417 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26418 @option{-musermode} has no effect, since there is no user mode.
26419
26420 @item -multcost=@var{number}
26421 @opindex multcost=@var{number}
26422 Set the cost to assume for a multiply insn.
26423
26424 @item -mdiv=@var{strategy}
26425 @opindex mdiv=@var{strategy}
26426 Set the division strategy to be used for integer division operations.
26427 @var{strategy} can be one of:
26428
26429 @table @samp
26430
26431 @item call-div1
26432 Calls a library function that uses the single-step division instruction
26433 @code{div1} to perform the operation. Division by zero calculates an
26434 unspecified result and does not trap. This is the default except for SH4,
26435 SH2A and SHcompact.
26436
26437 @item call-fp
26438 Calls a library function that performs the operation in double precision
26439 floating point. Division by zero causes a floating-point exception. This is
26440 the default for SHcompact with FPU. Specifying this for targets that do not
26441 have a double precision FPU defaults to @code{call-div1}.
26442
26443 @item call-table
26444 Calls a library function that uses a lookup table for small divisors and
26445 the @code{div1} instruction with case distinction for larger divisors. Division
26446 by zero calculates an unspecified result and does not trap. This is the default
26447 for SH4. Specifying this for targets that do not have dynamic shift
26448 instructions defaults to @code{call-div1}.
26449
26450 @end table
26451
26452 When a division strategy has not been specified the default strategy is
26453 selected based on the current target. For SH2A the default strategy is to
26454 use the @code{divs} and @code{divu} instructions instead of library function
26455 calls.
26456
26457 @item -maccumulate-outgoing-args
26458 @opindex maccumulate-outgoing-args
26459 Reserve space once for outgoing arguments in the function prologue rather
26460 than around each call. Generally beneficial for performance and size. Also
26461 needed for unwinding to avoid changing the stack frame around conditional code.
26462
26463 @item -mdivsi3_libfunc=@var{name}
26464 @opindex mdivsi3_libfunc=@var{name}
26465 Set the name of the library function used for 32-bit signed division to
26466 @var{name}.
26467 This only affects the name used in the @samp{call} division strategies, and
26468 the compiler still expects the same sets of input/output/clobbered registers as
26469 if this option were not present.
26470
26471 @item -mfixed-range=@var{register-range}
26472 @opindex mfixed-range
26473 Generate code treating the given register range as fixed registers.
26474 A fixed register is one that the register allocator cannot use. This is
26475 useful when compiling kernel code. A register range is specified as
26476 two registers separated by a dash. Multiple register ranges can be
26477 specified separated by a comma.
26478
26479 @item -mbranch-cost=@var{num}
26480 @opindex mbranch-cost=@var{num}
26481 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26482 make the compiler try to generate more branch-free code if possible.
26483 If not specified the value is selected depending on the processor type that
26484 is being compiled for.
26485
26486 @item -mzdcbranch
26487 @itemx -mno-zdcbranch
26488 @opindex mzdcbranch
26489 @opindex mno-zdcbranch
26490 Assume (do not assume) that zero displacement conditional branch instructions
26491 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26492 compiler prefers zero displacement branch code sequences. This is
26493 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26494 disabled by specifying @option{-mno-zdcbranch}.
26495
26496 @item -mcbranch-force-delay-slot
26497 @opindex mcbranch-force-delay-slot
26498 Force the usage of delay slots for conditional branches, which stuffs the delay
26499 slot with a @code{nop} if a suitable instruction cannot be found. By default
26500 this option is disabled. It can be enabled to work around hardware bugs as
26501 found in the original SH7055.
26502
26503 @item -mfused-madd
26504 @itemx -mno-fused-madd
26505 @opindex mfused-madd
26506 @opindex mno-fused-madd
26507 Generate code that uses (does not use) the floating-point multiply and
26508 accumulate instructions. These instructions are generated by default
26509 if hardware floating point is used. The machine-dependent
26510 @option{-mfused-madd} option is now mapped to the machine-independent
26511 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26512 mapped to @option{-ffp-contract=off}.
26513
26514 @item -mfsca
26515 @itemx -mno-fsca
26516 @opindex mfsca
26517 @opindex mno-fsca
26518 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26519 and cosine approximations. The option @option{-mfsca} must be used in
26520 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26521 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26522 approximations even if @option{-funsafe-math-optimizations} is in effect.
26523
26524 @item -mfsrra
26525 @itemx -mno-fsrra
26526 @opindex mfsrra
26527 @opindex mno-fsrra
26528 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26529 reciprocal square root approximations. The option @option{-mfsrra} must be used
26530 in combination with @option{-funsafe-math-optimizations} and
26531 @option{-ffinite-math-only}. It is enabled by default when generating code for
26532 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26533 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26534 in effect.
26535
26536 @item -mpretend-cmove
26537 @opindex mpretend-cmove
26538 Prefer zero-displacement conditional branches for conditional move instruction
26539 patterns. This can result in faster code on the SH4 processor.
26540
26541 @item -mfdpic
26542 @opindex fdpic
26543 Generate code using the FDPIC ABI.
26544
26545 @end table
26546
26547 @node Solaris 2 Options
26548 @subsection Solaris 2 Options
26549 @cindex Solaris 2 options
26550
26551 These @samp{-m} options are supported on Solaris 2:
26552
26553 @table @gcctabopt
26554 @item -mclear-hwcap
26555 @opindex mclear-hwcap
26556 @option{-mclear-hwcap} tells the compiler to remove the hardware
26557 capabilities generated by the Solaris assembler. This is only necessary
26558 when object files use ISA extensions not supported by the current
26559 machine, but check at runtime whether or not to use them.
26560
26561 @item -mimpure-text
26562 @opindex mimpure-text
26563 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26564 the compiler to not pass @option{-z text} to the linker when linking a
26565 shared object. Using this option, you can link position-dependent
26566 code into a shared object.
26567
26568 @option{-mimpure-text} suppresses the ``relocations remain against
26569 allocatable but non-writable sections'' linker error message.
26570 However, the necessary relocations trigger copy-on-write, and the
26571 shared object is not actually shared across processes. Instead of
26572 using @option{-mimpure-text}, you should compile all source code with
26573 @option{-fpic} or @option{-fPIC}.
26574
26575 @end table
26576
26577 These switches are supported in addition to the above on Solaris 2:
26578
26579 @table @gcctabopt
26580 @item -pthreads
26581 @opindex pthreads
26582 This is a synonym for @option{-pthread}.
26583 @end table
26584
26585 @node SPARC Options
26586 @subsection SPARC Options
26587 @cindex SPARC options
26588
26589 These @samp{-m} options are supported on the SPARC:
26590
26591 @table @gcctabopt
26592 @item -mno-app-regs
26593 @itemx -mapp-regs
26594 @opindex mno-app-regs
26595 @opindex mapp-regs
26596 Specify @option{-mapp-regs} to generate output using the global registers
26597 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26598 global register 1, each global register 2 through 4 is then treated as an
26599 allocable register that is clobbered by function calls. This is the default.
26600
26601 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26602 specify @option{-mno-app-regs}. You should compile libraries and system
26603 software with this option.
26604
26605 @item -mflat
26606 @itemx -mno-flat
26607 @opindex mflat
26608 @opindex mno-flat
26609 With @option{-mflat}, the compiler does not generate save/restore instructions
26610 and uses a ``flat'' or single register window model. This model is compatible
26611 with the regular register window model. The local registers and the input
26612 registers (0--5) are still treated as ``call-saved'' registers and are
26613 saved on the stack as needed.
26614
26615 With @option{-mno-flat} (the default), the compiler generates save/restore
26616 instructions (except for leaf functions). This is the normal operating mode.
26617
26618 @item -mfpu
26619 @itemx -mhard-float
26620 @opindex mfpu
26621 @opindex mhard-float
26622 Generate output containing floating-point instructions. This is the
26623 default.
26624
26625 @item -mno-fpu
26626 @itemx -msoft-float
26627 @opindex mno-fpu
26628 @opindex msoft-float
26629 Generate output containing library calls for floating point.
26630 @strong{Warning:} the requisite libraries are not available for all SPARC
26631 targets. Normally the facilities of the machine's usual C compiler are
26632 used, but this cannot be done directly in cross-compilation. You must make
26633 your own arrangements to provide suitable library functions for
26634 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26635 @samp{sparclite-*-*} do provide software floating-point support.
26636
26637 @option{-msoft-float} changes the calling convention in the output file;
26638 therefore, it is only useful if you compile @emph{all} of a program with
26639 this option. In particular, you need to compile @file{libgcc.a}, the
26640 library that comes with GCC, with @option{-msoft-float} in order for
26641 this to work.
26642
26643 @item -mhard-quad-float
26644 @opindex mhard-quad-float
26645 Generate output containing quad-word (long double) floating-point
26646 instructions.
26647
26648 @item -msoft-quad-float
26649 @opindex msoft-quad-float
26650 Generate output containing library calls for quad-word (long double)
26651 floating-point instructions. The functions called are those specified
26652 in the SPARC ABI@. This is the default.
26653
26654 As of this writing, there are no SPARC implementations that have hardware
26655 support for the quad-word floating-point instructions. They all invoke
26656 a trap handler for one of these instructions, and then the trap handler
26657 emulates the effect of the instruction. Because of the trap handler overhead,
26658 this is much slower than calling the ABI library routines. Thus the
26659 @option{-msoft-quad-float} option is the default.
26660
26661 @item -mno-unaligned-doubles
26662 @itemx -munaligned-doubles
26663 @opindex mno-unaligned-doubles
26664 @opindex munaligned-doubles
26665 Assume that doubles have 8-byte alignment. This is the default.
26666
26667 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26668 alignment only if they are contained in another type, or if they have an
26669 absolute address. Otherwise, it assumes they have 4-byte alignment.
26670 Specifying this option avoids some rare compatibility problems with code
26671 generated by other compilers. It is not the default because it results
26672 in a performance loss, especially for floating-point code.
26673
26674 @item -muser-mode
26675 @itemx -mno-user-mode
26676 @opindex muser-mode
26677 @opindex mno-user-mode
26678 Do not generate code that can only run in supervisor mode. This is relevant
26679 only for the @code{casa} instruction emitted for the LEON3 processor. This
26680 is the default.
26681
26682 @item -mfaster-structs
26683 @itemx -mno-faster-structs
26684 @opindex mfaster-structs
26685 @opindex mno-faster-structs
26686 With @option{-mfaster-structs}, the compiler assumes that structures
26687 should have 8-byte alignment. This enables the use of pairs of
26688 @code{ldd} and @code{std} instructions for copies in structure
26689 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26690 However, the use of this changed alignment directly violates the SPARC
26691 ABI@. Thus, it's intended only for use on targets where the developer
26692 acknowledges that their resulting code is not directly in line with
26693 the rules of the ABI@.
26694
26695 @item -mstd-struct-return
26696 @itemx -mno-std-struct-return
26697 @opindex mstd-struct-return
26698 @opindex mno-std-struct-return
26699 With @option{-mstd-struct-return}, the compiler generates checking code
26700 in functions returning structures or unions to detect size mismatches
26701 between the two sides of function calls, as per the 32-bit ABI@.
26702
26703 The default is @option{-mno-std-struct-return}. This option has no effect
26704 in 64-bit mode.
26705
26706 @item -mlra
26707 @itemx -mno-lra
26708 @opindex mlra
26709 @opindex mno-lra
26710 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26711 so @option{-mno-lra} needs to be passed to get old Reload.
26712
26713 @item -mcpu=@var{cpu_type}
26714 @opindex mcpu
26715 Set the instruction set, register set, and instruction scheduling parameters
26716 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26717 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26718 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26719 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26720 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26721 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26722
26723 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26724 which selects the best architecture option for the host processor.
26725 @option{-mcpu=native} has no effect if GCC does not recognize
26726 the processor.
26727
26728 Default instruction scheduling parameters are used for values that select
26729 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26730 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26731
26732 Here is a list of each supported architecture and their supported
26733 implementations.
26734
26735 @table @asis
26736 @item v7
26737 cypress, leon3v7
26738
26739 @item v8
26740 supersparc, hypersparc, leon, leon3
26741
26742 @item sparclite
26743 f930, f934, sparclite86x
26744
26745 @item sparclet
26746 tsc701
26747
26748 @item v9
26749 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26750 niagara7, m8
26751 @end table
26752
26753 By default (unless configured otherwise), GCC generates code for the V7
26754 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26755 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26756 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26757 SPARCStation 1, 2, IPX etc.
26758
26759 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26760 architecture. The only difference from V7 code is that the compiler emits
26761 the integer multiply and integer divide instructions which exist in SPARC-V8
26762 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26763 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26764 2000 series.
26765
26766 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26767 the SPARC architecture. This adds the integer multiply, integer divide step
26768 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26769 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26770 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26771 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26772 MB86934 chip, which is the more recent SPARClite with FPU@.
26773
26774 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26775 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26776 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26777 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26778 optimizes it for the TEMIC SPARClet chip.
26779
26780 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26781 architecture. This adds 64-bit integer and floating-point move instructions,
26782 3 additional floating-point condition code registers and conditional move
26783 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26784 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26785 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26786 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26787 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26788 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26789 additionally optimizes it for Sun UltraSPARC T2 chips. With
26790 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26791 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26792 additionally optimizes it for Sun UltraSPARC T4 chips. With
26793 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26794 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26795 additionally optimizes it for Oracle M8 chips.
26796
26797 @item -mtune=@var{cpu_type}
26798 @opindex mtune
26799 Set the instruction scheduling parameters for machine type
26800 @var{cpu_type}, but do not set the instruction set or register set that the
26801 option @option{-mcpu=@var{cpu_type}} does.
26802
26803 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26804 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26805 that select a particular CPU implementation. Those are
26806 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26807 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26808 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26809 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26810 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26811 and GNU/Linux toolchains, @samp{native} can also be used.
26812
26813 @item -mv8plus
26814 @itemx -mno-v8plus
26815 @opindex mv8plus
26816 @opindex mno-v8plus
26817 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26818 difference from the V8 ABI is that the global and out registers are
26819 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26820 mode for all SPARC-V9 processors.
26821
26822 @item -mvis
26823 @itemx -mno-vis
26824 @opindex mvis
26825 @opindex mno-vis
26826 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26827 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26828
26829 @item -mvis2
26830 @itemx -mno-vis2
26831 @opindex mvis2
26832 @opindex mno-vis2
26833 With @option{-mvis2}, GCC generates code that takes advantage of
26834 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26835 default is @option{-mvis2} when targeting a cpu that supports such
26836 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26837 also sets @option{-mvis}.
26838
26839 @item -mvis3
26840 @itemx -mno-vis3
26841 @opindex mvis3
26842 @opindex mno-vis3
26843 With @option{-mvis3}, GCC generates code that takes advantage of
26844 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26845 default is @option{-mvis3} when targeting a cpu that supports such
26846 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26847 also sets @option{-mvis2} and @option{-mvis}.
26848
26849 @item -mvis4
26850 @itemx -mno-vis4
26851 @opindex mvis4
26852 @opindex mno-vis4
26853 With @option{-mvis4}, GCC generates code that takes advantage of
26854 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26855 default is @option{-mvis4} when targeting a cpu that supports such
26856 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26857 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26858
26859 @item -mvis4b
26860 @itemx -mno-vis4b
26861 @opindex mvis4b
26862 @opindex mno-vis4b
26863 With @option{-mvis4b}, GCC generates code that takes advantage of
26864 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26865 the additional VIS instructions introduced in the Oracle SPARC
26866 Architecture 2017. The default is @option{-mvis4b} when targeting a
26867 cpu that supports such instructions, such as m8 and later. Setting
26868 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26869 @option{-mvis2} and @option{-mvis}.
26870
26871 @item -mcbcond
26872 @itemx -mno-cbcond
26873 @opindex mcbcond
26874 @opindex mno-cbcond
26875 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26876 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26877 when targeting a CPU that supports such instructions, such as Niagara-4 and
26878 later.
26879
26880 @item -mfmaf
26881 @itemx -mno-fmaf
26882 @opindex mfmaf
26883 @opindex mno-fmaf
26884 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26885 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26886 when targeting a CPU that supports such instructions, such as Niagara-3 and
26887 later.
26888
26889 @item -mfsmuld
26890 @itemx -mno-fsmuld
26891 @opindex mfsmuld
26892 @opindex mno-fsmuld
26893 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26894 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26895 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26896 or V9 with FPU except @option{-mcpu=leon}.
26897
26898 @item -mpopc
26899 @itemx -mno-popc
26900 @opindex mpopc
26901 @opindex mno-popc
26902 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26903 Population Count instruction. The default is @option{-mpopc}
26904 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26905 later.
26906
26907 @item -msubxc
26908 @itemx -mno-subxc
26909 @opindex msubxc
26910 @opindex mno-subxc
26911 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26912 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26913 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26914 later.
26915
26916 @item -mfix-at697f
26917 @opindex mfix-at697f
26918 Enable the documented workaround for the single erratum of the Atmel AT697F
26919 processor (which corresponds to erratum #13 of the AT697E processor).
26920
26921 @item -mfix-ut699
26922 @opindex mfix-ut699
26923 Enable the documented workarounds for the floating-point errata and the data
26924 cache nullify errata of the UT699 processor.
26925
26926 @item -mfix-ut700
26927 @opindex mfix-ut700
26928 Enable the documented workaround for the back-to-back store errata of
26929 the UT699E/UT700 processor.
26930
26931 @item -mfix-gr712rc
26932 @opindex mfix-gr712rc
26933 Enable the documented workaround for the back-to-back store errata of
26934 the GR712RC processor.
26935 @end table
26936
26937 These @samp{-m} options are supported in addition to the above
26938 on SPARC-V9 processors in 64-bit environments:
26939
26940 @table @gcctabopt
26941 @item -m32
26942 @itemx -m64
26943 @opindex m32
26944 @opindex m64
26945 Generate code for a 32-bit or 64-bit environment.
26946 The 32-bit environment sets int, long and pointer to 32 bits.
26947 The 64-bit environment sets int to 32 bits and long and pointer
26948 to 64 bits.
26949
26950 @item -mcmodel=@var{which}
26951 @opindex mcmodel
26952 Set the code model to one of
26953
26954 @table @samp
26955 @item medlow
26956 The Medium/Low code model: 64-bit addresses, programs
26957 must be linked in the low 32 bits of memory. Programs can be statically
26958 or dynamically linked.
26959
26960 @item medmid
26961 The Medium/Middle code model: 64-bit addresses, programs
26962 must be linked in the low 44 bits of memory, the text and data segments must
26963 be less than 2GB in size and the data segment must be located within 2GB of
26964 the text segment.
26965
26966 @item medany
26967 The Medium/Anywhere code model: 64-bit addresses, programs
26968 may be linked anywhere in memory, the text and data segments must be less
26969 than 2GB in size and the data segment must be located within 2GB of the
26970 text segment.
26971
26972 @item embmedany
26973 The Medium/Anywhere code model for embedded systems:
26974 64-bit addresses, the text and data segments must be less than 2GB in
26975 size, both starting anywhere in memory (determined at link time). The
26976 global register %g4 points to the base of the data segment. Programs
26977 are statically linked and PIC is not supported.
26978 @end table
26979
26980 @item -mmemory-model=@var{mem-model}
26981 @opindex mmemory-model
26982 Set the memory model in force on the processor to one of
26983
26984 @table @samp
26985 @item default
26986 The default memory model for the processor and operating system.
26987
26988 @item rmo
26989 Relaxed Memory Order
26990
26991 @item pso
26992 Partial Store Order
26993
26994 @item tso
26995 Total Store Order
26996
26997 @item sc
26998 Sequential Consistency
26999 @end table
27000
27001 These memory models are formally defined in Appendix D of the SPARC-V9
27002 architecture manual, as set in the processor's @code{PSTATE.MM} field.
27003
27004 @item -mstack-bias
27005 @itemx -mno-stack-bias
27006 @opindex mstack-bias
27007 @opindex mno-stack-bias
27008 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
27009 frame pointer if present, are offset by @minus{}2047 which must be added back
27010 when making stack frame references. This is the default in 64-bit mode.
27011 Otherwise, assume no such offset is present.
27012 @end table
27013
27014 @node System V Options
27015 @subsection Options for System V
27016
27017 These additional options are available on System V Release 4 for
27018 compatibility with other compilers on those systems:
27019
27020 @table @gcctabopt
27021 @item -G
27022 @opindex G
27023 Create a shared object.
27024 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
27025
27026 @item -Qy
27027 @opindex Qy
27028 Identify the versions of each tool used by the compiler, in a
27029 @code{.ident} assembler directive in the output.
27030
27031 @item -Qn
27032 @opindex Qn
27033 Refrain from adding @code{.ident} directives to the output file (this is
27034 the default).
27035
27036 @item -YP,@var{dirs}
27037 @opindex YP
27038 Search the directories @var{dirs}, and no others, for libraries
27039 specified with @option{-l}.
27040
27041 @item -Ym,@var{dir}
27042 @opindex Ym
27043 Look in the directory @var{dir} to find the M4 preprocessor.
27044 The assembler uses this option.
27045 @c This is supposed to go with a -Yd for predefined M4 macro files, but
27046 @c the generic assembler that comes with Solaris takes just -Ym.
27047 @end table
27048
27049 @node TILE-Gx Options
27050 @subsection TILE-Gx Options
27051 @cindex TILE-Gx options
27052
27053 These @samp{-m} options are supported on the TILE-Gx:
27054
27055 @table @gcctabopt
27056 @item -mcmodel=small
27057 @opindex mcmodel=small
27058 Generate code for the small model. The distance for direct calls is
27059 limited to 500M in either direction. PC-relative addresses are 32
27060 bits. Absolute addresses support the full address range.
27061
27062 @item -mcmodel=large
27063 @opindex mcmodel=large
27064 Generate code for the large model. There is no limitation on call
27065 distance, pc-relative addresses, or absolute addresses.
27066
27067 @item -mcpu=@var{name}
27068 @opindex mcpu
27069 Selects the type of CPU to be targeted. Currently the only supported
27070 type is @samp{tilegx}.
27071
27072 @item -m32
27073 @itemx -m64
27074 @opindex m32
27075 @opindex m64
27076 Generate code for a 32-bit or 64-bit environment. The 32-bit
27077 environment sets int, long, and pointer to 32 bits. The 64-bit
27078 environment sets int to 32 bits and long and pointer to 64 bits.
27079
27080 @item -mbig-endian
27081 @itemx -mlittle-endian
27082 @opindex mbig-endian
27083 @opindex mlittle-endian
27084 Generate code in big/little endian mode, respectively.
27085 @end table
27086
27087 @node TILEPro Options
27088 @subsection TILEPro Options
27089 @cindex TILEPro options
27090
27091 These @samp{-m} options are supported on the TILEPro:
27092
27093 @table @gcctabopt
27094 @item -mcpu=@var{name}
27095 @opindex mcpu
27096 Selects the type of CPU to be targeted. Currently the only supported
27097 type is @samp{tilepro}.
27098
27099 @item -m32
27100 @opindex m32
27101 Generate code for a 32-bit environment, which sets int, long, and
27102 pointer to 32 bits. This is the only supported behavior so the flag
27103 is essentially ignored.
27104 @end table
27105
27106 @node V850 Options
27107 @subsection V850 Options
27108 @cindex V850 Options
27109
27110 These @samp{-m} options are defined for V850 implementations:
27111
27112 @table @gcctabopt
27113 @item -mlong-calls
27114 @itemx -mno-long-calls
27115 @opindex mlong-calls
27116 @opindex mno-long-calls
27117 Treat all calls as being far away (near). If calls are assumed to be
27118 far away, the compiler always loads the function's address into a
27119 register, and calls indirect through the pointer.
27120
27121 @item -mno-ep
27122 @itemx -mep
27123 @opindex mno-ep
27124 @opindex mep
27125 Do not optimize (do optimize) basic blocks that use the same index
27126 pointer 4 or more times to copy pointer into the @code{ep} register, and
27127 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27128 option is on by default if you optimize.
27129
27130 @item -mno-prolog-function
27131 @itemx -mprolog-function
27132 @opindex mno-prolog-function
27133 @opindex mprolog-function
27134 Do not use (do use) external functions to save and restore registers
27135 at the prologue and epilogue of a function. The external functions
27136 are slower, but use less code space if more than one function saves
27137 the same number of registers. The @option{-mprolog-function} option
27138 is on by default if you optimize.
27139
27140 @item -mspace
27141 @opindex mspace
27142 Try to make the code as small as possible. At present, this just turns
27143 on the @option{-mep} and @option{-mprolog-function} options.
27144
27145 @item -mtda=@var{n}
27146 @opindex mtda
27147 Put static or global variables whose size is @var{n} bytes or less into
27148 the tiny data area that register @code{ep} points to. The tiny data
27149 area can hold up to 256 bytes in total (128 bytes for byte references).
27150
27151 @item -msda=@var{n}
27152 @opindex msda
27153 Put static or global variables whose size is @var{n} bytes or less into
27154 the small data area that register @code{gp} points to. The small data
27155 area can hold up to 64 kilobytes.
27156
27157 @item -mzda=@var{n}
27158 @opindex mzda
27159 Put static or global variables whose size is @var{n} bytes or less into
27160 the first 32 kilobytes of memory.
27161
27162 @item -mv850
27163 @opindex mv850
27164 Specify that the target processor is the V850.
27165
27166 @item -mv850e3v5
27167 @opindex mv850e3v5
27168 Specify that the target processor is the V850E3V5. The preprocessor
27169 constant @code{__v850e3v5__} is defined if this option is used.
27170
27171 @item -mv850e2v4
27172 @opindex mv850e2v4
27173 Specify that the target processor is the V850E3V5. This is an alias for
27174 the @option{-mv850e3v5} option.
27175
27176 @item -mv850e2v3
27177 @opindex mv850e2v3
27178 Specify that the target processor is the V850E2V3. The preprocessor
27179 constant @code{__v850e2v3__} is defined if this option is used.
27180
27181 @item -mv850e2
27182 @opindex mv850e2
27183 Specify that the target processor is the V850E2. The preprocessor
27184 constant @code{__v850e2__} is defined if this option is used.
27185
27186 @item -mv850e1
27187 @opindex mv850e1
27188 Specify that the target processor is the V850E1. The preprocessor
27189 constants @code{__v850e1__} and @code{__v850e__} are defined if
27190 this option is used.
27191
27192 @item -mv850es
27193 @opindex mv850es
27194 Specify that the target processor is the V850ES. This is an alias for
27195 the @option{-mv850e1} option.
27196
27197 @item -mv850e
27198 @opindex mv850e
27199 Specify that the target processor is the V850E@. The preprocessor
27200 constant @code{__v850e__} is defined if this option is used.
27201
27202 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27203 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27204 are defined then a default target processor is chosen and the
27205 relevant @samp{__v850*__} preprocessor constant is defined.
27206
27207 The preprocessor constants @code{__v850} and @code{__v851__} are always
27208 defined, regardless of which processor variant is the target.
27209
27210 @item -mdisable-callt
27211 @itemx -mno-disable-callt
27212 @opindex mdisable-callt
27213 @opindex mno-disable-callt
27214 This option suppresses generation of the @code{CALLT} instruction for the
27215 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27216 architecture.
27217
27218 This option is enabled by default when the RH850 ABI is
27219 in use (see @option{-mrh850-abi}), and disabled by default when the
27220 GCC ABI is in use. If @code{CALLT} instructions are being generated
27221 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27222
27223 @item -mrelax
27224 @itemx -mno-relax
27225 @opindex mrelax
27226 @opindex mno-relax
27227 Pass on (or do not pass on) the @option{-mrelax} command-line option
27228 to the assembler.
27229
27230 @item -mlong-jumps
27231 @itemx -mno-long-jumps
27232 @opindex mlong-jumps
27233 @opindex mno-long-jumps
27234 Disable (or re-enable) the generation of PC-relative jump instructions.
27235
27236 @item -msoft-float
27237 @itemx -mhard-float
27238 @opindex msoft-float
27239 @opindex mhard-float
27240 Disable (or re-enable) the generation of hardware floating point
27241 instructions. This option is only significant when the target
27242 architecture is @samp{V850E2V3} or higher. If hardware floating point
27243 instructions are being generated then the C preprocessor symbol
27244 @code{__FPU_OK__} is defined, otherwise the symbol
27245 @code{__NO_FPU__} is defined.
27246
27247 @item -mloop
27248 @opindex mloop
27249 Enables the use of the e3v5 LOOP instruction. The use of this
27250 instruction is not enabled by default when the e3v5 architecture is
27251 selected because its use is still experimental.
27252
27253 @item -mrh850-abi
27254 @itemx -mghs
27255 @opindex mrh850-abi
27256 @opindex mghs
27257 Enables support for the RH850 version of the V850 ABI. This is the
27258 default. With this version of the ABI the following rules apply:
27259
27260 @itemize
27261 @item
27262 Integer sized structures and unions are returned via a memory pointer
27263 rather than a register.
27264
27265 @item
27266 Large structures and unions (more than 8 bytes in size) are passed by
27267 value.
27268
27269 @item
27270 Functions are aligned to 16-bit boundaries.
27271
27272 @item
27273 The @option{-m8byte-align} command-line option is supported.
27274
27275 @item
27276 The @option{-mdisable-callt} command-line option is enabled by
27277 default. The @option{-mno-disable-callt} command-line option is not
27278 supported.
27279 @end itemize
27280
27281 When this version of the ABI is enabled the C preprocessor symbol
27282 @code{__V850_RH850_ABI__} is defined.
27283
27284 @item -mgcc-abi
27285 @opindex mgcc-abi
27286 Enables support for the old GCC version of the V850 ABI. With this
27287 version of the ABI the following rules apply:
27288
27289 @itemize
27290 @item
27291 Integer sized structures and unions are returned in register @code{r10}.
27292
27293 @item
27294 Large structures and unions (more than 8 bytes in size) are passed by
27295 reference.
27296
27297 @item
27298 Functions are aligned to 32-bit boundaries, unless optimizing for
27299 size.
27300
27301 @item
27302 The @option{-m8byte-align} command-line option is not supported.
27303
27304 @item
27305 The @option{-mdisable-callt} command-line option is supported but not
27306 enabled by default.
27307 @end itemize
27308
27309 When this version of the ABI is enabled the C preprocessor symbol
27310 @code{__V850_GCC_ABI__} is defined.
27311
27312 @item -m8byte-align
27313 @itemx -mno-8byte-align
27314 @opindex m8byte-align
27315 @opindex mno-8byte-align
27316 Enables support for @code{double} and @code{long long} types to be
27317 aligned on 8-byte boundaries. The default is to restrict the
27318 alignment of all objects to at most 4-bytes. When
27319 @option{-m8byte-align} is in effect the C preprocessor symbol
27320 @code{__V850_8BYTE_ALIGN__} is defined.
27321
27322 @item -mbig-switch
27323 @opindex mbig-switch
27324 Generate code suitable for big switch tables. Use this option only if
27325 the assembler/linker complain about out of range branches within a switch
27326 table.
27327
27328 @item -mapp-regs
27329 @opindex mapp-regs
27330 This option causes r2 and r5 to be used in the code generated by
27331 the compiler. This setting is the default.
27332
27333 @item -mno-app-regs
27334 @opindex mno-app-regs
27335 This option causes r2 and r5 to be treated as fixed registers.
27336
27337 @end table
27338
27339 @node VAX Options
27340 @subsection VAX Options
27341 @cindex VAX options
27342
27343 These @samp{-m} options are defined for the VAX:
27344
27345 @table @gcctabopt
27346 @item -munix
27347 @opindex munix
27348 Do not output certain jump instructions (@code{aobleq} and so on)
27349 that the Unix assembler for the VAX cannot handle across long
27350 ranges.
27351
27352 @item -mgnu
27353 @opindex mgnu
27354 Do output those jump instructions, on the assumption that the
27355 GNU assembler is being used.
27356
27357 @item -mg
27358 @opindex mg
27359 Output code for G-format floating-point numbers instead of D-format.
27360 @end table
27361
27362 @node Visium Options
27363 @subsection Visium Options
27364 @cindex Visium options
27365
27366 @table @gcctabopt
27367
27368 @item -mdebug
27369 @opindex mdebug
27370 A program which performs file I/O and is destined to run on an MCM target
27371 should be linked with this option. It causes the libraries libc.a and
27372 libdebug.a to be linked. The program should be run on the target under
27373 the control of the GDB remote debugging stub.
27374
27375 @item -msim
27376 @opindex msim
27377 A program which performs file I/O and is destined to run on the simulator
27378 should be linked with option. This causes libraries libc.a and libsim.a to
27379 be linked.
27380
27381 @item -mfpu
27382 @itemx -mhard-float
27383 @opindex mfpu
27384 @opindex mhard-float
27385 Generate code containing floating-point instructions. This is the
27386 default.
27387
27388 @item -mno-fpu
27389 @itemx -msoft-float
27390 @opindex mno-fpu
27391 @opindex msoft-float
27392 Generate code containing library calls for floating-point.
27393
27394 @option{-msoft-float} changes the calling convention in the output file;
27395 therefore, it is only useful if you compile @emph{all} of a program with
27396 this option. In particular, you need to compile @file{libgcc.a}, the
27397 library that comes with GCC, with @option{-msoft-float} in order for
27398 this to work.
27399
27400 @item -mcpu=@var{cpu_type}
27401 @opindex mcpu
27402 Set the instruction set, register set, and instruction scheduling parameters
27403 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27404 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27405
27406 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27407
27408 By default (unless configured otherwise), GCC generates code for the GR5
27409 variant of the Visium architecture.
27410
27411 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27412 architecture. The only difference from GR5 code is that the compiler will
27413 generate block move instructions.
27414
27415 @item -mtune=@var{cpu_type}
27416 @opindex mtune
27417 Set the instruction scheduling parameters for machine type @var{cpu_type},
27418 but do not set the instruction set or register set that the option
27419 @option{-mcpu=@var{cpu_type}} would.
27420
27421 @item -msv-mode
27422 @opindex msv-mode
27423 Generate code for the supervisor mode, where there are no restrictions on
27424 the access to general registers. This is the default.
27425
27426 @item -muser-mode
27427 @opindex muser-mode
27428 Generate code for the user mode, where the access to some general registers
27429 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27430 mode; on the GR6, only registers r29 to r31 are affected.
27431 @end table
27432
27433 @node VMS Options
27434 @subsection VMS Options
27435
27436 These @samp{-m} options are defined for the VMS implementations:
27437
27438 @table @gcctabopt
27439 @item -mvms-return-codes
27440 @opindex mvms-return-codes
27441 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27442 condition (e.g.@: error) codes.
27443
27444 @item -mdebug-main=@var{prefix}
27445 @opindex mdebug-main=@var{prefix}
27446 Flag the first routine whose name starts with @var{prefix} as the main
27447 routine for the debugger.
27448
27449 @item -mmalloc64
27450 @opindex mmalloc64
27451 Default to 64-bit memory allocation routines.
27452
27453 @item -mpointer-size=@var{size}
27454 @opindex mpointer-size=@var{size}
27455 Set the default size of pointers. Possible options for @var{size} are
27456 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27457 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27458 The later option disables @code{pragma pointer_size}.
27459 @end table
27460
27461 @node VxWorks Options
27462 @subsection VxWorks Options
27463 @cindex VxWorks Options
27464
27465 The options in this section are defined for all VxWorks targets.
27466 Options specific to the target hardware are listed with the other
27467 options for that target.
27468
27469 @table @gcctabopt
27470 @item -mrtp
27471 @opindex mrtp
27472 GCC can generate code for both VxWorks kernels and real time processes
27473 (RTPs). This option switches from the former to the latter. It also
27474 defines the preprocessor macro @code{__RTP__}.
27475
27476 @item -non-static
27477 @opindex non-static
27478 Link an RTP executable against shared libraries rather than static
27479 libraries. The options @option{-static} and @option{-shared} can
27480 also be used for RTPs (@pxref{Link Options}); @option{-static}
27481 is the default.
27482
27483 @item -Bstatic
27484 @itemx -Bdynamic
27485 @opindex Bstatic
27486 @opindex Bdynamic
27487 These options are passed down to the linker. They are defined for
27488 compatibility with Diab.
27489
27490 @item -Xbind-lazy
27491 @opindex Xbind-lazy
27492 Enable lazy binding of function calls. This option is equivalent to
27493 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27494
27495 @item -Xbind-now
27496 @opindex Xbind-now
27497 Disable lazy binding of function calls. This option is the default and
27498 is defined for compatibility with Diab.
27499 @end table
27500
27501 @node x86 Options
27502 @subsection x86 Options
27503 @cindex x86 Options
27504
27505 These @samp{-m} options are defined for the x86 family of computers.
27506
27507 @table @gcctabopt
27508
27509 @item -march=@var{cpu-type}
27510 @opindex march
27511 Generate instructions for the machine type @var{cpu-type}. In contrast to
27512 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27513 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27514 to generate code that may not run at all on processors other than the one
27515 indicated. Specifying @option{-march=@var{cpu-type}} implies
27516 @option{-mtune=@var{cpu-type}}.
27517
27518 The choices for @var{cpu-type} are:
27519
27520 @table @samp
27521 @item native
27522 This selects the CPU to generate code for at compilation time by determining
27523 the processor type of the compiling machine. Using @option{-march=native}
27524 enables all instruction subsets supported by the local machine (hence
27525 the result might not run on different machines). Using @option{-mtune=native}
27526 produces code optimized for the local machine under the constraints
27527 of the selected instruction set.
27528
27529 @item x86-64
27530 A generic CPU with 64-bit extensions.
27531
27532 @item i386
27533 Original Intel i386 CPU@.
27534
27535 @item i486
27536 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27537
27538 @item i586
27539 @itemx pentium
27540 Intel Pentium CPU with no MMX support.
27541
27542 @item lakemont
27543 Intel Lakemont MCU, based on Intel Pentium CPU.
27544
27545 @item pentium-mmx
27546 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27547
27548 @item pentiumpro
27549 Intel Pentium Pro CPU@.
27550
27551 @item i686
27552 When used with @option{-march}, the Pentium Pro
27553 instruction set is used, so the code runs on all i686 family chips.
27554 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27555
27556 @item pentium2
27557 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27558 support.
27559
27560 @item pentium3
27561 @itemx pentium3m
27562 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27563 set support.
27564
27565 @item pentium-m
27566 Intel Pentium M; low-power version of Intel Pentium III CPU
27567 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27568
27569 @item pentium4
27570 @itemx pentium4m
27571 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27572
27573 @item prescott
27574 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27575 set support.
27576
27577 @item nocona
27578 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27579 SSE2 and SSE3 instruction set support.
27580
27581 @item core2
27582 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27583 instruction set support.
27584
27585 @item nehalem
27586 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27587 SSE4.1, SSE4.2 and POPCNT instruction set support.
27588
27589 @item westmere
27590 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27591 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27592
27593 @item sandybridge
27594 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27595 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27596
27597 @item ivybridge
27598 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27599 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27600 instruction set support.
27601
27602 @item haswell
27603 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27604 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27605 BMI, BMI2 and F16C instruction set support.
27606
27607 @item broadwell
27608 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27609 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27610 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27611
27612 @item skylake
27613 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27614 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27615 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27616 XSAVES instruction set support.
27617
27618 @item bonnell
27619 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27620 instruction set support.
27621
27622 @item silvermont
27623 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27624 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27625
27626 @item goldmont
27627 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27628 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27629 instruction set support.
27630
27631 @item goldmont-plus
27632 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27633 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27634 PTWRITE, RDPID, SGX and UMIP instruction set support.
27635
27636 @item tremont
27637 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27638 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27639 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27640
27641 @item knl
27642 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27643 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27644 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27645 AVX512CD instruction set support.
27646
27647 @item knm
27648 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27649 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27650 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27651 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27652
27653 @item skylake-avx512
27654 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27655 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27656 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27657 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27658
27659 @item cannonlake
27660 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27661 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27662 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27663 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27664 AVX512IFMA, SHA and UMIP instruction set support.
27665
27666 @item icelake-client
27667 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27668 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27669 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27670 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27671 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27672 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27673
27674 @item icelake-server
27675 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27676 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27677 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27678 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27679 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27680 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27681 set support.
27682
27683 @item cascadelake
27684 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27685 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27686 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27687 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27688
27689 @item cooperlake
27690 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27691 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27692 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27693 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27694 set support.
27695
27696 @item tigerlake
27697 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27698 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27699 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27700 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27701 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27702 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27703 set support.
27704
27705 @item k6
27706 AMD K6 CPU with MMX instruction set support.
27707
27708 @item k6-2
27709 @itemx k6-3
27710 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27711
27712 @item athlon
27713 @itemx athlon-tbird
27714 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27715 support.
27716
27717 @item athlon-4
27718 @itemx athlon-xp
27719 @itemx athlon-mp
27720 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27721 instruction set support.
27722
27723 @item k8
27724 @itemx opteron
27725 @itemx athlon64
27726 @itemx athlon-fx
27727 Processors based on the AMD K8 core with x86-64 instruction set support,
27728 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27729 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27730 instruction set extensions.)
27731
27732 @item k8-sse3
27733 @itemx opteron-sse3
27734 @itemx athlon64-sse3
27735 Improved versions of AMD K8 cores with SSE3 instruction set support.
27736
27737 @item amdfam10
27738 @itemx barcelona
27739 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27740 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27741 instruction set extensions.)
27742
27743 @item bdver1
27744 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27745 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27746 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27747 @item bdver2
27748 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27749 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27750 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27751 extensions.)
27752 @item bdver3
27753 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27754 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27755 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27756 64-bit instruction set extensions.
27757 @item bdver4
27758 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27759 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27760 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27761 SSE4.2, ABM and 64-bit instruction set extensions.
27762
27763 @item znver1
27764 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27765 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27766 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27767 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27768 instruction set extensions.
27769 @item znver2
27770 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27771 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27772 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27773 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27774 instruction set extensions.)
27775
27776
27777 @item btver1
27778 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27779 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27780 instruction set extensions.)
27781
27782 @item btver2
27783 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27784 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27785 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27786
27787 @item winchip-c6
27788 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27789 set support.
27790
27791 @item winchip2
27792 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27793 instruction set support.
27794
27795 @item c3
27796 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27797 (No scheduling is implemented for this chip.)
27798
27799 @item c3-2
27800 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27801 (No scheduling is implemented for this chip.)
27802
27803 @item c7
27804 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27805 (No scheduling is implemented for this chip.)
27806
27807 @item samuel-2
27808 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27809 (No scheduling is implemented for this chip.)
27810
27811 @item nehemiah
27812 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27813 (No scheduling is implemented for this chip.)
27814
27815 @item esther
27816 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27817 (No scheduling is implemented for this chip.)
27818
27819 @item eden-x2
27820 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27821 (No scheduling is implemented for this chip.)
27822
27823 @item eden-x4
27824 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27825 AVX and AVX2 instruction set support.
27826 (No scheduling is implemented for this chip.)
27827
27828 @item nano
27829 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27830 instruction set support.
27831 (No scheduling is implemented for this chip.)
27832
27833 @item nano-1000
27834 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27835 instruction set support.
27836 (No scheduling is implemented for this chip.)
27837
27838 @item nano-2000
27839 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27840 instruction set support.
27841 (No scheduling is implemented for this chip.)
27842
27843 @item nano-3000
27844 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27845 instruction set support.
27846 (No scheduling is implemented for this chip.)
27847
27848 @item nano-x2
27849 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27850 instruction set support.
27851 (No scheduling is implemented for this chip.)
27852
27853 @item nano-x4
27854 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27855 instruction set support.
27856 (No scheduling is implemented for this chip.)
27857
27858 @item geode
27859 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27860 @end table
27861
27862 @item -mtune=@var{cpu-type}
27863 @opindex mtune
27864 Tune to @var{cpu-type} everything applicable about the generated code, except
27865 for the ABI and the set of available instructions.
27866 While picking a specific @var{cpu-type} schedules things appropriately
27867 for that particular chip, the compiler does not generate any code that
27868 cannot run on the default machine type unless you use a
27869 @option{-march=@var{cpu-type}} option.
27870 For example, if GCC is configured for i686-pc-linux-gnu
27871 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27872 but still runs on i686 machines.
27873
27874 The choices for @var{cpu-type} are the same as for @option{-march}.
27875 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27876
27877 @table @samp
27878 @item generic
27879 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27880 If you know the CPU on which your code will run, then you should use
27881 the corresponding @option{-mtune} or @option{-march} option instead of
27882 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27883 of your application will have, then you should use this option.
27884
27885 As new processors are deployed in the marketplace, the behavior of this
27886 option will change. Therefore, if you upgrade to a newer version of
27887 GCC, code generation controlled by this option will change to reflect
27888 the processors
27889 that are most common at the time that version of GCC is released.
27890
27891 There is no @option{-march=generic} option because @option{-march}
27892 indicates the instruction set the compiler can use, and there is no
27893 generic instruction set applicable to all processors. In contrast,
27894 @option{-mtune} indicates the processor (or, in this case, collection of
27895 processors) for which the code is optimized.
27896
27897 @item intel
27898 Produce code optimized for the most current Intel processors, which are
27899 Haswell and Silvermont for this version of GCC. If you know the CPU
27900 on which your code will run, then you should use the corresponding
27901 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27902 But, if you want your application performs better on both Haswell and
27903 Silvermont, then you should use this option.
27904
27905 As new Intel processors are deployed in the marketplace, the behavior of
27906 this option will change. Therefore, if you upgrade to a newer version of
27907 GCC, code generation controlled by this option will change to reflect
27908 the most current Intel processors at the time that version of GCC is
27909 released.
27910
27911 There is no @option{-march=intel} option because @option{-march} indicates
27912 the instruction set the compiler can use, and there is no common
27913 instruction set applicable to all processors. In contrast,
27914 @option{-mtune} indicates the processor (or, in this case, collection of
27915 processors) for which the code is optimized.
27916 @end table
27917
27918 @item -mcpu=@var{cpu-type}
27919 @opindex mcpu
27920 A deprecated synonym for @option{-mtune}.
27921
27922 @item -mfpmath=@var{unit}
27923 @opindex mfpmath
27924 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27925 for @var{unit} are:
27926
27927 @table @samp
27928 @item 387
27929 Use the standard 387 floating-point coprocessor present on the majority of chips and
27930 emulated otherwise. Code compiled with this option runs almost everywhere.
27931 The temporary results are computed in 80-bit precision instead of the precision
27932 specified by the type, resulting in slightly different results compared to most
27933 of other chips. See @option{-ffloat-store} for more detailed description.
27934
27935 This is the default choice for non-Darwin x86-32 targets.
27936
27937 @item sse
27938 Use scalar floating-point instructions present in the SSE instruction set.
27939 This instruction set is supported by Pentium III and newer chips,
27940 and in the AMD line
27941 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27942 instruction set supports only single-precision arithmetic, thus the double and
27943 extended-precision arithmetic are still done using 387. A later version, present
27944 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27945 arithmetic too.
27946
27947 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27948 or @option{-msse2} switches to enable SSE extensions and make this option
27949 effective. For the x86-64 compiler, these extensions are enabled by default.
27950
27951 The resulting code should be considerably faster in the majority of cases and avoid
27952 the numerical instability problems of 387 code, but may break some existing
27953 code that expects temporaries to be 80 bits.
27954
27955 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27956 and the default choice for x86-32 targets with the SSE2 instruction set
27957 when @option{-ffast-math} is enabled.
27958
27959 @item sse,387
27960 @itemx sse+387
27961 @itemx both
27962 Attempt to utilize both instruction sets at once. This effectively doubles the
27963 amount of available registers, and on chips with separate execution units for
27964 387 and SSE the execution resources too. Use this option with care, as it is
27965 still experimental, because the GCC register allocator does not model separate
27966 functional units well, resulting in unstable performance.
27967 @end table
27968
27969 @item -masm=@var{dialect}
27970 @opindex masm=@var{dialect}
27971 Output assembly instructions using selected @var{dialect}. Also affects
27972 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27973 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27974 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27975 not support @samp{intel}.
27976
27977 @item -mieee-fp
27978 @itemx -mno-ieee-fp
27979 @opindex mieee-fp
27980 @opindex mno-ieee-fp
27981 Control whether or not the compiler uses IEEE floating-point
27982 comparisons. These correctly handle the case where the result of a
27983 comparison is unordered.
27984
27985 @item -m80387
27986 @itemx -mhard-float
27987 @opindex 80387
27988 @opindex mhard-float
27989 Generate output containing 80387 instructions for floating point.
27990
27991 @item -mno-80387
27992 @itemx -msoft-float
27993 @opindex no-80387
27994 @opindex msoft-float
27995 Generate output containing library calls for floating point.
27996
27997 @strong{Warning:} the requisite libraries are not part of GCC@.
27998 Normally the facilities of the machine's usual C compiler are used, but
27999 this cannot be done directly in cross-compilation. You must make your
28000 own arrangements to provide suitable library functions for
28001 cross-compilation.
28002
28003 On machines where a function returns floating-point results in the 80387
28004 register stack, some floating-point opcodes may be emitted even if
28005 @option{-msoft-float} is used.
28006
28007 @item -mno-fp-ret-in-387
28008 @opindex mno-fp-ret-in-387
28009 @opindex mfp-ret-in-387
28010 Do not use the FPU registers for return values of functions.
28011
28012 The usual calling convention has functions return values of types
28013 @code{float} and @code{double} in an FPU register, even if there
28014 is no FPU@. The idea is that the operating system should emulate
28015 an FPU@.
28016
28017 The option @option{-mno-fp-ret-in-387} causes such values to be returned
28018 in ordinary CPU registers instead.
28019
28020 @item -mno-fancy-math-387
28021 @opindex mno-fancy-math-387
28022 @opindex mfancy-math-387
28023 Some 387 emulators do not support the @code{sin}, @code{cos} and
28024 @code{sqrt} instructions for the 387. Specify this option to avoid
28025 generating those instructions.
28026 This option is overridden when @option{-march}
28027 indicates that the target CPU always has an FPU and so the
28028 instruction does not need emulation. These
28029 instructions are not generated unless you also use the
28030 @option{-funsafe-math-optimizations} switch.
28031
28032 @item -malign-double
28033 @itemx -mno-align-double
28034 @opindex malign-double
28035 @opindex mno-align-double
28036 Control whether GCC aligns @code{double}, @code{long double}, and
28037 @code{long long} variables on a two-word boundary or a one-word
28038 boundary. Aligning @code{double} variables on a two-word boundary
28039 produces code that runs somewhat faster on a Pentium at the
28040 expense of more memory.
28041
28042 On x86-64, @option{-malign-double} is enabled by default.
28043
28044 @strong{Warning:} if you use the @option{-malign-double} switch,
28045 structures containing the above types are aligned differently than
28046 the published application binary interface specifications for the x86-32
28047 and are not binary compatible with structures in code compiled
28048 without that switch.
28049
28050 @item -m96bit-long-double
28051 @itemx -m128bit-long-double
28052 @opindex m96bit-long-double
28053 @opindex m128bit-long-double
28054 These switches control the size of @code{long double} type. The x86-32
28055 application binary interface specifies the size to be 96 bits,
28056 so @option{-m96bit-long-double} is the default in 32-bit mode.
28057
28058 Modern architectures (Pentium and newer) prefer @code{long double}
28059 to be aligned to an 8- or 16-byte boundary. In arrays or structures
28060 conforming to the ABI, this is not possible. So specifying
28061 @option{-m128bit-long-double} aligns @code{long double}
28062 to a 16-byte boundary by padding the @code{long double} with an additional
28063 32-bit zero.
28064
28065 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
28066 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
28067
28068 Notice that neither of these options enable any extra precision over the x87
28069 standard of 80 bits for a @code{long double}.
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 -mlong-double-64
28079 @itemx -mlong-double-80
28080 @itemx -mlong-double-128
28081 @opindex mlong-double-64
28082 @opindex mlong-double-80
28083 @opindex mlong-double-128
28084 These switches control the size of @code{long double} type. A size
28085 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28086 type. This is the default for 32-bit Bionic C library. A size
28087 of 128 bits makes the @code{long double} type equivalent to the
28088 @code{__float128} type. This is the default for 64-bit Bionic C library.
28089
28090 @strong{Warning:} if you override the default value for your target ABI, this
28091 changes the size of
28092 structures and arrays containing @code{long double} variables,
28093 as well as modifying the function calling convention for functions taking
28094 @code{long double}. Hence they are not binary-compatible
28095 with code compiled without that switch.
28096
28097 @item -malign-data=@var{type}
28098 @opindex malign-data
28099 Control how GCC aligns variables. Supported values for @var{type} are
28100 @samp{compat} uses increased alignment value compatible uses GCC 4.8
28101 and earlier, @samp{abi} uses alignment value as specified by the
28102 psABI, and @samp{cacheline} uses increased alignment value to match
28103 the cache line size. @samp{compat} is the default.
28104
28105 @item -mlarge-data-threshold=@var{threshold}
28106 @opindex mlarge-data-threshold
28107 When @option{-mcmodel=medium} is specified, data objects larger than
28108 @var{threshold} are placed in the large data section. This value must be the
28109 same across all objects linked into the binary, and defaults to 65535.
28110
28111 @item -mrtd
28112 @opindex mrtd
28113 Use a different function-calling convention, in which functions that
28114 take a fixed number of arguments return with the @code{ret @var{num}}
28115 instruction, which pops their arguments while returning. This saves one
28116 instruction in the caller since there is no need to pop the arguments
28117 there.
28118
28119 You can specify that an individual function is called with this calling
28120 sequence with the function attribute @code{stdcall}. You can also
28121 override the @option{-mrtd} option by using the function attribute
28122 @code{cdecl}. @xref{Function Attributes}.
28123
28124 @strong{Warning:} this calling convention is incompatible with the one
28125 normally used on Unix, so you cannot use it if you need to call
28126 libraries compiled with the Unix compiler.
28127
28128 Also, you must provide function prototypes for all functions that
28129 take variable numbers of arguments (including @code{printf});
28130 otherwise incorrect code is generated for calls to those
28131 functions.
28132
28133 In addition, seriously incorrect code results if you call a
28134 function with too many arguments. (Normally, extra arguments are
28135 harmlessly ignored.)
28136
28137 @item -mregparm=@var{num}
28138 @opindex mregparm
28139 Control how many registers are used to pass integer arguments. By
28140 default, no registers are used to pass arguments, and at most 3
28141 registers can be used. You can control this behavior for a specific
28142 function by using the function attribute @code{regparm}.
28143 @xref{Function Attributes}.
28144
28145 @strong{Warning:} if you use this switch, and
28146 @var{num} is nonzero, then you must build all modules with the same
28147 value, including any libraries. This includes the system libraries and
28148 startup modules.
28149
28150 @item -msseregparm
28151 @opindex msseregparm
28152 Use SSE register passing conventions for float and double arguments
28153 and return values. You can control this behavior for a specific
28154 function by using the function attribute @code{sseregparm}.
28155 @xref{Function Attributes}.
28156
28157 @strong{Warning:} if you use this switch then you must build all
28158 modules with the same value, including any libraries. This includes
28159 the system libraries and startup modules.
28160
28161 @item -mvect8-ret-in-mem
28162 @opindex mvect8-ret-in-mem
28163 Return 8-byte vectors in memory instead of MMX registers. This is the
28164 default on VxWorks to match the ABI of the Sun Studio compilers until
28165 version 12. @emph{Only} use this option if you need to remain
28166 compatible with existing code produced by those previous compiler
28167 versions or older versions of GCC@.
28168
28169 @item -mpc32
28170 @itemx -mpc64
28171 @itemx -mpc80
28172 @opindex mpc32
28173 @opindex mpc64
28174 @opindex mpc80
28175
28176 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28177 is specified, the significands of results of floating-point operations are
28178 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28179 significands of results of floating-point operations to 53 bits (double
28180 precision) and @option{-mpc80} rounds the significands of results of
28181 floating-point operations to 64 bits (extended double precision), which is
28182 the default. When this option is used, floating-point operations in higher
28183 precisions are not available to the programmer without setting the FPU
28184 control word explicitly.
28185
28186 Setting the rounding of floating-point operations to less than the default
28187 80 bits can speed some programs by 2% or more. Note that some mathematical
28188 libraries assume that extended-precision (80-bit) floating-point operations
28189 are enabled by default; routines in such libraries could suffer significant
28190 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28191 when this option is used to set the precision to less than extended precision.
28192
28193 @item -mstackrealign
28194 @opindex mstackrealign
28195 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28196 option generates an alternate prologue and epilogue that realigns the
28197 run-time stack if necessary. This supports mixing legacy codes that keep
28198 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28199 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28200 applicable to individual functions.
28201
28202 @item -mpreferred-stack-boundary=@var{num}
28203 @opindex mpreferred-stack-boundary
28204 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28205 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28206 the default is 4 (16 bytes or 128 bits).
28207
28208 @strong{Warning:} When generating code for the x86-64 architecture with
28209 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28210 used to keep the stack boundary aligned to 8 byte boundary. Since
28211 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28212 intended to be used in controlled environment where stack space is
28213 important limitation. This option leads to wrong code when functions
28214 compiled with 16 byte stack alignment (such as functions from a standard
28215 library) are called with misaligned stack. In this case, SSE
28216 instructions may lead to misaligned memory access traps. In addition,
28217 variable arguments are handled incorrectly for 16 byte aligned
28218 objects (including x87 long double and __int128), leading to wrong
28219 results. You must build all modules with
28220 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28221 includes the system libraries and startup modules.
28222
28223 @item -mincoming-stack-boundary=@var{num}
28224 @opindex mincoming-stack-boundary
28225 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28226 boundary. If @option{-mincoming-stack-boundary} is not specified,
28227 the one specified by @option{-mpreferred-stack-boundary} is used.
28228
28229 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28230 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28231 suffer significant run time performance penalties. On Pentium III, the
28232 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28233 properly if it is not 16-byte aligned.
28234
28235 To ensure proper alignment of this values on the stack, the stack boundary
28236 must be as aligned as that required by any value stored on the stack.
28237 Further, every function must be generated such that it keeps the stack
28238 aligned. Thus calling a function compiled with a higher preferred
28239 stack boundary from a function compiled with a lower preferred stack
28240 boundary most likely misaligns the stack. It is recommended that
28241 libraries that use callbacks always use the default setting.
28242
28243 This extra alignment does consume extra stack space, and generally
28244 increases code size. Code that is sensitive to stack space usage, such
28245 as embedded systems and operating system kernels, may want to reduce the
28246 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28247
28248 @need 200
28249 @item -mmmx
28250 @opindex mmmx
28251 @need 200
28252 @itemx -msse
28253 @opindex msse
28254 @need 200
28255 @itemx -msse2
28256 @opindex msse2
28257 @need 200
28258 @itemx -msse3
28259 @opindex msse3
28260 @need 200
28261 @itemx -mssse3
28262 @opindex mssse3
28263 @need 200
28264 @itemx -msse4
28265 @opindex msse4
28266 @need 200
28267 @itemx -msse4a
28268 @opindex msse4a
28269 @need 200
28270 @itemx -msse4.1
28271 @opindex msse4.1
28272 @need 200
28273 @itemx -msse4.2
28274 @opindex msse4.2
28275 @need 200
28276 @itemx -mavx
28277 @opindex mavx
28278 @need 200
28279 @itemx -mavx2
28280 @opindex mavx2
28281 @need 200
28282 @itemx -mavx512f
28283 @opindex mavx512f
28284 @need 200
28285 @itemx -mavx512pf
28286 @opindex mavx512pf
28287 @need 200
28288 @itemx -mavx512er
28289 @opindex mavx512er
28290 @need 200
28291 @itemx -mavx512cd
28292 @opindex mavx512cd
28293 @need 200
28294 @itemx -mavx512vl
28295 @opindex mavx512vl
28296 @need 200
28297 @itemx -mavx512bw
28298 @opindex mavx512bw
28299 @need 200
28300 @itemx -mavx512dq
28301 @opindex mavx512dq
28302 @need 200
28303 @itemx -mavx512ifma
28304 @opindex mavx512ifma
28305 @need 200
28306 @itemx -mavx512vbmi
28307 @opindex mavx512vbmi
28308 @need 200
28309 @itemx -msha
28310 @opindex msha
28311 @need 200
28312 @itemx -maes
28313 @opindex maes
28314 @need 200
28315 @itemx -mpclmul
28316 @opindex mpclmul
28317 @need 200
28318 @itemx -mclflushopt
28319 @opindex mclflushopt
28320 @need 200
28321 @itemx -mclwb
28322 @opindex mclwb
28323 @need 200
28324 @itemx -mfsgsbase
28325 @opindex mfsgsbase
28326 @need 200
28327 @itemx -mptwrite
28328 @opindex mptwrite
28329 @need 200
28330 @itemx -mrdrnd
28331 @opindex mrdrnd
28332 @need 200
28333 @itemx -mf16c
28334 @opindex mf16c
28335 @need 200
28336 @itemx -mfma
28337 @opindex mfma
28338 @need 200
28339 @itemx -mpconfig
28340 @opindex mpconfig
28341 @need 200
28342 @itemx -mwbnoinvd
28343 @opindex mwbnoinvd
28344 @need 200
28345 @itemx -mfma4
28346 @opindex mfma4
28347 @need 200
28348 @itemx -mprfchw
28349 @opindex mprfchw
28350 @need 200
28351 @itemx -mrdpid
28352 @opindex mrdpid
28353 @need 200
28354 @itemx -mprefetchwt1
28355 @opindex mprefetchwt1
28356 @need 200
28357 @itemx -mrdseed
28358 @opindex mrdseed
28359 @need 200
28360 @itemx -msgx
28361 @opindex msgx
28362 @need 200
28363 @itemx -mxop
28364 @opindex mxop
28365 @need 200
28366 @itemx -mlwp
28367 @opindex mlwp
28368 @need 200
28369 @itemx -m3dnow
28370 @opindex m3dnow
28371 @need 200
28372 @itemx -m3dnowa
28373 @opindex m3dnowa
28374 @need 200
28375 @itemx -mpopcnt
28376 @opindex mpopcnt
28377 @need 200
28378 @itemx -mabm
28379 @opindex mabm
28380 @need 200
28381 @itemx -madx
28382 @opindex madx
28383 @need 200
28384 @itemx -mbmi
28385 @opindex mbmi
28386 @need 200
28387 @itemx -mbmi2
28388 @opindex mbmi2
28389 @need 200
28390 @itemx -mlzcnt
28391 @opindex mlzcnt
28392 @need 200
28393 @itemx -mfxsr
28394 @opindex mfxsr
28395 @need 200
28396 @itemx -mxsave
28397 @opindex mxsave
28398 @need 200
28399 @itemx -mxsaveopt
28400 @opindex mxsaveopt
28401 @need 200
28402 @itemx -mxsavec
28403 @opindex mxsavec
28404 @need 200
28405 @itemx -mxsaves
28406 @opindex mxsaves
28407 @need 200
28408 @itemx -mrtm
28409 @opindex mrtm
28410 @need 200
28411 @itemx -mhle
28412 @opindex mhle
28413 @need 200
28414 @itemx -mtbm
28415 @opindex mtbm
28416 @need 200
28417 @itemx -mmwaitx
28418 @opindex mmwaitx
28419 @need 200
28420 @itemx -mclzero
28421 @opindex mclzero
28422 @need 200
28423 @itemx -mpku
28424 @opindex mpku
28425 @need 200
28426 @itemx -mavx512vbmi2
28427 @opindex mavx512vbmi2
28428 @need 200
28429 @itemx -mavx512bf16
28430 @opindex mavx512bf16
28431 @need 200
28432 @itemx -mgfni
28433 @opindex mgfni
28434 @need 200
28435 @itemx -mvaes
28436 @opindex mvaes
28437 @need 200
28438 @itemx -mwaitpkg
28439 @opindex mwaitpkg
28440 @need 200
28441 @itemx -mvpclmulqdq
28442 @opindex mvpclmulqdq
28443 @need 200
28444 @itemx -mavx512bitalg
28445 @opindex mavx512bitalg
28446 @need 200
28447 @itemx -mmovdiri
28448 @opindex mmovdiri
28449 @need 200
28450 @itemx -mmovdir64b
28451 @opindex mmovdir64b
28452 @need 200
28453 @itemx -menqcmd
28454 @opindex menqcmd
28455 @need 200
28456 @itemx -mavx512vpopcntdq
28457 @opindex mavx512vpopcntdq
28458 @need 200
28459 @itemx -mavx512vp2intersect
28460 @opindex mavx512vp2intersect
28461 @need 200
28462 @itemx -mavx5124fmaps
28463 @opindex mavx5124fmaps
28464 @need 200
28465 @itemx -mavx512vnni
28466 @opindex mavx512vnni
28467 @need 200
28468 @itemx -mavx5124vnniw
28469 @opindex mavx5124vnniw
28470 @need 200
28471 @itemx -mcldemote
28472 @opindex mcldemote
28473 These switches enable the use of instructions in the MMX, SSE,
28474 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28475 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28476 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28477 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28478 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28479 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28480 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28481 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28482 extended instruction sets. Each has a corresponding @option{-mno-} option to
28483 disable use of these instructions.
28484
28485 These extensions are also available as built-in functions: see
28486 @ref{x86 Built-in Functions}, for details of the functions enabled and
28487 disabled by these switches.
28488
28489 To generate SSE/SSE2 instructions automatically from floating-point
28490 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28491
28492 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28493 generates new AVX instructions or AVX equivalence for all SSEx instructions
28494 when needed.
28495
28496 These options enable GCC to use these extended instructions in
28497 generated code, even without @option{-mfpmath=sse}. Applications that
28498 perform run-time CPU detection must compile separate files for each
28499 supported architecture, using the appropriate flags. In particular,
28500 the file containing the CPU detection code should be compiled without
28501 these options.
28502
28503 @item -mdump-tune-features
28504 @opindex mdump-tune-features
28505 This option instructs GCC to dump the names of the x86 performance
28506 tuning features and default settings. The names can be used in
28507 @option{-mtune-ctrl=@var{feature-list}}.
28508
28509 @item -mtune-ctrl=@var{feature-list}
28510 @opindex mtune-ctrl=@var{feature-list}
28511 This option is used to do fine grain control of x86 code generation features.
28512 @var{feature-list} is a comma separated list of @var{feature} names. See also
28513 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28514 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28515 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28516 developers. Using it may lead to code paths not covered by testing and can
28517 potentially result in compiler ICEs or runtime errors.
28518
28519 @item -mno-default
28520 @opindex mno-default
28521 This option instructs GCC to turn off all tunable features. See also
28522 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28523
28524 @item -mcld
28525 @opindex mcld
28526 This option instructs GCC to emit a @code{cld} instruction in the prologue
28527 of functions that use string instructions. String instructions depend on
28528 the DF flag to select between autoincrement or autodecrement mode. While the
28529 ABI specifies the DF flag to be cleared on function entry, some operating
28530 systems violate this specification by not clearing the DF flag in their
28531 exception dispatchers. The exception handler can be invoked with the DF flag
28532 set, which leads to wrong direction mode when string instructions are used.
28533 This option can be enabled by default on 32-bit x86 targets by configuring
28534 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28535 instructions can be suppressed with the @option{-mno-cld} compiler option
28536 in this case.
28537
28538 @item -mvzeroupper
28539 @opindex mvzeroupper
28540 This option instructs GCC to emit a @code{vzeroupper} instruction
28541 before a transfer of control flow out of the function to minimize
28542 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28543 intrinsics.
28544
28545 @item -mprefer-avx128
28546 @opindex mprefer-avx128
28547 This option instructs GCC to use 128-bit AVX instructions instead of
28548 256-bit AVX instructions in the auto-vectorizer.
28549
28550 @item -mprefer-vector-width=@var{opt}
28551 @opindex mprefer-vector-width
28552 This option instructs GCC to use @var{opt}-bit vector width in instructions
28553 instead of default on the selected platform.
28554
28555 @table @samp
28556 @item none
28557 No extra limitations applied to GCC other than defined by the selected platform.
28558
28559 @item 128
28560 Prefer 128-bit vector width for instructions.
28561
28562 @item 256
28563 Prefer 256-bit vector width for instructions.
28564
28565 @item 512
28566 Prefer 512-bit vector width for instructions.
28567 @end table
28568
28569 @item -mcx16
28570 @opindex mcx16
28571 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28572 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28573 objects. This is useful for atomic updates of data structures exceeding one
28574 machine word in size. The compiler uses this instruction to implement
28575 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28576 128-bit integers, a library call is always used.
28577
28578 @item -msahf
28579 @opindex msahf
28580 This option enables generation of @code{SAHF} instructions in 64-bit code.
28581 Early Intel Pentium 4 CPUs with Intel 64 support,
28582 prior to the introduction of Pentium 4 G1 step in December 2005,
28583 lacked the @code{LAHF} and @code{SAHF} instructions
28584 which are supported by AMD64.
28585 These are load and store instructions, respectively, for certain status flags.
28586 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28587 @code{drem}, and @code{remainder} built-in functions;
28588 see @ref{Other Builtins} for details.
28589
28590 @item -mmovbe
28591 @opindex mmovbe
28592 This option enables use of the @code{movbe} instruction to implement
28593 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28594
28595 @item -mshstk
28596 @opindex mshstk
28597 The @option{-mshstk} option enables shadow stack built-in functions
28598 from x86 Control-flow Enforcement Technology (CET).
28599
28600 @item -mcrc32
28601 @opindex mcrc32
28602 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28603 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28604 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28605
28606 @item -mrecip
28607 @opindex mrecip
28608 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28609 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28610 with an additional Newton-Raphson step
28611 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28612 (and their vectorized
28613 variants) for single-precision floating-point arguments. These instructions
28614 are generated only when @option{-funsafe-math-optimizations} is enabled
28615 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28616 Note that while the throughput of the sequence is higher than the throughput
28617 of the non-reciprocal instruction, the precision of the sequence can be
28618 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28619
28620 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28621 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28622 combination), and doesn't need @option{-mrecip}.
28623
28624 Also note that GCC emits the above sequence with additional Newton-Raphson step
28625 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28626 already with @option{-ffast-math} (or the above option combination), and
28627 doesn't need @option{-mrecip}.
28628
28629 @item -mrecip=@var{opt}
28630 @opindex mrecip=opt
28631 This option controls which reciprocal estimate instructions
28632 may be used. @var{opt} is a comma-separated list of options, which may
28633 be preceded by a @samp{!} to invert the option:
28634
28635 @table @samp
28636 @item all
28637 Enable all estimate instructions.
28638
28639 @item default
28640 Enable the default instructions, equivalent to @option{-mrecip}.
28641
28642 @item none
28643 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28644
28645 @item div
28646 Enable the approximation for scalar division.
28647
28648 @item vec-div
28649 Enable the approximation for vectorized division.
28650
28651 @item sqrt
28652 Enable the approximation for scalar square root.
28653
28654 @item vec-sqrt
28655 Enable the approximation for vectorized square root.
28656 @end table
28657
28658 So, for example, @option{-mrecip=all,!sqrt} enables
28659 all of the reciprocal approximations, except for square root.
28660
28661 @item -mveclibabi=@var{type}
28662 @opindex mveclibabi
28663 Specifies the ABI type to use for vectorizing intrinsics using an
28664 external library. Supported values for @var{type} are @samp{svml}
28665 for the Intel short
28666 vector math library and @samp{acml} for the AMD math core library.
28667 To use this option, both @option{-ftree-vectorize} and
28668 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28669 ABI-compatible library must be specified at link time.
28670
28671 GCC currently emits calls to @code{vmldExp2},
28672 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28673 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28674 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28675 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28676 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28677 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28678 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28679 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28680 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28681 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28682 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28683 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28684 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28685 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28686 when @option{-mveclibabi=acml} is used.
28687
28688 @item -mabi=@var{name}
28689 @opindex mabi
28690 Generate code for the specified calling convention. Permissible values
28691 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28692 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28693 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28694 You can control this behavior for specific functions by
28695 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28696 @xref{Function Attributes}.
28697
28698 @item -mforce-indirect-call
28699 @opindex mforce-indirect-call
28700 Force all calls to functions to be indirect. This is useful
28701 when using Intel Processor Trace where it generates more precise timing
28702 information for function calls.
28703
28704 @item -mmanual-endbr
28705 @opindex mmanual-endbr
28706 Insert ENDBR instruction at function entry only via the @code{cf_check}
28707 function attribute. This is useful when used with the option
28708 @option{-fcf-protection=branch} to control ENDBR insertion at the
28709 function entry.
28710
28711 @item -mcall-ms2sysv-xlogues
28712 @opindex mcall-ms2sysv-xlogues
28713 @opindex mno-call-ms2sysv-xlogues
28714 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28715 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28716 default, the code for saving and restoring these registers is emitted inline,
28717 resulting in fairly lengthy prologues and epilogues. Using
28718 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28719 use stubs in the static portion of libgcc to perform these saves and restores,
28720 thus reducing function size at the cost of a few extra instructions.
28721
28722 @item -mtls-dialect=@var{type}
28723 @opindex mtls-dialect
28724 Generate code to access thread-local storage using the @samp{gnu} or
28725 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28726 @samp{gnu2} is more efficient, but it may add compile- and run-time
28727 requirements that cannot be satisfied on all systems.
28728
28729 @item -mpush-args
28730 @itemx -mno-push-args
28731 @opindex mpush-args
28732 @opindex mno-push-args
28733 Use PUSH operations to store outgoing parameters. This method is shorter
28734 and usually equally fast as method using SUB/MOV operations and is enabled
28735 by default. In some cases disabling it may improve performance because of
28736 improved scheduling and reduced dependencies.
28737
28738 @item -maccumulate-outgoing-args
28739 @opindex maccumulate-outgoing-args
28740 If enabled, the maximum amount of space required for outgoing arguments is
28741 computed in the function prologue. This is faster on most modern CPUs
28742 because of reduced dependencies, improved scheduling and reduced stack usage
28743 when the preferred stack boundary is not equal to 2. The drawback is a notable
28744 increase in code size. This switch implies @option{-mno-push-args}.
28745
28746 @item -mthreads
28747 @opindex mthreads
28748 Support thread-safe exception handling on MinGW. Programs that rely
28749 on thread-safe exception handling must compile and link all code with the
28750 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28751 @option{-D_MT}; when linking, it links in a special thread helper library
28752 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28753
28754 @item -mms-bitfields
28755 @itemx -mno-ms-bitfields
28756 @opindex mms-bitfields
28757 @opindex mno-ms-bitfields
28758
28759 Enable/disable bit-field layout compatible with the native Microsoft
28760 Windows compiler.
28761
28762 If @code{packed} is used on a structure, or if bit-fields are used,
28763 it may be that the Microsoft ABI lays out the structure differently
28764 than the way GCC normally does. Particularly when moving packed
28765 data between functions compiled with GCC and the native Microsoft compiler
28766 (either via function call or as data in a file), it may be necessary to access
28767 either format.
28768
28769 This option is enabled by default for Microsoft Windows
28770 targets. This behavior can also be controlled locally by use of variable
28771 or type attributes. For more information, see @ref{x86 Variable Attributes}
28772 and @ref{x86 Type Attributes}.
28773
28774 The Microsoft structure layout algorithm is fairly simple with the exception
28775 of the bit-field packing.
28776 The padding and alignment of members of structures and whether a bit-field
28777 can straddle a storage-unit boundary are determine by these rules:
28778
28779 @enumerate
28780 @item Structure members are stored sequentially in the order in which they are
28781 declared: the first member has the lowest memory address and the last member
28782 the highest.
28783
28784 @item Every data object has an alignment requirement. The alignment requirement
28785 for all data except structures, unions, and arrays is either the size of the
28786 object or the current packing size (specified with either the
28787 @code{aligned} attribute or the @code{pack} pragma),
28788 whichever is less. For structures, unions, and arrays,
28789 the alignment requirement is the largest alignment requirement of its members.
28790 Every object is allocated an offset so that:
28791
28792 @smallexample
28793 offset % alignment_requirement == 0
28794 @end smallexample
28795
28796 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28797 unit if the integral types are the same size and if the next bit-field fits
28798 into the current allocation unit without crossing the boundary imposed by the
28799 common alignment requirements of the bit-fields.
28800 @end enumerate
28801
28802 MSVC interprets zero-length bit-fields in the following ways:
28803
28804 @enumerate
28805 @item If a zero-length bit-field is inserted between two bit-fields that
28806 are normally coalesced, the bit-fields are not coalesced.
28807
28808 For example:
28809
28810 @smallexample
28811 struct
28812 @{
28813 unsigned long bf_1 : 12;
28814 unsigned long : 0;
28815 unsigned long bf_2 : 12;
28816 @} t1;
28817 @end smallexample
28818
28819 @noindent
28820 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28821 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28822
28823 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28824 alignment of the zero-length bit-field is greater than the member that follows it,
28825 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28826
28827 For example:
28828
28829 @smallexample
28830 struct
28831 @{
28832 char foo : 4;
28833 short : 0;
28834 char bar;
28835 @} t2;
28836
28837 struct
28838 @{
28839 char foo : 4;
28840 short : 0;
28841 double bar;
28842 @} t3;
28843 @end smallexample
28844
28845 @noindent
28846 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28847 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28848 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28849 of the structure.
28850
28851 Taking this into account, it is important to note the following:
28852
28853 @enumerate
28854 @item If a zero-length bit-field follows a normal bit-field, the type of the
28855 zero-length bit-field may affect the alignment of the structure as whole. For
28856 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28857 normal bit-field, and is of type short.
28858
28859 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28860 still affect the alignment of the structure:
28861
28862 @smallexample
28863 struct
28864 @{
28865 char foo : 6;
28866 long : 0;
28867 @} t4;
28868 @end smallexample
28869
28870 @noindent
28871 Here, @code{t4} takes up 4 bytes.
28872 @end enumerate
28873
28874 @item Zero-length bit-fields following non-bit-field members are ignored:
28875
28876 @smallexample
28877 struct
28878 @{
28879 char foo;
28880 long : 0;
28881 char bar;
28882 @} t5;
28883 @end smallexample
28884
28885 @noindent
28886 Here, @code{t5} takes up 2 bytes.
28887 @end enumerate
28888
28889
28890 @item -mno-align-stringops
28891 @opindex mno-align-stringops
28892 @opindex malign-stringops
28893 Do not align the destination of inlined string operations. This switch reduces
28894 code size and improves performance in case the destination is already aligned,
28895 but GCC doesn't know about it.
28896
28897 @item -minline-all-stringops
28898 @opindex minline-all-stringops
28899 By default GCC inlines string operations only when the destination is
28900 known to be aligned to least a 4-byte boundary.
28901 This enables more inlining and increases code
28902 size, but may improve performance of code that depends on fast
28903 @code{memcpy} and @code{memset} for short lengths.
28904 The option enables inline expansion of @code{strlen} for all
28905 pointer alignments.
28906
28907 @item -minline-stringops-dynamically
28908 @opindex minline-stringops-dynamically
28909 For string operations of unknown size, use run-time checks with
28910 inline code for small blocks and a library call for large blocks.
28911
28912 @item -mstringop-strategy=@var{alg}
28913 @opindex mstringop-strategy=@var{alg}
28914 Override the internal decision heuristic for the particular algorithm to use
28915 for inlining string operations. The allowed values for @var{alg} are:
28916
28917 @table @samp
28918 @item rep_byte
28919 @itemx rep_4byte
28920 @itemx rep_8byte
28921 Expand using i386 @code{rep} prefix of the specified size.
28922
28923 @item byte_loop
28924 @itemx loop
28925 @itemx unrolled_loop
28926 Expand into an inline loop.
28927
28928 @item libcall
28929 Always use a library call.
28930 @end table
28931
28932 @item -mmemcpy-strategy=@var{strategy}
28933 @opindex mmemcpy-strategy=@var{strategy}
28934 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28935 should be inlined and what inline algorithm to use when the expected size
28936 of the copy operation is known. @var{strategy}
28937 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28938 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28939 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28940 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28941 in the list must be specified in increasing order. The minimal byte size for
28942 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28943 preceding range.
28944
28945 @item -mmemset-strategy=@var{strategy}
28946 @opindex mmemset-strategy=@var{strategy}
28947 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28948 @code{__builtin_memset} expansion.
28949
28950 @item -momit-leaf-frame-pointer
28951 @opindex momit-leaf-frame-pointer
28952 Don't keep the frame pointer in a register for leaf functions. This
28953 avoids the instructions to save, set up, and restore frame pointers and
28954 makes an extra register available in leaf functions. The option
28955 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28956 which might make debugging harder.
28957
28958 @item -mtls-direct-seg-refs
28959 @itemx -mno-tls-direct-seg-refs
28960 @opindex mtls-direct-seg-refs
28961 Controls whether TLS variables may be accessed with offsets from the
28962 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28963 or whether the thread base pointer must be added. Whether or not this
28964 is valid depends on the operating system, and whether it maps the
28965 segment to cover the entire TLS area.
28966
28967 For systems that use the GNU C Library, the default is on.
28968
28969 @item -msse2avx
28970 @itemx -mno-sse2avx
28971 @opindex msse2avx
28972 Specify that the assembler should encode SSE instructions with VEX
28973 prefix. The option @option{-mavx} turns this on by default.
28974
28975 @item -mfentry
28976 @itemx -mno-fentry
28977 @opindex mfentry
28978 If profiling is active (@option{-pg}), put the profiling
28979 counter call before the prologue.
28980 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28981 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28982
28983 @item -mrecord-mcount
28984 @itemx -mno-record-mcount
28985 @opindex mrecord-mcount
28986 If profiling is active (@option{-pg}), generate a __mcount_loc section
28987 that contains pointers to each profiling call. This is useful for
28988 automatically patching and out calls.
28989
28990 @item -mnop-mcount
28991 @itemx -mno-nop-mcount
28992 @opindex mnop-mcount
28993 If profiling is active (@option{-pg}), generate the calls to
28994 the profiling functions as NOPs. This is useful when they
28995 should be patched in later dynamically. This is likely only
28996 useful together with @option{-mrecord-mcount}.
28997
28998 @item -minstrument-return=@var{type}
28999 @opindex minstrument-return
29000 Instrument function exit in -pg -mfentry instrumented functions with
29001 call to specified function. This only instruments true returns ending
29002 with ret, but not sibling calls ending with jump. Valid types
29003 are @var{none} to not instrument, @var{call} to generate a call to __return__,
29004 or @var{nop5} to generate a 5 byte nop.
29005
29006 @item -mrecord-return
29007 @itemx -mno-record-return
29008 @opindex mrecord-return
29009 Generate a __return_loc section pointing to all return instrumentation code.
29010
29011 @item -mfentry-name=@var{name}
29012 @opindex mfentry-name
29013 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
29014
29015 @item -mfentry-section=@var{name}
29016 @opindex mfentry-section
29017 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
29018
29019 @item -mskip-rax-setup
29020 @itemx -mno-skip-rax-setup
29021 @opindex mskip-rax-setup
29022 When generating code for the x86-64 architecture with SSE extensions
29023 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
29024 register when there are no variable arguments passed in vector registers.
29025
29026 @strong{Warning:} Since RAX register is used to avoid unnecessarily
29027 saving vector registers on stack when passing variable arguments, the
29028 impacts of this option are callees may waste some stack space,
29029 misbehave or jump to a random location. GCC 4.4 or newer don't have
29030 those issues, regardless the RAX register value.
29031
29032 @item -m8bit-idiv
29033 @itemx -mno-8bit-idiv
29034 @opindex m8bit-idiv
29035 On some processors, like Intel Atom, 8-bit unsigned integer divide is
29036 much faster than 32-bit/64-bit integer divide. This option generates a
29037 run-time check. If both dividend and divisor are within range of 0
29038 to 255, 8-bit unsigned integer divide is used instead of
29039 32-bit/64-bit integer divide.
29040
29041 @item -mavx256-split-unaligned-load
29042 @itemx -mavx256-split-unaligned-store
29043 @opindex mavx256-split-unaligned-load
29044 @opindex mavx256-split-unaligned-store
29045 Split 32-byte AVX unaligned load and store.
29046
29047 @item -mstack-protector-guard=@var{guard}
29048 @itemx -mstack-protector-guard-reg=@var{reg}
29049 @itemx -mstack-protector-guard-offset=@var{offset}
29050 @opindex mstack-protector-guard
29051 @opindex mstack-protector-guard-reg
29052 @opindex mstack-protector-guard-offset
29053 Generate stack protection code using canary at @var{guard}. Supported
29054 locations are @samp{global} for global canary or @samp{tls} for per-thread
29055 canary in the TLS block (the default). This option has effect only when
29056 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
29057
29058 With the latter choice the options
29059 @option{-mstack-protector-guard-reg=@var{reg}} and
29060 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29061 which segment register (@code{%fs} or @code{%gs}) to use as base register
29062 for reading the canary, and from what offset from that base register.
29063 The default for those is as specified in the relevant ABI.
29064
29065 @item -mgeneral-regs-only
29066 @opindex mgeneral-regs-only
29067 Generate code that uses only the general-purpose registers. This
29068 prevents the compiler from using floating-point, vector, mask and bound
29069 registers.
29070
29071 @item -mindirect-branch=@var{choice}
29072 @opindex mindirect-branch
29073 Convert indirect call and jump with @var{choice}. The default is
29074 @samp{keep}, which keeps indirect call and jump unmodified.
29075 @samp{thunk} converts indirect call and jump to call and return thunk.
29076 @samp{thunk-inline} converts indirect call and jump to inlined call
29077 and return thunk. @samp{thunk-extern} converts indirect call and jump
29078 to external call and return thunk provided in a separate object file.
29079 You can control this behavior for a specific function by using the
29080 function attribute @code{indirect_branch}. @xref{Function Attributes}.
29081
29082 Note that @option{-mcmodel=large} is incompatible with
29083 @option{-mindirect-branch=thunk} and
29084 @option{-mindirect-branch=thunk-extern} since the thunk function may
29085 not be reachable in the large code model.
29086
29087 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
29088 @option{-fcf-protection=branch} since the external thunk cannot be modified
29089 to disable control-flow check.
29090
29091 @item -mfunction-return=@var{choice}
29092 @opindex mfunction-return
29093 Convert function return with @var{choice}. The default is @samp{keep},
29094 which keeps function return unmodified. @samp{thunk} converts function
29095 return to call and return thunk. @samp{thunk-inline} converts function
29096 return to inlined call and return thunk. @samp{thunk-extern} converts
29097 function return to external call and return thunk provided in a separate
29098 object file. You can control this behavior for a specific function by
29099 using the function attribute @code{function_return}.
29100 @xref{Function Attributes}.
29101
29102 Note that @option{-mcmodel=large} is incompatible with
29103 @option{-mfunction-return=thunk} and
29104 @option{-mfunction-return=thunk-extern} since the thunk function may
29105 not be reachable in the large code model.
29106
29107
29108 @item -mindirect-branch-register
29109 @opindex mindirect-branch-register
29110 Force indirect call and jump via register.
29111
29112 @end table
29113
29114 These @samp{-m} switches are supported in addition to the above
29115 on x86-64 processors in 64-bit environments.
29116
29117 @table @gcctabopt
29118 @item -m32
29119 @itemx -m64
29120 @itemx -mx32
29121 @itemx -m16
29122 @itemx -miamcu
29123 @opindex m32
29124 @opindex m64
29125 @opindex mx32
29126 @opindex m16
29127 @opindex miamcu
29128 Generate code for a 16-bit, 32-bit or 64-bit environment.
29129 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29130 to 32 bits, and
29131 generates code that runs on any i386 system.
29132
29133 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29134 types to 64 bits, and generates code for the x86-64 architecture.
29135 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29136 and @option{-mdynamic-no-pic} options.
29137
29138 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29139 to 32 bits, and
29140 generates code for the x86-64 architecture.
29141
29142 The @option{-m16} option is the same as @option{-m32}, except for that
29143 it outputs the @code{.code16gcc} assembly directive at the beginning of
29144 the assembly output so that the binary can run in 16-bit mode.
29145
29146 The @option{-miamcu} option generates code which conforms to Intel MCU
29147 psABI. It requires the @option{-m32} option to be turned on.
29148
29149 @item -mno-red-zone
29150 @opindex mno-red-zone
29151 @opindex mred-zone
29152 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29153 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29154 stack pointer that is not modified by signal or interrupt handlers
29155 and therefore can be used for temporary data without adjusting the stack
29156 pointer. The flag @option{-mno-red-zone} disables this red zone.
29157
29158 @item -mcmodel=small
29159 @opindex mcmodel=small
29160 Generate code for the small code model: the program and its symbols must
29161 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29162 Programs can be statically or dynamically linked. This is the default
29163 code model.
29164
29165 @item -mcmodel=kernel
29166 @opindex mcmodel=kernel
29167 Generate code for the kernel code model. The kernel runs in the
29168 negative 2 GB of the address space.
29169 This model has to be used for Linux kernel code.
29170
29171 @item -mcmodel=medium
29172 @opindex mcmodel=medium
29173 Generate code for the medium model: the program is linked in the lower 2
29174 GB of the address space. Small symbols are also placed there. Symbols
29175 with sizes larger than @option{-mlarge-data-threshold} are put into
29176 large data or BSS sections and can be located above 2GB. Programs can
29177 be statically or dynamically linked.
29178
29179 @item -mcmodel=large
29180 @opindex mcmodel=large
29181 Generate code for the large model. This model makes no assumptions
29182 about addresses and sizes of sections.
29183
29184 @item -maddress-mode=long
29185 @opindex maddress-mode=long
29186 Generate code for long address mode. This is only supported for 64-bit
29187 and x32 environments. It is the default address mode for 64-bit
29188 environments.
29189
29190 @item -maddress-mode=short
29191 @opindex maddress-mode=short
29192 Generate code for short address mode. This is only supported for 32-bit
29193 and x32 environments. It is the default address mode for 32-bit and
29194 x32 environments.
29195 @end table
29196
29197 @node x86 Windows Options
29198 @subsection x86 Windows Options
29199 @cindex x86 Windows Options
29200 @cindex Windows Options for x86
29201
29202 These additional options are available for Microsoft Windows targets:
29203
29204 @table @gcctabopt
29205 @item -mconsole
29206 @opindex mconsole
29207 This option
29208 specifies that a console application is to be generated, by
29209 instructing the linker to set the PE header subsystem type
29210 required for console applications.
29211 This option is available for Cygwin and MinGW targets and is
29212 enabled by default on those targets.
29213
29214 @item -mdll
29215 @opindex mdll
29216 This option is available for Cygwin and MinGW targets. It
29217 specifies that a DLL---a dynamic link library---is to be
29218 generated, enabling the selection of the required runtime
29219 startup object and entry point.
29220
29221 @item -mnop-fun-dllimport
29222 @opindex mnop-fun-dllimport
29223 This option is available for Cygwin and MinGW targets. It
29224 specifies that the @code{dllimport} attribute should be ignored.
29225
29226 @item -mthread
29227 @opindex mthread
29228 This option is available for MinGW targets. It specifies
29229 that MinGW-specific thread support is to be used.
29230
29231 @item -municode
29232 @opindex municode
29233 This option is available for MinGW-w64 targets. It causes
29234 the @code{UNICODE} preprocessor macro to be predefined, and
29235 chooses Unicode-capable runtime startup code.
29236
29237 @item -mwin32
29238 @opindex mwin32
29239 This option is available for Cygwin and MinGW targets. It
29240 specifies that the typical Microsoft Windows predefined macros are to
29241 be set in the pre-processor, but does not influence the choice
29242 of runtime library/startup code.
29243
29244 @item -mwindows
29245 @opindex mwindows
29246 This option is available for Cygwin and MinGW targets. It
29247 specifies that a GUI application is to be generated by
29248 instructing the linker to set the PE header subsystem type
29249 appropriately.
29250
29251 @item -fno-set-stack-executable
29252 @opindex fno-set-stack-executable
29253 @opindex fset-stack-executable
29254 This option is available for MinGW targets. It specifies that
29255 the executable flag for the stack used by nested functions isn't
29256 set. This is necessary for binaries running in kernel mode of
29257 Microsoft Windows, as there the User32 API, which is used to set executable
29258 privileges, isn't available.
29259
29260 @item -fwritable-relocated-rdata
29261 @opindex fno-writable-relocated-rdata
29262 @opindex fwritable-relocated-rdata
29263 This option is available for MinGW and Cygwin targets. It specifies
29264 that relocated-data in read-only section is put into the @code{.data}
29265 section. This is a necessary for older runtimes not supporting
29266 modification of @code{.rdata} sections for pseudo-relocation.
29267
29268 @item -mpe-aligned-commons
29269 @opindex mpe-aligned-commons
29270 This option is available for Cygwin and MinGW targets. It
29271 specifies that the GNU extension to the PE file format that
29272 permits the correct alignment of COMMON variables should be
29273 used when generating code. It is enabled by default if
29274 GCC detects that the target assembler found during configuration
29275 supports the feature.
29276 @end table
29277
29278 See also under @ref{x86 Options} for standard options.
29279
29280 @node Xstormy16 Options
29281 @subsection Xstormy16 Options
29282 @cindex Xstormy16 Options
29283
29284 These options are defined for Xstormy16:
29285
29286 @table @gcctabopt
29287 @item -msim
29288 @opindex msim
29289 Choose startup files and linker script suitable for the simulator.
29290 @end table
29291
29292 @node Xtensa Options
29293 @subsection Xtensa Options
29294 @cindex Xtensa Options
29295
29296 These options are supported for Xtensa targets:
29297
29298 @table @gcctabopt
29299 @item -mconst16
29300 @itemx -mno-const16
29301 @opindex mconst16
29302 @opindex mno-const16
29303 Enable or disable use of @code{CONST16} instructions for loading
29304 constant values. The @code{CONST16} instruction is currently not a
29305 standard option from Tensilica. When enabled, @code{CONST16}
29306 instructions are always used in place of the standard @code{L32R}
29307 instructions. The use of @code{CONST16} is enabled by default only if
29308 the @code{L32R} instruction is not available.
29309
29310 @item -mfused-madd
29311 @itemx -mno-fused-madd
29312 @opindex mfused-madd
29313 @opindex mno-fused-madd
29314 Enable or disable use of fused multiply/add and multiply/subtract
29315 instructions in the floating-point option. This has no effect if the
29316 floating-point option is not also enabled. Disabling fused multiply/add
29317 and multiply/subtract instructions forces the compiler to use separate
29318 instructions for the multiply and add/subtract operations. This may be
29319 desirable in some cases where strict IEEE 754-compliant results are
29320 required: the fused multiply add/subtract instructions do not round the
29321 intermediate result, thereby producing results with @emph{more} bits of
29322 precision than specified by the IEEE standard. Disabling fused multiply
29323 add/subtract instructions also ensures that the program output is not
29324 sensitive to the compiler's ability to combine multiply and add/subtract
29325 operations.
29326
29327 @item -mserialize-volatile
29328 @itemx -mno-serialize-volatile
29329 @opindex mserialize-volatile
29330 @opindex mno-serialize-volatile
29331 When this option is enabled, GCC inserts @code{MEMW} instructions before
29332 @code{volatile} memory references to guarantee sequential consistency.
29333 The default is @option{-mserialize-volatile}. Use
29334 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29335
29336 @item -mforce-no-pic
29337 @opindex mforce-no-pic
29338 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29339 position-independent code (PIC), this option disables PIC for compiling
29340 kernel code.
29341
29342 @item -mtext-section-literals
29343 @itemx -mno-text-section-literals
29344 @opindex mtext-section-literals
29345 @opindex mno-text-section-literals
29346 These options control the treatment of literal pools. The default is
29347 @option{-mno-text-section-literals}, which places literals in a separate
29348 section in the output file. This allows the literal pool to be placed
29349 in a data RAM/ROM, and it also allows the linker to combine literal
29350 pools from separate object files to remove redundant literals and
29351 improve code size. With @option{-mtext-section-literals}, the literals
29352 are interspersed in the text section in order to keep them as close as
29353 possible to their references. This may be necessary for large assembly
29354 files. Literals for each function are placed right before that function.
29355
29356 @item -mauto-litpools
29357 @itemx -mno-auto-litpools
29358 @opindex mauto-litpools
29359 @opindex mno-auto-litpools
29360 These options control the treatment of literal pools. The default is
29361 @option{-mno-auto-litpools}, which places literals in a separate
29362 section in the output file unless @option{-mtext-section-literals} is
29363 used. With @option{-mauto-litpools} the literals are interspersed in
29364 the text section by the assembler. Compiler does not produce explicit
29365 @code{.literal} directives and loads literals into registers with
29366 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29367 do relaxation and place literals as necessary. This option allows
29368 assembler to create several literal pools per function and assemble
29369 very big functions, which may not be possible with
29370 @option{-mtext-section-literals}.
29371
29372 @item -mtarget-align
29373 @itemx -mno-target-align
29374 @opindex mtarget-align
29375 @opindex mno-target-align
29376 When this option is enabled, GCC instructs the assembler to
29377 automatically align instructions to reduce branch penalties at the
29378 expense of some code density. The assembler attempts to widen density
29379 instructions to align branch targets and the instructions following call
29380 instructions. If there are not enough preceding safe density
29381 instructions to align a target, no widening is performed. The
29382 default is @option{-mtarget-align}. These options do not affect the
29383 treatment of auto-aligned instructions like @code{LOOP}, which the
29384 assembler always aligns, either by widening density instructions or
29385 by inserting NOP instructions.
29386
29387 @item -mlongcalls
29388 @itemx -mno-longcalls
29389 @opindex mlongcalls
29390 @opindex mno-longcalls
29391 When this option is enabled, GCC instructs the assembler to translate
29392 direct calls to indirect calls unless it can determine that the target
29393 of a direct call is in the range allowed by the call instruction. This
29394 translation typically occurs for calls to functions in other source
29395 files. Specifically, the assembler translates a direct @code{CALL}
29396 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29397 The default is @option{-mno-longcalls}. This option should be used in
29398 programs where the call target can potentially be out of range. This
29399 option is implemented in the assembler, not the compiler, so the
29400 assembly code generated by GCC still shows direct call
29401 instructions---look at the disassembled object code to see the actual
29402 instructions. Note that the assembler uses an indirect call for
29403 every cross-file call, not just those that really are out of range.
29404 @end table
29405
29406 @node zSeries Options
29407 @subsection zSeries Options
29408 @cindex zSeries options
29409
29410 These are listed under @xref{S/390 and zSeries Options}.
29411
29412
29413 @c man end
29414
29415 @node Spec Files
29416 @section Specifying Subprocesses and the Switches to Pass to Them
29417 @cindex Spec Files
29418
29419 @command{gcc} is a driver program. It performs its job by invoking a
29420 sequence of other programs to do the work of compiling, assembling and
29421 linking. GCC interprets its command-line parameters and uses these to
29422 deduce which programs it should invoke, and which command-line options
29423 it ought to place on their command lines. This behavior is controlled
29424 by @dfn{spec strings}. In most cases there is one spec string for each
29425 program that GCC can invoke, but a few programs have multiple spec
29426 strings to control their behavior. The spec strings built into GCC can
29427 be overridden by using the @option{-specs=} command-line switch to specify
29428 a spec file.
29429
29430 @dfn{Spec files} are plain-text files that are used to construct spec
29431 strings. They consist of a sequence of directives separated by blank
29432 lines. The type of directive is determined by the first non-whitespace
29433 character on the line, which can be one of the following:
29434
29435 @table @code
29436 @item %@var{command}
29437 Issues a @var{command} to the spec file processor. The commands that can
29438 appear here are:
29439
29440 @table @code
29441 @item %include <@var{file}>
29442 @cindex @code{%include}
29443 Search for @var{file} and insert its text at the current point in the
29444 specs file.
29445
29446 @item %include_noerr <@var{file}>
29447 @cindex @code{%include_noerr}
29448 Just like @samp{%include}, but do not generate an error message if the include
29449 file cannot be found.
29450
29451 @item %rename @var{old_name} @var{new_name}
29452 @cindex @code{%rename}
29453 Rename the spec string @var{old_name} to @var{new_name}.
29454
29455 @end table
29456
29457 @item *[@var{spec_name}]:
29458 This tells the compiler to create, override or delete the named spec
29459 string. All lines after this directive up to the next directive or
29460 blank line are considered to be the text for the spec string. If this
29461 results in an empty string then the spec is deleted. (Or, if the
29462 spec did not exist, then nothing happens.) Otherwise, if the spec
29463 does not currently exist a new spec is created. If the spec does
29464 exist then its contents are overridden by the text of this
29465 directive, unless the first character of that text is the @samp{+}
29466 character, in which case the text is appended to the spec.
29467
29468 @item [@var{suffix}]:
29469 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29470 and up to the next directive or blank line are considered to make up the
29471 spec string for the indicated suffix. When the compiler encounters an
29472 input file with the named suffix, it processes the spec string in
29473 order to work out how to compile that file. For example:
29474
29475 @smallexample
29476 .ZZ:
29477 z-compile -input %i
29478 @end smallexample
29479
29480 This says that any input file whose name ends in @samp{.ZZ} should be
29481 passed to the program @samp{z-compile}, which should be invoked with the
29482 command-line switch @option{-input} and with the result of performing the
29483 @samp{%i} substitution. (See below.)
29484
29485 As an alternative to providing a spec string, the text following a
29486 suffix directive can be one of the following:
29487
29488 @table @code
29489 @item @@@var{language}
29490 This says that the suffix is an alias for a known @var{language}. This is
29491 similar to using the @option{-x} command-line switch to GCC to specify a
29492 language explicitly. For example:
29493
29494 @smallexample
29495 .ZZ:
29496 @@c++
29497 @end smallexample
29498
29499 Says that .ZZ files are, in fact, C++ source files.
29500
29501 @item #@var{name}
29502 This causes an error messages saying:
29503
29504 @smallexample
29505 @var{name} compiler not installed on this system.
29506 @end smallexample
29507 @end table
29508
29509 GCC already has an extensive list of suffixes built into it.
29510 This directive adds an entry to the end of the list of suffixes, but
29511 since the list is searched from the end backwards, it is effectively
29512 possible to override earlier entries using this technique.
29513
29514 @end table
29515
29516 GCC has the following spec strings built into it. Spec files can
29517 override these strings or create their own. Note that individual
29518 targets can also add their own spec strings to this list.
29519
29520 @smallexample
29521 asm Options to pass to the assembler
29522 asm_final Options to pass to the assembler post-processor
29523 cpp Options to pass to the C preprocessor
29524 cc1 Options to pass to the C compiler
29525 cc1plus Options to pass to the C++ compiler
29526 endfile Object files to include at the end of the link
29527 link Options to pass to the linker
29528 lib Libraries to include on the command line to the linker
29529 libgcc Decides which GCC support library to pass to the linker
29530 linker Sets the name of the linker
29531 predefines Defines to be passed to the C preprocessor
29532 signed_char Defines to pass to CPP to say whether @code{char} is signed
29533 by default
29534 startfile Object files to include at the start of the link
29535 @end smallexample
29536
29537 Here is a small example of a spec file:
29538
29539 @smallexample
29540 %rename lib old_lib
29541
29542 *lib:
29543 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29544 @end smallexample
29545
29546 This example renames the spec called @samp{lib} to @samp{old_lib} and
29547 then overrides the previous definition of @samp{lib} with a new one.
29548 The new definition adds in some extra command-line options before
29549 including the text of the old definition.
29550
29551 @dfn{Spec strings} are a list of command-line options to be passed to their
29552 corresponding program. In addition, the spec strings can contain
29553 @samp{%}-prefixed sequences to substitute variable text or to
29554 conditionally insert text into the command line. Using these constructs
29555 it is possible to generate quite complex command lines.
29556
29557 Here is a table of all defined @samp{%}-sequences for spec
29558 strings. Note that spaces are not generated automatically around the
29559 results of expanding these sequences. Therefore you can concatenate them
29560 together or combine them with constant text in a single argument.
29561
29562 @table @code
29563 @item %%
29564 Substitute one @samp{%} into the program name or argument.
29565
29566 @item %i
29567 Substitute the name of the input file being processed.
29568
29569 @item %b
29570 Substitute the basename of the input file being processed.
29571 This is the substring up to (and not including) the last period
29572 and not including the directory.
29573
29574 @item %B
29575 This is the same as @samp{%b}, but include the file suffix (text after
29576 the last period).
29577
29578 @item %d
29579 Marks the argument containing or following the @samp{%d} as a
29580 temporary file name, so that that file is deleted if GCC exits
29581 successfully. Unlike @samp{%g}, this contributes no text to the
29582 argument.
29583
29584 @item %g@var{suffix}
29585 Substitute a file name that has suffix @var{suffix} and is chosen
29586 once per compilation, and mark the argument in the same way as
29587 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29588 name is now chosen in a way that is hard to predict even when previously
29589 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29590 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29591 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29592 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29593 was simply substituted with a file name chosen once per compilation,
29594 without regard to any appended suffix (which was therefore treated
29595 just like ordinary text), making such attacks more likely to succeed.
29596
29597 @item %u@var{suffix}
29598 Like @samp{%g}, but generates a new temporary file name
29599 each time it appears instead of once per compilation.
29600
29601 @item %U@var{suffix}
29602 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29603 new one if there is no such last file name. In the absence of any
29604 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29605 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29606 involves the generation of two distinct file names, one
29607 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29608 simply substituted with a file name chosen for the previous @samp{%u},
29609 without regard to any appended suffix.
29610
29611 @item %j@var{suffix}
29612 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29613 writable, and if @option{-save-temps} is not used;
29614 otherwise, substitute the name
29615 of a temporary file, just like @samp{%u}. This temporary file is not
29616 meant for communication between processes, but rather as a junk
29617 disposal mechanism.
29618
29619 @item %|@var{suffix}
29620 @itemx %m@var{suffix}
29621 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29622 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29623 all. These are the two most common ways to instruct a program that it
29624 should read from standard input or write to standard output. If you
29625 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29626 construct: see for example @file{gcc/fortran/lang-specs.h}.
29627
29628 @item %.@var{SUFFIX}
29629 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29630 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29631 terminated by the next space or %.
29632
29633 @item %w
29634 Marks the argument containing or following the @samp{%w} as the
29635 designated output file of this compilation. This puts the argument
29636 into the sequence of arguments that @samp{%o} substitutes.
29637
29638 @item %o
29639 Substitutes the names of all the output files, with spaces
29640 automatically placed around them. You should write spaces
29641 around the @samp{%o} as well or the results are undefined.
29642 @samp{%o} is for use in the specs for running the linker.
29643 Input files whose names have no recognized suffix are not compiled
29644 at all, but they are included among the output files, so they are
29645 linked.
29646
29647 @item %O
29648 Substitutes the suffix for object files. Note that this is
29649 handled specially when it immediately follows @samp{%g, %u, or %U},
29650 because of the need for those to form complete file names. The
29651 handling is such that @samp{%O} is treated exactly as if it had already
29652 been substituted, except that @samp{%g, %u, and %U} do not currently
29653 support additional @var{suffix} characters following @samp{%O} as they do
29654 following, for example, @samp{.o}.
29655
29656 @item %p
29657 Substitutes the standard macro predefinitions for the
29658 current target machine. Use this when running @command{cpp}.
29659
29660 @item %P
29661 Like @samp{%p}, but puts @samp{__} before and after the name of each
29662 predefined macro, except for macros that start with @samp{__} or with
29663 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29664 C@.
29665
29666 @item %I
29667 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29668 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29669 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29670 and @option{-imultilib} as necessary.
29671
29672 @item %s
29673 Current argument is the name of a library or startup file of some sort.
29674 Search for that file in a standard list of directories and substitute
29675 the full name found. The current working directory is included in the
29676 list of directories scanned.
29677
29678 @item %T
29679 Current argument is the name of a linker script. Search for that file
29680 in the current list of directories to scan for libraries. If the file
29681 is located insert a @option{--script} option into the command line
29682 followed by the full path name found. If the file is not found then
29683 generate an error message. Note: the current working directory is not
29684 searched.
29685
29686 @item %e@var{str}
29687 Print @var{str} as an error message. @var{str} is terminated by a newline.
29688 Use this when inconsistent options are detected.
29689
29690 @item %(@var{name})
29691 Substitute the contents of spec string @var{name} at this point.
29692
29693 @item %x@{@var{option}@}
29694 Accumulate an option for @samp{%X}.
29695
29696 @item %X
29697 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29698 spec string.
29699
29700 @item %Y
29701 Output the accumulated assembler options specified by @option{-Wa}.
29702
29703 @item %Z
29704 Output the accumulated preprocessor options specified by @option{-Wp}.
29705
29706 @item %a
29707 Process the @code{asm} spec. This is used to compute the
29708 switches to be passed to the assembler.
29709
29710 @item %A
29711 Process the @code{asm_final} spec. This is a spec string for
29712 passing switches to an assembler post-processor, if such a program is
29713 needed.
29714
29715 @item %l
29716 Process the @code{link} spec. This is the spec for computing the
29717 command line passed to the linker. Typically it makes use of the
29718 @samp{%L %G %S %D and %E} sequences.
29719
29720 @item %D
29721 Dump out a @option{-L} option for each directory that GCC believes might
29722 contain startup files. If the target supports multilibs then the
29723 current multilib directory is prepended to each of these paths.
29724
29725 @item %L
29726 Process the @code{lib} spec. This is a spec string for deciding which
29727 libraries are included on the command line to the linker.
29728
29729 @item %G
29730 Process the @code{libgcc} spec. This is a spec string for deciding
29731 which GCC support library is included on the command line to the linker.
29732
29733 @item %S
29734 Process the @code{startfile} spec. This is a spec for deciding which
29735 object files are the first ones passed to the linker. Typically
29736 this might be a file named @file{crt0.o}.
29737
29738 @item %E
29739 Process the @code{endfile} spec. This is a spec string that specifies
29740 the last object files that are passed to the linker.
29741
29742 @item %C
29743 Process the @code{cpp} spec. This is used to construct the arguments
29744 to be passed to the C preprocessor.
29745
29746 @item %1
29747 Process the @code{cc1} spec. This is used to construct the options to be
29748 passed to the actual C compiler (@command{cc1}).
29749
29750 @item %2
29751 Process the @code{cc1plus} spec. This is used to construct the options to be
29752 passed to the actual C++ compiler (@command{cc1plus}).
29753
29754 @item %*
29755 Substitute the variable part of a matched option. See below.
29756 Note that each comma in the substituted string is replaced by
29757 a single space.
29758
29759 @item %<S
29760 Remove all occurrences of @code{-S} from the command line. Note---this
29761 command is position dependent. @samp{%} commands in the spec string
29762 before this one see @code{-S}, @samp{%} commands in the spec string
29763 after this one do not.
29764
29765 @item %:@var{function}(@var{args})
29766 Call the named function @var{function}, passing it @var{args}.
29767 @var{args} is first processed as a nested spec string, then split
29768 into an argument vector in the usual fashion. The function returns
29769 a string which is processed as if it had appeared literally as part
29770 of the current spec.
29771
29772 The following built-in spec functions are provided:
29773
29774 @table @code
29775 @item @code{getenv}
29776 The @code{getenv} spec function takes two arguments: an environment
29777 variable name and a string. If the environment variable is not
29778 defined, a fatal error is issued. Otherwise, the return value is the
29779 value of the environment variable concatenated with the string. For
29780 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29781
29782 @smallexample
29783 %:getenv(TOPDIR /include)
29784 @end smallexample
29785
29786 expands to @file{/path/to/top/include}.
29787
29788 @item @code{if-exists}
29789 The @code{if-exists} spec function takes one argument, an absolute
29790 pathname to a file. If the file exists, @code{if-exists} returns the
29791 pathname. Here is a small example of its usage:
29792
29793 @smallexample
29794 *startfile:
29795 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29796 @end smallexample
29797
29798 @item @code{if-exists-else}
29799 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29800 spec function, except that it takes two arguments. The first argument is
29801 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29802 returns the pathname. If it does not exist, it returns the second argument.
29803 This way, @code{if-exists-else} can be used to select one file or another,
29804 based on the existence of the first. Here is a small example of its usage:
29805
29806 @smallexample
29807 *startfile:
29808 crt0%O%s %:if-exists(crti%O%s) \
29809 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29810 @end smallexample
29811
29812 @item @code{replace-outfile}
29813 The @code{replace-outfile} spec function takes two arguments. It looks for the
29814 first argument in the outfiles array and replaces it with the second argument. Here
29815 is a small example of its usage:
29816
29817 @smallexample
29818 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29819 @end smallexample
29820
29821 @item @code{remove-outfile}
29822 The @code{remove-outfile} spec function takes one argument. It looks for the
29823 first argument in the outfiles array and removes it. Here is a small example
29824 its usage:
29825
29826 @smallexample
29827 %:remove-outfile(-lm)
29828 @end smallexample
29829
29830 @item @code{pass-through-libs}
29831 The @code{pass-through-libs} spec function takes any number of arguments. It
29832 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29833 assumes are the names of linker input library archive files) and returns a
29834 result containing all the found arguments each prepended by
29835 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29836 intended to be passed to the LTO linker plugin.
29837
29838 @smallexample
29839 %:pass-through-libs(%G %L %G)
29840 @end smallexample
29841
29842 @item @code{print-asm-header}
29843 The @code{print-asm-header} function takes no arguments and simply
29844 prints a banner like:
29845
29846 @smallexample
29847 Assembler options
29848 =================
29849
29850 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29851 @end smallexample
29852
29853 It is used to separate compiler options from assembler options
29854 in the @option{--target-help} output.
29855 @end table
29856
29857 @item %@{S@}
29858 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29859 If that switch is not specified, this substitutes nothing. Note that
29860 the leading dash is omitted when specifying this option, and it is
29861 automatically inserted if the substitution is performed. Thus the spec
29862 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29863 and outputs the command-line option @option{-foo}.
29864
29865 @item %W@{S@}
29866 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29867 deleted on failure.
29868
29869 @item %@{S*@}
29870 Substitutes all the switches specified to GCC whose names start
29871 with @code{-S}, but which also take an argument. This is used for
29872 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29873 GCC considers @option{-o foo} as being
29874 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29875 text, including the space. Thus two arguments are generated.
29876
29877 @item %@{S*&T*@}
29878 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29879 (the order of @code{S} and @code{T} in the spec is not significant).
29880 There can be any number of ampersand-separated variables; for each the
29881 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29882
29883 @item %@{S:X@}
29884 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29885
29886 @item %@{!S:X@}
29887 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29888
29889 @item %@{S*:X@}
29890 Substitutes @code{X} if one or more switches whose names start with
29891 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29892 once, no matter how many such switches appeared. However, if @code{%*}
29893 appears somewhere in @code{X}, then @code{X} is substituted once
29894 for each matching switch, with the @code{%*} replaced by the part of
29895 that switch matching the @code{*}.
29896
29897 If @code{%*} appears as the last part of a spec sequence then a space
29898 is added after the end of the last substitution. If there is more
29899 text in the sequence, however, then a space is not generated. This
29900 allows the @code{%*} substitution to be used as part of a larger
29901 string. For example, a spec string like this:
29902
29903 @smallexample
29904 %@{mcu=*:--script=%*/memory.ld@}
29905 @end smallexample
29906
29907 @noindent
29908 when matching an option like @option{-mcu=newchip} produces:
29909
29910 @smallexample
29911 --script=newchip/memory.ld
29912 @end smallexample
29913
29914 @item %@{.S:X@}
29915 Substitutes @code{X}, if processing a file with suffix @code{S}.
29916
29917 @item %@{!.S:X@}
29918 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29919
29920 @item %@{,S:X@}
29921 Substitutes @code{X}, if processing a file for language @code{S}.
29922
29923 @item %@{!,S:X@}
29924 Substitutes @code{X}, if not processing a file for language @code{S}.
29925
29926 @item %@{S|P:X@}
29927 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29928 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29929 @code{*} sequences as well, although they have a stronger binding than
29930 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29931 alternatives must be starred, and only the first matching alternative
29932 is substituted.
29933
29934 For example, a spec string like this:
29935
29936 @smallexample
29937 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29938 @end smallexample
29939
29940 @noindent
29941 outputs the following command-line options from the following input
29942 command-line options:
29943
29944 @smallexample
29945 fred.c -foo -baz
29946 jim.d -bar -boggle
29947 -d fred.c -foo -baz -boggle
29948 -d jim.d -bar -baz -boggle
29949 @end smallexample
29950
29951 @item %@{S:X; T:Y; :D@}
29952
29953 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29954 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29955 be as many clauses as you need. This may be combined with @code{.},
29956 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29957
29958
29959 @end table
29960
29961 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29962 or similar construct can use a backslash to ignore the special meaning
29963 of the character following it, thus allowing literal matching of a
29964 character that is otherwise specially treated. For example,
29965 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29966 @option{-std=iso9899:1999} option is given.
29967
29968 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29969 construct may contain other nested @samp{%} constructs or spaces, or
29970 even newlines. They are processed as usual, as described above.
29971 Trailing white space in @code{X} is ignored. White space may also
29972 appear anywhere on the left side of the colon in these constructs,
29973 except between @code{.} or @code{*} and the corresponding word.
29974
29975 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29976 handled specifically in these constructs. If another value of
29977 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29978 @option{-W} switch is found later in the command line, the earlier
29979 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29980 just one letter, which passes all matching options.
29981
29982 The character @samp{|} at the beginning of the predicate text is used to
29983 indicate that a command should be piped to the following command, but
29984 only if @option{-pipe} is specified.
29985
29986 It is built into GCC which switches take arguments and which do not.
29987 (You might think it would be useful to generalize this to allow each
29988 compiler's spec to say which switches take arguments. But this cannot
29989 be done in a consistent fashion. GCC cannot even decide which input
29990 files have been specified without knowing which switches take arguments,
29991 and it must know which input files to compile in order to tell which
29992 compilers to run).
29993
29994 GCC also knows implicitly that arguments starting in @option{-l} are to be
29995 treated as compiler output files, and passed to the linker in their
29996 proper position among the other output files.
29997
29998 @node Environment Variables
29999 @section Environment Variables Affecting GCC
30000 @cindex environment variables
30001
30002 @c man begin ENVIRONMENT
30003 This section describes several environment variables that affect how GCC
30004 operates. Some of them work by specifying directories or prefixes to use
30005 when searching for various kinds of files. Some are used to specify other
30006 aspects of the compilation environment.
30007
30008 Note that you can also specify places to search using options such as
30009 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
30010 take precedence over places specified using environment variables, which
30011 in turn take precedence over those specified by the configuration of GCC@.
30012 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
30013 GNU Compiler Collection (GCC) Internals}.
30014
30015 @table @env
30016 @item LANG
30017 @itemx LC_CTYPE
30018 @c @itemx LC_COLLATE
30019 @itemx LC_MESSAGES
30020 @c @itemx LC_MONETARY
30021 @c @itemx LC_NUMERIC
30022 @c @itemx LC_TIME
30023 @itemx LC_ALL
30024 @findex LANG
30025 @findex LC_CTYPE
30026 @c @findex LC_COLLATE
30027 @findex LC_MESSAGES
30028 @c @findex LC_MONETARY
30029 @c @findex LC_NUMERIC
30030 @c @findex LC_TIME
30031 @findex LC_ALL
30032 @cindex locale
30033 These environment variables control the way that GCC uses
30034 localization information which allows GCC to work with different
30035 national conventions. GCC inspects the locale categories
30036 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
30037 so. These locale categories can be set to any value supported by your
30038 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
30039 Kingdom encoded in UTF-8.
30040
30041 The @env{LC_CTYPE} environment variable specifies character
30042 classification. GCC uses it to determine the character boundaries in
30043 a string; this is needed for some multibyte encodings that contain quote
30044 and escape characters that are otherwise interpreted as a string
30045 end or escape.
30046
30047 The @env{LC_MESSAGES} environment variable specifies the language to
30048 use in diagnostic messages.
30049
30050 If the @env{LC_ALL} environment variable is set, it overrides the value
30051 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
30052 and @env{LC_MESSAGES} default to the value of the @env{LANG}
30053 environment variable. If none of these variables are set, GCC
30054 defaults to traditional C English behavior.
30055
30056 @item TMPDIR
30057 @findex TMPDIR
30058 If @env{TMPDIR} is set, it specifies the directory to use for temporary
30059 files. GCC uses temporary files to hold the output of one stage of
30060 compilation which is to be used as input to the next stage: for example,
30061 the output of the preprocessor, which is the input to the compiler
30062 proper.
30063
30064 @item GCC_COMPARE_DEBUG
30065 @findex GCC_COMPARE_DEBUG
30066 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
30067 @option{-fcompare-debug} to the compiler driver. See the documentation
30068 of this option for more details.
30069
30070 @item GCC_EXEC_PREFIX
30071 @findex GCC_EXEC_PREFIX
30072 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
30073 names of the subprograms executed by the compiler. No slash is added
30074 when this prefix is combined with the name of a subprogram, but you can
30075 specify a prefix that ends with a slash if you wish.
30076
30077 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
30078 an appropriate prefix to use based on the pathname it is invoked with.
30079
30080 If GCC cannot find the subprogram using the specified prefix, it
30081 tries looking in the usual places for the subprogram.
30082
30083 The default value of @env{GCC_EXEC_PREFIX} is
30084 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
30085 the installed compiler. In many cases @var{prefix} is the value
30086 of @code{prefix} when you ran the @file{configure} script.
30087
30088 Other prefixes specified with @option{-B} take precedence over this prefix.
30089
30090 This prefix is also used for finding files such as @file{crt0.o} that are
30091 used for linking.
30092
30093 In addition, the prefix is used in an unusual way in finding the
30094 directories to search for header files. For each of the standard
30095 directories whose name normally begins with @samp{/usr/local/lib/gcc}
30096 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
30097 replacing that beginning with the specified prefix to produce an
30098 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
30099 @file{foo/bar} just before it searches the standard directory
30100 @file{/usr/local/lib/bar}.
30101 If a standard directory begins with the configured
30102 @var{prefix} then the value of @var{prefix} is replaced by
30103 @env{GCC_EXEC_PREFIX} when looking for header files.
30104
30105 @item COMPILER_PATH
30106 @findex COMPILER_PATH
30107 The value of @env{COMPILER_PATH} is a colon-separated list of
30108 directories, much like @env{PATH}. GCC tries the directories thus
30109 specified when searching for subprograms, if it cannot find the
30110 subprograms using @env{GCC_EXEC_PREFIX}.
30111
30112 @item LIBRARY_PATH
30113 @findex LIBRARY_PATH
30114 The value of @env{LIBRARY_PATH} is a colon-separated list of
30115 directories, much like @env{PATH}. When configured as a native compiler,
30116 GCC tries the directories thus specified when searching for special
30117 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
30118 using GCC also uses these directories when searching for ordinary
30119 libraries for the @option{-l} option (but directories specified with
30120 @option{-L} come first).
30121
30122 @item LANG
30123 @findex LANG
30124 @cindex locale definition
30125 This variable is used to pass locale information to the compiler. One way in
30126 which this information is used is to determine the character set to be used
30127 when character literals, string literals and comments are parsed in C and C++.
30128 When the compiler is configured to allow multibyte characters,
30129 the following values for @env{LANG} are recognized:
30130
30131 @table @samp
30132 @item C-JIS
30133 Recognize JIS characters.
30134 @item C-SJIS
30135 Recognize SJIS characters.
30136 @item C-EUCJP
30137 Recognize EUCJP characters.
30138 @end table
30139
30140 If @env{LANG} is not defined, or if it has some other value, then the
30141 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30142 recognize and translate multibyte characters.
30143 @end table
30144
30145 @noindent
30146 Some additional environment variables affect the behavior of the
30147 preprocessor.
30148
30149 @include cppenv.texi
30150
30151 @c man end
30152
30153 @node Precompiled Headers
30154 @section Using Precompiled Headers
30155 @cindex precompiled headers
30156 @cindex speed of compilation
30157
30158 Often large projects have many header files that are included in every
30159 source file. The time the compiler takes to process these header files
30160 over and over again can account for nearly all of the time required to
30161 build the project. To make builds faster, GCC allows you to
30162 @dfn{precompile} a header file.
30163
30164 To create a precompiled header file, simply compile it as you would any
30165 other file, if necessary using the @option{-x} option to make the driver
30166 treat it as a C or C++ header file. You may want to use a
30167 tool like @command{make} to keep the precompiled header up-to-date when
30168 the headers it contains change.
30169
30170 A precompiled header file is searched for when @code{#include} is
30171 seen in the compilation. As it searches for the included file
30172 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30173 compiler looks for a precompiled header in each directory just before it
30174 looks for the include file in that directory. The name searched for is
30175 the name specified in the @code{#include} with @samp{.gch} appended. If
30176 the precompiled header file cannot be used, it is ignored.
30177
30178 For instance, if you have @code{#include "all.h"}, and you have
30179 @file{all.h.gch} in the same directory as @file{all.h}, then the
30180 precompiled header file is used if possible, and the original
30181 header is used otherwise.
30182
30183 Alternatively, you might decide to put the precompiled header file in a
30184 directory and use @option{-I} to ensure that directory is searched
30185 before (or instead of) the directory containing the original header.
30186 Then, if you want to check that the precompiled header file is always
30187 used, you can put a file of the same name as the original header in this
30188 directory containing an @code{#error} command.
30189
30190 This also works with @option{-include}. So yet another way to use
30191 precompiled headers, good for projects not designed with precompiled
30192 header files in mind, is to simply take most of the header files used by
30193 a project, include them from another header file, precompile that header
30194 file, and @option{-include} the precompiled header. If the header files
30195 have guards against multiple inclusion, they are skipped because
30196 they've already been included (in the precompiled header).
30197
30198 If you need to precompile the same header file for different
30199 languages, targets, or compiler options, you can instead make a
30200 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30201 header in the directory, perhaps using @option{-o}. It doesn't matter
30202 what you call the files in the directory; every precompiled header in
30203 the directory is considered. The first precompiled header
30204 encountered in the directory that is valid for this compilation is
30205 used; they're searched in no particular order.
30206
30207 There are many other possibilities, limited only by your imagination,
30208 good sense, and the constraints of your build system.
30209
30210 A precompiled header file can be used only when these conditions apply:
30211
30212 @itemize
30213 @item
30214 Only one precompiled header can be used in a particular compilation.
30215
30216 @item
30217 A precompiled header cannot be used once the first C token is seen. You
30218 can have preprocessor directives before a precompiled header; you cannot
30219 include a precompiled header from inside another header.
30220
30221 @item
30222 The precompiled header file must be produced for the same language as
30223 the current compilation. You cannot use a C precompiled header for a C++
30224 compilation.
30225
30226 @item
30227 The precompiled header file must have been produced by the same compiler
30228 binary as the current compilation is using.
30229
30230 @item
30231 Any macros defined before the precompiled header is included must
30232 either be defined in the same way as when the precompiled header was
30233 generated, or must not affect the precompiled header, which usually
30234 means that they don't appear in the precompiled header at all.
30235
30236 The @option{-D} option is one way to define a macro before a
30237 precompiled header is included; using a @code{#define} can also do it.
30238 There are also some options that define macros implicitly, like
30239 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30240 defined this way.
30241
30242 @item If debugging information is output when using the precompiled
30243 header, using @option{-g} or similar, the same kind of debugging information
30244 must have been output when building the precompiled header. However,
30245 a precompiled header built using @option{-g} can be used in a compilation
30246 when no debugging information is being output.
30247
30248 @item The same @option{-m} options must generally be used when building
30249 and using the precompiled header. @xref{Submodel Options},
30250 for any cases where this rule is relaxed.
30251
30252 @item Each of the following options must be the same when building and using
30253 the precompiled header:
30254
30255 @gccoptlist{-fexceptions}
30256
30257 @item
30258 Some other command-line options starting with @option{-f},
30259 @option{-p}, or @option{-O} must be defined in the same way as when
30260 the precompiled header was generated. At present, it's not clear
30261 which options are safe to change and which are not; the safest choice
30262 is to use exactly the same options when generating and using the
30263 precompiled header. The following are known to be safe:
30264
30265 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30266 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30267 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30268 -pedantic-errors}
30269
30270 @end itemize
30271
30272 For all of these except the last, the compiler automatically
30273 ignores the precompiled header if the conditions aren't met. If you
30274 find an option combination that doesn't work and doesn't cause the
30275 precompiled header to be ignored, please consider filing a bug report,
30276 see @ref{Bugs}.
30277
30278 If you do use differing options when generating and using the
30279 precompiled header, the actual behavior is a mixture of the
30280 behavior for the options. For instance, if you use @option{-g} to
30281 generate the precompiled header but not when using it, you may or may
30282 not get debugging information for routines in the precompiled header.