PR c++/91979 - mangling nullptr expression
[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 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
588 -fdbg-cnt=@var{counter-value-list} @gol
589 -fdisable-ipa-@var{pass_name} @gol
590 -fdisable-rtl-@var{pass_name} @gol
591 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
592 -fdisable-tree-@var{pass_name} @gol
593 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
594 -fdump-debug -fdump-earlydebug @gol
595 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
596 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
597 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
598 -fdump-lang-all @gol
599 -fdump-lang-@var{switch} @gol
600 -fdump-lang-@var{switch}-@var{options} @gol
601 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
602 -fdump-passes @gol
603 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
604 -fdump-statistics @gol
605 -fdump-tree-all @gol
606 -fdump-tree-@var{switch} @gol
607 -fdump-tree-@var{switch}-@var{options} @gol
608 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
609 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
610 -fenable-@var{kind}-@var{pass} @gol
611 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
612 -fira-verbose=@var{n} @gol
613 -flto-report -flto-report-wpa -fmem-report-wpa @gol
614 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
615 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
616 -fprofile-report @gol
617 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
618 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
619 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
620 -fvar-tracking-assignments-toggle -gtoggle @gol
621 -print-file-name=@var{library} -print-libgcc-file-name @gol
622 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
623 -print-prog-name=@var{program} -print-search-dirs -Q @gol
624 -print-sysroot -print-sysroot-headers-suffix @gol
625 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
626
627 @item Machine-Dependent Options
628 @xref{Submodel Options,,Machine-Dependent Options}.
629 @c This list is ordered alphanumerically by subsection name.
630 @c Try and put the significant identifier (CPU or system) first,
631 @c so users have a clue at guessing where the ones they want will be.
632
633 @emph{AArch64 Options}
634 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
635 -mgeneral-regs-only @gol
636 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
637 -mstrict-align -mno-strict-align @gol
638 -momit-leaf-frame-pointer @gol
639 -mtls-dialect=desc -mtls-dialect=traditional @gol
640 -mtls-size=@var{size} @gol
641 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
642 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
643 -mpc-relative-literal-loads @gol
644 -msign-return-address=@var{scope} @gol
645 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
646 +@var{b-key}]|@var{bti} @gol
647 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
648 -moverride=@var{string} -mverbose-cost-dump @gol
649 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
650 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
651 -moutline-atomics }
652
653 @emph{Adapteva Epiphany Options}
654 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
655 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
656 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
657 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
658 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
659 -msplit-vecmove-early -m1reg-@var{reg}}
660
661 @emph{AMD GCN Options}
662 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
663
664 @emph{ARC Options}
665 @gccoptlist{-mbarrel-shifter -mjli-always @gol
666 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
667 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
668 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
669 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
670 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
671 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
672 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
673 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
674 -mvolatile-cache -mtp-regno=@var{regno} @gol
675 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
676 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
677 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
678 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
679 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
680 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
681 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
682 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
683
684 @emph{ARM Options}
685 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
686 -mabi=@var{name} @gol
687 -mapcs-stack-check -mno-apcs-stack-check @gol
688 -mapcs-reentrant -mno-apcs-reentrant @gol
689 -mgeneral-regs-only @gol
690 -msched-prolog -mno-sched-prolog @gol
691 -mlittle-endian -mbig-endian @gol
692 -mbe8 -mbe32 @gol
693 -mfloat-abi=@var{name} @gol
694 -mfp16-format=@var{name}
695 -mthumb-interwork -mno-thumb-interwork @gol
696 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
697 -mtune=@var{name} -mprint-tune-info @gol
698 -mstructure-size-boundary=@var{n} @gol
699 -mabort-on-noreturn @gol
700 -mlong-calls -mno-long-calls @gol
701 -msingle-pic-base -mno-single-pic-base @gol
702 -mpic-register=@var{reg} @gol
703 -mnop-fun-dllimport @gol
704 -mpoke-function-name @gol
705 -mthumb -marm -mflip-thumb @gol
706 -mtpcs-frame -mtpcs-leaf-frame @gol
707 -mcaller-super-interworking -mcallee-super-interworking @gol
708 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
709 -mword-relocations @gol
710 -mfix-cortex-m3-ldrd @gol
711 -munaligned-access @gol
712 -mneon-for-64bits @gol
713 -mslow-flash-data @gol
714 -masm-syntax-unified @gol
715 -mrestrict-it @gol
716 -mverbose-cost-dump @gol
717 -mpure-code @gol
718 -mcmse @gol
719 -mfdpic}
720
721 @emph{AVR Options}
722 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
723 -mbranch-cost=@var{cost} @gol
724 -mcall-prologues -mgas-isr-prologues -mint8 @gol
725 -mn_flash=@var{size} -mno-interrupts @gol
726 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
727 -mfract-convert-truncate @gol
728 -mshort-calls -nodevicelib @gol
729 -Waddr-space-convert -Wmisspelled-isr}
730
731 @emph{Blackfin Options}
732 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
733 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
734 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
735 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
736 -mno-id-shared-library -mshared-library-id=@var{n} @gol
737 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
738 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
739 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
740 -micplb}
741
742 @emph{C6X Options}
743 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
744 -msim -msdata=@var{sdata-type}}
745
746 @emph{CRIS Options}
747 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
748 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
749 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
750 -mstack-align -mdata-align -mconst-align @gol
751 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
752 -melf -maout -melinux -mlinux -sim -sim2 @gol
753 -mmul-bug-workaround -mno-mul-bug-workaround}
754
755 @emph{CR16 Options}
756 @gccoptlist{-mmac @gol
757 -mcr16cplus -mcr16c @gol
758 -msim -mint32 -mbit-ops
759 -mdata-model=@var{model}}
760
761 @emph{C-SKY Options}
762 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
763 -mbig-endian -EB -mlittle-endian -EL @gol
764 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
765 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
766 -mdsp -medsp -mvdsp @gol
767 -mdiv -msmart -mhigh-registers -manchor @gol
768 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
769 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
770
771 @emph{Darwin Options}
772 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
773 -arch_only -bind_at_load -bundle -bundle_loader @gol
774 -client_name -compatibility_version -current_version @gol
775 -dead_strip @gol
776 -dependency-file -dylib_file -dylinker_install_name @gol
777 -dynamic -dynamiclib -exported_symbols_list @gol
778 -filelist -flat_namespace -force_cpusubtype_ALL @gol
779 -force_flat_namespace -headerpad_max_install_names @gol
780 -iframework @gol
781 -image_base -init -install_name -keep_private_externs @gol
782 -multi_module -multiply_defined -multiply_defined_unused @gol
783 -noall_load -no_dead_strip_inits_and_terms @gol
784 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
785 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
786 -private_bundle -read_only_relocs -sectalign @gol
787 -sectobjectsymbols -whyload -seg1addr @gol
788 -sectcreate -sectobjectsymbols -sectorder @gol
789 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
790 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
791 -segprot -segs_read_only_addr -segs_read_write_addr @gol
792 -single_module -static -sub_library -sub_umbrella @gol
793 -twolevel_namespace -umbrella -undefined @gol
794 -unexported_symbols_list -weak_reference_mismatches @gol
795 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
796 -mkernel -mone-byte-bool}
797
798 @emph{DEC Alpha Options}
799 @gccoptlist{-mno-fp-regs -msoft-float @gol
800 -mieee -mieee-with-inexact -mieee-conformant @gol
801 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
802 -mtrap-precision=@var{mode} -mbuild-constants @gol
803 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
804 -mbwx -mmax -mfix -mcix @gol
805 -mfloat-vax -mfloat-ieee @gol
806 -mexplicit-relocs -msmall-data -mlarge-data @gol
807 -msmall-text -mlarge-text @gol
808 -mmemory-latency=@var{time}}
809
810 @emph{eBPF Options}
811 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
812 -mframe-limit=@var{bytes}}
813
814 @emph{FR30 Options}
815 @gccoptlist{-msmall-model -mno-lsim}
816
817 @emph{FT32 Options}
818 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
819
820 @emph{FRV Options}
821 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
822 -mhard-float -msoft-float @gol
823 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
824 -mdouble -mno-double @gol
825 -mmedia -mno-media -mmuladd -mno-muladd @gol
826 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
827 -mlinked-fp -mlong-calls -malign-labels @gol
828 -mlibrary-pic -macc-4 -macc-8 @gol
829 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
830 -moptimize-membar -mno-optimize-membar @gol
831 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
832 -mvliw-branch -mno-vliw-branch @gol
833 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
834 -mno-nested-cond-exec -mtomcat-stats @gol
835 -mTLS -mtls @gol
836 -mcpu=@var{cpu}}
837
838 @emph{GNU/Linux Options}
839 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
840 -tno-android-cc -tno-android-ld}
841
842 @emph{H8/300 Options}
843 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
844
845 @emph{HPPA Options}
846 @gccoptlist{-march=@var{architecture-type} @gol
847 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
848 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
849 -mfixed-range=@var{register-range} @gol
850 -mjump-in-delay -mlinker-opt -mlong-calls @gol
851 -mlong-load-store -mno-disable-fpregs @gol
852 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
853 -mno-jump-in-delay -mno-long-load-store @gol
854 -mno-portable-runtime -mno-soft-float @gol
855 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
856 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
857 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
858 -munix=@var{unix-std} -nolibdld -static -threads}
859
860 @emph{IA-64 Options}
861 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
862 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
863 -mconstant-gp -mauto-pic -mfused-madd @gol
864 -minline-float-divide-min-latency @gol
865 -minline-float-divide-max-throughput @gol
866 -mno-inline-float-divide @gol
867 -minline-int-divide-min-latency @gol
868 -minline-int-divide-max-throughput @gol
869 -mno-inline-int-divide @gol
870 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
871 -mno-inline-sqrt @gol
872 -mdwarf2-asm -mearly-stop-bits @gol
873 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
874 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
875 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
876 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
877 -msched-spec-ldc -msched-spec-control-ldc @gol
878 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
879 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
880 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
881 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
882
883 @emph{LM32 Options}
884 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
885 -msign-extend-enabled -muser-enabled}
886
887 @emph{M32R/D Options}
888 @gccoptlist{-m32r2 -m32rx -m32r @gol
889 -mdebug @gol
890 -malign-loops -mno-align-loops @gol
891 -missue-rate=@var{number} @gol
892 -mbranch-cost=@var{number} @gol
893 -mmodel=@var{code-size-model-type} @gol
894 -msdata=@var{sdata-type} @gol
895 -mno-flush-func -mflush-func=@var{name} @gol
896 -mno-flush-trap -mflush-trap=@var{number} @gol
897 -G @var{num}}
898
899 @emph{M32C Options}
900 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
901
902 @emph{M680x0 Options}
903 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
904 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
905 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
906 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
907 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
908 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
909 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
910 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
911 -mxgot -mno-xgot -mlong-jump-table-offsets}
912
913 @emph{MCore Options}
914 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
915 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
916 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
917 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
918 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
919
920 @emph{MeP Options}
921 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
922 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
923 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
924 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
925 -mtiny=@var{n}}
926
927 @emph{MicroBlaze Options}
928 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
929 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
930 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
931 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
932 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
933 -mpic-data-is-text-relative}
934
935 @emph{MIPS Options}
936 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
937 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
938 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
939 -mips16 -mno-mips16 -mflip-mips16 @gol
940 -minterlink-compressed -mno-interlink-compressed @gol
941 -minterlink-mips16 -mno-interlink-mips16 @gol
942 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
943 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
944 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
945 -mno-float -msingle-float -mdouble-float @gol
946 -modd-spreg -mno-odd-spreg @gol
947 -mabs=@var{mode} -mnan=@var{encoding} @gol
948 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
949 -mmcu -mmno-mcu @gol
950 -meva -mno-eva @gol
951 -mvirt -mno-virt @gol
952 -mxpa -mno-xpa @gol
953 -mcrc -mno-crc @gol
954 -mginv -mno-ginv @gol
955 -mmicromips -mno-micromips @gol
956 -mmsa -mno-msa @gol
957 -mloongson-mmi -mno-loongson-mmi @gol
958 -mloongson-ext -mno-loongson-ext @gol
959 -mloongson-ext2 -mno-loongson-ext2 @gol
960 -mfpu=@var{fpu-type} @gol
961 -msmartmips -mno-smartmips @gol
962 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
963 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
964 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
965 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
966 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
967 -membedded-data -mno-embedded-data @gol
968 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
969 -mcode-readable=@var{setting} @gol
970 -msplit-addresses -mno-split-addresses @gol
971 -mexplicit-relocs -mno-explicit-relocs @gol
972 -mcheck-zero-division -mno-check-zero-division @gol
973 -mdivide-traps -mdivide-breaks @gol
974 -mload-store-pairs -mno-load-store-pairs @gol
975 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
976 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
977 -mfix-24k -mno-fix-24k @gol
978 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
979 -mfix-r5900 -mno-fix-r5900 @gol
980 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
981 -mfix-vr4120 -mno-fix-vr4120 @gol
982 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
983 -mflush-func=@var{func} -mno-flush-func @gol
984 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
985 -mcompact-branches=@var{policy} @gol
986 -mfp-exceptions -mno-fp-exceptions @gol
987 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
988 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
989 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
990 -mframe-header-opt -mno-frame-header-opt}
991
992 @emph{MMIX Options}
993 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
994 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
995 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
996 -mno-base-addresses -msingle-exit -mno-single-exit}
997
998 @emph{MN10300 Options}
999 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1000 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1001 -mtune=@var{cpu-type} @gol
1002 -mreturn-pointer-on-d0 @gol
1003 -mno-crt0 -mrelax -mliw -msetlb}
1004
1005 @emph{Moxie Options}
1006 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1007
1008 @emph{MSP430 Options}
1009 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1010 -mwarn-mcu @gol
1011 -mcode-region= -mdata-region= @gol
1012 -msilicon-errata= -msilicon-errata-warn= @gol
1013 -mhwmult= -minrt -mtiny-printf}
1014
1015 @emph{NDS32 Options}
1016 @gccoptlist{-mbig-endian -mlittle-endian @gol
1017 -mreduced-regs -mfull-regs @gol
1018 -mcmov -mno-cmov @gol
1019 -mext-perf -mno-ext-perf @gol
1020 -mext-perf2 -mno-ext-perf2 @gol
1021 -mext-string -mno-ext-string @gol
1022 -mv3push -mno-v3push @gol
1023 -m16bit -mno-16bit @gol
1024 -misr-vector-size=@var{num} @gol
1025 -mcache-block-size=@var{num} @gol
1026 -march=@var{arch} @gol
1027 -mcmodel=@var{code-model} @gol
1028 -mctor-dtor -mrelax}
1029
1030 @emph{Nios II Options}
1031 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1032 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1033 -mel -meb @gol
1034 -mno-bypass-cache -mbypass-cache @gol
1035 -mno-cache-volatile -mcache-volatile @gol
1036 -mno-fast-sw-div -mfast-sw-div @gol
1037 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1038 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1039 -mcustom-fpu-cfg=@var{name} @gol
1040 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1041 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1042
1043 @emph{Nvidia PTX Options}
1044 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1045
1046 @emph{OpenRISC Options}
1047 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1048 -msoft-mul -msoft-div @gol
1049 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1050 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1051
1052 @emph{PDP-11 Options}
1053 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1054 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1055 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1056
1057 @emph{picoChip Options}
1058 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1059 -msymbol-as-address -mno-inefficient-warnings}
1060
1061 @emph{PowerPC Options}
1062 See RS/6000 and PowerPC Options.
1063
1064 @emph{PRU Options}
1065 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1066 -mabi=@var{variant} @gol}
1067
1068 @emph{RISC-V Options}
1069 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1070 -mplt -mno-plt @gol
1071 -mabi=@var{ABI-string} @gol
1072 -mfdiv -mno-fdiv @gol
1073 -mdiv -mno-div @gol
1074 -march=@var{ISA-string} @gol
1075 -mtune=@var{processor-string} @gol
1076 -mpreferred-stack-boundary=@var{num} @gol
1077 -msmall-data-limit=@var{N-bytes} @gol
1078 -msave-restore -mno-save-restore @gol
1079 -mstrict-align -mno-strict-align @gol
1080 -mcmodel=medlow -mcmodel=medany @gol
1081 -mexplicit-relocs -mno-explicit-relocs @gol
1082 -mrelax -mno-relax @gol
1083 -mriscv-attribute -mmo-riscv-attribute @gol
1084 -malign-data=@var{type}}
1085
1086 @emph{RL78 Options}
1087 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1088 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1089 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1090
1091 @emph{RS/6000 and PowerPC Options}
1092 @gccoptlist{-mcpu=@var{cpu-type} @gol
1093 -mtune=@var{cpu-type} @gol
1094 -mcmodel=@var{code-model} @gol
1095 -mpowerpc64 @gol
1096 -maltivec -mno-altivec @gol
1097 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1098 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1099 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1100 -mfprnd -mno-fprnd @gol
1101 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1102 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1103 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1104 -malign-power -malign-natural @gol
1105 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1106 -mupdate -mno-update @gol
1107 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1108 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1109 -mstrict-align -mno-strict-align -mrelocatable @gol
1110 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1111 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1112 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1113 -mprioritize-restricted-insns=@var{priority} @gol
1114 -msched-costly-dep=@var{dependence_type} @gol
1115 -minsert-sched-nops=@var{scheme} @gol
1116 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1117 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1118 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1119 -mtraceback=@var{traceback_type} @gol
1120 -maix-struct-return -msvr4-struct-return @gol
1121 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1122 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1123 -mblock-move-inline-limit=@var{num} @gol
1124 -mblock-compare-inline-limit=@var{num} @gol
1125 -mblock-compare-inline-loop-limit=@var{num} @gol
1126 -mstring-compare-inline-limit=@var{num} @gol
1127 -misel -mno-isel @gol
1128 -mvrsave -mno-vrsave @gol
1129 -mmulhw -mno-mulhw @gol
1130 -mdlmzb -mno-dlmzb @gol
1131 -mprototype -mno-prototype @gol
1132 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1133 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1134 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1135 -mno-recip-precision @gol
1136 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1137 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1138 -msave-toc-indirect -mno-save-toc-indirect @gol
1139 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1140 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1141 -mquad-memory -mno-quad-memory @gol
1142 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1143 -mcompat-align-parm -mno-compat-align-parm @gol
1144 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1145 -mgnu-attribute -mno-gnu-attribute @gol
1146 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1147 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1148
1149 @emph{RX Options}
1150 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1151 -mcpu=@gol
1152 -mbig-endian-data -mlittle-endian-data @gol
1153 -msmall-data @gol
1154 -msim -mno-sim@gol
1155 -mas100-syntax -mno-as100-syntax@gol
1156 -mrelax@gol
1157 -mmax-constant-size=@gol
1158 -mint-register=@gol
1159 -mpid@gol
1160 -mallow-string-insns -mno-allow-string-insns@gol
1161 -mjsr@gol
1162 -mno-warn-multiple-fast-interrupts@gol
1163 -msave-acc-in-interrupts}
1164
1165 @emph{S/390 and zSeries Options}
1166 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1167 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1168 -mlong-double-64 -mlong-double-128 @gol
1169 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1170 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1171 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1172 -mhtm -mvx -mzvector @gol
1173 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1174 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1175 -mhotpatch=@var{halfwords},@var{halfwords}}
1176
1177 @emph{Score Options}
1178 @gccoptlist{-meb -mel @gol
1179 -mnhwloop @gol
1180 -muls @gol
1181 -mmac @gol
1182 -mscore5 -mscore5u -mscore7 -mscore7d}
1183
1184 @emph{SH Options}
1185 @gccoptlist{-m1 -m2 -m2e @gol
1186 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1187 -m3 -m3e @gol
1188 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1189 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1190 -mb -ml -mdalign -mrelax @gol
1191 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1192 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1193 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1194 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1195 -maccumulate-outgoing-args @gol
1196 -matomic-model=@var{atomic-model} @gol
1197 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1198 -mcbranch-force-delay-slot @gol
1199 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1200 -mpretend-cmove -mtas}
1201
1202 @emph{Solaris 2 Options}
1203 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1204 -pthreads}
1205
1206 @emph{SPARC Options}
1207 @gccoptlist{-mcpu=@var{cpu-type} @gol
1208 -mtune=@var{cpu-type} @gol
1209 -mcmodel=@var{code-model} @gol
1210 -mmemory-model=@var{mem-model} @gol
1211 -m32 -m64 -mapp-regs -mno-app-regs @gol
1212 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1213 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1214 -mhard-quad-float -msoft-quad-float @gol
1215 -mstack-bias -mno-stack-bias @gol
1216 -mstd-struct-return -mno-std-struct-return @gol
1217 -munaligned-doubles -mno-unaligned-doubles @gol
1218 -muser-mode -mno-user-mode @gol
1219 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1220 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1221 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1222 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1223 -mpopc -mno-popc -msubxc -mno-subxc @gol
1224 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1225 -mlra -mno-lra}
1226
1227 @emph{System V Options}
1228 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1229
1230 @emph{TILE-Gx Options}
1231 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1232 -mcmodel=@var{code-model}}
1233
1234 @emph{TILEPro Options}
1235 @gccoptlist{-mcpu=@var{cpu} -m32}
1236
1237 @emph{V850 Options}
1238 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1239 -mprolog-function -mno-prolog-function -mspace @gol
1240 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1241 -mapp-regs -mno-app-regs @gol
1242 -mdisable-callt -mno-disable-callt @gol
1243 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1244 -mv850e -mv850 -mv850e3v5 @gol
1245 -mloop @gol
1246 -mrelax @gol
1247 -mlong-jumps @gol
1248 -msoft-float @gol
1249 -mhard-float @gol
1250 -mgcc-abi @gol
1251 -mrh850-abi @gol
1252 -mbig-switch}
1253
1254 @emph{VAX Options}
1255 @gccoptlist{-mg -mgnu -munix}
1256
1257 @emph{Visium Options}
1258 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1259 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1260
1261 @emph{VMS Options}
1262 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1263 -mpointer-size=@var{size}}
1264
1265 @emph{VxWorks Options}
1266 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1267 -Xbind-lazy -Xbind-now}
1268
1269 @emph{x86 Options}
1270 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1271 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1272 -mfpmath=@var{unit} @gol
1273 -masm=@var{dialect} -mno-fancy-math-387 @gol
1274 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1275 -mno-wide-multiply -mrtd -malign-double @gol
1276 -mpreferred-stack-boundary=@var{num} @gol
1277 -mincoming-stack-boundary=@var{num} @gol
1278 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1279 -mrecip -mrecip=@var{opt} @gol
1280 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1281 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1282 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1283 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1284 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1285 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1286 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1287 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1288 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1289 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1290 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1291 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1292 -mrdseed -msgx -mavx512vp2intersect@gol
1293 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1294 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1295 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1296 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1297 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1298 -mregparm=@var{num} -msseregparm @gol
1299 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1300 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1301 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1302 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1303 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1304 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1305 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1306 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1307 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1308 -mstack-protector-guard-reg=@var{reg} @gol
1309 -mstack-protector-guard-offset=@var{offset} @gol
1310 -mstack-protector-guard-symbol=@var{symbol} @gol
1311 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1312 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1313 -mindirect-branch-register}
1314
1315 @emph{x86 Windows Options}
1316 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1317 -mnop-fun-dllimport -mthread @gol
1318 -municode -mwin32 -mwindows -fno-set-stack-executable}
1319
1320 @emph{Xstormy16 Options}
1321 @gccoptlist{-msim}
1322
1323 @emph{Xtensa Options}
1324 @gccoptlist{-mconst16 -mno-const16 @gol
1325 -mfused-madd -mno-fused-madd @gol
1326 -mforce-no-pic @gol
1327 -mserialize-volatile -mno-serialize-volatile @gol
1328 -mtext-section-literals -mno-text-section-literals @gol
1329 -mauto-litpools -mno-auto-litpools @gol
1330 -mtarget-align -mno-target-align @gol
1331 -mlongcalls -mno-longcalls}
1332
1333 @emph{zSeries Options}
1334 See S/390 and zSeries Options.
1335 @end table
1336
1337
1338 @node Overall Options
1339 @section Options Controlling the Kind of Output
1340
1341 Compilation can involve up to four stages: preprocessing, compilation
1342 proper, assembly and linking, always in that order. GCC is capable of
1343 preprocessing and compiling several files either into several
1344 assembler input files, or into one assembler input file; then each
1345 assembler input file produces an object file, and linking combines all
1346 the object files (those newly compiled, and those specified as input)
1347 into an executable file.
1348
1349 @cindex file name suffix
1350 For any given input file, the file name suffix determines what kind of
1351 compilation is done:
1352
1353 @table @gcctabopt
1354 @item @var{file}.c
1355 C source code that must be preprocessed.
1356
1357 @item @var{file}.i
1358 C source code that should not be preprocessed.
1359
1360 @item @var{file}.ii
1361 C++ source code that should not be preprocessed.
1362
1363 @item @var{file}.m
1364 Objective-C source code. Note that you must link with the @file{libobjc}
1365 library to make an Objective-C program work.
1366
1367 @item @var{file}.mi
1368 Objective-C source code that should not be preprocessed.
1369
1370 @item @var{file}.mm
1371 @itemx @var{file}.M
1372 Objective-C++ source code. Note that you must link with the @file{libobjc}
1373 library to make an Objective-C++ program work. Note that @samp{.M} refers
1374 to a literal capital M@.
1375
1376 @item @var{file}.mii
1377 Objective-C++ source code that should not be preprocessed.
1378
1379 @item @var{file}.h
1380 C, C++, Objective-C or Objective-C++ header file to be turned into a
1381 precompiled header (default), or C, C++ header file to be turned into an
1382 Ada spec (via the @option{-fdump-ada-spec} switch).
1383
1384 @item @var{file}.cc
1385 @itemx @var{file}.cp
1386 @itemx @var{file}.cxx
1387 @itemx @var{file}.cpp
1388 @itemx @var{file}.CPP
1389 @itemx @var{file}.c++
1390 @itemx @var{file}.C
1391 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1392 the last two letters must both be literally @samp{x}. Likewise,
1393 @samp{.C} refers to a literal capital C@.
1394
1395 @item @var{file}.mm
1396 @itemx @var{file}.M
1397 Objective-C++ source code that must be preprocessed.
1398
1399 @item @var{file}.mii
1400 Objective-C++ source code that should not be preprocessed.
1401
1402 @item @var{file}.hh
1403 @itemx @var{file}.H
1404 @itemx @var{file}.hp
1405 @itemx @var{file}.hxx
1406 @itemx @var{file}.hpp
1407 @itemx @var{file}.HPP
1408 @itemx @var{file}.h++
1409 @itemx @var{file}.tcc
1410 C++ header file to be turned into a precompiled header or Ada spec.
1411
1412 @item @var{file}.f
1413 @itemx @var{file}.for
1414 @itemx @var{file}.ftn
1415 Fixed form Fortran source code that should not be preprocessed.
1416
1417 @item @var{file}.F
1418 @itemx @var{file}.FOR
1419 @itemx @var{file}.fpp
1420 @itemx @var{file}.FPP
1421 @itemx @var{file}.FTN
1422 Fixed form Fortran source code that must be preprocessed (with the traditional
1423 preprocessor).
1424
1425 @item @var{file}.f90
1426 @itemx @var{file}.f95
1427 @itemx @var{file}.f03
1428 @itemx @var{file}.f08
1429 Free form Fortran source code that should not be preprocessed.
1430
1431 @item @var{file}.F90
1432 @itemx @var{file}.F95
1433 @itemx @var{file}.F03
1434 @itemx @var{file}.F08
1435 Free form Fortran source code that must be preprocessed (with the
1436 traditional preprocessor).
1437
1438 @item @var{file}.go
1439 Go source code.
1440
1441 @item @var{file}.brig
1442 BRIG files (binary representation of HSAIL).
1443
1444 @item @var{file}.d
1445 D source code.
1446
1447 @item @var{file}.di
1448 D interface file.
1449
1450 @item @var{file}.dd
1451 D documentation code (Ddoc).
1452
1453 @item @var{file}.ads
1454 Ada source code file that contains a library unit declaration (a
1455 declaration of a package, subprogram, or generic, or a generic
1456 instantiation), or a library unit renaming declaration (a package,
1457 generic, or subprogram renaming declaration). Such files are also
1458 called @dfn{specs}.
1459
1460 @item @var{file}.adb
1461 Ada source code file containing a library unit body (a subprogram or
1462 package body). Such files are also called @dfn{bodies}.
1463
1464 @c GCC also knows about some suffixes for languages not yet included:
1465 @c Ratfor:
1466 @c @var{file}.r
1467
1468 @item @var{file}.s
1469 Assembler code.
1470
1471 @item @var{file}.S
1472 @itemx @var{file}.sx
1473 Assembler code that must be preprocessed.
1474
1475 @item @var{other}
1476 An object file to be fed straight into linking.
1477 Any file name with no recognized suffix is treated this way.
1478 @end table
1479
1480 @opindex x
1481 You can specify the input language explicitly with the @option{-x} option:
1482
1483 @table @gcctabopt
1484 @item -x @var{language}
1485 Specify explicitly the @var{language} for the following input files
1486 (rather than letting the compiler choose a default based on the file
1487 name suffix). This option applies to all following input files until
1488 the next @option{-x} option. Possible values for @var{language} are:
1489 @smallexample
1490 c c-header cpp-output
1491 c++ c++-header c++-cpp-output
1492 objective-c objective-c-header objective-c-cpp-output
1493 objective-c++ objective-c++-header objective-c++-cpp-output
1494 assembler assembler-with-cpp
1495 ada
1496 d
1497 f77 f77-cpp-input f95 f95-cpp-input
1498 go
1499 brig
1500 @end smallexample
1501
1502 @item -x none
1503 Turn off any specification of a language, so that subsequent files are
1504 handled according to their file name suffixes (as they are if @option{-x}
1505 has not been used at all).
1506 @end table
1507
1508 If you only want some of the stages of compilation, you can use
1509 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1510 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1511 @command{gcc} is to stop. Note that some combinations (for example,
1512 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1513
1514 @table @gcctabopt
1515 @item -c
1516 @opindex c
1517 Compile or assemble the source files, but do not link. The linking
1518 stage simply is not done. The ultimate output is in the form of an
1519 object file for each source file.
1520
1521 By default, the object file name for a source file is made by replacing
1522 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1523
1524 Unrecognized input files, not requiring compilation or assembly, are
1525 ignored.
1526
1527 @item -S
1528 @opindex S
1529 Stop after the stage of compilation proper; do not assemble. The output
1530 is in the form of an assembler code file for each non-assembler input
1531 file specified.
1532
1533 By default, the assembler file name for a source file is made by
1534 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1535
1536 Input files that don't require compilation are ignored.
1537
1538 @item -E
1539 @opindex E
1540 Stop after the preprocessing stage; do not run the compiler proper. The
1541 output is in the form of preprocessed source code, which is sent to the
1542 standard output.
1543
1544 Input files that don't require preprocessing are ignored.
1545
1546 @cindex output file option
1547 @item -o @var{file}
1548 @opindex o
1549 Place output in file @var{file}. This applies to whatever
1550 sort of output is being produced, whether it be an executable file,
1551 an object file, an assembler file or preprocessed C code.
1552
1553 If @option{-o} is not specified, the default is to put an executable
1554 file in @file{a.out}, the object file for
1555 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1556 assembler file in @file{@var{source}.s}, a precompiled header file in
1557 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1558 standard output.
1559
1560 @item -v
1561 @opindex v
1562 Print (on standard error output) the commands executed to run the stages
1563 of compilation. Also print the version number of the compiler driver
1564 program and of the preprocessor and the compiler proper.
1565
1566 @item -###
1567 @opindex ###
1568 Like @option{-v} except the commands are not executed and arguments
1569 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1570 This is useful for shell scripts to capture the driver-generated command lines.
1571
1572 @item --help
1573 @opindex help
1574 Print (on the standard output) a description of the command-line options
1575 understood by @command{gcc}. If the @option{-v} option is also specified
1576 then @option{--help} is also passed on to the various processes
1577 invoked by @command{gcc}, so that they can display the command-line options
1578 they accept. If the @option{-Wextra} option has also been specified
1579 (prior to the @option{--help} option), then command-line options that
1580 have no documentation associated with them are also displayed.
1581
1582 @item --target-help
1583 @opindex target-help
1584 Print (on the standard output) a description of target-specific command-line
1585 options for each tool. For some targets extra target-specific
1586 information may also be printed.
1587
1588 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1589 Print (on the standard output) a description of the command-line
1590 options understood by the compiler that fit into all specified classes
1591 and qualifiers. These are the supported classes:
1592
1593 @table @asis
1594 @item @samp{optimizers}
1595 Display all of the optimization options supported by the
1596 compiler.
1597
1598 @item @samp{warnings}
1599 Display all of the options controlling warning messages
1600 produced by the compiler.
1601
1602 @item @samp{target}
1603 Display target-specific options. Unlike the
1604 @option{--target-help} option however, target-specific options of the
1605 linker and assembler are not displayed. This is because those
1606 tools do not currently support the extended @option{--help=} syntax.
1607
1608 @item @samp{params}
1609 Display the values recognized by the @option{--param}
1610 option.
1611
1612 @item @var{language}
1613 Display the options supported for @var{language}, where
1614 @var{language} is the name of one of the languages supported in this
1615 version of GCC@.
1616
1617 @item @samp{common}
1618 Display the options that are common to all languages.
1619 @end table
1620
1621 These are the supported qualifiers:
1622
1623 @table @asis
1624 @item @samp{undocumented}
1625 Display only those options that are undocumented.
1626
1627 @item @samp{joined}
1628 Display options taking an argument that appears after an equal
1629 sign in the same continuous piece of text, such as:
1630 @samp{--help=target}.
1631
1632 @item @samp{separate}
1633 Display options taking an argument that appears as a separate word
1634 following the original option, such as: @samp{-o output-file}.
1635 @end table
1636
1637 Thus for example to display all the undocumented target-specific
1638 switches supported by the compiler, use:
1639
1640 @smallexample
1641 --help=target,undocumented
1642 @end smallexample
1643
1644 The sense of a qualifier can be inverted by prefixing it with the
1645 @samp{^} character, so for example to display all binary warning
1646 options (i.e., ones that are either on or off and that do not take an
1647 argument) that have a description, use:
1648
1649 @smallexample
1650 --help=warnings,^joined,^undocumented
1651 @end smallexample
1652
1653 The argument to @option{--help=} should not consist solely of inverted
1654 qualifiers.
1655
1656 Combining several classes is possible, although this usually
1657 restricts the output so much that there is nothing to display. One
1658 case where it does work, however, is when one of the classes is
1659 @var{target}. For example, to display all the target-specific
1660 optimization options, use:
1661
1662 @smallexample
1663 --help=target,optimizers
1664 @end smallexample
1665
1666 The @option{--help=} option can be repeated on the command line. Each
1667 successive use displays its requested class of options, skipping
1668 those that have already been displayed. If @option{--help} is also
1669 specified anywhere on the command line then this takes precedence
1670 over any @option{--help=} option.
1671
1672 If the @option{-Q} option appears on the command line before the
1673 @option{--help=} option, then the descriptive text displayed by
1674 @option{--help=} is changed. Instead of describing the displayed
1675 options, an indication is given as to whether the option is enabled,
1676 disabled or set to a specific value (assuming that the compiler
1677 knows this at the point where the @option{--help=} option is used).
1678
1679 Here is a truncated example from the ARM port of @command{gcc}:
1680
1681 @smallexample
1682 % gcc -Q -mabi=2 --help=target -c
1683 The following options are target specific:
1684 -mabi= 2
1685 -mabort-on-noreturn [disabled]
1686 -mapcs [disabled]
1687 @end smallexample
1688
1689 The output is sensitive to the effects of previous command-line
1690 options, so for example it is possible to find out which optimizations
1691 are enabled at @option{-O2} by using:
1692
1693 @smallexample
1694 -Q -O2 --help=optimizers
1695 @end smallexample
1696
1697 Alternatively you can discover which binary optimizations are enabled
1698 by @option{-O3} by using:
1699
1700 @smallexample
1701 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1702 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1703 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1704 @end smallexample
1705
1706 @item --version
1707 @opindex version
1708 Display the version number and copyrights of the invoked GCC@.
1709
1710 @item -pass-exit-codes
1711 @opindex pass-exit-codes
1712 Normally the @command{gcc} program exits with the code of 1 if any
1713 phase of the compiler returns a non-success return code. If you specify
1714 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1715 the numerically highest error produced by any phase returning an error
1716 indication. The C, C++, and Fortran front ends return 4 if an internal
1717 compiler error is encountered.
1718
1719 @item -pipe
1720 @opindex pipe
1721 Use pipes rather than temporary files for communication between the
1722 various stages of compilation. This fails to work on some systems where
1723 the assembler is unable to read from a pipe; but the GNU assembler has
1724 no trouble.
1725
1726 @item -specs=@var{file}
1727 @opindex specs
1728 Process @var{file} after the compiler reads in the standard @file{specs}
1729 file, in order to override the defaults which the @command{gcc} driver
1730 program uses when determining what switches to pass to @command{cc1},
1731 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1732 @option{-specs=@var{file}} can be specified on the command line, and they
1733 are processed in order, from left to right. @xref{Spec Files}, for
1734 information about the format of the @var{file}.
1735
1736 @item -wrapper
1737 @opindex wrapper
1738 Invoke all subcommands under a wrapper program. The name of the
1739 wrapper program and its parameters are passed as a comma separated
1740 list.
1741
1742 @smallexample
1743 gcc -c t.c -wrapper gdb,--args
1744 @end smallexample
1745
1746 @noindent
1747 This invokes all subprograms of @command{gcc} under
1748 @samp{gdb --args}, thus the invocation of @command{cc1} is
1749 @samp{gdb --args cc1 @dots{}}.
1750
1751 @item -ffile-prefix-map=@var{old}=@var{new}
1752 @opindex ffile-prefix-map
1753 When compiling files residing in directory @file{@var{old}}, record
1754 any references to them in the result of the compilation as if the
1755 files resided in directory @file{@var{new}} instead. Specifying this
1756 option is equivalent to specifying all the individual
1757 @option{-f*-prefix-map} options. This can be used to make reproducible
1758 builds that are location independent. See also
1759 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1760
1761 @item -fplugin=@var{name}.so
1762 @opindex fplugin
1763 Load the plugin code in file @var{name}.so, assumed to be a
1764 shared object to be dlopen'd by the compiler. The base name of
1765 the shared object file is used to identify the plugin for the
1766 purposes of argument parsing (See
1767 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1768 Each plugin should define the callback functions specified in the
1769 Plugins API.
1770
1771 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1772 @opindex fplugin-arg
1773 Define an argument called @var{key} with a value of @var{value}
1774 for the plugin called @var{name}.
1775
1776 @item -fdump-ada-spec@r{[}-slim@r{]}
1777 @opindex fdump-ada-spec
1778 For C and C++ source and include files, generate corresponding Ada specs.
1779 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1780 GNAT User's Guide}, which provides detailed documentation on this feature.
1781
1782 @item -fada-spec-parent=@var{unit}
1783 @opindex fada-spec-parent
1784 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1785 Ada specs as child units of parent @var{unit}.
1786
1787 @item -fdump-go-spec=@var{file}
1788 @opindex fdump-go-spec
1789 For input files in any language, generate corresponding Go
1790 declarations in @var{file}. This generates Go @code{const},
1791 @code{type}, @code{var}, and @code{func} declarations which may be a
1792 useful way to start writing a Go interface to code written in some
1793 other language.
1794
1795 @include @value{srcdir}/../libiberty/at-file.texi
1796 @end table
1797
1798 @node Invoking G++
1799 @section Compiling C++ Programs
1800
1801 @cindex suffixes for C++ source
1802 @cindex C++ source file suffixes
1803 C++ source files conventionally use one of the suffixes @samp{.C},
1804 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1805 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1806 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1807 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1808 files with these names and compiles them as C++ programs even if you
1809 call the compiler the same way as for compiling C programs (usually
1810 with the name @command{gcc}).
1811
1812 @findex g++
1813 @findex c++
1814 However, the use of @command{gcc} does not add the C++ library.
1815 @command{g++} is a program that calls GCC and automatically specifies linking
1816 against the C++ library. It treats @samp{.c},
1817 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1818 files unless @option{-x} is used. This program is also useful when
1819 precompiling a C header file with a @samp{.h} extension for use in C++
1820 compilations. On many systems, @command{g++} is also installed with
1821 the name @command{c++}.
1822
1823 @cindex invoking @command{g++}
1824 When you compile C++ programs, you may specify many of the same
1825 command-line options that you use for compiling programs in any
1826 language; or command-line options meaningful for C and related
1827 languages; or options that are meaningful only for C++ programs.
1828 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1829 explanations of options for languages related to C@.
1830 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1831 explanations of options that are meaningful only for C++ programs.
1832
1833 @node C Dialect Options
1834 @section Options Controlling C Dialect
1835 @cindex dialect options
1836 @cindex language dialect options
1837 @cindex options, dialect
1838
1839 The following options control the dialect of C (or languages derived
1840 from C, such as C++, Objective-C and Objective-C++) that the compiler
1841 accepts:
1842
1843 @table @gcctabopt
1844 @cindex ANSI support
1845 @cindex ISO support
1846 @item -ansi
1847 @opindex ansi
1848 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1849 equivalent to @option{-std=c++98}.
1850
1851 This turns off certain features of GCC that are incompatible with ISO
1852 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1853 such as the @code{asm} and @code{typeof} keywords, and
1854 predefined macros such as @code{unix} and @code{vax} that identify the
1855 type of system you are using. It also enables the undesirable and
1856 rarely used ISO trigraph feature. For the C compiler,
1857 it disables recognition of C++ style @samp{//} comments as well as
1858 the @code{inline} keyword.
1859
1860 The alternate keywords @code{__asm__}, @code{__extension__},
1861 @code{__inline__} and @code{__typeof__} continue to work despite
1862 @option{-ansi}. You would not want to use them in an ISO C program, of
1863 course, but it is useful to put them in header files that might be included
1864 in compilations done with @option{-ansi}. Alternate predefined macros
1865 such as @code{__unix__} and @code{__vax__} are also available, with or
1866 without @option{-ansi}.
1867
1868 The @option{-ansi} option does not cause non-ISO programs to be
1869 rejected gratuitously. For that, @option{-Wpedantic} is required in
1870 addition to @option{-ansi}. @xref{Warning Options}.
1871
1872 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1873 option is used. Some header files may notice this macro and refrain
1874 from declaring certain functions or defining certain macros that the
1875 ISO standard doesn't call for; this is to avoid interfering with any
1876 programs that might use these names for other things.
1877
1878 Functions that are normally built in but do not have semantics
1879 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1880 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1881 built-in functions provided by GCC}, for details of the functions
1882 affected.
1883
1884 @item -std=
1885 @opindex std
1886 Determine the language standard. @xref{Standards,,Language Standards
1887 Supported by GCC}, for details of these standard versions. This option
1888 is currently only supported when compiling C or C++.
1889
1890 The compiler can accept several base standards, such as @samp{c90} or
1891 @samp{c++98}, and GNU dialects of those standards, such as
1892 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1893 compiler accepts all programs following that standard plus those
1894 using GNU extensions that do not contradict it. For example,
1895 @option{-std=c90} turns off certain features of GCC that are
1896 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1897 keywords, but not other GNU extensions that do not have a meaning in
1898 ISO C90, such as omitting the middle term of a @code{?:}
1899 expression. On the other hand, when a GNU dialect of a standard is
1900 specified, all features supported by the compiler are enabled, even when
1901 those features change the meaning of the base standard. As a result, some
1902 strict-conforming programs may be rejected. The particular standard
1903 is used by @option{-Wpedantic} to identify which features are GNU
1904 extensions given that version of the standard. For example
1905 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1906 comments, while @option{-std=gnu99 -Wpedantic} does not.
1907
1908 A value for this option must be provided; possible values are
1909
1910 @table @samp
1911 @item c90
1912 @itemx c89
1913 @itemx iso9899:1990
1914 Support all ISO C90 programs (certain GNU extensions that conflict
1915 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1916
1917 @item iso9899:199409
1918 ISO C90 as modified in amendment 1.
1919
1920 @item c99
1921 @itemx c9x
1922 @itemx iso9899:1999
1923 @itemx iso9899:199x
1924 ISO C99. This standard is substantially completely supported, modulo
1925 bugs and floating-point issues
1926 (mainly but not entirely relating to optional C99 features from
1927 Annexes F and G). See
1928 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1929 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1930
1931 @item c11
1932 @itemx c1x
1933 @itemx iso9899:2011
1934 ISO C11, the 2011 revision of the ISO C standard. This standard is
1935 substantially completely supported, modulo bugs, floating-point issues
1936 (mainly but not entirely relating to optional C11 features from
1937 Annexes F and G) and the optional Annexes K (Bounds-checking
1938 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1939
1940 @item c17
1941 @itemx c18
1942 @itemx iso9899:2017
1943 @itemx iso9899:2018
1944 ISO C17, the 2017 revision of the ISO C standard
1945 (published in 2018). This standard is
1946 same as C11 except for corrections of defects (all of which are also
1947 applied with @option{-std=c11}) and a new value of
1948 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1949
1950 @item c2x
1951 The next version of the ISO C standard, still under development. The
1952 support for this version is experimental and incomplete.
1953
1954 @item gnu90
1955 @itemx gnu89
1956 GNU dialect of ISO C90 (including some C99 features).
1957
1958 @item gnu99
1959 @itemx gnu9x
1960 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1961
1962 @item gnu11
1963 @itemx gnu1x
1964 GNU dialect of ISO C11.
1965 The name @samp{gnu1x} is deprecated.
1966
1967 @item gnu17
1968 @itemx gnu18
1969 GNU dialect of ISO C17. This is the default for C code.
1970
1971 @item gnu2x
1972 The next version of the ISO C standard, still under development, plus
1973 GNU extensions. The support for this version is experimental and
1974 incomplete.
1975
1976 @item c++98
1977 @itemx c++03
1978 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1979 additional defect reports. Same as @option{-ansi} for C++ code.
1980
1981 @item gnu++98
1982 @itemx gnu++03
1983 GNU dialect of @option{-std=c++98}.
1984
1985 @item c++11
1986 @itemx c++0x
1987 The 2011 ISO C++ standard plus amendments.
1988 The name @samp{c++0x} is deprecated.
1989
1990 @item gnu++11
1991 @itemx gnu++0x
1992 GNU dialect of @option{-std=c++11}.
1993 The name @samp{gnu++0x} is deprecated.
1994
1995 @item c++14
1996 @itemx c++1y
1997 The 2014 ISO C++ standard plus amendments.
1998 The name @samp{c++1y} is deprecated.
1999
2000 @item gnu++14
2001 @itemx gnu++1y
2002 GNU dialect of @option{-std=c++14}.
2003 This is the default for C++ code.
2004 The name @samp{gnu++1y} is deprecated.
2005
2006 @item c++17
2007 @itemx c++1z
2008 The 2017 ISO C++ standard plus amendments.
2009 The name @samp{c++1z} is deprecated.
2010
2011 @item gnu++17
2012 @itemx gnu++1z
2013 GNU dialect of @option{-std=c++17}.
2014 The name @samp{gnu++1z} is deprecated.
2015
2016 @item c++2a
2017 The next revision of the ISO C++ standard, tentatively planned for
2018 2020. Support is highly experimental, and will almost certainly
2019 change in incompatible ways in future releases.
2020
2021 @item gnu++2a
2022 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2023 and will almost certainly change in incompatible ways in future
2024 releases.
2025 @end table
2026
2027 @item -fgnu89-inline
2028 @opindex fgnu89-inline
2029 The option @option{-fgnu89-inline} tells GCC to use the traditional
2030 GNU semantics for @code{inline} functions when in C99 mode.
2031 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2032 Using this option is roughly equivalent to adding the
2033 @code{gnu_inline} function attribute to all inline functions
2034 (@pxref{Function Attributes}).
2035
2036 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2037 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2038 specifies the default behavior).
2039 This option is not supported in @option{-std=c90} or
2040 @option{-std=gnu90} mode.
2041
2042 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2043 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2044 in effect for @code{inline} functions. @xref{Common Predefined
2045 Macros,,,cpp,The C Preprocessor}.
2046
2047 @item -fpermitted-flt-eval-methods=@var{style}
2048 @opindex fpermitted-flt-eval-methods
2049 @opindex fpermitted-flt-eval-methods=c11
2050 @opindex fpermitted-flt-eval-methods=ts-18661-3
2051 ISO/IEC TS 18661-3 defines new permissible values for
2052 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2053 a semantic type that is an interchange or extended format should be
2054 evaluated to the precision and range of that type. These new values are
2055 a superset of those permitted under C99/C11, which does not specify the
2056 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2057 conforming to C11 may not have been written expecting the possibility of
2058 the new values.
2059
2060 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2061 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2062 or the extended set of values specified in ISO/IEC TS 18661-3.
2063
2064 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2065
2066 The default when in a standards compliant mode (@option{-std=c11} or similar)
2067 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2068 dialect (@option{-std=gnu11} or similar) is
2069 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2070
2071 @item -aux-info @var{filename}
2072 @opindex aux-info
2073 Output to the given filename prototyped declarations for all functions
2074 declared and/or defined in a translation unit, including those in header
2075 files. This option is silently ignored in any language other than C@.
2076
2077 Besides declarations, the file indicates, in comments, the origin of
2078 each declaration (source file and line), whether the declaration was
2079 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2080 @samp{O} for old, respectively, in the first character after the line
2081 number and the colon), and whether it came from a declaration or a
2082 definition (@samp{C} or @samp{F}, respectively, in the following
2083 character). In the case of function definitions, a K&R-style list of
2084 arguments followed by their declarations is also provided, inside
2085 comments, after the declaration.
2086
2087 @item -fallow-parameterless-variadic-functions
2088 @opindex fallow-parameterless-variadic-functions
2089 Accept variadic functions without named parameters.
2090
2091 Although it is possible to define such a function, this is not very
2092 useful as it is not possible to read the arguments. This is only
2093 supported for C as this construct is allowed by C++.
2094
2095 @item -fno-asm
2096 @opindex fno-asm
2097 @opindex fasm
2098 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2099 keyword, so that code can use these words as identifiers. You can use
2100 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2101 instead. @option{-ansi} implies @option{-fno-asm}.
2102
2103 In C++, this switch only affects the @code{typeof} keyword, since
2104 @code{asm} and @code{inline} are standard keywords. You may want to
2105 use the @option{-fno-gnu-keywords} flag instead, which has the same
2106 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2107 switch only affects the @code{asm} and @code{typeof} keywords, since
2108 @code{inline} is a standard keyword in ISO C99.
2109
2110 @item -fno-builtin
2111 @itemx -fno-builtin-@var{function}
2112 @opindex fno-builtin
2113 @opindex fbuiltin
2114 @cindex built-in functions
2115 Don't recognize built-in functions that do not begin with
2116 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2117 functions provided by GCC}, for details of the functions affected,
2118 including those which are not built-in functions when @option{-ansi} or
2119 @option{-std} options for strict ISO C conformance are used because they
2120 do not have an ISO standard meaning.
2121
2122 GCC normally generates special code to handle certain built-in functions
2123 more efficiently; for instance, calls to @code{alloca} may become single
2124 instructions which adjust the stack directly, and calls to @code{memcpy}
2125 may become inline copy loops. The resulting code is often both smaller
2126 and faster, but since the function calls no longer appear as such, you
2127 cannot set a breakpoint on those calls, nor can you change the behavior
2128 of the functions by linking with a different library. In addition,
2129 when a function is recognized as a built-in function, GCC may use
2130 information about that function to warn about problems with calls to
2131 that function, or to generate more efficient code, even if the
2132 resulting code still contains calls to that function. For example,
2133 warnings are given with @option{-Wformat} for bad calls to
2134 @code{printf} when @code{printf} is built in and @code{strlen} is
2135 known not to modify global memory.
2136
2137 With the @option{-fno-builtin-@var{function}} option
2138 only the built-in function @var{function} is
2139 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2140 function is named that is not built-in in this version of GCC, this
2141 option is ignored. There is no corresponding
2142 @option{-fbuiltin-@var{function}} option; if you wish to enable
2143 built-in functions selectively when using @option{-fno-builtin} or
2144 @option{-ffreestanding}, you may define macros such as:
2145
2146 @smallexample
2147 #define abs(n) __builtin_abs ((n))
2148 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2149 @end smallexample
2150
2151 @item -fgimple
2152 @opindex fgimple
2153
2154 Enable parsing of function definitions marked with @code{__GIMPLE}.
2155 This is an experimental feature that allows unit testing of GIMPLE
2156 passes.
2157
2158 @item -fhosted
2159 @opindex fhosted
2160 @cindex hosted environment
2161
2162 Assert that compilation targets a hosted environment. This implies
2163 @option{-fbuiltin}. A hosted environment is one in which the
2164 entire standard library is available, and in which @code{main} has a return
2165 type of @code{int}. Examples are nearly everything except a kernel.
2166 This is equivalent to @option{-fno-freestanding}.
2167
2168 @item -ffreestanding
2169 @opindex ffreestanding
2170 @cindex hosted environment
2171
2172 Assert that compilation targets a freestanding environment. This
2173 implies @option{-fno-builtin}. A freestanding environment
2174 is one in which the standard library may not exist, and program startup may
2175 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2176 This is equivalent to @option{-fno-hosted}.
2177
2178 @xref{Standards,,Language Standards Supported by GCC}, for details of
2179 freestanding and hosted environments.
2180
2181 @item -fopenacc
2182 @opindex fopenacc
2183 @cindex OpenACC accelerator programming
2184 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2185 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2186 compiler generates accelerated code according to the OpenACC Application
2187 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2188 implies @option{-pthread}, and thus is only supported on targets that
2189 have support for @option{-pthread}.
2190
2191 @item -fopenacc-dim=@var{geom}
2192 @opindex fopenacc-dim
2193 @cindex OpenACC accelerator programming
2194 Specify default compute dimensions for parallel offload regions that do
2195 not explicitly specify. The @var{geom} value is a triple of
2196 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2197 can be omitted, to use a target-specific default value.
2198
2199 @item -fopenmp
2200 @opindex fopenmp
2201 @cindex OpenMP parallel
2202 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2203 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2204 compiler generates parallel code according to the OpenMP Application
2205 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2206 implies @option{-pthread}, and thus is only supported on targets that
2207 have support for @option{-pthread}. @option{-fopenmp} implies
2208 @option{-fopenmp-simd}.
2209
2210 @item -fopenmp-simd
2211 @opindex fopenmp-simd
2212 @cindex OpenMP SIMD
2213 @cindex SIMD
2214 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2215 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2216 are ignored.
2217
2218 @item -fgnu-tm
2219 @opindex fgnu-tm
2220 When the option @option{-fgnu-tm} is specified, the compiler
2221 generates code for the Linux variant of Intel's current Transactional
2222 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2223 an experimental feature whose interface may change in future versions
2224 of GCC, as the official specification changes. Please note that not
2225 all architectures are supported for this feature.
2226
2227 For more information on GCC's support for transactional memory,
2228 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2229 Transactional Memory Library}.
2230
2231 Note that the transactional memory feature is not supported with
2232 non-call exceptions (@option{-fnon-call-exceptions}).
2233
2234 @item -fms-extensions
2235 @opindex fms-extensions
2236 Accept some non-standard constructs used in Microsoft header files.
2237
2238 In C++ code, this allows member names in structures to be similar
2239 to previous types declarations.
2240
2241 @smallexample
2242 typedef int UOW;
2243 struct ABC @{
2244 UOW UOW;
2245 @};
2246 @end smallexample
2247
2248 Some cases of unnamed fields in structures and unions are only
2249 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2250 fields within structs/unions}, for details.
2251
2252 Note that this option is off for all targets except for x86
2253 targets using ms-abi.
2254
2255 @item -fplan9-extensions
2256 @opindex fplan9-extensions
2257 Accept some non-standard constructs used in Plan 9 code.
2258
2259 This enables @option{-fms-extensions}, permits passing pointers to
2260 structures with anonymous fields to functions that expect pointers to
2261 elements of the type of the field, and permits referring to anonymous
2262 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2263 struct/union fields within structs/unions}, for details. This is only
2264 supported for C, not C++.
2265
2266 @item -fcond-mismatch
2267 @opindex fcond-mismatch
2268 Allow conditional expressions with mismatched types in the second and
2269 third arguments. The value of such an expression is void. This option
2270 is not supported for C++.
2271
2272 @item -flax-vector-conversions
2273 @opindex flax-vector-conversions
2274 Allow implicit conversions between vectors with differing numbers of
2275 elements and/or incompatible element types. This option should not be
2276 used for new code.
2277
2278 @item -funsigned-char
2279 @opindex funsigned-char
2280 Let the type @code{char} be unsigned, like @code{unsigned char}.
2281
2282 Each kind of machine has a default for what @code{char} should
2283 be. It is either like @code{unsigned char} by default or like
2284 @code{signed char} by default.
2285
2286 Ideally, a portable program should always use @code{signed char} or
2287 @code{unsigned char} when it depends on the signedness of an object.
2288 But many programs have been written to use plain @code{char} and
2289 expect it to be signed, or expect it to be unsigned, depending on the
2290 machines they were written for. This option, and its inverse, let you
2291 make such a program work with the opposite default.
2292
2293 The type @code{char} is always a distinct type from each of
2294 @code{signed char} or @code{unsigned char}, even though its behavior
2295 is always just like one of those two.
2296
2297 @item -fsigned-char
2298 @opindex fsigned-char
2299 Let the type @code{char} be signed, like @code{signed char}.
2300
2301 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2302 the negative form of @option{-funsigned-char}. Likewise, the option
2303 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2304
2305 @item -fsigned-bitfields
2306 @itemx -funsigned-bitfields
2307 @itemx -fno-signed-bitfields
2308 @itemx -fno-unsigned-bitfields
2309 @opindex fsigned-bitfields
2310 @opindex funsigned-bitfields
2311 @opindex fno-signed-bitfields
2312 @opindex fno-unsigned-bitfields
2313 These options control whether a bit-field is signed or unsigned, when the
2314 declaration does not use either @code{signed} or @code{unsigned}. By
2315 default, such a bit-field is signed, because this is consistent: the
2316 basic integer types such as @code{int} are signed types.
2317
2318 @item -fsso-struct=@var{endianness}
2319 @opindex fsso-struct
2320 Set the default scalar storage order of structures and unions to the
2321 specified endianness. The accepted values are @samp{big-endian},
2322 @samp{little-endian} and @samp{native} for the native endianness of
2323 the target (the default). This option is not supported for C++.
2324
2325 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2326 code that is not binary compatible with code generated without it if the
2327 specified endianness is not the native endianness of the target.
2328 @end table
2329
2330 @node C++ Dialect Options
2331 @section Options Controlling C++ Dialect
2332
2333 @cindex compiler options, C++
2334 @cindex C++ options, command-line
2335 @cindex options, C++
2336 This section describes the command-line options that are only meaningful
2337 for C++ programs. You can also use most of the GNU compiler options
2338 regardless of what language your program is in. For example, you
2339 might compile a file @file{firstClass.C} like this:
2340
2341 @smallexample
2342 g++ -g -fstrict-enums -O -c firstClass.C
2343 @end smallexample
2344
2345 @noindent
2346 In this example, only @option{-fstrict-enums} is an option meant
2347 only for C++ programs; you can use the other options with any
2348 language supported by GCC@.
2349
2350 Some options for compiling C programs, such as @option{-std}, are also
2351 relevant for C++ programs.
2352 @xref{C Dialect Options,,Options Controlling C Dialect}.
2353
2354 Here is a list of options that are @emph{only} for compiling C++ programs:
2355
2356 @table @gcctabopt
2357
2358 @item -fabi-version=@var{n}
2359 @opindex fabi-version
2360 Use version @var{n} of the C++ ABI@. The default is version 0.
2361
2362 Version 0 refers to the version conforming most closely to
2363 the C++ ABI specification. Therefore, the ABI obtained using version 0
2364 will change in different versions of G++ as ABI bugs are fixed.
2365
2366 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2367
2368 Version 2 is the version of the C++ ABI that first appeared in G++
2369 3.4, and was the default through G++ 4.9.
2370
2371 Version 3 corrects an error in mangling a constant address as a
2372 template argument.
2373
2374 Version 4, which first appeared in G++ 4.5, implements a standard
2375 mangling for vector types.
2376
2377 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2378 attribute const/volatile on function pointer types, decltype of a
2379 plain decl, and use of a function parameter in the declaration of
2380 another parameter.
2381
2382 Version 6, which first appeared in G++ 4.7, corrects the promotion
2383 behavior of C++11 scoped enums and the mangling of template argument
2384 packs, const/static_cast, prefix ++ and --, and a class scope function
2385 used as a template argument.
2386
2387 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2388 builtin type and corrects the mangling of lambdas in default argument
2389 scope.
2390
2391 Version 8, which first appeared in G++ 4.9, corrects the substitution
2392 behavior of function types with function-cv-qualifiers.
2393
2394 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2395 @code{nullptr_t}.
2396
2397 Version 10, which first appeared in G++ 6.1, adds mangling of
2398 attributes that affect type identity, such as ia32 calling convention
2399 attributes (e.g.@: @samp{stdcall}).
2400
2401 Version 11, which first appeared in G++ 7, corrects the mangling of
2402 sizeof... expressions and operator names. For multiple entities with
2403 the same name within a function, that are declared in different scopes,
2404 the mangling now changes starting with the twelfth occurrence. It also
2405 implies @option{-fnew-inheriting-ctors}.
2406
2407 Version 12, which first appeared in G++ 8, corrects the calling
2408 conventions for empty classes on the x86_64 target and for classes
2409 with only deleted copy/move constructors. It accidentally changes the
2410 calling convention for classes with a deleted copy constructor and a
2411 trivial move constructor.
2412
2413 Version 13, which first appeared in G++ 8.2, fixes the accidental
2414 change in version 12.
2415
2416 Version 14, which first appeared in G++ 10, corrects the mangling of
2417 the nullptr expression.
2418
2419 See also @option{-Wabi}.
2420
2421 @item -fabi-compat-version=@var{n}
2422 @opindex fabi-compat-version
2423 On targets that support strong aliases, G++
2424 works around mangling changes by creating an alias with the correct
2425 mangled name when defining a symbol with an incorrect mangled name.
2426 This switch specifies which ABI version to use for the alias.
2427
2428 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2429 compatibility). If another ABI version is explicitly selected, this
2430 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2431 use @option{-fabi-compat-version=2}.
2432
2433 If this option is not provided but @option{-Wabi=@var{n}} is, that
2434 version is used for compatibility aliases. If this option is provided
2435 along with @option{-Wabi} (without the version), the version from this
2436 option is used for the warning.
2437
2438 @item -fno-access-control
2439 @opindex fno-access-control
2440 @opindex faccess-control
2441 Turn off all access checking. This switch is mainly useful for working
2442 around bugs in the access control code.
2443
2444 @item -faligned-new
2445 @opindex faligned-new
2446 Enable support for C++17 @code{new} of types that require more
2447 alignment than @code{void* ::operator new(std::size_t)} provides. A
2448 numeric argument such as @code{-faligned-new=32} can be used to
2449 specify how much alignment (in bytes) is provided by that function,
2450 but few users will need to override the default of
2451 @code{alignof(std::max_align_t)}.
2452
2453 This flag is enabled by default for @option{-std=c++17}.
2454
2455 @item -fchar8_t
2456 @itemx -fno-char8_t
2457 @opindex fchar8_t
2458 @opindex fno-char8_t
2459 Enable support for @code{char8_t} as adopted for C++2a. This includes
2460 the addition of a new @code{char8_t} fundamental type, changes to the
2461 types of UTF-8 string and character literals, new signatures for
2462 user-defined literals, associated standard library updates, and new
2463 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2464
2465 This option enables functions to be overloaded for ordinary and UTF-8
2466 strings:
2467
2468 @smallexample
2469 int f(const char *); // #1
2470 int f(const char8_t *); // #2
2471 int v1 = f("text"); // Calls #1
2472 int v2 = f(u8"text"); // Calls #2
2473 @end smallexample
2474
2475 @noindent
2476 and introduces new signatures for user-defined literals:
2477
2478 @smallexample
2479 int operator""_udl1(char8_t);
2480 int v3 = u8'x'_udl1;
2481 int operator""_udl2(const char8_t*, std::size_t);
2482 int v4 = u8"text"_udl2;
2483 template<typename T, T...> int operator""_udl3();
2484 int v5 = u8"text"_udl3;
2485 @end smallexample
2486
2487 @noindent
2488 The change to the types of UTF-8 string and character literals introduces
2489 incompatibilities with ISO C++11 and later standards. For example, the
2490 following code is well-formed under ISO C++11, but is ill-formed when
2491 @option{-fchar8_t} is specified.
2492
2493 @smallexample
2494 char ca[] = u8"xx"; // error: char-array initialized from wide
2495 // string
2496 const char *cp = u8"xx";// error: invalid conversion from
2497 // `const char8_t*' to `const char*'
2498 int f(const char*);
2499 auto v = f(u8"xx"); // error: invalid conversion from
2500 // `const char8_t*' to `const char*'
2501 std::string s@{u8"xx"@}; // error: no matching function for call to
2502 // `std::basic_string<char>::basic_string()'
2503 using namespace std::literals;
2504 s = u8"xx"s; // error: conversion from
2505 // `basic_string<char8_t>' to non-scalar
2506 // type `basic_string<char>' requested
2507 @end smallexample
2508
2509 @item -fcheck-new
2510 @opindex fcheck-new
2511 Check that the pointer returned by @code{operator new} is non-null
2512 before attempting to modify the storage allocated. This check is
2513 normally unnecessary because the C++ standard specifies that
2514 @code{operator new} only returns @code{0} if it is declared
2515 @code{throw()}, in which case the compiler always checks the
2516 return value even without this option. In all other cases, when
2517 @code{operator new} has a non-empty exception specification, memory
2518 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2519 @samp{new (nothrow)}.
2520
2521 @item -fconcepts
2522 @itemx -fconcepts-ts
2523 @opindex fconcepts
2524 @opindex fconcepts-ts
2525 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2526 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2527
2528 With @option{-std=c++2a} and above, Concepts are part of the language
2529 standard, so @option{-fconcepts} defaults to on. But the standard
2530 specification of Concepts differs significantly from the TS, so some
2531 constructs that were allowed in the TS but didn't make it into the
2532 standard can still be enabled by @option{-fconcepts-ts}.
2533
2534 @item -fconstexpr-depth=@var{n}
2535 @opindex fconstexpr-depth
2536 Set the maximum nested evaluation depth for C++11 constexpr functions
2537 to @var{n}. A limit is needed to detect endless recursion during
2538 constant expression evaluation. The minimum specified by the standard
2539 is 512.
2540
2541 @item -fconstexpr-cache-depth=@var{n}
2542 @opindex fconstexpr-cache-depth
2543 Set the maximum level of nested evaluation depth for C++11 constexpr
2544 functions that will be cached to @var{n}. This is a heuristic that
2545 trades off compilation speed (when the cache avoids repeated
2546 calculations) against memory consumption (when the cache grows very
2547 large from highly recursive evaluations). The default is 8. Very few
2548 users are likely to want to adjust it, but if your code does heavy
2549 constexpr calculations you might want to experiment to find which
2550 value works best for you.
2551
2552 @item -fconstexpr-loop-limit=@var{n}
2553 @opindex fconstexpr-loop-limit
2554 Set the maximum number of iterations for a loop in C++14 constexpr functions
2555 to @var{n}. A limit is needed to detect infinite loops during
2556 constant expression evaluation. The default is 262144 (1<<18).
2557
2558 @item -fconstexpr-ops-limit=@var{n}
2559 @opindex fconstexpr-ops-limit
2560 Set the maximum number of operations during a single constexpr evaluation.
2561 Even when number of iterations of a single loop is limited with the above limit,
2562 if there are several nested loops and each of them has many iterations but still
2563 smaller than the above limit, or if in a body of some loop or even outside
2564 of a loop too many expressions need to be evaluated, the resulting constexpr
2565 evaluation might take too long.
2566 The default is 33554432 (1<<25).
2567
2568 @item -fno-elide-constructors
2569 @opindex fno-elide-constructors
2570 @opindex felide-constructors
2571 The C++ standard allows an implementation to omit creating a temporary
2572 that is only used to initialize another object of the same type.
2573 Specifying this option disables that optimization, and forces G++ to
2574 call the copy constructor in all cases. This option also causes G++
2575 to call trivial member functions which otherwise would be expanded inline.
2576
2577 In C++17, the compiler is required to omit these temporaries, but this
2578 option still affects trivial member functions.
2579
2580 @item -fno-enforce-eh-specs
2581 @opindex fno-enforce-eh-specs
2582 @opindex fenforce-eh-specs
2583 Don't generate code to check for violation of exception specifications
2584 at run time. This option violates the C++ standard, but may be useful
2585 for reducing code size in production builds, much like defining
2586 @code{NDEBUG}. This does not give user code permission to throw
2587 exceptions in violation of the exception specifications; the compiler
2588 still optimizes based on the specifications, so throwing an
2589 unexpected exception results in undefined behavior at run time.
2590
2591 @item -fextern-tls-init
2592 @itemx -fno-extern-tls-init
2593 @opindex fextern-tls-init
2594 @opindex fno-extern-tls-init
2595 The C++11 and OpenMP standards allow @code{thread_local} and
2596 @code{threadprivate} variables to have dynamic (runtime)
2597 initialization. To support this, any use of such a variable goes
2598 through a wrapper function that performs any necessary initialization.
2599 When the use and definition of the variable are in the same
2600 translation unit, this overhead can be optimized away, but when the
2601 use is in a different translation unit there is significant overhead
2602 even if the variable doesn't actually need dynamic initialization. If
2603 the programmer can be sure that no use of the variable in a
2604 non-defining TU needs to trigger dynamic initialization (either
2605 because the variable is statically initialized, or a use of the
2606 variable in the defining TU will be executed before any uses in
2607 another TU), they can avoid this overhead with the
2608 @option{-fno-extern-tls-init} option.
2609
2610 On targets that support symbol aliases, the default is
2611 @option{-fextern-tls-init}. On targets that do not support symbol
2612 aliases, the default is @option{-fno-extern-tls-init}.
2613
2614 @item -fno-gnu-keywords
2615 @opindex fno-gnu-keywords
2616 @opindex fgnu-keywords
2617 Do not recognize @code{typeof} as a keyword, so that code can use this
2618 word as an identifier. You can use the keyword @code{__typeof__} instead.
2619 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2620 @option{-std=c++98}, @option{-std=c++11}, etc.
2621
2622 @item -fno-implicit-templates
2623 @opindex fno-implicit-templates
2624 @opindex fimplicit-templates
2625 Never emit code for non-inline templates that are instantiated
2626 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2627 If you use this option, you must take care to structure your code to
2628 include all the necessary explicit instantiations to avoid getting
2629 undefined symbols at link time.
2630 @xref{Template Instantiation}, for more information.
2631
2632 @item -fno-implicit-inline-templates
2633 @opindex fno-implicit-inline-templates
2634 @opindex fimplicit-inline-templates
2635 Don't emit code for implicit instantiations of inline templates, either.
2636 The default is to handle inlines differently so that compiles with and
2637 without optimization need the same set of explicit instantiations.
2638
2639 @item -fno-implement-inlines
2640 @opindex fno-implement-inlines
2641 @opindex fimplement-inlines
2642 To save space, do not emit out-of-line copies of inline functions
2643 controlled by @code{#pragma implementation}. This causes linker
2644 errors if these functions are not inlined everywhere they are called.
2645
2646 @item -fms-extensions
2647 @opindex fms-extensions
2648 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2649 int and getting a pointer to member function via non-standard syntax.
2650
2651 @item -fnew-inheriting-ctors
2652 @opindex fnew-inheriting-ctors
2653 Enable the P0136 adjustment to the semantics of C++11 constructor
2654 inheritance. This is part of C++17 but also considered to be a Defect
2655 Report against C++11 and C++14. This flag is enabled by default
2656 unless @option{-fabi-version=10} or lower is specified.
2657
2658 @item -fnew-ttp-matching
2659 @opindex fnew-ttp-matching
2660 Enable the P0522 resolution to Core issue 150, template template
2661 parameters and default arguments: this allows a template with default
2662 template arguments as an argument for a template template parameter
2663 with fewer template parameters. This flag is enabled by default for
2664 @option{-std=c++17}.
2665
2666 @item -fno-nonansi-builtins
2667 @opindex fno-nonansi-builtins
2668 @opindex fnonansi-builtins
2669 Disable built-in declarations of functions that are not mandated by
2670 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2671 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2672
2673 @item -fnothrow-opt
2674 @opindex fnothrow-opt
2675 Treat a @code{throw()} exception specification as if it were a
2676 @code{noexcept} specification to reduce or eliminate the text size
2677 overhead relative to a function with no exception specification. If
2678 the function has local variables of types with non-trivial
2679 destructors, the exception specification actually makes the
2680 function smaller because the EH cleanups for those variables can be
2681 optimized away. The semantic effect is that an exception thrown out of
2682 a function with such an exception specification results in a call
2683 to @code{terminate} rather than @code{unexpected}.
2684
2685 @item -fno-operator-names
2686 @opindex fno-operator-names
2687 @opindex foperator-names
2688 Do not treat the operator name keywords @code{and}, @code{bitand},
2689 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2690 synonyms as keywords.
2691
2692 @item -fno-optional-diags
2693 @opindex fno-optional-diags
2694 @opindex foptional-diags
2695 Disable diagnostics that the standard says a compiler does not need to
2696 issue. Currently, the only such diagnostic issued by G++ is the one for
2697 a name having multiple meanings within a class.
2698
2699 @item -fpermissive
2700 @opindex fpermissive
2701 Downgrade some diagnostics about nonconformant code from errors to
2702 warnings. Thus, using @option{-fpermissive} allows some
2703 nonconforming code to compile.
2704
2705 @item -fno-pretty-templates
2706 @opindex fno-pretty-templates
2707 @opindex fpretty-templates
2708 When an error message refers to a specialization of a function
2709 template, the compiler normally prints the signature of the
2710 template followed by the template arguments and any typedefs or
2711 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2712 rather than @code{void f(int)}) so that it's clear which template is
2713 involved. When an error message refers to a specialization of a class
2714 template, the compiler omits any template arguments that match
2715 the default template arguments for that template. If either of these
2716 behaviors make it harder to understand the error message rather than
2717 easier, you can use @option{-fno-pretty-templates} to disable them.
2718
2719 @item -fno-rtti
2720 @opindex fno-rtti
2721 @opindex frtti
2722 Disable generation of information about every class with virtual
2723 functions for use by the C++ run-time type identification features
2724 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2725 of the language, you can save some space by using this flag. Note that
2726 exception handling uses the same information, but G++ generates it as
2727 needed. The @code{dynamic_cast} operator can still be used for casts that
2728 do not require run-time type information, i.e.@: casts to @code{void *} or to
2729 unambiguous base classes.
2730
2731 Mixing code compiled with @option{-frtti} with that compiled with
2732 @option{-fno-rtti} may not work. For example, programs may
2733 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2734 for a class compiled with @option{-frtti}.
2735
2736 @item -fsized-deallocation
2737 @opindex fsized-deallocation
2738 Enable the built-in global declarations
2739 @smallexample
2740 void operator delete (void *, std::size_t) noexcept;
2741 void operator delete[] (void *, std::size_t) noexcept;
2742 @end smallexample
2743 as introduced in C++14. This is useful for user-defined replacement
2744 deallocation functions that, for example, use the size of the object
2745 to make deallocation faster. Enabled by default under
2746 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2747 warns about places that might want to add a definition.
2748
2749 @item -fstrict-enums
2750 @opindex fstrict-enums
2751 Allow the compiler to optimize using the assumption that a value of
2752 enumerated type can only be one of the values of the enumeration (as
2753 defined in the C++ standard; basically, a value that can be
2754 represented in the minimum number of bits needed to represent all the
2755 enumerators). This assumption may not be valid if the program uses a
2756 cast to convert an arbitrary integer value to the enumerated type.
2757
2758 @item -fstrong-eval-order
2759 @opindex fstrong-eval-order
2760 Evaluate member access, array subscripting, and shift expressions in
2761 left-to-right order, and evaluate assignment in right-to-left order,
2762 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2763 @option{-fstrong-eval-order=some} enables just the ordering of member
2764 access and shift expressions, and is the default without
2765 @option{-std=c++17}.
2766
2767 @item -ftemplate-backtrace-limit=@var{n}
2768 @opindex ftemplate-backtrace-limit
2769 Set the maximum number of template instantiation notes for a single
2770 warning or error to @var{n}. The default value is 10.
2771
2772 @item -ftemplate-depth=@var{n}
2773 @opindex ftemplate-depth
2774 Set the maximum instantiation depth for template classes to @var{n}.
2775 A limit on the template instantiation depth is needed to detect
2776 endless recursions during template class instantiation. ANSI/ISO C++
2777 conforming programs must not rely on a maximum depth greater than 17
2778 (changed to 1024 in C++11). The default value is 900, as the compiler
2779 can run out of stack space before hitting 1024 in some situations.
2780
2781 @item -fno-threadsafe-statics
2782 @opindex fno-threadsafe-statics
2783 @opindex fthreadsafe-statics
2784 Do not emit the extra code to use the routines specified in the C++
2785 ABI for thread-safe initialization of local statics. You can use this
2786 option to reduce code size slightly in code that doesn't need to be
2787 thread-safe.
2788
2789 @item -fuse-cxa-atexit
2790 @opindex fuse-cxa-atexit
2791 Register destructors for objects with static storage duration with the
2792 @code{__cxa_atexit} function rather than the @code{atexit} function.
2793 This option is required for fully standards-compliant handling of static
2794 destructors, but only works if your C library supports
2795 @code{__cxa_atexit}.
2796
2797 @item -fno-use-cxa-get-exception-ptr
2798 @opindex fno-use-cxa-get-exception-ptr
2799 @opindex fuse-cxa-get-exception-ptr
2800 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2801 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2802 if the runtime routine is not available.
2803
2804 @item -fvisibility-inlines-hidden
2805 @opindex fvisibility-inlines-hidden
2806 This switch declares that the user does not attempt to compare
2807 pointers to inline functions or methods where the addresses of the two functions
2808 are taken in different shared objects.
2809
2810 The effect of this is that GCC may, effectively, mark inline methods with
2811 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2812 appear in the export table of a DSO and do not require a PLT indirection
2813 when used within the DSO@. Enabling this option can have a dramatic effect
2814 on load and link times of a DSO as it massively reduces the size of the
2815 dynamic export table when the library makes heavy use of templates.
2816
2817 The behavior of this switch is not quite the same as marking the
2818 methods as hidden directly, because it does not affect static variables
2819 local to the function or cause the compiler to deduce that
2820 the function is defined in only one shared object.
2821
2822 You may mark a method as having a visibility explicitly to negate the
2823 effect of the switch for that method. For example, if you do want to
2824 compare pointers to a particular inline method, you might mark it as
2825 having default visibility. Marking the enclosing class with explicit
2826 visibility has no effect.
2827
2828 Explicitly instantiated inline methods are unaffected by this option
2829 as their linkage might otherwise cross a shared library boundary.
2830 @xref{Template Instantiation}.
2831
2832 @item -fvisibility-ms-compat
2833 @opindex fvisibility-ms-compat
2834 This flag attempts to use visibility settings to make GCC's C++
2835 linkage model compatible with that of Microsoft Visual Studio.
2836
2837 The flag makes these changes to GCC's linkage model:
2838
2839 @enumerate
2840 @item
2841 It sets the default visibility to @code{hidden}, like
2842 @option{-fvisibility=hidden}.
2843
2844 @item
2845 Types, but not their members, are not hidden by default.
2846
2847 @item
2848 The One Definition Rule is relaxed for types without explicit
2849 visibility specifications that are defined in more than one
2850 shared object: those declarations are permitted if they are
2851 permitted when this option is not used.
2852 @end enumerate
2853
2854 In new code it is better to use @option{-fvisibility=hidden} and
2855 export those classes that are intended to be externally visible.
2856 Unfortunately it is possible for code to rely, perhaps accidentally,
2857 on the Visual Studio behavior.
2858
2859 Among the consequences of these changes are that static data members
2860 of the same type with the same name but defined in different shared
2861 objects are different, so changing one does not change the other;
2862 and that pointers to function members defined in different shared
2863 objects may not compare equal. When this flag is given, it is a
2864 violation of the ODR to define types with the same name differently.
2865
2866 @item -fno-weak
2867 @opindex fno-weak
2868 @opindex fweak
2869 Do not use weak symbol support, even if it is provided by the linker.
2870 By default, G++ uses weak symbols if they are available. This
2871 option exists only for testing, and should not be used by end-users;
2872 it results in inferior code and has no benefits. This option may
2873 be removed in a future release of G++.
2874
2875 @item -nostdinc++
2876 @opindex nostdinc++
2877 Do not search for header files in the standard directories specific to
2878 C++, but do still search the other standard directories. (This option
2879 is used when building the C++ library.)
2880 @end table
2881
2882 In addition, these optimization, warning, and code generation options
2883 have meanings only for C++ programs:
2884
2885 @table @gcctabopt
2886 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2887 @opindex Wabi
2888 @opindex Wno-abi
2889 Warn when G++ it generates code that is probably not compatible with
2890 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2891 ABI with each major release, normally @option{-Wabi} will warn only if
2892 there is a check added later in a release series for an ABI issue
2893 discovered since the initial release. @option{-Wabi} will warn about
2894 more things if an older ABI version is selected (with
2895 @option{-fabi-version=@var{n}}).
2896
2897 @option{-Wabi} can also be used with an explicit version number to
2898 warn about compatibility with a particular @option{-fabi-version}
2899 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2900 @option{-fabi-version=2}.
2901
2902 If an explicit version number is provided and
2903 @option{-fabi-compat-version} is not specified, the version number
2904 from this option is used for compatibility aliases. If no explicit
2905 version number is provided with this option, but
2906 @option{-fabi-compat-version} is specified, that version number is
2907 used for ABI warnings.
2908
2909 Although an effort has been made to warn about
2910 all such cases, there are probably some cases that are not warned about,
2911 even though G++ is generating incompatible code. There may also be
2912 cases where warnings are emitted even though the code that is generated
2913 is compatible.
2914
2915 You should rewrite your code to avoid these warnings if you are
2916 concerned about the fact that code generated by G++ may not be binary
2917 compatible with code generated by other compilers.
2918
2919 Known incompatibilities in @option{-fabi-version=2} (which was the
2920 default from GCC 3.4 to 4.9) include:
2921
2922 @itemize @bullet
2923
2924 @item
2925 A template with a non-type template parameter of reference type was
2926 mangled incorrectly:
2927 @smallexample
2928 extern int N;
2929 template <int &> struct S @{@};
2930 void n (S<N>) @{2@}
2931 @end smallexample
2932
2933 This was fixed in @option{-fabi-version=3}.
2934
2935 @item
2936 SIMD vector types declared using @code{__attribute ((vector_size))} were
2937 mangled in a non-standard way that does not allow for overloading of
2938 functions taking vectors of different sizes.
2939
2940 The mangling was changed in @option{-fabi-version=4}.
2941
2942 @item
2943 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2944 qualifiers, and @code{decltype} of a plain declaration was folded away.
2945
2946 These mangling issues were fixed in @option{-fabi-version=5}.
2947
2948 @item
2949 Scoped enumerators passed as arguments to a variadic function are
2950 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2951 On most targets this does not actually affect the parameter passing
2952 ABI, as there is no way to pass an argument smaller than @code{int}.
2953
2954 Also, the ABI changed the mangling of template argument packs,
2955 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2956 a class scope function used as a template argument.
2957
2958 These issues were corrected in @option{-fabi-version=6}.
2959
2960 @item
2961 Lambdas in default argument scope were mangled incorrectly, and the
2962 ABI changed the mangling of @code{nullptr_t}.
2963
2964 These issues were corrected in @option{-fabi-version=7}.
2965
2966 @item
2967 When mangling a function type with function-cv-qualifiers, the
2968 un-qualified function type was incorrectly treated as a substitution
2969 candidate.
2970
2971 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2972
2973 @item
2974 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2975 unaligned accesses. Note that this did not affect the ABI of a
2976 function with a @code{nullptr_t} parameter, as parameters have a
2977 minimum alignment.
2978
2979 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2980
2981 @item
2982 Target-specific attributes that affect the identity of a type, such as
2983 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2984 did not affect the mangled name, leading to name collisions when
2985 function pointers were used as template arguments.
2986
2987 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2988
2989 @end itemize
2990
2991 It also warns about psABI-related changes. The known psABI changes at this
2992 point include:
2993
2994 @itemize @bullet
2995
2996 @item
2997 For SysV/x86-64, unions with @code{long double} members are
2998 passed in memory as specified in psABI. For example:
2999
3000 @smallexample
3001 union U @{
3002 long double ld;
3003 int i;
3004 @};
3005 @end smallexample
3006
3007 @noindent
3008 @code{union U} is always passed in memory.
3009
3010 @end itemize
3011
3012 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3013 @opindex Wabi-tag
3014 @opindex Wabi-tag
3015 Warn when a type with an ABI tag is used in a context that does not
3016 have that ABI tag. See @ref{C++ Attributes} for more information
3017 about ABI tags.
3018
3019 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3020 @opindex Wcomma-subscript
3021 @opindex Wno-comma-subscript
3022 Warn about uses of a comma expression within a subscripting expression.
3023 This usage was deprecated in C++2a. However, a comma expression wrapped
3024 in @code{( )} is not deprecated. Example:
3025
3026 @smallexample
3027 @group
3028 void f(int *a, int b, int c) @{
3029 a[b,c]; // deprecated
3030 a[(b,c)]; // OK
3031 @}
3032 @end group
3033 @end smallexample
3034
3035 Enabled by default with @option{-std=c++2a}.
3036
3037 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3038 @opindex Wctor-dtor-privacy
3039 @opindex Wno-ctor-dtor-privacy
3040 Warn when a class seems unusable because all the constructors or
3041 destructors in that class are private, and it has neither friends nor
3042 public static member functions. Also warn if there are no non-private
3043 methods, and there's at least one private member function that isn't
3044 a constructor or destructor.
3045
3046 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3047 @opindex Wdelete-non-virtual-dtor
3048 @opindex Wno-delete-non-virtual-dtor
3049 Warn when @code{delete} is used to destroy an instance of a class that
3050 has virtual functions and non-virtual destructor. It is unsafe to delete
3051 an instance of a derived class through a pointer to a base class if the
3052 base class does not have a virtual destructor. This warning is enabled
3053 by @option{-Wall}.
3054
3055 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3056 @opindex Wdeprecated-copy
3057 @opindex Wno-deprecated-copy
3058 Warn that the implicit declaration of a copy constructor or copy
3059 assignment operator is deprecated if the class has a user-provided
3060 copy constructor or copy assignment operator, in C++11 and up. This
3061 warning is enabled by @option{-Wextra}. With
3062 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3063 user-provided destructor.
3064
3065 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3066 @opindex Winit-list-lifetime
3067 @opindex Wno-init-list-lifetime
3068 Do not warn about uses of @code{std::initializer_list} that are likely
3069 to result in dangling pointers. Since the underlying array for an
3070 @code{initializer_list} is handled like a normal C++ temporary object,
3071 it is easy to inadvertently keep a pointer to the array past the end
3072 of the array's lifetime. For example:
3073
3074 @itemize @bullet
3075 @item
3076 If a function returns a temporary @code{initializer_list}, or a local
3077 @code{initializer_list} variable, the array's lifetime ends at the end
3078 of the return statement, so the value returned has a dangling pointer.
3079
3080 @item
3081 If a new-expression creates an @code{initializer_list}, the array only
3082 lives until the end of the enclosing full-expression, so the
3083 @code{initializer_list} in the heap has a dangling pointer.
3084
3085 @item
3086 When an @code{initializer_list} variable is assigned from a
3087 brace-enclosed initializer list, the temporary array created for the
3088 right side of the assignment only lives until the end of the
3089 full-expression, so at the next statement the @code{initializer_list}
3090 variable has a dangling pointer.
3091
3092 @smallexample
3093 // li's initial underlying array lives as long as li
3094 std::initializer_list<int> li = @{ 1,2,3 @};
3095 // assignment changes li to point to a temporary array
3096 li = @{ 4, 5 @};
3097 // now the temporary is gone and li has a dangling pointer
3098 int i = li.begin()[0] // undefined behavior
3099 @end smallexample
3100
3101 @item
3102 When a list constructor stores the @code{begin} pointer from the
3103 @code{initializer_list} argument, this doesn't extend the lifetime of
3104 the array, so if a class variable is constructed from a temporary
3105 @code{initializer_list}, the pointer is left dangling by the end of
3106 the variable declaration statement.
3107
3108 @end itemize
3109
3110 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3111 @opindex Wliteral-suffix
3112 @opindex Wno-literal-suffix
3113 Warn when a string or character literal is followed by a ud-suffix which does
3114 not begin with an underscore. As a conforming extension, GCC treats such
3115 suffixes as separate preprocessing tokens in order to maintain backwards
3116 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3117 For example:
3118
3119 @smallexample
3120 #define __STDC_FORMAT_MACROS
3121 #include <inttypes.h>
3122 #include <stdio.h>
3123
3124 int main() @{
3125 int64_t i64 = 123;
3126 printf("My int64: %" PRId64"\n", i64);
3127 @}
3128 @end smallexample
3129
3130 In this case, @code{PRId64} is treated as a separate preprocessing token.
3131
3132 Additionally, warn when a user-defined literal operator is declared with
3133 a literal suffix identifier that doesn't begin with an underscore. Literal
3134 suffix identifiers that don't begin with an underscore are reserved for
3135 future standardization.
3136
3137 This warning is enabled by default.
3138
3139 @item -Wlto-type-mismatch
3140 @opindex Wlto-type-mismatch
3141 @opindex Wno-lto-type-mismatch
3142
3143 During the link-time optimization warn about type mismatches in
3144 global declarations from different compilation units.
3145 Requires @option{-flto} to be enabled. Enabled by default.
3146
3147 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3148 @opindex Wnarrowing
3149 @opindex Wno-narrowing
3150 For C++11 and later standards, narrowing conversions are diagnosed by default,
3151 as required by the standard. A narrowing conversion from a constant produces
3152 an error, and a narrowing conversion from a non-constant produces a warning,
3153 but @option{-Wno-narrowing} suppresses the diagnostic.
3154 Note that this does not affect the meaning of well-formed code;
3155 narrowing conversions are still considered ill-formed in SFINAE contexts.
3156
3157 With @option{-Wnarrowing} in C++98, warn when a narrowing
3158 conversion prohibited by C++11 occurs within
3159 @samp{@{ @}}, e.g.
3160
3161 @smallexample
3162 int i = @{ 2.2 @}; // error: narrowing from double to int
3163 @end smallexample
3164
3165 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3166
3167 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3168 @opindex Wnoexcept
3169 @opindex Wno-noexcept
3170 Warn when a noexcept-expression evaluates to false because of a call
3171 to a function that does not have a non-throwing exception
3172 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3173 the compiler to never throw an exception.
3174
3175 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3176 @opindex Wnoexcept-type
3177 @opindex Wno-noexcept-type
3178 Warn if the C++17 feature making @code{noexcept} part of a function
3179 type changes the mangled name of a symbol relative to C++14. Enabled
3180 by @option{-Wabi} and @option{-Wc++17-compat}.
3181
3182 As an example:
3183
3184 @smallexample
3185 template <class T> void f(T t) @{ t(); @};
3186 void g() noexcept;
3187 void h() @{ f(g); @}
3188 @end smallexample
3189
3190 @noindent
3191 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3192 C++17 it calls @code{f<void(*)()noexcept>}.
3193
3194 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3195 @opindex Wclass-memaccess
3196 @opindex Wno-class-memaccess
3197 Warn when the destination of a call to a raw memory function such as
3198 @code{memset} or @code{memcpy} is an object of class type, and when writing
3199 into such an object might bypass the class non-trivial or deleted constructor
3200 or copy assignment, violate const-correctness or encapsulation, or corrupt
3201 virtual table pointers. Modifying the representation of such objects may
3202 violate invariants maintained by member functions of the class. For example,
3203 the call to @code{memset} below is undefined because it modifies a non-trivial
3204 class object and is, therefore, diagnosed. The safe way to either initialize
3205 or clear the storage of objects of such types is by using the appropriate
3206 constructor or assignment operator, if one is available.
3207 @smallexample
3208 std::string str = "abc";
3209 memset (&str, 0, sizeof str);
3210 @end smallexample
3211 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3212 Explicitly casting the pointer to the class object to @code{void *} or
3213 to a type that can be safely accessed by the raw memory function suppresses
3214 the warning.
3215
3216 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3217 @opindex Wnon-virtual-dtor
3218 @opindex Wno-non-virtual-dtor
3219 Warn when a class has virtual functions and an accessible non-virtual
3220 destructor itself or in an accessible polymorphic base class, in which
3221 case it is possible but unsafe to delete an instance of a derived
3222 class through a pointer to the class itself or base class. This
3223 warning is automatically enabled if @option{-Weffc++} is specified.
3224
3225 @item -Wregister @r{(C++ and Objective-C++ only)}
3226 @opindex Wregister
3227 @opindex Wno-register
3228 Warn on uses of the @code{register} storage class specifier, except
3229 when it is part of the GNU @ref{Explicit Register Variables} extension.
3230 The use of the @code{register} keyword as storage class specifier has
3231 been deprecated in C++11 and removed in C++17.
3232 Enabled by default with @option{-std=c++17}.
3233
3234 @item -Wreorder @r{(C++ and Objective-C++ only)}
3235 @opindex Wreorder
3236 @opindex Wno-reorder
3237 @cindex reordering, warning
3238 @cindex warning for reordering of member initializers
3239 Warn when the order of member initializers given in the code does not
3240 match the order in which they must be executed. For instance:
3241
3242 @smallexample
3243 struct A @{
3244 int i;
3245 int j;
3246 A(): j (0), i (1) @{ @}
3247 @};
3248 @end smallexample
3249
3250 @noindent
3251 The compiler rearranges the member initializers for @code{i}
3252 and @code{j} to match the declaration order of the members, emitting
3253 a warning to that effect. This warning is enabled by @option{-Wall}.
3254
3255 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3256 @opindex Wpessimizing-move
3257 @opindex Wno-pessimizing-move
3258 This warning warns when a call to @code{std::move} prevents copy
3259 elision. A typical scenario when copy elision can occur is when returning in
3260 a function with a class return type, when the expression being returned is the
3261 name of a non-volatile automatic object, and is not a function parameter, and
3262 has the same type as the function return type.
3263
3264 @smallexample
3265 struct T @{
3266 @dots{}
3267 @};
3268 T fn()
3269 @{
3270 T t;
3271 @dots{}
3272 return std::move (t);
3273 @}
3274 @end smallexample
3275
3276 But in this example, the @code{std::move} call prevents copy elision.
3277
3278 This warning is enabled by @option{-Wall}.
3279
3280 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3281 @opindex Wredundant-move
3282 @opindex Wno-redundant-move
3283 This warning warns about redundant calls to @code{std::move}; that is, when
3284 a move operation would have been performed even without the @code{std::move}
3285 call. This happens because the compiler is forced to treat the object as if
3286 it were an rvalue in certain situations such as returning a local variable,
3287 where copy elision isn't applicable. Consider:
3288
3289 @smallexample
3290 struct T @{
3291 @dots{}
3292 @};
3293 T fn(T t)
3294 @{
3295 @dots{}
3296 return std::move (t);
3297 @}
3298 @end smallexample
3299
3300 Here, the @code{std::move} call is redundant. Because G++ implements Core
3301 Issue 1579, another example is:
3302
3303 @smallexample
3304 struct T @{ // convertible to U
3305 @dots{}
3306 @};
3307 struct U @{
3308 @dots{}
3309 @};
3310 U fn()
3311 @{
3312 T t;
3313 @dots{}
3314 return std::move (t);
3315 @}
3316 @end smallexample
3317 In this example, copy elision isn't applicable because the type of the
3318 expression being returned and the function return type differ, yet G++
3319 treats the return value as if it were designated by an rvalue.
3320
3321 This warning is enabled by @option{-Wextra}.
3322
3323 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3324 @opindex fext-numeric-literals
3325 @opindex fno-ext-numeric-literals
3326 Accept imaginary, fixed-point, or machine-defined
3327 literal number suffixes as GNU extensions.
3328 When this option is turned off these suffixes are treated
3329 as C++11 user-defined literal numeric suffixes.
3330 This is on by default for all pre-C++11 dialects and all GNU dialects:
3331 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3332 @option{-std=gnu++14}.
3333 This option is off by default
3334 for ISO C++11 onwards (@option{-std=c++11}, ...).
3335 @end table
3336
3337 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3338
3339 @table @gcctabopt
3340 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3341 @opindex Weffc++
3342 @opindex Wno-effc++
3343 Warn about violations of the following style guidelines from Scott Meyers'
3344 @cite{Effective C++} series of books:
3345
3346 @itemize @bullet
3347 @item
3348 Define a copy constructor and an assignment operator for classes
3349 with dynamically-allocated memory.
3350
3351 @item
3352 Prefer initialization to assignment in constructors.
3353
3354 @item
3355 Have @code{operator=} return a reference to @code{*this}.
3356
3357 @item
3358 Don't try to return a reference when you must return an object.
3359
3360 @item
3361 Distinguish between prefix and postfix forms of increment and
3362 decrement operators.
3363
3364 @item
3365 Never overload @code{&&}, @code{||}, or @code{,}.
3366
3367 @end itemize
3368
3369 This option also enables @option{-Wnon-virtual-dtor}, which is also
3370 one of the effective C++ recommendations. However, the check is
3371 extended to warn about the lack of virtual destructor in accessible
3372 non-polymorphic bases classes too.
3373
3374 When selecting this option, be aware that the standard library
3375 headers do not obey all of these guidelines; use @samp{grep -v}
3376 to filter out those warnings.
3377
3378 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3379 @opindex Wstrict-null-sentinel
3380 @opindex Wno-strict-null-sentinel
3381 Warn about the use of an uncasted @code{NULL} as sentinel. When
3382 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3383 to @code{__null}. Although it is a null pointer constant rather than a
3384 null pointer, it is guaranteed to be of the same size as a pointer.
3385 But this use is not portable across different compilers.
3386
3387 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3388 @opindex Wno-non-template-friend
3389 @opindex Wnon-template-friend
3390 Disable warnings when non-template friend functions are declared
3391 within a template. In very old versions of GCC that predate implementation
3392 of the ISO standard, declarations such as
3393 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3394 could be interpreted as a particular specialization of a template
3395 function; the warning exists to diagnose compatibility problems,
3396 and is enabled by default.
3397
3398 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3399 @opindex Wold-style-cast
3400 @opindex Wno-old-style-cast
3401 Warn if an old-style (C-style) cast to a non-void type is used within
3402 a C++ program. The new-style casts (@code{dynamic_cast},
3403 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3404 less vulnerable to unintended effects and much easier to search for.
3405
3406 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3407 @opindex Woverloaded-virtual
3408 @opindex Wno-overloaded-virtual
3409 @cindex overloaded virtual function, warning
3410 @cindex warning for overloaded virtual function
3411 Warn when a function declaration hides virtual functions from a
3412 base class. For example, in:
3413
3414 @smallexample
3415 struct A @{
3416 virtual void f();
3417 @};
3418
3419 struct B: public A @{
3420 void f(int);
3421 @};
3422 @end smallexample
3423
3424 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3425 like:
3426
3427 @smallexample
3428 B* b;
3429 b->f();
3430 @end smallexample
3431
3432 @noindent
3433 fails to compile.
3434
3435 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3436 @opindex Wno-pmf-conversions
3437 @opindex Wpmf-conversions
3438 Disable the diagnostic for converting a bound pointer to member function
3439 to a plain pointer.
3440
3441 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3442 @opindex Wsign-promo
3443 @opindex Wno-sign-promo
3444 Warn when overload resolution chooses a promotion from unsigned or
3445 enumerated type to a signed type, over a conversion to an unsigned type of
3446 the same size. Previous versions of G++ tried to preserve
3447 unsignedness, but the standard mandates the current behavior.
3448
3449 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3450 @opindex Wtemplates
3451 @opindex Wno-templates
3452 Warn when a primary template declaration is encountered. Some coding
3453 rules disallow templates, and this may be used to enforce that rule.
3454 The warning is inactive inside a system header file, such as the STL, so
3455 one can still use the STL. One may also instantiate or specialize
3456 templates.
3457
3458 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3459 @opindex Wmultiple-inheritance
3460 @opindex Wno-multiple-inheritance
3461 Warn when a class is defined with multiple direct base classes. Some
3462 coding rules disallow multiple inheritance, and this may be used to
3463 enforce that rule. The warning is inactive inside a system header file,
3464 such as the STL, so one can still use the STL. One may also define
3465 classes that indirectly use multiple inheritance.
3466
3467 @item -Wvirtual-inheritance
3468 @opindex Wvirtual-inheritance
3469 @opindex Wno-virtual-inheritance
3470 Warn when a class is defined with a virtual direct base class. Some
3471 coding rules disallow multiple inheritance, and this may be used to
3472 enforce that rule. The warning is inactive inside a system header file,
3473 such as the STL, so one can still use the STL. One may also define
3474 classes that indirectly use virtual inheritance.
3475
3476 @item -Wnamespaces
3477 @opindex Wnamespaces
3478 @opindex Wno-namespaces
3479 Warn when a namespace definition is opened. Some coding rules disallow
3480 namespaces, and this may be used to enforce that rule. The warning is
3481 inactive inside a system header file, such as the STL, so one can still
3482 use the STL. One may also use using directives and qualified names.
3483
3484 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3485 @opindex Wterminate
3486 @opindex Wno-terminate
3487 Disable the warning about a throw-expression that will immediately
3488 result in a call to @code{terminate}.
3489
3490 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3491 @opindex Wno-class-conversion
3492 @opindex Wclass-conversion
3493 Disable the warning about the case when a conversion function converts an
3494 object to the same type, to a base class of that type, or to void; such
3495 a conversion function will never be called.
3496
3497 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3498 @opindex Wvolatile
3499 @opindex Wno-volatile
3500 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3501 postfix and prefix @code{++} and @code{--} expressions of
3502 @code{volatile}-qualified types, using simple assignments where the left
3503 operand is a @code{volatile}-qualified non-class type for their value,
3504 compound assignments where the left operand is a @code{volatile}-qualified
3505 non-class type, @code{volatile}-qualified function return type,
3506 @code{volatile}-qualified parameter type, and structured bindings of a
3507 @code{volatile}-qualified type. This usage was deprecated in C++20.
3508
3509 Enabled by default with @option{-std=c++2a}.
3510 @end table
3511
3512 @node Objective-C and Objective-C++ Dialect Options
3513 @section Options Controlling Objective-C and Objective-C++ Dialects
3514
3515 @cindex compiler options, Objective-C and Objective-C++
3516 @cindex Objective-C and Objective-C++ options, command-line
3517 @cindex options, Objective-C and Objective-C++
3518 (NOTE: This manual does not describe the Objective-C and Objective-C++
3519 languages themselves. @xref{Standards,,Language Standards
3520 Supported by GCC}, for references.)
3521
3522 This section describes the command-line options that are only meaningful
3523 for Objective-C and Objective-C++ programs. You can also use most of
3524 the language-independent GNU compiler options.
3525 For example, you might compile a file @file{some_class.m} like this:
3526
3527 @smallexample
3528 gcc -g -fgnu-runtime -O -c some_class.m
3529 @end smallexample
3530
3531 @noindent
3532 In this example, @option{-fgnu-runtime} is an option meant only for
3533 Objective-C and Objective-C++ programs; you can use the other options with
3534 any language supported by GCC@.
3535
3536 Note that since Objective-C is an extension of the C language, Objective-C
3537 compilations may also use options specific to the C front-end (e.g.,
3538 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3539 C++-specific options (e.g., @option{-Wabi}).
3540
3541 Here is a list of options that are @emph{only} for compiling Objective-C
3542 and Objective-C++ programs:
3543
3544 @table @gcctabopt
3545 @item -fconstant-string-class=@var{class-name}
3546 @opindex fconstant-string-class
3547 Use @var{class-name} as the name of the class to instantiate for each
3548 literal string specified with the syntax @code{@@"@dots{}"}. The default
3549 class name is @code{NXConstantString} if the GNU runtime is being used, and
3550 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3551 @option{-fconstant-cfstrings} option, if also present, overrides the
3552 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3553 to be laid out as constant CoreFoundation strings.
3554
3555 @item -fgnu-runtime
3556 @opindex fgnu-runtime
3557 Generate object code compatible with the standard GNU Objective-C
3558 runtime. This is the default for most types of systems.
3559
3560 @item -fnext-runtime
3561 @opindex fnext-runtime
3562 Generate output compatible with the NeXT runtime. This is the default
3563 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3564 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3565 used.
3566
3567 @item -fno-nil-receivers
3568 @opindex fno-nil-receivers
3569 @opindex fnil-receivers
3570 Assume that all Objective-C message dispatches (@code{[receiver
3571 message:arg]}) in this translation unit ensure that the receiver is
3572 not @code{nil}. This allows for more efficient entry points in the
3573 runtime to be used. This option is only available in conjunction with
3574 the NeXT runtime and ABI version 0 or 1.
3575
3576 @item -fobjc-abi-version=@var{n}
3577 @opindex fobjc-abi-version
3578 Use version @var{n} of the Objective-C ABI for the selected runtime.
3579 This option is currently supported only for the NeXT runtime. In that
3580 case, Version 0 is the traditional (32-bit) ABI without support for
3581 properties and other Objective-C 2.0 additions. Version 1 is the
3582 traditional (32-bit) ABI with support for properties and other
3583 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3584 nothing is specified, the default is Version 0 on 32-bit target
3585 machines, and Version 2 on 64-bit target machines.
3586
3587 @item -fobjc-call-cxx-cdtors
3588 @opindex fobjc-call-cxx-cdtors
3589 For each Objective-C class, check if any of its instance variables is a
3590 C++ object with a non-trivial default constructor. If so, synthesize a
3591 special @code{- (id) .cxx_construct} instance method which runs
3592 non-trivial default constructors on any such instance variables, in order,
3593 and then return @code{self}. Similarly, check if any instance variable
3594 is a C++ object with a non-trivial destructor, and if so, synthesize a
3595 special @code{- (void) .cxx_destruct} method which runs
3596 all such default destructors, in reverse order.
3597
3598 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3599 methods thusly generated only operate on instance variables
3600 declared in the current Objective-C class, and not those inherited
3601 from superclasses. It is the responsibility of the Objective-C
3602 runtime to invoke all such methods in an object's inheritance
3603 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3604 by the runtime immediately after a new object instance is allocated;
3605 the @code{- (void) .cxx_destruct} methods are invoked immediately
3606 before the runtime deallocates an object instance.
3607
3608 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3609 support for invoking the @code{- (id) .cxx_construct} and
3610 @code{- (void) .cxx_destruct} methods.
3611
3612 @item -fobjc-direct-dispatch
3613 @opindex fobjc-direct-dispatch
3614 Allow fast jumps to the message dispatcher. On Darwin this is
3615 accomplished via the comm page.
3616
3617 @item -fobjc-exceptions
3618 @opindex fobjc-exceptions
3619 Enable syntactic support for structured exception handling in
3620 Objective-C, similar to what is offered by C++. This option
3621 is required to use the Objective-C keywords @code{@@try},
3622 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3623 @code{@@synchronized}. This option is available with both the GNU
3624 runtime and the NeXT runtime (but not available in conjunction with
3625 the NeXT runtime on Mac OS X 10.2 and earlier).
3626
3627 @item -fobjc-gc
3628 @opindex fobjc-gc
3629 Enable garbage collection (GC) in Objective-C and Objective-C++
3630 programs. This option is only available with the NeXT runtime; the
3631 GNU runtime has a different garbage collection implementation that
3632 does not require special compiler flags.
3633
3634 @item -fobjc-nilcheck
3635 @opindex fobjc-nilcheck
3636 For the NeXT runtime with version 2 of the ABI, check for a nil
3637 receiver in method invocations before doing the actual method call.
3638 This is the default and can be disabled using
3639 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3640 checked for nil in this way no matter what this flag is set to.
3641 Currently this flag does nothing when the GNU runtime, or an older
3642 version of the NeXT runtime ABI, is used.
3643
3644 @item -fobjc-std=objc1
3645 @opindex fobjc-std
3646 Conform to the language syntax of Objective-C 1.0, the language
3647 recognized by GCC 4.0. This only affects the Objective-C additions to
3648 the C/C++ language; it does not affect conformance to C/C++ standards,
3649 which is controlled by the separate C/C++ dialect option flags. When
3650 this option is used with the Objective-C or Objective-C++ compiler,
3651 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3652 This is useful if you need to make sure that your Objective-C code can
3653 be compiled with older versions of GCC@.
3654
3655 @item -freplace-objc-classes
3656 @opindex freplace-objc-classes
3657 Emit a special marker instructing @command{ld(1)} not to statically link in
3658 the resulting object file, and allow @command{dyld(1)} to load it in at
3659 run time instead. This is used in conjunction with the Fix-and-Continue
3660 debugging mode, where the object file in question may be recompiled and
3661 dynamically reloaded in the course of program execution, without the need
3662 to restart the program itself. Currently, Fix-and-Continue functionality
3663 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3664 and later.
3665
3666 @item -fzero-link
3667 @opindex fzero-link
3668 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3669 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3670 compile time) with static class references that get initialized at load time,
3671 which improves run-time performance. Specifying the @option{-fzero-link} flag
3672 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3673 to be retained. This is useful in Zero-Link debugging mode, since it allows
3674 for individual class implementations to be modified during program execution.
3675 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3676 regardless of command-line options.
3677
3678 @item -fno-local-ivars
3679 @opindex fno-local-ivars
3680 @opindex flocal-ivars
3681 By default instance variables in Objective-C can be accessed as if
3682 they were local variables from within the methods of the class they're
3683 declared in. This can lead to shadowing between instance variables
3684 and other variables declared either locally inside a class method or
3685 globally with the same name. Specifying the @option{-fno-local-ivars}
3686 flag disables this behavior thus avoiding variable shadowing issues.
3687
3688 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3689 @opindex fivar-visibility
3690 Set the default instance variable visibility to the specified option
3691 so that instance variables declared outside the scope of any access
3692 modifier directives default to the specified visibility.
3693
3694 @item -gen-decls
3695 @opindex gen-decls
3696 Dump interface declarations for all classes seen in the source file to a
3697 file named @file{@var{sourcename}.decl}.
3698
3699 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3700 @opindex Wassign-intercept
3701 @opindex Wno-assign-intercept
3702 Warn whenever an Objective-C assignment is being intercepted by the
3703 garbage collector.
3704
3705 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3706 @opindex Wno-protocol
3707 @opindex Wprotocol
3708 If a class is declared to implement a protocol, a warning is issued for
3709 every method in the protocol that is not implemented by the class. The
3710 default behavior is to issue a warning for every method not explicitly
3711 implemented in the class, even if a method implementation is inherited
3712 from the superclass. If you use the @option{-Wno-protocol} option, then
3713 methods inherited from the superclass are considered to be implemented,
3714 and no warning is issued for them.
3715
3716 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3717 @opindex Wselector
3718 @opindex Wno-selector
3719 Warn if multiple methods of different types for the same selector are
3720 found during compilation. The check is performed on the list of methods
3721 in the final stage of compilation. Additionally, a check is performed
3722 for each selector appearing in a @code{@@selector(@dots{})}
3723 expression, and a corresponding method for that selector has been found
3724 during compilation. Because these checks scan the method table only at
3725 the end of compilation, these warnings are not produced if the final
3726 stage of compilation is not reached, for example because an error is
3727 found during compilation, or because the @option{-fsyntax-only} option is
3728 being used.
3729
3730 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3731 @opindex Wstrict-selector-match
3732 @opindex Wno-strict-selector-match
3733 Warn if multiple methods with differing argument and/or return types are
3734 found for a given selector when attempting to send a message using this
3735 selector to a receiver of type @code{id} or @code{Class}. When this flag
3736 is off (which is the default behavior), the compiler omits such warnings
3737 if any differences found are confined to types that share the same size
3738 and alignment.
3739
3740 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3741 @opindex Wundeclared-selector
3742 @opindex Wno-undeclared-selector
3743 Warn if a @code{@@selector(@dots{})} expression referring to an
3744 undeclared selector is found. A selector is considered undeclared if no
3745 method with that name has been declared before the
3746 @code{@@selector(@dots{})} expression, either explicitly in an
3747 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3748 an @code{@@implementation} section. This option always performs its
3749 checks as soon as a @code{@@selector(@dots{})} expression is found,
3750 while @option{-Wselector} only performs its checks in the final stage of
3751 compilation. This also enforces the coding style convention
3752 that methods and selectors must be declared before being used.
3753
3754 @item -print-objc-runtime-info
3755 @opindex print-objc-runtime-info
3756 Generate C header describing the largest structure that is passed by
3757 value, if any.
3758
3759 @end table
3760
3761 @node Diagnostic Message Formatting Options
3762 @section Options to Control Diagnostic Messages Formatting
3763 @cindex options to control diagnostics formatting
3764 @cindex diagnostic messages
3765 @cindex message formatting
3766
3767 Traditionally, diagnostic messages have been formatted irrespective of
3768 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3769 options described below
3770 to control the formatting algorithm for diagnostic messages,
3771 e.g.@: how many characters per line, how often source location
3772 information should be reported. Note that some language front ends may not
3773 honor these options.
3774
3775 @table @gcctabopt
3776 @item -fmessage-length=@var{n}
3777 @opindex fmessage-length
3778 Try to format error messages so that they fit on lines of about
3779 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3780 done; each error message appears on a single line. This is the
3781 default for all front ends.
3782
3783 Note - this option also affects the display of the @samp{#error} and
3784 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3785 function/type/variable attribute. It does not however affect the
3786 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3787
3788 @item -fdiagnostics-show-location=once
3789 @opindex fdiagnostics-show-location
3790 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3791 reporter to emit source location information @emph{once}; that is, in
3792 case the message is too long to fit on a single physical line and has to
3793 be wrapped, the source location won't be emitted (as prefix) again,
3794 over and over, in subsequent continuation lines. This is the default
3795 behavior.
3796
3797 @item -fdiagnostics-show-location=every-line
3798 Only meaningful in line-wrapping mode. Instructs the diagnostic
3799 messages reporter to emit the same source location information (as
3800 prefix) for physical lines that result from the process of breaking
3801 a message which is too long to fit on a single line.
3802
3803 @item -fdiagnostics-color[=@var{WHEN}]
3804 @itemx -fno-diagnostics-color
3805 @opindex fdiagnostics-color
3806 @cindex highlight, color
3807 @vindex GCC_COLORS @r{environment variable}
3808 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3809 or @samp{auto}. The default depends on how the compiler has been configured,
3810 it can be any of the above @var{WHEN} options or also @samp{never}
3811 if @env{GCC_COLORS} environment variable isn't present in the environment,
3812 and @samp{auto} otherwise.
3813 @samp{auto} means to use color only when the standard error is a terminal.
3814 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3815 aliases for @option{-fdiagnostics-color=always} and
3816 @option{-fdiagnostics-color=never}, respectively.
3817
3818 The colors are defined by the environment variable @env{GCC_COLORS}.
3819 Its value is a colon-separated list of capabilities and Select Graphic
3820 Rendition (SGR) substrings. SGR commands are interpreted by the
3821 terminal or terminal emulator. (See the section in the documentation
3822 of your text terminal for permitted values and their meanings as
3823 character attributes.) These substring values are integers in decimal
3824 representation and can be concatenated with semicolons.
3825 Common values to concatenate include
3826 @samp{1} for bold,
3827 @samp{4} for underline,
3828 @samp{5} for blink,
3829 @samp{7} for inverse,
3830 @samp{39} for default foreground color,
3831 @samp{30} to @samp{37} for foreground colors,
3832 @samp{90} to @samp{97} for 16-color mode foreground colors,
3833 @samp{38;5;0} to @samp{38;5;255}
3834 for 88-color and 256-color modes foreground colors,
3835 @samp{49} for default background color,
3836 @samp{40} to @samp{47} for background colors,
3837 @samp{100} to @samp{107} for 16-color mode background colors,
3838 and @samp{48;5;0} to @samp{48;5;255}
3839 for 88-color and 256-color modes background colors.
3840
3841 The default @env{GCC_COLORS} is
3842 @smallexample
3843 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3844 quote=01:fixit-insert=32:fixit-delete=31:\
3845 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3846 type-diff=01;32
3847 @end smallexample
3848 @noindent
3849 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3850 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3851 @samp{01} is bold, and @samp{31} is red.
3852 Setting @env{GCC_COLORS} to the empty string disables colors.
3853 Supported capabilities are as follows.
3854
3855 @table @code
3856 @item error=
3857 @vindex error GCC_COLORS @r{capability}
3858 SGR substring for error: markers.
3859
3860 @item warning=
3861 @vindex warning GCC_COLORS @r{capability}
3862 SGR substring for warning: markers.
3863
3864 @item note=
3865 @vindex note GCC_COLORS @r{capability}
3866 SGR substring for note: markers.
3867
3868 @item range1=
3869 @vindex range1 GCC_COLORS @r{capability}
3870 SGR substring for first additional range.
3871
3872 @item range2=
3873 @vindex range2 GCC_COLORS @r{capability}
3874 SGR substring for second additional range.
3875
3876 @item locus=
3877 @vindex locus GCC_COLORS @r{capability}
3878 SGR substring for location information, @samp{file:line} or
3879 @samp{file:line:column} etc.
3880
3881 @item quote=
3882 @vindex quote GCC_COLORS @r{capability}
3883 SGR substring for information printed within quotes.
3884
3885 @item fixit-insert=
3886 @vindex fixit-insert GCC_COLORS @r{capability}
3887 SGR substring for fix-it hints suggesting text to
3888 be inserted or replaced.
3889
3890 @item fixit-delete=
3891 @vindex fixit-delete GCC_COLORS @r{capability}
3892 SGR substring for fix-it hints suggesting text to
3893 be deleted.
3894
3895 @item diff-filename=
3896 @vindex diff-filename GCC_COLORS @r{capability}
3897 SGR substring for filename headers within generated patches.
3898
3899 @item diff-hunk=
3900 @vindex diff-hunk GCC_COLORS @r{capability}
3901 SGR substring for the starts of hunks within generated patches.
3902
3903 @item diff-delete=
3904 @vindex diff-delete GCC_COLORS @r{capability}
3905 SGR substring for deleted lines within generated patches.
3906
3907 @item diff-insert=
3908 @vindex diff-insert GCC_COLORS @r{capability}
3909 SGR substring for inserted lines within generated patches.
3910
3911 @item type-diff=
3912 @vindex type-diff GCC_COLORS @r{capability}
3913 SGR substring for highlighting mismatching types within template
3914 arguments in the C++ frontend.
3915 @end table
3916
3917 @item -fdiagnostics-urls[=@var{WHEN}]
3918 @opindex fdiagnostics-urls
3919 @cindex urls
3920 Use escape sequences to embed URLs in diagnostics. For example, when
3921 @option{-fdiagnostics-show-option} emits text showing the command-line
3922 option controlling a diagnostic, embed a URL for documentation of that
3923 option.
3924
3925 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
3926 The default is @samp{auto}, which means to use URL escape sequences only
3927 when the standard error is a terminal.
3928
3929 @item -fno-diagnostics-show-option
3930 @opindex fno-diagnostics-show-option
3931 @opindex fdiagnostics-show-option
3932 By default, each diagnostic emitted includes text indicating the
3933 command-line option that directly controls the diagnostic (if such an
3934 option is known to the diagnostic machinery). Specifying the
3935 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3936
3937 @item -fno-diagnostics-show-caret
3938 @opindex fno-diagnostics-show-caret
3939 @opindex fdiagnostics-show-caret
3940 By default, each diagnostic emitted includes the original source line
3941 and a caret @samp{^} indicating the column. This option suppresses this
3942 information. The source line is truncated to @var{n} characters, if
3943 the @option{-fmessage-length=n} option is given. When the output is done
3944 to the terminal, the width is limited to the width given by the
3945 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3946
3947 @item -fno-diagnostics-show-labels
3948 @opindex fno-diagnostics-show-labels
3949 @opindex fdiagnostics-show-labels
3950 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3951 diagnostics can label ranges of source code with pertinent information, such
3952 as the types of expressions:
3953
3954 @smallexample
3955 printf ("foo %s bar", long_i + long_j);
3956 ~^ ~~~~~~~~~~~~~~~
3957 | |
3958 char * long int
3959 @end smallexample
3960
3961 This option suppresses the printing of these labels (in the example above,
3962 the vertical bars and the ``char *'' and ``long int'' text).
3963
3964 @item -fno-diagnostics-show-line-numbers
3965 @opindex fno-diagnostics-show-line-numbers
3966 @opindex fdiagnostics-show-line-numbers
3967 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3968 a left margin is printed, showing line numbers. This option suppresses this
3969 left margin.
3970
3971 @item -fdiagnostics-minimum-margin-width=@var{width}
3972 @opindex fdiagnostics-minimum-margin-width
3973 This option controls the minimum width of the left margin printed by
3974 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3975
3976 @item -fdiagnostics-parseable-fixits
3977 @opindex fdiagnostics-parseable-fixits
3978 Emit fix-it hints in a machine-parseable format, suitable for consumption
3979 by IDEs. For each fix-it, a line will be printed after the relevant
3980 diagnostic, starting with the string ``fix-it:''. For example:
3981
3982 @smallexample
3983 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3984 @end smallexample
3985
3986 The location is expressed as a half-open range, expressed as a count of
3987 bytes, starting at byte 1 for the initial column. In the above example,
3988 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3989 given string:
3990
3991 @smallexample
3992 00000000011111111112222222222
3993 12345678901234567890123456789
3994 gtk_widget_showall (dlg);
3995 ^^^^^^^^^^^^^^^^^^
3996 gtk_widget_show_all
3997 @end smallexample
3998
3999 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4000 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4001 (e.g. vertical tab as ``\013'').
4002
4003 An empty replacement string indicates that the given range is to be removed.
4004 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4005 be inserted at the given position.
4006
4007 @item -fdiagnostics-generate-patch
4008 @opindex fdiagnostics-generate-patch
4009 Print fix-it hints to stderr in unified diff format, after any diagnostics
4010 are printed. For example:
4011
4012 @smallexample
4013 --- test.c
4014 +++ test.c
4015 @@ -42,5 +42,5 @@
4016
4017 void show_cb(GtkDialog *dlg)
4018 @{
4019 - gtk_widget_showall(dlg);
4020 + gtk_widget_show_all(dlg);
4021 @}
4022
4023 @end smallexample
4024
4025 The diff may or may not be colorized, following the same rules
4026 as for diagnostics (see @option{-fdiagnostics-color}).
4027
4028 @item -fdiagnostics-show-template-tree
4029 @opindex fdiagnostics-show-template-tree
4030
4031 In the C++ frontend, when printing diagnostics showing mismatching
4032 template types, such as:
4033
4034 @smallexample
4035 could not convert 'std::map<int, std::vector<double> >()'
4036 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4037 @end smallexample
4038
4039 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4040 tree-like structure showing the common and differing parts of the types,
4041 such as:
4042
4043 @smallexample
4044 map<
4045 [...],
4046 vector<
4047 [double != float]>>
4048 @end smallexample
4049
4050 The parts that differ are highlighted with color (``double'' and
4051 ``float'' in this case).
4052
4053 @item -fno-elide-type
4054 @opindex fno-elide-type
4055 @opindex felide-type
4056 By default when the C++ frontend prints diagnostics showing mismatching
4057 template types, common parts of the types are printed as ``[...]'' to
4058 simplify the error message. For example:
4059
4060 @smallexample
4061 could not convert 'std::map<int, std::vector<double> >()'
4062 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4063 @end smallexample
4064
4065 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4066 This flag also affects the output of the
4067 @option{-fdiagnostics-show-template-tree} flag.
4068
4069 @item -fno-show-column
4070 @opindex fno-show-column
4071 @opindex fshow-column
4072 Do not print column numbers in diagnostics. This may be necessary if
4073 diagnostics are being scanned by a program that does not understand the
4074 column numbers, such as @command{dejagnu}.
4075
4076 @item -fdiagnostics-format=@var{FORMAT}
4077 @opindex fdiagnostics-format
4078 Select a different format for printing diagnostics.
4079 @var{FORMAT} is @samp{text} or @samp{json}.
4080 The default is @samp{text}.
4081
4082 The @samp{json} format consists of a top-level JSON array containing JSON
4083 objects representing the diagnostics.
4084
4085 The JSON is emitted as one line, without formatting; the examples below
4086 have been formatted for clarity.
4087
4088 Diagnostics can have child diagnostics. For example, this error and note:
4089
4090 @smallexample
4091 misleading-indentation.c:15:3: warning: this 'if' clause does not
4092 guard... [-Wmisleading-indentation]
4093 15 | if (flag)
4094 | ^~
4095 misleading-indentation.c:17:5: note: ...this statement, but the latter
4096 is misleadingly indented as if it were guarded by the 'if'
4097 17 | y = 2;
4098 | ^
4099 @end smallexample
4100
4101 @noindent
4102 might be printed in JSON form (after formatting) like this:
4103
4104 @smallexample
4105 [
4106 @{
4107 "kind": "warning",
4108 "locations": [
4109 @{
4110 "caret": @{
4111 "column": 3,
4112 "file": "misleading-indentation.c",
4113 "line": 15
4114 @},
4115 "finish": @{
4116 "column": 4,
4117 "file": "misleading-indentation.c",
4118 "line": 15
4119 @}
4120 @}
4121 ],
4122 "message": "this \u2018if\u2019 clause does not guard...",
4123 "option": "-Wmisleading-indentation",
4124 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4125 "children": [
4126 @{
4127 "kind": "note",
4128 "locations": [
4129 @{
4130 "caret": @{
4131 "column": 5,
4132 "file": "misleading-indentation.c",
4133 "line": 17
4134 @}
4135 @}
4136 ],
4137 "message": "...this statement, but the latter is @dots{}"
4138 @}
4139 ]
4140 @},
4141 @dots{}
4142 ]
4143 @end smallexample
4144
4145 @noindent
4146 where the @code{note} is a child of the @code{warning}.
4147
4148 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4149 an @code{option} key describing the command-line option controlling the
4150 warning.
4151
4152 A diagnostic can contain zero or more locations. Each location has up
4153 to three positions within it: a @code{caret} position and optional
4154 @code{start} and @code{finish} positions. A location can also have
4155 an optional @code{label} string. For example, this error:
4156
4157 @smallexample
4158 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4159 'struct s'@} and 'T' @{aka 'struct t'@})
4160 64 | return callee_4a () + callee_4b ();
4161 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4162 | | |
4163 | | T @{aka struct t@}
4164 | S @{aka struct s@}
4165 @end smallexample
4166
4167 @noindent
4168 has three locations. Its primary location is at the ``+'' token at column
4169 23. It has two secondary locations, describing the left and right-hand sides
4170 of the expression, which have labels. It might be printed in JSON form as:
4171
4172 @smallexample
4173 @{
4174 "children": [],
4175 "kind": "error",
4176 "locations": [
4177 @{
4178 "caret": @{
4179 "column": 23, "file": "bad-binary-ops.c", "line": 64
4180 @}
4181 @},
4182 @{
4183 "caret": @{
4184 "column": 10, "file": "bad-binary-ops.c", "line": 64
4185 @},
4186 "finish": @{
4187 "column": 21, "file": "bad-binary-ops.c", "line": 64
4188 @},
4189 "label": "S @{aka struct s@}"
4190 @},
4191 @{
4192 "caret": @{
4193 "column": 25, "file": "bad-binary-ops.c", "line": 64
4194 @},
4195 "finish": @{
4196 "column": 36, "file": "bad-binary-ops.c", "line": 64
4197 @},
4198 "label": "T @{aka struct t@}"
4199 @}
4200 ],
4201 "message": "invalid operands to binary + @dots{}"
4202 @}
4203 @end smallexample
4204
4205 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4206 consisting of half-open intervals, similar to the output of
4207 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4208 with a replacement fix-it hint:
4209
4210 @smallexample
4211 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4212 mean 'color'?
4213 8 | return ptr->colour;
4214 | ^~~~~~
4215 | color
4216 @end smallexample
4217
4218 @noindent
4219 might be printed in JSON form as:
4220
4221 @smallexample
4222 @{
4223 "children": [],
4224 "fixits": [
4225 @{
4226 "next": @{
4227 "column": 21,
4228 "file": "demo.c",
4229 "line": 8
4230 @},
4231 "start": @{
4232 "column": 15,
4233 "file": "demo.c",
4234 "line": 8
4235 @},
4236 "string": "color"
4237 @}
4238 ],
4239 "kind": "error",
4240 "locations": [
4241 @{
4242 "caret": @{
4243 "column": 15,
4244 "file": "demo.c",
4245 "line": 8
4246 @},
4247 "finish": @{
4248 "column": 20,
4249 "file": "demo.c",
4250 "line": 8
4251 @}
4252 @}
4253 ],
4254 "message": "\u2018struct s\u2019 has no member named @dots{}"
4255 @}
4256 @end smallexample
4257
4258 @noindent
4259 where the fix-it hint suggests replacing the text from @code{start} up
4260 to but not including @code{next} with @code{string}'s value. Deletions
4261 are expressed via an empty value for @code{string}, insertions by
4262 having @code{start} equal @code{next}.
4263
4264 @end table
4265
4266 @node Warning Options
4267 @section Options to Request or Suppress Warnings
4268 @cindex options to control warnings
4269 @cindex warning messages
4270 @cindex messages, warning
4271 @cindex suppressing warnings
4272
4273 Warnings are diagnostic messages that report constructions that
4274 are not inherently erroneous but that are risky or suggest there
4275 may have been an error.
4276
4277 The following language-independent options do not enable specific
4278 warnings but control the kinds of diagnostics produced by GCC@.
4279
4280 @table @gcctabopt
4281 @cindex syntax checking
4282 @item -fsyntax-only
4283 @opindex fsyntax-only
4284 Check the code for syntax errors, but don't do anything beyond that.
4285
4286 @item -fmax-errors=@var{n}
4287 @opindex fmax-errors
4288 Limits the maximum number of error messages to @var{n}, at which point
4289 GCC bails out rather than attempting to continue processing the source
4290 code. If @var{n} is 0 (the default), there is no limit on the number
4291 of error messages produced. If @option{-Wfatal-errors} is also
4292 specified, then @option{-Wfatal-errors} takes precedence over this
4293 option.
4294
4295 @item -w
4296 @opindex w
4297 Inhibit all warning messages.
4298
4299 @item -Werror
4300 @opindex Werror
4301 @opindex Wno-error
4302 Make all warnings into errors.
4303
4304 @item -Werror=
4305 @opindex Werror=
4306 @opindex Wno-error=
4307 Make the specified warning into an error. The specifier for a warning
4308 is appended; for example @option{-Werror=switch} turns the warnings
4309 controlled by @option{-Wswitch} into errors. This switch takes a
4310 negative form, to be used to negate @option{-Werror} for specific
4311 warnings; for example @option{-Wno-error=switch} makes
4312 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4313 is in effect.
4314
4315 The warning message for each controllable warning includes the
4316 option that controls the warning. That option can then be used with
4317 @option{-Werror=} and @option{-Wno-error=} as described above.
4318 (Printing of the option in the warning message can be disabled using the
4319 @option{-fno-diagnostics-show-option} flag.)
4320
4321 Note that specifying @option{-Werror=}@var{foo} automatically implies
4322 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4323 imply anything.
4324
4325 @item -Wfatal-errors
4326 @opindex Wfatal-errors
4327 @opindex Wno-fatal-errors
4328 This option causes the compiler to abort compilation on the first error
4329 occurred rather than trying to keep going and printing further error
4330 messages.
4331
4332 @end table
4333
4334 You can request many specific warnings with options beginning with
4335 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4336 implicit declarations. Each of these specific warning options also
4337 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4338 example, @option{-Wno-implicit}. This manual lists only one of the
4339 two forms, whichever is not the default. For further
4340 language-specific options also refer to @ref{C++ Dialect Options} and
4341 @ref{Objective-C and Objective-C++ Dialect Options}.
4342
4343 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4344 options, such as @option{-Wunused}, which may turn on further options,
4345 such as @option{-Wunused-value}. The combined effect of positive and
4346 negative forms is that more specific options have priority over less
4347 specific ones, independently of their position in the command-line. For
4348 options of the same specificity, the last one takes effect. Options
4349 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4350 as if they appeared at the end of the command-line.
4351
4352 When an unrecognized warning option is requested (e.g.,
4353 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4354 that the option is not recognized. However, if the @option{-Wno-} form
4355 is used, the behavior is slightly different: no diagnostic is
4356 produced for @option{-Wno-unknown-warning} unless other diagnostics
4357 are being produced. This allows the use of new @option{-Wno-} options
4358 with old compilers, but if something goes wrong, the compiler
4359 warns that an unrecognized option is present.
4360
4361 @table @gcctabopt
4362 @item -Wpedantic
4363 @itemx -pedantic
4364 @opindex pedantic
4365 @opindex Wpedantic
4366 @opindex Wno-pedantic
4367 Issue all the warnings demanded by strict ISO C and ISO C++;
4368 reject all programs that use forbidden extensions, and some other
4369 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4370 version of the ISO C standard specified by any @option{-std} option used.
4371
4372 Valid ISO C and ISO C++ programs should compile properly with or without
4373 this option (though a rare few require @option{-ansi} or a
4374 @option{-std} option specifying the required version of ISO C)@. However,
4375 without this option, certain GNU extensions and traditional C and C++
4376 features are supported as well. With this option, they are rejected.
4377
4378 @option{-Wpedantic} does not cause warning messages for use of the
4379 alternate keywords whose names begin and end with @samp{__}. This alternate
4380 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4381 i.e. @samp{__intN__}.
4382 Pedantic warnings are also disabled in the expression that follows
4383 @code{__extension__}. However, only system header files should use
4384 these escape routes; application programs should avoid them.
4385 @xref{Alternate Keywords}.
4386
4387 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4388 C conformance. They soon find that it does not do quite what they want:
4389 it finds some non-ISO practices, but not all---only those for which
4390 ISO C @emph{requires} a diagnostic, and some others for which
4391 diagnostics have been added.
4392
4393 A feature to report any failure to conform to ISO C might be useful in
4394 some instances, but would require considerable additional work and would
4395 be quite different from @option{-Wpedantic}. We don't have plans to
4396 support such a feature in the near future.
4397
4398 Where the standard specified with @option{-std} represents a GNU
4399 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4400 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4401 extended dialect is based. Warnings from @option{-Wpedantic} are given
4402 where they are required by the base standard. (It does not make sense
4403 for such warnings to be given only for features not in the specified GNU
4404 C dialect, since by definition the GNU dialects of C include all
4405 features the compiler supports with the given option, and there would be
4406 nothing to warn about.)
4407
4408 @item -pedantic-errors
4409 @opindex pedantic-errors
4410 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4411 requires a diagnostic, in some cases where there is undefined behavior
4412 at compile-time and in some other cases that do not prevent compilation
4413 of programs that are valid according to the standard. This is not
4414 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4415 by this option and not enabled by the latter and vice versa.
4416
4417 @item -Wall
4418 @opindex Wall
4419 @opindex Wno-all
4420 This enables all the warnings about constructions that some users
4421 consider questionable, and that are easy to avoid (or modify to
4422 prevent the warning), even in conjunction with macros. This also
4423 enables some language-specific warnings described in @ref{C++ Dialect
4424 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4425
4426 @option{-Wall} turns on the following warning flags:
4427
4428 @gccoptlist{-Waddress @gol
4429 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4430 -Wbool-compare @gol
4431 -Wbool-operation @gol
4432 -Wc++11-compat -Wc++14-compat @gol
4433 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4434 -Wchar-subscripts @gol
4435 -Wcomment @gol
4436 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4437 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4438 -Wenum-conversion @r{in C/ObjC;} @gol
4439 -Wformat @gol
4440 -Wint-in-bool-context @gol
4441 -Wimplicit @r{(C and Objective-C only)} @gol
4442 -Wimplicit-int @r{(C and Objective-C only)} @gol
4443 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4444 -Winit-self @r{(only for C++)} @gol
4445 -Wzero-length-bounds @gol
4446 -Wlogical-not-parentheses @gol
4447 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4448 -Wmaybe-uninitialized @gol
4449 -Wmemset-elt-size @gol
4450 -Wmemset-transposed-args @gol
4451 -Wmisleading-indentation @r{(only for C/C++)} @gol
4452 -Wmissing-attributes @gol
4453 -Wmissing-braces @r{(only for C/ObjC)} @gol
4454 -Wmultistatement-macros @gol
4455 -Wnarrowing @r{(only for C++)} @gol
4456 -Wnonnull @gol
4457 -Wnonnull-compare @gol
4458 -Wopenmp-simd @gol
4459 -Wparentheses @gol
4460 -Wpessimizing-move @r{(only for C++)} @gol
4461 -Wpointer-sign @gol
4462 -Wreorder @gol
4463 -Wrestrict @gol
4464 -Wreturn-type @gol
4465 -Wsequence-point @gol
4466 -Wsign-compare @r{(only in C++)} @gol
4467 -Wsizeof-pointer-div @gol
4468 -Wsizeof-pointer-memaccess @gol
4469 -Wstrict-aliasing @gol
4470 -Wstrict-overflow=1 @gol
4471 -Wswitch @gol
4472 -Wtautological-compare @gol
4473 -Wtrigraphs @gol
4474 -Wuninitialized @gol
4475 -Wunknown-pragmas @gol
4476 -Wunused-function @gol
4477 -Wunused-label @gol
4478 -Wunused-value @gol
4479 -Wunused-variable @gol
4480 -Wvolatile-register-var}
4481
4482 Note that some warning flags are not implied by @option{-Wall}. Some of
4483 them warn about constructions that users generally do not consider
4484 questionable, but which occasionally you might wish to check for;
4485 others warn about constructions that are necessary or hard to avoid in
4486 some cases, and there is no simple way to modify the code to suppress
4487 the warning. Some of them are enabled by @option{-Wextra} but many of
4488 them must be enabled individually.
4489
4490 @item -Wextra
4491 @opindex W
4492 @opindex Wextra
4493 @opindex Wno-extra
4494 This enables some extra warning flags that are not enabled by
4495 @option{-Wall}. (This option used to be called @option{-W}. The older
4496 name is still supported, but the newer name is more descriptive.)
4497
4498 @gccoptlist{-Wclobbered @gol
4499 -Wcast-function-type @gol
4500 -Wdeprecated-copy @r{(C++ only)} @gol
4501 -Wempty-body @gol
4502 -Wignored-qualifiers @gol
4503 -Wimplicit-fallthrough=3 @gol
4504 -Wmissing-field-initializers @gol
4505 -Wmissing-parameter-type @r{(C only)} @gol
4506 -Wold-style-declaration @r{(C only)} @gol
4507 -Woverride-init @gol
4508 -Wsign-compare @r{(C only)} @gol
4509 -Wstring-compare @gol
4510 -Wredundant-move @r{(only for C++)} @gol
4511 -Wtype-limits @gol
4512 -Wuninitialized @gol
4513 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4514 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4515 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4516
4517
4518 The option @option{-Wextra} also prints warning messages for the
4519 following cases:
4520
4521 @itemize @bullet
4522
4523 @item
4524 A pointer is compared against integer zero with @code{<}, @code{<=},
4525 @code{>}, or @code{>=}.
4526
4527 @item
4528 (C++ only) An enumerator and a non-enumerator both appear in a
4529 conditional expression.
4530
4531 @item
4532 (C++ only) Ambiguous virtual bases.
4533
4534 @item
4535 (C++ only) Subscripting an array that has been declared @code{register}.
4536
4537 @item
4538 (C++ only) Taking the address of a variable that has been declared
4539 @code{register}.
4540
4541 @item
4542 (C++ only) A base class is not initialized in the copy constructor
4543 of a derived class.
4544
4545 @end itemize
4546
4547 @item -Wchar-subscripts
4548 @opindex Wchar-subscripts
4549 @opindex Wno-char-subscripts
4550 Warn if an array subscript has type @code{char}. This is a common cause
4551 of error, as programmers often forget that this type is signed on some
4552 machines.
4553 This warning is enabled by @option{-Wall}.
4554
4555 @item -Wno-coverage-mismatch
4556 @opindex Wno-coverage-mismatch
4557 @opindex Wcoverage-mismatch
4558 Warn if feedback profiles do not match when using the
4559 @option{-fprofile-use} option.
4560 If a source file is changed between compiling with @option{-fprofile-generate}
4561 and with @option{-fprofile-use}, the files with the profile feedback can fail
4562 to match the source file and GCC cannot use the profile feedback
4563 information. By default, this warning is enabled and is treated as an
4564 error. @option{-Wno-coverage-mismatch} can be used to disable the
4565 warning or @option{-Wno-error=coverage-mismatch} can be used to
4566 disable the error. Disabling the error for this warning can result in
4567 poorly optimized code and is useful only in the
4568 case of very minor changes such as bug fixes to an existing code-base.
4569 Completely disabling the warning is not recommended.
4570
4571 @item -Wno-cpp
4572 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4573
4574 Suppress warning messages emitted by @code{#warning} directives.
4575
4576 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4577 @opindex Wdouble-promotion
4578 @opindex Wno-double-promotion
4579 Give a warning when a value of type @code{float} is implicitly
4580 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4581 floating-point unit implement @code{float} in hardware, but emulate
4582 @code{double} in software. On such a machine, doing computations
4583 using @code{double} values is much more expensive because of the
4584 overhead required for software emulation.
4585
4586 It is easy to accidentally do computations with @code{double} because
4587 floating-point literals are implicitly of type @code{double}. For
4588 example, in:
4589 @smallexample
4590 @group
4591 float area(float radius)
4592 @{
4593 return 3.14159 * radius * radius;
4594 @}
4595 @end group
4596 @end smallexample
4597 the compiler performs the entire computation with @code{double}
4598 because the floating-point literal is a @code{double}.
4599
4600 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4601 @opindex Wduplicate-decl-specifier
4602 @opindex Wno-duplicate-decl-specifier
4603 Warn if a declaration has duplicate @code{const}, @code{volatile},
4604 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4605 @option{-Wall}.
4606
4607 @item -Wformat
4608 @itemx -Wformat=@var{n}
4609 @opindex Wformat
4610 @opindex Wno-format
4611 @opindex ffreestanding
4612 @opindex fno-builtin
4613 @opindex Wformat=
4614 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4615 the arguments supplied have types appropriate to the format string
4616 specified, and that the conversions specified in the format string make
4617 sense. This includes standard functions, and others specified by format
4618 attributes (@pxref{Function Attributes}), in the @code{printf},
4619 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4620 not in the C standard) families (or other target-specific families).
4621 Which functions are checked without format attributes having been
4622 specified depends on the standard version selected, and such checks of
4623 functions without the attribute specified are disabled by
4624 @option{-ffreestanding} or @option{-fno-builtin}.
4625
4626 The formats are checked against the format features supported by GNU
4627 libc version 2.2. These include all ISO C90 and C99 features, as well
4628 as features from the Single Unix Specification and some BSD and GNU
4629 extensions. Other library implementations may not support all these
4630 features; GCC does not support warning about features that go beyond a
4631 particular library's limitations. However, if @option{-Wpedantic} is used
4632 with @option{-Wformat}, warnings are given about format features not
4633 in the selected standard version (but not for @code{strfmon} formats,
4634 since those are not in any version of the C standard). @xref{C Dialect
4635 Options,,Options Controlling C Dialect}.
4636
4637 @table @gcctabopt
4638 @item -Wformat=1
4639 @itemx -Wformat
4640 @opindex Wformat
4641 @opindex Wformat=1
4642 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4643 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4644 @option{-Wformat} also checks for null format arguments for several
4645 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4646 aspects of this level of format checking can be disabled by the
4647 options: @option{-Wno-format-contains-nul},
4648 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4649 @option{-Wformat} is enabled by @option{-Wall}.
4650
4651 @item -Wno-format-contains-nul
4652 @opindex Wno-format-contains-nul
4653 @opindex Wformat-contains-nul
4654 If @option{-Wformat} is specified, do not warn about format strings that
4655 contain NUL bytes.
4656
4657 @item -Wno-format-extra-args
4658 @opindex Wno-format-extra-args
4659 @opindex Wformat-extra-args
4660 If @option{-Wformat} is specified, do not warn about excess arguments to a
4661 @code{printf} or @code{scanf} format function. The C standard specifies
4662 that such arguments are ignored.
4663
4664 Where the unused arguments lie between used arguments that are
4665 specified with @samp{$} operand number specifications, normally
4666 warnings are still given, since the implementation could not know what
4667 type to pass to @code{va_arg} to skip the unused arguments. However,
4668 in the case of @code{scanf} formats, this option suppresses the
4669 warning if the unused arguments are all pointers, since the Single
4670 Unix Specification says that such unused arguments are allowed.
4671
4672 @item -Wformat-overflow
4673 @itemx -Wformat-overflow=@var{level}
4674 @opindex Wformat-overflow
4675 @opindex Wno-format-overflow
4676 Warn about calls to formatted input/output functions such as @code{sprintf}
4677 and @code{vsprintf} that might overflow the destination buffer. When the
4678 exact number of bytes written by a format directive cannot be determined
4679 at compile-time it is estimated based on heuristics that depend on the
4680 @var{level} argument and on optimization. While enabling optimization
4681 will in most cases improve the accuracy of the warning, it may also
4682 result in false positives.
4683
4684 @table @gcctabopt
4685 @item -Wformat-overflow
4686 @itemx -Wformat-overflow=1
4687 @opindex Wformat-overflow
4688 @opindex Wno-format-overflow
4689 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4690 employs a conservative approach that warns only about calls that most
4691 likely overflow the buffer. At this level, numeric arguments to format
4692 directives with unknown values are assumed to have the value of one, and
4693 strings of unknown length to be empty. Numeric arguments that are known
4694 to be bounded to a subrange of their type, or string arguments whose output
4695 is bounded either by their directive's precision or by a finite set of
4696 string literals, are assumed to take on the value within the range that
4697 results in the most bytes on output. For example, the call to @code{sprintf}
4698 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4699 the terminating NUL character (@code{'\0'}) appended by the function
4700 to the destination buffer will be written past its end. Increasing
4701 the size of the buffer by a single byte is sufficient to avoid the
4702 warning, though it may not be sufficient to avoid the overflow.
4703
4704 @smallexample
4705 void f (int a, int b)
4706 @{
4707 char buf [13];
4708 sprintf (buf, "a = %i, b = %i\n", a, b);
4709 @}
4710 @end smallexample
4711
4712 @item -Wformat-overflow=2
4713 Level @var{2} warns also about calls that might overflow the destination
4714 buffer given an argument of sufficient length or magnitude. At level
4715 @var{2}, unknown numeric arguments are assumed to have the minimum
4716 representable value for signed types with a precision greater than 1, and
4717 the maximum representable value otherwise. Unknown string arguments whose
4718 length cannot be assumed to be bounded either by the directive's precision,
4719 or by a finite set of string literals they may evaluate to, or the character
4720 array they may point to, are assumed to be 1 character long.
4721
4722 At level @var{2}, the call in the example above is again diagnosed, but
4723 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4724 @code{%i} directive will write some of its digits beyond the end of
4725 the destination buffer. To make the call safe regardless of the values
4726 of the two variables, the size of the destination buffer must be increased
4727 to at least 34 bytes. GCC includes the minimum size of the buffer in
4728 an informational note following the warning.
4729
4730 An alternative to increasing the size of the destination buffer is to
4731 constrain the range of formatted values. The maximum length of string
4732 arguments can be bounded by specifying the precision in the format
4733 directive. When numeric arguments of format directives can be assumed
4734 to be bounded by less than the precision of their type, choosing
4735 an appropriate length modifier to the format specifier will reduce
4736 the required buffer size. For example, if @var{a} and @var{b} in the
4737 example above can be assumed to be within the precision of
4738 the @code{short int} type then using either the @code{%hi} format
4739 directive or casting the argument to @code{short} reduces the maximum
4740 required size of the buffer to 24 bytes.
4741
4742 @smallexample
4743 void f (int a, int b)
4744 @{
4745 char buf [23];
4746 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4747 @}
4748 @end smallexample
4749 @end table
4750
4751 @item -Wno-format-zero-length
4752 @opindex Wno-format-zero-length
4753 @opindex Wformat-zero-length
4754 If @option{-Wformat} is specified, do not warn about zero-length formats.
4755 The C standard specifies that zero-length formats are allowed.
4756
4757
4758 @item -Wformat=2
4759 @opindex Wformat=2
4760 Enable @option{-Wformat} plus additional format checks. Currently
4761 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4762 -Wformat-y2k}.
4763
4764 @item -Wformat-nonliteral
4765 @opindex Wformat-nonliteral
4766 @opindex Wno-format-nonliteral
4767 If @option{-Wformat} is specified, also warn if the format string is not a
4768 string literal and so cannot be checked, unless the format function
4769 takes its format arguments as a @code{va_list}.
4770
4771 @item -Wformat-security
4772 @opindex Wformat-security
4773 @opindex Wno-format-security
4774 If @option{-Wformat} is specified, also warn about uses of format
4775 functions that represent possible security problems. At present, this
4776 warns about calls to @code{printf} and @code{scanf} functions where the
4777 format string is not a string literal and there are no format arguments,
4778 as in @code{printf (foo);}. This may be a security hole if the format
4779 string came from untrusted input and contains @samp{%n}. (This is
4780 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4781 in future warnings may be added to @option{-Wformat-security} that are not
4782 included in @option{-Wformat-nonliteral}.)
4783
4784 @item -Wformat-signedness
4785 @opindex Wformat-signedness
4786 @opindex Wno-format-signedness
4787 If @option{-Wformat} is specified, also warn if the format string
4788 requires an unsigned argument and the argument is signed and vice versa.
4789
4790 @item -Wformat-truncation
4791 @itemx -Wformat-truncation=@var{level}
4792 @opindex Wformat-truncation
4793 @opindex Wno-format-truncation
4794 Warn about calls to formatted input/output functions such as @code{snprintf}
4795 and @code{vsnprintf} that might result in output truncation. When the exact
4796 number of bytes written by a format directive cannot be determined at
4797 compile-time it is estimated based on heuristics that depend on
4798 the @var{level} argument and on optimization. While enabling optimization
4799 will in most cases improve the accuracy of the warning, it may also result
4800 in false positives. Except as noted otherwise, the option uses the same
4801 logic @option{-Wformat-overflow}.
4802
4803 @table @gcctabopt
4804 @item -Wformat-truncation
4805 @itemx -Wformat-truncation=1
4806 @opindex Wformat-truncation
4807 @opindex Wno-format-truncation
4808 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4809 employs a conservative approach that warns only about calls to bounded
4810 functions whose return value is unused and that will most likely result
4811 in output truncation.
4812
4813 @item -Wformat-truncation=2
4814 Level @var{2} warns also about calls to bounded functions whose return
4815 value is used and that might result in truncation given an argument of
4816 sufficient length or magnitude.
4817 @end table
4818
4819 @item -Wformat-y2k
4820 @opindex Wformat-y2k
4821 @opindex Wno-format-y2k
4822 If @option{-Wformat} is specified, also warn about @code{strftime}
4823 formats that may yield only a two-digit year.
4824 @end table
4825
4826 @item -Wnonnull
4827 @opindex Wnonnull
4828 @opindex Wno-nonnull
4829 Warn about passing a null pointer for arguments marked as
4830 requiring a non-null value by the @code{nonnull} function attribute.
4831
4832 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4833 can be disabled with the @option{-Wno-nonnull} option.
4834
4835 @item -Wnonnull-compare
4836 @opindex Wnonnull-compare
4837 @opindex Wno-nonnull-compare
4838 Warn when comparing an argument marked with the @code{nonnull}
4839 function attribute against null inside the function.
4840
4841 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4842 can be disabled with the @option{-Wno-nonnull-compare} option.
4843
4844 @item -Wnull-dereference
4845 @opindex Wnull-dereference
4846 @opindex Wno-null-dereference
4847 Warn if the compiler detects paths that trigger erroneous or
4848 undefined behavior due to dereferencing a null pointer. This option
4849 is only active when @option{-fdelete-null-pointer-checks} is active,
4850 which is enabled by optimizations in most targets. The precision of
4851 the warnings depends on the optimization options used.
4852
4853 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4854 @opindex Winaccessible-base
4855 @opindex Wno-inaccessible-base
4856 Warn when a base class is inaccessible in a class derived from it due to
4857 ambiguity. The warning is enabled by default. Note the warning for virtual
4858 bases is enabled by the @option{-Wextra} option.
4859 @smallexample
4860 @group
4861 struct A @{ int a; @};
4862
4863 struct B : A @{ @};
4864
4865 struct C : B, A @{ @};
4866 @end group
4867 @end smallexample
4868
4869 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4870 @opindex Winit-self
4871 @opindex Wno-init-self
4872 Warn about uninitialized variables that are initialized with themselves.
4873 Note this option can only be used with the @option{-Wuninitialized} option.
4874
4875 For example, GCC warns about @code{i} being uninitialized in the
4876 following snippet only when @option{-Winit-self} has been specified:
4877 @smallexample
4878 @group
4879 int f()
4880 @{
4881 int i = i;
4882 return i;
4883 @}
4884 @end group
4885 @end smallexample
4886
4887 This warning is enabled by @option{-Wall} in C++.
4888
4889 @item -Wimplicit-int @r{(C and Objective-C only)}
4890 @opindex Wimplicit-int
4891 @opindex Wno-implicit-int
4892 Warn when a declaration does not specify a type.
4893 This warning is enabled by @option{-Wall}.
4894
4895 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4896 @opindex Wimplicit-function-declaration
4897 @opindex Wno-implicit-function-declaration
4898 Give a warning whenever a function is used before being declared. In
4899 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4900 enabled by default and it is made into an error by
4901 @option{-pedantic-errors}. This warning is also enabled by
4902 @option{-Wall}.
4903
4904 @item -Wimplicit @r{(C and Objective-C only)}
4905 @opindex Wimplicit
4906 @opindex Wno-implicit
4907 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4908 This warning is enabled by @option{-Wall}.
4909
4910 @item -Wimplicit-fallthrough
4911 @opindex Wimplicit-fallthrough
4912 @opindex Wno-implicit-fallthrough
4913 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4914 and @option{-Wno-implicit-fallthrough} is the same as
4915 @option{-Wimplicit-fallthrough=0}.
4916
4917 @item -Wimplicit-fallthrough=@var{n}
4918 @opindex Wimplicit-fallthrough=
4919 Warn when a switch case falls through. For example:
4920
4921 @smallexample
4922 @group
4923 switch (cond)
4924 @{
4925 case 1:
4926 a = 1;
4927 break;
4928 case 2:
4929 a = 2;
4930 case 3:
4931 a = 3;
4932 break;
4933 @}
4934 @end group
4935 @end smallexample
4936
4937 This warning does not warn when the last statement of a case cannot
4938 fall through, e.g. when there is a return statement or a call to function
4939 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4940 also takes into account control flow statements, such as ifs, and only
4941 warns when appropriate. E.g.@:
4942
4943 @smallexample
4944 @group
4945 switch (cond)
4946 @{
4947 case 1:
4948 if (i > 3) @{
4949 bar (5);
4950 break;
4951 @} else if (i < 1) @{
4952 bar (0);
4953 @} else
4954 return;
4955 default:
4956 @dots{}
4957 @}
4958 @end group
4959 @end smallexample
4960
4961 Since there are occasions where a switch case fall through is desirable,
4962 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4963 to be used along with a null statement to suppress this warning that
4964 would normally occur:
4965
4966 @smallexample
4967 @group
4968 switch (cond)
4969 @{
4970 case 1:
4971 bar (0);
4972 __attribute__ ((fallthrough));
4973 default:
4974 @dots{}
4975 @}
4976 @end group
4977 @end smallexample
4978
4979 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4980 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4981 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4982 Instead of these attributes, it is also possible to add a fallthrough comment
4983 to silence the warning. The whole body of the C or C++ style comment should
4984 match the given regular expressions listed below. The option argument @var{n}
4985 specifies what kind of comments are accepted:
4986
4987 @itemize @bullet
4988
4989 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4990
4991 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4992 expression, any comment is used as fallthrough comment.
4993
4994 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4995 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4996
4997 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4998 following regular expressions:
4999
5000 @itemize @bullet
5001
5002 @item @code{-fallthrough}
5003
5004 @item @code{@@fallthrough@@}
5005
5006 @item @code{lint -fallthrough[ \t]*}
5007
5008 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5009
5010 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5011
5012 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5013
5014 @end itemize
5015
5016 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5017 following regular expressions:
5018
5019 @itemize @bullet
5020
5021 @item @code{-fallthrough}
5022
5023 @item @code{@@fallthrough@@}
5024
5025 @item @code{lint -fallthrough[ \t]*}
5026
5027 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5028
5029 @end itemize
5030
5031 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5032 fallthrough comments, only attributes disable the warning.
5033
5034 @end itemize
5035
5036 The comment needs to be followed after optional whitespace and other comments
5037 by @code{case} or @code{default} keywords or by a user label that precedes some
5038 @code{case} or @code{default} label.
5039
5040 @smallexample
5041 @group
5042 switch (cond)
5043 @{
5044 case 1:
5045 bar (0);
5046 /* FALLTHRU */
5047 default:
5048 @dots{}
5049 @}
5050 @end group
5051 @end smallexample
5052
5053 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5054
5055 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5056 @opindex Wif-not-aligned
5057 @opindex Wno-if-not-aligned
5058 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5059 should be issued. This is enabled by default.
5060 Use @option{-Wno-if-not-aligned} to disable it.
5061
5062 @item -Wignored-qualifiers @r{(C and C++ only)}
5063 @opindex Wignored-qualifiers
5064 @opindex Wno-ignored-qualifiers
5065 Warn if the return type of a function has a type qualifier
5066 such as @code{const}. For ISO C such a type qualifier has no effect,
5067 since the value returned by a function is not an lvalue.
5068 For C++, the warning is only emitted for scalar types or @code{void}.
5069 ISO C prohibits qualified @code{void} return types on function
5070 definitions, so such return types always receive a warning
5071 even without this option.
5072
5073 This warning is also enabled by @option{-Wextra}.
5074
5075 @item -Wignored-attributes @r{(C and C++ only)}
5076 @opindex Wignored-attributes
5077 @opindex Wno-ignored-attributes
5078 Warn when an attribute is ignored. This is different from the
5079 @option{-Wattributes} option in that it warns whenever the compiler decides
5080 to drop an attribute, not that the attribute is either unknown, used in a
5081 wrong place, etc. This warning is enabled by default.
5082
5083 @item -Wmain
5084 @opindex Wmain
5085 @opindex Wno-main
5086 Warn if the type of @code{main} is suspicious. @code{main} should be
5087 a function with external linkage, returning int, taking either zero
5088 arguments, two, or three arguments of appropriate types. This warning
5089 is enabled by default in C++ and is enabled by either @option{-Wall}
5090 or @option{-Wpedantic}.
5091
5092 @item -Wmisleading-indentation @r{(C and C++ only)}
5093 @opindex Wmisleading-indentation
5094 @opindex Wno-misleading-indentation
5095 Warn when the indentation of the code does not reflect the block structure.
5096 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5097 @code{for} clauses with a guarded statement that does not use braces,
5098 followed by an unguarded statement with the same indentation.
5099
5100 In the following example, the call to ``bar'' is misleadingly indented as
5101 if it were guarded by the ``if'' conditional.
5102
5103 @smallexample
5104 if (some_condition ())
5105 foo ();
5106 bar (); /* Gotcha: this is not guarded by the "if". */
5107 @end smallexample
5108
5109 In the case of mixed tabs and spaces, the warning uses the
5110 @option{-ftabstop=} option to determine if the statements line up
5111 (defaulting to 8).
5112
5113 The warning is not issued for code involving multiline preprocessor logic
5114 such as the following example.
5115
5116 @smallexample
5117 if (flagA)
5118 foo (0);
5119 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5120 if (flagB)
5121 #endif
5122 foo (1);
5123 @end smallexample
5124
5125 The warning is not issued after a @code{#line} directive, since this
5126 typically indicates autogenerated code, and no assumptions can be made
5127 about the layout of the file that the directive references.
5128
5129 This warning is enabled by @option{-Wall} in C and C++.
5130
5131 @item -Wmissing-attributes
5132 @opindex Wmissing-attributes
5133 @opindex Wno-missing-attributes
5134 Warn when a declaration of a function is missing one or more attributes
5135 that a related function is declared with and whose absence may adversely
5136 affect the correctness or efficiency of generated code. For example,
5137 the warning is issued for declarations of aliases that use attributes
5138 to specify less restrictive requirements than those of their targets.
5139 This typically represents a potential optimization opportunity.
5140 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5141 issued when the alias is more restrictive than the target, which could
5142 lead to incorrect code generation.
5143 Attributes considered include @code{alloc_align}, @code{alloc_size},
5144 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5145 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5146 @code{returns_nonnull}, and @code{returns_twice}.
5147
5148 In C++, the warning is issued when an explicit specialization of a primary
5149 template declared with attribute @code{alloc_align}, @code{alloc_size},
5150 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5151 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5152 @code{error}, and @code{warning} suppress the warning.
5153 (@pxref{Function Attributes}).
5154
5155 You can use the @code{copy} attribute to apply the same
5156 set of attributes to a declaration as that on another declaration without
5157 explicitly enumerating the attributes. This attribute can be applied
5158 to declarations of functions (@pxref{Common Function Attributes}),
5159 variables (@pxref{Common Variable Attributes}), or types
5160 (@pxref{Common Type Attributes}).
5161
5162 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5163
5164 For example, since the declaration of the primary function template
5165 below makes use of both attribute @code{malloc} and @code{alloc_size}
5166 the declaration of the explicit specialization of the template is
5167 diagnosed because it is missing one of the attributes.
5168
5169 @smallexample
5170 template <class T>
5171 T* __attribute__ ((malloc, alloc_size (1)))
5172 allocate (size_t);
5173
5174 template <>
5175 void* __attribute__ ((malloc)) // missing alloc_size
5176 allocate<void> (size_t);
5177 @end smallexample
5178
5179 @item -Wmissing-braces
5180 @opindex Wmissing-braces
5181 @opindex Wno-missing-braces
5182 Warn if an aggregate or union initializer is not fully bracketed. In
5183 the following example, the initializer for @code{a} is not fully
5184 bracketed, but that for @code{b} is fully bracketed. This warning is
5185 enabled by @option{-Wall} in C.
5186
5187 @smallexample
5188 int a[2][2] = @{ 0, 1, 2, 3 @};
5189 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5190 @end smallexample
5191
5192 This warning is enabled by @option{-Wall}.
5193
5194 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5195 @opindex Wmissing-include-dirs
5196 @opindex Wno-missing-include-dirs
5197 Warn if a user-supplied include directory does not exist.
5198
5199 @item -Wmissing-profile
5200 @opindex Wmissing-profile
5201 @opindex Wno-missing-profile
5202 Warn if feedback profiles are missing when using the
5203 @option{-fprofile-use} option.
5204 This option diagnoses those cases where a new function or a new file is added
5205 to the user code between compiling with @option{-fprofile-generate} and with
5206 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5207 profile feedback data files do not contain any profile feedback information for
5208 the newly added function or file respectively. Also, in the case when profile
5209 count data (.gcda) files are removed, GCC cannot use any profile feedback
5210 information. In all these cases, warnings are issued to inform the user that a
5211 profile generation step is due. @option{-Wno-missing-profile} can be used to
5212 disable the warning. Ignoring the warning can result in poorly optimized code.
5213 Completely disabling the warning is not recommended and should be done only
5214 when non-existent profile data is justified.
5215
5216 @item -Wmultistatement-macros
5217 @opindex Wmultistatement-macros
5218 @opindex Wno-multistatement-macros
5219 Warn about unsafe multiple statement macros that appear to be guarded
5220 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5221 @code{while}, in which only the first statement is actually guarded after
5222 the macro is expanded.
5223
5224 For example:
5225
5226 @smallexample
5227 #define DOIT x++; y++
5228 if (c)
5229 DOIT;
5230 @end smallexample
5231
5232 will increment @code{y} unconditionally, not just when @code{c} holds.
5233 The can usually be fixed by wrapping the macro in a do-while loop:
5234 @smallexample
5235 #define DOIT do @{ x++; y++; @} while (0)
5236 if (c)
5237 DOIT;
5238 @end smallexample
5239
5240 This warning is enabled by @option{-Wall} in C and C++.
5241
5242 @item -Wparentheses
5243 @opindex Wparentheses
5244 @opindex Wno-parentheses
5245 Warn if parentheses are omitted in certain contexts, such
5246 as when there is an assignment in a context where a truth value
5247 is expected, or when operators are nested whose precedence people
5248 often get confused about.
5249
5250 Also warn if a comparison like @code{x<=y<=z} appears; this is
5251 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5252 interpretation from that of ordinary mathematical notation.
5253
5254 Also warn for dangerous uses of the GNU extension to
5255 @code{?:} with omitted middle operand. When the condition
5256 in the @code{?}: operator is a boolean expression, the omitted value is
5257 always 1. Often programmers expect it to be a value computed
5258 inside the conditional expression instead.
5259
5260 For C++ this also warns for some cases of unnecessary parentheses in
5261 declarations, which can indicate an attempt at a function call instead
5262 of a declaration:
5263 @smallexample
5264 @{
5265 // Declares a local variable called mymutex.
5266 std::unique_lock<std::mutex> (mymutex);
5267 // User meant std::unique_lock<std::mutex> lock (mymutex);
5268 @}
5269 @end smallexample
5270
5271 This warning is enabled by @option{-Wall}.
5272
5273 @item -Wsequence-point
5274 @opindex Wsequence-point
5275 @opindex Wno-sequence-point
5276 Warn about code that may have undefined semantics because of violations
5277 of sequence point rules in the C and C++ standards.
5278
5279 The C and C++ standards define the order in which expressions in a C/C++
5280 program are evaluated in terms of @dfn{sequence points}, which represent
5281 a partial ordering between the execution of parts of the program: those
5282 executed before the sequence point, and those executed after it. These
5283 occur after the evaluation of a full expression (one which is not part
5284 of a larger expression), after the evaluation of the first operand of a
5285 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5286 function is called (but after the evaluation of its arguments and the
5287 expression denoting the called function), and in certain other places.
5288 Other than as expressed by the sequence point rules, the order of
5289 evaluation of subexpressions of an expression is not specified. All
5290 these rules describe only a partial order rather than a total order,
5291 since, for example, if two functions are called within one expression
5292 with no sequence point between them, the order in which the functions
5293 are called is not specified. However, the standards committee have
5294 ruled that function calls do not overlap.
5295
5296 It is not specified when between sequence points modifications to the
5297 values of objects take effect. Programs whose behavior depends on this
5298 have undefined behavior; the C and C++ standards specify that ``Between
5299 the previous and next sequence point an object shall have its stored
5300 value modified at most once by the evaluation of an expression.
5301 Furthermore, the prior value shall be read only to determine the value
5302 to be stored.''. If a program breaks these rules, the results on any
5303 particular implementation are entirely unpredictable.
5304
5305 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5306 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5307 diagnosed by this option, and it may give an occasional false positive
5308 result, but in general it has been found fairly effective at detecting
5309 this sort of problem in programs.
5310
5311 The C++17 standard will define the order of evaluation of operands in
5312 more cases: in particular it requires that the right-hand side of an
5313 assignment be evaluated before the left-hand side, so the above
5314 examples are no longer undefined. But this warning will still warn
5315 about them, to help people avoid writing code that is undefined in C
5316 and earlier revisions of C++.
5317
5318 The standard is worded confusingly, therefore there is some debate
5319 over the precise meaning of the sequence point rules in subtle cases.
5320 Links to discussions of the problem, including proposed formal
5321 definitions, may be found on the GCC readings page, at
5322 @uref{http://gcc.gnu.org/@/readings.html}.
5323
5324 This warning is enabled by @option{-Wall} for C and C++.
5325
5326 @item -Wno-return-local-addr
5327 @opindex Wno-return-local-addr
5328 @opindex Wreturn-local-addr
5329 Do not warn about returning a pointer (or in C++, a reference) to a
5330 variable that goes out of scope after the function returns.
5331
5332 @item -Wreturn-type
5333 @opindex Wreturn-type
5334 @opindex Wno-return-type
5335 Warn whenever a function is defined with a return type that defaults
5336 to @code{int}. Also warn about any @code{return} statement with no
5337 return value in a function whose return type is not @code{void}
5338 (falling off the end of the function body is considered returning
5339 without a value).
5340
5341 For C only, warn about a @code{return} statement with an expression in a
5342 function whose return type is @code{void}, unless the expression type is
5343 also @code{void}. As a GNU extension, the latter case is accepted
5344 without a warning unless @option{-Wpedantic} is used. Attempting
5345 to use the return value of a non-@code{void} function other than @code{main}
5346 that flows off the end by reaching the closing curly brace that terminates
5347 the function is undefined.
5348
5349 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5350 than @code{main} results in undefined behavior even when the value of
5351 the function is not used.
5352
5353 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5354
5355 @item -Wshift-count-negative
5356 @opindex Wshift-count-negative
5357 @opindex Wno-shift-count-negative
5358 Warn if shift count is negative. This warning is enabled by default.
5359
5360 @item -Wshift-count-overflow
5361 @opindex Wshift-count-overflow
5362 @opindex Wno-shift-count-overflow
5363 Warn if shift count >= width of type. This warning is enabled by default.
5364
5365 @item -Wshift-negative-value
5366 @opindex Wshift-negative-value
5367 @opindex Wno-shift-negative-value
5368 Warn if left shifting a negative value. This warning is enabled by
5369 @option{-Wextra} in C99 and C++11 modes (and newer).
5370
5371 @item -Wshift-overflow
5372 @itemx -Wshift-overflow=@var{n}
5373 @opindex Wshift-overflow
5374 @opindex Wno-shift-overflow
5375 Warn about left shift overflows. This warning is enabled by
5376 default in C99 and C++11 modes (and newer).
5377
5378 @table @gcctabopt
5379 @item -Wshift-overflow=1
5380 This is the warning level of @option{-Wshift-overflow} and is enabled
5381 by default in C99 and C++11 modes (and newer). This warning level does
5382 not warn about left-shifting 1 into the sign bit. (However, in C, such
5383 an overflow is still rejected in contexts where an integer constant expression
5384 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5385 shifts always wrap.
5386
5387 @item -Wshift-overflow=2
5388 This warning level also warns about left-shifting 1 into the sign bit,
5389 unless C++14 mode (or newer) is active.
5390 @end table
5391
5392 @item -Wswitch
5393 @opindex Wswitch
5394 @opindex Wno-switch
5395 Warn whenever a @code{switch} statement has an index of enumerated type
5396 and lacks a @code{case} for one or more of the named codes of that
5397 enumeration. (The presence of a @code{default} label prevents this
5398 warning.) @code{case} labels outside the enumeration range also
5399 provoke warnings when this option is used (even if there is a
5400 @code{default} label).
5401 This warning is enabled by @option{-Wall}.
5402
5403 @item -Wswitch-default
5404 @opindex Wswitch-default
5405 @opindex Wno-switch-default
5406 Warn whenever a @code{switch} statement does not have a @code{default}
5407 case.
5408
5409 @item -Wswitch-enum
5410 @opindex Wswitch-enum
5411 @opindex Wno-switch-enum
5412 Warn whenever a @code{switch} statement has an index of enumerated type
5413 and lacks a @code{case} for one or more of the named codes of that
5414 enumeration. @code{case} labels outside the enumeration range also
5415 provoke warnings when this option is used. The only difference
5416 between @option{-Wswitch} and this option is that this option gives a
5417 warning about an omitted enumeration code even if there is a
5418 @code{default} label.
5419
5420 @item -Wswitch-bool
5421 @opindex Wswitch-bool
5422 @opindex Wno-switch-bool
5423 Warn whenever a @code{switch} statement has an index of boolean type
5424 and the case values are outside the range of a boolean type.
5425 It is possible to suppress this warning by casting the controlling
5426 expression to a type other than @code{bool}. For example:
5427 @smallexample
5428 @group
5429 switch ((int) (a == 4))
5430 @{
5431 @dots{}
5432 @}
5433 @end group
5434 @end smallexample
5435 This warning is enabled by default for C and C++ programs.
5436
5437 @item -Wswitch-outside-range
5438 @opindex Wswitch-outside-range
5439 @opindex Wno-switch-outside-range
5440 Warn whenever a @code{switch} case has a value that is outside of its
5441 respective type range. This warning is enabled by default for
5442 C and C++ programs.
5443
5444 @item -Wswitch-unreachable
5445 @opindex Wswitch-unreachable
5446 @opindex Wno-switch-unreachable
5447 Warn whenever a @code{switch} statement contains statements between the
5448 controlling expression and the first case label, which will never be
5449 executed. For example:
5450 @smallexample
5451 @group
5452 switch (cond)
5453 @{
5454 i = 15;
5455 @dots{}
5456 case 5:
5457 @dots{}
5458 @}
5459 @end group
5460 @end smallexample
5461 @option{-Wswitch-unreachable} does not warn if the statement between the
5462 controlling expression and the first case label is just a declaration:
5463 @smallexample
5464 @group
5465 switch (cond)
5466 @{
5467 int i;
5468 @dots{}
5469 case 5:
5470 i = 5;
5471 @dots{}
5472 @}
5473 @end group
5474 @end smallexample
5475 This warning is enabled by default for C and C++ programs.
5476
5477 @item -Wsync-nand @r{(C and C++ only)}
5478 @opindex Wsync-nand
5479 @opindex Wno-sync-nand
5480 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5481 built-in functions are used. These functions changed semantics in GCC 4.4.
5482
5483 @item -Wunused-but-set-parameter
5484 @opindex Wunused-but-set-parameter
5485 @opindex Wno-unused-but-set-parameter
5486 Warn whenever a function parameter is assigned to, but otherwise unused
5487 (aside from its declaration).
5488
5489 To suppress this warning use the @code{unused} attribute
5490 (@pxref{Variable Attributes}).
5491
5492 This warning is also enabled by @option{-Wunused} together with
5493 @option{-Wextra}.
5494
5495 @item -Wunused-but-set-variable
5496 @opindex Wunused-but-set-variable
5497 @opindex Wno-unused-but-set-variable
5498 Warn whenever a local variable is assigned to, but otherwise unused
5499 (aside from its declaration).
5500 This warning is enabled by @option{-Wall}.
5501
5502 To suppress this warning use the @code{unused} attribute
5503 (@pxref{Variable Attributes}).
5504
5505 This warning is also enabled by @option{-Wunused}, which is enabled
5506 by @option{-Wall}.
5507
5508 @item -Wunused-function
5509 @opindex Wunused-function
5510 @opindex Wno-unused-function
5511 Warn whenever a static function is declared but not defined or a
5512 non-inline static function is unused.
5513 This warning is enabled by @option{-Wall}.
5514
5515 @item -Wunused-label
5516 @opindex Wunused-label
5517 @opindex Wno-unused-label
5518 Warn whenever a label is declared but not used.
5519 This warning is enabled by @option{-Wall}.
5520
5521 To suppress this warning use the @code{unused} attribute
5522 (@pxref{Variable Attributes}).
5523
5524 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5525 @opindex Wunused-local-typedefs
5526 @opindex Wno-unused-local-typedefs
5527 Warn when a typedef locally defined in a function is not used.
5528 This warning is enabled by @option{-Wall}.
5529
5530 @item -Wunused-parameter
5531 @opindex Wunused-parameter
5532 @opindex Wno-unused-parameter
5533 Warn whenever a function parameter is unused aside from its declaration.
5534
5535 To suppress this warning use the @code{unused} attribute
5536 (@pxref{Variable Attributes}).
5537
5538 @item -Wno-unused-result
5539 @opindex Wunused-result
5540 @opindex Wno-unused-result
5541 Do not warn if a caller of a function marked with attribute
5542 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5543 its return value. The default is @option{-Wunused-result}.
5544
5545 @item -Wunused-variable
5546 @opindex Wunused-variable
5547 @opindex Wno-unused-variable
5548 Warn whenever a local or static variable is unused aside from its
5549 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5550 but not for C++. This warning is enabled by @option{-Wall}.
5551
5552 To suppress this warning use the @code{unused} attribute
5553 (@pxref{Variable Attributes}).
5554
5555 @item -Wunused-const-variable
5556 @itemx -Wunused-const-variable=@var{n}
5557 @opindex Wunused-const-variable
5558 @opindex Wno-unused-const-variable
5559 Warn whenever a constant static variable is unused aside from its declaration.
5560 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5561 for C, but not for C++. In C this declares variable storage, but in C++ this
5562 is not an error since const variables take the place of @code{#define}s.
5563
5564 To suppress this warning use the @code{unused} attribute
5565 (@pxref{Variable Attributes}).
5566
5567 @table @gcctabopt
5568 @item -Wunused-const-variable=1
5569 This is the warning level that is enabled by @option{-Wunused-variable} for
5570 C. It warns only about unused static const variables defined in the main
5571 compilation unit, but not about static const variables declared in any
5572 header included.
5573
5574 @item -Wunused-const-variable=2
5575 This warning level also warns for unused constant static variables in
5576 headers (excluding system headers). This is the warning level of
5577 @option{-Wunused-const-variable} and must be explicitly requested since
5578 in C++ this isn't an error and in C it might be harder to clean up all
5579 headers included.
5580 @end table
5581
5582 @item -Wunused-value
5583 @opindex Wunused-value
5584 @opindex Wno-unused-value
5585 Warn whenever a statement computes a result that is explicitly not
5586 used. To suppress this warning cast the unused expression to
5587 @code{void}. This includes an expression-statement or the left-hand
5588 side of a comma expression that contains no side effects. For example,
5589 an expression such as @code{x[i,j]} causes a warning, while
5590 @code{x[(void)i,j]} does not.
5591
5592 This warning is enabled by @option{-Wall}.
5593
5594 @item -Wunused
5595 @opindex Wunused
5596 @opindex Wno-unused
5597 All the above @option{-Wunused} options combined.
5598
5599 In order to get a warning about an unused function parameter, you must
5600 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5601 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5602
5603 @item -Wuninitialized
5604 @opindex Wuninitialized
5605 @opindex Wno-uninitialized
5606 Warn if an automatic variable is used without first being initialized.
5607 In C++, warn if a non-static reference or non-static @code{const}
5608 member appears in a class without constructors.
5609
5610 If you want to warn about code that uses the uninitialized value of the
5611 variable in its own initializer, use the @option{-Winit-self} option.
5612
5613 These warnings occur for individual uninitialized elements of
5614 structure, union or array variables as well as for variables that are
5615 uninitialized as a whole. They do not occur for variables or elements
5616 declared @code{volatile}. Because these warnings depend on
5617 optimization, the exact variables or elements for which there are
5618 warnings depend on the precise optimization options and version of GCC
5619 used.
5620
5621 Note that there may be no warning about a variable that is used only
5622 to compute a value that itself is never used, because such
5623 computations may be deleted by data flow analysis before the warnings
5624 are printed.
5625
5626 @item -Winvalid-memory-model
5627 @opindex Winvalid-memory-model
5628 @opindex Wno-invalid-memory-model
5629 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5630 and the C11 atomic generic functions with a memory consistency argument
5631 that is either invalid for the operation or outside the range of values
5632 of the @code{memory_order} enumeration. For example, since the
5633 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5634 defined for the relaxed, release, and sequentially consistent memory
5635 orders the following code is diagnosed:
5636
5637 @smallexample
5638 void store (int *i)
5639 @{
5640 __atomic_store_n (i, 0, memory_order_consume);
5641 @}
5642 @end smallexample
5643
5644 @option{-Winvalid-memory-model} is enabled by default.
5645
5646 @item -Wmaybe-uninitialized
5647 @opindex Wmaybe-uninitialized
5648 @opindex Wno-maybe-uninitialized
5649 For an automatic (i.e.@: local) variable, if there exists a path from the
5650 function entry to a use of the variable that is initialized, but there exist
5651 some other paths for which the variable is not initialized, the compiler
5652 emits a warning if it cannot prove the uninitialized paths are not
5653 executed at run time.
5654
5655 These warnings are only possible in optimizing compilation, because otherwise
5656 GCC does not keep track of the state of variables.
5657
5658 These warnings are made optional because GCC may not be able to determine when
5659 the code is correct in spite of appearing to have an error. Here is one
5660 example of how this can happen:
5661
5662 @smallexample
5663 @group
5664 @{
5665 int x;
5666 switch (y)
5667 @{
5668 case 1: x = 1;
5669 break;
5670 case 2: x = 4;
5671 break;
5672 case 3: x = 5;
5673 @}
5674 foo (x);
5675 @}
5676 @end group
5677 @end smallexample
5678
5679 @noindent
5680 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5681 always initialized, but GCC doesn't know this. To suppress the
5682 warning, you need to provide a default case with assert(0) or
5683 similar code.
5684
5685 @cindex @code{longjmp} warnings
5686 This option also warns when a non-volatile automatic variable might be
5687 changed by a call to @code{longjmp}.
5688 The compiler sees only the calls to @code{setjmp}. It cannot know
5689 where @code{longjmp} will be called; in fact, a signal handler could
5690 call it at any point in the code. As a result, you may get a warning
5691 even when there is in fact no problem because @code{longjmp} cannot
5692 in fact be called at the place that would cause a problem.
5693
5694 Some spurious warnings can be avoided if you declare all the functions
5695 you use that never return as @code{noreturn}. @xref{Function
5696 Attributes}.
5697
5698 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5699
5700 @item -Wunknown-pragmas
5701 @opindex Wunknown-pragmas
5702 @opindex Wno-unknown-pragmas
5703 @cindex warning for unknown pragmas
5704 @cindex unknown pragmas, warning
5705 @cindex pragmas, warning of unknown
5706 Warn when a @code{#pragma} directive is encountered that is not understood by
5707 GCC@. If this command-line option is used, warnings are even issued
5708 for unknown pragmas in system header files. This is not the case if
5709 the warnings are only enabled by the @option{-Wall} command-line option.
5710
5711 @item -Wno-pragmas
5712 @opindex Wno-pragmas
5713 @opindex Wpragmas
5714 Do not warn about misuses of pragmas, such as incorrect parameters,
5715 invalid syntax, or conflicts between pragmas. See also
5716 @option{-Wunknown-pragmas}.
5717
5718 @item -Wno-prio-ctor-dtor
5719 @opindex Wno-prio-ctor-dtor
5720 @opindex Wprio-ctor-dtor
5721 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5722 The use of constructor and destructor attributes allow you to assign a
5723 priority to the constructor/destructor to control its order of execution
5724 before @code{main} is called or after it returns. The priority values must be
5725 greater than 100 as the compiler reserves priority values between 0--100 for
5726 the implementation.
5727
5728 @item -Wstrict-aliasing
5729 @opindex Wstrict-aliasing
5730 @opindex Wno-strict-aliasing
5731 This option is only active when @option{-fstrict-aliasing} is active.
5732 It warns about code that might break the strict aliasing rules that the
5733 compiler is using for optimization. The warning does not catch all
5734 cases, but does attempt to catch the more common pitfalls. It is
5735 included in @option{-Wall}.
5736 It is equivalent to @option{-Wstrict-aliasing=3}
5737
5738 @item -Wstrict-aliasing=n
5739 @opindex Wstrict-aliasing=n
5740 This option is only active when @option{-fstrict-aliasing} is active.
5741 It warns about code that might break the strict aliasing rules that the
5742 compiler is using for optimization.
5743 Higher levels correspond to higher accuracy (fewer false positives).
5744 Higher levels also correspond to more effort, similar to the way @option{-O}
5745 works.
5746 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5747
5748 Level 1: Most aggressive, quick, least accurate.
5749 Possibly useful when higher levels
5750 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5751 false negatives. However, it has many false positives.
5752 Warns for all pointer conversions between possibly incompatible types,
5753 even if never dereferenced. Runs in the front end only.
5754
5755 Level 2: Aggressive, quick, not too precise.
5756 May still have many false positives (not as many as level 1 though),
5757 and few false negatives (but possibly more than level 1).
5758 Unlike level 1, it only warns when an address is taken. Warns about
5759 incomplete types. Runs in the front end only.
5760
5761 Level 3 (default for @option{-Wstrict-aliasing}):
5762 Should have very few false positives and few false
5763 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5764 Takes care of the common pun+dereference pattern in the front end:
5765 @code{*(int*)&some_float}.
5766 If optimization is enabled, it also runs in the back end, where it deals
5767 with multiple statement cases using flow-sensitive points-to information.
5768 Only warns when the converted pointer is dereferenced.
5769 Does not warn about incomplete types.
5770
5771 @item -Wstrict-overflow
5772 @itemx -Wstrict-overflow=@var{n}
5773 @opindex Wstrict-overflow
5774 @opindex Wno-strict-overflow
5775 This option is only active when signed overflow is undefined.
5776 It warns about cases where the compiler optimizes based on the
5777 assumption that signed overflow does not occur. Note that it does not
5778 warn about all cases where the code might overflow: it only warns
5779 about cases where the compiler implements some optimization. Thus
5780 this warning depends on the optimization level.
5781
5782 An optimization that assumes that signed overflow does not occur is
5783 perfectly safe if the values of the variables involved are such that
5784 overflow never does, in fact, occur. Therefore this warning can
5785 easily give a false positive: a warning about code that is not
5786 actually a problem. To help focus on important issues, several
5787 warning levels are defined. No warnings are issued for the use of
5788 undefined signed overflow when estimating how many iterations a loop
5789 requires, in particular when determining whether a loop will be
5790 executed at all.
5791
5792 @table @gcctabopt
5793 @item -Wstrict-overflow=1
5794 Warn about cases that are both questionable and easy to avoid. For
5795 example the compiler simplifies
5796 @code{x + 1 > x} to @code{1}. This level of
5797 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5798 are not, and must be explicitly requested.
5799
5800 @item -Wstrict-overflow=2
5801 Also warn about other cases where a comparison is simplified to a
5802 constant. For example: @code{abs (x) >= 0}. This can only be
5803 simplified when signed integer overflow is undefined, because
5804 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5805 zero. @option{-Wstrict-overflow} (with no level) is the same as
5806 @option{-Wstrict-overflow=2}.
5807
5808 @item -Wstrict-overflow=3
5809 Also warn about other cases where a comparison is simplified. For
5810 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5811
5812 @item -Wstrict-overflow=4
5813 Also warn about other simplifications not covered by the above cases.
5814 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5815
5816 @item -Wstrict-overflow=5
5817 Also warn about cases where the compiler reduces the magnitude of a
5818 constant involved in a comparison. For example: @code{x + 2 > y} is
5819 simplified to @code{x + 1 >= y}. This is reported only at the
5820 highest warning level because this simplification applies to many
5821 comparisons, so this warning level gives a very large number of
5822 false positives.
5823 @end table
5824
5825 @item -Wstring-compare
5826 @opindex Wstring-compare
5827 @opindex Wno-string-compare
5828 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
5829 determined to be either zero or non-zero in tests for such equality
5830 owing to the length of one argument being greater than the size of
5831 the array the other argument is stored in (or the bound in the case
5832 of @code{strncmp}). Such calls could be mistakes. For example,
5833 the call to @code{strcmp} below is diagnosed because its result is
5834 necessarily non-zero irrespective of the contents of the array @code{a}.
5835
5836 @smallexample
5837 extern char a[4];
5838 void f (char *d)
5839 @{
5840 strcpy (d, "string");
5841 @dots{}
5842 if (0 == strcmp (a, d)) // cannot be true
5843 puts ("a and d are the same");
5844 @}
5845 @end smallexample
5846
5847 @option{-Wstring-compare} is enabled by @option{-Wextra}.
5848
5849 @item -Wstringop-overflow
5850 @itemx -Wstringop-overflow=@var{type}
5851 @opindex Wstringop-overflow
5852 @opindex Wno-stringop-overflow
5853 Warn for calls to string manipulation functions such as @code{memcpy} and
5854 @code{strcpy} that are determined to overflow the destination buffer. The
5855 optional argument is one greater than the type of Object Size Checking to
5856 perform to determine the size of the destination. @xref{Object Size Checking}.
5857 The argument is meaningful only for functions that operate on character arrays
5858 but not for raw memory functions like @code{memcpy} which always make use
5859 of Object Size type-0. The option also warns for calls that specify a size
5860 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5861 The option produces the best results with optimization enabled but can detect
5862 a small subset of simple buffer overflows even without optimization in
5863 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5864 correspond to the standard functions. In any case, the option warns about
5865 just a subset of buffer overflows detected by the corresponding overflow
5866 checking built-ins. For example, the option will issue a warning for
5867 the @code{strcpy} call below because it copies at least 5 characters
5868 (the string @code{"blue"} including the terminating NUL) into the buffer
5869 of size 4.
5870
5871 @smallexample
5872 enum Color @{ blue, purple, yellow @};
5873 const char* f (enum Color clr)
5874 @{
5875 static char buf [4];
5876 const char *str;
5877 switch (clr)
5878 @{
5879 case blue: str = "blue"; break;
5880 case purple: str = "purple"; break;
5881 case yellow: str = "yellow"; break;
5882 @}
5883
5884 return strcpy (buf, str); // warning here
5885 @}
5886 @end smallexample
5887
5888 Option @option{-Wstringop-overflow=2} is enabled by default.
5889
5890 @table @gcctabopt
5891 @item -Wstringop-overflow
5892 @itemx -Wstringop-overflow=1
5893 @opindex Wstringop-overflow
5894 @opindex Wno-stringop-overflow
5895 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5896 to determine the sizes of destination objects. This is the default setting
5897 of the option. At this setting the option will not warn for writes past
5898 the end of subobjects of larger objects accessed by pointers unless the
5899 size of the largest surrounding object is known. When the destination may
5900 be one of several objects it is assumed to be the largest one of them. On
5901 Linux systems, when optimization is enabled at this setting the option warns
5902 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5903 a non-zero value.
5904
5905 @item -Wstringop-overflow=2
5906 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5907 to determine the sizes of destination objects. At this setting the option
5908 will warn about overflows when writing to members of the largest complete
5909 objects whose exact size is known. It will, however, not warn for excessive
5910 writes to the same members of unknown objects referenced by pointers since
5911 they may point to arrays containing unknown numbers of elements.
5912
5913 @item -Wstringop-overflow=3
5914 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5915 to determine the sizes of destination objects. At this setting the option
5916 warns about overflowing the smallest object or data member. This is the
5917 most restrictive setting of the option that may result in warnings for safe
5918 code.
5919
5920 @item -Wstringop-overflow=4
5921 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5922 to determine the sizes of destination objects. At this setting the option
5923 will warn about overflowing any data members, and when the destination is
5924 one of several objects it uses the size of the largest of them to decide
5925 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5926 setting of the option may result in warnings for benign code.
5927 @end table
5928
5929 @item -Wstringop-truncation
5930 @opindex Wstringop-truncation
5931 @opindex Wno-stringop-truncation
5932 Warn for calls to bounded string manipulation functions such as @code{strncat},
5933 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5934 or leave the destination unchanged.
5935
5936 In the following example, the call to @code{strncat} specifies a bound that
5937 is less than the length of the source string. As a result, the copy of
5938 the source will be truncated and so the call is diagnosed. To avoid the
5939 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5940
5941 @smallexample
5942 void append (char *buf, size_t bufsize)
5943 @{
5944 strncat (buf, ".txt", 3);
5945 @}
5946 @end smallexample
5947
5948 As another example, the following call to @code{strncpy} results in copying
5949 to @code{d} just the characters preceding the terminating NUL, without
5950 appending the NUL to the end. Assuming the result of @code{strncpy} is
5951 necessarily a NUL-terminated string is a common mistake, and so the call
5952 is diagnosed. To avoid the warning when the result is not expected to be
5953 NUL-terminated, call @code{memcpy} instead.
5954
5955 @smallexample
5956 void copy (char *d, const char *s)
5957 @{
5958 strncpy (d, s, strlen (s));
5959 @}
5960 @end smallexample
5961
5962 In the following example, the call to @code{strncpy} specifies the size
5963 of the destination buffer as the bound. If the length of the source
5964 string is equal to or greater than this size the result of the copy will
5965 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5966 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5967 element of the buffer to @code{NUL}.
5968
5969 @smallexample
5970 void copy (const char *s)
5971 @{
5972 char buf[80];
5973 strncpy (buf, s, sizeof buf);
5974 @dots{}
5975 @}
5976 @end smallexample
5977
5978 In situations where a character array is intended to store a sequence
5979 of bytes with no terminating @code{NUL} such an array may be annotated
5980 with attribute @code{nonstring} to avoid this warning. Such arrays,
5981 however, are not suitable arguments to functions that expect
5982 @code{NUL}-terminated strings. To help detect accidental misuses of
5983 such arrays GCC issues warnings unless it can prove that the use is
5984 safe. @xref{Common Variable Attributes}.
5985
5986 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5987 @opindex Wsuggest-attribute=
5988 @opindex Wno-suggest-attribute=
5989 Warn for cases where adding an attribute may be beneficial. The
5990 attributes currently supported are listed below.
5991
5992 @table @gcctabopt
5993 @item -Wsuggest-attribute=pure
5994 @itemx -Wsuggest-attribute=const
5995 @itemx -Wsuggest-attribute=noreturn
5996 @itemx -Wmissing-noreturn
5997 @itemx -Wsuggest-attribute=malloc
5998 @opindex Wsuggest-attribute=pure
5999 @opindex Wno-suggest-attribute=pure
6000 @opindex Wsuggest-attribute=const
6001 @opindex Wno-suggest-attribute=const
6002 @opindex Wsuggest-attribute=noreturn
6003 @opindex Wno-suggest-attribute=noreturn
6004 @opindex Wmissing-noreturn
6005 @opindex Wno-missing-noreturn
6006 @opindex Wsuggest-attribute=malloc
6007 @opindex Wno-suggest-attribute=malloc
6008
6009 Warn about functions that might be candidates for attributes
6010 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6011 only warns for functions visible in other compilation units or (in the case of
6012 @code{pure} and @code{const}) if it cannot prove that the function returns
6013 normally. A function returns normally if it doesn't contain an infinite loop or
6014 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6015 requires option @option{-fipa-pure-const}, which is enabled by default at
6016 @option{-O} and higher. Higher optimization levels improve the accuracy
6017 of the analysis.
6018
6019 @item -Wsuggest-attribute=format
6020 @itemx -Wmissing-format-attribute
6021 @opindex Wsuggest-attribute=format
6022 @opindex Wmissing-format-attribute
6023 @opindex Wno-suggest-attribute=format
6024 @opindex Wno-missing-format-attribute
6025 @opindex Wformat
6026 @opindex Wno-format
6027
6028 Warn about function pointers that might be candidates for @code{format}
6029 attributes. Note these are only possible candidates, not absolute ones.
6030 GCC guesses that function pointers with @code{format} attributes that
6031 are used in assignment, initialization, parameter passing or return
6032 statements should have a corresponding @code{format} attribute in the
6033 resulting type. I.e.@: the left-hand side of the assignment or
6034 initialization, the type of the parameter variable, or the return type
6035 of the containing function respectively should also have a @code{format}
6036 attribute to avoid the warning.
6037
6038 GCC also warns about function definitions that might be
6039 candidates for @code{format} attributes. Again, these are only
6040 possible candidates. GCC guesses that @code{format} attributes
6041 might be appropriate for any function that calls a function like
6042 @code{vprintf} or @code{vscanf}, but this might not always be the
6043 case, and some functions for which @code{format} attributes are
6044 appropriate may not be detected.
6045
6046 @item -Wsuggest-attribute=cold
6047 @opindex Wsuggest-attribute=cold
6048 @opindex Wno-suggest-attribute=cold
6049
6050 Warn about functions that might be candidates for @code{cold} attribute. This
6051 is based on static detection and generally will only warn about functions which
6052 always leads to a call to another @code{cold} function such as wrappers of
6053 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6054 @end table
6055
6056 @item -Wsuggest-final-types
6057 @opindex Wno-suggest-final-types
6058 @opindex Wsuggest-final-types
6059 Warn about types with virtual methods where code quality would be improved
6060 if the type were declared with the C++11 @code{final} specifier,
6061 or, if possible,
6062 declared in an anonymous namespace. This allows GCC to more aggressively
6063 devirtualize the polymorphic calls. This warning is more effective with
6064 link-time optimization,
6065 where the information about the class hierarchy graph is
6066 more complete.
6067
6068 @item -Wsuggest-final-methods
6069 @opindex Wno-suggest-final-methods
6070 @opindex Wsuggest-final-methods
6071 Warn about virtual methods where code quality would be improved if the method
6072 were declared with the C++11 @code{final} specifier,
6073 or, if possible, its type were
6074 declared in an anonymous namespace or with the @code{final} specifier.
6075 This warning is
6076 more effective with link-time optimization, where the information about the
6077 class hierarchy graph is more complete. It is recommended to first consider
6078 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6079 annotations.
6080
6081 @item -Wsuggest-override
6082 Warn about overriding virtual functions that are not marked with the override
6083 keyword.
6084
6085 @item -Walloc-zero
6086 @opindex Wno-alloc-zero
6087 @opindex Walloc-zero
6088 Warn about calls to allocation functions decorated with attribute
6089 @code{alloc_size} that specify zero bytes, including those to the built-in
6090 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6091 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6092 when called with a zero size differs among implementations (and in the case
6093 of @code{realloc} has been deprecated) relying on it may result in subtle
6094 portability bugs and should be avoided.
6095
6096 @item -Walloc-size-larger-than=@var{byte-size}
6097 @opindex Walloc-size-larger-than=
6098 @opindex Wno-alloc-size-larger-than
6099 Warn about calls to functions decorated with attribute @code{alloc_size}
6100 that attempt to allocate objects larger than the specified number of bytes,
6101 or where the result of the size computation in an integer type with infinite
6102 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6103 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6104 Warnings controlled by the option can be disabled either by specifying
6105 @var{byte-size} of @samp{SIZE_MAX} or more or by
6106 @option{-Wno-alloc-size-larger-than}.
6107 @xref{Function Attributes}.
6108
6109 @item -Wno-alloc-size-larger-than
6110 @opindex Wno-alloc-size-larger-than
6111 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6112 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6113 larger.
6114
6115 @item -Walloca
6116 @opindex Wno-alloca
6117 @opindex Walloca
6118 This option warns on all uses of @code{alloca} in the source.
6119
6120 @item -Walloca-larger-than=@var{byte-size}
6121 @opindex Walloca-larger-than=
6122 @opindex Wno-alloca-larger-than
6123 This option warns on calls to @code{alloca} with an integer argument whose
6124 value is either zero, or that is not bounded by a controlling predicate
6125 that limits its value to at most @var{byte-size}. It also warns for calls
6126 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6127 types are considered unbounded even if they appear to be constrained to
6128 the expected range.
6129
6130 For example, a bounded case of @code{alloca} could be:
6131
6132 @smallexample
6133 void func (size_t n)
6134 @{
6135 void *p;
6136 if (n <= 1000)
6137 p = alloca (n);
6138 else
6139 p = malloc (n);
6140 f (p);
6141 @}
6142 @end smallexample
6143
6144 In the above example, passing @code{-Walloca-larger-than=1000} would not
6145 issue a warning because the call to @code{alloca} is known to be at most
6146 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6147 the compiler would emit a warning.
6148
6149 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6150 controlling predicate constraining its integer argument. For example:
6151
6152 @smallexample
6153 void func ()
6154 @{
6155 void *p = alloca (n);
6156 f (p);
6157 @}
6158 @end smallexample
6159
6160 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6161 a warning, but this time because of the lack of bounds checking.
6162
6163 Note, that even seemingly correct code involving signed integers could
6164 cause a warning:
6165
6166 @smallexample
6167 void func (signed int n)
6168 @{
6169 if (n < 500)
6170 @{
6171 p = alloca (n);
6172 f (p);
6173 @}
6174 @}
6175 @end smallexample
6176
6177 In the above example, @var{n} could be negative, causing a larger than
6178 expected argument to be implicitly cast into the @code{alloca} call.
6179
6180 This option also warns when @code{alloca} is used in a loop.
6181
6182 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6183 but is usually only effective when @option{-ftree-vrp} is active (default
6184 for @option{-O2} and above).
6185
6186 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6187
6188 @item -Wno-alloca-larger-than
6189 @opindex Wno-alloca-larger-than
6190 Disable @option{-Walloca-larger-than=} warnings. The option is
6191 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6192
6193 @item -Warray-bounds
6194 @itemx -Warray-bounds=@var{n}
6195 @opindex Wno-array-bounds
6196 @opindex Warray-bounds
6197 This option is only active when @option{-ftree-vrp} is active
6198 (default for @option{-O2} and above). It warns about subscripts to arrays
6199 that are always out of bounds. This warning is enabled by @option{-Wall}.
6200
6201 @table @gcctabopt
6202 @item -Warray-bounds=1
6203 This is the warning level of @option{-Warray-bounds} and is enabled
6204 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6205
6206 @item -Warray-bounds=2
6207 This warning level also warns about out of bounds access for
6208 arrays at the end of a struct and for arrays accessed through
6209 pointers. This warning level may give a larger number of
6210 false positives and is deactivated by default.
6211 @end table
6212
6213 @item -Wattribute-alias=@var{n}
6214 @itemx -Wno-attribute-alias
6215 @opindex Wattribute-alias
6216 @opindex Wno-attribute-alias
6217 Warn about declarations using the @code{alias} and similar attributes whose
6218 target is incompatible with the type of the alias.
6219 @xref{Function Attributes,,Declaring Attributes of Functions}.
6220
6221 @table @gcctabopt
6222 @item -Wattribute-alias=1
6223 The default warning level of the @option{-Wattribute-alias} option diagnoses
6224 incompatibilities between the type of the alias declaration and that of its
6225 target. Such incompatibilities are typically indicative of bugs.
6226
6227 @item -Wattribute-alias=2
6228
6229 At this level @option{-Wattribute-alias} also diagnoses cases where
6230 the attributes of the alias declaration are more restrictive than the
6231 attributes applied to its target. These mismatches can potentially
6232 result in incorrect code generation. In other cases they may be
6233 benign and could be resolved simply by adding the missing attribute to
6234 the target. For comparison, see the @option{-Wmissing-attributes}
6235 option, which controls diagnostics when the alias declaration is less
6236 restrictive than the target, rather than more restrictive.
6237
6238 Attributes considered include @code{alloc_align}, @code{alloc_size},
6239 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6240 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6241 @code{returns_nonnull}, and @code{returns_twice}.
6242 @end table
6243
6244 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6245 This is the default. You can disable these warnings with either
6246 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6247
6248 @item -Wbool-compare
6249 @opindex Wno-bool-compare
6250 @opindex Wbool-compare
6251 Warn about boolean expression compared with an integer value different from
6252 @code{true}/@code{false}. For instance, the following comparison is
6253 always false:
6254 @smallexample
6255 int n = 5;
6256 @dots{}
6257 if ((n > 1) == 2) @{ @dots{} @}
6258 @end smallexample
6259 This warning is enabled by @option{-Wall}.
6260
6261 @item -Wbool-operation
6262 @opindex Wno-bool-operation
6263 @opindex Wbool-operation
6264 Warn about suspicious operations on expressions of a boolean type. For
6265 instance, bitwise negation of a boolean is very likely a bug in the program.
6266 For C, this warning also warns about incrementing or decrementing a boolean,
6267 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6268 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6269
6270 This warning is enabled by @option{-Wall}.
6271
6272 @item -Wduplicated-branches
6273 @opindex Wno-duplicated-branches
6274 @opindex Wduplicated-branches
6275 Warn when an if-else has identical branches. This warning detects cases like
6276 @smallexample
6277 if (p != NULL)
6278 return 0;
6279 else
6280 return 0;
6281 @end smallexample
6282 It doesn't warn when both branches contain just a null statement. This warning
6283 also warn for conditional operators:
6284 @smallexample
6285 int i = x ? *p : *p;
6286 @end smallexample
6287
6288 @item -Wduplicated-cond
6289 @opindex Wno-duplicated-cond
6290 @opindex Wduplicated-cond
6291 Warn about duplicated conditions in an if-else-if chain. For instance,
6292 warn for the following code:
6293 @smallexample
6294 if (p->q != NULL) @{ @dots{} @}
6295 else if (p->q != NULL) @{ @dots{} @}
6296 @end smallexample
6297
6298 @item -Wframe-address
6299 @opindex Wno-frame-address
6300 @opindex Wframe-address
6301 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6302 is called with an argument greater than 0. Such calls may return indeterminate
6303 values or crash the program. The warning is included in @option{-Wall}.
6304
6305 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6306 @opindex Wno-discarded-qualifiers
6307 @opindex Wdiscarded-qualifiers
6308 Do not warn if type qualifiers on pointers are being discarded.
6309 Typically, the compiler warns if a @code{const char *} variable is
6310 passed to a function that takes a @code{char *} parameter. This option
6311 can be used to suppress such a warning.
6312
6313 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6314 @opindex Wno-discarded-array-qualifiers
6315 @opindex Wdiscarded-array-qualifiers
6316 Do not warn if type qualifiers on arrays which are pointer targets
6317 are being discarded. Typically, the compiler warns if a
6318 @code{const int (*)[]} variable is passed to a function that
6319 takes a @code{int (*)[]} parameter. This option can be used to
6320 suppress such a warning.
6321
6322 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6323 @opindex Wno-incompatible-pointer-types
6324 @opindex Wincompatible-pointer-types
6325 Do not warn when there is a conversion between pointers that have incompatible
6326 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6327 which warns for pointer argument passing or assignment with different
6328 signedness.
6329
6330 @item -Wno-int-conversion @r{(C and Objective-C only)}
6331 @opindex Wno-int-conversion
6332 @opindex Wint-conversion
6333 Do not warn about incompatible integer to pointer and pointer to integer
6334 conversions. This warning is about implicit conversions; for explicit
6335 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6336 @option{-Wno-pointer-to-int-cast} may be used.
6337
6338 @item -Wzero-length-bounds
6339 @opindex Wzero-length-bounds
6340 @opindex Wzero-length-bounds
6341 Warn about accesses to elements of zero-length array members that might
6342 overlap other members of the same object. Declaring interior zero-length
6343 arrays is discouraged because accesses to them are undefined. See
6344 @xref{Zero Length}.
6345
6346 For example, the first two stores in function @code{bad} are diagnosed
6347 because the array elements overlap the subsequent members @code{b} and
6348 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
6349 because it is beyond the bounds of the enclosing object.
6350
6351 @smallexample
6352 struct X @{ int a[0]; int b, c; @};
6353 struct X x;
6354
6355 void bad (void)
6356 @{
6357 x.a[0] = 0; // -Wzero-length-bounds
6358 x.a[1] = 1; // -Wzero-length-bounds
6359 x.a[2] = 2; // -Warray-bounds
6360 @}
6361 @end smallexample
6362
6363 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6364
6365 @item -Wno-div-by-zero
6366 @opindex Wno-div-by-zero
6367 @opindex Wdiv-by-zero
6368 Do not warn about compile-time integer division by zero. Floating-point
6369 division by zero is not warned about, as it can be a legitimate way of
6370 obtaining infinities and NaNs.
6371
6372 @item -Wsystem-headers
6373 @opindex Wsystem-headers
6374 @opindex Wno-system-headers
6375 @cindex warnings from system headers
6376 @cindex system headers, warnings from
6377 Print warning messages for constructs found in system header files.
6378 Warnings from system headers are normally suppressed, on the assumption
6379 that they usually do not indicate real problems and would only make the
6380 compiler output harder to read. Using this command-line option tells
6381 GCC to emit warnings from system headers as if they occurred in user
6382 code. However, note that using @option{-Wall} in conjunction with this
6383 option does @emph{not} warn about unknown pragmas in system
6384 headers---for that, @option{-Wunknown-pragmas} must also be used.
6385
6386 @item -Wtautological-compare
6387 @opindex Wtautological-compare
6388 @opindex Wno-tautological-compare
6389 Warn if a self-comparison always evaluates to true or false. This
6390 warning detects various mistakes such as:
6391 @smallexample
6392 int i = 1;
6393 @dots{}
6394 if (i > i) @{ @dots{} @}
6395 @end smallexample
6396
6397 This warning also warns about bitwise comparisons that always evaluate
6398 to true or false, for instance:
6399 @smallexample
6400 if ((a & 16) == 10) @{ @dots{} @}
6401 @end smallexample
6402 will always be false.
6403
6404 This warning is enabled by @option{-Wall}.
6405
6406 @item -Wtrampolines
6407 @opindex Wtrampolines
6408 @opindex Wno-trampolines
6409 Warn about trampolines generated for pointers to nested functions.
6410 A trampoline is a small piece of data or code that is created at run
6411 time on the stack when the address of a nested function is taken, and is
6412 used to call the nested function indirectly. For some targets, it is
6413 made up of data only and thus requires no special treatment. But, for
6414 most targets, it is made up of code and thus requires the stack to be
6415 made executable in order for the program to work properly.
6416
6417 @item -Wfloat-equal
6418 @opindex Wfloat-equal
6419 @opindex Wno-float-equal
6420 Warn if floating-point values are used in equality comparisons.
6421
6422 The idea behind this is that sometimes it is convenient (for the
6423 programmer) to consider floating-point values as approximations to
6424 infinitely precise real numbers. If you are doing this, then you need
6425 to compute (by analyzing the code, or in some other way) the maximum or
6426 likely maximum error that the computation introduces, and allow for it
6427 when performing comparisons (and when producing output, but that's a
6428 different problem). In particular, instead of testing for equality, you
6429 should check to see whether the two values have ranges that overlap; and
6430 this is done with the relational operators, so equality comparisons are
6431 probably mistaken.
6432
6433 @item -Wtraditional @r{(C and Objective-C only)}
6434 @opindex Wtraditional
6435 @opindex Wno-traditional
6436 Warn about certain constructs that behave differently in traditional and
6437 ISO C@. Also warn about ISO C constructs that have no traditional C
6438 equivalent, and/or problematic constructs that should be avoided.
6439
6440 @itemize @bullet
6441 @item
6442 Macro parameters that appear within string literals in the macro body.
6443 In traditional C macro replacement takes place within string literals,
6444 but in ISO C it does not.
6445
6446 @item
6447 In traditional C, some preprocessor directives did not exist.
6448 Traditional preprocessors only considered a line to be a directive
6449 if the @samp{#} appeared in column 1 on the line. Therefore
6450 @option{-Wtraditional} warns about directives that traditional C
6451 understands but ignores because the @samp{#} does not appear as the
6452 first character on the line. It also suggests you hide directives like
6453 @code{#pragma} not understood by traditional C by indenting them. Some
6454 traditional implementations do not recognize @code{#elif}, so this option
6455 suggests avoiding it altogether.
6456
6457 @item
6458 A function-like macro that appears without arguments.
6459
6460 @item
6461 The unary plus operator.
6462
6463 @item
6464 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6465 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6466 constants.) Note, these suffixes appear in macros defined in the system
6467 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6468 Use of these macros in user code might normally lead to spurious
6469 warnings, however GCC's integrated preprocessor has enough context to
6470 avoid warning in these cases.
6471
6472 @item
6473 A function declared external in one block and then used after the end of
6474 the block.
6475
6476 @item
6477 A @code{switch} statement has an operand of type @code{long}.
6478
6479 @item
6480 A non-@code{static} function declaration follows a @code{static} one.
6481 This construct is not accepted by some traditional C compilers.
6482
6483 @item
6484 The ISO type of an integer constant has a different width or
6485 signedness from its traditional type. This warning is only issued if
6486 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6487 typically represent bit patterns, are not warned about.
6488
6489 @item
6490 Usage of ISO string concatenation is detected.
6491
6492 @item
6493 Initialization of automatic aggregates.
6494
6495 @item
6496 Identifier conflicts with labels. Traditional C lacks a separate
6497 namespace for labels.
6498
6499 @item
6500 Initialization of unions. If the initializer is zero, the warning is
6501 omitted. This is done under the assumption that the zero initializer in
6502 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6503 initializer warnings and relies on default initialization to zero in the
6504 traditional C case.
6505
6506 @item
6507 Conversions by prototypes between fixed/floating-point values and vice
6508 versa. The absence of these prototypes when compiling with traditional
6509 C causes serious problems. This is a subset of the possible
6510 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6511
6512 @item
6513 Use of ISO C style function definitions. This warning intentionally is
6514 @emph{not} issued for prototype declarations or variadic functions
6515 because these ISO C features appear in your code when using
6516 libiberty's traditional C compatibility macros, @code{PARAMS} and
6517 @code{VPARAMS}. This warning is also bypassed for nested functions
6518 because that feature is already a GCC extension and thus not relevant to
6519 traditional C compatibility.
6520 @end itemize
6521
6522 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6523 @opindex Wtraditional-conversion
6524 @opindex Wno-traditional-conversion
6525 Warn if a prototype causes a type conversion that is different from what
6526 would happen to the same argument in the absence of a prototype. This
6527 includes conversions of fixed point to floating and vice versa, and
6528 conversions changing the width or signedness of a fixed-point argument
6529 except when the same as the default promotion.
6530
6531 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6532 @opindex Wdeclaration-after-statement
6533 @opindex Wno-declaration-after-statement
6534 Warn when a declaration is found after a statement in a block. This
6535 construct, known from C++, was introduced with ISO C99 and is by default
6536 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6537
6538 @item -Wshadow
6539 @opindex Wshadow
6540 @opindex Wno-shadow
6541 Warn whenever a local variable or type declaration shadows another
6542 variable, parameter, type, class member (in C++), or instance variable
6543 (in Objective-C) or whenever a built-in function is shadowed. Note
6544 that in C++, the compiler warns if a local variable shadows an
6545 explicit typedef, but not if it shadows a struct/class/enum.
6546 If this warning is enabled, it includes also all instances of
6547 local shadowing. This means that @option{-Wno-shadow=local}
6548 and @option{-Wno-shadow=compatible-local} are ignored when
6549 @option{-Wshadow} is used.
6550 Same as @option{-Wshadow=global}.
6551
6552 @item -Wno-shadow-ivar @r{(Objective-C only)}
6553 @opindex Wno-shadow-ivar
6554 @opindex Wshadow-ivar
6555 Do not warn whenever a local variable shadows an instance variable in an
6556 Objective-C method.
6557
6558 @item -Wshadow=global
6559 @opindex Wshadow=global
6560 Warn for any shadowing.
6561 Same as @option{-Wshadow}.
6562
6563 @item -Wshadow=local
6564 @opindex Wshadow=local
6565 Warn when a local variable shadows another local variable or parameter.
6566
6567 @item -Wshadow=compatible-local
6568 @opindex Wshadow=compatible-local
6569 Warn when a local variable shadows another local variable or parameter
6570 whose type is compatible with that of the shadowing variable. In C++,
6571 type compatibility here means the type of the shadowing variable can be
6572 converted to that of the shadowed variable. The creation of this flag
6573 (in addition to @option{-Wshadow=local}) is based on the idea that when
6574 a local variable shadows another one of incompatible type, it is most
6575 likely intentional, not a bug or typo, as shown in the following example:
6576
6577 @smallexample
6578 @group
6579 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6580 @{
6581 for (int i = 0; i < N; ++i)
6582 @{
6583 ...
6584 @}
6585 ...
6586 @}
6587 @end group
6588 @end smallexample
6589
6590 Since the two variable @code{i} in the example above have incompatible types,
6591 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
6592 Because their types are incompatible, if a programmer accidentally uses one
6593 in place of the other, type checking is expected to catch that and emit an
6594 error or warning. Use of this flag instead of @option{-Wshadow=local} can
6595 possibly reduce the number of warnings triggered by intentional shadowing.
6596 Note that this also means that shadowing @code{const char *i} by
6597 @code{char *i} does not emit a warning.
6598
6599 This warning is also enabled by @option{-Wshadow=local}.
6600
6601 @item -Wlarger-than=@var{byte-size}
6602 @opindex Wlarger-than=
6603 @opindex Wlarger-than-@var{byte-size}
6604 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6605 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6606 Warnings controlled by the option can be disabled either by specifying
6607 @var{byte-size} of @samp{SIZE_MAX} or more or by
6608 @option{-Wno-larger-than}.
6609
6610 @item -Wno-larger-than
6611 @opindex Wno-larger-than
6612 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6613 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6614
6615 @item -Wframe-larger-than=@var{byte-size}
6616 @opindex Wframe-larger-than=
6617 @opindex Wno-frame-larger-than
6618 Warn if the size of a function frame exceeds @var{byte-size}.
6619 The computation done to determine the stack frame size is approximate
6620 and not conservative.
6621 The actual requirements may be somewhat greater than @var{byte-size}
6622 even if you do not get a warning. In addition, any space allocated
6623 via @code{alloca}, variable-length arrays, or related constructs
6624 is not included by the compiler when determining
6625 whether or not to issue a warning.
6626 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6627 Warnings controlled by the option can be disabled either by specifying
6628 @var{byte-size} of @samp{SIZE_MAX} or more or by
6629 @option{-Wno-frame-larger-than}.
6630
6631 @item -Wno-frame-larger-than
6632 @opindex Wno-frame-larger-than
6633 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6634 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6635
6636 @item -Wno-free-nonheap-object
6637 @opindex Wno-free-nonheap-object
6638 @opindex Wfree-nonheap-object
6639 Do not warn when attempting to free an object that was not allocated
6640 on the heap.
6641
6642 @item -Wstack-usage=@var{byte-size}
6643 @opindex Wstack-usage
6644 @opindex Wno-stack-usage
6645 Warn if the stack usage of a function might exceed @var{byte-size}.
6646 The computation done to determine the stack usage is conservative.
6647 Any space allocated via @code{alloca}, variable-length arrays, or related
6648 constructs is included by the compiler when determining whether or not to
6649 issue a warning.
6650
6651 The message is in keeping with the output of @option{-fstack-usage}.
6652
6653 @itemize
6654 @item
6655 If the stack usage is fully static but exceeds the specified amount, it's:
6656
6657 @smallexample
6658 warning: stack usage is 1120 bytes
6659 @end smallexample
6660 @item
6661 If the stack usage is (partly) dynamic but bounded, it's:
6662
6663 @smallexample
6664 warning: stack usage might be 1648 bytes
6665 @end smallexample
6666 @item
6667 If the stack usage is (partly) dynamic and not bounded, it's:
6668
6669 @smallexample
6670 warning: stack usage might be unbounded
6671 @end smallexample
6672 @end itemize
6673
6674 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6675 Warnings controlled by the option can be disabled either by specifying
6676 @var{byte-size} of @samp{SIZE_MAX} or more or by
6677 @option{-Wno-stack-usage}.
6678
6679 @item -Wno-stack-usage
6680 @opindex Wno-stack-usage
6681 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6682 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6683
6684 @item -Wunsafe-loop-optimizations
6685 @opindex Wunsafe-loop-optimizations
6686 @opindex Wno-unsafe-loop-optimizations
6687 Warn if the loop cannot be optimized because the compiler cannot
6688 assume anything on the bounds of the loop indices. With
6689 @option{-funsafe-loop-optimizations} warn if the compiler makes
6690 such assumptions.
6691
6692 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6693 @opindex Wno-pedantic-ms-format
6694 @opindex Wpedantic-ms-format
6695 When used in combination with @option{-Wformat}
6696 and @option{-pedantic} without GNU extensions, this option
6697 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6698 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6699 which depend on the MS runtime.
6700
6701 @item -Waligned-new
6702 @opindex Waligned-new
6703 @opindex Wno-aligned-new
6704 Warn about a new-expression of a type that requires greater alignment
6705 than the @code{alignof(std::max_align_t)} but uses an allocation
6706 function without an explicit alignment parameter. This option is
6707 enabled by @option{-Wall}.
6708
6709 Normally this only warns about global allocation functions, but
6710 @option{-Waligned-new=all} also warns about class member allocation
6711 functions.
6712
6713 @item -Wplacement-new
6714 @itemx -Wplacement-new=@var{n}
6715 @opindex Wplacement-new
6716 @opindex Wno-placement-new
6717 Warn about placement new expressions with undefined behavior, such as
6718 constructing an object in a buffer that is smaller than the type of
6719 the object. For example, the placement new expression below is diagnosed
6720 because it attempts to construct an array of 64 integers in a buffer only
6721 64 bytes large.
6722 @smallexample
6723 char buf [64];
6724 new (buf) int[64];
6725 @end smallexample
6726 This warning is enabled by default.
6727
6728 @table @gcctabopt
6729 @item -Wplacement-new=1
6730 This is the default warning level of @option{-Wplacement-new}. At this
6731 level the warning is not issued for some strictly undefined constructs that
6732 GCC allows as extensions for compatibility with legacy code. For example,
6733 the following @code{new} expression is not diagnosed at this level even
6734 though it has undefined behavior according to the C++ standard because
6735 it writes past the end of the one-element array.
6736 @smallexample
6737 struct S @{ int n, a[1]; @};
6738 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6739 new (s->a)int [32]();
6740 @end smallexample
6741
6742 @item -Wplacement-new=2
6743 At this level, in addition to diagnosing all the same constructs as at level
6744 1, a diagnostic is also issued for placement new expressions that construct
6745 an object in the last member of structure whose type is an array of a single
6746 element and whose size is less than the size of the object being constructed.
6747 While the previous example would be diagnosed, the following construct makes
6748 use of the flexible member array extension to avoid the warning at level 2.
6749 @smallexample
6750 struct S @{ int n, a[]; @};
6751 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6752 new (s->a)int [32]();
6753 @end smallexample
6754
6755 @end table
6756
6757 @item -Wpointer-arith
6758 @opindex Wpointer-arith
6759 @opindex Wno-pointer-arith
6760 Warn about anything that depends on the ``size of'' a function type or
6761 of @code{void}. GNU C assigns these types a size of 1, for
6762 convenience in calculations with @code{void *} pointers and pointers
6763 to functions. In C++, warn also when an arithmetic operation involves
6764 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6765
6766 @item -Wpointer-compare
6767 @opindex Wpointer-compare
6768 @opindex Wno-pointer-compare
6769 Warn if a pointer is compared with a zero character constant. This usually
6770 means that the pointer was meant to be dereferenced. For example:
6771
6772 @smallexample
6773 const char *p = foo ();
6774 if (p == '\0')
6775 return 42;
6776 @end smallexample
6777
6778 Note that the code above is invalid in C++11.
6779
6780 This warning is enabled by default.
6781
6782 @item -Wtype-limits
6783 @opindex Wtype-limits
6784 @opindex Wno-type-limits
6785 Warn if a comparison is always true or always false due to the limited
6786 range of the data type, but do not warn for constant expressions. For
6787 example, warn if an unsigned variable is compared against zero with
6788 @code{<} or @code{>=}. This warning is also enabled by
6789 @option{-Wextra}.
6790
6791 @item -Wabsolute-value @r{(C and Objective-C only)}
6792 @opindex Wabsolute-value
6793 @opindex Wno-absolute-value
6794 Warn for calls to standard functions that compute the absolute value
6795 of an argument when a more appropriate standard function is available.
6796 For example, calling @code{abs(3.14)} triggers the warning because the
6797 appropriate function to call to compute the absolute value of a double
6798 argument is @code{fabs}. The option also triggers warnings when the
6799 argument in a call to such a function has an unsigned type. This
6800 warning can be suppressed with an explicit type cast and it is also
6801 enabled by @option{-Wextra}.
6802
6803 @include cppwarnopts.texi
6804
6805 @item -Wbad-function-cast @r{(C and Objective-C only)}
6806 @opindex Wbad-function-cast
6807 @opindex Wno-bad-function-cast
6808 Warn when a function call is cast to a non-matching type.
6809 For example, warn if a call to a function returning an integer type
6810 is cast to a pointer type.
6811
6812 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6813 @opindex Wc90-c99-compat
6814 @opindex Wno-c90-c99-compat
6815 Warn about features not present in ISO C90, but present in ISO C99.
6816 For instance, warn about use of variable length arrays, @code{long long}
6817 type, @code{bool} type, compound literals, designated initializers, and so
6818 on. This option is independent of the standards mode. Warnings are disabled
6819 in the expression that follows @code{__extension__}.
6820
6821 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6822 @opindex Wc99-c11-compat
6823 @opindex Wno-c99-c11-compat
6824 Warn about features not present in ISO C99, but present in ISO C11.
6825 For instance, warn about use of anonymous structures and unions,
6826 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6827 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6828 and so on. This option is independent of the standards mode. Warnings are
6829 disabled in the expression that follows @code{__extension__}.
6830
6831 @item -Wc++-compat @r{(C and Objective-C only)}
6832 @opindex Wc++-compat
6833 @opindex Wno-c++-compat
6834 Warn about ISO C constructs that are outside of the common subset of
6835 ISO C and ISO C++, e.g.@: request for implicit conversion from
6836 @code{void *} to a pointer to non-@code{void} type.
6837
6838 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6839 @opindex Wc++11-compat
6840 @opindex Wno-c++11-compat
6841 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6842 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6843 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6844 enabled by @option{-Wall}.
6845
6846 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6847 @opindex Wc++14-compat
6848 @opindex Wno-c++14-compat
6849 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6850 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6851
6852 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6853 @opindex Wc++17-compat
6854 @opindex Wno-c++17-compat
6855 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6856 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6857
6858 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6859 @opindex Wc++20-compat
6860 @opindex Wno-c++20-compat
6861 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6862 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6863
6864 @item -Wcast-qual
6865 @opindex Wcast-qual
6866 @opindex Wno-cast-qual
6867 Warn whenever a pointer is cast so as to remove a type qualifier from
6868 the target type. For example, warn if a @code{const char *} is cast
6869 to an ordinary @code{char *}.
6870
6871 Also warn when making a cast that introduces a type qualifier in an
6872 unsafe way. For example, casting @code{char **} to @code{const char **}
6873 is unsafe, as in this example:
6874
6875 @smallexample
6876 /* p is char ** value. */
6877 const char **q = (const char **) p;
6878 /* Assignment of readonly string to const char * is OK. */
6879 *q = "string";
6880 /* Now char** pointer points to read-only memory. */
6881 **p = 'b';
6882 @end smallexample
6883
6884 @item -Wcast-align
6885 @opindex Wcast-align
6886 @opindex Wno-cast-align
6887 Warn whenever a pointer is cast such that the required alignment of the
6888 target is increased. For example, warn if a @code{char *} is cast to
6889 an @code{int *} on machines where integers can only be accessed at
6890 two- or four-byte boundaries.
6891
6892 @item -Wcast-align=strict
6893 @opindex Wcast-align=strict
6894 Warn whenever a pointer is cast such that the required alignment of the
6895 target is increased. For example, warn if a @code{char *} is cast to
6896 an @code{int *} regardless of the target machine.
6897
6898 @item -Wcast-function-type
6899 @opindex Wcast-function-type
6900 @opindex Wno-cast-function-type
6901 Warn when a function pointer is cast to an incompatible function pointer.
6902 In a cast involving function types with a variable argument list only
6903 the types of initial arguments that are provided are considered.
6904 Any parameter of pointer-type matches any other pointer-type. Any benign
6905 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6906 on ILP32 targets. Likewise type qualifiers are ignored. The function
6907 type @code{void (*) (void)} is special and matches everything, which can
6908 be used to suppress this warning.
6909 In a cast involving pointer to member types this warning warns whenever
6910 the type cast is changing the pointer to member type.
6911 This warning is enabled by @option{-Wextra}.
6912
6913 @item -Wwrite-strings
6914 @opindex Wwrite-strings
6915 @opindex Wno-write-strings
6916 When compiling C, give string constants the type @code{const
6917 char[@var{length}]} so that copying the address of one into a
6918 non-@code{const} @code{char *} pointer produces a warning. These
6919 warnings help you find at compile time code that can try to write
6920 into a string constant, but only if you have been very careful about
6921 using @code{const} in declarations and prototypes. Otherwise, it is
6922 just a nuisance. This is why we did not make @option{-Wall} request
6923 these warnings.
6924
6925 When compiling C++, warn about the deprecated conversion from string
6926 literals to @code{char *}. This warning is enabled by default for C++
6927 programs.
6928
6929 @item -Wcatch-value
6930 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6931 @opindex Wcatch-value
6932 @opindex Wno-catch-value
6933 Warn about catch handlers that do not catch via reference.
6934 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6935 warn about polymorphic class types that are caught by value.
6936 With @option{-Wcatch-value=2} warn about all class types that are caught
6937 by value. With @option{-Wcatch-value=3} warn about all types that are
6938 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6939
6940 @item -Wclobbered
6941 @opindex Wclobbered
6942 @opindex Wno-clobbered
6943 Warn for variables that might be changed by @code{longjmp} or
6944 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6945
6946 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6947 @opindex Wconditionally-supported
6948 @opindex Wno-conditionally-supported
6949 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6950
6951 @item -Wconversion
6952 @opindex Wconversion
6953 @opindex Wno-conversion
6954 Warn for implicit conversions that may alter a value. This includes
6955 conversions between real and integer, like @code{abs (x)} when
6956 @code{x} is @code{double}; conversions between signed and unsigned,
6957 like @code{unsigned ui = -1}; and conversions to smaller types, like
6958 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6959 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6960 changed by the conversion like in @code{abs (2.0)}. Warnings about
6961 conversions between signed and unsigned integers can be disabled by
6962 using @option{-Wno-sign-conversion}.
6963
6964 For C++, also warn for confusing overload resolution for user-defined
6965 conversions; and conversions that never use a type conversion
6966 operator: conversions to @code{void}, the same type, a base class or a
6967 reference to them. Warnings about conversions between signed and
6968 unsigned integers are disabled by default in C++ unless
6969 @option{-Wsign-conversion} is explicitly enabled.
6970
6971 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6972 @opindex Wconversion-null
6973 @opindex Wno-conversion-null
6974 Do not warn for conversions between @code{NULL} and non-pointer
6975 types. @option{-Wconversion-null} is enabled by default.
6976
6977 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6978 @opindex Wzero-as-null-pointer-constant
6979 @opindex Wno-zero-as-null-pointer-constant
6980 Warn when a literal @samp{0} is used as null pointer constant. This can
6981 be useful to facilitate the conversion to @code{nullptr} in C++11.
6982
6983 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6984 @opindex Wsubobject-linkage
6985 @opindex Wno-subobject-linkage
6986 Warn if a class type has a base or a field whose type uses the anonymous
6987 namespace or depends on a type with no linkage. If a type A depends on
6988 a type B with no or internal linkage, defining it in multiple
6989 translation units would be an ODR violation because the meaning of B
6990 is different in each translation unit. If A only appears in a single
6991 translation unit, the best way to silence the warning is to give it
6992 internal linkage by putting it in an anonymous namespace as well. The
6993 compiler doesn't give this warning for types defined in the main .C
6994 file, as those are unlikely to have multiple definitions.
6995 @option{-Wsubobject-linkage} is enabled by default.
6996
6997 @item -Wdangling-else
6998 @opindex Wdangling-else
6999 @opindex Wno-dangling-else
7000 Warn about constructions where there may be confusion to which
7001 @code{if} statement an @code{else} branch belongs. Here is an example of
7002 such a case:
7003
7004 @smallexample
7005 @group
7006 @{
7007 if (a)
7008 if (b)
7009 foo ();
7010 else
7011 bar ();
7012 @}
7013 @end group
7014 @end smallexample
7015
7016 In C/C++, every @code{else} branch belongs to the innermost possible
7017 @code{if} statement, which in this example is @code{if (b)}. This is
7018 often not what the programmer expected, as illustrated in the above
7019 example by indentation the programmer chose. When there is the
7020 potential for this confusion, GCC issues a warning when this flag
7021 is specified. To eliminate the warning, add explicit braces around
7022 the innermost @code{if} statement so there is no way the @code{else}
7023 can belong to the enclosing @code{if}. The resulting code
7024 looks like this:
7025
7026 @smallexample
7027 @group
7028 @{
7029 if (a)
7030 @{
7031 if (b)
7032 foo ();
7033 else
7034 bar ();
7035 @}
7036 @}
7037 @end group
7038 @end smallexample
7039
7040 This warning is enabled by @option{-Wparentheses}.
7041
7042 @item -Wdate-time
7043 @opindex Wdate-time
7044 @opindex Wno-date-time
7045 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7046 are encountered as they might prevent bit-wise-identical reproducible
7047 compilations.
7048
7049 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
7050 @opindex Wdelete-incomplete
7051 @opindex Wno-delete-incomplete
7052 Warn when deleting a pointer to incomplete type, which may cause
7053 undefined behavior at runtime. This warning is enabled by default.
7054
7055 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
7056 @opindex Wuseless-cast
7057 @opindex Wno-useless-cast
7058 Warn when an expression is casted to its own type.
7059
7060 @item -Wempty-body
7061 @opindex Wempty-body
7062 @opindex Wno-empty-body
7063 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7064 while} statement. This warning is also enabled by @option{-Wextra}.
7065
7066 @item -Wenum-compare
7067 @opindex Wenum-compare
7068 @opindex Wno-enum-compare
7069 Warn about a comparison between values of different enumerated types.
7070 In C++ enumerated type mismatches in conditional expressions are also
7071 diagnosed and the warning is enabled by default. In C this warning is
7072 enabled by @option{-Wall}.
7073
7074 @item -Wenum-conversion @r{(C, Objective-C only)}
7075 @opindex Wenum-conversion
7076 @opindex Wno-enum-conversion
7077 Warn when a value of enumerated type is implicitly converted to a
7078 different enumerated type. This warning is enabled by @option{-Wextra}.
7079
7080 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7081 @opindex Wextra-semi
7082 @opindex Wno-extra-semi
7083 Warn about redundant semicolon after in-class function definition.
7084
7085 @item -Wjump-misses-init @r{(C, Objective-C only)}
7086 @opindex Wjump-misses-init
7087 @opindex Wno-jump-misses-init
7088 Warn if a @code{goto} statement or a @code{switch} statement jumps
7089 forward across the initialization of a variable, or jumps backward to a
7090 label after the variable has been initialized. This only warns about
7091 variables that are initialized when they are declared. This warning is
7092 only supported for C and Objective-C; in C++ this sort of branch is an
7093 error in any case.
7094
7095 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7096 can be disabled with the @option{-Wno-jump-misses-init} option.
7097
7098 @item -Wsign-compare
7099 @opindex Wsign-compare
7100 @opindex Wno-sign-compare
7101 @cindex warning for comparison of signed and unsigned values
7102 @cindex comparison of signed and unsigned values, warning
7103 @cindex signed and unsigned values, comparison warning
7104 Warn when a comparison between signed and unsigned values could produce
7105 an incorrect result when the signed value is converted to unsigned.
7106 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7107 also enabled by @option{-Wextra}.
7108
7109 @item -Wsign-conversion
7110 @opindex Wsign-conversion
7111 @opindex Wno-sign-conversion
7112 Warn for implicit conversions that may change the sign of an integer
7113 value, like assigning a signed integer expression to an unsigned
7114 integer variable. An explicit cast silences the warning. In C, this
7115 option is enabled also by @option{-Wconversion}.
7116
7117 @item -Wfloat-conversion
7118 @opindex Wfloat-conversion
7119 @opindex Wno-float-conversion
7120 Warn for implicit conversions that reduce the precision of a real value.
7121 This includes conversions from real to integer, and from higher precision
7122 real to lower precision real values. This option is also enabled by
7123 @option{-Wconversion}.
7124
7125 @item -Wno-scalar-storage-order
7126 @opindex Wno-scalar-storage-order
7127 @opindex Wscalar-storage-order
7128 Do not warn on suspicious constructs involving reverse scalar storage order.
7129
7130 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7131 @opindex Wsized-deallocation
7132 @opindex Wno-sized-deallocation
7133 Warn about a definition of an unsized deallocation function
7134 @smallexample
7135 void operator delete (void *) noexcept;
7136 void operator delete[] (void *) noexcept;
7137 @end smallexample
7138 without a definition of the corresponding sized deallocation function
7139 @smallexample
7140 void operator delete (void *, std::size_t) noexcept;
7141 void operator delete[] (void *, std::size_t) noexcept;
7142 @end smallexample
7143 or vice versa. Enabled by @option{-Wextra} along with
7144 @option{-fsized-deallocation}.
7145
7146 @item -Wsizeof-pointer-div
7147 @opindex Wsizeof-pointer-div
7148 @opindex Wno-sizeof-pointer-div
7149 Warn for suspicious divisions of two sizeof expressions that divide
7150 the pointer size by the element size, which is the usual way to compute
7151 the array size but won't work out correctly with pointers. This warning
7152 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7153 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7154
7155 @item -Wsizeof-pointer-memaccess
7156 @opindex Wsizeof-pointer-memaccess
7157 @opindex Wno-sizeof-pointer-memaccess
7158 Warn for suspicious length parameters to certain string and memory built-in
7159 functions if the argument uses @code{sizeof}. This warning triggers for
7160 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7161 an array, but a pointer, and suggests a possible fix, or about
7162 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7163 also warns about calls to bounded string copy functions like @code{strncat}
7164 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7165 the source array. For example, in the following function the call to
7166 @code{strncat} specifies the size of the source string as the bound. That
7167 is almost certainly a mistake and so the call is diagnosed.
7168 @smallexample
7169 void make_file (const char *name)
7170 @{
7171 char path[PATH_MAX];
7172 strncpy (path, name, sizeof path - 1);
7173 strncat (path, ".text", sizeof ".text");
7174 @dots{}
7175 @}
7176 @end smallexample
7177
7178 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7179
7180 @item -Wsizeof-array-argument
7181 @opindex Wsizeof-array-argument
7182 @opindex Wno-sizeof-array-argument
7183 Warn when the @code{sizeof} operator is applied to a parameter that is
7184 declared as an array in a function definition. This warning is enabled by
7185 default for C and C++ programs.
7186
7187 @item -Wmemset-elt-size
7188 @opindex Wmemset-elt-size
7189 @opindex Wno-memset-elt-size
7190 Warn for suspicious calls to the @code{memset} built-in function, if the
7191 first argument references an array, and the third argument is a number
7192 equal to the number of elements, but not equal to the size of the array
7193 in memory. This indicates that the user has omitted a multiplication by
7194 the element size. This warning is enabled by @option{-Wall}.
7195
7196 @item -Wmemset-transposed-args
7197 @opindex Wmemset-transposed-args
7198 @opindex Wno-memset-transposed-args
7199 Warn for suspicious calls to the @code{memset} built-in function where
7200 the second argument is not zero and the third argument is zero. For
7201 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7202 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7203 is only emitted if the third argument is a literal zero. Otherwise, if
7204 it is an expression that is folded to zero, or a cast of zero to some
7205 type, it is far less likely that the arguments have been mistakenly
7206 transposed and no warning is emitted. This warning is enabled
7207 by @option{-Wall}.
7208
7209 @item -Waddress
7210 @opindex Waddress
7211 @opindex Wno-address
7212 Warn about suspicious uses of memory addresses. These include using
7213 the address of a function in a conditional expression, such as
7214 @code{void func(void); if (func)}, and comparisons against the memory
7215 address of a string literal, such as @code{if (x == "abc")}. Such
7216 uses typically indicate a programmer error: the address of a function
7217 always evaluates to true, so their use in a conditional usually
7218 indicate that the programmer forgot the parentheses in a function
7219 call; and comparisons against string literals result in unspecified
7220 behavior and are not portable in C, so they usually indicate that the
7221 programmer intended to use @code{strcmp}. This warning is enabled by
7222 @option{-Wall}.
7223
7224 @item -Waddress-of-packed-member
7225 @opindex Waddress-of-packed-member
7226 @opindex Wno-address-of-packed-member
7227 Warn when the address of packed member of struct or union is taken,
7228 which usually results in an unaligned pointer value. This is
7229 enabled by default.
7230
7231 @item -Wlogical-op
7232 @opindex Wlogical-op
7233 @opindex Wno-logical-op
7234 Warn about suspicious uses of logical operators in expressions.
7235 This includes using logical operators in contexts where a
7236 bit-wise operator is likely to be expected. Also warns when
7237 the operands of a logical operator are the same:
7238 @smallexample
7239 extern int a;
7240 if (a < 0 && a < 0) @{ @dots{} @}
7241 @end smallexample
7242
7243 @item -Wlogical-not-parentheses
7244 @opindex Wlogical-not-parentheses
7245 @opindex Wno-logical-not-parentheses
7246 Warn about logical not used on the left hand side operand of a comparison.
7247 This option does not warn if the right operand is considered to be a boolean
7248 expression. Its purpose is to detect suspicious code like the following:
7249 @smallexample
7250 int a;
7251 @dots{}
7252 if (!a > 1) @{ @dots{} @}
7253 @end smallexample
7254
7255 It is possible to suppress the warning by wrapping the LHS into
7256 parentheses:
7257 @smallexample
7258 if ((!a) > 1) @{ @dots{} @}
7259 @end smallexample
7260
7261 This warning is enabled by @option{-Wall}.
7262
7263 @item -Waggregate-return
7264 @opindex Waggregate-return
7265 @opindex Wno-aggregate-return
7266 Warn if any functions that return structures or unions are defined or
7267 called. (In languages where you can return an array, this also elicits
7268 a warning.)
7269
7270 @item -Wno-aggressive-loop-optimizations
7271 @opindex Wno-aggressive-loop-optimizations
7272 @opindex Waggressive-loop-optimizations
7273 Warn if in a loop with constant number of iterations the compiler detects
7274 undefined behavior in some statement during one or more of the iterations.
7275
7276 @item -Wno-attributes
7277 @opindex Wno-attributes
7278 @opindex Wattributes
7279 Do not warn if an unexpected @code{__attribute__} is used, such as
7280 unrecognized attributes, function attributes applied to variables,
7281 etc. This does not stop errors for incorrect use of supported
7282 attributes.
7283
7284 @item -Wno-builtin-declaration-mismatch
7285 @opindex Wno-builtin-declaration-mismatch
7286 @opindex Wbuiltin-declaration-mismatch
7287 Warn if a built-in function is declared with an incompatible signature
7288 or as a non-function, or when a built-in function declared with a type
7289 that does not include a prototype is called with arguments whose promoted
7290 types do not match those expected by the function. When @option{-Wextra}
7291 is specified, also warn when a built-in function that takes arguments is
7292 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7293 warning is enabled by default. To avoid the warning include the appropriate
7294 header to bring the prototypes of built-in functions into scope.
7295
7296 For example, the call to @code{memset} below is diagnosed by the warning
7297 because the function expects a value of type @code{size_t} as its argument
7298 but the type of @code{32} is @code{int}. With @option{-Wextra},
7299 the declaration of the function is diagnosed as well.
7300 @smallexample
7301 extern void* memset ();
7302 void f (void *d)
7303 @{
7304 memset (d, '\0', 32);
7305 @}
7306 @end smallexample
7307
7308 @item -Wno-builtin-macro-redefined
7309 @opindex Wno-builtin-macro-redefined
7310 @opindex Wbuiltin-macro-redefined
7311 Do not warn if certain built-in macros are redefined. This suppresses
7312 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7313 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7314
7315 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7316 @opindex Wstrict-prototypes
7317 @opindex Wno-strict-prototypes
7318 Warn if a function is declared or defined without specifying the
7319 argument types. (An old-style function definition is permitted without
7320 a warning if preceded by a declaration that specifies the argument
7321 types.)
7322
7323 @item -Wold-style-declaration @r{(C and Objective-C only)}
7324 @opindex Wold-style-declaration
7325 @opindex Wno-old-style-declaration
7326 Warn for obsolescent usages, according to the C Standard, in a
7327 declaration. For example, warn if storage-class specifiers like
7328 @code{static} are not the first things in a declaration. This warning
7329 is also enabled by @option{-Wextra}.
7330
7331 @item -Wold-style-definition @r{(C and Objective-C only)}
7332 @opindex Wold-style-definition
7333 @opindex Wno-old-style-definition
7334 Warn if an old-style function definition is used. A warning is given
7335 even if there is a previous prototype.
7336
7337 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7338 @opindex Wmissing-parameter-type
7339 @opindex Wno-missing-parameter-type
7340 A function parameter is declared without a type specifier in K&R-style
7341 functions:
7342
7343 @smallexample
7344 void foo(bar) @{ @}
7345 @end smallexample
7346
7347 This warning is also enabled by @option{-Wextra}.
7348
7349 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7350 @opindex Wmissing-prototypes
7351 @opindex Wno-missing-prototypes
7352 Warn if a global function is defined without a previous prototype
7353 declaration. This warning is issued even if the definition itself
7354 provides a prototype. Use this option to detect global functions
7355 that do not have a matching prototype declaration in a header file.
7356 This option is not valid for C++ because all function declarations
7357 provide prototypes and a non-matching declaration declares an
7358 overload rather than conflict with an earlier declaration.
7359 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7360
7361 @item -Wmissing-declarations
7362 @opindex Wmissing-declarations
7363 @opindex Wno-missing-declarations
7364 Warn if a global function is defined without a previous declaration.
7365 Do so even if the definition itself provides a prototype.
7366 Use this option to detect global functions that are not declared in
7367 header files. In C, no warnings are issued for functions with previous
7368 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7369 missing prototypes. In C++, no warnings are issued for function templates,
7370 or for inline functions, or for functions in anonymous namespaces.
7371
7372 @item -Wmissing-field-initializers
7373 @opindex Wmissing-field-initializers
7374 @opindex Wno-missing-field-initializers
7375 @opindex W
7376 @opindex Wextra
7377 @opindex Wno-extra
7378 Warn if a structure's initializer has some fields missing. For
7379 example, the following code causes such a warning, because
7380 @code{x.h} is implicitly zero:
7381
7382 @smallexample
7383 struct s @{ int f, g, h; @};
7384 struct s x = @{ 3, 4 @};
7385 @end smallexample
7386
7387 This option does not warn about designated initializers, so the following
7388 modification does not trigger a warning:
7389
7390 @smallexample
7391 struct s @{ int f, g, h; @};
7392 struct s x = @{ .f = 3, .g = 4 @};
7393 @end smallexample
7394
7395 In C this option does not warn about the universal zero initializer
7396 @samp{@{ 0 @}}:
7397
7398 @smallexample
7399 struct s @{ int f, g, h; @};
7400 struct s x = @{ 0 @};
7401 @end smallexample
7402
7403 Likewise, in C++ this option does not warn about the empty @{ @}
7404 initializer, for example:
7405
7406 @smallexample
7407 struct s @{ int f, g, h; @};
7408 s x = @{ @};
7409 @end smallexample
7410
7411 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7412 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7413
7414 @item -Wno-multichar
7415 @opindex Wno-multichar
7416 @opindex Wmultichar
7417 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7418 Usually they indicate a typo in the user's code, as they have
7419 implementation-defined values, and should not be used in portable code.
7420
7421 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7422 @opindex Wnormalized=
7423 @opindex Wnormalized
7424 @opindex Wno-normalized
7425 @cindex NFC
7426 @cindex NFKC
7427 @cindex character set, input normalization
7428 In ISO C and ISO C++, two identifiers are different if they are
7429 different sequences of characters. However, sometimes when characters
7430 outside the basic ASCII character set are used, you can have two
7431 different character sequences that look the same. To avoid confusion,
7432 the ISO 10646 standard sets out some @dfn{normalization rules} which
7433 when applied ensure that two sequences that look the same are turned into
7434 the same sequence. GCC can warn you if you are using identifiers that
7435 have not been normalized; this option controls that warning.
7436
7437 There are four levels of warning supported by GCC@. The default is
7438 @option{-Wnormalized=nfc}, which warns about any identifier that is
7439 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7440 recommended form for most uses. It is equivalent to
7441 @option{-Wnormalized}.
7442
7443 Unfortunately, there are some characters allowed in identifiers by
7444 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7445 identifiers. That is, there's no way to use these symbols in portable
7446 ISO C or C++ and have all your identifiers in NFC@.
7447 @option{-Wnormalized=id} suppresses the warning for these characters.
7448 It is hoped that future versions of the standards involved will correct
7449 this, which is why this option is not the default.
7450
7451 You can switch the warning off for all characters by writing
7452 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7453 only do this if you are using some other normalization scheme (like
7454 ``D''), because otherwise you can easily create bugs that are
7455 literally impossible to see.
7456
7457 Some characters in ISO 10646 have distinct meanings but look identical
7458 in some fonts or display methodologies, especially once formatting has
7459 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7460 LETTER N'', displays just like a regular @code{n} that has been
7461 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7462 normalization scheme to convert all these into a standard form as
7463 well, and GCC warns if your code is not in NFKC if you use
7464 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7465 about every identifier that contains the letter O because it might be
7466 confused with the digit 0, and so is not the default, but may be
7467 useful as a local coding convention if the programming environment
7468 cannot be fixed to display these characters distinctly.
7469
7470 @item -Wno-attribute-warning
7471 @opindex Wno-attribute-warning
7472 @opindex Wattribute-warning
7473 Do not warn about usage of functions (@pxref{Function Attributes})
7474 declared with @code{warning} attribute. By default, this warning is
7475 enabled. @option{-Wno-attribute-warning} can be used to disable the
7476 warning or @option{-Wno-error=attribute-warning} can be used to
7477 disable the error when compiled with @option{-Werror} flag.
7478
7479 @item -Wno-deprecated
7480 @opindex Wno-deprecated
7481 @opindex Wdeprecated
7482 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7483
7484 @item -Wno-deprecated-declarations
7485 @opindex Wno-deprecated-declarations
7486 @opindex Wdeprecated-declarations
7487 Do not warn about uses of functions (@pxref{Function Attributes}),
7488 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7489 Attributes}) marked as deprecated by using the @code{deprecated}
7490 attribute.
7491
7492 @item -Wno-overflow
7493 @opindex Wno-overflow
7494 @opindex Woverflow
7495 Do not warn about compile-time overflow in constant expressions.
7496
7497 @item -Wno-odr
7498 @opindex Wno-odr
7499 @opindex Wodr
7500 Warn about One Definition Rule violations during link-time optimization.
7501 Enabled by default.
7502
7503 @item -Wopenmp-simd
7504 @opindex Wopenmp-simd
7505 @opindex Wno-openmp-simd
7506 Warn if the vectorizer cost model overrides the OpenMP
7507 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7508 option can be used to relax the cost model.
7509
7510 @item -Woverride-init @r{(C and Objective-C only)}
7511 @opindex Woverride-init
7512 @opindex Wno-override-init
7513 @opindex W
7514 @opindex Wextra
7515 @opindex Wno-extra
7516 Warn if an initialized field without side effects is overridden when
7517 using designated initializers (@pxref{Designated Inits, , Designated
7518 Initializers}).
7519
7520 This warning is included in @option{-Wextra}. To get other
7521 @option{-Wextra} warnings without this one, use @option{-Wextra
7522 -Wno-override-init}.
7523
7524 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7525 @opindex Woverride-init-side-effects
7526 @opindex Wno-override-init-side-effects
7527 Warn if an initialized field with side effects is overridden when
7528 using designated initializers (@pxref{Designated Inits, , Designated
7529 Initializers}). This warning is enabled by default.
7530
7531 @item -Wpacked
7532 @opindex Wpacked
7533 @opindex Wno-packed
7534 Warn if a structure is given the packed attribute, but the packed
7535 attribute has no effect on the layout or size of the structure.
7536 Such structures may be mis-aligned for little benefit. For
7537 instance, in this code, the variable @code{f.x} in @code{struct bar}
7538 is misaligned even though @code{struct bar} does not itself
7539 have the packed attribute:
7540
7541 @smallexample
7542 @group
7543 struct foo @{
7544 int x;
7545 char a, b, c, d;
7546 @} __attribute__((packed));
7547 struct bar @{
7548 char z;
7549 struct foo f;
7550 @};
7551 @end group
7552 @end smallexample
7553
7554 @item -Wpacked-bitfield-compat
7555 @opindex Wpacked-bitfield-compat
7556 @opindex Wno-packed-bitfield-compat
7557 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7558 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7559 the change can lead to differences in the structure layout. GCC
7560 informs you when the offset of such a field has changed in GCC 4.4.
7561 For example there is no longer a 4-bit padding between field @code{a}
7562 and @code{b} in this structure:
7563
7564 @smallexample
7565 struct foo
7566 @{
7567 char a:4;
7568 char b:8;
7569 @} __attribute__ ((packed));
7570 @end smallexample
7571
7572 This warning is enabled by default. Use
7573 @option{-Wno-packed-bitfield-compat} to disable this warning.
7574
7575 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7576 @opindex Wpacked-not-aligned
7577 @opindex Wno-packed-not-aligned
7578 Warn if a structure field with explicitly specified alignment in a
7579 packed struct or union is misaligned. For example, a warning will
7580 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7581 'struct S' is less than 8}, in this code:
7582
7583 @smallexample
7584 @group
7585 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7586 struct __attribute__ ((packed)) S @{
7587 struct S8 s8;
7588 @};
7589 @end group
7590 @end smallexample
7591
7592 This warning is enabled by @option{-Wall}.
7593
7594 @item -Wpadded
7595 @opindex Wpadded
7596 @opindex Wno-padded
7597 Warn if padding is included in a structure, either to align an element
7598 of the structure or to align the whole structure. Sometimes when this
7599 happens it is possible to rearrange the fields of the structure to
7600 reduce the padding and so make the structure smaller.
7601
7602 @item -Wredundant-decls
7603 @opindex Wredundant-decls
7604 @opindex Wno-redundant-decls
7605 Warn if anything is declared more than once in the same scope, even in
7606 cases where multiple declaration is valid and changes nothing.
7607
7608 @item -Wno-restrict
7609 @opindex Wrestrict
7610 @opindex Wno-restrict
7611 Warn when an object referenced by a @code{restrict}-qualified parameter
7612 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7613 argument, or when copies between such objects overlap. For example,
7614 the call to the @code{strcpy} function below attempts to truncate the string
7615 by replacing its initial characters with the last four. However, because
7616 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7617 the call is diagnosed.
7618
7619 @smallexample
7620 void foo (void)
7621 @{
7622 char a[] = "abcd1234";
7623 strcpy (a, a + 4);
7624 @dots{}
7625 @}
7626 @end smallexample
7627 The @option{-Wrestrict} option detects some instances of simple overlap
7628 even without optimization but works best at @option{-O2} and above. It
7629 is included in @option{-Wall}.
7630
7631 @item -Wnested-externs @r{(C and Objective-C only)}
7632 @opindex Wnested-externs
7633 @opindex Wno-nested-externs
7634 Warn if an @code{extern} declaration is encountered within a function.
7635
7636 @item -Wno-inherited-variadic-ctor
7637 @opindex Winherited-variadic-ctor
7638 @opindex Wno-inherited-variadic-ctor
7639 Suppress warnings about use of C++11 inheriting constructors when the
7640 base class inherited from has a C variadic constructor; the warning is
7641 on by default because the ellipsis is not inherited.
7642
7643 @item -Winline
7644 @opindex Winline
7645 @opindex Wno-inline
7646 Warn if a function that is declared as inline cannot be inlined.
7647 Even with this option, the compiler does not warn about failures to
7648 inline functions declared in system headers.
7649
7650 The compiler uses a variety of heuristics to determine whether or not
7651 to inline a function. For example, the compiler takes into account
7652 the size of the function being inlined and the amount of inlining
7653 that has already been done in the current function. Therefore,
7654 seemingly insignificant changes in the source program can cause the
7655 warnings produced by @option{-Winline} to appear or disappear.
7656
7657 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7658 @opindex Wno-invalid-offsetof
7659 @opindex Winvalid-offsetof
7660 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7661 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7662 to a non-standard-layout type is undefined. In existing C++ implementations,
7663 however, @code{offsetof} typically gives meaningful results.
7664 This flag is for users who are aware that they are
7665 writing nonportable code and who have deliberately chosen to ignore the
7666 warning about it.
7667
7668 The restrictions on @code{offsetof} may be relaxed in a future version
7669 of the C++ standard.
7670
7671 @item -Wint-in-bool-context
7672 @opindex Wint-in-bool-context
7673 @opindex Wno-int-in-bool-context
7674 Warn for suspicious use of integer values where boolean values are expected,
7675 such as conditional expressions (?:) using non-boolean integer constants in
7676 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7677 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7678 for all kinds of multiplications regardless of the data type.
7679 This warning is enabled by @option{-Wall}.
7680
7681 @item -Wno-int-to-pointer-cast
7682 @opindex Wno-int-to-pointer-cast
7683 @opindex Wint-to-pointer-cast
7684 Suppress warnings from casts to pointer type of an integer of a
7685 different size. In C++, casting to a pointer type of smaller size is
7686 an error. @option{Wint-to-pointer-cast} is enabled by default.
7687
7688
7689 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7690 @opindex Wno-pointer-to-int-cast
7691 @opindex Wpointer-to-int-cast
7692 Suppress warnings from casts from a pointer to an integer type of a
7693 different size.
7694
7695 @item -Winvalid-pch
7696 @opindex Winvalid-pch
7697 @opindex Wno-invalid-pch
7698 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7699 the search path but cannot be used.
7700
7701 @item -Wlong-long
7702 @opindex Wlong-long
7703 @opindex Wno-long-long
7704 Warn if @code{long long} type is used. This is enabled by either
7705 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7706 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7707
7708 @item -Wvariadic-macros
7709 @opindex Wvariadic-macros
7710 @opindex Wno-variadic-macros
7711 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7712 alternate syntax is used in ISO C99 mode. This is enabled by either
7713 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7714 messages, use @option{-Wno-variadic-macros}.
7715
7716 @item -Wvarargs
7717 @opindex Wvarargs
7718 @opindex Wno-varargs
7719 Warn upon questionable usage of the macros used to handle variable
7720 arguments like @code{va_start}. This is default. To inhibit the
7721 warning messages, use @option{-Wno-varargs}.
7722
7723 @item -Wvector-operation-performance
7724 @opindex Wvector-operation-performance
7725 @opindex Wno-vector-operation-performance
7726 Warn if vector operation is not implemented via SIMD capabilities of the
7727 architecture. Mainly useful for the performance tuning.
7728 Vector operation can be implemented @code{piecewise}, which means that the
7729 scalar operation is performed on every vector element;
7730 @code{in parallel}, which means that the vector operation is implemented
7731 using scalars of wider type, which normally is more performance efficient;
7732 and @code{as a single scalar}, which means that vector fits into a
7733 scalar type.
7734
7735 @item -Wno-virtual-move-assign
7736 @opindex Wvirtual-move-assign
7737 @opindex Wno-virtual-move-assign
7738 Suppress warnings about inheriting from a virtual base with a
7739 non-trivial C++11 move assignment operator. This is dangerous because
7740 if the virtual base is reachable along more than one path, it is
7741 moved multiple times, which can mean both objects end up in the
7742 moved-from state. If the move assignment operator is written to avoid
7743 moving from a moved-from object, this warning can be disabled.
7744
7745 @item -Wvla
7746 @opindex Wvla
7747 @opindex Wno-vla
7748 Warn if a variable-length array is used in the code.
7749 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7750 the variable-length array.
7751
7752 @item -Wvla-larger-than=@var{byte-size}
7753 @opindex Wvla-larger-than=
7754 @opindex Wno-vla-larger-than
7755 If this option is used, the compiler will warn for declarations of
7756 variable-length arrays whose size is either unbounded, or bounded
7757 by an argument that allows the array size to exceed @var{byte-size}
7758 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7759 works, but with variable-length arrays.
7760
7761 Note that GCC may optimize small variable-length arrays of a known
7762 value into plain arrays, so this warning may not get triggered for
7763 such arrays.
7764
7765 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7766 is typically only effective when @option{-ftree-vrp} is active (default
7767 for @option{-O2} and above).
7768
7769 See also @option{-Walloca-larger-than=@var{byte-size}}.
7770
7771 @item -Wno-vla-larger-than
7772 @opindex Wno-vla-larger-than
7773 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7774 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7775
7776 @item -Wvolatile-register-var
7777 @opindex Wvolatile-register-var
7778 @opindex Wno-volatile-register-var
7779 Warn if a register variable is declared volatile. The volatile
7780 modifier does not inhibit all optimizations that may eliminate reads
7781 and/or writes to register variables. This warning is enabled by
7782 @option{-Wall}.
7783
7784 @item -Wdisabled-optimization
7785 @opindex Wdisabled-optimization
7786 @opindex Wno-disabled-optimization
7787 Warn if a requested optimization pass is disabled. This warning does
7788 not generally indicate that there is anything wrong with your code; it
7789 merely indicates that GCC's optimizers are unable to handle the code
7790 effectively. Often, the problem is that your code is too big or too
7791 complex; GCC refuses to optimize programs when the optimization
7792 itself is likely to take inordinate amounts of time.
7793
7794 @item -Wpointer-sign @r{(C and Objective-C only)}
7795 @opindex Wpointer-sign
7796 @opindex Wno-pointer-sign
7797 Warn for pointer argument passing or assignment with different signedness.
7798 This option is only supported for C and Objective-C@. It is implied by
7799 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7800 @option{-Wno-pointer-sign}.
7801
7802 @item -Wstack-protector
7803 @opindex Wstack-protector
7804 @opindex Wno-stack-protector
7805 This option is only active when @option{-fstack-protector} is active. It
7806 warns about functions that are not protected against stack smashing.
7807
7808 @item -Woverlength-strings
7809 @opindex Woverlength-strings
7810 @opindex Wno-overlength-strings
7811 Warn about string constants that are longer than the ``minimum
7812 maximum'' length specified in the C standard. Modern compilers
7813 generally allow string constants that are much longer than the
7814 standard's minimum limit, but very portable programs should avoid
7815 using longer strings.
7816
7817 The limit applies @emph{after} string constant concatenation, and does
7818 not count the trailing NUL@. In C90, the limit was 509 characters; in
7819 C99, it was raised to 4095. C++98 does not specify a normative
7820 minimum maximum, so we do not diagnose overlength strings in C++@.
7821
7822 This option is implied by @option{-Wpedantic}, and can be disabled with
7823 @option{-Wno-overlength-strings}.
7824
7825 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7826 @opindex Wunsuffixed-float-constants
7827 @opindex Wno-unsuffixed-float-constants
7828
7829 Issue a warning for any floating constant that does not have
7830 a suffix. When used together with @option{-Wsystem-headers} it
7831 warns about such constants in system header files. This can be useful
7832 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7833 from the decimal floating-point extension to C99.
7834
7835 @item -Wno-designated-init @r{(C and Objective-C only)}
7836 Suppress warnings when a positional initializer is used to initialize
7837 a structure that has been marked with the @code{designated_init}
7838 attribute.
7839
7840 @item -Whsa
7841 Issue a warning when HSAIL cannot be emitted for the compiled function or
7842 OpenMP construct.
7843
7844 @end table
7845
7846 @node Debugging Options
7847 @section Options for Debugging Your Program
7848 @cindex options, debugging
7849 @cindex debugging information options
7850
7851 To tell GCC to emit extra information for use by a debugger, in almost
7852 all cases you need only to add @option{-g} to your other options.
7853
7854 GCC allows you to use @option{-g} with
7855 @option{-O}. The shortcuts taken by optimized code may occasionally
7856 be surprising: some variables you declared may not exist
7857 at all; flow of control may briefly move where you did not expect it;
7858 some statements may not be executed because they compute constant
7859 results or their values are already at hand; some statements may
7860 execute in different places because they have been moved out of loops.
7861 Nevertheless it is possible to debug optimized output. This makes
7862 it reasonable to use the optimizer for programs that might have bugs.
7863
7864 If you are not using some other optimization option, consider
7865 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7866 With no @option{-O} option at all, some compiler passes that collect
7867 information useful for debugging do not run at all, so that
7868 @option{-Og} may result in a better debugging experience.
7869
7870 @table @gcctabopt
7871 @item -g
7872 @opindex g
7873 Produce debugging information in the operating system's native format
7874 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7875 information.
7876
7877 On most systems that use stabs format, @option{-g} enables use of extra
7878 debugging information that only GDB can use; this extra information
7879 makes debugging work better in GDB but probably makes other debuggers
7880 crash or
7881 refuse to read the program. If you want to control for certain whether
7882 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7883 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7884
7885 @item -ggdb
7886 @opindex ggdb
7887 Produce debugging information for use by GDB@. This means to use the
7888 most expressive format available (DWARF, stabs, or the native format
7889 if neither of those are supported), including GDB extensions if at all
7890 possible.
7891
7892 @item -gdwarf
7893 @itemx -gdwarf-@var{version}
7894 @opindex gdwarf
7895 Produce debugging information in DWARF format (if that is supported).
7896 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7897 for most targets is 4. DWARF Version 5 is only experimental.
7898
7899 Note that with DWARF Version 2, some ports require and always
7900 use some non-conflicting DWARF 3 extensions in the unwind tables.
7901
7902 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7903 for maximum benefit.
7904
7905 GCC no longer supports DWARF Version 1, which is substantially
7906 different than Version 2 and later. For historical reasons, some
7907 other DWARF-related options such as
7908 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7909 in their names, but apply to all currently-supported versions of DWARF.
7910
7911 @item -gstabs
7912 @opindex gstabs
7913 Produce debugging information in stabs format (if that is supported),
7914 without GDB extensions. This is the format used by DBX on most BSD
7915 systems. On MIPS, Alpha and System V Release 4 systems this option
7916 produces stabs debugging output that is not understood by DBX@.
7917 On System V Release 4 systems this option requires the GNU assembler.
7918
7919 @item -gstabs+
7920 @opindex gstabs+
7921 Produce debugging information in stabs format (if that is supported),
7922 using GNU extensions understood only by the GNU debugger (GDB)@. The
7923 use of these extensions is likely to make other debuggers crash or
7924 refuse to read the program.
7925
7926 @item -gxcoff
7927 @opindex gxcoff
7928 Produce debugging information in XCOFF format (if that is supported).
7929 This is the format used by the DBX debugger on IBM RS/6000 systems.
7930
7931 @item -gxcoff+
7932 @opindex gxcoff+
7933 Produce debugging information in XCOFF format (if that is supported),
7934 using GNU extensions understood only by the GNU debugger (GDB)@. The
7935 use of these extensions is likely to make other debuggers crash or
7936 refuse to read the program, and may cause assemblers other than the GNU
7937 assembler (GAS) to fail with an error.
7938
7939 @item -gvms
7940 @opindex gvms
7941 Produce debugging information in Alpha/VMS debug format (if that is
7942 supported). This is the format used by DEBUG on Alpha/VMS systems.
7943
7944 @item -g@var{level}
7945 @itemx -ggdb@var{level}
7946 @itemx -gstabs@var{level}
7947 @itemx -gxcoff@var{level}
7948 @itemx -gvms@var{level}
7949 Request debugging information and also use @var{level} to specify how
7950 much information. The default level is 2.
7951
7952 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7953 @option{-g}.
7954
7955 Level 1 produces minimal information, enough for making backtraces in
7956 parts of the program that you don't plan to debug. This includes
7957 descriptions of functions and external variables, and line number
7958 tables, but no information about local variables.
7959
7960 Level 3 includes extra information, such as all the macro definitions
7961 present in the program. Some debuggers support macro expansion when
7962 you use @option{-g3}.
7963
7964 If you use multiple @option{-g} options, with or without level numbers,
7965 the last such option is the one that is effective.
7966
7967 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7968 confusion with @option{-gdwarf-@var{level}}.
7969 Instead use an additional @option{-g@var{level}} option to change the
7970 debug level for DWARF.
7971
7972 @item -fno-eliminate-unused-debug-symbols
7973 @opindex feliminate-unused-debug-symbols
7974 @opindex fno-eliminate-unused-debug-symbols
7975 By default, no debug information is produced for symbols that are not actually
7976 used. Use this option if you want debug information for all symbols.
7977
7978 @item -femit-class-debug-always
7979 @opindex femit-class-debug-always
7980 Instead of emitting debugging information for a C++ class in only one
7981 object file, emit it in all object files using the class. This option
7982 should be used only with debuggers that are unable to handle the way GCC
7983 normally emits debugging information for classes because using this
7984 option increases the size of debugging information by as much as a
7985 factor of two.
7986
7987 @item -fno-merge-debug-strings
7988 @opindex fmerge-debug-strings
7989 @opindex fno-merge-debug-strings
7990 Direct the linker to not merge together strings in the debugging
7991 information that are identical in different object files. Merging is
7992 not supported by all assemblers or linkers. Merging decreases the size
7993 of the debug information in the output file at the cost of increasing
7994 link processing time. Merging is enabled by default.
7995
7996 @item -fdebug-prefix-map=@var{old}=@var{new}
7997 @opindex fdebug-prefix-map
7998 When compiling files residing in directory @file{@var{old}}, record
7999 debugging information describing them as if the files resided in
8000 directory @file{@var{new}} instead. This can be used to replace a
8001 build-time path with an install-time path in the debug info. It can
8002 also be used to change an absolute path to a relative path by using
8003 @file{.} for @var{new}. This can give more reproducible builds, which
8004 are location independent, but may require an extra command to tell GDB
8005 where to find the source files. See also @option{-ffile-prefix-map}.
8006
8007 @item -fvar-tracking
8008 @opindex fvar-tracking
8009 Run variable tracking pass. It computes where variables are stored at each
8010 position in code. Better debugging information is then generated
8011 (if the debugging information format supports this information).
8012
8013 It is enabled by default when compiling with optimization (@option{-Os},
8014 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8015 the debug info format supports it.
8016
8017 @item -fvar-tracking-assignments
8018 @opindex fvar-tracking-assignments
8019 @opindex fno-var-tracking-assignments
8020 Annotate assignments to user variables early in the compilation and
8021 attempt to carry the annotations over throughout the compilation all the
8022 way to the end, in an attempt to improve debug information while
8023 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
8024
8025 It can be enabled even if var-tracking is disabled, in which case
8026 annotations are created and maintained, but discarded at the end.
8027 By default, this flag is enabled together with @option{-fvar-tracking},
8028 except when selective scheduling is enabled.
8029
8030 @item -gsplit-dwarf
8031 @opindex gsplit-dwarf
8032 Separate as much DWARF debugging information as possible into a
8033 separate output file with the extension @file{.dwo}. This option allows
8034 the build system to avoid linking files with debug information. To
8035 be useful, this option requires a debugger capable of reading @file{.dwo}
8036 files.
8037
8038 @item -gdescribe-dies
8039 @opindex gdescribe-dies
8040 Add description attributes to some DWARF DIEs that have no name attribute,
8041 such as artificial variables, external references and call site
8042 parameter DIEs.
8043
8044 @item -gpubnames
8045 @opindex gpubnames
8046 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8047
8048 @item -ggnu-pubnames
8049 @opindex ggnu-pubnames
8050 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8051 suitable for conversion into a GDB@ index. This option is only useful
8052 with a linker that can produce GDB@ index version 7.
8053
8054 @item -fdebug-types-section
8055 @opindex fdebug-types-section
8056 @opindex fno-debug-types-section
8057 When using DWARF Version 4 or higher, type DIEs can be put into
8058 their own @code{.debug_types} section instead of making them part of the
8059 @code{.debug_info} section. It is more efficient to put them in a separate
8060 comdat section since the linker can then remove duplicates.
8061 But not all DWARF consumers support @code{.debug_types} sections yet
8062 and on some objects @code{.debug_types} produces larger instead of smaller
8063 debugging information.
8064
8065 @item -grecord-gcc-switches
8066 @itemx -gno-record-gcc-switches
8067 @opindex grecord-gcc-switches
8068 @opindex gno-record-gcc-switches
8069 This switch causes the command-line options used to invoke the
8070 compiler that may affect code generation to be appended to the
8071 DW_AT_producer attribute in DWARF debugging information. The options
8072 are concatenated with spaces separating them from each other and from
8073 the compiler version.
8074 It is enabled by default.
8075 See also @option{-frecord-gcc-switches} for another
8076 way of storing compiler options into the object file.
8077
8078 @item -gstrict-dwarf
8079 @opindex gstrict-dwarf
8080 Disallow using extensions of later DWARF standard version than selected
8081 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8082 DWARF extensions from later standard versions is allowed.
8083
8084 @item -gno-strict-dwarf
8085 @opindex gno-strict-dwarf
8086 Allow using extensions of later DWARF standard version than selected with
8087 @option{-gdwarf-@var{version}}.
8088
8089 @item -gas-loc-support
8090 @opindex gas-loc-support
8091 Inform the compiler that the assembler supports @code{.loc} directives.
8092 It may then use them for the assembler to generate DWARF2+ line number
8093 tables.
8094
8095 This is generally desirable, because assembler-generated line-number
8096 tables are a lot more compact than those the compiler can generate
8097 itself.
8098
8099 This option will be enabled by default if, at GCC configure time, the
8100 assembler was found to support such directives.
8101
8102 @item -gno-as-loc-support
8103 @opindex gno-as-loc-support
8104 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8105 line number tables are to be generated.
8106
8107 @item -gas-locview-support
8108 @opindex gas-locview-support
8109 Inform the compiler that the assembler supports @code{view} assignment
8110 and reset assertion checking in @code{.loc} directives.
8111
8112 This option will be enabled by default if, at GCC configure time, the
8113 assembler was found to support them.
8114
8115 @item -gno-as-locview-support
8116 Force GCC to assign view numbers internally, if
8117 @option{-gvariable-location-views} are explicitly requested.
8118
8119 @item -gcolumn-info
8120 @itemx -gno-column-info
8121 @opindex gcolumn-info
8122 @opindex gno-column-info
8123 Emit location column information into DWARF debugging information, rather
8124 than just file and line.
8125 This option is enabled by default.
8126
8127 @item -gstatement-frontiers
8128 @itemx -gno-statement-frontiers
8129 @opindex gstatement-frontiers
8130 @opindex gno-statement-frontiers
8131 This option causes GCC to create markers in the internal representation
8132 at the beginning of statements, and to keep them roughly in place
8133 throughout compilation, using them to guide the output of @code{is_stmt}
8134 markers in the line number table. This is enabled by default when
8135 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8136 @dots{}), and outputting DWARF 2 debug information at the normal level.
8137
8138 @item -gvariable-location-views
8139 @itemx -gvariable-location-views=incompat5
8140 @itemx -gno-variable-location-views
8141 @opindex gvariable-location-views
8142 @opindex gvariable-location-views=incompat5
8143 @opindex gno-variable-location-views
8144 Augment variable location lists with progressive view numbers implied
8145 from the line number table. This enables debug information consumers to
8146 inspect state at certain points of the program, even if no instructions
8147 associated with the corresponding source locations are present at that
8148 point. If the assembler lacks support for view numbers in line number
8149 tables, this will cause the compiler to emit the line number table,
8150 which generally makes them somewhat less compact. The augmented line
8151 number tables and location lists are fully backward-compatible, so they
8152 can be consumed by debug information consumers that are not aware of
8153 these augmentations, but they won't derive any benefit from them either.
8154
8155 This is enabled by default when outputting DWARF 2 debug information at
8156 the normal level, as long as there is assembler support,
8157 @option{-fvar-tracking-assignments} is enabled and
8158 @option{-gstrict-dwarf} is not. When assembler support is not
8159 available, this may still be enabled, but it will force GCC to output
8160 internal line number tables, and if
8161 @option{-ginternal-reset-location-views} is not enabled, that will most
8162 certainly lead to silently mismatching location views.
8163
8164 There is a proposed representation for view numbers that is not backward
8165 compatible with the location list format introduced in DWARF 5, that can
8166 be enabled with @option{-gvariable-location-views=incompat5}. This
8167 option may be removed in the future, is only provided as a reference
8168 implementation of the proposed representation. Debug information
8169 consumers are not expected to support this extended format, and they
8170 would be rendered unable to decode location lists using it.
8171
8172 @item -ginternal-reset-location-views
8173 @itemx -gnointernal-reset-location-views
8174 @opindex ginternal-reset-location-views
8175 @opindex gno-internal-reset-location-views
8176 Attempt to determine location views that can be omitted from location
8177 view lists. This requires the compiler to have very accurate insn
8178 length estimates, which isn't always the case, and it may cause
8179 incorrect view lists to be generated silently when using an assembler
8180 that does not support location view lists. The GNU assembler will flag
8181 any such error as a @code{view number mismatch}. This is only enabled
8182 on ports that define a reliable estimation function.
8183
8184 @item -ginline-points
8185 @itemx -gno-inline-points
8186 @opindex ginline-points
8187 @opindex gno-inline-points
8188 Generate extended debug information for inlined functions. Location
8189 view tracking markers are inserted at inlined entry points, so that
8190 address and view numbers can be computed and output in debug
8191 information. This can be enabled independently of location views, in
8192 which case the view numbers won't be output, but it can only be enabled
8193 along with statement frontiers, and it is only enabled by default if
8194 location views are enabled.
8195
8196 @item -gz@r{[}=@var{type}@r{]}
8197 @opindex gz
8198 Produce compressed debug sections in DWARF format, if that is supported.
8199 If @var{type} is not given, the default type depends on the capabilities
8200 of the assembler and linker used. @var{type} may be one of
8201 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8202 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8203 compression in traditional GNU format). If the linker doesn't support
8204 writing compressed debug sections, the option is rejected. Otherwise,
8205 if the assembler does not support them, @option{-gz} is silently ignored
8206 when producing object files.
8207
8208 @item -femit-struct-debug-baseonly
8209 @opindex femit-struct-debug-baseonly
8210 Emit debug information for struct-like types
8211 only when the base name of the compilation source file
8212 matches the base name of file in which the struct is defined.
8213
8214 This option substantially reduces the size of debugging information,
8215 but at significant potential loss in type information to the debugger.
8216 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8217 See @option{-femit-struct-debug-detailed} for more detailed control.
8218
8219 This option works only with DWARF debug output.
8220
8221 @item -femit-struct-debug-reduced
8222 @opindex femit-struct-debug-reduced
8223 Emit debug information for struct-like types
8224 only when the base name of the compilation source file
8225 matches the base name of file in which the type is defined,
8226 unless the struct is a template or defined in a system header.
8227
8228 This option significantly reduces the size of debugging information,
8229 with some potential loss in type information to the debugger.
8230 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8231 See @option{-femit-struct-debug-detailed} for more detailed control.
8232
8233 This option works only with DWARF debug output.
8234
8235 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8236 @opindex femit-struct-debug-detailed
8237 Specify the struct-like types
8238 for which the compiler generates debug information.
8239 The intent is to reduce duplicate struct debug information
8240 between different object files within the same program.
8241
8242 This option is a detailed version of
8243 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8244 which serves for most needs.
8245
8246 A specification has the syntax@*
8247 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8248
8249 The optional first word limits the specification to
8250 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8251 A struct type is used directly when it is the type of a variable, member.
8252 Indirect uses arise through pointers to structs.
8253 That is, when use of an incomplete struct is valid, the use is indirect.
8254 An example is
8255 @samp{struct one direct; struct two * indirect;}.
8256
8257 The optional second word limits the specification to
8258 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8259 Generic structs are a bit complicated to explain.
8260 For C++, these are non-explicit specializations of template classes,
8261 or non-template classes within the above.
8262 Other programming languages have generics,
8263 but @option{-femit-struct-debug-detailed} does not yet implement them.
8264
8265 The third word specifies the source files for those
8266 structs for which the compiler should emit debug information.
8267 The values @samp{none} and @samp{any} have the normal meaning.
8268 The value @samp{base} means that
8269 the base of name of the file in which the type declaration appears
8270 must match the base of the name of the main compilation file.
8271 In practice, this means that when compiling @file{foo.c}, debug information
8272 is generated for types declared in that file and @file{foo.h},
8273 but not other header files.
8274 The value @samp{sys} means those types satisfying @samp{base}
8275 or declared in system or compiler headers.
8276
8277 You may need to experiment to determine the best settings for your application.
8278
8279 The default is @option{-femit-struct-debug-detailed=all}.
8280
8281 This option works only with DWARF debug output.
8282
8283 @item -fno-dwarf2-cfi-asm
8284 @opindex fdwarf2-cfi-asm
8285 @opindex fno-dwarf2-cfi-asm
8286 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8287 instead of using GAS @code{.cfi_*} directives.
8288
8289 @item -fno-eliminate-unused-debug-types
8290 @opindex feliminate-unused-debug-types
8291 @opindex fno-eliminate-unused-debug-types
8292 Normally, when producing DWARF output, GCC avoids producing debug symbol
8293 output for types that are nowhere used in the source file being compiled.
8294 Sometimes it is useful to have GCC emit debugging
8295 information for all types declared in a compilation
8296 unit, regardless of whether or not they are actually used
8297 in that compilation unit, for example
8298 if, in the debugger, you want to cast a value to a type that is
8299 not actually used in your program (but is declared). More often,
8300 however, this results in a significant amount of wasted space.
8301 @end table
8302
8303 @node Optimize Options
8304 @section Options That Control Optimization
8305 @cindex optimize options
8306 @cindex options, optimization
8307
8308 These options control various sorts of optimizations.
8309
8310 Without any optimization option, the compiler's goal is to reduce the
8311 cost of compilation and to make debugging produce the expected
8312 results. Statements are independent: if you stop the program with a
8313 breakpoint between statements, you can then assign a new value to any
8314 variable or change the program counter to any other statement in the
8315 function and get exactly the results you expect from the source
8316 code.
8317
8318 Turning on optimization flags makes the compiler attempt to improve
8319 the performance and/or code size at the expense of compilation time
8320 and possibly the ability to debug the program.
8321
8322 The compiler performs optimization based on the knowledge it has of the
8323 program. Compiling multiple files at once to a single output file mode allows
8324 the compiler to use information gained from all of the files when compiling
8325 each of them.
8326
8327 Not all optimizations are controlled directly by a flag. Only
8328 optimizations that have a flag are listed in this section.
8329
8330 Most optimizations are completely disabled at @option{-O0} or if an
8331 @option{-O} level is not set on the command line, even if individual
8332 optimization flags are specified. Similarly, @option{-Og} suppresses
8333 many optimization passes.
8334
8335 Depending on the target and how GCC was configured, a slightly different
8336 set of optimizations may be enabled at each @option{-O} level than
8337 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8338 to find out the exact set of optimizations that are enabled at each level.
8339 @xref{Overall Options}, for examples.
8340
8341 @table @gcctabopt
8342 @item -O
8343 @itemx -O1
8344 @opindex O
8345 @opindex O1
8346 Optimize. Optimizing compilation takes somewhat more time, and a lot
8347 more memory for a large function.
8348
8349 With @option{-O}, the compiler tries to reduce code size and execution
8350 time, without performing any optimizations that take a great deal of
8351 compilation time.
8352
8353 @c Note that in addition to the default_options_table list in opts.c,
8354 @c several optimization flags default to true but control optimization
8355 @c passes that are explicitly disabled at -O0.
8356
8357 @option{-O} turns on the following optimization flags:
8358
8359 @c Please keep the following list alphabetized.
8360 @gccoptlist{-fauto-inc-dec @gol
8361 -fbranch-count-reg @gol
8362 -fcombine-stack-adjustments @gol
8363 -fcompare-elim @gol
8364 -fcprop-registers @gol
8365 -fdce @gol
8366 -fdefer-pop @gol
8367 -fdelayed-branch @gol
8368 -fdse @gol
8369 -fforward-propagate @gol
8370 -fguess-branch-probability @gol
8371 -fif-conversion @gol
8372 -fif-conversion2 @gol
8373 -finline-functions-called-once @gol
8374 -fipa-profile @gol
8375 -fipa-pure-const @gol
8376 -fipa-reference @gol
8377 -fipa-reference-addressable @gol
8378 -fmerge-constants @gol
8379 -fmove-loop-invariants @gol
8380 -fomit-frame-pointer @gol
8381 -freorder-blocks @gol
8382 -fshrink-wrap @gol
8383 -fshrink-wrap-separate @gol
8384 -fsplit-wide-types @gol
8385 -fssa-backprop @gol
8386 -fssa-phiopt @gol
8387 -ftree-bit-ccp @gol
8388 -ftree-ccp @gol
8389 -ftree-ch @gol
8390 -ftree-coalesce-vars @gol
8391 -ftree-copy-prop @gol
8392 -ftree-dce @gol
8393 -ftree-dominator-opts @gol
8394 -ftree-dse @gol
8395 -ftree-forwprop @gol
8396 -ftree-fre @gol
8397 -ftree-phiprop @gol
8398 -ftree-pta @gol
8399 -ftree-scev-cprop @gol
8400 -ftree-sink @gol
8401 -ftree-slsr @gol
8402 -ftree-sra @gol
8403 -ftree-ter @gol
8404 -funit-at-a-time}
8405
8406 @item -O2
8407 @opindex O2
8408 Optimize even more. GCC performs nearly all supported optimizations
8409 that do not involve a space-speed tradeoff.
8410 As compared to @option{-O}, this option increases both compilation time
8411 and the performance of the generated code.
8412
8413 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8414 also turns on the following optimization flags:
8415
8416 @c Please keep the following list alphabetized!
8417 @gccoptlist{-falign-functions -falign-jumps @gol
8418 -falign-labels -falign-loops @gol
8419 -fcaller-saves @gol
8420 -fcode-hoisting @gol
8421 -fcrossjumping @gol
8422 -fcse-follow-jumps -fcse-skip-blocks @gol
8423 -fdelete-null-pointer-checks @gol
8424 -fdevirtualize -fdevirtualize-speculatively @gol
8425 -fexpensive-optimizations @gol
8426 -ffinite-loops @gol
8427 -fgcse -fgcse-lm @gol
8428 -fhoist-adjacent-loads @gol
8429 -finline-functions @gol
8430 -finline-small-functions @gol
8431 -findirect-inlining @gol
8432 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8433 -fipa-ra -fipa-sra -fipa-vrp @gol
8434 -fisolate-erroneous-paths-dereference @gol
8435 -flra-remat @gol
8436 -foptimize-sibling-calls @gol
8437 -foptimize-strlen @gol
8438 -fpartial-inlining @gol
8439 -fpeephole2 @gol
8440 -freorder-blocks-algorithm=stc @gol
8441 -freorder-blocks-and-partition -freorder-functions @gol
8442 -frerun-cse-after-loop @gol
8443 -fschedule-insns -fschedule-insns2 @gol
8444 -fsched-interblock -fsched-spec @gol
8445 -fstore-merging @gol
8446 -fstrict-aliasing @gol
8447 -fthread-jumps @gol
8448 -ftree-builtin-call-dce @gol
8449 -ftree-pre @gol
8450 -ftree-switch-conversion -ftree-tail-merge @gol
8451 -ftree-vrp}
8452
8453 Please note the warning under @option{-fgcse} about
8454 invoking @option{-O2} on programs that use computed gotos.
8455
8456 @item -O3
8457 @opindex O3
8458 Optimize yet more. @option{-O3} turns on all optimizations specified
8459 by @option{-O2} and also turns on the following optimization flags:
8460
8461 @c Please keep the following list alphabetized!
8462 @gccoptlist{-fgcse-after-reload @gol
8463 -fipa-cp-clone
8464 -floop-interchange @gol
8465 -floop-unroll-and-jam @gol
8466 -fpeel-loops @gol
8467 -fpredictive-commoning @gol
8468 -fsplit-paths @gol
8469 -ftree-loop-distribute-patterns @gol
8470 -ftree-loop-distribution @gol
8471 -ftree-loop-vectorize @gol
8472 -ftree-partial-pre @gol
8473 -ftree-slp-vectorize @gol
8474 -funswitch-loops @gol
8475 -fvect-cost-model @gol
8476 -fversion-loops-for-strides}
8477
8478 @item -O0
8479 @opindex O0
8480 Reduce compilation time and make debugging produce the expected
8481 results. This is the default.
8482
8483 @item -Os
8484 @opindex Os
8485 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8486 except those that often increase code size:
8487
8488 @gccoptlist{-falign-functions -falign-jumps @gol
8489 -falign-labels -falign-loops @gol
8490 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8491
8492 It also enables @option{-finline-functions}, causes the compiler to tune for
8493 code size rather than execution speed, and performs further optimizations
8494 designed to reduce code size.
8495
8496 @item -Ofast
8497 @opindex Ofast
8498 Disregard strict standards compliance. @option{-Ofast} enables all
8499 @option{-O3} optimizations. It also enables optimizations that are not
8500 valid for all standard-compliant programs.
8501 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
8502 and the Fortran-specific @option{-fstack-arrays}, unless
8503 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
8504
8505 @item -Og
8506 @opindex Og
8507 Optimize debugging experience. @option{-Og} should be the optimization
8508 level of choice for the standard edit-compile-debug cycle, offering
8509 a reasonable level of optimization while maintaining fast compilation
8510 and a good debugging experience. It is a better choice than @option{-O0}
8511 for producing debuggable code because some compiler passes
8512 that collect debug information are disabled at @option{-O0}.
8513
8514 Like @option{-O0}, @option{-Og} completely disables a number of
8515 optimization passes so that individual options controlling them have
8516 no effect. Otherwise @option{-Og} enables all @option{-O1}
8517 optimization flags except for those that may interfere with debugging:
8518
8519 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8520 -fdse -fif-conversion -fif-conversion2 @gol
8521 -finline-functions-called-once @gol
8522 -fmove-loop-invariants -fssa-phiopt @gol
8523 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8524
8525 @end table
8526
8527 If you use multiple @option{-O} options, with or without level numbers,
8528 the last such option is the one that is effective.
8529
8530 Options of the form @option{-f@var{flag}} specify machine-independent
8531 flags. Most flags have both positive and negative forms; the negative
8532 form of @option{-ffoo} is @option{-fno-foo}. In the table
8533 below, only one of the forms is listed---the one you typically
8534 use. You can figure out the other form by either removing @samp{no-}
8535 or adding it.
8536
8537 The following options control specific optimizations. They are either
8538 activated by @option{-O} options or are related to ones that are. You
8539 can use the following flags in the rare cases when ``fine-tuning'' of
8540 optimizations to be performed is desired.
8541
8542 @table @gcctabopt
8543 @item -fno-defer-pop
8544 @opindex fno-defer-pop
8545 @opindex fdefer-pop
8546 For machines that must pop arguments after a function call, always pop
8547 the arguments as soon as each function returns.
8548 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8549 this allows the compiler to let arguments accumulate on the stack for several
8550 function calls and pop them all at once.
8551
8552 @item -fforward-propagate
8553 @opindex fforward-propagate
8554 Perform a forward propagation pass on RTL@. The pass tries to combine two
8555 instructions and checks if the result can be simplified. If loop unrolling
8556 is active, two passes are performed and the second is scheduled after
8557 loop unrolling.
8558
8559 This option is enabled by default at optimization levels @option{-O},
8560 @option{-O2}, @option{-O3}, @option{-Os}.
8561
8562 @item -ffp-contract=@var{style}
8563 @opindex ffp-contract
8564 @option{-ffp-contract=off} disables floating-point expression contraction.
8565 @option{-ffp-contract=fast} enables floating-point expression contraction
8566 such as forming of fused multiply-add operations if the target has
8567 native support for them.
8568 @option{-ffp-contract=on} enables floating-point expression contraction
8569 if allowed by the language standard. This is currently not implemented
8570 and treated equal to @option{-ffp-contract=off}.
8571
8572 The default is @option{-ffp-contract=fast}.
8573
8574 @item -fomit-frame-pointer
8575 @opindex fomit-frame-pointer
8576 Omit the frame pointer in functions that don't need one. This avoids the
8577 instructions to save, set up and restore the frame pointer; on many targets
8578 it also makes an extra register available.
8579
8580 On some targets this flag has no effect because the standard calling sequence
8581 always uses a frame pointer, so it cannot be omitted.
8582
8583 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8584 is used in all functions. Several targets always omit the frame pointer in
8585 leaf functions.
8586
8587 Enabled by default at @option{-O} and higher.
8588
8589 @item -foptimize-sibling-calls
8590 @opindex foptimize-sibling-calls
8591 Optimize sibling and tail recursive calls.
8592
8593 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8594
8595 @item -foptimize-strlen
8596 @opindex foptimize-strlen
8597 Optimize various standard C string functions (e.g.@: @code{strlen},
8598 @code{strchr} or @code{strcpy}) and
8599 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8600
8601 Enabled at levels @option{-O2}, @option{-O3}.
8602
8603 @item -fno-inline
8604 @opindex fno-inline
8605 @opindex finline
8606 Do not expand any functions inline apart from those marked with
8607 the @code{always_inline} attribute. This is the default when not
8608 optimizing.
8609
8610 Single functions can be exempted from inlining by marking them
8611 with the @code{noinline} attribute.
8612
8613 @item -finline-small-functions
8614 @opindex finline-small-functions
8615 Integrate functions into their callers when their body is smaller than expected
8616 function call code (so overall size of program gets smaller). The compiler
8617 heuristically decides which functions are simple enough to be worth integrating
8618 in this way. This inlining applies to all functions, even those not declared
8619 inline.
8620
8621 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8622
8623 @item -findirect-inlining
8624 @opindex findirect-inlining
8625 Inline also indirect calls that are discovered to be known at compile
8626 time thanks to previous inlining. This option has any effect only
8627 when inlining itself is turned on by the @option{-finline-functions}
8628 or @option{-finline-small-functions} options.
8629
8630 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8631
8632 @item -finline-functions
8633 @opindex finline-functions
8634 Consider all functions for inlining, even if they are not declared inline.
8635 The compiler heuristically decides which functions are worth integrating
8636 in this way.
8637
8638 If all calls to a given function are integrated, and the function is
8639 declared @code{static}, then the function is normally not output as
8640 assembler code in its own right.
8641
8642 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8643 by @option{-fprofile-use} and @option{-fauto-profile}.
8644
8645 @item -finline-functions-called-once
8646 @opindex finline-functions-called-once
8647 Consider all @code{static} functions called once for inlining into their
8648 caller even if they are not marked @code{inline}. If a call to a given
8649 function is integrated, then the function is not output as assembler code
8650 in its own right.
8651
8652 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8653 but not @option{-Og}.
8654
8655 @item -fearly-inlining
8656 @opindex fearly-inlining
8657 Inline functions marked by @code{always_inline} and functions whose body seems
8658 smaller than the function call overhead early before doing
8659 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8660 makes profiling significantly cheaper and usually inlining faster on programs
8661 having large chains of nested wrapper functions.
8662
8663 Enabled by default.
8664
8665 @item -fipa-sra
8666 @opindex fipa-sra
8667 Perform interprocedural scalar replacement of aggregates, removal of
8668 unused parameters and replacement of parameters passed by reference
8669 by parameters passed by value.
8670
8671 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8672
8673 @item -finline-limit=@var{n}
8674 @opindex finline-limit
8675 By default, GCC limits the size of functions that can be inlined. This flag
8676 allows coarse control of this limit. @var{n} is the size of functions that
8677 can be inlined in number of pseudo instructions.
8678
8679 Inlining is actually controlled by a number of parameters, which may be
8680 specified individually by using @option{--param @var{name}=@var{value}}.
8681 The @option{-finline-limit=@var{n}} option sets some of these parameters
8682 as follows:
8683
8684 @table @gcctabopt
8685 @item max-inline-insns-single
8686 is set to @var{n}/2.
8687 @item max-inline-insns-auto
8688 is set to @var{n}/2.
8689 @end table
8690
8691 See below for a documentation of the individual
8692 parameters controlling inlining and for the defaults of these parameters.
8693
8694 @emph{Note:} there may be no value to @option{-finline-limit} that results
8695 in default behavior.
8696
8697 @emph{Note:} pseudo instruction represents, in this particular context, an
8698 abstract measurement of function's size. In no way does it represent a count
8699 of assembly instructions and as such its exact meaning might change from one
8700 release to an another.
8701
8702 @item -fno-keep-inline-dllexport
8703 @opindex fno-keep-inline-dllexport
8704 @opindex fkeep-inline-dllexport
8705 This is a more fine-grained version of @option{-fkeep-inline-functions},
8706 which applies only to functions that are declared using the @code{dllexport}
8707 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8708 Functions}.
8709
8710 @item -fkeep-inline-functions
8711 @opindex fkeep-inline-functions
8712 In C, emit @code{static} functions that are declared @code{inline}
8713 into the object file, even if the function has been inlined into all
8714 of its callers. This switch does not affect functions using the
8715 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8716 inline functions into the object file.
8717
8718 @item -fkeep-static-functions
8719 @opindex fkeep-static-functions
8720 Emit @code{static} functions into the object file, even if the function
8721 is never used.
8722
8723 @item -fkeep-static-consts
8724 @opindex fkeep-static-consts
8725 Emit variables declared @code{static const} when optimization isn't turned
8726 on, even if the variables aren't referenced.
8727
8728 GCC enables this option by default. If you want to force the compiler to
8729 check if a variable is referenced, regardless of whether or not
8730 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8731
8732 @item -fmerge-constants
8733 @opindex fmerge-constants
8734 Attempt to merge identical constants (string constants and floating-point
8735 constants) across compilation units.
8736
8737 This option is the default for optimized compilation if the assembler and
8738 linker support it. Use @option{-fno-merge-constants} to inhibit this
8739 behavior.
8740
8741 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8742
8743 @item -fmerge-all-constants
8744 @opindex fmerge-all-constants
8745 Attempt to merge identical constants and identical variables.
8746
8747 This option implies @option{-fmerge-constants}. In addition to
8748 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8749 arrays or initialized constant variables with integral or floating-point
8750 types. Languages like C or C++ require each variable, including multiple
8751 instances of the same variable in recursive calls, to have distinct locations,
8752 so using this option results in non-conforming
8753 behavior.
8754
8755 @item -fmodulo-sched
8756 @opindex fmodulo-sched
8757 Perform swing modulo scheduling immediately before the first scheduling
8758 pass. This pass looks at innermost loops and reorders their
8759 instructions by overlapping different iterations.
8760
8761 @item -fmodulo-sched-allow-regmoves
8762 @opindex fmodulo-sched-allow-regmoves
8763 Perform more aggressive SMS-based modulo scheduling with register moves
8764 allowed. By setting this flag certain anti-dependences edges are
8765 deleted, which triggers the generation of reg-moves based on the
8766 life-range analysis. This option is effective only with
8767 @option{-fmodulo-sched} enabled.
8768
8769 @item -fno-branch-count-reg
8770 @opindex fno-branch-count-reg
8771 @opindex fbranch-count-reg
8772 Disable the optimization pass that scans for opportunities to use
8773 ``decrement and branch'' instructions on a count register instead of
8774 instruction sequences that decrement a register, compare it against zero, and
8775 then branch based upon the result. This option is only meaningful on
8776 architectures that support such instructions, which include x86, PowerPC,
8777 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8778 doesn't remove the decrement and branch instructions from the generated
8779 instruction stream introduced by other optimization passes.
8780
8781 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8782 except for @option{-Og}.
8783
8784 @item -fno-function-cse
8785 @opindex fno-function-cse
8786 @opindex ffunction-cse
8787 Do not put function addresses in registers; make each instruction that
8788 calls a constant function contain the function's address explicitly.
8789
8790 This option results in less efficient code, but some strange hacks
8791 that alter the assembler output may be confused by the optimizations
8792 performed when this option is not used.
8793
8794 The default is @option{-ffunction-cse}
8795
8796 @item -fno-zero-initialized-in-bss
8797 @opindex fno-zero-initialized-in-bss
8798 @opindex fzero-initialized-in-bss
8799 If the target supports a BSS section, GCC by default puts variables that
8800 are initialized to zero into BSS@. This can save space in the resulting
8801 code.
8802
8803 This option turns off this behavior because some programs explicitly
8804 rely on variables going to the data section---e.g., so that the
8805 resulting executable can find the beginning of that section and/or make
8806 assumptions based on that.
8807
8808 The default is @option{-fzero-initialized-in-bss}.
8809
8810 @item -fthread-jumps
8811 @opindex fthread-jumps
8812 Perform optimizations that check to see if a jump branches to a
8813 location where another comparison subsumed by the first is found. If
8814 so, the first branch is redirected to either the destination of the
8815 second branch or a point immediately following it, depending on whether
8816 the condition is known to be true or false.
8817
8818 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8819
8820 @item -fsplit-wide-types
8821 @opindex fsplit-wide-types
8822 When using a type that occupies multiple registers, such as @code{long
8823 long} on a 32-bit system, split the registers apart and allocate them
8824 independently. This normally generates better code for those types,
8825 but may make debugging more difficult.
8826
8827 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8828 @option{-Os}.
8829
8830 @item -fsplit-wide-types-early
8831 @opindex fsplit-wide-types-early
8832 Fully split wide types early, instead of very late.
8833 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8834
8835 This is the default on some targets.
8836
8837 @item -fcse-follow-jumps
8838 @opindex fcse-follow-jumps
8839 In common subexpression elimination (CSE), scan through jump instructions
8840 when the target of the jump is not reached by any other path. For
8841 example, when CSE encounters an @code{if} statement with an
8842 @code{else} clause, CSE follows the jump when the condition
8843 tested is false.
8844
8845 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8846
8847 @item -fcse-skip-blocks
8848 @opindex fcse-skip-blocks
8849 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8850 follow jumps that conditionally skip over blocks. When CSE
8851 encounters a simple @code{if} statement with no else clause,
8852 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8853 body of the @code{if}.
8854
8855 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8856
8857 @item -frerun-cse-after-loop
8858 @opindex frerun-cse-after-loop
8859 Re-run common subexpression elimination after loop optimizations are
8860 performed.
8861
8862 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8863
8864 @item -fgcse
8865 @opindex fgcse
8866 Perform a global common subexpression elimination pass.
8867 This pass also performs global constant and copy propagation.
8868
8869 @emph{Note:} When compiling a program using computed gotos, a GCC
8870 extension, you may get better run-time performance if you disable
8871 the global common subexpression elimination pass by adding
8872 @option{-fno-gcse} to the command line.
8873
8874 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8875
8876 @item -fgcse-lm
8877 @opindex fgcse-lm
8878 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8879 attempts to move loads that are only killed by stores into themselves. This
8880 allows a loop containing a load/store sequence to be changed to a load outside
8881 the loop, and a copy/store within the loop.
8882
8883 Enabled by default when @option{-fgcse} is enabled.
8884
8885 @item -fgcse-sm
8886 @opindex fgcse-sm
8887 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8888 global common subexpression elimination. This pass attempts to move
8889 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8890 loops containing a load/store sequence can be changed to a load before
8891 the loop and a store after the loop.
8892
8893 Not enabled at any optimization level.
8894
8895 @item -fgcse-las
8896 @opindex fgcse-las
8897 When @option{-fgcse-las} is enabled, the global common subexpression
8898 elimination pass eliminates redundant loads that come after stores to the
8899 same memory location (both partial and full redundancies).
8900
8901 Not enabled at any optimization level.
8902
8903 @item -fgcse-after-reload
8904 @opindex fgcse-after-reload
8905 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8906 pass is performed after reload. The purpose of this pass is to clean up
8907 redundant spilling.
8908
8909 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8910
8911 @item -faggressive-loop-optimizations
8912 @opindex faggressive-loop-optimizations
8913 This option tells the loop optimizer to use language constraints to
8914 derive bounds for the number of iterations of a loop. This assumes that
8915 loop code does not invoke undefined behavior by for example causing signed
8916 integer overflows or out-of-bound array accesses. The bounds for the
8917 number of iterations of a loop are used to guide loop unrolling and peeling
8918 and loop exit test optimizations.
8919 This option is enabled by default.
8920
8921 @item -funconstrained-commons
8922 @opindex funconstrained-commons
8923 This option tells the compiler that variables declared in common blocks
8924 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8925 prevents certain optimizations that depend on knowing the array bounds.
8926
8927 @item -fcrossjumping
8928 @opindex fcrossjumping
8929 Perform cross-jumping transformation.
8930 This transformation unifies equivalent code and saves code size. The
8931 resulting code may or may not perform better than without cross-jumping.
8932
8933 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8934
8935 @item -fauto-inc-dec
8936 @opindex fauto-inc-dec
8937 Combine increments or decrements of addresses with memory accesses.
8938 This pass is always skipped on architectures that do not have
8939 instructions to support this. Enabled by default at @option{-O} and
8940 higher on architectures that support this.
8941
8942 @item -fdce
8943 @opindex fdce
8944 Perform dead code elimination (DCE) on RTL@.
8945 Enabled by default at @option{-O} and higher.
8946
8947 @item -fdse
8948 @opindex fdse
8949 Perform dead store elimination (DSE) on RTL@.
8950 Enabled by default at @option{-O} and higher.
8951
8952 @item -fif-conversion
8953 @opindex fif-conversion
8954 Attempt to transform conditional jumps into branch-less equivalents. This
8955 includes use of conditional moves, min, max, set flags and abs instructions, and
8956 some tricks doable by standard arithmetics. The use of conditional execution
8957 on chips where it is available is controlled by @option{-fif-conversion2}.
8958
8959 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8960 not with @option{-Og}.
8961
8962 @item -fif-conversion2
8963 @opindex fif-conversion2
8964 Use conditional execution (where available) to transform conditional jumps into
8965 branch-less equivalents.
8966
8967 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8968 not with @option{-Og}.
8969
8970 @item -fdeclone-ctor-dtor
8971 @opindex fdeclone-ctor-dtor
8972 The C++ ABI requires multiple entry points for constructors and
8973 destructors: one for a base subobject, one for a complete object, and
8974 one for a virtual destructor that calls operator delete afterwards.
8975 For a hierarchy with virtual bases, the base and complete variants are
8976 clones, which means two copies of the function. With this option, the
8977 base and complete variants are changed to be thunks that call a common
8978 implementation.
8979
8980 Enabled by @option{-Os}.
8981
8982 @item -fdelete-null-pointer-checks
8983 @opindex fdelete-null-pointer-checks
8984 Assume that programs cannot safely dereference null pointers, and that
8985 no code or data element resides at address zero.
8986 This option enables simple constant
8987 folding optimizations at all optimization levels. In addition, other
8988 optimization passes in GCC use this flag to control global dataflow
8989 analyses that eliminate useless checks for null pointers; these assume
8990 that a memory access to address zero always results in a trap, so
8991 that if a pointer is checked after it has already been dereferenced,
8992 it cannot be null.
8993
8994 Note however that in some environments this assumption is not true.
8995 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8996 for programs that depend on that behavior.
8997
8998 This option is enabled by default on most targets. On Nios II ELF, it
8999 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
9000
9001 Passes that use the dataflow information
9002 are enabled independently at different optimization levels.
9003
9004 @item -fdevirtualize
9005 @opindex fdevirtualize
9006 Attempt to convert calls to virtual functions to direct calls. This
9007 is done both within a procedure and interprocedurally as part of
9008 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9009 propagation (@option{-fipa-cp}).
9010 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9011
9012 @item -fdevirtualize-speculatively
9013 @opindex fdevirtualize-speculatively
9014 Attempt to convert calls to virtual functions to speculative direct calls.
9015 Based on the analysis of the type inheritance graph, determine for a given call
9016 the set of likely targets. If the set is small, preferably of size 1, change
9017 the call into a conditional deciding between direct and indirect calls. The
9018 speculative calls enable more optimizations, such as inlining. When they seem
9019 useless after further optimization, they are converted back into original form.
9020
9021 @item -fdevirtualize-at-ltrans
9022 @opindex fdevirtualize-at-ltrans
9023 Stream extra information needed for aggressive devirtualization when running
9024 the link-time optimizer in local transformation mode.
9025 This option enables more devirtualization but
9026 significantly increases the size of streamed data. For this reason it is
9027 disabled by default.
9028
9029 @item -fexpensive-optimizations
9030 @opindex fexpensive-optimizations
9031 Perform a number of minor optimizations that are relatively expensive.
9032
9033 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9034
9035 @item -free
9036 @opindex free
9037 Attempt to remove redundant extension instructions. This is especially
9038 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9039 registers after writing to their lower 32-bit half.
9040
9041 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9042 @option{-O3}, @option{-Os}.
9043
9044 @item -fno-lifetime-dse
9045 @opindex fno-lifetime-dse
9046 @opindex flifetime-dse
9047 In C++ the value of an object is only affected by changes within its
9048 lifetime: when the constructor begins, the object has an indeterminate
9049 value, and any changes during the lifetime of the object are dead when
9050 the object is destroyed. Normally dead store elimination will take
9051 advantage of this; if your code relies on the value of the object
9052 storage persisting beyond the lifetime of the object, you can use this
9053 flag to disable this optimization. To preserve stores before the
9054 constructor starts (e.g.@: because your operator new clears the object
9055 storage) but still treat the object as dead after the destructor you,
9056 can use @option{-flifetime-dse=1}. The default behavior can be
9057 explicitly selected with @option{-flifetime-dse=2}.
9058 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9059
9060 @item -flive-range-shrinkage
9061 @opindex flive-range-shrinkage
9062 Attempt to decrease register pressure through register live range
9063 shrinkage. This is helpful for fast processors with small or moderate
9064 size register sets.
9065
9066 @item -fira-algorithm=@var{algorithm}
9067 @opindex fira-algorithm
9068 Use the specified coloring algorithm for the integrated register
9069 allocator. The @var{algorithm} argument can be @samp{priority}, which
9070 specifies Chow's priority coloring, or @samp{CB}, which specifies
9071 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9072 for all architectures, but for those targets that do support it, it is
9073 the default because it generates better code.
9074
9075 @item -fira-region=@var{region}
9076 @opindex fira-region
9077 Use specified regions for the integrated register allocator. The
9078 @var{region} argument should be one of the following:
9079
9080 @table @samp
9081
9082 @item all
9083 Use all loops as register allocation regions.
9084 This can give the best results for machines with a small and/or
9085 irregular register set.
9086
9087 @item mixed
9088 Use all loops except for loops with small register pressure
9089 as the regions. This value usually gives
9090 the best results in most cases and for most architectures,
9091 and is enabled by default when compiling with optimization for speed
9092 (@option{-O}, @option{-O2}, @dots{}).
9093
9094 @item one
9095 Use all functions as a single region.
9096 This typically results in the smallest code size, and is enabled by default for
9097 @option{-Os} or @option{-O0}.
9098
9099 @end table
9100
9101 @item -fira-hoist-pressure
9102 @opindex fira-hoist-pressure
9103 Use IRA to evaluate register pressure in the code hoisting pass for
9104 decisions to hoist expressions. This option usually results in smaller
9105 code, but it can slow the compiler down.
9106
9107 This option is enabled at level @option{-Os} for all targets.
9108
9109 @item -fira-loop-pressure
9110 @opindex fira-loop-pressure
9111 Use IRA to evaluate register pressure in loops for decisions to move
9112 loop invariants. This option usually results in generation
9113 of faster and smaller code on machines with large register files (>= 32
9114 registers), but it can slow the compiler down.
9115
9116 This option is enabled at level @option{-O3} for some targets.
9117
9118 @item -fno-ira-share-save-slots
9119 @opindex fno-ira-share-save-slots
9120 @opindex fira-share-save-slots
9121 Disable sharing of stack slots used for saving call-used hard
9122 registers living through a call. Each hard register gets a
9123 separate stack slot, and as a result function stack frames are
9124 larger.
9125
9126 @item -fno-ira-share-spill-slots
9127 @opindex fno-ira-share-spill-slots
9128 @opindex fira-share-spill-slots
9129 Disable sharing of stack slots allocated for pseudo-registers. Each
9130 pseudo-register that does not get a hard register gets a separate
9131 stack slot, and as a result function stack frames are larger.
9132
9133 @item -flra-remat
9134 @opindex flra-remat
9135 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9136 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9137 values if it is profitable.
9138
9139 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9140
9141 @item -fdelayed-branch
9142 @opindex fdelayed-branch
9143 If supported for the target machine, attempt to reorder instructions
9144 to exploit instruction slots available after delayed branch
9145 instructions.
9146
9147 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9148 but not at @option{-Og}.
9149
9150 @item -fschedule-insns
9151 @opindex fschedule-insns
9152 If supported for the target machine, attempt to reorder instructions to
9153 eliminate execution stalls due to required data being unavailable. This
9154 helps machines that have slow floating point or memory load instructions
9155 by allowing other instructions to be issued until the result of the load
9156 or floating-point instruction is required.
9157
9158 Enabled at levels @option{-O2}, @option{-O3}.
9159
9160 @item -fschedule-insns2
9161 @opindex fschedule-insns2
9162 Similar to @option{-fschedule-insns}, but requests an additional pass of
9163 instruction scheduling after register allocation has been done. This is
9164 especially useful on machines with a relatively small number of
9165 registers and where memory load instructions take more than one cycle.
9166
9167 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9168
9169 @item -fno-sched-interblock
9170 @opindex fno-sched-interblock
9171 @opindex fsched-interblock
9172 Disable instruction scheduling across basic blocks, which
9173 is normally enabled when scheduling before register allocation, i.e.@:
9174 with @option{-fschedule-insns} or at @option{-O2} or higher.
9175
9176 @item -fno-sched-spec
9177 @opindex fno-sched-spec
9178 @opindex fsched-spec
9179 Disable speculative motion of non-load instructions, which
9180 is normally enabled when scheduling before register allocation, i.e.@:
9181 with @option{-fschedule-insns} or at @option{-O2} or higher.
9182
9183 @item -fsched-pressure
9184 @opindex fsched-pressure
9185 Enable register pressure sensitive insn scheduling before register
9186 allocation. This only makes sense when scheduling before register
9187 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9188 @option{-O2} or higher. Usage of this option can improve the
9189 generated code and decrease its size by preventing register pressure
9190 increase above the number of available hard registers and subsequent
9191 spills in register allocation.
9192
9193 @item -fsched-spec-load
9194 @opindex fsched-spec-load
9195 Allow speculative motion of some load instructions. This only makes
9196 sense when scheduling before register allocation, i.e.@: with
9197 @option{-fschedule-insns} or at @option{-O2} or higher.
9198
9199 @item -fsched-spec-load-dangerous
9200 @opindex fsched-spec-load-dangerous
9201 Allow speculative motion of more load instructions. This only makes
9202 sense when scheduling before register allocation, i.e.@: with
9203 @option{-fschedule-insns} or at @option{-O2} or higher.
9204
9205 @item -fsched-stalled-insns
9206 @itemx -fsched-stalled-insns=@var{n}
9207 @opindex fsched-stalled-insns
9208 Define how many insns (if any) can be moved prematurely from the queue
9209 of stalled insns into the ready list during the second scheduling pass.
9210 @option{-fno-sched-stalled-insns} means that no insns are moved
9211 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9212 on how many queued insns can be moved prematurely.
9213 @option{-fsched-stalled-insns} without a value is equivalent to
9214 @option{-fsched-stalled-insns=1}.
9215
9216 @item -fsched-stalled-insns-dep
9217 @itemx -fsched-stalled-insns-dep=@var{n}
9218 @opindex fsched-stalled-insns-dep
9219 Define how many insn groups (cycles) are examined for a dependency
9220 on a stalled insn that is a candidate for premature removal from the queue
9221 of stalled insns. This has an effect only during the second scheduling pass,
9222 and only if @option{-fsched-stalled-insns} is used.
9223 @option{-fno-sched-stalled-insns-dep} is equivalent to
9224 @option{-fsched-stalled-insns-dep=0}.
9225 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9226 @option{-fsched-stalled-insns-dep=1}.
9227
9228 @item -fsched2-use-superblocks
9229 @opindex fsched2-use-superblocks
9230 When scheduling after register allocation, use superblock scheduling.
9231 This allows motion across basic block boundaries,
9232 resulting in faster schedules. This option is experimental, as not all machine
9233 descriptions used by GCC model the CPU closely enough to avoid unreliable
9234 results from the algorithm.
9235
9236 This only makes sense when scheduling after register allocation, i.e.@: with
9237 @option{-fschedule-insns2} or at @option{-O2} or higher.
9238
9239 @item -fsched-group-heuristic
9240 @opindex fsched-group-heuristic
9241 Enable the group heuristic in the scheduler. This heuristic favors
9242 the instruction that belongs to a schedule group. This is enabled
9243 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9244 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9245
9246 @item -fsched-critical-path-heuristic
9247 @opindex fsched-critical-path-heuristic
9248 Enable the critical-path heuristic in the scheduler. This heuristic favors
9249 instructions on the critical path. This is enabled by default when
9250 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9251 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9252
9253 @item -fsched-spec-insn-heuristic
9254 @opindex fsched-spec-insn-heuristic
9255 Enable the speculative instruction heuristic in the scheduler. This
9256 heuristic favors speculative instructions with greater dependency weakness.
9257 This is enabled by default when scheduling is enabled, i.e.@:
9258 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9259 or at @option{-O2} or higher.
9260
9261 @item -fsched-rank-heuristic
9262 @opindex fsched-rank-heuristic
9263 Enable the rank heuristic in the scheduler. This heuristic favors
9264 the instruction belonging to a basic block with greater size or frequency.
9265 This is enabled by default when scheduling is enabled, i.e.@:
9266 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9267 at @option{-O2} or higher.
9268
9269 @item -fsched-last-insn-heuristic
9270 @opindex fsched-last-insn-heuristic
9271 Enable the last-instruction heuristic in the scheduler. This heuristic
9272 favors the instruction that is less dependent on the last instruction
9273 scheduled. This is enabled by default when scheduling is enabled,
9274 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9275 at @option{-O2} or higher.
9276
9277 @item -fsched-dep-count-heuristic
9278 @opindex fsched-dep-count-heuristic
9279 Enable the dependent-count heuristic in the scheduler. This heuristic
9280 favors the instruction that has more instructions depending on it.
9281 This is enabled by default when scheduling is enabled, i.e.@:
9282 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9283 at @option{-O2} or higher.
9284
9285 @item -freschedule-modulo-scheduled-loops
9286 @opindex freschedule-modulo-scheduled-loops
9287 Modulo scheduling is performed before traditional scheduling. If a loop
9288 is modulo scheduled, later scheduling passes may change its schedule.
9289 Use this option to control that behavior.
9290
9291 @item -fselective-scheduling
9292 @opindex fselective-scheduling
9293 Schedule instructions using selective scheduling algorithm. Selective
9294 scheduling runs instead of the first scheduler pass.
9295
9296 @item -fselective-scheduling2
9297 @opindex fselective-scheduling2
9298 Schedule instructions using selective scheduling algorithm. Selective
9299 scheduling runs instead of the second scheduler pass.
9300
9301 @item -fsel-sched-pipelining
9302 @opindex fsel-sched-pipelining
9303 Enable software pipelining of innermost loops during selective scheduling.
9304 This option has no effect unless one of @option{-fselective-scheduling} or
9305 @option{-fselective-scheduling2} is turned on.
9306
9307 @item -fsel-sched-pipelining-outer-loops
9308 @opindex fsel-sched-pipelining-outer-loops
9309 When pipelining loops during selective scheduling, also pipeline outer loops.
9310 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9311
9312 @item -fsemantic-interposition
9313 @opindex fsemantic-interposition
9314 Some object formats, like ELF, allow interposing of symbols by the
9315 dynamic linker.
9316 This means that for symbols exported from the DSO, the compiler cannot perform
9317 interprocedural propagation, inlining and other optimizations in anticipation
9318 that the function or variable in question may change. While this feature is
9319 useful, for example, to rewrite memory allocation functions by a debugging
9320 implementation, it is expensive in the terms of code quality.
9321 With @option{-fno-semantic-interposition} the compiler assumes that
9322 if interposition happens for functions the overwriting function will have
9323 precisely the same semantics (and side effects).
9324 Similarly if interposition happens
9325 for variables, the constructor of the variable will be the same. The flag
9326 has no effect for functions explicitly declared inline
9327 (where it is never allowed for interposition to change semantics)
9328 and for symbols explicitly declared weak.
9329
9330 @item -fshrink-wrap
9331 @opindex fshrink-wrap
9332 Emit function prologues only before parts of the function that need it,
9333 rather than at the top of the function. This flag is enabled by default at
9334 @option{-O} and higher.
9335
9336 @item -fshrink-wrap-separate
9337 @opindex fshrink-wrap-separate
9338 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9339 those parts are only executed when needed.
9340 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9341 is also turned on and the target supports this.
9342
9343 @item -fcaller-saves
9344 @opindex fcaller-saves
9345 Enable allocation of values to registers that are clobbered by
9346 function calls, by emitting extra instructions to save and restore the
9347 registers around such calls. Such allocation is done only when it
9348 seems to result in better code.
9349
9350 This option is always enabled by default on certain machines, usually
9351 those which have no call-preserved registers to use instead.
9352
9353 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9354
9355 @item -fcombine-stack-adjustments
9356 @opindex fcombine-stack-adjustments
9357 Tracks stack adjustments (pushes and pops) and stack memory references
9358 and then tries to find ways to combine them.
9359
9360 Enabled by default at @option{-O1} and higher.
9361
9362 @item -fipa-ra
9363 @opindex fipa-ra
9364 Use caller save registers for allocation if those registers are not used by
9365 any called function. In that case it is not necessary to save and restore
9366 them around calls. This is only possible if called functions are part of
9367 same compilation unit as current function and they are compiled before it.
9368
9369 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9370 is disabled if generated code will be instrumented for profiling
9371 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9372 exactly (this happens on targets that do not expose prologues
9373 and epilogues in RTL).
9374
9375 @item -fconserve-stack
9376 @opindex fconserve-stack
9377 Attempt to minimize stack usage. The compiler attempts to use less
9378 stack space, even if that makes the program slower. This option
9379 implies setting the @option{large-stack-frame} parameter to 100
9380 and the @option{large-stack-frame-growth} parameter to 400.
9381
9382 @item -ftree-reassoc
9383 @opindex ftree-reassoc
9384 Perform reassociation on trees. This flag is enabled by default
9385 at @option{-O} and higher.
9386
9387 @item -fcode-hoisting
9388 @opindex fcode-hoisting
9389 Perform code hoisting. Code hoisting tries to move the
9390 evaluation of expressions executed on all paths to the function exit
9391 as early as possible. This is especially useful as a code size
9392 optimization, but it often helps for code speed as well.
9393 This flag is enabled by default at @option{-O2} and higher.
9394
9395 @item -ftree-pre
9396 @opindex ftree-pre
9397 Perform partial redundancy elimination (PRE) on trees. This flag is
9398 enabled by default at @option{-O2} and @option{-O3}.
9399
9400 @item -ftree-partial-pre
9401 @opindex ftree-partial-pre
9402 Make partial redundancy elimination (PRE) more aggressive. This flag is
9403 enabled by default at @option{-O3}.
9404
9405 @item -ftree-forwprop
9406 @opindex ftree-forwprop
9407 Perform forward propagation on trees. This flag is enabled by default
9408 at @option{-O} and higher.
9409
9410 @item -ftree-fre
9411 @opindex ftree-fre
9412 Perform full redundancy elimination (FRE) on trees. The difference
9413 between FRE and PRE is that FRE only considers expressions
9414 that are computed on all paths leading to the redundant computation.
9415 This analysis is faster than PRE, though it exposes fewer redundancies.
9416 This flag is enabled by default at @option{-O} and higher.
9417
9418 @item -ftree-phiprop
9419 @opindex ftree-phiprop
9420 Perform hoisting of loads from conditional pointers on trees. This
9421 pass is enabled by default at @option{-O} and higher.
9422
9423 @item -fhoist-adjacent-loads
9424 @opindex fhoist-adjacent-loads
9425 Speculatively hoist loads from both branches of an if-then-else if the
9426 loads are from adjacent locations in the same structure and the target
9427 architecture has a conditional move instruction. This flag is enabled
9428 by default at @option{-O2} and higher.
9429
9430 @item -ftree-copy-prop
9431 @opindex ftree-copy-prop
9432 Perform copy propagation on trees. This pass eliminates unnecessary
9433 copy operations. This flag is enabled by default at @option{-O} and
9434 higher.
9435
9436 @item -fipa-pure-const
9437 @opindex fipa-pure-const
9438 Discover which functions are pure or constant.
9439 Enabled by default at @option{-O} and higher.
9440
9441 @item -fipa-reference
9442 @opindex fipa-reference
9443 Discover which static variables do not escape the
9444 compilation unit.
9445 Enabled by default at @option{-O} and higher.
9446
9447 @item -fipa-reference-addressable
9448 @opindex fipa-reference-addressable
9449 Discover read-only, write-only and non-addressable static variables.
9450 Enabled by default at @option{-O} and higher.
9451
9452 @item -fipa-stack-alignment
9453 @opindex fipa-stack-alignment
9454 Reduce stack alignment on call sites if possible.
9455 Enabled by default.
9456
9457 @item -fipa-pta
9458 @opindex fipa-pta
9459 Perform interprocedural pointer analysis and interprocedural modification
9460 and reference analysis. This option can cause excessive memory and
9461 compile-time usage on large compilation units. It is not enabled by
9462 default at any optimization level.
9463
9464 @item -fipa-profile
9465 @opindex fipa-profile
9466 Perform interprocedural profile propagation. The functions called only from
9467 cold functions are marked as cold. Also functions executed once (such as
9468 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9469 functions and loop less parts of functions executed once are then optimized for
9470 size.
9471 Enabled by default at @option{-O} and higher.
9472
9473 @item -fipa-cp
9474 @opindex fipa-cp
9475 Perform interprocedural constant propagation.
9476 This optimization analyzes the program to determine when values passed
9477 to functions are constants and then optimizes accordingly.
9478 This optimization can substantially increase performance
9479 if the application has constants passed to functions.
9480 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9481 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9482
9483 @item -fipa-cp-clone
9484 @opindex fipa-cp-clone
9485 Perform function cloning to make interprocedural constant propagation stronger.
9486 When enabled, interprocedural constant propagation performs function cloning
9487 when externally visible function can be called with constant arguments.
9488 Because this optimization can create multiple copies of functions,
9489 it may significantly increase code size
9490 (see @option{--param ipcp-unit-growth=@var{value}}).
9491 This flag is enabled by default at @option{-O3}.
9492 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9493
9494 @item -fipa-bit-cp
9495 @opindex fipa-bit-cp
9496 When enabled, perform interprocedural bitwise constant
9497 propagation. This flag is enabled by default at @option{-O2} and
9498 by @option{-fprofile-use} and @option{-fauto-profile}.
9499 It requires that @option{-fipa-cp} is enabled.
9500
9501 @item -fipa-vrp
9502 @opindex fipa-vrp
9503 When enabled, perform interprocedural propagation of value
9504 ranges. This flag is enabled by default at @option{-O2}. It requires
9505 that @option{-fipa-cp} is enabled.
9506
9507 @item -fipa-icf
9508 @opindex fipa-icf
9509 Perform Identical Code Folding for functions and read-only variables.
9510 The optimization reduces code size and may disturb unwind stacks by replacing
9511 a function by equivalent one with a different name. The optimization works
9512 more effectively with link-time optimization enabled.
9513
9514 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9515 works on different levels and thus the optimizations are not same - there are
9516 equivalences that are found only by GCC and equivalences found only by Gold.
9517
9518 This flag is enabled by default at @option{-O2} and @option{-Os}.
9519
9520 @item -flive-patching=@var{level}
9521 @opindex flive-patching
9522 Control GCC's optimizations to produce output suitable for live-patching.
9523
9524 If the compiler's optimization uses a function's body or information extracted
9525 from its body to optimize/change another function, the latter is called an
9526 impacted function of the former. If a function is patched, its impacted
9527 functions should be patched too.
9528
9529 The impacted functions are determined by the compiler's interprocedural
9530 optimizations. For example, a caller is impacted when inlining a function
9531 into its caller,
9532 cloning a function and changing its caller to call this new clone,
9533 or extracting a function's pureness/constness information to optimize
9534 its direct or indirect callers, etc.
9535
9536 Usually, the more IPA optimizations enabled, the larger the number of
9537 impacted functions for each function. In order to control the number of
9538 impacted functions and more easily compute the list of impacted function,
9539 IPA optimizations can be partially enabled at two different levels.
9540
9541 The @var{level} argument should be one of the following:
9542
9543 @table @samp
9544
9545 @item inline-clone
9546
9547 Only enable inlining and cloning optimizations, which includes inlining,
9548 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9549 As a result, when patching a function, all its callers and its clones'
9550 callers are impacted, therefore need to be patched as well.
9551
9552 @option{-flive-patching=inline-clone} disables the following optimization flags:
9553 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9554 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9555 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9556 -fipa-stack-alignment}
9557
9558 @item inline-only-static
9559
9560 Only enable inlining of static functions.
9561 As a result, when patching a static function, all its callers are impacted
9562 and so need to be patched as well.
9563
9564 In addition to all the flags that @option{-flive-patching=inline-clone}
9565 disables,
9566 @option{-flive-patching=inline-only-static} disables the following additional
9567 optimization flags:
9568 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9569
9570 @end table
9571
9572 When @option{-flive-patching} is specified without any value, the default value
9573 is @var{inline-clone}.
9574
9575 This flag is disabled by default.
9576
9577 Note that @option{-flive-patching} is not supported with link-time optimization
9578 (@option{-flto}).
9579
9580 @item -fisolate-erroneous-paths-dereference
9581 @opindex fisolate-erroneous-paths-dereference
9582 Detect paths that trigger erroneous or undefined behavior due to
9583 dereferencing a null pointer. Isolate those paths from the main control
9584 flow and turn the statement with erroneous or undefined behavior into a trap.
9585 This flag is enabled by default at @option{-O2} and higher and depends on
9586 @option{-fdelete-null-pointer-checks} also being enabled.
9587
9588 @item -fisolate-erroneous-paths-attribute
9589 @opindex fisolate-erroneous-paths-attribute
9590 Detect paths that trigger erroneous or undefined behavior due to a null value
9591 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9592 attribute. Isolate those paths from the main control flow and turn the
9593 statement with erroneous or undefined behavior into a trap. This is not
9594 currently enabled, but may be enabled by @option{-O2} in the future.
9595
9596 @item -ftree-sink
9597 @opindex ftree-sink
9598 Perform forward store motion on trees. This flag is
9599 enabled by default at @option{-O} and higher.
9600
9601 @item -ftree-bit-ccp
9602 @opindex ftree-bit-ccp
9603 Perform sparse conditional bit constant propagation on trees and propagate
9604 pointer alignment information.
9605 This pass only operates on local scalar variables and is enabled by default
9606 at @option{-O1} and higher, except for @option{-Og}.
9607 It requires that @option{-ftree-ccp} is enabled.
9608
9609 @item -ftree-ccp
9610 @opindex ftree-ccp
9611 Perform sparse conditional constant propagation (CCP) on trees. This
9612 pass only operates on local scalar variables and is enabled by default
9613 at @option{-O} and higher.
9614
9615 @item -fssa-backprop
9616 @opindex fssa-backprop
9617 Propagate information about uses of a value up the definition chain
9618 in order to simplify the definitions. For example, this pass strips
9619 sign operations if the sign of a value never matters. The flag is
9620 enabled by default at @option{-O} and higher.
9621
9622 @item -fssa-phiopt
9623 @opindex fssa-phiopt
9624 Perform pattern matching on SSA PHI nodes to optimize conditional
9625 code. This pass is enabled by default at @option{-O1} and higher,
9626 except for @option{-Og}.
9627
9628 @item -ftree-switch-conversion
9629 @opindex ftree-switch-conversion
9630 Perform conversion of simple initializations in a switch to
9631 initializations from a scalar array. This flag is enabled by default
9632 at @option{-O2} and higher.
9633
9634 @item -ftree-tail-merge
9635 @opindex ftree-tail-merge
9636 Look for identical code sequences. When found, replace one with a jump to the
9637 other. This optimization is known as tail merging or cross jumping. This flag
9638 is enabled by default at @option{-O2} and higher. The compilation time
9639 in this pass can
9640 be limited using @option{max-tail-merge-comparisons} parameter and
9641 @option{max-tail-merge-iterations} parameter.
9642
9643 @item -ftree-dce
9644 @opindex ftree-dce
9645 Perform dead code elimination (DCE) on trees. This flag is enabled by
9646 default at @option{-O} and higher.
9647
9648 @item -ftree-builtin-call-dce
9649 @opindex ftree-builtin-call-dce
9650 Perform conditional dead code elimination (DCE) for calls to built-in functions
9651 that may set @code{errno} but are otherwise free of side effects. This flag is
9652 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9653 specified.
9654
9655 @item -ffinite-loops
9656 @opindex ffinite-loops
9657 @opindex fno-finite-loops
9658 Assume that a loop with an exit will eventually take the exit and not loop
9659 indefinitely. This allows the compiler to remove loops that otherwise have
9660 no side-effects, not considering eventual endless looping as such.
9661
9662 This option is enabled by default at @option{-O2}.
9663
9664 @item -ftree-dominator-opts
9665 @opindex ftree-dominator-opts
9666 Perform a variety of simple scalar cleanups (constant/copy
9667 propagation, redundancy elimination, range propagation and expression
9668 simplification) based on a dominator tree traversal. This also
9669 performs jump threading (to reduce jumps to jumps). This flag is
9670 enabled by default at @option{-O} and higher.
9671
9672 @item -ftree-dse
9673 @opindex ftree-dse
9674 Perform dead store elimination (DSE) on trees. A dead store is a store into
9675 a memory location that is later overwritten by another store without
9676 any intervening loads. In this case the earlier store can be deleted. This
9677 flag is enabled by default at @option{-O} and higher.
9678
9679 @item -ftree-ch
9680 @opindex ftree-ch
9681 Perform loop header copying on trees. This is beneficial since it increases
9682 effectiveness of code motion optimizations. It also saves one jump. This flag
9683 is enabled by default at @option{-O} and higher. It is not enabled
9684 for @option{-Os}, since it usually increases code size.
9685
9686 @item -ftree-loop-optimize
9687 @opindex ftree-loop-optimize
9688 Perform loop optimizations on trees. This flag is enabled by default
9689 at @option{-O} and higher.
9690
9691 @item -ftree-loop-linear
9692 @itemx -floop-strip-mine
9693 @itemx -floop-block
9694 @opindex ftree-loop-linear
9695 @opindex floop-strip-mine
9696 @opindex floop-block
9697 Perform loop nest optimizations. Same as
9698 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9699 to be configured with @option{--with-isl} to enable the Graphite loop
9700 transformation infrastructure.
9701
9702 @item -fgraphite-identity
9703 @opindex fgraphite-identity
9704 Enable the identity transformation for graphite. For every SCoP we generate
9705 the polyhedral representation and transform it back to gimple. Using
9706 @option{-fgraphite-identity} we can check the costs or benefits of the
9707 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9708 are also performed by the code generator isl, like index splitting and
9709 dead code elimination in loops.
9710
9711 @item -floop-nest-optimize
9712 @opindex floop-nest-optimize
9713 Enable the isl based loop nest optimizer. This is a generic loop nest
9714 optimizer based on the Pluto optimization algorithms. It calculates a loop
9715 structure optimized for data-locality and parallelism. This option
9716 is experimental.
9717
9718 @item -floop-parallelize-all
9719 @opindex floop-parallelize-all
9720 Use the Graphite data dependence analysis to identify loops that can
9721 be parallelized. Parallelize all the loops that can be analyzed to
9722 not contain loop carried dependences without checking that it is
9723 profitable to parallelize the loops.
9724
9725 @item -ftree-coalesce-vars
9726 @opindex ftree-coalesce-vars
9727 While transforming the program out of the SSA representation, attempt to
9728 reduce copying by coalescing versions of different user-defined
9729 variables, instead of just compiler temporaries. This may severely
9730 limit the ability to debug an optimized program compiled with
9731 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9732 prevents SSA coalescing of user variables. This option is enabled by
9733 default if optimization is enabled, and it does very little otherwise.
9734
9735 @item -ftree-loop-if-convert
9736 @opindex ftree-loop-if-convert
9737 Attempt to transform conditional jumps in the innermost loops to
9738 branch-less equivalents. The intent is to remove control-flow from
9739 the innermost loops in order to improve the ability of the
9740 vectorization pass to handle these loops. This is enabled by default
9741 if vectorization is enabled.
9742
9743 @item -ftree-loop-distribution
9744 @opindex ftree-loop-distribution
9745 Perform loop distribution. This flag can improve cache performance on
9746 big loop bodies and allow further loop optimizations, like
9747 parallelization or vectorization, to take place. For example, the loop
9748 @smallexample
9749 DO I = 1, N
9750 A(I) = B(I) + C
9751 D(I) = E(I) * F
9752 ENDDO
9753 @end smallexample
9754 is transformed to
9755 @smallexample
9756 DO I = 1, N
9757 A(I) = B(I) + C
9758 ENDDO
9759 DO I = 1, N
9760 D(I) = E(I) * F
9761 ENDDO
9762 @end smallexample
9763 This flag is enabled by default at @option{-O3}.
9764 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9765
9766 @item -ftree-loop-distribute-patterns
9767 @opindex ftree-loop-distribute-patterns
9768 Perform loop distribution of patterns that can be code generated with
9769 calls to a library. This flag is enabled by default at @option{-O3}, and
9770 by @option{-fprofile-use} and @option{-fauto-profile}.
9771
9772 This pass distributes the initialization loops and generates a call to
9773 memset zero. For example, the loop
9774 @smallexample
9775 DO I = 1, N
9776 A(I) = 0
9777 B(I) = A(I) + I
9778 ENDDO
9779 @end smallexample
9780 is transformed to
9781 @smallexample
9782 DO I = 1, N
9783 A(I) = 0
9784 ENDDO
9785 DO I = 1, N
9786 B(I) = A(I) + I
9787 ENDDO
9788 @end smallexample
9789 and the initialization loop is transformed into a call to memset zero.
9790 This flag is enabled by default at @option{-O3}.
9791 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9792
9793 @item -floop-interchange
9794 @opindex floop-interchange
9795 Perform loop interchange outside of graphite. This flag can improve cache
9796 performance on loop nest and allow further loop optimizations, like
9797 vectorization, to take place. For example, the loop
9798 @smallexample
9799 for (int i = 0; i < N; i++)
9800 for (int j = 0; j < N; j++)
9801 for (int k = 0; k < N; k++)
9802 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9803 @end smallexample
9804 is transformed to
9805 @smallexample
9806 for (int i = 0; i < N; i++)
9807 for (int k = 0; k < N; k++)
9808 for (int j = 0; j < N; j++)
9809 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9810 @end smallexample
9811 This flag is enabled by default at @option{-O3}.
9812 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9813
9814 @item -floop-unroll-and-jam
9815 @opindex floop-unroll-and-jam
9816 Apply unroll and jam transformations on feasible loops. In a loop
9817 nest this unrolls the outer loop by some factor and fuses the resulting
9818 multiple inner loops. This flag is enabled by default at @option{-O3}.
9819 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9820
9821 @item -ftree-loop-im
9822 @opindex ftree-loop-im
9823 Perform loop invariant motion on trees. This pass moves only invariants that
9824 are hard to handle at RTL level (function calls, operations that expand to
9825 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9826 operands of conditions that are invariant out of the loop, so that we can use
9827 just trivial invariantness analysis in loop unswitching. The pass also includes
9828 store motion.
9829
9830 @item -ftree-loop-ivcanon
9831 @opindex ftree-loop-ivcanon
9832 Create a canonical counter for number of iterations in loops for which
9833 determining number of iterations requires complicated analysis. Later
9834 optimizations then may determine the number easily. Useful especially
9835 in connection with unrolling.
9836
9837 @item -ftree-scev-cprop
9838 @opindex ftree-scev-cprop
9839 Perform final value replacement. If a variable is modified in a loop
9840 in such a way that its value when exiting the loop can be determined using
9841 only its initial value and the number of loop iterations, replace uses of
9842 the final value by such a computation, provided it is sufficiently cheap.
9843 This reduces data dependencies and may allow further simplifications.
9844 Enabled by default at @option{-O} and higher.
9845
9846 @item -fivopts
9847 @opindex fivopts
9848 Perform induction variable optimizations (strength reduction, induction
9849 variable merging and induction variable elimination) on trees.
9850
9851 @item -ftree-parallelize-loops=n
9852 @opindex ftree-parallelize-loops
9853 Parallelize loops, i.e., split their iteration space to run in n threads.
9854 This is only possible for loops whose iterations are independent
9855 and can be arbitrarily reordered. The optimization is only
9856 profitable on multiprocessor machines, for loops that are CPU-intensive,
9857 rather than constrained e.g.@: by memory bandwidth. This option
9858 implies @option{-pthread}, and thus is only supported on targets
9859 that have support for @option{-pthread}.
9860
9861 @item -ftree-pta
9862 @opindex ftree-pta
9863 Perform function-local points-to analysis on trees. This flag is
9864 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9865
9866 @item -ftree-sra
9867 @opindex ftree-sra
9868 Perform scalar replacement of aggregates. This pass replaces structure
9869 references with scalars to prevent committing structures to memory too
9870 early. This flag is enabled by default at @option{-O1} and higher,
9871 except for @option{-Og}.
9872
9873 @item -fstore-merging
9874 @opindex fstore-merging
9875 Perform merging of narrow stores to consecutive memory addresses. This pass
9876 merges contiguous stores of immediate values narrower than a word into fewer
9877 wider stores to reduce the number of instructions. This is enabled by default
9878 at @option{-O2} and higher as well as @option{-Os}.
9879
9880 @item -ftree-ter
9881 @opindex ftree-ter
9882 Perform temporary expression replacement during the SSA->normal phase. Single
9883 use/single def temporaries are replaced at their use location with their
9884 defining expression. This results in non-GIMPLE code, but gives the expanders
9885 much more complex trees to work on resulting in better RTL generation. This is
9886 enabled by default at @option{-O} and higher.
9887
9888 @item -ftree-slsr
9889 @opindex ftree-slsr
9890 Perform straight-line strength reduction on trees. This recognizes related
9891 expressions involving multiplications and replaces them by less expensive
9892 calculations when possible. This is enabled by default at @option{-O} and
9893 higher.
9894
9895 @item -ftree-vectorize
9896 @opindex ftree-vectorize
9897 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9898 and @option{-ftree-slp-vectorize} if not explicitly specified.
9899
9900 @item -ftree-loop-vectorize
9901 @opindex ftree-loop-vectorize
9902 Perform loop vectorization on trees. This flag is enabled by default at
9903 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9904 and @option{-fauto-profile}.
9905
9906 @item -ftree-slp-vectorize
9907 @opindex ftree-slp-vectorize
9908 Perform basic block vectorization on trees. This flag is enabled by default at
9909 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9910 and @option{-fauto-profile}.
9911
9912 @item -fvect-cost-model=@var{model}
9913 @opindex fvect-cost-model
9914 Alter the cost model used for vectorization. The @var{model} argument
9915 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9916 With the @samp{unlimited} model the vectorized code-path is assumed
9917 to be profitable while with the @samp{dynamic} model a runtime check
9918 guards the vectorized code-path to enable it only for iteration
9919 counts that will likely execute faster than when executing the original
9920 scalar loop. The @samp{cheap} model disables vectorization of
9921 loops where doing so would be cost prohibitive for example due to
9922 required runtime checks for data dependence or alignment but otherwise
9923 is equal to the @samp{dynamic} model.
9924 The default cost model depends on other optimization flags and is
9925 either @samp{dynamic} or @samp{cheap}.
9926
9927 @item -fsimd-cost-model=@var{model}
9928 @opindex fsimd-cost-model
9929 Alter the cost model used for vectorization of loops marked with the OpenMP
9930 simd directive. The @var{model} argument should be one of
9931 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9932 have the same meaning as described in @option{-fvect-cost-model} and by
9933 default a cost model defined with @option{-fvect-cost-model} is used.
9934
9935 @item -ftree-vrp
9936 @opindex ftree-vrp
9937 Perform Value Range Propagation on trees. This is similar to the
9938 constant propagation pass, but instead of values, ranges of values are
9939 propagated. This allows the optimizers to remove unnecessary range
9940 checks like array bound checks and null pointer checks. This is
9941 enabled by default at @option{-O2} and higher. Null pointer check
9942 elimination is only done if @option{-fdelete-null-pointer-checks} is
9943 enabled.
9944
9945 @item -fsplit-paths
9946 @opindex fsplit-paths
9947 Split paths leading to loop backedges. This can improve dead code
9948 elimination and common subexpression elimination. This is enabled by
9949 default at @option{-O3} and above.
9950
9951 @item -fsplit-ivs-in-unroller
9952 @opindex fsplit-ivs-in-unroller
9953 Enables expression of values of induction variables in later iterations
9954 of the unrolled loop using the value in the first iteration. This breaks
9955 long dependency chains, thus improving efficiency of the scheduling passes.
9956
9957 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9958 same effect. However, that is not reliable in cases where the loop body
9959 is more complicated than a single basic block. It also does not work at all
9960 on some architectures due to restrictions in the CSE pass.
9961
9962 This optimization is enabled by default.
9963
9964 @item -fvariable-expansion-in-unroller
9965 @opindex fvariable-expansion-in-unroller
9966 With this option, the compiler creates multiple copies of some
9967 local variables when unrolling a loop, which can result in superior code.
9968
9969 This optimization is enabled by default for PowerPC targets, but disabled
9970 by default otherwise.
9971
9972 @item -fpartial-inlining
9973 @opindex fpartial-inlining
9974 Inline parts of functions. This option has any effect only
9975 when inlining itself is turned on by the @option{-finline-functions}
9976 or @option{-finline-small-functions} options.
9977
9978 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9979
9980 @item -fpredictive-commoning
9981 @opindex fpredictive-commoning
9982 Perform predictive commoning optimization, i.e., reusing computations
9983 (especially memory loads and stores) performed in previous
9984 iterations of loops.
9985
9986 This option is enabled at level @option{-O3}.
9987 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9988
9989 @item -fprefetch-loop-arrays
9990 @opindex fprefetch-loop-arrays
9991 If supported by the target machine, generate instructions to prefetch
9992 memory to improve the performance of loops that access large arrays.
9993
9994 This option may generate better or worse code; results are highly
9995 dependent on the structure of loops within the source code.
9996
9997 Disabled at level @option{-Os}.
9998
9999 @item -fno-printf-return-value
10000 @opindex fno-printf-return-value
10001 @opindex fprintf-return-value
10002 Do not substitute constants for known return value of formatted output
10003 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10004 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
10005 transformation allows GCC to optimize or even eliminate branches based
10006 on the known return value of these functions called with arguments that
10007 are either constant, or whose values are known to be in a range that
10008 makes determining the exact return value possible. For example, when
10009 @option{-fprintf-return-value} is in effect, both the branch and the
10010 body of the @code{if} statement (but not the call to @code{snprint})
10011 can be optimized away when @code{i} is a 32-bit or smaller integer
10012 because the return value is guaranteed to be at most 8.
10013
10014 @smallexample
10015 char buf[9];
10016 if (snprintf (buf, "%08x", i) >= sizeof buf)
10017 @dots{}
10018 @end smallexample
10019
10020 The @option{-fprintf-return-value} option relies on other optimizations
10021 and yields best results with @option{-O2} and above. It works in tandem
10022 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10023 options. The @option{-fprintf-return-value} option is enabled by default.
10024
10025 @item -fno-peephole
10026 @itemx -fno-peephole2
10027 @opindex fno-peephole
10028 @opindex fpeephole
10029 @opindex fno-peephole2
10030 @opindex fpeephole2
10031 Disable any machine-specific peephole optimizations. The difference
10032 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10033 are implemented in the compiler; some targets use one, some use the
10034 other, a few use both.
10035
10036 @option{-fpeephole} is enabled by default.
10037 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10038
10039 @item -fno-guess-branch-probability
10040 @opindex fno-guess-branch-probability
10041 @opindex fguess-branch-probability
10042 Do not guess branch probabilities using heuristics.
10043
10044 GCC uses heuristics to guess branch probabilities if they are
10045 not provided by profiling feedback (@option{-fprofile-arcs}). These
10046 heuristics are based on the control flow graph. If some branch probabilities
10047 are specified by @code{__builtin_expect}, then the heuristics are
10048 used to guess branch probabilities for the rest of the control flow graph,
10049 taking the @code{__builtin_expect} info into account. The interactions
10050 between the heuristics and @code{__builtin_expect} can be complex, and in
10051 some cases, it may be useful to disable the heuristics so that the effects
10052 of @code{__builtin_expect} are easier to understand.
10053
10054 It is also possible to specify expected probability of the expression
10055 with @code{__builtin_expect_with_probability} built-in function.
10056
10057 The default is @option{-fguess-branch-probability} at levels
10058 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10059
10060 @item -freorder-blocks
10061 @opindex freorder-blocks
10062 Reorder basic blocks in the compiled function in order to reduce number of
10063 taken branches and improve code locality.
10064
10065 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10066
10067 @item -freorder-blocks-algorithm=@var{algorithm}
10068 @opindex freorder-blocks-algorithm
10069 Use the specified algorithm for basic block reordering. The
10070 @var{algorithm} argument can be @samp{simple}, which does not increase
10071 code size (except sometimes due to secondary effects like alignment),
10072 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10073 put all often executed code together, minimizing the number of branches
10074 executed by making extra copies of code.
10075
10076 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10077 @samp{stc} at levels @option{-O2}, @option{-O3}.
10078
10079 @item -freorder-blocks-and-partition
10080 @opindex freorder-blocks-and-partition
10081 In addition to reordering basic blocks in the compiled function, in order
10082 to reduce number of taken branches, partitions hot and cold basic blocks
10083 into separate sections of the assembly and @file{.o} files, to improve
10084 paging and cache locality performance.
10085
10086 This optimization is automatically turned off in the presence of
10087 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10088 section attribute and on any architecture that does not support named
10089 sections. When @option{-fsplit-stack} is used this option is not
10090 enabled by default (to avoid linker errors), but may be enabled
10091 explicitly (if using a working linker).
10092
10093 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10094
10095 @item -freorder-functions
10096 @opindex freorder-functions
10097 Reorder functions in the object file in order to
10098 improve code locality. This is implemented by using special
10099 subsections @code{.text.hot} for most frequently executed functions and
10100 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10101 the linker so object file format must support named sections and linker must
10102 place them in a reasonable way.
10103
10104 This option isn't effective unless you either provide profile feedback
10105 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10106 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10107
10108 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10109
10110 @item -fstrict-aliasing
10111 @opindex fstrict-aliasing
10112 Allow the compiler to assume the strictest aliasing rules applicable to
10113 the language being compiled. For C (and C++), this activates
10114 optimizations based on the type of expressions. In particular, an
10115 object of one type is assumed never to reside at the same address as an
10116 object of a different type, unless the types are almost the same. For
10117 example, an @code{unsigned int} can alias an @code{int}, but not a
10118 @code{void*} or a @code{double}. A character type may alias any other
10119 type.
10120
10121 @anchor{Type-punning}Pay special attention to code like this:
10122 @smallexample
10123 union a_union @{
10124 int i;
10125 double d;
10126 @};
10127
10128 int f() @{
10129 union a_union t;
10130 t.d = 3.0;
10131 return t.i;
10132 @}
10133 @end smallexample
10134 The practice of reading from a different union member than the one most
10135 recently written to (called ``type-punning'') is common. Even with
10136 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10137 is accessed through the union type. So, the code above works as
10138 expected. @xref{Structures unions enumerations and bit-fields
10139 implementation}. However, this code might not:
10140 @smallexample
10141 int f() @{
10142 union a_union t;
10143 int* ip;
10144 t.d = 3.0;
10145 ip = &t.i;
10146 return *ip;
10147 @}
10148 @end smallexample
10149
10150 Similarly, access by taking the address, casting the resulting pointer
10151 and dereferencing the result has undefined behavior, even if the cast
10152 uses a union type, e.g.:
10153 @smallexample
10154 int f() @{
10155 double d = 3.0;
10156 return ((union a_union *) &d)->i;
10157 @}
10158 @end smallexample
10159
10160 The @option{-fstrict-aliasing} option is enabled at levels
10161 @option{-O2}, @option{-O3}, @option{-Os}.
10162
10163 @item -falign-functions
10164 @itemx -falign-functions=@var{n}
10165 @itemx -falign-functions=@var{n}:@var{m}
10166 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10167 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10168 @opindex falign-functions
10169 Align the start of functions to the next power-of-two greater than
10170 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10171 the first @var{m} bytes of the function can be fetched by the CPU
10172 without crossing an @var{n}-byte alignment boundary.
10173
10174 If @var{m} is not specified, it defaults to @var{n}.
10175
10176 Examples: @option{-falign-functions=32} aligns functions to the next
10177 32-byte boundary, @option{-falign-functions=24} aligns to the next
10178 32-byte boundary only if this can be done by skipping 23 bytes or less,
10179 @option{-falign-functions=32:7} aligns to the next
10180 32-byte boundary only if this can be done by skipping 6 bytes or less.
10181
10182 The second pair of @var{n2}:@var{m2} values allows you to specify
10183 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10184 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10185 otherwise aligns to the next 32-byte boundary if this can be done
10186 by skipping 2 bytes or less.
10187 If @var{m2} is not specified, it defaults to @var{n2}.
10188
10189 Some assemblers only support this flag when @var{n} is a power of two;
10190 in that case, it is rounded up.
10191
10192 @option{-fno-align-functions} and @option{-falign-functions=1} are
10193 equivalent and mean that functions are not aligned.
10194
10195 If @var{n} is not specified or is zero, use a machine-dependent default.
10196 The maximum allowed @var{n} option value is 65536.
10197
10198 Enabled at levels @option{-O2}, @option{-O3}.
10199
10200 @item -flimit-function-alignment
10201 If this option is enabled, the compiler tries to avoid unnecessarily
10202 overaligning functions. It attempts to instruct the assembler to align
10203 by the amount specified by @option{-falign-functions}, but not to
10204 skip more bytes than the size of the function.
10205
10206 @item -falign-labels
10207 @itemx -falign-labels=@var{n}
10208 @itemx -falign-labels=@var{n}:@var{m}
10209 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10210 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10211 @opindex falign-labels
10212 Align all branch targets to a power-of-two boundary.
10213
10214 Parameters of this option are analogous to the @option{-falign-functions} option.
10215 @option{-fno-align-labels} and @option{-falign-labels=1} are
10216 equivalent and mean that labels are not aligned.
10217
10218 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10219 are greater than this value, then their values are used instead.
10220
10221 If @var{n} is not specified or is zero, use a machine-dependent default
10222 which is very likely to be @samp{1}, meaning no alignment.
10223 The maximum allowed @var{n} option value is 65536.
10224
10225 Enabled at levels @option{-O2}, @option{-O3}.
10226
10227 @item -falign-loops
10228 @itemx -falign-loops=@var{n}
10229 @itemx -falign-loops=@var{n}:@var{m}
10230 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10231 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10232 @opindex falign-loops
10233 Align loops to a power-of-two boundary. If the loops are executed
10234 many times, this makes up for any execution of the dummy padding
10235 instructions.
10236
10237 Parameters of this option are analogous to the @option{-falign-functions} option.
10238 @option{-fno-align-loops} and @option{-falign-loops=1} are
10239 equivalent and mean that loops are not aligned.
10240 The maximum allowed @var{n} option value is 65536.
10241
10242 If @var{n} is not specified or is zero, use a machine-dependent default.
10243
10244 Enabled at levels @option{-O2}, @option{-O3}.
10245
10246 @item -falign-jumps
10247 @itemx -falign-jumps=@var{n}
10248 @itemx -falign-jumps=@var{n}:@var{m}
10249 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10250 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10251 @opindex falign-jumps
10252 Align branch targets to a power-of-two boundary, for branch targets
10253 where the targets can only be reached by jumping. In this case,
10254 no dummy operations need be executed.
10255
10256 Parameters of this option are analogous to the @option{-falign-functions} option.
10257 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10258 equivalent and mean that loops are not aligned.
10259
10260 If @var{n} is not specified or is zero, use a machine-dependent default.
10261 The maximum allowed @var{n} option value is 65536.
10262
10263 Enabled at levels @option{-O2}, @option{-O3}.
10264
10265 @item -fallow-store-data-races
10266 @opindex fallow-store-data-races
10267 Allow the compiler to introduce new data races on stores.
10268
10269 Enabled at level @option{-Ofast}.
10270
10271 @item -funit-at-a-time
10272 @opindex funit-at-a-time
10273 This option is left for compatibility reasons. @option{-funit-at-a-time}
10274 has no effect, while @option{-fno-unit-at-a-time} implies
10275 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10276
10277 Enabled by default.
10278
10279 @item -fno-toplevel-reorder
10280 @opindex fno-toplevel-reorder
10281 @opindex ftoplevel-reorder
10282 Do not reorder top-level functions, variables, and @code{asm}
10283 statements. Output them in the same order that they appear in the
10284 input file. When this option is used, unreferenced static variables
10285 are not removed. This option is intended to support existing code
10286 that relies on a particular ordering. For new code, it is better to
10287 use attributes when possible.
10288
10289 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10290 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10291 Additionally @option{-fno-toplevel-reorder} implies
10292 @option{-fno-section-anchors}.
10293
10294 @item -fweb
10295 @opindex fweb
10296 Constructs webs as commonly used for register allocation purposes and assign
10297 each web individual pseudo register. This allows the register allocation pass
10298 to operate on pseudos directly, but also strengthens several other optimization
10299 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10300 however, make debugging impossible, since variables no longer stay in a
10301 ``home register''.
10302
10303 Enabled by default with @option{-funroll-loops}.
10304
10305 @item -fwhole-program
10306 @opindex fwhole-program
10307 Assume that the current compilation unit represents the whole program being
10308 compiled. All public functions and variables with the exception of @code{main}
10309 and those merged by attribute @code{externally_visible} become static functions
10310 and in effect are optimized more aggressively by interprocedural optimizers.
10311
10312 This option should not be used in combination with @option{-flto}.
10313 Instead relying on a linker plugin should provide safer and more precise
10314 information.
10315
10316 @item -flto[=@var{n}]
10317 @opindex flto
10318 This option runs the standard link-time optimizer. When invoked
10319 with source code, it generates GIMPLE (one of GCC's internal
10320 representations) and writes it to special ELF sections in the object
10321 file. When the object files are linked together, all the function
10322 bodies are read from these ELF sections and instantiated as if they
10323 had been part of the same translation unit.
10324
10325 To use the link-time optimizer, @option{-flto} and optimization
10326 options should be specified at compile time and during the final link.
10327 It is recommended that you compile all the files participating in the
10328 same link with the same options and also specify those options at
10329 link time.
10330 For example:
10331
10332 @smallexample
10333 gcc -c -O2 -flto foo.c
10334 gcc -c -O2 -flto bar.c
10335 gcc -o myprog -flto -O2 foo.o bar.o
10336 @end smallexample
10337
10338 The first two invocations to GCC save a bytecode representation
10339 of GIMPLE into special ELF sections inside @file{foo.o} and
10340 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10341 @file{foo.o} and @file{bar.o}, merges the two files into a single
10342 internal image, and compiles the result as usual. Since both
10343 @file{foo.o} and @file{bar.o} are merged into a single image, this
10344 causes all the interprocedural analyses and optimizations in GCC to
10345 work across the two files as if they were a single one. This means,
10346 for example, that the inliner is able to inline functions in
10347 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10348
10349 Another (simpler) way to enable link-time optimization is:
10350
10351 @smallexample
10352 gcc -o myprog -flto -O2 foo.c bar.c
10353 @end smallexample
10354
10355 The above generates bytecode for @file{foo.c} and @file{bar.c},
10356 merges them together into a single GIMPLE representation and optimizes
10357 them as usual to produce @file{myprog}.
10358
10359 The important thing to keep in mind is that to enable link-time
10360 optimizations you need to use the GCC driver to perform the link step.
10361 GCC automatically performs link-time optimization if any of the
10362 objects involved were compiled with the @option{-flto} command-line option.
10363 You can always override
10364 the automatic decision to do link-time optimization
10365 by passing @option{-fno-lto} to the link command.
10366
10367 To make whole program optimization effective, it is necessary to make
10368 certain whole program assumptions. The compiler needs to know
10369 what functions and variables can be accessed by libraries and runtime
10370 outside of the link-time optimized unit. When supported by the linker,
10371 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10372 to the compiler about used and externally visible symbols. When
10373 the linker plugin is not available, @option{-fwhole-program} should be
10374 used to allow the compiler to make these assumptions, which leads
10375 to more aggressive optimization decisions.
10376
10377 When a file is compiled with @option{-flto} without
10378 @option{-fuse-linker-plugin}, the generated object file is larger than
10379 a regular object file because it contains GIMPLE bytecodes and the usual
10380 final code (see @option{-ffat-lto-objects}. This means that
10381 object files with LTO information can be linked as normal object
10382 files; if @option{-fno-lto} is passed to the linker, no
10383 interprocedural optimizations are applied. Note that when
10384 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10385 but you cannot perform a regular, non-LTO link on them.
10386
10387 When producing the final binary, GCC only
10388 applies link-time optimizations to those files that contain bytecode.
10389 Therefore, you can mix and match object files and libraries with
10390 GIMPLE bytecodes and final object code. GCC automatically selects
10391 which files to optimize in LTO mode and which files to link without
10392 further processing.
10393
10394 Generally, options specified at link time override those
10395 specified at compile time, although in some cases GCC attempts to infer
10396 link-time options from the settings used to compile the input files.
10397
10398 If you do not specify an optimization level option @option{-O} at
10399 link time, then GCC uses the highest optimization level
10400 used when compiling the object files. Note that it is generally
10401 ineffective to specify an optimization level option only at link time and
10402 not at compile time, for two reasons. First, compiling without
10403 optimization suppresses compiler passes that gather information
10404 needed for effective optimization at link time. Second, some early
10405 optimization passes can be performed only at compile time and
10406 not at link time.
10407
10408 There are some code generation flags preserved by GCC when
10409 generating bytecodes, as they need to be used during the final link.
10410 Currently, the following options and their settings are taken from
10411 the first object file that explicitly specifies them:
10412 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10413 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10414 and all the @option{-m} target flags.
10415
10416 Certain ABI-changing flags are required to match in all compilation units,
10417 and trying to override this at link time with a conflicting value
10418 is ignored. This includes options such as @option{-freg-struct-return}
10419 and @option{-fpcc-struct-return}.
10420
10421 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10422 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10423 are passed through to the link stage and merged conservatively for
10424 conflicting translation units. Specifically
10425 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10426 precedence; and for example @option{-ffp-contract=off} takes precedence
10427 over @option{-ffp-contract=fast}. You can override them at link time.
10428
10429 To enable debug info generation you need to supply @option{-g} at
10430 compile-time. If any of the input files at link time were built
10431 with debug info generation enabled the link will enable debug info
10432 generation as well. Any elaborate debug info settings
10433 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
10434 at the linker command line and mixing different settings in different
10435 translation units is discouraged.
10436
10437 If LTO encounters objects with C linkage declared with incompatible
10438 types in separate translation units to be linked together (undefined
10439 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10440 issued. The behavior is still undefined at run time. Similar
10441 diagnostics may be raised for other languages.
10442
10443 Another feature of LTO is that it is possible to apply interprocedural
10444 optimizations on files written in different languages:
10445
10446 @smallexample
10447 gcc -c -flto foo.c
10448 g++ -c -flto bar.cc
10449 gfortran -c -flto baz.f90
10450 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10451 @end smallexample
10452
10453 Notice that the final link is done with @command{g++} to get the C++
10454 runtime libraries and @option{-lgfortran} is added to get the Fortran
10455 runtime libraries. In general, when mixing languages in LTO mode, you
10456 should use the same link command options as when mixing languages in a
10457 regular (non-LTO) compilation.
10458
10459 If object files containing GIMPLE bytecode are stored in a library archive, say
10460 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10461 are using a linker with plugin support. To create static libraries suitable
10462 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10463 and @command{ranlib};
10464 to show the symbols of object files with GIMPLE bytecode, use
10465 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10466 and @command{nm} have been compiled with plugin support. At link time, use the
10467 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10468 the LTO optimization process:
10469
10470 @smallexample
10471 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10472 @end smallexample
10473
10474 With the linker plugin enabled, the linker extracts the needed
10475 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10476 to make them part of the aggregated GIMPLE image to be optimized.
10477
10478 If you are not using a linker with plugin support and/or do not
10479 enable the linker plugin, then the objects inside @file{libfoo.a}
10480 are extracted and linked as usual, but they do not participate
10481 in the LTO optimization process. In order to make a static library suitable
10482 for both LTO optimization and usual linkage, compile its object files with
10483 @option{-flto} @option{-ffat-lto-objects}.
10484
10485 Link-time optimizations do not require the presence of the whole program to
10486 operate. If the program does not require any symbols to be exported, it is
10487 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10488 the interprocedural optimizers to use more aggressive assumptions which may
10489 lead to improved optimization opportunities.
10490 Use of @option{-fwhole-program} is not needed when linker plugin is
10491 active (see @option{-fuse-linker-plugin}).
10492
10493 The current implementation of LTO makes no
10494 attempt to generate bytecode that is portable between different
10495 types of hosts. The bytecode files are versioned and there is a
10496 strict version check, so bytecode files generated in one version of
10497 GCC do not work with an older or newer version of GCC.
10498
10499 Link-time optimization does not work well with generation of debugging
10500 information on systems other than those using a combination of ELF and
10501 DWARF.
10502
10503 If you specify the optional @var{n}, the optimization and code
10504 generation done at link time is executed in parallel using @var{n}
10505 parallel jobs by utilizing an installed @command{make} program. The
10506 environment variable @env{MAKE} may be used to override the program
10507 used.
10508
10509 You can also specify @option{-flto=jobserver} to use GNU make's
10510 job server mode to determine the number of parallel jobs. This
10511 is useful when the Makefile calling GCC is already executing in parallel.
10512 You must prepend a @samp{+} to the command recipe in the parent Makefile
10513 for this to work. This option likely only works if @env{MAKE} is
10514 GNU make. Even without the option value, GCC tries to automatically
10515 detect a running GNU make's job server.
10516
10517 Use @option{-flto=auto} to use GNU make's job server, if available,
10518 or otherwise fall back to autodetection of the number of CPU threads
10519 present in your system.
10520
10521 @item -flto-partition=@var{alg}
10522 @opindex flto-partition
10523 Specify the partitioning algorithm used by the link-time optimizer.
10524 The value is either @samp{1to1} to specify a partitioning mirroring
10525 the original source files or @samp{balanced} to specify partitioning
10526 into equally sized chunks (whenever possible) or @samp{max} to create
10527 new partition for every symbol where possible. Specifying @samp{none}
10528 as an algorithm disables partitioning and streaming completely.
10529 The default value is @samp{balanced}. While @samp{1to1} can be used
10530 as an workaround for various code ordering issues, the @samp{max}
10531 partitioning is intended for internal testing only.
10532 The value @samp{one} specifies that exactly one partition should be
10533 used while the value @samp{none} bypasses partitioning and executes
10534 the link-time optimization step directly from the WPA phase.
10535
10536 @item -flto-compression-level=@var{n}
10537 @opindex flto-compression-level
10538 This option specifies the level of compression used for intermediate
10539 language written to LTO object files, and is only meaningful in
10540 conjunction with LTO mode (@option{-flto}). Valid
10541 values are 0 (no compression) to 9 (maximum compression). Values
10542 outside this range are clamped to either 0 or 9. If the option is not
10543 given, a default balanced compression setting is used.
10544
10545 @item -fuse-linker-plugin
10546 @opindex fuse-linker-plugin
10547 Enables the use of a linker plugin during link-time optimization. This
10548 option relies on plugin support in the linker, which is available in gold
10549 or in GNU ld 2.21 or newer.
10550
10551 This option enables the extraction of object files with GIMPLE bytecode out
10552 of library archives. This improves the quality of optimization by exposing
10553 more code to the link-time optimizer. This information specifies what
10554 symbols can be accessed externally (by non-LTO object or during dynamic
10555 linking). Resulting code quality improvements on binaries (and shared
10556 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10557 See @option{-flto} for a description of the effect of this flag and how to
10558 use it.
10559
10560 This option is enabled by default when LTO support in GCC is enabled
10561 and GCC was configured for use with
10562 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10563
10564 @item -ffat-lto-objects
10565 @opindex ffat-lto-objects
10566 Fat LTO objects are object files that contain both the intermediate language
10567 and the object code. This makes them usable for both LTO linking and normal
10568 linking. This option is effective only when compiling with @option{-flto}
10569 and is ignored at link time.
10570
10571 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10572 requires the complete toolchain to be aware of LTO. It requires a linker with
10573 linker plugin support for basic functionality. Additionally,
10574 @command{nm}, @command{ar} and @command{ranlib}
10575 need to support linker plugins to allow a full-featured build environment
10576 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10577 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10578 to these tools. With non fat LTO makefiles need to be modified to use them.
10579
10580 Note that modern binutils provide plugin auto-load mechanism.
10581 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10582 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10583 @command{gcc-ranlib}).
10584
10585 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10586 support.
10587
10588 @item -fcompare-elim
10589 @opindex fcompare-elim
10590 After register allocation and post-register allocation instruction splitting,
10591 identify arithmetic instructions that compute processor flags similar to a
10592 comparison operation based on that arithmetic. If possible, eliminate the
10593 explicit comparison operation.
10594
10595 This pass only applies to certain targets that cannot explicitly represent
10596 the comparison operation before register allocation is complete.
10597
10598 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10599
10600 @item -fcprop-registers
10601 @opindex fcprop-registers
10602 After register allocation and post-register allocation instruction splitting,
10603 perform a copy-propagation pass to try to reduce scheduling dependencies
10604 and occasionally eliminate the copy.
10605
10606 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10607
10608 @item -fprofile-correction
10609 @opindex fprofile-correction
10610 Profiles collected using an instrumented binary for multi-threaded programs may
10611 be inconsistent due to missed counter updates. When this option is specified,
10612 GCC uses heuristics to correct or smooth out such inconsistencies. By
10613 default, GCC emits an error message when an inconsistent profile is detected.
10614
10615 This option is enabled by @option{-fauto-profile}.
10616
10617 @item -fprofile-use
10618 @itemx -fprofile-use=@var{path}
10619 @opindex fprofile-use
10620 Enable profile feedback-directed optimizations,
10621 and the following optimizations, many of which
10622 are generally profitable only with profile feedback available:
10623
10624 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10625 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10626 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10627 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10628 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10629 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10630 -fprofile-reorder-functions}
10631
10632 Before you can use this option, you must first generate profiling information.
10633 @xref{Instrumentation Options}, for information about the
10634 @option{-fprofile-generate} option.
10635
10636 By default, GCC emits an error message if the feedback profiles do not
10637 match the source code. This error can be turned into a warning by using
10638 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10639 optimized code. Additionally, by default, GCC also emits a warning message if
10640 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10641
10642 If @var{path} is specified, GCC looks at the @var{path} to find
10643 the profile feedback data files. See @option{-fprofile-dir}.
10644
10645 @item -fauto-profile
10646 @itemx -fauto-profile=@var{path}
10647 @opindex fauto-profile
10648 Enable sampling-based feedback-directed optimizations,
10649 and the following optimizations,
10650 many of which are generally profitable only with profile feedback available:
10651
10652 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10653 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10654 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10655 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10656 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10657 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10658 -fprofile-correction}
10659
10660 @var{path} is the name of a file containing AutoFDO profile information.
10661 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10662
10663 Producing an AutoFDO profile data file requires running your program
10664 with the @command{perf} utility on a supported GNU/Linux target system.
10665 For more information, see @uref{https://perf.wiki.kernel.org/}.
10666
10667 E.g.
10668 @smallexample
10669 perf record -e br_inst_retired:near_taken -b -o perf.data \
10670 -- your_program
10671 @end smallexample
10672
10673 Then use the @command{create_gcov} tool to convert the raw profile data
10674 to a format that can be used by GCC.@ You must also supply the
10675 unstripped binary for your program to this tool.
10676 See @uref{https://github.com/google/autofdo}.
10677
10678 E.g.
10679 @smallexample
10680 create_gcov --binary=your_program.unstripped --profile=perf.data \
10681 --gcov=profile.afdo
10682 @end smallexample
10683 @end table
10684
10685 The following options control compiler behavior regarding floating-point
10686 arithmetic. These options trade off between speed and
10687 correctness. All must be specifically enabled.
10688
10689 @table @gcctabopt
10690 @item -ffloat-store
10691 @opindex ffloat-store
10692 Do not store floating-point variables in registers, and inhibit other
10693 options that might change whether a floating-point value is taken from a
10694 register or memory.
10695
10696 @cindex floating-point precision
10697 This option prevents undesirable excess precision on machines such as
10698 the 68000 where the floating registers (of the 68881) keep more
10699 precision than a @code{double} is supposed to have. Similarly for the
10700 x86 architecture. For most programs, the excess precision does only
10701 good, but a few programs rely on the precise definition of IEEE floating
10702 point. Use @option{-ffloat-store} for such programs, after modifying
10703 them to store all pertinent intermediate computations into variables.
10704
10705 @item -fexcess-precision=@var{style}
10706 @opindex fexcess-precision
10707 This option allows further control over excess precision on machines
10708 where floating-point operations occur in a format with more precision or
10709 range than the IEEE standard and interchange floating-point types. By
10710 default, @option{-fexcess-precision=fast} is in effect; this means that
10711 operations may be carried out in a wider precision than the types specified
10712 in the source if that would result in faster code, and it is unpredictable
10713 when rounding to the types specified in the source code takes place.
10714 When compiling C, if @option{-fexcess-precision=standard} is specified then
10715 excess precision follows the rules specified in ISO C99; in particular,
10716 both casts and assignments cause values to be rounded to their
10717 semantic types (whereas @option{-ffloat-store} only affects
10718 assignments). This option is enabled by default for C if a strict
10719 conformance option such as @option{-std=c99} is used.
10720 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10721 regardless of whether a strict conformance option is used.
10722
10723 @opindex mfpmath
10724 @option{-fexcess-precision=standard} is not implemented for languages
10725 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10726 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10727 semantics apply without excess precision, and in the latter, rounding
10728 is unpredictable.
10729
10730 @item -ffast-math
10731 @opindex ffast-math
10732 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10733 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10734 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10735 @option{-fexcess-precision=fast}.
10736
10737 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10738
10739 This option is not turned on by any @option{-O} option besides
10740 @option{-Ofast} since it can result in incorrect output for programs
10741 that depend on an exact implementation of IEEE or ISO rules/specifications
10742 for math functions. It may, however, yield faster code for programs
10743 that do not require the guarantees of these specifications.
10744
10745 @item -fno-math-errno
10746 @opindex fno-math-errno
10747 @opindex fmath-errno
10748 Do not set @code{errno} after calling math functions that are executed
10749 with a single instruction, e.g., @code{sqrt}. A program that relies on
10750 IEEE exceptions for math error handling may want to use this flag
10751 for speed while maintaining IEEE arithmetic compatibility.
10752
10753 This option is not turned on by any @option{-O} option since
10754 it can result in incorrect output for programs that depend on
10755 an exact implementation of IEEE or ISO rules/specifications for
10756 math functions. It may, however, yield faster code for programs
10757 that do not require the guarantees of these specifications.
10758
10759 The default is @option{-fmath-errno}.
10760
10761 On Darwin systems, the math library never sets @code{errno}. There is
10762 therefore no reason for the compiler to consider the possibility that
10763 it might, and @option{-fno-math-errno} is the default.
10764
10765 @item -funsafe-math-optimizations
10766 @opindex funsafe-math-optimizations
10767
10768 Allow optimizations for floating-point arithmetic that (a) assume
10769 that arguments and results are valid and (b) may violate IEEE or
10770 ANSI standards. When used at link time, it may include libraries
10771 or startup files that change the default FPU control word or other
10772 similar optimizations.
10773
10774 This option is not turned on by any @option{-O} option since
10775 it can result in incorrect output for programs that depend on
10776 an exact implementation of IEEE or ISO rules/specifications for
10777 math functions. It may, however, yield faster code for programs
10778 that do not require the guarantees of these specifications.
10779 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10780 @option{-fassociative-math} and @option{-freciprocal-math}.
10781
10782 The default is @option{-fno-unsafe-math-optimizations}.
10783
10784 @item -fassociative-math
10785 @opindex fassociative-math
10786
10787 Allow re-association of operands in series of floating-point operations.
10788 This violates the ISO C and C++ language standard by possibly changing
10789 computation result. NOTE: re-ordering may change the sign of zero as
10790 well as ignore NaNs and inhibit or create underflow or overflow (and
10791 thus cannot be used on code that relies on rounding behavior like
10792 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10793 and thus may not be used when ordered comparisons are required.
10794 This option requires that both @option{-fno-signed-zeros} and
10795 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10796 much sense with @option{-frounding-math}. For Fortran the option
10797 is automatically enabled when both @option{-fno-signed-zeros} and
10798 @option{-fno-trapping-math} are in effect.
10799
10800 The default is @option{-fno-associative-math}.
10801
10802 @item -freciprocal-math
10803 @opindex freciprocal-math
10804
10805 Allow the reciprocal of a value to be used instead of dividing by
10806 the value if this enables optimizations. For example @code{x / y}
10807 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10808 is subject to common subexpression elimination. Note that this loses
10809 precision and increases the number of flops operating on the value.
10810
10811 The default is @option{-fno-reciprocal-math}.
10812
10813 @item -ffinite-math-only
10814 @opindex ffinite-math-only
10815 Allow optimizations for floating-point arithmetic that assume
10816 that arguments and results are not NaNs or +-Infs.
10817
10818 This option is not turned on by any @option{-O} option since
10819 it can result in incorrect output for programs that depend on
10820 an exact implementation of IEEE or ISO rules/specifications for
10821 math functions. It may, however, yield faster code for programs
10822 that do not require the guarantees of these specifications.
10823
10824 The default is @option{-fno-finite-math-only}.
10825
10826 @item -fno-signed-zeros
10827 @opindex fno-signed-zeros
10828 @opindex fsigned-zeros
10829 Allow optimizations for floating-point arithmetic that ignore the
10830 signedness of zero. IEEE arithmetic specifies the behavior of
10831 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10832 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10833 This option implies that the sign of a zero result isn't significant.
10834
10835 The default is @option{-fsigned-zeros}.
10836
10837 @item -fno-trapping-math
10838 @opindex fno-trapping-math
10839 @opindex ftrapping-math
10840 Compile code assuming that floating-point operations cannot generate
10841 user-visible traps. These traps include division by zero, overflow,
10842 underflow, inexact result and invalid operation. This option requires
10843 that @option{-fno-signaling-nans} be in effect. Setting this option may
10844 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10845
10846 This option should never be turned on by any @option{-O} option since
10847 it can result in incorrect output for programs that depend on
10848 an exact implementation of IEEE or ISO rules/specifications for
10849 math functions.
10850
10851 The default is @option{-ftrapping-math}.
10852
10853 @item -frounding-math
10854 @opindex frounding-math
10855 Disable transformations and optimizations that assume default floating-point
10856 rounding behavior. This is round-to-zero for all floating point
10857 to integer conversions, and round-to-nearest for all other arithmetic
10858 truncations. This option should be specified for programs that change
10859 the FP rounding mode dynamically, or that may be executed with a
10860 non-default rounding mode. This option disables constant folding of
10861 floating-point expressions at compile time (which may be affected by
10862 rounding mode) and arithmetic transformations that are unsafe in the
10863 presence of sign-dependent rounding modes.
10864
10865 The default is @option{-fno-rounding-math}.
10866
10867 This option is experimental and does not currently guarantee to
10868 disable all GCC optimizations that are affected by rounding mode.
10869 Future versions of GCC may provide finer control of this setting
10870 using C99's @code{FENV_ACCESS} pragma. This command-line option
10871 will be used to specify the default state for @code{FENV_ACCESS}.
10872
10873 @item -fsignaling-nans
10874 @opindex fsignaling-nans
10875 Compile code assuming that IEEE signaling NaNs may generate user-visible
10876 traps during floating-point operations. Setting this option disables
10877 optimizations that may change the number of exceptions visible with
10878 signaling NaNs. This option implies @option{-ftrapping-math}.
10879
10880 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10881 be defined.
10882
10883 The default is @option{-fno-signaling-nans}.
10884
10885 This option is experimental and does not currently guarantee to
10886 disable all GCC optimizations that affect signaling NaN behavior.
10887
10888 @item -fno-fp-int-builtin-inexact
10889 @opindex fno-fp-int-builtin-inexact
10890 @opindex ffp-int-builtin-inexact
10891 Do not allow the built-in functions @code{ceil}, @code{floor},
10892 @code{round} and @code{trunc}, and their @code{float} and @code{long
10893 double} variants, to generate code that raises the ``inexact''
10894 floating-point exception for noninteger arguments. ISO C99 and C11
10895 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10896 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
10897 ISO C2X, does not allow these functions to do so.
10898
10899 The default is @option{-ffp-int-builtin-inexact}, allowing the
10900 exception to be raised, unless C2X or a later C standard is selected.
10901 This option does nothing unless @option{-ftrapping-math} is in effect.
10902
10903 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10904 generate a call to a library function then the ``inexact'' exception
10905 may be raised if the library implementation does not follow TS 18661.
10906
10907 @item -fsingle-precision-constant
10908 @opindex fsingle-precision-constant
10909 Treat floating-point constants as single precision instead of
10910 implicitly converting them to double-precision constants.
10911
10912 @item -fcx-limited-range
10913 @opindex fcx-limited-range
10914 When enabled, this option states that a range reduction step is not
10915 needed when performing complex division. Also, there is no checking
10916 whether the result of a complex multiplication or division is @code{NaN
10917 + I*NaN}, with an attempt to rescue the situation in that case. The
10918 default is @option{-fno-cx-limited-range}, but is enabled by
10919 @option{-ffast-math}.
10920
10921 This option controls the default setting of the ISO C99
10922 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10923 all languages.
10924
10925 @item -fcx-fortran-rules
10926 @opindex fcx-fortran-rules
10927 Complex multiplication and division follow Fortran rules. Range
10928 reduction is done as part of complex division, but there is no checking
10929 whether the result of a complex multiplication or division is @code{NaN
10930 + I*NaN}, with an attempt to rescue the situation in that case.
10931
10932 The default is @option{-fno-cx-fortran-rules}.
10933
10934 @end table
10935
10936 The following options control optimizations that may improve
10937 performance, but are not enabled by any @option{-O} options. This
10938 section includes experimental options that may produce broken code.
10939
10940 @table @gcctabopt
10941 @item -fbranch-probabilities
10942 @opindex fbranch-probabilities
10943 After running a program compiled with @option{-fprofile-arcs}
10944 (@pxref{Instrumentation Options}),
10945 you can compile it a second time using
10946 @option{-fbranch-probabilities}, to improve optimizations based on
10947 the number of times each branch was taken. When a program
10948 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10949 counts to a file called @file{@var{sourcename}.gcda} for each source
10950 file. The information in this data file is very dependent on the
10951 structure of the generated code, so you must use the same source code
10952 and the same optimization options for both compilations.
10953
10954 With @option{-fbranch-probabilities}, GCC puts a
10955 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10956 These can be used to improve optimization. Currently, they are only
10957 used in one place: in @file{reorg.c}, instead of guessing which path a
10958 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10959 exactly determine which path is taken more often.
10960
10961 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10962
10963 @item -fprofile-values
10964 @opindex fprofile-values
10965 If combined with @option{-fprofile-arcs}, it adds code so that some
10966 data about values of expressions in the program is gathered.
10967
10968 With @option{-fbranch-probabilities}, it reads back the data gathered
10969 from profiling values of expressions for usage in optimizations.
10970
10971 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10972 @option{-fauto-profile}.
10973
10974 @item -fprofile-reorder-functions
10975 @opindex fprofile-reorder-functions
10976 Function reordering based on profile instrumentation collects
10977 first time of execution of a function and orders these functions
10978 in ascending order.
10979
10980 Enabled with @option{-fprofile-use}.
10981
10982 @item -fvpt
10983 @opindex fvpt
10984 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10985 to add code to gather information about values of expressions.
10986
10987 With @option{-fbranch-probabilities}, it reads back the data gathered
10988 and actually performs the optimizations based on them.
10989 Currently the optimizations include specialization of division operations
10990 using the knowledge about the value of the denominator.
10991
10992 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10993
10994 @item -frename-registers
10995 @opindex frename-registers
10996 Attempt to avoid false dependencies in scheduled code by making use
10997 of registers left over after register allocation. This optimization
10998 most benefits processors with lots of registers. Depending on the
10999 debug information format adopted by the target, however, it can
11000 make debugging impossible, since variables no longer stay in
11001 a ``home register''.
11002
11003 Enabled by default with @option{-funroll-loops}.
11004
11005 @item -fschedule-fusion
11006 @opindex fschedule-fusion
11007 Performs a target dependent pass over the instruction stream to schedule
11008 instructions of same type together because target machine can execute them
11009 more efficiently if they are adjacent to each other in the instruction flow.
11010
11011 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11012
11013 @item -ftracer
11014 @opindex ftracer
11015 Perform tail duplication to enlarge superblock size. This transformation
11016 simplifies the control flow of the function allowing other optimizations to do
11017 a better job.
11018
11019 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11020
11021 @item -funroll-loops
11022 @opindex funroll-loops
11023 Unroll loops whose number of iterations can be determined at compile time or
11024 upon entry to the loop. @option{-funroll-loops} implies
11025 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11026 It also turns on complete loop peeling (i.e.@: complete removal of loops with
11027 a small constant number of iterations). This option makes code larger, and may
11028 or may not make it run faster.
11029
11030 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11031
11032 @item -funroll-all-loops
11033 @opindex funroll-all-loops
11034 Unroll all loops, even if their number of iterations is uncertain when
11035 the loop is entered. This usually makes programs run more slowly.
11036 @option{-funroll-all-loops} implies the same options as
11037 @option{-funroll-loops}.
11038
11039 @item -fpeel-loops
11040 @opindex fpeel-loops
11041 Peels loops for which there is enough information that they do not
11042 roll much (from profile feedback or static analysis). It also turns on
11043 complete loop peeling (i.e.@: complete removal of loops with small constant
11044 number of iterations).
11045
11046 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11047
11048 @item -fmove-loop-invariants
11049 @opindex fmove-loop-invariants
11050 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
11051 at level @option{-O1} and higher, except for @option{-Og}.
11052
11053 @item -fsplit-loops
11054 @opindex fsplit-loops
11055 Split a loop into two if it contains a condition that's always true
11056 for one side of the iteration space and false for the other.
11057
11058 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11059
11060 @item -funswitch-loops
11061 @opindex funswitch-loops
11062 Move branches with loop invariant conditions out of the loop, with duplicates
11063 of the loop on both branches (modified according to result of the condition).
11064
11065 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11066
11067 @item -fversion-loops-for-strides
11068 @opindex fversion-loops-for-strides
11069 If a loop iterates over an array with a variable stride, create another
11070 version of the loop that assumes the stride is always one. For example:
11071
11072 @smallexample
11073 for (int i = 0; i < n; ++i)
11074 x[i * stride] = @dots{};
11075 @end smallexample
11076
11077 becomes:
11078
11079 @smallexample
11080 if (stride == 1)
11081 for (int i = 0; i < n; ++i)
11082 x[i] = @dots{};
11083 else
11084 for (int i = 0; i < n; ++i)
11085 x[i * stride] = @dots{};
11086 @end smallexample
11087
11088 This is particularly useful for assumed-shape arrays in Fortran where
11089 (for example) it allows better vectorization assuming contiguous accesses.
11090 This flag is enabled by default at @option{-O3}.
11091 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11092
11093 @item -ffunction-sections
11094 @itemx -fdata-sections
11095 @opindex ffunction-sections
11096 @opindex fdata-sections
11097 Place each function or data item into its own section in the output
11098 file if the target supports arbitrary sections. The name of the
11099 function or the name of the data item determines the section's name
11100 in the output file.
11101
11102 Use these options on systems where the linker can perform optimizations to
11103 improve locality of reference in the instruction space. Most systems using the
11104 ELF object format have linkers with such optimizations. On AIX, the linker
11105 rearranges sections (CSECTs) based on the call graph. The performance impact
11106 varies.
11107
11108 Together with a linker garbage collection (linker @option{--gc-sections}
11109 option) these options may lead to smaller statically-linked executables (after
11110 stripping).
11111
11112 On ELF/DWARF systems these options do not degenerate the quality of the debug
11113 information. There could be issues with other object files/debug info formats.
11114
11115 Only use these options when there are significant benefits from doing so. When
11116 you specify these options, the assembler and linker create larger object and
11117 executable files and are also slower. These options affect code generation.
11118 They prevent optimizations by the compiler and assembler using relative
11119 locations inside a translation unit since the locations are unknown until
11120 link time. An example of such an optimization is relaxing calls to short call
11121 instructions.
11122
11123 @item -fstdarg-opt
11124 @opindex fstdarg-opt
11125 Optimize the prologue of variadic argument functions with respect to usage of
11126 those arguments.
11127
11128 @item -fsection-anchors
11129 @opindex fsection-anchors
11130 Try to reduce the number of symbolic address calculations by using
11131 shared ``anchor'' symbols to address nearby objects. This transformation
11132 can help to reduce the number of GOT entries and GOT accesses on some
11133 targets.
11134
11135 For example, the implementation of the following function @code{foo}:
11136
11137 @smallexample
11138 static int a, b, c;
11139 int foo (void) @{ return a + b + c; @}
11140 @end smallexample
11141
11142 @noindent
11143 usually calculates the addresses of all three variables, but if you
11144 compile it with @option{-fsection-anchors}, it accesses the variables
11145 from a common anchor point instead. The effect is similar to the
11146 following pseudocode (which isn't valid C):
11147
11148 @smallexample
11149 int foo (void)
11150 @{
11151 register int *xr = &x;
11152 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11153 @}
11154 @end smallexample
11155
11156 Not all targets support this option.
11157
11158 @item --param @var{name}=@var{value}
11159 @opindex param
11160 In some places, GCC uses various constants to control the amount of
11161 optimization that is done. For example, GCC does not inline functions
11162 that contain more than a certain number of instructions. You can
11163 control some of these constants on the command line using the
11164 @option{--param} option.
11165
11166 The names of specific parameters, and the meaning of the values, are
11167 tied to the internals of the compiler, and are subject to change
11168 without notice in future releases.
11169
11170 In order to get minimal, maximal and default value of a parameter,
11171 one can use @option{--help=param -Q} options.
11172
11173 In each case, the @var{value} is an integer. The allowable choices for
11174 @var{name} are:
11175
11176 @table @gcctabopt
11177 @item predictable-branch-outcome
11178 When branch is predicted to be taken with probability lower than this threshold
11179 (in percent), then it is considered well predictable.
11180
11181 @item max-rtl-if-conversion-insns
11182 RTL if-conversion tries to remove conditional branches around a block and
11183 replace them with conditionally executed instructions. This parameter
11184 gives the maximum number of instructions in a block which should be
11185 considered for if-conversion. The compiler will
11186 also use other heuristics to decide whether if-conversion is likely to be
11187 profitable.
11188
11189 @item max-rtl-if-conversion-predictable-cost
11190 @itemx max-rtl-if-conversion-unpredictable-cost
11191 RTL if-conversion will try to remove conditional branches around a block
11192 and replace them with conditionally executed instructions. These parameters
11193 give the maximum permissible cost for the sequence that would be generated
11194 by if-conversion depending on whether the branch is statically determined
11195 to be predictable or not. The units for this parameter are the same as
11196 those for the GCC internal seq_cost metric. The compiler will try to
11197 provide a reasonable default for this parameter using the BRANCH_COST
11198 target macro.
11199
11200 @item max-crossjump-edges
11201 The maximum number of incoming edges to consider for cross-jumping.
11202 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11203 the number of edges incoming to each block. Increasing values mean
11204 more aggressive optimization, making the compilation time increase with
11205 probably small improvement in executable size.
11206
11207 @item min-crossjump-insns
11208 The minimum number of instructions that must be matched at the end
11209 of two blocks before cross-jumping is performed on them. This
11210 value is ignored in the case where all instructions in the block being
11211 cross-jumped from are matched.
11212
11213 @item max-grow-copy-bb-insns
11214 The maximum code size expansion factor when copying basic blocks
11215 instead of jumping. The expansion is relative to a jump instruction.
11216
11217 @item max-goto-duplication-insns
11218 The maximum number of instructions to duplicate to a block that jumps
11219 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11220 passes, GCC factors computed gotos early in the compilation process,
11221 and unfactors them as late as possible. Only computed jumps at the
11222 end of a basic blocks with no more than max-goto-duplication-insns are
11223 unfactored.
11224
11225 @item max-delay-slot-insn-search
11226 The maximum number of instructions to consider when looking for an
11227 instruction to fill a delay slot. If more than this arbitrary number of
11228 instructions are searched, the time savings from filling the delay slot
11229 are minimal, so stop searching. Increasing values mean more
11230 aggressive optimization, making the compilation time increase with probably
11231 small improvement in execution time.
11232
11233 @item max-delay-slot-live-search
11234 When trying to fill delay slots, the maximum number of instructions to
11235 consider when searching for a block with valid live register
11236 information. Increasing this arbitrarily chosen value means more
11237 aggressive optimization, increasing the compilation time. This parameter
11238 should be removed when the delay slot code is rewritten to maintain the
11239 control-flow graph.
11240
11241 @item max-gcse-memory
11242 The approximate maximum amount of memory that can be allocated in
11243 order to perform the global common subexpression elimination
11244 optimization. If more memory than specified is required, the
11245 optimization is not done.
11246
11247 @item max-gcse-insertion-ratio
11248 If the ratio of expression insertions to deletions is larger than this value
11249 for any expression, then RTL PRE inserts or removes the expression and thus
11250 leaves partially redundant computations in the instruction stream.
11251
11252 @item max-pending-list-length
11253 The maximum number of pending dependencies scheduling allows
11254 before flushing the current state and starting over. Large functions
11255 with few branches or calls can create excessively large lists which
11256 needlessly consume memory and resources.
11257
11258 @item max-modulo-backtrack-attempts
11259 The maximum number of backtrack attempts the scheduler should make
11260 when modulo scheduling a loop. Larger values can exponentially increase
11261 compilation time.
11262
11263 @item max-inline-insns-single
11264 @item max-inline-insns-single-O2
11265 Several parameters control the tree inliner used in GCC@. This number sets the
11266 maximum number of instructions (counted in GCC's internal representation) in a
11267 single function that the tree inliner considers for inlining. This only
11268 affects functions declared inline and methods implemented in a class
11269 declaration (C++).
11270
11271 For functions compiled with optimization levels
11272 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-single} is
11273 applied. In other cases @option{max-inline-insns-single-O2} is applied.
11274
11275
11276 @item max-inline-insns-auto
11277 @item max-inline-insns-auto-O2
11278 When you use @option{-finline-functions} (included in @option{-O3}),
11279 a lot of functions that would otherwise not be considered for inlining
11280 by the compiler are investigated. To those functions, a different
11281 (more restrictive) limit compared to functions declared inline can
11282 be applied.
11283
11284 For functions compiled with optimization levels
11285 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
11286 applied. In other cases @option{max-inline-insns-auto-O2} is applied.
11287
11288 @item max-inline-insns-small
11289 This is bound applied to calls which are considered relevant with
11290 @option{-finline-small-functions}.
11291
11292 @item max-inline-insns-size
11293 This is bound applied to calls which are optimized for size. Small growth
11294 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11295
11296 @item uninlined-function-insns
11297 Number of instructions accounted by inliner for function overhead such as
11298 function prologue and epilogue.
11299
11300 @item uninlined-function-time
11301 Extra time accounted by inliner for function overhead such as time needed to
11302 execute function prologue and epilogue
11303
11304 @item inline-heuristics-hint-percent
11305 @item inline-heuristics-hint-percent-O2
11306 The scale (in percents) applied to @option{inline-insns-single},
11307 @option{inline-insns-single-O2}, @option{inline-insns-auto},
11308 @option{inline-insns-auto-O2} when inline heuristics hints that inlining is
11309 very profitable (will enable later optimizations).
11310
11311 For functions compiled with optimization levels
11312 @option{-O3} and @option{-Ofast} parameter
11313 @option{inline-heuristics-hint-percent} is applied. In other cases
11314 @option{inline-heuristics-hint-percent-O2} is applied.
11315
11316 @item uninlined-thunk-insns
11317 @item uninlined-thunk-time
11318 Same as @option{--param uninlined-function-insns} and
11319 @option{--param uninlined-function-time} but applied to function thunks
11320
11321 @item inline-min-speedup
11322 @item inline-min-speedup-O2
11323 When estimated performance improvement of caller + callee runtime exceeds this
11324 threshold (in percent), the function can be inlined regardless of the limit on
11325 @option{--param max-inline-insns-single} and @option{--param
11326 max-inline-insns-auto}.
11327
11328 For functions compiled with optimization levels
11329 @option{-O3} and @option{-Ofast} parameter @option{inline-min-speedup} is
11330 applied. In other cases @option{inline-min-speedup-O2} is applied.
11331
11332 @item large-function-insns
11333 The limit specifying really large functions. For functions larger than this
11334 limit after inlining, inlining is constrained by
11335 @option{--param large-function-growth}. This parameter is useful primarily
11336 to avoid extreme compilation time caused by non-linear algorithms used by the
11337 back end.
11338
11339 @item large-function-growth
11340 Specifies maximal growth of large function caused by inlining in percents.
11341 For example, parameter value 100 limits large function growth to 2.0 times
11342 the original size.
11343
11344 @item large-unit-insns
11345 The limit specifying large translation unit. Growth caused by inlining of
11346 units larger than this limit is limited by @option{--param inline-unit-growth}.
11347 For small units this might be too tight.
11348 For example, consider a unit consisting of function A
11349 that is inline and B that just calls A three times. If B is small relative to
11350 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11351 large units consisting of small inlineable functions, however, the overall unit
11352 growth limit is needed to avoid exponential explosion of code size. Thus for
11353 smaller units, the size is increased to @option{--param large-unit-insns}
11354 before applying @option{--param inline-unit-growth}.
11355
11356 @item inline-unit-growth
11357 Specifies maximal overall growth of the compilation unit caused by inlining.
11358 For example, parameter value 20 limits unit growth to 1.2 times the original
11359 size. Cold functions (either marked cold via an attribute or by profile
11360 feedback) are not accounted into the unit size.
11361
11362 @item ipcp-unit-growth
11363 Specifies maximal overall growth of the compilation unit caused by
11364 interprocedural constant propagation. For example, parameter value 10 limits
11365 unit growth to 1.1 times the original size.
11366
11367 @item large-stack-frame
11368 The limit specifying large stack frames. While inlining the algorithm is trying
11369 to not grow past this limit too much.
11370
11371 @item large-stack-frame-growth
11372 Specifies maximal growth of large stack frames caused by inlining in percents.
11373 For example, parameter value 1000 limits large stack frame growth to 11 times
11374 the original size.
11375
11376 @item max-inline-insns-recursive
11377 @itemx max-inline-insns-recursive-auto
11378 Specifies the maximum number of instructions an out-of-line copy of a
11379 self-recursive inline
11380 function can grow into by performing recursive inlining.
11381
11382 @option{--param max-inline-insns-recursive} applies to functions
11383 declared inline.
11384 For functions not declared inline, recursive inlining
11385 happens only when @option{-finline-functions} (included in @option{-O3}) is
11386 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11387
11388 @item max-inline-recursive-depth
11389 @itemx max-inline-recursive-depth-auto
11390 Specifies the maximum recursion depth used for recursive inlining.
11391
11392 @option{--param max-inline-recursive-depth} applies to functions
11393 declared inline. For functions not declared inline, recursive inlining
11394 happens only when @option{-finline-functions} (included in @option{-O3}) is
11395 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11396
11397 @item min-inline-recursive-probability
11398 Recursive inlining is profitable only for function having deep recursion
11399 in average and can hurt for function having little recursion depth by
11400 increasing the prologue size or complexity of function body to other
11401 optimizers.
11402
11403 When profile feedback is available (see @option{-fprofile-generate}) the actual
11404 recursion depth can be guessed from the probability that function recurses
11405 via a given call expression. This parameter limits inlining only to call
11406 expressions whose probability exceeds the given threshold (in percents).
11407
11408 @item early-inlining-insns
11409 @item early-inlining-insns-O2
11410 Specify growth that the early inliner can make. In effect it increases
11411 the amount of inlining for code having a large abstraction penalty.
11412
11413 For functions compiled with optimization levels
11414 @option{-O3} and @option{-Ofast} parameter @option{early-inlining-insns} is
11415 applied. In other cases @option{early-inlining-insns-O2} is applied.
11416
11417 @item max-early-inliner-iterations
11418 Limit of iterations of the early inliner. This basically bounds
11419 the number of nested indirect calls the early inliner can resolve.
11420 Deeper chains are still handled by late inlining.
11421
11422 @item comdat-sharing-probability
11423 Probability (in percent) that C++ inline function with comdat visibility
11424 are shared across multiple compilation units.
11425
11426 @item profile-func-internal-id
11427 A parameter to control whether to use function internal id in profile
11428 database lookup. If the value is 0, the compiler uses an id that
11429 is based on function assembler name and filename, which makes old profile
11430 data more tolerant to source changes such as function reordering etc.
11431
11432 @item min-vect-loop-bound
11433 The minimum number of iterations under which loops are not vectorized
11434 when @option{-ftree-vectorize} is used. The number of iterations after
11435 vectorization needs to be greater than the value specified by this option
11436 to allow vectorization.
11437
11438 @item gcse-cost-distance-ratio
11439 Scaling factor in calculation of maximum distance an expression
11440 can be moved by GCSE optimizations. This is currently supported only in the
11441 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11442 is with simple expressions, i.e., the expressions that have cost
11443 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11444 hoisting of simple expressions.
11445
11446 @item gcse-unrestricted-cost
11447 Cost, roughly measured as the cost of a single typical machine
11448 instruction, at which GCSE optimizations do not constrain
11449 the distance an expression can travel. This is currently
11450 supported only in the code hoisting pass. The lesser the cost,
11451 the more aggressive code hoisting is. Specifying 0
11452 allows all expressions to travel unrestricted distances.
11453
11454 @item max-hoist-depth
11455 The depth of search in the dominator tree for expressions to hoist.
11456 This is used to avoid quadratic behavior in hoisting algorithm.
11457 The value of 0 does not limit on the search, but may slow down compilation
11458 of huge functions.
11459
11460 @item max-tail-merge-comparisons
11461 The maximum amount of similar bbs to compare a bb with. This is used to
11462 avoid quadratic behavior in tree tail merging.
11463
11464 @item max-tail-merge-iterations
11465 The maximum amount of iterations of the pass over the function. This is used to
11466 limit compilation time in tree tail merging.
11467
11468 @item store-merging-allow-unaligned
11469 Allow the store merging pass to introduce unaligned stores if it is legal to
11470 do so.
11471
11472 @item max-stores-to-merge
11473 The maximum number of stores to attempt to merge into wider stores in the store
11474 merging pass.
11475
11476 @item max-unrolled-insns
11477 The maximum number of instructions that a loop may have to be unrolled.
11478 If a loop is unrolled, this parameter also determines how many times
11479 the loop code is unrolled.
11480
11481 @item max-average-unrolled-insns
11482 The maximum number of instructions biased by probabilities of their execution
11483 that a loop may have to be unrolled. If a loop is unrolled,
11484 this parameter also determines how many times the loop code is unrolled.
11485
11486 @item max-unroll-times
11487 The maximum number of unrollings of a single loop.
11488
11489 @item max-peeled-insns
11490 The maximum number of instructions that a loop may have to be peeled.
11491 If a loop is peeled, this parameter also determines how many times
11492 the loop code is peeled.
11493
11494 @item max-peel-times
11495 The maximum number of peelings of a single loop.
11496
11497 @item max-peel-branches
11498 The maximum number of branches on the hot path through the peeled sequence.
11499
11500 @item max-completely-peeled-insns
11501 The maximum number of insns of a completely peeled loop.
11502
11503 @item max-completely-peel-times
11504 The maximum number of iterations of a loop to be suitable for complete peeling.
11505
11506 @item max-completely-peel-loop-nest-depth
11507 The maximum depth of a loop nest suitable for complete peeling.
11508
11509 @item max-unswitch-insns
11510 The maximum number of insns of an unswitched loop.
11511
11512 @item max-unswitch-level
11513 The maximum number of branches unswitched in a single loop.
11514
11515 @item lim-expensive
11516 The minimum cost of an expensive expression in the loop invariant motion.
11517
11518 @item iv-consider-all-candidates-bound
11519 Bound on number of candidates for induction variables, below which
11520 all candidates are considered for each use in induction variable
11521 optimizations. If there are more candidates than this,
11522 only the most relevant ones are considered to avoid quadratic time complexity.
11523
11524 @item iv-max-considered-uses
11525 The induction variable optimizations give up on loops that contain more
11526 induction variable uses.
11527
11528 @item iv-always-prune-cand-set-bound
11529 If the number of candidates in the set is smaller than this value,
11530 always try to remove unnecessary ivs from the set
11531 when adding a new one.
11532
11533 @item avg-loop-niter
11534 Average number of iterations of a loop.
11535
11536 @item dse-max-object-size
11537 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11538 Larger values may result in larger compilation times.
11539
11540 @item dse-max-alias-queries-per-store
11541 Maximum number of queries into the alias oracle per store.
11542 Larger values result in larger compilation times and may result in more
11543 removed dead stores.
11544
11545 @item scev-max-expr-size
11546 Bound on size of expressions used in the scalar evolutions analyzer.
11547 Large expressions slow the analyzer.
11548
11549 @item scev-max-expr-complexity
11550 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11551 Complex expressions slow the analyzer.
11552
11553 @item max-tree-if-conversion-phi-args
11554 Maximum number of arguments in a PHI supported by TREE if conversion
11555 unless the loop is marked with simd pragma.
11556
11557 @item vect-max-version-for-alignment-checks
11558 The maximum number of run-time checks that can be performed when
11559 doing loop versioning for alignment in the vectorizer.
11560
11561 @item vect-max-version-for-alias-checks
11562 The maximum number of run-time checks that can be performed when
11563 doing loop versioning for alias in the vectorizer.
11564
11565 @item vect-max-peeling-for-alignment
11566 The maximum number of loop peels to enhance access alignment
11567 for vectorizer. Value -1 means no limit.
11568
11569 @item max-iterations-to-track
11570 The maximum number of iterations of a loop the brute-force algorithm
11571 for analysis of the number of iterations of the loop tries to evaluate.
11572
11573 @item hot-bb-count-fraction
11574 The denominator n of fraction 1/n of the maximal execution count of a
11575 basic block in the entire program that a basic block needs to at least
11576 have in order to be considered hot. The default is 10000, which means
11577 that a basic block is considered hot if its execution count is greater
11578 than 1/10000 of the maximal execution count. 0 means that it is never
11579 considered hot. Used in non-LTO mode.
11580
11581 @item hot-bb-count-ws-permille
11582 The number of most executed permilles, ranging from 0 to 1000, of the
11583 profiled execution of the entire program to which the execution count
11584 of a basic block must be part of in order to be considered hot. The
11585 default is 990, which means that a basic block is considered hot if
11586 its execution count contributes to the upper 990 permilles, or 99.0%,
11587 of the profiled execution of the entire program. 0 means that it is
11588 never considered hot. Used in LTO mode.
11589
11590 @item hot-bb-frequency-fraction
11591 The denominator n of fraction 1/n of the execution frequency of the
11592 entry block of a function that a basic block of this function needs
11593 to at least have in order to be considered hot. The default is 1000,
11594 which means that a basic block is considered hot in a function if it
11595 is executed more frequently than 1/1000 of the frequency of the entry
11596 block of the function. 0 means that it is never considered hot.
11597
11598 @item unlikely-bb-count-fraction
11599 The denominator n of fraction 1/n of the number of profiled runs of
11600 the entire program below which the execution count of a basic block
11601 must be in order for the basic block to be considered unlikely executed.
11602 The default is 20, which means that a basic block is considered unlikely
11603 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11604 the program. 0 means that it is always considered unlikely executed.
11605
11606 @item max-predicted-iterations
11607 The maximum number of loop iterations we predict statically. This is useful
11608 in cases where a function contains a single loop with known bound and
11609 another loop with unknown bound.
11610 The known number of iterations is predicted correctly, while
11611 the unknown number of iterations average to roughly 10. This means that the
11612 loop without bounds appears artificially cold relative to the other one.
11613
11614 @item builtin-expect-probability
11615 Control the probability of the expression having the specified value. This
11616 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11617
11618 @item builtin-string-cmp-inline-length
11619 The maximum length of a constant string for a builtin string cmp call
11620 eligible for inlining.
11621
11622 @item align-threshold
11623
11624 Select fraction of the maximal frequency of executions of a basic block in
11625 a function to align the basic block.
11626
11627 @item align-loop-iterations
11628
11629 A loop expected to iterate at least the selected number of iterations is
11630 aligned.
11631
11632 @item tracer-dynamic-coverage
11633 @itemx tracer-dynamic-coverage-feedback
11634
11635 This value is used to limit superblock formation once the given percentage of
11636 executed instructions is covered. This limits unnecessary code size
11637 expansion.
11638
11639 The @option{tracer-dynamic-coverage-feedback} parameter
11640 is used only when profile
11641 feedback is available. The real profiles (as opposed to statically estimated
11642 ones) are much less balanced allowing the threshold to be larger value.
11643
11644 @item tracer-max-code-growth
11645 Stop tail duplication once code growth has reached given percentage. This is
11646 a rather artificial limit, as most of the duplicates are eliminated later in
11647 cross jumping, so it may be set to much higher values than is the desired code
11648 growth.
11649
11650 @item tracer-min-branch-ratio
11651
11652 Stop reverse growth when the reverse probability of best edge is less than this
11653 threshold (in percent).
11654
11655 @item tracer-min-branch-probability
11656 @itemx tracer-min-branch-probability-feedback
11657
11658 Stop forward growth if the best edge has probability lower than this
11659 threshold.
11660
11661 Similarly to @option{tracer-dynamic-coverage} two parameters are
11662 provided. @option{tracer-min-branch-probability-feedback} is used for
11663 compilation with profile feedback and @option{tracer-min-branch-probability}
11664 compilation without. The value for compilation with profile feedback
11665 needs to be more conservative (higher) in order to make tracer
11666 effective.
11667
11668 @item stack-clash-protection-guard-size
11669 Specify the size of the operating system provided stack guard as
11670 2 raised to @var{num} bytes. Higher values may reduce the
11671 number of explicit probes, but a value larger than the operating system
11672 provided guard will leave code vulnerable to stack clash style attacks.
11673
11674 @item stack-clash-protection-probe-interval
11675 Stack clash protection involves probing stack space as it is allocated. This
11676 param controls the maximum distance between probes into the stack as 2 raised
11677 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11678 larger than the operating system provided guard will leave code vulnerable to
11679 stack clash style attacks.
11680
11681 @item max-cse-path-length
11682
11683 The maximum number of basic blocks on path that CSE considers.
11684
11685 @item max-cse-insns
11686 The maximum number of instructions CSE processes before flushing.
11687
11688 @item ggc-min-expand
11689
11690 GCC uses a garbage collector to manage its own memory allocation. This
11691 parameter specifies the minimum percentage by which the garbage
11692 collector's heap should be allowed to expand between collections.
11693 Tuning this may improve compilation speed; it has no effect on code
11694 generation.
11695
11696 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11697 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11698 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11699 GCC is not able to calculate RAM on a particular platform, the lower
11700 bound of 30% is used. Setting this parameter and
11701 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11702 every opportunity. This is extremely slow, but can be useful for
11703 debugging.
11704
11705 @item ggc-min-heapsize
11706
11707 Minimum size of the garbage collector's heap before it begins bothering
11708 to collect garbage. The first collection occurs after the heap expands
11709 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11710 tuning this may improve compilation speed, and has no effect on code
11711 generation.
11712
11713 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11714 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11715 with a lower bound of 4096 (four megabytes) and an upper bound of
11716 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11717 particular platform, the lower bound is used. Setting this parameter
11718 very large effectively disables garbage collection. Setting this
11719 parameter and @option{ggc-min-expand} to zero causes a full collection
11720 to occur at every opportunity.
11721
11722 @item max-reload-search-insns
11723 The maximum number of instruction reload should look backward for equivalent
11724 register. Increasing values mean more aggressive optimization, making the
11725 compilation time increase with probably slightly better performance.
11726
11727 @item max-cselib-memory-locations
11728 The maximum number of memory locations cselib should take into account.
11729 Increasing values mean more aggressive optimization, making the compilation time
11730 increase with probably slightly better performance.
11731
11732 @item max-sched-ready-insns
11733 The maximum number of instructions ready to be issued the scheduler should
11734 consider at any given time during the first scheduling pass. Increasing
11735 values mean more thorough searches, making the compilation time increase
11736 with probably little benefit.
11737
11738 @item max-sched-region-blocks
11739 The maximum number of blocks in a region to be considered for
11740 interblock scheduling.
11741
11742 @item max-pipeline-region-blocks
11743 The maximum number of blocks in a region to be considered for
11744 pipelining in the selective scheduler.
11745
11746 @item max-sched-region-insns
11747 The maximum number of insns in a region to be considered for
11748 interblock scheduling.
11749
11750 @item max-pipeline-region-insns
11751 The maximum number of insns in a region to be considered for
11752 pipelining in the selective scheduler.
11753
11754 @item min-spec-prob
11755 The minimum probability (in percents) of reaching a source block
11756 for interblock speculative scheduling.
11757
11758 @item max-sched-extend-regions-iters
11759 The maximum number of iterations through CFG to extend regions.
11760 A value of 0 disables region extensions.
11761
11762 @item max-sched-insn-conflict-delay
11763 The maximum conflict delay for an insn to be considered for speculative motion.
11764
11765 @item sched-spec-prob-cutoff
11766 The minimal probability of speculation success (in percents), so that
11767 speculative insns are scheduled.
11768
11769 @item sched-state-edge-prob-cutoff
11770 The minimum probability an edge must have for the scheduler to save its
11771 state across it.
11772
11773 @item sched-mem-true-dep-cost
11774 Minimal distance (in CPU cycles) between store and load targeting same
11775 memory locations.
11776
11777 @item selsched-max-lookahead
11778 The maximum size of the lookahead window of selective scheduling. It is a
11779 depth of search for available instructions.
11780
11781 @item selsched-max-sched-times
11782 The maximum number of times that an instruction is scheduled during
11783 selective scheduling. This is the limit on the number of iterations
11784 through which the instruction may be pipelined.
11785
11786 @item selsched-insns-to-rename
11787 The maximum number of best instructions in the ready list that are considered
11788 for renaming in the selective scheduler.
11789
11790 @item sms-min-sc
11791 The minimum value of stage count that swing modulo scheduler
11792 generates.
11793
11794 @item max-last-value-rtl
11795 The maximum size measured as number of RTLs that can be recorded in an expression
11796 in combiner for a pseudo register as last known value of that register.
11797
11798 @item max-combine-insns
11799 The maximum number of instructions the RTL combiner tries to combine.
11800
11801 @item integer-share-limit
11802 Small integer constants can use a shared data structure, reducing the
11803 compiler's memory usage and increasing its speed. This sets the maximum
11804 value of a shared integer constant.
11805
11806 @item ssp-buffer-size
11807 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11808 protection when @option{-fstack-protection} is used.
11809
11810 @item min-size-for-stack-sharing
11811 The minimum size of variables taking part in stack slot sharing when not
11812 optimizing.
11813
11814 @item max-jump-thread-duplication-stmts
11815 Maximum number of statements allowed in a block that needs to be
11816 duplicated when threading jumps.
11817
11818 @item max-fields-for-field-sensitive
11819 Maximum number of fields in a structure treated in
11820 a field sensitive manner during pointer analysis.
11821
11822 @item prefetch-latency
11823 Estimate on average number of instructions that are executed before
11824 prefetch finishes. The distance prefetched ahead is proportional
11825 to this constant. Increasing this number may also lead to less
11826 streams being prefetched (see @option{simultaneous-prefetches}).
11827
11828 @item simultaneous-prefetches
11829 Maximum number of prefetches that can run at the same time.
11830
11831 @item l1-cache-line-size
11832 The size of cache line in L1 data cache, in bytes.
11833
11834 @item l1-cache-size
11835 The size of L1 data cache, in kilobytes.
11836
11837 @item l2-cache-size
11838 The size of L2 data cache, in kilobytes.
11839
11840 @item prefetch-dynamic-strides
11841 Whether the loop array prefetch pass should issue software prefetch hints
11842 for strides that are non-constant. In some cases this may be
11843 beneficial, though the fact the stride is non-constant may make it
11844 hard to predict when there is clear benefit to issuing these hints.
11845
11846 Set to 1 if the prefetch hints should be issued for non-constant
11847 strides. Set to 0 if prefetch hints should be issued only for strides that
11848 are known to be constant and below @option{prefetch-minimum-stride}.
11849
11850 @item prefetch-minimum-stride
11851 Minimum constant stride, in bytes, to start using prefetch hints for. If
11852 the stride is less than this threshold, prefetch hints will not be issued.
11853
11854 This setting is useful for processors that have hardware prefetchers, in
11855 which case there may be conflicts between the hardware prefetchers and
11856 the software prefetchers. If the hardware prefetchers have a maximum
11857 stride they can handle, it should be used here to improve the use of
11858 software prefetchers.
11859
11860 A value of -1 means we don't have a threshold and therefore
11861 prefetch hints can be issued for any constant stride.
11862
11863 This setting is only useful for strides that are known and constant.
11864
11865 @item loop-interchange-max-num-stmts
11866 The maximum number of stmts in a loop to be interchanged.
11867
11868 @item loop-interchange-stride-ratio
11869 The minimum ratio between stride of two loops for interchange to be profitable.
11870
11871 @item min-insn-to-prefetch-ratio
11872 The minimum ratio between the number of instructions and the
11873 number of prefetches to enable prefetching in a loop.
11874
11875 @item prefetch-min-insn-to-mem-ratio
11876 The minimum ratio between the number of instructions and the
11877 number of memory references to enable prefetching in a loop.
11878
11879 @item use-canonical-types
11880 Whether the compiler should use the ``canonical'' type system.
11881 Should always be 1, which uses a more efficient internal
11882 mechanism for comparing types in C++ and Objective-C++. However, if
11883 bugs in the canonical type system are causing compilation failures,
11884 set this value to 0 to disable canonical types.
11885
11886 @item switch-conversion-max-branch-ratio
11887 Switch initialization conversion refuses to create arrays that are
11888 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11889 branches in the switch.
11890
11891 @item max-partial-antic-length
11892 Maximum length of the partial antic set computed during the tree
11893 partial redundancy elimination optimization (@option{-ftree-pre}) when
11894 optimizing at @option{-O3} and above. For some sorts of source code
11895 the enhanced partial redundancy elimination optimization can run away,
11896 consuming all of the memory available on the host machine. This
11897 parameter sets a limit on the length of the sets that are computed,
11898 which prevents the runaway behavior. Setting a value of 0 for
11899 this parameter allows an unlimited set length.
11900
11901 @item rpo-vn-max-loop-depth
11902 Maximum loop depth that is value-numbered optimistically.
11903 When the limit hits the innermost
11904 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11905 loop nest are value-numbered optimistically and the remaining ones not.
11906
11907 @item sccvn-max-alias-queries-per-access
11908 Maximum number of alias-oracle queries we perform when looking for
11909 redundancies for loads and stores. If this limit is hit the search
11910 is aborted and the load or store is not considered redundant. The
11911 number of queries is algorithmically limited to the number of
11912 stores on all paths from the load to the function entry.
11913
11914 @item ira-max-loops-num
11915 IRA uses regional register allocation by default. If a function
11916 contains more loops than the number given by this parameter, only at most
11917 the given number of the most frequently-executed loops form regions
11918 for regional register allocation.
11919
11920 @item ira-max-conflict-table-size
11921 Although IRA uses a sophisticated algorithm to compress the conflict
11922 table, the table can still require excessive amounts of memory for
11923 huge functions. If the conflict table for a function could be more
11924 than the size in MB given by this parameter, the register allocator
11925 instead uses a faster, simpler, and lower-quality
11926 algorithm that does not require building a pseudo-register conflict table.
11927
11928 @item ira-loop-reserved-regs
11929 IRA can be used to evaluate more accurate register pressure in loops
11930 for decisions to move loop invariants (see @option{-O3}). The number
11931 of available registers reserved for some other purposes is given
11932 by this parameter. Default of the parameter
11933 is the best found from numerous experiments.
11934
11935 @item lra-inheritance-ebb-probability-cutoff
11936 LRA tries to reuse values reloaded in registers in subsequent insns.
11937 This optimization is called inheritance. EBB is used as a region to
11938 do this optimization. The parameter defines a minimal fall-through
11939 edge probability in percentage used to add BB to inheritance EBB in
11940 LRA. The default value was chosen
11941 from numerous runs of SPEC2000 on x86-64.
11942
11943 @item loop-invariant-max-bbs-in-loop
11944 Loop invariant motion can be very expensive, both in compilation time and
11945 in amount of needed compile-time memory, with very large loops. Loops
11946 with more basic blocks than this parameter won't have loop invariant
11947 motion optimization performed on them.
11948
11949 @item loop-max-datarefs-for-datadeps
11950 Building data dependencies is expensive for very large loops. This
11951 parameter limits the number of data references in loops that are
11952 considered for data dependence analysis. These large loops are no
11953 handled by the optimizations using loop data dependencies.
11954
11955 @item max-vartrack-size
11956 Sets a maximum number of hash table slots to use during variable
11957 tracking dataflow analysis of any function. If this limit is exceeded
11958 with variable tracking at assignments enabled, analysis for that
11959 function is retried without it, after removing all debug insns from
11960 the function. If the limit is exceeded even without debug insns, var
11961 tracking analysis is completely disabled for the function. Setting
11962 the parameter to zero makes it unlimited.
11963
11964 @item max-vartrack-expr-depth
11965 Sets a maximum number of recursion levels when attempting to map
11966 variable names or debug temporaries to value expressions. This trades
11967 compilation time for more complete debug information. If this is set too
11968 low, value expressions that are available and could be represented in
11969 debug information may end up not being used; setting this higher may
11970 enable the compiler to find more complex debug expressions, but compile
11971 time and memory use may grow.
11972
11973 @item max-debug-marker-count
11974 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11975 markers) to avoid complexity explosion at inlining or expanding to RTL.
11976 If a function has more such gimple stmts than the set limit, such stmts
11977 will be dropped from the inlined copy of a function, and from its RTL
11978 expansion.
11979
11980 @item min-nondebug-insn-uid
11981 Use uids starting at this parameter for nondebug insns. The range below
11982 the parameter is reserved exclusively for debug insns created by
11983 @option{-fvar-tracking-assignments}, but debug insns may get
11984 (non-overlapping) uids above it if the reserved range is exhausted.
11985
11986 @item ipa-sra-ptr-growth-factor
11987 IPA-SRA replaces a pointer to an aggregate with one or more new
11988 parameters only when their cumulative size is less or equal to
11989 @option{ipa-sra-ptr-growth-factor} times the size of the original
11990 pointer parameter.
11991
11992 @item ipa-sra-max-replacements
11993 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11994 consequence, it is also the maximum number of replacements of a formal
11995 parameter.
11996
11997 @item sra-max-scalarization-size-Ospeed
11998 @itemx sra-max-scalarization-size-Osize
11999 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12000 replace scalar parts of aggregates with uses of independent scalar
12001 variables. These parameters control the maximum size, in storage units,
12002 of aggregate which is considered for replacement when compiling for
12003 speed
12004 (@option{sra-max-scalarization-size-Ospeed}) or size
12005 (@option{sra-max-scalarization-size-Osize}) respectively.
12006
12007 @item tm-max-aggregate-size
12008 When making copies of thread-local variables in a transaction, this
12009 parameter specifies the size in bytes after which variables are
12010 saved with the logging functions as opposed to save/restore code
12011 sequence pairs. This option only applies when using
12012 @option{-fgnu-tm}.
12013
12014 @item graphite-max-nb-scop-params
12015 To avoid exponential effects in the Graphite loop transforms, the
12016 number of parameters in a Static Control Part (SCoP) is bounded.
12017 A value of zero can be used to lift
12018 the bound. A variable whose value is unknown at compilation time and
12019 defined outside a SCoP is a parameter of the SCoP.
12020
12021 @item loop-block-tile-size
12022 Loop blocking or strip mining transforms, enabled with
12023 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12024 loop in the loop nest by a given number of iterations. The strip
12025 length can be changed using the @option{loop-block-tile-size}
12026 parameter.
12027
12028 @item ipa-cp-value-list-size
12029 IPA-CP attempts to track all possible values and types passed to a function's
12030 parameter in order to propagate them and perform devirtualization.
12031 @option{ipa-cp-value-list-size} is the maximum number of values and types it
12032 stores per one formal parameter of a function.
12033
12034 @item ipa-cp-eval-threshold
12035 IPA-CP calculates its own score of cloning profitability heuristics
12036 and performs those cloning opportunities with scores that exceed
12037 @option{ipa-cp-eval-threshold}.
12038
12039 @item ipa-cp-recursion-penalty
12040 Percentage penalty the recursive functions will receive when they
12041 are evaluated for cloning.
12042
12043 @item ipa-cp-single-call-penalty
12044 Percentage penalty functions containing a single call to another
12045 function will receive when they are evaluated for cloning.
12046
12047 @item ipa-max-agg-items
12048 IPA-CP is also capable to propagate a number of scalar values passed
12049 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12050 number of such values per one parameter.
12051
12052 @item ipa-cp-loop-hint-bonus
12053 When IPA-CP determines that a cloning candidate would make the number
12054 of iterations of a loop known, it adds a bonus of
12055 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12056 the candidate.
12057
12058 @item ipa-max-aa-steps
12059 During its analysis of function bodies, IPA-CP employs alias analysis
12060 in order to track values pointed to by function parameters. In order
12061 not spend too much time analyzing huge functions, it gives up and
12062 consider all memory clobbered after examining
12063 @option{ipa-max-aa-steps} statements modifying memory.
12064
12065 @item ipa-max-switch-predicate-bounds
12066 Maximal number of boundary endpoints of case ranges of switch statement.
12067 For switch exceeding this limit, IPA-CP will not construct cloning cost
12068 predicate, which is used to estimate cloning benefit, for default case
12069 of the switch statement.
12070
12071 @item ipa-max-param-expr-ops
12072 IPA-CP will analyze conditional statement that references some function
12073 parameter to estimate benefit for cloning upon certain constant value.
12074 But if number of operations in a parameter expression exceeds
12075 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
12076 one, and is not handled by IPA analysis.
12077
12078 @item lto-partitions
12079 Specify desired number of partitions produced during WHOPR compilation.
12080 The number of partitions should exceed the number of CPUs used for compilation.
12081
12082 @item lto-min-partition
12083 Size of minimal partition for WHOPR (in estimated instructions).
12084 This prevents expenses of splitting very small programs into too many
12085 partitions.
12086
12087 @item lto-max-partition
12088 Size of max partition for WHOPR (in estimated instructions).
12089 to provide an upper bound for individual size of partition.
12090 Meant to be used only with balanced partitioning.
12091
12092 @item lto-max-streaming-parallelism
12093 Maximal number of parallel processes used for LTO streaming.
12094
12095 @item cxx-max-namespaces-for-diagnostic-help
12096 The maximum number of namespaces to consult for suggestions when C++
12097 name lookup fails for an identifier.
12098
12099 @item sink-frequency-threshold
12100 The maximum relative execution frequency (in percents) of the target block
12101 relative to a statement's original block to allow statement sinking of a
12102 statement. Larger numbers result in more aggressive statement sinking.
12103 A small positive adjustment is applied for
12104 statements with memory operands as those are even more profitable so sink.
12105
12106 @item max-stores-to-sink
12107 The maximum number of conditional store pairs that can be sunk. Set to 0
12108 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12109 (@option{-ftree-loop-if-convert}) is disabled.
12110
12111 @item case-values-threshold
12112 The smallest number of different values for which it is best to use a
12113 jump-table instead of a tree of conditional branches. If the value is
12114 0, use the default for the machine.
12115
12116 @item jump-table-max-growth-ratio-for-size
12117 The maximum code size growth ratio when expanding
12118 into a jump table (in percent). The parameter is used when
12119 optimizing for size.
12120
12121 @item jump-table-max-growth-ratio-for-speed
12122 The maximum code size growth ratio when expanding
12123 into a jump table (in percent). The parameter is used when
12124 optimizing for speed.
12125
12126 @item tree-reassoc-width
12127 Set the maximum number of instructions executed in parallel in
12128 reassociated tree. This parameter overrides target dependent
12129 heuristics used by default if has non zero value.
12130
12131 @item sched-pressure-algorithm
12132 Choose between the two available implementations of
12133 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12134 and is the more likely to prevent instructions from being reordered.
12135 Algorithm 2 was designed to be a compromise between the relatively
12136 conservative approach taken by algorithm 1 and the rather aggressive
12137 approach taken by the default scheduler. It relies more heavily on
12138 having a regular register file and accurate register pressure classes.
12139 See @file{haifa-sched.c} in the GCC sources for more details.
12140
12141 The default choice depends on the target.
12142
12143 @item max-slsr-cand-scan
12144 Set the maximum number of existing candidates that are considered when
12145 seeking a basis for a new straight-line strength reduction candidate.
12146
12147 @item asan-globals
12148 Enable buffer overflow detection for global objects. This kind
12149 of protection is enabled by default if you are using
12150 @option{-fsanitize=address} option.
12151 To disable global objects protection use @option{--param asan-globals=0}.
12152
12153 @item asan-stack
12154 Enable buffer overflow detection for stack objects. This kind of
12155 protection is enabled by default when using @option{-fsanitize=address}.
12156 To disable stack protection use @option{--param asan-stack=0} option.
12157
12158 @item asan-instrument-reads
12159 Enable buffer overflow detection for memory reads. This kind of
12160 protection is enabled by default when using @option{-fsanitize=address}.
12161 To disable memory reads protection use
12162 @option{--param asan-instrument-reads=0}.
12163
12164 @item asan-instrument-writes
12165 Enable buffer overflow detection for memory writes. This kind of
12166 protection is enabled by default when using @option{-fsanitize=address}.
12167 To disable memory writes protection use
12168 @option{--param asan-instrument-writes=0} option.
12169
12170 @item asan-memintrin
12171 Enable detection for built-in functions. This kind of protection
12172 is enabled by default when using @option{-fsanitize=address}.
12173 To disable built-in functions protection use
12174 @option{--param asan-memintrin=0}.
12175
12176 @item asan-use-after-return
12177 Enable detection of use-after-return. This kind of protection
12178 is enabled by default when using the @option{-fsanitize=address} option.
12179 To disable it use @option{--param asan-use-after-return=0}.
12180
12181 Note: By default the check is disabled at run time. To enable it,
12182 add @code{detect_stack_use_after_return=1} to the environment variable
12183 @env{ASAN_OPTIONS}.
12184
12185 @item asan-instrumentation-with-call-threshold
12186 If number of memory accesses in function being instrumented
12187 is greater or equal to this number, use callbacks instead of inline checks.
12188 E.g. to disable inline code use
12189 @option{--param asan-instrumentation-with-call-threshold=0}.
12190
12191 @item use-after-scope-direct-emission-threshold
12192 If the size of a local variable in bytes is smaller or equal to this
12193 number, directly poison (or unpoison) shadow memory instead of using
12194 run-time callbacks.
12195
12196 @item max-fsm-thread-path-insns
12197 Maximum number of instructions to copy when duplicating blocks on a
12198 finite state automaton jump thread path.
12199
12200 @item max-fsm-thread-length
12201 Maximum number of basic blocks on a finite state automaton jump thread
12202 path.
12203
12204 @item max-fsm-thread-paths
12205 Maximum number of new jump thread paths to create for a finite state
12206 automaton.
12207
12208 @item parloops-chunk-size
12209 Chunk size of omp schedule for loops parallelized by parloops.
12210
12211 @item parloops-schedule
12212 Schedule type of omp schedule for loops parallelized by parloops (static,
12213 dynamic, guided, auto, runtime).
12214
12215 @item parloops-min-per-thread
12216 The minimum number of iterations per thread of an innermost parallelized
12217 loop for which the parallelized variant is preferred over the single threaded
12218 one. Note that for a parallelized loop nest the
12219 minimum number of iterations of the outermost loop per thread is two.
12220
12221 @item max-ssa-name-query-depth
12222 Maximum depth of recursion when querying properties of SSA names in things
12223 like fold routines. One level of recursion corresponds to following a
12224 use-def chain.
12225
12226 @item hsa-gen-debug-stores
12227 Enable emission of special debug stores within HSA kernels which are
12228 then read and reported by libgomp plugin. Generation of these stores
12229 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12230 enable it.
12231
12232 @item max-speculative-devirt-maydefs
12233 The maximum number of may-defs we analyze when looking for a must-def
12234 specifying the dynamic type of an object that invokes a virtual call
12235 we may be able to devirtualize speculatively.
12236
12237 @item max-vrp-switch-assertions
12238 The maximum number of assertions to add along the default edge of a switch
12239 statement during VRP.
12240
12241 @item unroll-jam-min-percent
12242 The minimum percentage of memory references that must be optimized
12243 away for the unroll-and-jam transformation to be considered profitable.
12244
12245 @item unroll-jam-max-unroll
12246 The maximum number of times the outer loop should be unrolled by
12247 the unroll-and-jam transformation.
12248
12249 @item max-rtl-if-conversion-unpredictable-cost
12250 Maximum permissible cost for the sequence that would be generated
12251 by the RTL if-conversion pass for a branch that is considered unpredictable.
12252
12253 @item max-variable-expansions-in-unroller
12254 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12255 of times that an individual variable will be expanded during loop unrolling.
12256
12257 @item tracer-min-branch-probability-feedback
12258 Stop forward growth if the probability of best edge is less than
12259 this threshold (in percent). Used when profile feedback is available.
12260
12261 @item partial-inlining-entry-probability
12262 Maximum probability of the entry BB of split region
12263 (in percent relative to entry BB of the function)
12264 to make partial inlining happen.
12265
12266 @item max-tracked-strlens
12267 Maximum number of strings for which strlen optimization pass will
12268 track string lengths.
12269
12270 @item gcse-after-reload-partial-fraction
12271 The threshold ratio for performing partial redundancy
12272 elimination after reload.
12273
12274 @item gcse-after-reload-critical-fraction
12275 The threshold ratio of critical edges execution count that
12276 permit performing redundancy elimination after reload.
12277
12278 @item max-loop-header-insns
12279 The maximum number of insns in loop header duplicated
12280 by the copy loop headers pass.
12281
12282 @item vect-epilogues-nomask
12283 Enable loop epilogue vectorization using smaller vector size.
12284
12285 @item slp-max-insns-in-bb
12286 Maximum number of instructions in basic block to be
12287 considered for SLP vectorization.
12288
12289 @item avoid-fma-max-bits
12290 Maximum number of bits for which we avoid creating FMAs.
12291
12292 @item sms-loop-average-count-threshold
12293 A threshold on the average loop count considered by the swing modulo scheduler.
12294
12295 @item sms-dfa-history
12296 The number of cycles the swing modulo scheduler considers when checking
12297 conflicts using DFA.
12298
12299 @item max-inline-insns-recursive-auto
12300 The maximum number of instructions non-inline function
12301 can grow to via recursive inlining.
12302
12303 @item graphite-allow-codegen-errors
12304 Whether codegen errors should be ICEs when @option{-fchecking}.
12305
12306 @item sms-max-ii-factor
12307 A factor for tuning the upper bound that swing modulo scheduler
12308 uses for scheduling a loop.
12309
12310 @item lra-max-considered-reload-pseudos
12311 The max number of reload pseudos which are considered during
12312 spilling a non-reload pseudo.
12313
12314 @item max-pow-sqrt-depth
12315 Maximum depth of sqrt chains to use when synthesizing exponentiation
12316 by a real constant.
12317
12318 @item max-dse-active-local-stores
12319 Maximum number of active local stores in RTL dead store elimination.
12320
12321 @item asan-instrument-allocas
12322 Enable asan allocas/VLAs protection.
12323
12324 @item max-iterations-computation-cost
12325 Bound on the cost of an expression to compute the number of iterations.
12326
12327 @item max-isl-operations
12328 Maximum number of isl operations, 0 means unlimited.
12329
12330 @item graphite-max-arrays-per-scop
12331 Maximum number of arrays per scop.
12332
12333 @item max-vartrack-reverse-op-size
12334 Max. size of loc list for which reverse ops should be added.
12335
12336 @item tracer-dynamic-coverage-feedback
12337 The percentage of function, weighted by execution frequency,
12338 that must be covered by trace formation.
12339 Used when profile feedback is available.
12340
12341 @item max-inline-recursive-depth-auto
12342 The maximum depth of recursive inlining for non-inline functions.
12343
12344 @item fsm-scale-path-stmts
12345 Scale factor to apply to the number of statements in a threading path
12346 when comparing to the number of (scaled) blocks.
12347
12348 @item fsm-maximum-phi-arguments
12349 Maximum number of arguments a PHI may have before the FSM threader
12350 will not try to thread through its block.
12351
12352 @item uninit-control-dep-attempts
12353 Maximum number of nested calls to search for control dependencies
12354 during uninitialized variable analysis.
12355
12356 @item max-once-peeled-insns
12357 The maximum number of insns of a peeled loop that rolls only once.
12358
12359 @item sra-max-scalarization-size-Osize
12360 Maximum size, in storage units, of an aggregate
12361 which should be considered for scalarization when compiling for size.
12362
12363 @item fsm-scale-path-blocks
12364 Scale factor to apply to the number of blocks in a threading path
12365 when comparing to the number of (scaled) statements.
12366
12367 @item sched-autopref-queue-depth
12368 Hardware autoprefetcher scheduler model control flag.
12369 Number of lookahead cycles the model looks into; at '
12370 ' only enable instruction sorting heuristic.
12371
12372 @item loop-versioning-max-inner-insns
12373 The maximum number of instructions that an inner loop can have
12374 before the loop versioning pass considers it too big to copy.
12375
12376 @item loop-versioning-max-outer-insns
12377 The maximum number of instructions that an outer loop can have
12378 before the loop versioning pass considers it too big to copy,
12379 discounting any instructions in inner loops that directly benefit
12380 from versioning.
12381
12382 @item ssa-name-def-chain-limit
12383 The maximum number of SSA_NAME assignments to follow in determining
12384 a property of a variable such as its value. This limits the number
12385 of iterations or recursive calls GCC performs when optimizing certain
12386 statements or when determining their validity prior to issuing
12387 diagnostics.
12388
12389 @end table
12390 @end table
12391
12392 @node Instrumentation Options
12393 @section Program Instrumentation Options
12394 @cindex instrumentation options
12395 @cindex program instrumentation options
12396 @cindex run-time error checking options
12397 @cindex profiling options
12398 @cindex options, program instrumentation
12399 @cindex options, run-time error checking
12400 @cindex options, profiling
12401
12402 GCC supports a number of command-line options that control adding
12403 run-time instrumentation to the code it normally generates.
12404 For example, one purpose of instrumentation is collect profiling
12405 statistics for use in finding program hot spots, code coverage
12406 analysis, or profile-guided optimizations.
12407 Another class of program instrumentation is adding run-time checking
12408 to detect programming errors like invalid pointer
12409 dereferences or out-of-bounds array accesses, as well as deliberately
12410 hostile attacks such as stack smashing or C++ vtable hijacking.
12411 There is also a general hook which can be used to implement other
12412 forms of tracing or function-level instrumentation for debug or
12413 program analysis purposes.
12414
12415 @table @gcctabopt
12416 @cindex @command{prof}
12417 @cindex @command{gprof}
12418 @item -p
12419 @itemx -pg
12420 @opindex p
12421 @opindex pg
12422 Generate extra code to write profile information suitable for the
12423 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12424 (for @option{-pg}). You must use this option when compiling
12425 the source files you want data about, and you must also use it when
12426 linking.
12427
12428 You can use the function attribute @code{no_instrument_function} to
12429 suppress profiling of individual functions when compiling with these options.
12430 @xref{Common Function Attributes}.
12431
12432 @item -fprofile-arcs
12433 @opindex fprofile-arcs
12434 Add code so that program flow @dfn{arcs} are instrumented. During
12435 execution the program records how many times each branch and call is
12436 executed and how many times it is taken or returns. On targets that support
12437 constructors with priority support, profiling properly handles constructors,
12438 destructors and C++ constructors (and destructors) of classes which are used
12439 as a type of a global variable.
12440
12441 When the compiled
12442 program exits it saves this data to a file called
12443 @file{@var{auxname}.gcda} for each source file. The data may be used for
12444 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12445 test coverage analysis (@option{-ftest-coverage}). Each object file's
12446 @var{auxname} is generated from the name of the output file, if
12447 explicitly specified and it is not the final executable, otherwise it is
12448 the basename of the source file. In both cases any suffix is removed
12449 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12450 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12451 @xref{Cross-profiling}.
12452
12453 @cindex @command{gcov}
12454 @item --coverage
12455 @opindex coverage
12456
12457 This option is used to compile and link code instrumented for coverage
12458 analysis. The option is a synonym for @option{-fprofile-arcs}
12459 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12460 linking). See the documentation for those options for more details.
12461
12462 @itemize
12463
12464 @item
12465 Compile the source files with @option{-fprofile-arcs} plus optimization
12466 and code generation options. For test coverage analysis, use the
12467 additional @option{-ftest-coverage} option. You do not need to profile
12468 every source file in a program.
12469
12470 @item
12471 Compile the source files additionally with @option{-fprofile-abs-path}
12472 to create absolute path names in the @file{.gcno} files. This allows
12473 @command{gcov} to find the correct sources in projects where compilations
12474 occur with different working directories.
12475
12476 @item
12477 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12478 (the latter implies the former).
12479
12480 @item
12481 Run the program on a representative workload to generate the arc profile
12482 information. This may be repeated any number of times. You can run
12483 concurrent instances of your program, and provided that the file system
12484 supports locking, the data files will be correctly updated. Unless
12485 a strict ISO C dialect option is in effect, @code{fork} calls are
12486 detected and correctly handled without double counting.
12487
12488 @item
12489 For profile-directed optimizations, compile the source files again with
12490 the same optimization and code generation options plus
12491 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12492 Control Optimization}).
12493
12494 @item
12495 For test coverage analysis, use @command{gcov} to produce human readable
12496 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12497 @command{gcov} documentation for further information.
12498
12499 @end itemize
12500
12501 With @option{-fprofile-arcs}, for each function of your program GCC
12502 creates a program flow graph, then finds a spanning tree for the graph.
12503 Only arcs that are not on the spanning tree have to be instrumented: the
12504 compiler adds code to count the number of times that these arcs are
12505 executed. When an arc is the only exit or only entrance to a block, the
12506 instrumentation code can be added to the block; otherwise, a new basic
12507 block must be created to hold the instrumentation code.
12508
12509 @need 2000
12510 @item -ftest-coverage
12511 @opindex ftest-coverage
12512 Produce a notes file that the @command{gcov} code-coverage utility
12513 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12514 show program coverage. Each source file's note file is called
12515 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12516 above for a description of @var{auxname} and instructions on how to
12517 generate test coverage data. Coverage data matches the source files
12518 more closely if you do not optimize.
12519
12520 @item -fprofile-abs-path
12521 @opindex fprofile-abs-path
12522 Automatically convert relative source file names to absolute path names
12523 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12524 sources in projects where compilations occur with different working
12525 directories.
12526
12527 @item -fprofile-dir=@var{path}
12528 @opindex fprofile-dir
12529
12530 Set the directory to search for the profile data files in to @var{path}.
12531 This option affects only the profile data generated by
12532 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12533 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12534 and its related options. Both absolute and relative paths can be used.
12535 By default, GCC uses the current directory as @var{path}, thus the
12536 profile data file appears in the same directory as the object file.
12537 In order to prevent the file name clashing, if the object file name is
12538 not an absolute path, we mangle the absolute path of the
12539 @file{@var{sourcename}.gcda} file and use it as the file name of a
12540 @file{.gcda} file. See similar option @option{-fprofile-note}.
12541
12542 When an executable is run in a massive parallel environment, it is recommended
12543 to save profile to different folders. That can be done with variables
12544 in @var{path} that are exported during run-time:
12545
12546 @table @gcctabopt
12547
12548 @item %p
12549 process ID.
12550
12551 @item %q@{VAR@}
12552 value of environment variable @var{VAR}
12553
12554 @end table
12555
12556 @item -fprofile-generate
12557 @itemx -fprofile-generate=@var{path}
12558 @opindex fprofile-generate
12559
12560 Enable options usually used for instrumenting application to produce
12561 profile useful for later recompilation with profile feedback based
12562 optimization. You must use @option{-fprofile-generate} both when
12563 compiling and when linking your program.
12564
12565 The following options are enabled:
12566 @option{-fprofile-arcs}, @option{-fprofile-values},
12567 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12568
12569 If @var{path} is specified, GCC looks at the @var{path} to find
12570 the profile feedback data files. See @option{-fprofile-dir}.
12571
12572 To optimize the program based on the collected profile information, use
12573 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12574
12575 @item -fprofile-note=@var{path}
12576 @opindex fprofile-note
12577
12578 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12579 location. If you combine the option with multiple source files,
12580 the @file{.gcno} file will be overwritten.
12581
12582 @item -fprofile-update=@var{method}
12583 @opindex fprofile-update
12584
12585 Alter the update method for an application instrumented for profile
12586 feedback based optimization. The @var{method} argument should be one of
12587 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12588 The first one is useful for single-threaded applications,
12589 while the second one prevents profile corruption by emitting thread-safe code.
12590
12591 @strong{Warning:} When an application does not properly join all threads
12592 (or creates an detached thread), a profile file can be still corrupted.
12593
12594 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12595 when supported by a target, or to @samp{single} otherwise. The GCC driver
12596 automatically selects @samp{prefer-atomic} when @option{-pthread}
12597 is present in the command line.
12598
12599 @item -fprofile-filter-files=@var{regex}
12600 @opindex fprofile-filter-files
12601
12602 Instrument only functions from files where names match
12603 any regular expression (separated by a semi-colon).
12604
12605 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12606 only @file{main.c} and all C files starting with 'module'.
12607
12608 @item -fprofile-exclude-files=@var{regex}
12609 @opindex fprofile-exclude-files
12610
12611 Instrument only functions from files where names do not match
12612 all the regular expressions (separated by a semi-colon).
12613
12614 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12615 of all files that are located in @file{/usr/} folder.
12616
12617 @item -fsanitize=address
12618 @opindex fsanitize=address
12619 Enable AddressSanitizer, a fast memory error detector.
12620 Memory access instructions are instrumented to detect
12621 out-of-bounds and use-after-free bugs.
12622 The option enables @option{-fsanitize-address-use-after-scope}.
12623 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12624 more details. The run-time behavior can be influenced using the
12625 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12626 the available options are shown at startup of the instrumented program. See
12627 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12628 for a list of supported options.
12629 The option cannot be combined with @option{-fsanitize=thread}.
12630
12631 @item -fsanitize=kernel-address
12632 @opindex fsanitize=kernel-address
12633 Enable AddressSanitizer for Linux kernel.
12634 See @uref{https://github.com/google/kasan/wiki} for more details.
12635
12636 @item -fsanitize=pointer-compare
12637 @opindex fsanitize=pointer-compare
12638 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12639 The option must be combined with either @option{-fsanitize=kernel-address} or
12640 @option{-fsanitize=address}
12641 The option cannot be combined with @option{-fsanitize=thread}.
12642 Note: By default the check is disabled at run time. To enable it,
12643 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12644 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12645 invalid operation only when both pointers are non-null.
12646
12647 @item -fsanitize=pointer-subtract
12648 @opindex fsanitize=pointer-subtract
12649 Instrument subtraction with pointer operands.
12650 The option must be combined with either @option{-fsanitize=kernel-address} or
12651 @option{-fsanitize=address}
12652 The option cannot be combined with @option{-fsanitize=thread}.
12653 Note: By default the check is disabled at run time. To enable it,
12654 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12655 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12656 invalid operation only when both pointers are non-null.
12657
12658 @item -fsanitize=thread
12659 @opindex fsanitize=thread
12660 Enable ThreadSanitizer, a fast data race detector.
12661 Memory access instructions are instrumented to detect
12662 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12663 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12664 environment variable; see
12665 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12666 supported options.
12667 The option cannot be combined with @option{-fsanitize=address},
12668 @option{-fsanitize=leak}.
12669
12670 Note that sanitized atomic builtins cannot throw exceptions when
12671 operating on invalid memory addresses with non-call exceptions
12672 (@option{-fnon-call-exceptions}).
12673
12674 @item -fsanitize=leak
12675 @opindex fsanitize=leak
12676 Enable LeakSanitizer, a memory leak detector.
12677 This option only matters for linking of executables and
12678 the executable is linked against a library that overrides @code{malloc}
12679 and other allocator functions. See
12680 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12681 details. The run-time behavior can be influenced using the
12682 @env{LSAN_OPTIONS} environment variable.
12683 The option cannot be combined with @option{-fsanitize=thread}.
12684
12685 @item -fsanitize=undefined
12686 @opindex fsanitize=undefined
12687 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12688 Various computations are instrumented to detect undefined behavior
12689 at runtime. Current suboptions are:
12690
12691 @table @gcctabopt
12692
12693 @item -fsanitize=shift
12694 @opindex fsanitize=shift
12695 This option enables checking that the result of a shift operation is
12696 not undefined. Note that what exactly is considered undefined differs
12697 slightly between C and C++, as well as between ISO C90 and C99, etc.
12698 This option has two suboptions, @option{-fsanitize=shift-base} and
12699 @option{-fsanitize=shift-exponent}.
12700
12701 @item -fsanitize=shift-exponent
12702 @opindex fsanitize=shift-exponent
12703 This option enables checking that the second argument of a shift operation
12704 is not negative and is smaller than the precision of the promoted first
12705 argument.
12706
12707 @item -fsanitize=shift-base
12708 @opindex fsanitize=shift-base
12709 If the second argument of a shift operation is within range, check that the
12710 result of a shift operation is not undefined. Note that what exactly is
12711 considered undefined differs slightly between C and C++, as well as between
12712 ISO C90 and C99, etc.
12713
12714 @item -fsanitize=integer-divide-by-zero
12715 @opindex fsanitize=integer-divide-by-zero
12716 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12717
12718 @item -fsanitize=unreachable
12719 @opindex fsanitize=unreachable
12720 With this option, the compiler turns the @code{__builtin_unreachable}
12721 call into a diagnostics message call instead. When reaching the
12722 @code{__builtin_unreachable} call, the behavior is undefined.
12723
12724 @item -fsanitize=vla-bound
12725 @opindex fsanitize=vla-bound
12726 This option instructs the compiler to check that the size of a variable
12727 length array is positive.
12728
12729 @item -fsanitize=null
12730 @opindex fsanitize=null
12731 This option enables pointer checking. Particularly, the application
12732 built with this option turned on will issue an error message when it
12733 tries to dereference a NULL pointer, or if a reference (possibly an
12734 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12735 on an object pointed by a NULL pointer.
12736
12737 @item -fsanitize=return
12738 @opindex fsanitize=return
12739 This option enables return statement checking. Programs
12740 built with this option turned on will issue an error message
12741 when the end of a non-void function is reached without actually
12742 returning a value. This option works in C++ only.
12743
12744 @item -fsanitize=signed-integer-overflow
12745 @opindex fsanitize=signed-integer-overflow
12746 This option enables signed integer overflow checking. We check that
12747 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12748 does not overflow in the signed arithmetics. Note, integer promotion
12749 rules must be taken into account. That is, the following is not an
12750 overflow:
12751 @smallexample
12752 signed char a = SCHAR_MAX;
12753 a++;
12754 @end smallexample
12755
12756 @item -fsanitize=bounds
12757 @opindex fsanitize=bounds
12758 This option enables instrumentation of array bounds. Various out of bounds
12759 accesses are detected. Flexible array members, flexible array member-like
12760 arrays, and initializers of variables with static storage are not instrumented.
12761
12762 @item -fsanitize=bounds-strict
12763 @opindex fsanitize=bounds-strict
12764 This option enables strict instrumentation of array bounds. Most out of bounds
12765 accesses are detected, including flexible array members and flexible array
12766 member-like arrays. Initializers of variables with static storage are not
12767 instrumented.
12768
12769 @item -fsanitize=alignment
12770 @opindex fsanitize=alignment
12771
12772 This option enables checking of alignment of pointers when they are
12773 dereferenced, or when a reference is bound to insufficiently aligned target,
12774 or when a method or constructor is invoked on insufficiently aligned object.
12775
12776 @item -fsanitize=object-size
12777 @opindex fsanitize=object-size
12778 This option enables instrumentation of memory references using the
12779 @code{__builtin_object_size} function. Various out of bounds pointer
12780 accesses are detected.
12781
12782 @item -fsanitize=float-divide-by-zero
12783 @opindex fsanitize=float-divide-by-zero
12784 Detect floating-point division by zero. Unlike other similar options,
12785 @option{-fsanitize=float-divide-by-zero} is not enabled by
12786 @option{-fsanitize=undefined}, since floating-point division by zero can
12787 be a legitimate way of obtaining infinities and NaNs.
12788
12789 @item -fsanitize=float-cast-overflow
12790 @opindex fsanitize=float-cast-overflow
12791 This option enables floating-point type to integer conversion checking.
12792 We check that the result of the conversion does not overflow.
12793 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12794 not enabled by @option{-fsanitize=undefined}.
12795 This option does not work well with @code{FE_INVALID} exceptions enabled.
12796
12797 @item -fsanitize=nonnull-attribute
12798 @opindex fsanitize=nonnull-attribute
12799
12800 This option enables instrumentation of calls, checking whether null values
12801 are not passed to arguments marked as requiring a non-null value by the
12802 @code{nonnull} function attribute.
12803
12804 @item -fsanitize=returns-nonnull-attribute
12805 @opindex fsanitize=returns-nonnull-attribute
12806
12807 This option enables instrumentation of return statements in functions
12808 marked with @code{returns_nonnull} function attribute, to detect returning
12809 of null values from such functions.
12810
12811 @item -fsanitize=bool
12812 @opindex fsanitize=bool
12813
12814 This option enables instrumentation of loads from bool. If a value other
12815 than 0/1 is loaded, a run-time error is issued.
12816
12817 @item -fsanitize=enum
12818 @opindex fsanitize=enum
12819
12820 This option enables instrumentation of loads from an enum type. If
12821 a value outside the range of values for the enum type is loaded,
12822 a run-time error is issued.
12823
12824 @item -fsanitize=vptr
12825 @opindex fsanitize=vptr
12826
12827 This option enables instrumentation of C++ member function calls, member
12828 accesses and some conversions between pointers to base and derived classes,
12829 to verify the referenced object has the correct dynamic type.
12830
12831 @item -fsanitize=pointer-overflow
12832 @opindex fsanitize=pointer-overflow
12833
12834 This option enables instrumentation of pointer arithmetics. If the pointer
12835 arithmetics overflows, a run-time error is issued.
12836
12837 @item -fsanitize=builtin
12838 @opindex fsanitize=builtin
12839
12840 This option enables instrumentation of arguments to selected builtin
12841 functions. If an invalid value is passed to such arguments, a run-time
12842 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12843 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12844 by this option.
12845
12846 @end table
12847
12848 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12849 @option{-fsanitize=undefined} gives a diagnostic message.
12850 This currently works only for the C family of languages.
12851
12852 @item -fno-sanitize=all
12853 @opindex fno-sanitize=all
12854
12855 This option disables all previously enabled sanitizers.
12856 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12857 together.
12858
12859 @item -fasan-shadow-offset=@var{number}
12860 @opindex fasan-shadow-offset
12861 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12862 It is useful for experimenting with different shadow memory layouts in
12863 Kernel AddressSanitizer.
12864
12865 @item -fsanitize-sections=@var{s1},@var{s2},...
12866 @opindex fsanitize-sections
12867 Sanitize global variables in selected user-defined sections. @var{si} may
12868 contain wildcards.
12869
12870 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12871 @opindex fsanitize-recover
12872 @opindex fno-sanitize-recover
12873 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12874 mentioned in comma-separated list of @var{opts}. Enabling this option
12875 for a sanitizer component causes it to attempt to continue
12876 running the program as if no error happened. This means multiple
12877 runtime errors can be reported in a single program run, and the exit
12878 code of the program may indicate success even when errors
12879 have been reported. The @option{-fno-sanitize-recover=} option
12880 can be used to alter
12881 this behavior: only the first detected error is reported
12882 and program then exits with a non-zero exit code.
12883
12884 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12885 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12886 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12887 @option{-fsanitize=bounds-strict},
12888 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12889 For these sanitizers error recovery is turned on by default,
12890 except @option{-fsanitize=address}, for which this feature is experimental.
12891 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12892 accepted, the former enables recovery for all sanitizers that support it,
12893 the latter disables recovery for all sanitizers that support it.
12894
12895 Even if a recovery mode is turned on the compiler side, it needs to be also
12896 enabled on the runtime library side, otherwise the failures are still fatal.
12897 The runtime library defaults to @code{halt_on_error=0} for
12898 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12899 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12900 setting the @code{halt_on_error} flag in the corresponding environment variable.
12901
12902 Syntax without an explicit @var{opts} parameter is deprecated. It is
12903 equivalent to specifying an @var{opts} list of:
12904
12905 @smallexample
12906 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12907 @end smallexample
12908
12909 @item -fsanitize-address-use-after-scope
12910 @opindex fsanitize-address-use-after-scope
12911 Enable sanitization of local variables to detect use-after-scope bugs.
12912 The option sets @option{-fstack-reuse} to @samp{none}.
12913
12914 @item -fsanitize-undefined-trap-on-error
12915 @opindex fsanitize-undefined-trap-on-error
12916 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12917 report undefined behavior using @code{__builtin_trap} rather than
12918 a @code{libubsan} library routine. The advantage of this is that the
12919 @code{libubsan} library is not needed and is not linked in, so this
12920 is usable even in freestanding environments.
12921
12922 @item -fsanitize-coverage=trace-pc
12923 @opindex fsanitize-coverage=trace-pc
12924 Enable coverage-guided fuzzing code instrumentation.
12925 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12926
12927 @item -fsanitize-coverage=trace-cmp
12928 @opindex fsanitize-coverage=trace-cmp
12929 Enable dataflow guided fuzzing code instrumentation.
12930 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12931 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12932 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12933 variable or @code{__sanitizer_cov_trace_const_cmp1},
12934 @code{__sanitizer_cov_trace_const_cmp2},
12935 @code{__sanitizer_cov_trace_const_cmp4} or
12936 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12937 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12938 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12939 @code{__sanitizer_cov_trace_switch} for switch statements.
12940
12941 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12942 @opindex fcf-protection
12943 Enable code instrumentation of control-flow transfers to increase
12944 program security by checking that target addresses of control-flow
12945 transfer instructions (such as indirect function call, function return,
12946 indirect jump) are valid. This prevents diverting the flow of control
12947 to an unexpected target. This is intended to protect against such
12948 threats as Return-oriented Programming (ROP), and similarly
12949 call/jmp-oriented programming (COP/JOP).
12950
12951 The value @code{branch} tells the compiler to implement checking of
12952 validity of control-flow transfer at the point of indirect branch
12953 instructions, i.e.@: call/jmp instructions. The value @code{return}
12954 implements checking of validity at the point of returning from a
12955 function. The value @code{full} is an alias for specifying both
12956 @code{branch} and @code{return}. The value @code{none} turns off
12957 instrumentation.
12958
12959 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12960 used. The first bit of @code{__CET__} is set to 1 for the value
12961 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12962 the @code{return}.
12963
12964 You can also use the @code{nocf_check} attribute to identify
12965 which functions and calls should be skipped from instrumentation
12966 (@pxref{Function Attributes}).
12967
12968 Currently the x86 GNU/Linux target provides an implementation based
12969 on Intel Control-flow Enforcement Technology (CET).
12970
12971 @item -fstack-protector
12972 @opindex fstack-protector
12973 Emit extra code to check for buffer overflows, such as stack smashing
12974 attacks. This is done by adding a guard variable to functions with
12975 vulnerable objects. This includes functions that call @code{alloca}, and
12976 functions with buffers larger than 8 bytes. The guards are initialized
12977 when a function is entered and then checked when the function exits.
12978 If a guard check fails, an error message is printed and the program exits.
12979
12980 @item -fstack-protector-all
12981 @opindex fstack-protector-all
12982 Like @option{-fstack-protector} except that all functions are protected.
12983
12984 @item -fstack-protector-strong
12985 @opindex fstack-protector-strong
12986 Like @option{-fstack-protector} but includes additional functions to
12987 be protected --- those that have local array definitions, or have
12988 references to local frame addresses.
12989
12990 @item -fstack-protector-explicit
12991 @opindex fstack-protector-explicit
12992 Like @option{-fstack-protector} but only protects those functions which
12993 have the @code{stack_protect} attribute.
12994
12995 @item -fstack-check
12996 @opindex fstack-check
12997 Generate code to verify that you do not go beyond the boundary of the
12998 stack. You should specify this flag if you are running in an
12999 environment with multiple threads, but you only rarely need to specify it in
13000 a single-threaded environment since stack overflow is automatically
13001 detected on nearly all systems if there is only one stack.
13002
13003 Note that this switch does not actually cause checking to be done; the
13004 operating system or the language runtime must do that. The switch causes
13005 generation of code to ensure that they see the stack being extended.
13006
13007 You can additionally specify a string parameter: @samp{no} means no
13008 checking, @samp{generic} means force the use of old-style checking,
13009 @samp{specific} means use the best checking method and is equivalent
13010 to bare @option{-fstack-check}.
13011
13012 Old-style checking is a generic mechanism that requires no specific
13013 target support in the compiler but comes with the following drawbacks:
13014
13015 @enumerate
13016 @item
13017 Modified allocation strategy for large objects: they are always
13018 allocated dynamically if their size exceeds a fixed threshold. Note this
13019 may change the semantics of some code.
13020
13021 @item
13022 Fixed limit on the size of the static frame of functions: when it is
13023 topped by a particular function, stack checking is not reliable and
13024 a warning is issued by the compiler.
13025
13026 @item
13027 Inefficiency: because of both the modified allocation strategy and the
13028 generic implementation, code performance is hampered.
13029 @end enumerate
13030
13031 Note that old-style stack checking is also the fallback method for
13032 @samp{specific} if no target support has been added in the compiler.
13033
13034 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13035 and stack overflows. @samp{specific} is an excellent choice when compiling
13036 Ada code. It is not generally sufficient to protect against stack-clash
13037 attacks. To protect against those you want @samp{-fstack-clash-protection}.
13038
13039 @item -fstack-clash-protection
13040 @opindex fstack-clash-protection
13041 Generate code to prevent stack clash style attacks. When this option is
13042 enabled, the compiler will only allocate one page of stack space at a time
13043 and each page is accessed immediately after allocation. Thus, it prevents
13044 allocations from jumping over any stack guard page provided by the
13045 operating system.
13046
13047 Most targets do not fully support stack clash protection. However, on
13048 those targets @option{-fstack-clash-protection} will protect dynamic stack
13049 allocations. @option{-fstack-clash-protection} may also provide limited
13050 protection for static stack allocations if the target supports
13051 @option{-fstack-check=specific}.
13052
13053 @item -fstack-limit-register=@var{reg}
13054 @itemx -fstack-limit-symbol=@var{sym}
13055 @itemx -fno-stack-limit
13056 @opindex fstack-limit-register
13057 @opindex fstack-limit-symbol
13058 @opindex fno-stack-limit
13059 Generate code to ensure that the stack does not grow beyond a certain value,
13060 either the value of a register or the address of a symbol. If a larger
13061 stack is required, a signal is raised at run time. For most targets,
13062 the signal is raised before the stack overruns the boundary, so
13063 it is possible to catch the signal without taking special precautions.
13064
13065 For instance, if the stack starts at absolute address @samp{0x80000000}
13066 and grows downwards, you can use the flags
13067 @option{-fstack-limit-symbol=__stack_limit} and
13068 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13069 of 128KB@. Note that this may only work with the GNU linker.
13070
13071 You can locally override stack limit checking by using the
13072 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13073
13074 @item -fsplit-stack
13075 @opindex fsplit-stack
13076 Generate code to automatically split the stack before it overflows.
13077 The resulting program has a discontiguous stack which can only
13078 overflow if the program is unable to allocate any more memory. This
13079 is most useful when running threaded programs, as it is no longer
13080 necessary to calculate a good stack size to use for each thread. This
13081 is currently only implemented for the x86 targets running
13082 GNU/Linux.
13083
13084 When code compiled with @option{-fsplit-stack} calls code compiled
13085 without @option{-fsplit-stack}, there may not be much stack space
13086 available for the latter code to run. If compiling all code,
13087 including library code, with @option{-fsplit-stack} is not an option,
13088 then the linker can fix up these calls so that the code compiled
13089 without @option{-fsplit-stack} always has a large stack. Support for
13090 this is implemented in the gold linker in GNU binutils release 2.21
13091 and later.
13092
13093 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13094 @opindex fvtable-verify
13095 This option is only available when compiling C++ code.
13096 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13097 feature that verifies at run time, for every virtual call, that
13098 the vtable pointer through which the call is made is valid for the type of
13099 the object, and has not been corrupted or overwritten. If an invalid vtable
13100 pointer is detected at run time, an error is reported and execution of the
13101 program is immediately halted.
13102
13103 This option causes run-time data structures to be built at program startup,
13104 which are used for verifying the vtable pointers.
13105 The options @samp{std} and @samp{preinit}
13106 control the timing of when these data structures are built. In both cases the
13107 data structures are built before execution reaches @code{main}. Using
13108 @option{-fvtable-verify=std} causes the data structures to be built after
13109 shared libraries have been loaded and initialized.
13110 @option{-fvtable-verify=preinit} causes them to be built before shared
13111 libraries have been loaded and initialized.
13112
13113 If this option appears multiple times in the command line with different
13114 values specified, @samp{none} takes highest priority over both @samp{std} and
13115 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13116
13117 @item -fvtv-debug
13118 @opindex fvtv-debug
13119 When used in conjunction with @option{-fvtable-verify=std} or
13120 @option{-fvtable-verify=preinit}, causes debug versions of the
13121 runtime functions for the vtable verification feature to be called.
13122 This flag also causes the compiler to log information about which
13123 vtable pointers it finds for each class.
13124 This information is written to a file named @file{vtv_set_ptr_data.log}
13125 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13126 if that is defined or the current working directory otherwise.
13127
13128 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13129 file, be sure to delete any existing one.
13130
13131 @item -fvtv-counts
13132 @opindex fvtv-counts
13133 This is a debugging flag. When used in conjunction with
13134 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13135 causes the compiler to keep track of the total number of virtual calls
13136 it encounters and the number of verifications it inserts. It also
13137 counts the number of calls to certain run-time library functions
13138 that it inserts and logs this information for each compilation unit.
13139 The compiler writes this information to a file named
13140 @file{vtv_count_data.log} in the directory named by the environment
13141 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13142 directory otherwise. It also counts the size of the vtable pointer sets
13143 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13144 in the same directory.
13145
13146 Note: This feature @emph{appends} data to the log files. To get fresh log
13147 files, be sure to delete any existing ones.
13148
13149 @item -finstrument-functions
13150 @opindex finstrument-functions
13151 Generate instrumentation calls for entry and exit to functions. Just
13152 after function entry and just before function exit, the following
13153 profiling functions are called with the address of the current
13154 function and its call site. (On some platforms,
13155 @code{__builtin_return_address} does not work beyond the current
13156 function, so the call site information may not be available to the
13157 profiling functions otherwise.)
13158
13159 @smallexample
13160 void __cyg_profile_func_enter (void *this_fn,
13161 void *call_site);
13162 void __cyg_profile_func_exit (void *this_fn,
13163 void *call_site);
13164 @end smallexample
13165
13166 The first argument is the address of the start of the current function,
13167 which may be looked up exactly in the symbol table.
13168
13169 This instrumentation is also done for functions expanded inline in other
13170 functions. The profiling calls indicate where, conceptually, the
13171 inline function is entered and exited. This means that addressable
13172 versions of such functions must be available. If all your uses of a
13173 function are expanded inline, this may mean an additional expansion of
13174 code size. If you use @code{extern inline} in your C code, an
13175 addressable version of such functions must be provided. (This is
13176 normally the case anyway, but if you get lucky and the optimizer always
13177 expands the functions inline, you might have gotten away without
13178 providing static copies.)
13179
13180 A function may be given the attribute @code{no_instrument_function}, in
13181 which case this instrumentation is not done. This can be used, for
13182 example, for the profiling functions listed above, high-priority
13183 interrupt routines, and any functions from which the profiling functions
13184 cannot safely be called (perhaps signal handlers, if the profiling
13185 routines generate output or allocate memory).
13186 @xref{Common Function Attributes}.
13187
13188 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13189 @opindex finstrument-functions-exclude-file-list
13190
13191 Set the list of functions that are excluded from instrumentation (see
13192 the description of @option{-finstrument-functions}). If the file that
13193 contains a function definition matches with one of @var{file}, then
13194 that function is not instrumented. The match is done on substrings:
13195 if the @var{file} parameter is a substring of the file name, it is
13196 considered to be a match.
13197
13198 For example:
13199
13200 @smallexample
13201 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13202 @end smallexample
13203
13204 @noindent
13205 excludes any inline function defined in files whose pathnames
13206 contain @file{/bits/stl} or @file{include/sys}.
13207
13208 If, for some reason, you want to include letter @samp{,} in one of
13209 @var{sym}, write @samp{\,}. For example,
13210 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13211 (note the single quote surrounding the option).
13212
13213 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13214 @opindex finstrument-functions-exclude-function-list
13215
13216 This is similar to @option{-finstrument-functions-exclude-file-list},
13217 but this option sets the list of function names to be excluded from
13218 instrumentation. The function name to be matched is its user-visible
13219 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13220 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13221 match is done on substrings: if the @var{sym} parameter is a substring
13222 of the function name, it is considered to be a match. For C99 and C++
13223 extended identifiers, the function name must be given in UTF-8, not
13224 using universal character names.
13225
13226 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13227 @opindex fpatchable-function-entry
13228 Generate @var{N} NOPs right at the beginning
13229 of each function, with the function entry point before the @var{M}th NOP.
13230 If @var{M} is omitted, it defaults to @code{0} so the
13231 function entry points to the address just at the first NOP.
13232 The NOP instructions reserve extra space which can be used to patch in
13233 any desired instrumentation at run time, provided that the code segment
13234 is writable. The amount of space is controllable indirectly via
13235 the number of NOPs; the NOP instruction used corresponds to the instruction
13236 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13237 is target-specific and may also depend on the architecture variant and/or
13238 other compilation options.
13239
13240 For run-time identification, the starting addresses of these areas,
13241 which correspond to their respective function entries minus @var{M},
13242 are additionally collected in the @code{__patchable_function_entries}
13243 section of the resulting binary.
13244
13245 Note that the value of @code{__attribute__ ((patchable_function_entry
13246 (N,M)))} takes precedence over command-line option
13247 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13248 the area size or to remove it completely on a single function.
13249 If @code{N=0}, no pad location is recorded.
13250
13251 The NOP instructions are inserted at---and maybe before, depending on
13252 @var{M}---the function entry address, even before the prologue.
13253
13254 @end table
13255
13256
13257 @node Preprocessor Options
13258 @section Options Controlling the Preprocessor
13259 @cindex preprocessor options
13260 @cindex options, preprocessor
13261
13262 These options control the C preprocessor, which is run on each C source
13263 file before actual compilation.
13264
13265 If you use the @option{-E} option, nothing is done except preprocessing.
13266 Some of these options make sense only together with @option{-E} because
13267 they cause the preprocessor output to be unsuitable for actual
13268 compilation.
13269
13270 In addition to the options listed here, there are a number of options
13271 to control search paths for include files documented in
13272 @ref{Directory Options}.
13273 Options to control preprocessor diagnostics are listed in
13274 @ref{Warning Options}.
13275
13276 @table @gcctabopt
13277 @include cppopts.texi
13278
13279 @item -Wp,@var{option}
13280 @opindex Wp
13281 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13282 and pass @var{option} directly through to the preprocessor. If
13283 @var{option} contains commas, it is split into multiple options at the
13284 commas. However, many options are modified, translated or interpreted
13285 by the compiler driver before being passed to the preprocessor, and
13286 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13287 interface is undocumented and subject to change, so whenever possible
13288 you should avoid using @option{-Wp} and let the driver handle the
13289 options instead.
13290
13291 @item -Xpreprocessor @var{option}
13292 @opindex Xpreprocessor
13293 Pass @var{option} as an option to the preprocessor. You can use this to
13294 supply system-specific preprocessor options that GCC does not
13295 recognize.
13296
13297 If you want to pass an option that takes an argument, you must use
13298 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13299
13300 @item -no-integrated-cpp
13301 @opindex no-integrated-cpp
13302 Perform preprocessing as a separate pass before compilation.
13303 By default, GCC performs preprocessing as an integrated part of
13304 input tokenization and parsing.
13305 If this option is provided, the appropriate language front end
13306 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13307 and Objective-C, respectively) is instead invoked twice,
13308 once for preprocessing only and once for actual compilation
13309 of the preprocessed input.
13310 This option may be useful in conjunction with the @option{-B} or
13311 @option{-wrapper} options to specify an alternate preprocessor or
13312 perform additional processing of the program source between
13313 normal preprocessing and compilation.
13314
13315 @end table
13316
13317 @node Assembler Options
13318 @section Passing Options to the Assembler
13319
13320 @c prevent bad page break with this line
13321 You can pass options to the assembler.
13322
13323 @table @gcctabopt
13324 @item -Wa,@var{option}
13325 @opindex Wa
13326 Pass @var{option} as an option to the assembler. If @var{option}
13327 contains commas, it is split into multiple options at the commas.
13328
13329 @item -Xassembler @var{option}
13330 @opindex Xassembler
13331 Pass @var{option} as an option to the assembler. You can use this to
13332 supply system-specific assembler options that GCC does not
13333 recognize.
13334
13335 If you want to pass an option that takes an argument, you must use
13336 @option{-Xassembler} twice, once for the option and once for the argument.
13337
13338 @end table
13339
13340 @node Link Options
13341 @section Options for Linking
13342 @cindex link options
13343 @cindex options, linking
13344
13345 These options come into play when the compiler links object files into
13346 an executable output file. They are meaningless if the compiler is
13347 not doing a link step.
13348
13349 @table @gcctabopt
13350 @cindex file names
13351 @item @var{object-file-name}
13352 A file name that does not end in a special recognized suffix is
13353 considered to name an object file or library. (Object files are
13354 distinguished from libraries by the linker according to the file
13355 contents.) If linking is done, these object files are used as input
13356 to the linker.
13357
13358 @item -c
13359 @itemx -S
13360 @itemx -E
13361 @opindex c
13362 @opindex S
13363 @opindex E
13364 If any of these options is used, then the linker is not run, and
13365 object file names should not be used as arguments. @xref{Overall
13366 Options}.
13367
13368 @item -flinker-output=@var{type}
13369 @opindex flinker-output
13370 This option controls code generation of the link-time optimizer. By
13371 default the linker output is automatically determined by the linker
13372 plugin. For debugging the compiler and if incremental linking with a
13373 non-LTO object file is desired, it may be useful to control the type
13374 manually.
13375
13376 If @var{type} is @samp{exec}, code generation produces a static
13377 binary. In this case @option{-fpic} and @option{-fpie} are both
13378 disabled.
13379
13380 If @var{type} is @samp{dyn}, code generation produces a shared
13381 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13382 but not enabled automatically. This allows to build shared libraries
13383 without position-independent code on architectures where this is
13384 possible, i.e.@: on x86.
13385
13386 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13387 executable. This results in similar optimizations as @samp{exec}
13388 except that @option{-fpie} is not disabled if specified at compilation
13389 time.
13390
13391 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13392 done. The sections containing intermediate code for link-time optimization are
13393 merged, pre-optimized, and output to the resulting object file. In addition, if
13394 @option{-ffat-lto-objects} is specified, binary code is produced for future
13395 non-LTO linking. The object file produced by incremental linking is smaller
13396 than a static library produced from the same object files. At link time the
13397 result of incremental linking also loads faster than a static
13398 library assuming that the majority of objects in the library are used.
13399
13400 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13401 code generation is forced, a final binary is produced, and the intermediate
13402 code for later link-time optimization is stripped. When multiple object files
13403 are linked together the resulting code is better optimized than with
13404 link-time optimizations disabled (for example, cross-module inlining
13405 happens), but most of benefits of whole program optimizations are lost.
13406
13407 During the incremental link (by @option{-r}) the linker plugin defaults to
13408 @option{rel}. With current interfaces to GNU Binutils it is however not
13409 possible to incrementally link LTO objects and non-LTO objects into a single
13410 mixed object file. If any of object files in incremental link cannot
13411 be used for link-time optimization, the linker plugin issues a warning and
13412 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13413 recommended to link such objects into static library instead. Alternatively it
13414 is possible to use H.J. Lu's binutils with support for mixed objects.
13415
13416 @item -fuse-ld=bfd
13417 @opindex fuse-ld=bfd
13418 Use the @command{bfd} linker instead of the default linker.
13419
13420 @item -fuse-ld=gold
13421 @opindex fuse-ld=gold
13422 Use the @command{gold} linker instead of the default linker.
13423
13424 @item -fuse-ld=lld
13425 @opindex fuse-ld=lld
13426 Use the LLVM @command{lld} linker instead of the default linker.
13427
13428 @cindex Libraries
13429 @item -l@var{library}
13430 @itemx -l @var{library}
13431 @opindex l
13432 Search the library named @var{library} when linking. (The second
13433 alternative with the library as a separate argument is only for
13434 POSIX compliance and is not recommended.)
13435
13436 The @option{-l} option is passed directly to the linker by GCC. Refer
13437 to your linker documentation for exact details. The general
13438 description below applies to the GNU linker.
13439
13440 The linker searches a standard list of directories for the library.
13441 The directories searched include several standard system directories
13442 plus any that you specify with @option{-L}.
13443
13444 Static libraries are archives of object files, and have file names
13445 like @file{lib@var{library}.a}. Some targets also support shared
13446 libraries, which typically have names like @file{lib@var{library}.so}.
13447 If both static and shared libraries are found, the linker gives
13448 preference to linking with the shared library unless the
13449 @option{-static} option is used.
13450
13451 It makes a difference where in the command you write this option; the
13452 linker searches and processes libraries and object files in the order they
13453 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13454 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13455 to functions in @samp{z}, those functions may not be loaded.
13456
13457 @item -lobjc
13458 @opindex lobjc
13459 You need this special case of the @option{-l} option in order to
13460 link an Objective-C or Objective-C++ program.
13461
13462 @item -nostartfiles
13463 @opindex nostartfiles
13464 Do not use the standard system startup files when linking.
13465 The standard system libraries are used normally, unless @option{-nostdlib},
13466 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13467
13468 @item -nodefaultlibs
13469 @opindex nodefaultlibs
13470 Do not use the standard system libraries when linking.
13471 Only the libraries you specify are passed to the linker, and options
13472 specifying linkage of the system libraries, such as @option{-static-libgcc}
13473 or @option{-shared-libgcc}, are ignored.
13474 The standard startup files are used normally, unless @option{-nostartfiles}
13475 is used.
13476
13477 The compiler may generate calls to @code{memcmp},
13478 @code{memset}, @code{memcpy} and @code{memmove}.
13479 These entries are usually resolved by entries in
13480 libc. These entry points should be supplied through some other
13481 mechanism when this option is specified.
13482
13483 @item -nolibc
13484 @opindex nolibc
13485 Do not use the C library or system libraries tightly coupled with it when
13486 linking. Still link with the startup files, @file{libgcc} or toolchain
13487 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13488 or @file{libstdc++} unless options preventing their inclusion are used as
13489 well. This typically removes @option{-lc} from the link command line, as well
13490 as system libraries that normally go with it and become meaningless when
13491 absence of a C library is assumed, for example @option{-lpthread} or
13492 @option{-lm} in some configurations. This is intended for bare-board
13493 targets when there is indeed no C library available.
13494
13495 @item -nostdlib
13496 @opindex nostdlib
13497 Do not use the standard system startup files or libraries when linking.
13498 No startup files and only the libraries you specify are passed to
13499 the linker, and options specifying linkage of the system libraries, such as
13500 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13501
13502 The compiler may generate calls to @code{memcmp}, @code{memset},
13503 @code{memcpy} and @code{memmove}.
13504 These entries are usually resolved by entries in
13505 libc. These entry points should be supplied through some other
13506 mechanism when this option is specified.
13507
13508 @cindex @option{-lgcc}, use with @option{-nostdlib}
13509 @cindex @option{-nostdlib} and unresolved references
13510 @cindex unresolved references and @option{-nostdlib}
13511 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13512 @cindex @option{-nodefaultlibs} and unresolved references
13513 @cindex unresolved references and @option{-nodefaultlibs}
13514 One of the standard libraries bypassed by @option{-nostdlib} and
13515 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13516 which GCC uses to overcome shortcomings of particular machines, or special
13517 needs for some languages.
13518 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13519 Collection (GCC) Internals},
13520 for more discussion of @file{libgcc.a}.)
13521 In most cases, you need @file{libgcc.a} even when you want to avoid
13522 other standard libraries. In other words, when you specify @option{-nostdlib}
13523 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13524 This ensures that you have no unresolved references to internal GCC
13525 library subroutines.
13526 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13527 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13528 GNU Compiler Collection (GCC) Internals}.)
13529
13530 @item -e @var{entry}
13531 @itemx --entry=@var{entry}
13532 @opindex e
13533 @opindex entry
13534
13535 Specify that the program entry point is @var{entry}. The argument is
13536 interpreted by the linker; the GNU linker accepts either a symbol name
13537 or an address.
13538
13539 @item -pie
13540 @opindex pie
13541 Produce a dynamically linked position independent executable on targets
13542 that support it. For predictable results, you must also specify the same
13543 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13544 or model suboptions) when you specify this linker option.
13545
13546 @item -no-pie
13547 @opindex no-pie
13548 Don't produce a dynamically linked position independent executable.
13549
13550 @item -static-pie
13551 @opindex static-pie
13552 Produce a static position independent executable on targets that support
13553 it. A static position independent executable is similar to a static
13554 executable, but can be loaded at any address without a dynamic linker.
13555 For predictable results, you must also specify the same set of options
13556 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13557 suboptions) when you specify this linker option.
13558
13559 @item -pthread
13560 @opindex pthread
13561 Link with the POSIX threads library. This option is supported on
13562 GNU/Linux targets, most other Unix derivatives, and also on
13563 x86 Cygwin and MinGW targets. On some targets this option also sets
13564 flags for the preprocessor, so it should be used consistently for both
13565 compilation and linking.
13566
13567 @item -r
13568 @opindex r
13569 Produce a relocatable object as output. This is also known as partial
13570 linking.
13571
13572 @item -rdynamic
13573 @opindex rdynamic
13574 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13575 that support it. This instructs the linker to add all symbols, not
13576 only used ones, to the dynamic symbol table. This option is needed
13577 for some uses of @code{dlopen} or to allow obtaining backtraces
13578 from within a program.
13579
13580 @item -s
13581 @opindex s
13582 Remove all symbol table and relocation information from the executable.
13583
13584 @item -static
13585 @opindex static
13586 On systems that support dynamic linking, this overrides @option{-pie}
13587 and prevents linking with the shared libraries. On other systems, this
13588 option has no effect.
13589
13590 @item -shared
13591 @opindex shared
13592 Produce a shared object which can then be linked with other objects to
13593 form an executable. Not all systems support this option. For predictable
13594 results, you must also specify the same set of options used for compilation
13595 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13596 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13597 needs to build supplementary stub code for constructors to work. On
13598 multi-libbed systems, @samp{gcc -shared} must select the correct support
13599 libraries to link against. Failing to supply the correct flags may lead
13600 to subtle defects. Supplying them in cases where they are not necessary
13601 is innocuous.}
13602
13603 @item -shared-libgcc
13604 @itemx -static-libgcc
13605 @opindex shared-libgcc
13606 @opindex static-libgcc
13607 On systems that provide @file{libgcc} as a shared library, these options
13608 force the use of either the shared or static version, respectively.
13609 If no shared version of @file{libgcc} was built when the compiler was
13610 configured, these options have no effect.
13611
13612 There are several situations in which an application should use the
13613 shared @file{libgcc} instead of the static version. The most common
13614 of these is when the application wishes to throw and catch exceptions
13615 across different shared libraries. In that case, each of the libraries
13616 as well as the application itself should use the shared @file{libgcc}.
13617
13618 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13619 whenever you build a shared library or a main executable, because C++
13620 programs typically use exceptions, so this is the right thing to do.
13621
13622 If, instead, you use the GCC driver to create shared libraries, you may
13623 find that they are not always linked with the shared @file{libgcc}.
13624 If GCC finds, at its configuration time, that you have a non-GNU linker
13625 or a GNU linker that does not support option @option{--eh-frame-hdr},
13626 it links the shared version of @file{libgcc} into shared libraries
13627 by default. Otherwise, it takes advantage of the linker and optimizes
13628 away the linking with the shared version of @file{libgcc}, linking with
13629 the static version of libgcc by default. This allows exceptions to
13630 propagate through such shared libraries, without incurring relocation
13631 costs at library load time.
13632
13633 However, if a library or main executable is supposed to throw or catch
13634 exceptions, you must link it using the G++ driver, or using the option
13635 @option{-shared-libgcc}, such that it is linked with the shared
13636 @file{libgcc}.
13637
13638 @item -static-libasan
13639 @opindex static-libasan
13640 When the @option{-fsanitize=address} option is used to link a program,
13641 the GCC driver automatically links against @option{libasan}. If
13642 @file{libasan} is available as a shared library, and the @option{-static}
13643 option is not used, then this links against the shared version of
13644 @file{libasan}. The @option{-static-libasan} option directs the GCC
13645 driver to link @file{libasan} statically, without necessarily linking
13646 other libraries statically.
13647
13648 @item -static-libtsan
13649 @opindex static-libtsan
13650 When the @option{-fsanitize=thread} option is used to link a program,
13651 the GCC driver automatically links against @option{libtsan}. If
13652 @file{libtsan} 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{libtsan}. The @option{-static-libtsan} option directs the GCC
13655 driver to link @file{libtsan} statically, without necessarily linking
13656 other libraries statically.
13657
13658 @item -static-liblsan
13659 @opindex static-liblsan
13660 When the @option{-fsanitize=leak} option is used to link a program,
13661 the GCC driver automatically links against @option{liblsan}. If
13662 @file{liblsan} 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{liblsan}. The @option{-static-liblsan} option directs the GCC
13665 driver to link @file{liblsan} statically, without necessarily linking
13666 other libraries statically.
13667
13668 @item -static-libubsan
13669 @opindex static-libubsan
13670 When the @option{-fsanitize=undefined} option is used to link a program,
13671 the GCC driver automatically links against @option{libubsan}. If
13672 @file{libubsan} 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{libubsan}. The @option{-static-libubsan} option directs the GCC
13675 driver to link @file{libubsan} statically, without necessarily linking
13676 other libraries statically.
13677
13678 @item -static-libstdc++
13679 @opindex static-libstdc++
13680 When the @command{g++} program is used to link a C++ program, it
13681 normally automatically links against @option{libstdc++}. If
13682 @file{libstdc++} is available as a shared library, and the
13683 @option{-static} option is not used, then this links against the
13684 shared version of @file{libstdc++}. That is normally fine. However, it
13685 is sometimes useful to freeze the version of @file{libstdc++} used by
13686 the program without going all the way to a fully static link. The
13687 @option{-static-libstdc++} option directs the @command{g++} driver to
13688 link @file{libstdc++} statically, without necessarily linking other
13689 libraries statically.
13690
13691 @item -symbolic
13692 @opindex symbolic
13693 Bind references to global symbols when building a shared object. Warn
13694 about any unresolved references (unless overridden by the link editor
13695 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13696 this option.
13697
13698 @item -T @var{script}
13699 @opindex T
13700 @cindex linker script
13701 Use @var{script} as the linker script. This option is supported by most
13702 systems using the GNU linker. On some targets, such as bare-board
13703 targets without an operating system, the @option{-T} option may be required
13704 when linking to avoid references to undefined symbols.
13705
13706 @item -Xlinker @var{option}
13707 @opindex Xlinker
13708 Pass @var{option} as an option to the linker. You can use this to
13709 supply system-specific linker options that GCC does not recognize.
13710
13711 If you want to pass an option that takes a separate argument, you must use
13712 @option{-Xlinker} twice, once for the option and once for the argument.
13713 For example, to pass @option{-assert definitions}, you must write
13714 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13715 @option{-Xlinker "-assert definitions"}, because this passes the entire
13716 string as a single argument, which is not what the linker expects.
13717
13718 When using the GNU linker, it is usually more convenient to pass
13719 arguments to linker options using the @option{@var{option}=@var{value}}
13720 syntax than as separate arguments. For example, you can specify
13721 @option{-Xlinker -Map=output.map} rather than
13722 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13723 this syntax for command-line options.
13724
13725 @item -Wl,@var{option}
13726 @opindex Wl
13727 Pass @var{option} as an option to the linker. If @var{option} contains
13728 commas, it is split into multiple options at the commas. You can use this
13729 syntax to pass an argument to the option.
13730 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13731 linker. When using the GNU linker, you can also get the same effect with
13732 @option{-Wl,-Map=output.map}.
13733
13734 @item -u @var{symbol}
13735 @opindex u
13736 Pretend the symbol @var{symbol} is undefined, to force linking of
13737 library modules to define it. You can use @option{-u} multiple times with
13738 different symbols to force loading of additional library modules.
13739
13740 @item -z @var{keyword}
13741 @opindex z
13742 @option{-z} is passed directly on to the linker along with the keyword
13743 @var{keyword}. See the section in the documentation of your linker for
13744 permitted values and their meanings.
13745 @end table
13746
13747 @node Directory Options
13748 @section Options for Directory Search
13749 @cindex directory options
13750 @cindex options, directory search
13751 @cindex search path
13752
13753 These options specify directories to search for header files, for
13754 libraries and for parts of the compiler:
13755
13756 @table @gcctabopt
13757 @include cppdiropts.texi
13758
13759 @item -iplugindir=@var{dir}
13760 @opindex iplugindir=
13761 Set the directory to search for plugins that are passed
13762 by @option{-fplugin=@var{name}} instead of
13763 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13764 to be used by the user, but only passed by the driver.
13765
13766 @item -L@var{dir}
13767 @opindex L
13768 Add directory @var{dir} to the list of directories to be searched
13769 for @option{-l}.
13770
13771 @item -B@var{prefix}
13772 @opindex B
13773 This option specifies where to find the executables, libraries,
13774 include files, and data files of the compiler itself.
13775
13776 The compiler driver program runs one or more of the subprograms
13777 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13778 @var{prefix} as a prefix for each program it tries to run, both with and
13779 without @samp{@var{machine}/@var{version}/} for the corresponding target
13780 machine and compiler version.
13781
13782 For each subprogram to be run, the compiler driver first tries the
13783 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13784 is not specified, the driver tries two standard prefixes,
13785 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13786 those results in a file name that is found, the unmodified program
13787 name is searched for using the directories specified in your
13788 @env{PATH} environment variable.
13789
13790 The compiler checks to see if the path provided by @option{-B}
13791 refers to a directory, and if necessary it adds a directory
13792 separator character at the end of the path.
13793
13794 @option{-B} prefixes that effectively specify directory names also apply
13795 to libraries in the linker, because the compiler translates these
13796 options into @option{-L} options for the linker. They also apply to
13797 include files in the preprocessor, because the compiler translates these
13798 options into @option{-isystem} options for the preprocessor. In this case,
13799 the compiler appends @samp{include} to the prefix.
13800
13801 The runtime support file @file{libgcc.a} can also be searched for using
13802 the @option{-B} prefix, if needed. If it is not found there, the two
13803 standard prefixes above are tried, and that is all. The file is left
13804 out of the link if it is not found by those means.
13805
13806 Another way to specify a prefix much like the @option{-B} prefix is to use
13807 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13808 Variables}.
13809
13810 As a special kludge, if the path provided by @option{-B} is
13811 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13812 9, then it is replaced by @file{[dir/]include}. This is to help
13813 with boot-strapping the compiler.
13814
13815 @item -no-canonical-prefixes
13816 @opindex no-canonical-prefixes
13817 Do not expand any symbolic links, resolve references to @samp{/../}
13818 or @samp{/./}, or make the path absolute when generating a relative
13819 prefix.
13820
13821 @item --sysroot=@var{dir}
13822 @opindex sysroot
13823 Use @var{dir} as the logical root directory for headers and libraries.
13824 For example, if the compiler normally searches for headers in
13825 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13826 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13827
13828 If you use both this option and the @option{-isysroot} option, then
13829 the @option{--sysroot} option applies to libraries, but the
13830 @option{-isysroot} option applies to header files.
13831
13832 The GNU linker (beginning with version 2.16) has the necessary support
13833 for this option. If your linker does not support this option, the
13834 header file aspect of @option{--sysroot} still works, but the
13835 library aspect does not.
13836
13837 @item --no-sysroot-suffix
13838 @opindex no-sysroot-suffix
13839 For some targets, a suffix is added to the root directory specified
13840 with @option{--sysroot}, depending on the other options used, so that
13841 headers may for example be found in
13842 @file{@var{dir}/@var{suffix}/usr/include} instead of
13843 @file{@var{dir}/usr/include}. This option disables the addition of
13844 such a suffix.
13845
13846 @end table
13847
13848 @node Code Gen Options
13849 @section Options for Code Generation Conventions
13850 @cindex code generation conventions
13851 @cindex options, code generation
13852 @cindex run-time options
13853
13854 These machine-independent options control the interface conventions
13855 used in code generation.
13856
13857 Most of them have both positive and negative forms; the negative form
13858 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13859 one of the forms is listed---the one that is not the default. You
13860 can figure out the other form by either removing @samp{no-} or adding
13861 it.
13862
13863 @table @gcctabopt
13864 @item -fstack-reuse=@var{reuse-level}
13865 @opindex fstack_reuse
13866 This option controls stack space reuse for user declared local/auto variables
13867 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13868 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13869 local variables and temporaries, @samp{named_vars} enables the reuse only for
13870 user defined local variables with names, and @samp{none} disables stack reuse
13871 completely. The default value is @samp{all}. The option is needed when the
13872 program extends the lifetime of a scoped local variable or a compiler generated
13873 temporary beyond the end point defined by the language. When a lifetime of
13874 a variable ends, and if the variable lives in memory, the optimizing compiler
13875 has the freedom to reuse its stack space with other temporaries or scoped
13876 local variables whose live range does not overlap with it. Legacy code extending
13877 local lifetime is likely to break with the stack reuse optimization.
13878
13879 For example,
13880
13881 @smallexample
13882 int *p;
13883 @{
13884 int local1;
13885
13886 p = &local1;
13887 local1 = 10;
13888 ....
13889 @}
13890 @{
13891 int local2;
13892 local2 = 20;
13893 ...
13894 @}
13895
13896 if (*p == 10) // out of scope use of local1
13897 @{
13898
13899 @}
13900 @end smallexample
13901
13902 Another example:
13903 @smallexample
13904
13905 struct A
13906 @{
13907 A(int k) : i(k), j(k) @{ @}
13908 int i;
13909 int j;
13910 @};
13911
13912 A *ap;
13913
13914 void foo(const A& ar)
13915 @{
13916 ap = &ar;
13917 @}
13918
13919 void bar()
13920 @{
13921 foo(A(10)); // temp object's lifetime ends when foo returns
13922
13923 @{
13924 A a(20);
13925 ....
13926 @}
13927 ap->i+= 10; // ap references out of scope temp whose space
13928 // is reused with a. What is the value of ap->i?
13929 @}
13930
13931 @end smallexample
13932
13933 The lifetime of a compiler generated temporary is well defined by the C++
13934 standard. When a lifetime of a temporary ends, and if the temporary lives
13935 in memory, the optimizing compiler has the freedom to reuse its stack
13936 space with other temporaries or scoped local variables whose live range
13937 does not overlap with it. However some of the legacy code relies on
13938 the behavior of older compilers in which temporaries' stack space is
13939 not reused, the aggressive stack reuse can lead to runtime errors. This
13940 option is used to control the temporary stack reuse optimization.
13941
13942 @item -ftrapv
13943 @opindex ftrapv
13944 This option generates traps for signed overflow on addition, subtraction,
13945 multiplication operations.
13946 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13947 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13948 @option{-fwrapv} being effective. Note that only active options override, so
13949 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13950 results in @option{-ftrapv} being effective.
13951
13952 @item -fwrapv
13953 @opindex fwrapv
13954 This option instructs the compiler to assume that signed arithmetic
13955 overflow of addition, subtraction and multiplication wraps around
13956 using twos-complement representation. This flag enables some optimizations
13957 and disables others.
13958 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13959 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13960 @option{-fwrapv} being effective. Note that only active options override, so
13961 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13962 results in @option{-ftrapv} being effective.
13963
13964 @item -fwrapv-pointer
13965 @opindex fwrapv-pointer
13966 This option instructs the compiler to assume that pointer arithmetic
13967 overflow on addition and subtraction wraps around using twos-complement
13968 representation. This flag disables some optimizations which assume
13969 pointer overflow is invalid.
13970
13971 @item -fstrict-overflow
13972 @opindex fstrict-overflow
13973 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13974 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13975
13976 @item -fexceptions
13977 @opindex fexceptions
13978 Enable exception handling. Generates extra code needed to propagate
13979 exceptions. For some targets, this implies GCC generates frame
13980 unwind information for all functions, which can produce significant data
13981 size overhead, although it does not affect execution. If you do not
13982 specify this option, GCC enables it by default for languages like
13983 C++ that normally require exception handling, and disables it for
13984 languages like C that do not normally require it. However, you may need
13985 to enable this option when compiling C code that needs to interoperate
13986 properly with exception handlers written in C++. You may also wish to
13987 disable this option if you are compiling older C++ programs that don't
13988 use exception handling.
13989
13990 @item -fnon-call-exceptions
13991 @opindex fnon-call-exceptions
13992 Generate code that allows trapping instructions to throw exceptions.
13993 Note that this requires platform-specific runtime support that does
13994 not exist everywhere. Moreover, it only allows @emph{trapping}
13995 instructions to throw exceptions, i.e.@: memory references or floating-point
13996 instructions. It does not allow exceptions to be thrown from
13997 arbitrary signal handlers such as @code{SIGALRM}.
13998
13999 @item -fdelete-dead-exceptions
14000 @opindex fdelete-dead-exceptions
14001 Consider that instructions that may throw exceptions but don't otherwise
14002 contribute to the execution of the program can be optimized away.
14003 This option is enabled by default for the Ada front end, as permitted by
14004 the Ada language specification.
14005 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14006
14007 @item -funwind-tables
14008 @opindex funwind-tables
14009 Similar to @option{-fexceptions}, except that it just generates any needed
14010 static data, but does not affect the generated code in any other way.
14011 You normally do not need to enable this option; instead, a language processor
14012 that needs this handling enables it on your behalf.
14013
14014 @item -fasynchronous-unwind-tables
14015 @opindex fasynchronous-unwind-tables
14016 Generate unwind table in DWARF format, if supported by target machine. The
14017 table is exact at each instruction boundary, so it can be used for stack
14018 unwinding from asynchronous events (such as debugger or garbage collector).
14019
14020 @item -fno-gnu-unique
14021 @opindex fno-gnu-unique
14022 @opindex fgnu-unique
14023 On systems with recent GNU assembler and C library, the C++ compiler
14024 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14025 of template static data members and static local variables in inline
14026 functions are unique even in the presence of @code{RTLD_LOCAL}; this
14027 is necessary to avoid problems with a library used by two different
14028 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
14029 therefore disagreeing with the other one about the binding of the
14030 symbol. But this causes @code{dlclose} to be ignored for affected
14031 DSOs; if your program relies on reinitialization of a DSO via
14032 @code{dlclose} and @code{dlopen}, you can use
14033 @option{-fno-gnu-unique}.
14034
14035 @item -fpcc-struct-return
14036 @opindex fpcc-struct-return
14037 Return ``short'' @code{struct} and @code{union} values in memory like
14038 longer ones, rather than in registers. This convention is less
14039 efficient, but it has the advantage of allowing intercallability between
14040 GCC-compiled files and files compiled with other compilers, particularly
14041 the Portable C Compiler (pcc).
14042
14043 The precise convention for returning structures in memory depends
14044 on the target configuration macros.
14045
14046 Short structures and unions are those whose size and alignment match
14047 that of some integer type.
14048
14049 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14050 switch is not binary compatible with code compiled with the
14051 @option{-freg-struct-return} switch.
14052 Use it to conform to a non-default application binary interface.
14053
14054 @item -freg-struct-return
14055 @opindex freg-struct-return
14056 Return @code{struct} and @code{union} values in registers when possible.
14057 This is more efficient for small structures than
14058 @option{-fpcc-struct-return}.
14059
14060 If you specify neither @option{-fpcc-struct-return} nor
14061 @option{-freg-struct-return}, GCC defaults to whichever convention is
14062 standard for the target. If there is no standard convention, GCC
14063 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14064 the principal compiler. In those cases, we can choose the standard, and
14065 we chose the more efficient register return alternative.
14066
14067 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14068 switch is not binary compatible with code compiled with the
14069 @option{-fpcc-struct-return} switch.
14070 Use it to conform to a non-default application binary interface.
14071
14072 @item -fshort-enums
14073 @opindex fshort-enums
14074 Allocate to an @code{enum} type only as many bytes as it needs for the
14075 declared range of possible values. Specifically, the @code{enum} type
14076 is equivalent to the smallest integer type that has enough room.
14077
14078 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14079 code that is not binary compatible with code generated without that switch.
14080 Use it to conform to a non-default application binary interface.
14081
14082 @item -fshort-wchar
14083 @opindex fshort-wchar
14084 Override the underlying type for @code{wchar_t} to be @code{short
14085 unsigned int} instead of the default for the target. This option is
14086 useful for building programs to run under WINE@.
14087
14088 @strong{Warning:} the @option{-fshort-wchar} 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 -fno-common
14093 @opindex fno-common
14094 @opindex fcommon
14095 @cindex tentative definitions
14096 In C code, this option controls the placement of global variables
14097 defined without an initializer, known as @dfn{tentative definitions}
14098 in the C standard. Tentative definitions are distinct from declarations
14099 of a variable with the @code{extern} keyword, which do not allocate storage.
14100
14101 Unix C compilers have traditionally allocated storage for
14102 uninitialized global variables in a common block. This allows the
14103 linker to resolve all tentative definitions of the same variable
14104 in different compilation units to the same object, or to a non-tentative
14105 definition.
14106 This is the behavior specified by @option{-fcommon}, and is the default for
14107 GCC on most targets.
14108 On the other hand, this behavior is not required by ISO
14109 C, and on some targets may carry a speed or code size penalty on
14110 variable references.
14111
14112 The @option{-fno-common} option specifies that the compiler should instead
14113 place uninitialized global variables in the BSS section of the object file.
14114 This inhibits the merging of tentative definitions by the linker so
14115 you get a multiple-definition error if the same
14116 variable is defined in more than one compilation unit.
14117 Compiling with @option{-fno-common} is useful on targets for which
14118 it provides better performance, or if you wish to verify that the
14119 program will work on other systems that always treat uninitialized
14120 variable definitions this way.
14121
14122 @item -fno-ident
14123 @opindex fno-ident
14124 @opindex fident
14125 Ignore the @code{#ident} directive.
14126
14127 @item -finhibit-size-directive
14128 @opindex finhibit-size-directive
14129 Don't output a @code{.size} assembler directive, or anything else that
14130 would cause trouble if the function is split in the middle, and the
14131 two halves are placed at locations far apart in memory. This option is
14132 used when compiling @file{crtstuff.c}; you should not need to use it
14133 for anything else.
14134
14135 @item -fverbose-asm
14136 @opindex fverbose-asm
14137 Put extra commentary information in the generated assembly code to
14138 make it more readable. This option is generally only of use to those
14139 who actually need to read the generated assembly code (perhaps while
14140 debugging the compiler itself).
14141
14142 @option{-fno-verbose-asm}, the default, causes the
14143 extra information to be omitted and is useful when comparing two assembler
14144 files.
14145
14146 The added comments include:
14147
14148 @itemize @bullet
14149
14150 @item
14151 information on the compiler version and command-line options,
14152
14153 @item
14154 the source code lines associated with the assembly instructions,
14155 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14156
14157 @item
14158 hints on which high-level expressions correspond to
14159 the various assembly instruction operands.
14160
14161 @end itemize
14162
14163 For example, given this C source file:
14164
14165 @smallexample
14166 int test (int n)
14167 @{
14168 int i;
14169 int total = 0;
14170
14171 for (i = 0; i < n; i++)
14172 total += i * i;
14173
14174 return total;
14175 @}
14176 @end smallexample
14177
14178 compiling to (x86_64) assembly via @option{-S} and emitting the result
14179 direct to stdout via @option{-o} @option{-}
14180
14181 @smallexample
14182 gcc -S test.c -fverbose-asm -Os -o -
14183 @end smallexample
14184
14185 gives output similar to this:
14186
14187 @smallexample
14188 .file "test.c"
14189 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14190 [...snip...]
14191 # options passed:
14192 [...snip...]
14193
14194 .text
14195 .globl test
14196 .type test, @@function
14197 test:
14198 .LFB0:
14199 .cfi_startproc
14200 # test.c:4: int total = 0;
14201 xorl %eax, %eax # <retval>
14202 # test.c:6: for (i = 0; i < n; i++)
14203 xorl %edx, %edx # i
14204 .L2:
14205 # test.c:6: for (i = 0; i < n; i++)
14206 cmpl %edi, %edx # n, i
14207 jge .L5 #,
14208 # test.c:7: total += i * i;
14209 movl %edx, %ecx # i, tmp92
14210 imull %edx, %ecx # i, tmp92
14211 # test.c:6: for (i = 0; i < n; i++)
14212 incl %edx # i
14213 # test.c:7: total += i * i;
14214 addl %ecx, %eax # tmp92, <retval>
14215 jmp .L2 #
14216 .L5:
14217 # test.c:10: @}
14218 ret
14219 .cfi_endproc
14220 .LFE0:
14221 .size test, .-test
14222 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14223 .section .note.GNU-stack,"",@@progbits
14224 @end smallexample
14225
14226 The comments are intended for humans rather than machines and hence the
14227 precise format of the comments is subject to change.
14228
14229 @item -frecord-gcc-switches
14230 @opindex frecord-gcc-switches
14231 This switch causes the command line used to invoke the
14232 compiler to be recorded into the object file that is being created.
14233 This switch is only implemented on some targets and the exact format
14234 of the recording is target and binary file format dependent, but it
14235 usually takes the form of a section containing ASCII text. This
14236 switch is related to the @option{-fverbose-asm} switch, but that
14237 switch only records information in the assembler output file as
14238 comments, so it never reaches the object file.
14239 See also @option{-grecord-gcc-switches} for another
14240 way of storing compiler options into the object file.
14241
14242 @item -fpic
14243 @opindex fpic
14244 @cindex global offset table
14245 @cindex PIC
14246 Generate position-independent code (PIC) suitable for use in a shared
14247 library, if supported for the target machine. Such code accesses all
14248 constant addresses through a global offset table (GOT)@. The dynamic
14249 loader resolves the GOT entries when the program starts (the dynamic
14250 loader is not part of GCC; it is part of the operating system). If
14251 the GOT size for the linked executable exceeds a machine-specific
14252 maximum size, you get an error message from the linker indicating that
14253 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14254 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14255 on the m68k and RS/6000. The x86 has no such limit.)
14256
14257 Position-independent code requires special support, and therefore works
14258 only on certain machines. For the x86, GCC supports PIC for System V
14259 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14260 position-independent.
14261
14262 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14263 are defined to 1.
14264
14265 @item -fPIC
14266 @opindex fPIC
14267 If supported for the target machine, emit position-independent code,
14268 suitable for dynamic linking and avoiding any limit on the size of the
14269 global offset table. This option makes a difference on AArch64, m68k,
14270 PowerPC and SPARC@.
14271
14272 Position-independent code requires special support, and therefore works
14273 only on certain machines.
14274
14275 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14276 are defined to 2.
14277
14278 @item -fpie
14279 @itemx -fPIE
14280 @opindex fpie
14281 @opindex fPIE
14282 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14283 generated position-independent code can be only linked into executables.
14284 Usually these options are used to compile code that will be linked using
14285 the @option{-pie} GCC option.
14286
14287 @option{-fpie} and @option{-fPIE} both define the macros
14288 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14289 for @option{-fpie} and 2 for @option{-fPIE}.
14290
14291 @item -fno-plt
14292 @opindex fno-plt
14293 @opindex fplt
14294 Do not use the PLT for external function calls in position-independent code.
14295 Instead, load the callee address at call sites from the GOT and branch to it.
14296 This leads to more efficient code by eliminating PLT stubs and exposing
14297 GOT loads to optimizations. On architectures such as 32-bit x86 where
14298 PLT stubs expect the GOT pointer in a specific register, this gives more
14299 register allocation freedom to the compiler.
14300 Lazy binding requires use of the PLT;
14301 with @option{-fno-plt} all external symbols are resolved at load time.
14302
14303 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14304 through the PLT for specific external functions.
14305
14306 In position-dependent code, a few targets also convert calls to
14307 functions that are marked to not use the PLT to use the GOT instead.
14308
14309 @item -fno-jump-tables
14310 @opindex fno-jump-tables
14311 @opindex fjump-tables
14312 Do not use jump tables for switch statements even where it would be
14313 more efficient than other code generation strategies. This option is
14314 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14315 building code that forms part of a dynamic linker and cannot
14316 reference the address of a jump table. On some targets, jump tables
14317 do not require a GOT and this option is not needed.
14318
14319 @item -ffixed-@var{reg}
14320 @opindex ffixed
14321 Treat the register named @var{reg} as a fixed register; generated code
14322 should never refer to it (except perhaps as a stack pointer, frame
14323 pointer or in some other fixed role).
14324
14325 @var{reg} must be the name of a register. The register names accepted
14326 are machine-specific and are defined in the @code{REGISTER_NAMES}
14327 macro in the machine description macro file.
14328
14329 This flag does not have a negative form, because it specifies a
14330 three-way choice.
14331
14332 @item -fcall-used-@var{reg}
14333 @opindex fcall-used
14334 Treat the register named @var{reg} as an allocable register that is
14335 clobbered by function calls. It may be allocated for temporaries or
14336 variables that do not live across a call. Functions compiled this way
14337 do not save and restore the register @var{reg}.
14338
14339 It is an error to use this flag with the frame pointer or stack pointer.
14340 Use of this flag for other registers that have fixed pervasive roles in
14341 the machine's execution model produces disastrous results.
14342
14343 This flag does not have a negative form, because it specifies a
14344 three-way choice.
14345
14346 @item -fcall-saved-@var{reg}
14347 @opindex fcall-saved
14348 Treat the register named @var{reg} as an allocable register saved by
14349 functions. It may be allocated even for temporaries or variables that
14350 live across a call. Functions compiled this way save and restore
14351 the register @var{reg} if they use it.
14352
14353 It is an error to use this flag with the frame pointer or stack pointer.
14354 Use of this flag for other registers that have fixed pervasive roles in
14355 the machine's execution model produces disastrous results.
14356
14357 A different sort of disaster results from the use of this flag for
14358 a register in which function values may be returned.
14359
14360 This flag does not have a negative form, because it specifies a
14361 three-way choice.
14362
14363 @item -fpack-struct[=@var{n}]
14364 @opindex fpack-struct
14365 Without a value specified, pack all structure members together without
14366 holes. When a value is specified (which must be a small power of two), pack
14367 structure members according to this value, representing the maximum
14368 alignment (that is, objects with default alignment requirements larger than
14369 this are output potentially unaligned at the next fitting location.
14370
14371 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14372 code that is not binary compatible with code generated without that switch.
14373 Additionally, it makes the code suboptimal.
14374 Use it to conform to a non-default application binary interface.
14375
14376 @item -fleading-underscore
14377 @opindex fleading-underscore
14378 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14379 change the way C symbols are represented in the object file. One use
14380 is to help link with legacy assembly code.
14381
14382 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14383 generate code that is not binary compatible with code generated without that
14384 switch. Use it to conform to a non-default application binary interface.
14385 Not all targets provide complete support for this switch.
14386
14387 @item -ftls-model=@var{model}
14388 @opindex ftls-model
14389 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14390 The @var{model} argument should be one of @samp{global-dynamic},
14391 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14392 Note that the choice is subject to optimization: the compiler may use
14393 a more efficient model for symbols not visible outside of the translation
14394 unit, or if @option{-fpic} is not given on the command line.
14395
14396 The default without @option{-fpic} is @samp{initial-exec}; with
14397 @option{-fpic} the default is @samp{global-dynamic}.
14398
14399 @item -ftrampolines
14400 @opindex ftrampolines
14401 For targets that normally need trampolines for nested functions, always
14402 generate them instead of using descriptors. Otherwise, for targets that
14403 do not need them, like for example HP-PA or IA-64, do nothing.
14404
14405 A trampoline is a small piece of code that is created at run time on the
14406 stack when the address of a nested function is taken, and is used to call
14407 the nested function indirectly. Therefore, it requires the stack to be
14408 made executable in order for the program to work properly.
14409
14410 @option{-fno-trampolines} is enabled by default on a language by language
14411 basis to let the compiler avoid generating them, if it computes that this
14412 is safe, and replace them with descriptors. Descriptors are made up of data
14413 only, but the generated code must be prepared to deal with them. As of this
14414 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14415
14416 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14417 @option{-fno-trampolines} are not binary compatible if nested functions are
14418 present. This option must therefore be used on a program-wide basis and be
14419 manipulated with extreme care.
14420
14421 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14422 @opindex fvisibility
14423 Set the default ELF image symbol visibility to the specified option---all
14424 symbols are marked with this unless overridden within the code.
14425 Using this feature can very substantially improve linking and
14426 load times of shared object libraries, produce more optimized
14427 code, provide near-perfect API export and prevent symbol clashes.
14428 It is @strong{strongly} recommended that you use this in any shared objects
14429 you distribute.
14430
14431 Despite the nomenclature, @samp{default} always means public; i.e.,
14432 available to be linked against from outside the shared object.
14433 @samp{protected} and @samp{internal} are pretty useless in real-world
14434 usage so the only other commonly used option is @samp{hidden}.
14435 The default if @option{-fvisibility} isn't specified is
14436 @samp{default}, i.e., make every symbol public.
14437
14438 A good explanation of the benefits offered by ensuring ELF
14439 symbols have the correct visibility is given by ``How To Write
14440 Shared Libraries'' by Ulrich Drepper (which can be found at
14441 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14442 solution made possible by this option to marking things hidden when
14443 the default is public is to make the default hidden and mark things
14444 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14445 and @code{__attribute__ ((visibility("default")))} instead of
14446 @code{__declspec(dllexport)} you get almost identical semantics with
14447 identical syntax. This is a great boon to those working with
14448 cross-platform projects.
14449
14450 For those adding visibility support to existing code, you may find
14451 @code{#pragma GCC visibility} of use. This works by you enclosing
14452 the declarations you wish to set visibility for with (for example)
14453 @code{#pragma GCC visibility push(hidden)} and
14454 @code{#pragma GCC visibility pop}.
14455 Bear in mind that symbol visibility should be viewed @strong{as
14456 part of the API interface contract} and thus all new code should
14457 always specify visibility when it is not the default; i.e., declarations
14458 only for use within the local DSO should @strong{always} be marked explicitly
14459 as hidden as so to avoid PLT indirection overheads---making this
14460 abundantly clear also aids readability and self-documentation of the code.
14461 Note that due to ISO C++ specification requirements, @code{operator new} and
14462 @code{operator delete} must always be of default visibility.
14463
14464 Be aware that headers from outside your project, in particular system
14465 headers and headers from any other library you use, may not be
14466 expecting to be compiled with visibility other than the default. You
14467 may need to explicitly say @code{#pragma GCC visibility push(default)}
14468 before including any such headers.
14469
14470 @code{extern} declarations are not affected by @option{-fvisibility}, so
14471 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14472 no modifications. However, this means that calls to @code{extern}
14473 functions with no explicit visibility use the PLT, so it is more
14474 effective to use @code{__attribute ((visibility))} and/or
14475 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14476 declarations should be treated as hidden.
14477
14478 Note that @option{-fvisibility} does affect C++ vague linkage
14479 entities. This means that, for instance, an exception class that is
14480 be thrown between DSOs must be explicitly marked with default
14481 visibility so that the @samp{type_info} nodes are unified between
14482 the DSOs.
14483
14484 An overview of these techniques, their benefits and how to use them
14485 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14486
14487 @item -fstrict-volatile-bitfields
14488 @opindex fstrict-volatile-bitfields
14489 This option should be used if accesses to volatile bit-fields (or other
14490 structure fields, although the compiler usually honors those types
14491 anyway) should use a single access of the width of the
14492 field's type, aligned to a natural alignment if possible. For
14493 example, targets with memory-mapped peripheral registers might require
14494 all such accesses to be 16 bits wide; with this flag you can
14495 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14496 is 16 bits on these targets) to force GCC to use 16-bit accesses
14497 instead of, perhaps, a more efficient 32-bit access.
14498
14499 If this option is disabled, the compiler uses the most efficient
14500 instruction. In the previous example, that might be a 32-bit load
14501 instruction, even though that accesses bytes that do not contain
14502 any portion of the bit-field, or memory-mapped registers unrelated to
14503 the one being updated.
14504
14505 In some cases, such as when the @code{packed} attribute is applied to a
14506 structure field, it may not be possible to access the field with a single
14507 read or write that is correctly aligned for the target machine. In this
14508 case GCC falls back to generating multiple accesses rather than code that
14509 will fault or truncate the result at run time.
14510
14511 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14512 not allowed to touch non bit-field members. It is therefore recommended
14513 to define all bits of the field's type as bit-field members.
14514
14515 The default value of this option is determined by the application binary
14516 interface for the target processor.
14517
14518 @item -fsync-libcalls
14519 @opindex fsync-libcalls
14520 This option controls whether any out-of-line instance of the @code{__sync}
14521 family of functions may be used to implement the C++11 @code{__atomic}
14522 family of functions.
14523
14524 The default value of this option is enabled, thus the only useful form
14525 of the option is @option{-fno-sync-libcalls}. This option is used in
14526 the implementation of the @file{libatomic} runtime library.
14527
14528 @end table
14529
14530 @node Developer Options
14531 @section GCC Developer Options
14532 @cindex developer options
14533 @cindex debugging GCC
14534 @cindex debug dump options
14535 @cindex dump options
14536 @cindex compilation statistics
14537
14538 This section describes command-line options that are primarily of
14539 interest to GCC developers, including options to support compiler
14540 testing and investigation of compiler bugs and compile-time
14541 performance problems. This includes options that produce debug dumps
14542 at various points in the compilation; that print statistics such as
14543 memory use and execution time; and that print information about GCC's
14544 configuration, such as where it searches for libraries. You should
14545 rarely need to use any of these options for ordinary compilation and
14546 linking tasks.
14547
14548 Many developer options that cause GCC to dump output to a file take an
14549 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14550 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14551 error.
14552
14553 If @samp{=@var{filename}} is omitted, a default dump file name is
14554 constructed by concatenating the base dump file name, a pass number,
14555 phase letter, and pass name. The base dump file name is the name of
14556 output file produced by the compiler if explicitly specified and not
14557 an executable; otherwise it is the source file name.
14558 The pass number is determined by the order passes are registered with
14559 the compiler's pass manager.
14560 This is generally the same as the order of execution, but passes
14561 registered by plugins, target-specific passes, or passes that are
14562 otherwise registered late are numbered higher than the pass named
14563 @samp{final}, even if they are executed earlier. The phase letter is
14564 one of @samp{i} (inter-procedural analysis), @samp{l}
14565 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14566 The files are created in the directory of the output file.
14567
14568 @table @gcctabopt
14569
14570 @item -d@var{letters}
14571 @itemx -fdump-rtl-@var{pass}
14572 @itemx -fdump-rtl-@var{pass}=@var{filename}
14573 @opindex d
14574 @opindex fdump-rtl-@var{pass}
14575 Says to make debugging dumps during compilation at times specified by
14576 @var{letters}. This is used for debugging the RTL-based passes of the
14577 compiler.
14578
14579 Some @option{-d@var{letters}} switches have different meaning when
14580 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14581 for information about preprocessor-specific dump options.
14582
14583 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14584 @option{-d} option @var{letters}. Here are the possible
14585 letters for use in @var{pass} and @var{letters}, and their meanings:
14586
14587 @table @gcctabopt
14588
14589 @item -fdump-rtl-alignments
14590 @opindex fdump-rtl-alignments
14591 Dump after branch alignments have been computed.
14592
14593 @item -fdump-rtl-asmcons
14594 @opindex fdump-rtl-asmcons
14595 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14596
14597 @item -fdump-rtl-auto_inc_dec
14598 @opindex fdump-rtl-auto_inc_dec
14599 Dump after auto-inc-dec discovery. This pass is only run on
14600 architectures that have auto inc or auto dec instructions.
14601
14602 @item -fdump-rtl-barriers
14603 @opindex fdump-rtl-barriers
14604 Dump after cleaning up the barrier instructions.
14605
14606 @item -fdump-rtl-bbpart
14607 @opindex fdump-rtl-bbpart
14608 Dump after partitioning hot and cold basic blocks.
14609
14610 @item -fdump-rtl-bbro
14611 @opindex fdump-rtl-bbro
14612 Dump after block reordering.
14613
14614 @item -fdump-rtl-btl1
14615 @itemx -fdump-rtl-btl2
14616 @opindex fdump-rtl-btl2
14617 @opindex fdump-rtl-btl2
14618 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14619 after the two branch
14620 target load optimization passes.
14621
14622 @item -fdump-rtl-bypass
14623 @opindex fdump-rtl-bypass
14624 Dump after jump bypassing and control flow optimizations.
14625
14626 @item -fdump-rtl-combine
14627 @opindex fdump-rtl-combine
14628 Dump after the RTL instruction combination pass.
14629
14630 @item -fdump-rtl-compgotos
14631 @opindex fdump-rtl-compgotos
14632 Dump after duplicating the computed gotos.
14633
14634 @item -fdump-rtl-ce1
14635 @itemx -fdump-rtl-ce2
14636 @itemx -fdump-rtl-ce3
14637 @opindex fdump-rtl-ce1
14638 @opindex fdump-rtl-ce2
14639 @opindex fdump-rtl-ce3
14640 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14641 @option{-fdump-rtl-ce3} enable dumping after the three
14642 if conversion passes.
14643
14644 @item -fdump-rtl-cprop_hardreg
14645 @opindex fdump-rtl-cprop_hardreg
14646 Dump after hard register copy propagation.
14647
14648 @item -fdump-rtl-csa
14649 @opindex fdump-rtl-csa
14650 Dump after combining stack adjustments.
14651
14652 @item -fdump-rtl-cse1
14653 @itemx -fdump-rtl-cse2
14654 @opindex fdump-rtl-cse1
14655 @opindex fdump-rtl-cse2
14656 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14657 the two common subexpression elimination passes.
14658
14659 @item -fdump-rtl-dce
14660 @opindex fdump-rtl-dce
14661 Dump after the standalone dead code elimination passes.
14662
14663 @item -fdump-rtl-dbr
14664 @opindex fdump-rtl-dbr
14665 Dump after delayed branch scheduling.
14666
14667 @item -fdump-rtl-dce1
14668 @itemx -fdump-rtl-dce2
14669 @opindex fdump-rtl-dce1
14670 @opindex fdump-rtl-dce2
14671 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14672 the two dead store elimination passes.
14673
14674 @item -fdump-rtl-eh
14675 @opindex fdump-rtl-eh
14676 Dump after finalization of EH handling code.
14677
14678 @item -fdump-rtl-eh_ranges
14679 @opindex fdump-rtl-eh_ranges
14680 Dump after conversion of EH handling range regions.
14681
14682 @item -fdump-rtl-expand
14683 @opindex fdump-rtl-expand
14684 Dump after RTL generation.
14685
14686 @item -fdump-rtl-fwprop1
14687 @itemx -fdump-rtl-fwprop2
14688 @opindex fdump-rtl-fwprop1
14689 @opindex fdump-rtl-fwprop2
14690 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14691 dumping after the two forward propagation passes.
14692
14693 @item -fdump-rtl-gcse1
14694 @itemx -fdump-rtl-gcse2
14695 @opindex fdump-rtl-gcse1
14696 @opindex fdump-rtl-gcse2
14697 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14698 after global common subexpression elimination.
14699
14700 @item -fdump-rtl-init-regs
14701 @opindex fdump-rtl-init-regs
14702 Dump after the initialization of the registers.
14703
14704 @item -fdump-rtl-initvals
14705 @opindex fdump-rtl-initvals
14706 Dump after the computation of the initial value sets.
14707
14708 @item -fdump-rtl-into_cfglayout
14709 @opindex fdump-rtl-into_cfglayout
14710 Dump after converting to cfglayout mode.
14711
14712 @item -fdump-rtl-ira
14713 @opindex fdump-rtl-ira
14714 Dump after iterated register allocation.
14715
14716 @item -fdump-rtl-jump
14717 @opindex fdump-rtl-jump
14718 Dump after the second jump optimization.
14719
14720 @item -fdump-rtl-loop2
14721 @opindex fdump-rtl-loop2
14722 @option{-fdump-rtl-loop2} enables dumping after the rtl
14723 loop optimization passes.
14724
14725 @item -fdump-rtl-mach
14726 @opindex fdump-rtl-mach
14727 Dump after performing the machine dependent reorganization pass, if that
14728 pass exists.
14729
14730 @item -fdump-rtl-mode_sw
14731 @opindex fdump-rtl-mode_sw
14732 Dump after removing redundant mode switches.
14733
14734 @item -fdump-rtl-rnreg
14735 @opindex fdump-rtl-rnreg
14736 Dump after register renumbering.
14737
14738 @item -fdump-rtl-outof_cfglayout
14739 @opindex fdump-rtl-outof_cfglayout
14740 Dump after converting from cfglayout mode.
14741
14742 @item -fdump-rtl-peephole2
14743 @opindex fdump-rtl-peephole2
14744 Dump after the peephole pass.
14745
14746 @item -fdump-rtl-postreload
14747 @opindex fdump-rtl-postreload
14748 Dump after post-reload optimizations.
14749
14750 @item -fdump-rtl-pro_and_epilogue
14751 @opindex fdump-rtl-pro_and_epilogue
14752 Dump after generating the function prologues and epilogues.
14753
14754 @item -fdump-rtl-sched1
14755 @itemx -fdump-rtl-sched2
14756 @opindex fdump-rtl-sched1
14757 @opindex fdump-rtl-sched2
14758 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14759 after the basic block scheduling passes.
14760
14761 @item -fdump-rtl-ree
14762 @opindex fdump-rtl-ree
14763 Dump after sign/zero extension elimination.
14764
14765 @item -fdump-rtl-seqabstr
14766 @opindex fdump-rtl-seqabstr
14767 Dump after common sequence discovery.
14768
14769 @item -fdump-rtl-shorten
14770 @opindex fdump-rtl-shorten
14771 Dump after shortening branches.
14772
14773 @item -fdump-rtl-sibling
14774 @opindex fdump-rtl-sibling
14775 Dump after sibling call optimizations.
14776
14777 @item -fdump-rtl-split1
14778 @itemx -fdump-rtl-split2
14779 @itemx -fdump-rtl-split3
14780 @itemx -fdump-rtl-split4
14781 @itemx -fdump-rtl-split5
14782 @opindex fdump-rtl-split1
14783 @opindex fdump-rtl-split2
14784 @opindex fdump-rtl-split3
14785 @opindex fdump-rtl-split4
14786 @opindex fdump-rtl-split5
14787 These options enable dumping after five rounds of
14788 instruction splitting.
14789
14790 @item -fdump-rtl-sms
14791 @opindex fdump-rtl-sms
14792 Dump after modulo scheduling. This pass is only run on some
14793 architectures.
14794
14795 @item -fdump-rtl-stack
14796 @opindex fdump-rtl-stack
14797 Dump after conversion from GCC's ``flat register file'' registers to the
14798 x87's stack-like registers. This pass is only run on x86 variants.
14799
14800 @item -fdump-rtl-subreg1
14801 @itemx -fdump-rtl-subreg2
14802 @opindex fdump-rtl-subreg1
14803 @opindex fdump-rtl-subreg2
14804 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14805 the two subreg expansion passes.
14806
14807 @item -fdump-rtl-unshare
14808 @opindex fdump-rtl-unshare
14809 Dump after all rtl has been unshared.
14810
14811 @item -fdump-rtl-vartrack
14812 @opindex fdump-rtl-vartrack
14813 Dump after variable tracking.
14814
14815 @item -fdump-rtl-vregs
14816 @opindex fdump-rtl-vregs
14817 Dump after converting virtual registers to hard registers.
14818
14819 @item -fdump-rtl-web
14820 @opindex fdump-rtl-web
14821 Dump after live range splitting.
14822
14823 @item -fdump-rtl-regclass
14824 @itemx -fdump-rtl-subregs_of_mode_init
14825 @itemx -fdump-rtl-subregs_of_mode_finish
14826 @itemx -fdump-rtl-dfinit
14827 @itemx -fdump-rtl-dfinish
14828 @opindex fdump-rtl-regclass
14829 @opindex fdump-rtl-subregs_of_mode_init
14830 @opindex fdump-rtl-subregs_of_mode_finish
14831 @opindex fdump-rtl-dfinit
14832 @opindex fdump-rtl-dfinish
14833 These dumps are defined but always produce empty files.
14834
14835 @item -da
14836 @itemx -fdump-rtl-all
14837 @opindex da
14838 @opindex fdump-rtl-all
14839 Produce all the dumps listed above.
14840
14841 @item -dA
14842 @opindex dA
14843 Annotate the assembler output with miscellaneous debugging information.
14844
14845 @item -dD
14846 @opindex dD
14847 Dump all macro definitions, at the end of preprocessing, in addition to
14848 normal output.
14849
14850 @item -dH
14851 @opindex dH
14852 Produce a core dump whenever an error occurs.
14853
14854 @item -dp
14855 @opindex dp
14856 Annotate the assembler output with a comment indicating which
14857 pattern and alternative is used. The length and cost of each instruction are
14858 also printed.
14859
14860 @item -dP
14861 @opindex dP
14862 Dump the RTL in the assembler output as a comment before each instruction.
14863 Also turns on @option{-dp} annotation.
14864
14865 @item -dx
14866 @opindex dx
14867 Just generate RTL for a function instead of compiling it. Usually used
14868 with @option{-fdump-rtl-expand}.
14869 @end table
14870
14871 @item -fdump-debug
14872 @opindex fdump-debug
14873 Dump debugging information generated during the debug
14874 generation phase.
14875
14876 @item -fdump-earlydebug
14877 @opindex fdump-earlydebug
14878 Dump debugging information generated during the early debug
14879 generation phase.
14880
14881 @item -fdump-noaddr
14882 @opindex fdump-noaddr
14883 When doing debugging dumps, suppress address output. This makes it more
14884 feasible to use diff on debugging dumps for compiler invocations with
14885 different compiler binaries and/or different
14886 text / bss / data / heap / stack / dso start locations.
14887
14888 @item -freport-bug
14889 @opindex freport-bug
14890 Collect and dump debug information into a temporary file if an
14891 internal compiler error (ICE) occurs.
14892
14893 @item -fdump-unnumbered
14894 @opindex fdump-unnumbered
14895 When doing debugging dumps, suppress instruction numbers and address output.
14896 This makes it more feasible to use diff on debugging dumps for compiler
14897 invocations with different options, in particular with and without
14898 @option{-g}.
14899
14900 @item -fdump-unnumbered-links
14901 @opindex fdump-unnumbered-links
14902 When doing debugging dumps (see @option{-d} option above), suppress
14903 instruction numbers for the links to the previous and next instructions
14904 in a sequence.
14905
14906 @item -fdump-ipa-@var{switch}
14907 @itemx -fdump-ipa-@var{switch}-@var{options}
14908 @opindex fdump-ipa
14909 Control the dumping at various stages of inter-procedural analysis
14910 language tree to a file. The file name is generated by appending a
14911 switch specific suffix to the source file name, and the file is created
14912 in the same directory as the output file. The following dumps are
14913 possible:
14914
14915 @table @samp
14916 @item all
14917 Enables all inter-procedural analysis dumps.
14918
14919 @item cgraph
14920 Dumps information about call-graph optimization, unused function removal,
14921 and inlining decisions.
14922
14923 @item inline
14924 Dump after function inlining.
14925
14926 @end table
14927
14928 Additionally, the options @option{-optimized}, @option{-missed},
14929 @option{-note}, and @option{-all} can be provided, with the same meaning
14930 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14931
14932 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14933 information on callsites that were inlined, along with callsites
14934 that were not inlined.
14935
14936 By default, the dump will contain messages about successful
14937 optimizations (equivalent to @option{-optimized}) together with
14938 low-level details about the analysis.
14939
14940 @item -fdump-lang-all
14941 @itemx -fdump-lang-@var{switch}
14942 @itemx -fdump-lang-@var{switch}-@var{options}
14943 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14944 @opindex fdump-lang-all
14945 @opindex fdump-lang
14946 Control the dumping of language-specific information. The @var{options}
14947 and @var{filename} portions behave as described in the
14948 @option{-fdump-tree} option. The following @var{switch} values are
14949 accepted:
14950
14951 @table @samp
14952 @item all
14953
14954 Enable all language-specific dumps.
14955
14956 @item class
14957 Dump class hierarchy information. Virtual table information is emitted
14958 unless '@option{slim}' is specified. This option is applicable to C++ only.
14959
14960 @item raw
14961 Dump the raw internal tree data. This option is applicable to C++ only.
14962
14963 @end table
14964
14965 @item -fdump-passes
14966 @opindex fdump-passes
14967 Print on @file{stderr} the list of optimization passes that are turned
14968 on and off by the current command-line options.
14969
14970 @item -fdump-statistics-@var{option}
14971 @opindex fdump-statistics
14972 Enable and control dumping of pass statistics in a separate file. The
14973 file name is generated by appending a suffix ending in
14974 @samp{.statistics} to the source file name, and the file is created in
14975 the same directory as the output file. If the @samp{-@var{option}}
14976 form is used, @samp{-stats} causes counters to be summed over the
14977 whole compilation unit while @samp{-details} dumps every event as
14978 the passes generate them. The default with no option is to sum
14979 counters for each function compiled.
14980
14981 @item -fdump-tree-all
14982 @itemx -fdump-tree-@var{switch}
14983 @itemx -fdump-tree-@var{switch}-@var{options}
14984 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14985 @opindex fdump-tree-all
14986 @opindex fdump-tree
14987 Control the dumping at various stages of processing the intermediate
14988 language tree to a file. If the @samp{-@var{options}}
14989 form is used, @var{options} is a list of @samp{-} separated options
14990 which control the details of the dump. Not all options are applicable
14991 to all dumps; those that are not meaningful are ignored. The
14992 following options are available
14993
14994 @table @samp
14995 @item address
14996 Print the address of each node. Usually this is not meaningful as it
14997 changes according to the environment and source file. Its primary use
14998 is for tying up a dump file with a debug environment.
14999 @item asmname
15000 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15001 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
15002 use working backward from mangled names in the assembly file.
15003 @item slim
15004 When dumping front-end intermediate representations, inhibit dumping
15005 of members of a scope or body of a function merely because that scope
15006 has been reached. Only dump such items when they are directly reachable
15007 by some other path.
15008
15009 When dumping pretty-printed trees, this option inhibits dumping the
15010 bodies of control structures.
15011
15012 When dumping RTL, print the RTL in slim (condensed) form instead of
15013 the default LISP-like representation.
15014 @item raw
15015 Print a raw representation of the tree. By default, trees are
15016 pretty-printed into a C-like representation.
15017 @item details
15018 Enable more detailed dumps (not honored by every dump option). Also
15019 include information from the optimization passes.
15020 @item stats
15021 Enable dumping various statistics about the pass (not honored by every dump
15022 option).
15023 @item blocks
15024 Enable showing basic block boundaries (disabled in raw dumps).
15025 @item graph
15026 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15027 dump a representation of the control flow graph suitable for viewing with
15028 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
15029 the file is pretty-printed as a subgraph, so that GraphViz can render them
15030 all in a single plot.
15031
15032 This option currently only works for RTL dumps, and the RTL is always
15033 dumped in slim form.
15034 @item vops
15035 Enable showing virtual operands for every statement.
15036 @item lineno
15037 Enable showing line numbers for statements.
15038 @item uid
15039 Enable showing the unique ID (@code{DECL_UID}) for each variable.
15040 @item verbose
15041 Enable showing the tree dump for each statement.
15042 @item eh
15043 Enable showing the EH region number holding each statement.
15044 @item scev
15045 Enable showing scalar evolution analysis details.
15046 @item optimized
15047 Enable showing optimization information (only available in certain
15048 passes).
15049 @item missed
15050 Enable showing missed optimization information (only available in certain
15051 passes).
15052 @item note
15053 Enable other detailed optimization information (only available in
15054 certain passes).
15055 @item all
15056 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15057 and @option{lineno}.
15058 @item optall
15059 Turn on all optimization options, i.e., @option{optimized},
15060 @option{missed}, and @option{note}.
15061 @end table
15062
15063 To determine what tree dumps are available or find the dump for a pass
15064 of interest follow the steps below.
15065
15066 @enumerate
15067 @item
15068 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15069 look for a code that corresponds to the pass you are interested in.
15070 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15071 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15072 The number at the end distinguishes distinct invocations of the same pass.
15073 @item
15074 To enable the creation of the dump file, append the pass code to
15075 the @option{-fdump-} option prefix and invoke GCC with it. For example,
15076 to enable the dump from the Early Value Range Propagation pass, invoke
15077 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
15078 specify the name of the dump file. If you don't specify one, GCC
15079 creates as described below.
15080 @item
15081 Find the pass dump in a file whose name is composed of three components
15082 separated by a period: the name of the source file GCC was invoked to
15083 compile, a numeric suffix indicating the pass number followed by the
15084 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15085 and finally the pass code. For example, the Early VRP pass dump might
15086 be in a file named @file{myfile.c.038t.evrp} in the current working
15087 directory. Note that the numeric codes are not stable and may change
15088 from one version of GCC to another.
15089 @end enumerate
15090
15091 @item -fopt-info
15092 @itemx -fopt-info-@var{options}
15093 @itemx -fopt-info-@var{options}=@var{filename}
15094 @opindex fopt-info
15095 Controls optimization dumps from various optimization passes. If the
15096 @samp{-@var{options}} form is used, @var{options} is a list of
15097 @samp{-} separated option keywords to select the dump details and
15098 optimizations.
15099
15100 The @var{options} can be divided into three groups:
15101 @enumerate
15102 @item
15103 options describing what kinds of messages should be emitted,
15104 @item
15105 options describing the verbosity of the dump, and
15106 @item
15107 options describing which optimizations should be included.
15108 @end enumerate
15109 The options from each group can be freely mixed as they are
15110 non-overlapping. However, in case of any conflicts,
15111 the later options override the earlier options on the command
15112 line.
15113
15114 The following options control which kinds of messages should be emitted:
15115
15116 @table @samp
15117 @item optimized
15118 Print information when an optimization is successfully applied. It is
15119 up to a pass to decide which information is relevant. For example, the
15120 vectorizer passes print the source location of loops which are
15121 successfully vectorized.
15122 @item missed
15123 Print information about missed optimizations. Individual passes
15124 control which information to include in the output.
15125 @item note
15126 Print verbose information about optimizations, such as certain
15127 transformations, more detailed messages about decisions etc.
15128 @item all
15129 Print detailed optimization information. This includes
15130 @samp{optimized}, @samp{missed}, and @samp{note}.
15131 @end table
15132
15133 The following option controls the dump verbosity:
15134
15135 @table @samp
15136 @item internals
15137 By default, only ``high-level'' messages are emitted. This option enables
15138 additional, more detailed, messages, which are likely to only be of interest
15139 to GCC developers.
15140 @end table
15141
15142 One or more of the following option keywords can be used to describe a
15143 group of optimizations:
15144
15145 @table @samp
15146 @item ipa
15147 Enable dumps from all interprocedural optimizations.
15148 @item loop
15149 Enable dumps from all loop optimizations.
15150 @item inline
15151 Enable dumps from all inlining optimizations.
15152 @item omp
15153 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15154 @item vec
15155 Enable dumps from all vectorization optimizations.
15156 @item optall
15157 Enable dumps from all optimizations. This is a superset of
15158 the optimization groups listed above.
15159 @end table
15160
15161 If @var{options} is
15162 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15163 about successful optimizations from all the passes, omitting messages
15164 that are treated as ``internals''.
15165
15166 If the @var{filename} is provided, then the dumps from all the
15167 applicable optimizations are concatenated into the @var{filename}.
15168 Otherwise the dump is output onto @file{stderr}. Though multiple
15169 @option{-fopt-info} options are accepted, only one of them can include
15170 a @var{filename}. If other filenames are provided then all but the
15171 first such option are ignored.
15172
15173 Note that the output @var{filename} is overwritten
15174 in case of multiple translation units. If a combined output from
15175 multiple translation units is desired, @file{stderr} should be used
15176 instead.
15177
15178 In the following example, the optimization info is output to
15179 @file{stderr}:
15180
15181 @smallexample
15182 gcc -O3 -fopt-info
15183 @end smallexample
15184
15185 This example:
15186 @smallexample
15187 gcc -O3 -fopt-info-missed=missed.all
15188 @end smallexample
15189
15190 @noindent
15191 outputs missed optimization report from all the passes into
15192 @file{missed.all}, and this one:
15193
15194 @smallexample
15195 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15196 @end smallexample
15197
15198 @noindent
15199 prints information about missed optimization opportunities from
15200 vectorization passes on @file{stderr}.
15201 Note that @option{-fopt-info-vec-missed} is equivalent to
15202 @option{-fopt-info-missed-vec}. The order of the optimization group
15203 names and message types listed after @option{-fopt-info} does not matter.
15204
15205 As another example,
15206 @smallexample
15207 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15208 @end smallexample
15209
15210 @noindent
15211 outputs information about missed optimizations as well as
15212 optimized locations from all the inlining passes into
15213 @file{inline.txt}.
15214
15215 Finally, consider:
15216
15217 @smallexample
15218 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15219 @end smallexample
15220
15221 @noindent
15222 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15223 in conflict since only one output file is allowed. In this case, only
15224 the first option takes effect and the subsequent options are
15225 ignored. Thus only @file{vec.miss} is produced which contains
15226 dumps from the vectorizer about missed opportunities.
15227
15228 @item -fsave-optimization-record
15229 @opindex fsave-optimization-record
15230 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15231 were performed, for those optimizations that support @option{-fopt-info}.
15232
15233 This option is experimental and the format of the data within the
15234 compressed JSON file is subject to change.
15235
15236 It is roughly equivalent to a machine-readable version of
15237 @option{-fopt-info-all}, as a collection of messages with source file,
15238 line number and column number, with the following additional data for
15239 each message:
15240
15241 @itemize @bullet
15242
15243 @item
15244 the execution count of the code being optimized, along with metadata about
15245 whether this was from actual profile data, or just an estimate, allowing
15246 consumers to prioritize messages by code hotness,
15247
15248 @item
15249 the function name of the code being optimized, where applicable,
15250
15251 @item
15252 the ``inlining chain'' for the code being optimized, so that when
15253 a function is inlined into several different places (which might
15254 themselves be inlined), the reader can distinguish between the copies,
15255
15256 @item
15257 objects identifying those parts of the message that refer to expressions,
15258 statements or symbol-table nodes, which of these categories they are, and,
15259 when available, their source code location,
15260
15261 @item
15262 the GCC pass that emitted the message, and
15263
15264 @item
15265 the location in GCC's own code from which the message was emitted
15266
15267 @end itemize
15268
15269 Additionally, some messages are logically nested within other
15270 messages, reflecting implementation details of the optimization
15271 passes.
15272
15273 @item -fsched-verbose=@var{n}
15274 @opindex fsched-verbose
15275 On targets that use instruction scheduling, this option controls the
15276 amount of debugging output the scheduler prints to the dump files.
15277
15278 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15279 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15280 For @var{n} greater than one, it also output basic block probabilities,
15281 detailed ready list information and unit/insn info. For @var{n} greater
15282 than two, it includes RTL at abort point, control-flow and regions info.
15283 And for @var{n} over four, @option{-fsched-verbose} also includes
15284 dependence info.
15285
15286
15287
15288 @item -fenable-@var{kind}-@var{pass}
15289 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15290 @opindex fdisable-
15291 @opindex fenable-
15292
15293 This is a set of options that are used to explicitly disable/enable
15294 optimization passes. These options are intended for use for debugging GCC.
15295 Compiler users should use regular options for enabling/disabling
15296 passes instead.
15297
15298 @table @gcctabopt
15299
15300 @item -fdisable-ipa-@var{pass}
15301 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15302 statically invoked in the compiler multiple times, the pass name should be
15303 appended with a sequential number starting from 1.
15304
15305 @item -fdisable-rtl-@var{pass}
15306 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15307 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15308 statically invoked in the compiler multiple times, the pass name should be
15309 appended with a sequential number starting from 1. @var{range-list} is a
15310 comma-separated list of function ranges or assembler names. Each range is a number
15311 pair separated by a colon. The range is inclusive in both ends. If the range
15312 is trivial, the number pair can be simplified as a single number. If the
15313 function's call graph node's @var{uid} falls within one of the specified ranges,
15314 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15315 function header of a dump file, and the pass names can be dumped by using
15316 option @option{-fdump-passes}.
15317
15318 @item -fdisable-tree-@var{pass}
15319 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15320 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15321 option arguments.
15322
15323 @item -fenable-ipa-@var{pass}
15324 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15325 statically invoked in the compiler multiple times, the pass name should be
15326 appended with a sequential number starting from 1.
15327
15328 @item -fenable-rtl-@var{pass}
15329 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15330 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15331 description and examples.
15332
15333 @item -fenable-tree-@var{pass}
15334 @itemx -fenable-tree-@var{pass}=@var{range-list}
15335 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15336 of option arguments.
15337
15338 @end table
15339
15340 Here are some examples showing uses of these options.
15341
15342 @smallexample
15343
15344 # disable ccp1 for all functions
15345 -fdisable-tree-ccp1
15346 # disable complete unroll for function whose cgraph node uid is 1
15347 -fenable-tree-cunroll=1
15348 # disable gcse2 for functions at the following ranges [1,1],
15349 # [300,400], and [400,1000]
15350 # disable gcse2 for functions foo and foo2
15351 -fdisable-rtl-gcse2=foo,foo2
15352 # disable early inlining
15353 -fdisable-tree-einline
15354 # disable ipa inlining
15355 -fdisable-ipa-inline
15356 # enable tree full unroll
15357 -fenable-tree-unroll
15358
15359 @end smallexample
15360
15361 @item -fchecking
15362 @itemx -fchecking=@var{n}
15363 @opindex fchecking
15364 @opindex fno-checking
15365 Enable internal consistency checking. The default depends on
15366 the compiler configuration. @option{-fchecking=2} enables further
15367 internal consistency checking that might affect code generation.
15368
15369 @item -frandom-seed=@var{string}
15370 @opindex frandom-seed
15371 This option provides a seed that GCC uses in place of
15372 random numbers in generating certain symbol names
15373 that have to be different in every compiled file. It is also used to
15374 place unique stamps in coverage data files and the object files that
15375 produce them. You can use the @option{-frandom-seed} option to produce
15376 reproducibly identical object files.
15377
15378 The @var{string} can either be a number (decimal, octal or hex) or an
15379 arbitrary string (in which case it's converted to a number by
15380 computing CRC32).
15381
15382 The @var{string} should be different for every file you compile.
15383
15384 @item -save-temps
15385 @itemx -save-temps=cwd
15386 @opindex save-temps
15387 Store the usual ``temporary'' intermediate files permanently; place them
15388 in the current directory and name them based on the source file. Thus,
15389 compiling @file{foo.c} with @option{-c -save-temps} produces files
15390 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15391 preprocessed @file{foo.i} output file even though the compiler now
15392 normally uses an integrated preprocessor.
15393
15394 When used in combination with the @option{-x} command-line option,
15395 @option{-save-temps} is sensible enough to avoid over writing an
15396 input source file with the same extension as an intermediate file.
15397 The corresponding intermediate file may be obtained by renaming the
15398 source file before using @option{-save-temps}.
15399
15400 If you invoke GCC in parallel, compiling several different source
15401 files that share a common base name in different subdirectories or the
15402 same source file compiled for multiple output destinations, it is
15403 likely that the different parallel compilers will interfere with each
15404 other, and overwrite the temporary files. For instance:
15405
15406 @smallexample
15407 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15408 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15409 @end smallexample
15410
15411 may result in @file{foo.i} and @file{foo.o} being written to
15412 simultaneously by both compilers.
15413
15414 @item -save-temps=obj
15415 @opindex save-temps=obj
15416 Store the usual ``temporary'' intermediate files permanently. If the
15417 @option{-o} option is used, the temporary files are based on the
15418 object file. If the @option{-o} option is not used, the
15419 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15420
15421 For example:
15422
15423 @smallexample
15424 gcc -save-temps=obj -c foo.c
15425 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15426 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15427 @end smallexample
15428
15429 @noindent
15430 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15431 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15432 @file{dir2/yfoobar.o}.
15433
15434 @item -time@r{[}=@var{file}@r{]}
15435 @opindex time
15436 Report the CPU time taken by each subprocess in the compilation
15437 sequence. For C source files, this is the compiler proper and assembler
15438 (plus the linker if linking is done).
15439
15440 Without the specification of an output file, the output looks like this:
15441
15442 @smallexample
15443 # cc1 0.12 0.01
15444 # as 0.00 0.01
15445 @end smallexample
15446
15447 The first number on each line is the ``user time'', that is time spent
15448 executing the program itself. The second number is ``system time'',
15449 time spent executing operating system routines on behalf of the program.
15450 Both numbers are in seconds.
15451
15452 With the specification of an output file, the output is appended to the
15453 named file, and it looks like this:
15454
15455 @smallexample
15456 0.12 0.01 cc1 @var{options}
15457 0.00 0.01 as @var{options}
15458 @end smallexample
15459
15460 The ``user time'' and the ``system time'' are moved before the program
15461 name, and the options passed to the program are displayed, so that one
15462 can later tell what file was being compiled, and with which options.
15463
15464 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15465 @opindex fdump-final-insns
15466 Dump the final internal representation (RTL) to @var{file}. If the
15467 optional argument is omitted (or if @var{file} is @code{.}), the name
15468 of the dump file is determined by appending @code{.gkd} to the
15469 compilation output file name.
15470
15471 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15472 @opindex fcompare-debug
15473 @opindex fno-compare-debug
15474 If no error occurs during compilation, run the compiler a second time,
15475 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15476 passed to the second compilation. Dump the final internal
15477 representation in both compilations, and print an error if they differ.
15478
15479 If the equal sign is omitted, the default @option{-gtoggle} is used.
15480
15481 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15482 and nonzero, implicitly enables @option{-fcompare-debug}. If
15483 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15484 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15485 is used.
15486
15487 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15488 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15489 of the final representation and the second compilation, preventing even
15490 @env{GCC_COMPARE_DEBUG} from taking effect.
15491
15492 To verify full coverage during @option{-fcompare-debug} testing, set
15493 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15494 which GCC rejects as an invalid option in any actual compilation
15495 (rather than preprocessing, assembly or linking). To get just a
15496 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15497 not overridden} will do.
15498
15499 @item -fcompare-debug-second
15500 @opindex fcompare-debug-second
15501 This option is implicitly passed to the compiler for the second
15502 compilation requested by @option{-fcompare-debug}, along with options to
15503 silence warnings, and omitting other options that would cause the compiler
15504 to produce output to files or to standard output as a side effect. Dump
15505 files and preserved temporary files are renamed so as to contain the
15506 @code{.gk} additional extension during the second compilation, to avoid
15507 overwriting those generated by the first.
15508
15509 When this option is passed to the compiler driver, it causes the
15510 @emph{first} compilation to be skipped, which makes it useful for little
15511 other than debugging the compiler proper.
15512
15513 @item -gtoggle
15514 @opindex gtoggle
15515 Turn off generation of debug info, if leaving out this option
15516 generates it, or turn it on at level 2 otherwise. The position of this
15517 argument in the command line does not matter; it takes effect after all
15518 other options are processed, and it does so only once, no matter how
15519 many times it is given. This is mainly intended to be used with
15520 @option{-fcompare-debug}.
15521
15522 @item -fvar-tracking-assignments-toggle
15523 @opindex fvar-tracking-assignments-toggle
15524 @opindex fno-var-tracking-assignments-toggle
15525 Toggle @option{-fvar-tracking-assignments}, in the same way that
15526 @option{-gtoggle} toggles @option{-g}.
15527
15528 @item -Q
15529 @opindex Q
15530 Makes the compiler print out each function name as it is compiled, and
15531 print some statistics about each pass when it finishes.
15532
15533 @item -ftime-report
15534 @opindex ftime-report
15535 Makes the compiler print some statistics about the time consumed by each
15536 pass when it finishes.
15537
15538 @item -ftime-report-details
15539 @opindex ftime-report-details
15540 Record the time consumed by infrastructure parts separately for each pass.
15541
15542 @item -fira-verbose=@var{n}
15543 @opindex fira-verbose
15544 Control the verbosity of the dump file for the integrated register allocator.
15545 The default value is 5. If the value @var{n} is greater or equal to 10,
15546 the dump output is sent to stderr using the same format as @var{n} minus 10.
15547
15548 @item -flto-report
15549 @opindex flto-report
15550 Prints a report with internal details on the workings of the link-time
15551 optimizer. The contents of this report vary from version to version.
15552 It is meant to be useful to GCC developers when processing object
15553 files in LTO mode (via @option{-flto}).
15554
15555 Disabled by default.
15556
15557 @item -flto-report-wpa
15558 @opindex flto-report-wpa
15559 Like @option{-flto-report}, but only print for the WPA phase of link-time
15560 optimization.
15561
15562 @item -fmem-report
15563 @opindex fmem-report
15564 Makes the compiler print some statistics about permanent memory
15565 allocation when it finishes.
15566
15567 @item -fmem-report-wpa
15568 @opindex fmem-report-wpa
15569 Makes the compiler print some statistics about permanent memory
15570 allocation for the WPA phase only.
15571
15572 @item -fpre-ipa-mem-report
15573 @opindex fpre-ipa-mem-report
15574 @item -fpost-ipa-mem-report
15575 @opindex fpost-ipa-mem-report
15576 Makes the compiler print some statistics about permanent memory
15577 allocation before or after interprocedural optimization.
15578
15579 @item -fprofile-report
15580 @opindex fprofile-report
15581 Makes the compiler print some statistics about consistency of the
15582 (estimated) profile and effect of individual passes.
15583
15584 @item -fstack-usage
15585 @opindex fstack-usage
15586 Makes the compiler output stack usage information for the program, on a
15587 per-function basis. The filename for the dump is made by appending
15588 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15589 the output file, if explicitly specified and it is not an executable,
15590 otherwise it is the basename of the source file. An entry is made up
15591 of three fields:
15592
15593 @itemize
15594 @item
15595 The name of the function.
15596 @item
15597 A number of bytes.
15598 @item
15599 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15600 @end itemize
15601
15602 The qualifier @code{static} means that the function manipulates the stack
15603 statically: a fixed number of bytes are allocated for the frame on function
15604 entry and released on function exit; no stack adjustments are otherwise made
15605 in the function. The second field is this fixed number of bytes.
15606
15607 The qualifier @code{dynamic} means that the function manipulates the stack
15608 dynamically: in addition to the static allocation described above, stack
15609 adjustments are made in the body of the function, for example to push/pop
15610 arguments around function calls. If the qualifier @code{bounded} is also
15611 present, the amount of these adjustments is bounded at compile time and
15612 the second field is an upper bound of the total amount of stack used by
15613 the function. If it is not present, the amount of these adjustments is
15614 not bounded at compile time and the second field only represents the
15615 bounded part.
15616
15617 @item -fstats
15618 @opindex fstats
15619 Emit statistics about front-end processing at the end of the compilation.
15620 This option is supported only by the C++ front end, and
15621 the information is generally only useful to the G++ development team.
15622
15623 @item -fdbg-cnt-list
15624 @opindex fdbg-cnt-list
15625 Print the name and the counter upper bound for all debug counters.
15626
15627
15628 @item -fdbg-cnt=@var{counter-value-list}
15629 @opindex fdbg-cnt
15630 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15631 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15632 tuples which sets the lower and the upper bound of each debug
15633 counter @var{name}. The @var{lower_bound} is optional and is zero
15634 initialized if not set.
15635 All debug counters have the initial upper bound of @code{UINT_MAX};
15636 thus @code{dbg_cnt} returns true always unless the upper bound
15637 is set by this option.
15638 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15639 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15640 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15641
15642 @item -print-file-name=@var{library}
15643 @opindex print-file-name
15644 Print the full absolute name of the library file @var{library} that
15645 would be used when linking---and don't do anything else. With this
15646 option, GCC does not compile or link anything; it just prints the
15647 file name.
15648
15649 @item -print-multi-directory
15650 @opindex print-multi-directory
15651 Print the directory name corresponding to the multilib selected by any
15652 other switches present in the command line. This directory is supposed
15653 to exist in @env{GCC_EXEC_PREFIX}.
15654
15655 @item -print-multi-lib
15656 @opindex print-multi-lib
15657 Print the mapping from multilib directory names to compiler switches
15658 that enable them. The directory name is separated from the switches by
15659 @samp{;}, and each switch starts with an @samp{@@} instead of the
15660 @samp{-}, without spaces between multiple switches. This is supposed to
15661 ease shell processing.
15662
15663 @item -print-multi-os-directory
15664 @opindex print-multi-os-directory
15665 Print the path to OS libraries for the selected
15666 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15667 present in the @file{lib} subdirectory and no multilibs are used, this is
15668 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15669 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15670 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15671 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15672
15673 @item -print-multiarch
15674 @opindex print-multiarch
15675 Print the path to OS libraries for the selected multiarch,
15676 relative to some @file{lib} subdirectory.
15677
15678 @item -print-prog-name=@var{program}
15679 @opindex print-prog-name
15680 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15681
15682 @item -print-libgcc-file-name
15683 @opindex print-libgcc-file-name
15684 Same as @option{-print-file-name=libgcc.a}.
15685
15686 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15687 but you do want to link with @file{libgcc.a}. You can do:
15688
15689 @smallexample
15690 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15691 @end smallexample
15692
15693 @item -print-search-dirs
15694 @opindex print-search-dirs
15695 Print the name of the configured installation directory and a list of
15696 program and library directories @command{gcc} searches---and don't do anything else.
15697
15698 This is useful when @command{gcc} prints the error message
15699 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15700 To resolve this you either need to put @file{cpp0} and the other compiler
15701 components where @command{gcc} expects to find them, or you can set the environment
15702 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15703 Don't forget the trailing @samp{/}.
15704 @xref{Environment Variables}.
15705
15706 @item -print-sysroot
15707 @opindex print-sysroot
15708 Print the target sysroot directory that is used during
15709 compilation. This is the target sysroot specified either at configure
15710 time or using the @option{--sysroot} option, possibly with an extra
15711 suffix that depends on compilation options. If no target sysroot is
15712 specified, the option prints nothing.
15713
15714 @item -print-sysroot-headers-suffix
15715 @opindex print-sysroot-headers-suffix
15716 Print the suffix added to the target sysroot when searching for
15717 headers, or give an error if the compiler is not configured with such
15718 a suffix---and don't do anything else.
15719
15720 @item -dumpmachine
15721 @opindex dumpmachine
15722 Print the compiler's target machine (for example,
15723 @samp{i686-pc-linux-gnu})---and don't do anything else.
15724
15725 @item -dumpversion
15726 @opindex dumpversion
15727 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15728 anything else. This is the compiler version used in filesystem paths and
15729 specs. Depending on how the compiler has been configured it can be just
15730 a single number (major version), two numbers separated by a dot (major and
15731 minor version) or three numbers separated by dots (major, minor and patchlevel
15732 version).
15733
15734 @item -dumpfullversion
15735 @opindex dumpfullversion
15736 Print the full compiler version---and don't do anything else. The output is
15737 always three numbers separated by dots, major, minor and patchlevel version.
15738
15739 @item -dumpspecs
15740 @opindex dumpspecs
15741 Print the compiler's built-in specs---and don't do anything else. (This
15742 is used when GCC itself is being built.) @xref{Spec Files}.
15743 @end table
15744
15745 @node Submodel Options
15746 @section Machine-Dependent Options
15747 @cindex submodel options
15748 @cindex specifying hardware config
15749 @cindex hardware models and configurations, specifying
15750 @cindex target-dependent options
15751 @cindex machine-dependent options
15752
15753 Each target machine supported by GCC can have its own options---for
15754 example, to allow you to compile for a particular processor variant or
15755 ABI, or to control optimizations specific to that machine. By
15756 convention, the names of machine-specific options start with
15757 @samp{-m}.
15758
15759 Some configurations of the compiler also support additional target-specific
15760 options, usually for compatibility with other compilers on the same
15761 platform.
15762
15763 @c This list is ordered alphanumerically by subsection name.
15764 @c It should be the same order and spelling as these options are listed
15765 @c in Machine Dependent Options
15766
15767 @menu
15768 * AArch64 Options::
15769 * Adapteva Epiphany Options::
15770 * AMD GCN Options::
15771 * ARC Options::
15772 * ARM Options::
15773 * AVR Options::
15774 * Blackfin Options::
15775 * C6X Options::
15776 * CRIS Options::
15777 * CR16 Options::
15778 * C-SKY Options::
15779 * Darwin Options::
15780 * DEC Alpha Options::
15781 * eBPF Options::
15782 * FR30 Options::
15783 * FT32 Options::
15784 * FRV Options::
15785 * GNU/Linux Options::
15786 * H8/300 Options::
15787 * HPPA Options::
15788 * IA-64 Options::
15789 * LM32 Options::
15790 * M32C Options::
15791 * M32R/D Options::
15792 * M680x0 Options::
15793 * MCore Options::
15794 * MeP Options::
15795 * MicroBlaze Options::
15796 * MIPS Options::
15797 * MMIX Options::
15798 * MN10300 Options::
15799 * Moxie Options::
15800 * MSP430 Options::
15801 * NDS32 Options::
15802 * Nios II Options::
15803 * Nvidia PTX Options::
15804 * OpenRISC Options::
15805 * PDP-11 Options::
15806 * picoChip Options::
15807 * PowerPC Options::
15808 * PRU Options::
15809 * RISC-V Options::
15810 * RL78 Options::
15811 * RS/6000 and PowerPC Options::
15812 * RX Options::
15813 * S/390 and zSeries Options::
15814 * Score Options::
15815 * SH Options::
15816 * Solaris 2 Options::
15817 * SPARC Options::
15818 * System V Options::
15819 * TILE-Gx Options::
15820 * TILEPro Options::
15821 * V850 Options::
15822 * VAX Options::
15823 * Visium Options::
15824 * VMS Options::
15825 * VxWorks Options::
15826 * x86 Options::
15827 * x86 Windows Options::
15828 * Xstormy16 Options::
15829 * Xtensa Options::
15830 * zSeries Options::
15831 @end menu
15832
15833 @node AArch64 Options
15834 @subsection AArch64 Options
15835 @cindex AArch64 Options
15836
15837 These options are defined for AArch64 implementations:
15838
15839 @table @gcctabopt
15840
15841 @item -mabi=@var{name}
15842 @opindex mabi
15843 Generate code for the specified data model. Permissible values
15844 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15845 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15846 but long int and pointers are 64 bits.
15847
15848 The default depends on the specific target configuration. Note that
15849 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15850 entire program with the same ABI, and link with a compatible set of libraries.
15851
15852 @item -mbig-endian
15853 @opindex mbig-endian
15854 Generate big-endian code. This is the default when GCC is configured for an
15855 @samp{aarch64_be-*-*} target.
15856
15857 @item -mgeneral-regs-only
15858 @opindex mgeneral-regs-only
15859 Generate code which uses only the general-purpose registers. This will prevent
15860 the compiler from using floating-point and Advanced SIMD registers but will not
15861 impose any restrictions on the assembler.
15862
15863 @item -mlittle-endian
15864 @opindex mlittle-endian
15865 Generate little-endian code. This is the default when GCC is configured for an
15866 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15867
15868 @item -mcmodel=tiny
15869 @opindex mcmodel=tiny
15870 Generate code for the tiny code model. The program and its statically defined
15871 symbols must be within 1MB of each other. Programs can be statically or
15872 dynamically linked.
15873
15874 @item -mcmodel=small
15875 @opindex mcmodel=small
15876 Generate code for the small code model. The program and its statically defined
15877 symbols must be within 4GB of each other. Programs can be statically or
15878 dynamically linked. This is the default code model.
15879
15880 @item -mcmodel=large
15881 @opindex mcmodel=large
15882 Generate code for the large code model. This makes no assumptions about
15883 addresses and sizes of sections. Programs can be statically linked only.
15884
15885 @item -mstrict-align
15886 @itemx -mno-strict-align
15887 @opindex mstrict-align
15888 @opindex mno-strict-align
15889 Avoid or allow generating memory accesses that may not be aligned on a natural
15890 object boundary as described in the architecture specification.
15891
15892 @item -momit-leaf-frame-pointer
15893 @itemx -mno-omit-leaf-frame-pointer
15894 @opindex momit-leaf-frame-pointer
15895 @opindex mno-omit-leaf-frame-pointer
15896 Omit or keep the frame pointer in leaf functions. The former behavior is the
15897 default.
15898
15899 @item -mstack-protector-guard=@var{guard}
15900 @itemx -mstack-protector-guard-reg=@var{reg}
15901 @itemx -mstack-protector-guard-offset=@var{offset}
15902 @opindex mstack-protector-guard
15903 @opindex mstack-protector-guard-reg
15904 @opindex mstack-protector-guard-offset
15905 Generate stack protection code using canary at @var{guard}. Supported
15906 locations are @samp{global} for a global canary or @samp{sysreg} for a
15907 canary in an appropriate system register.
15908
15909 With the latter choice the options
15910 @option{-mstack-protector-guard-reg=@var{reg}} and
15911 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15912 which system register to use as base register for reading the canary,
15913 and from what offset from that base register. There is no default
15914 register or offset as this is entirely for use within the Linux
15915 kernel.
15916
15917 @item -mstack-protector-guard=@var{guard}
15918 @itemx -mstack-protector-guard-reg=@var{reg}
15919 @itemx -mstack-protector-guard-offset=@var{offset}
15920 @opindex mstack-protector-guard
15921 @opindex mstack-protector-guard-reg
15922 @opindex mstack-protector-guard-offset
15923 Generate stack protection code using canary at @var{guard}. Supported
15924 locations are @samp{global} for a global canary or @samp{sysreg} for a
15925 canary in an appropriate system register.
15926
15927 With the latter choice the options
15928 @option{-mstack-protector-guard-reg=@var{reg}} and
15929 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15930 which system register to use as base register for reading the canary,
15931 and from what offset from that base register. There is no default
15932 register or offset as this is entirely for use within the Linux
15933 kernel.
15934
15935 @item -mtls-dialect=desc
15936 @opindex mtls-dialect=desc
15937 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15938 of TLS variables. This is the default.
15939
15940 @item -mtls-dialect=traditional
15941 @opindex mtls-dialect=traditional
15942 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15943 of TLS variables.
15944
15945 @item -mtls-size=@var{size}
15946 @opindex mtls-size
15947 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15948 This option requires binutils 2.26 or newer.
15949
15950 @item -mfix-cortex-a53-835769
15951 @itemx -mno-fix-cortex-a53-835769
15952 @opindex mfix-cortex-a53-835769
15953 @opindex mno-fix-cortex-a53-835769
15954 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15955 This involves inserting a NOP instruction between memory instructions and
15956 64-bit integer multiply-accumulate instructions.
15957
15958 @item -mfix-cortex-a53-843419
15959 @itemx -mno-fix-cortex-a53-843419
15960 @opindex mfix-cortex-a53-843419
15961 @opindex mno-fix-cortex-a53-843419
15962 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15963 This erratum workaround is made at link time and this will only pass the
15964 corresponding flag to the linker.
15965
15966 @item -mlow-precision-recip-sqrt
15967 @itemx -mno-low-precision-recip-sqrt
15968 @opindex mlow-precision-recip-sqrt
15969 @opindex mno-low-precision-recip-sqrt
15970 Enable or disable the reciprocal square root approximation.
15971 This option only has an effect if @option{-ffast-math} or
15972 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15973 precision of reciprocal square root results to about 16 bits for
15974 single precision and to 32 bits for double precision.
15975
15976 @item -mlow-precision-sqrt
15977 @itemx -mno-low-precision-sqrt
15978 @opindex mlow-precision-sqrt
15979 @opindex mno-low-precision-sqrt
15980 Enable or disable the square root approximation.
15981 This option only has an effect if @option{-ffast-math} or
15982 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15983 precision of square root results to about 16 bits for
15984 single precision and to 32 bits for double precision.
15985 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15986
15987 @item -mlow-precision-div
15988 @itemx -mno-low-precision-div
15989 @opindex mlow-precision-div
15990 @opindex mno-low-precision-div
15991 Enable or disable the division approximation.
15992 This option only has an effect if @option{-ffast-math} or
15993 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15994 precision of division results to about 16 bits for
15995 single precision and to 32 bits for double precision.
15996
15997 @item -mtrack-speculation
15998 @itemx -mno-track-speculation
15999 Enable or disable generation of additional code to track speculative
16000 execution through conditional branches. The tracking state can then
16001 be used by the compiler when expanding calls to
16002 @code{__builtin_speculation_safe_copy} to permit a more efficient code
16003 sequence to be generated.
16004
16005 @item -moutline-atomics
16006 @itemx -mno-outline-atomics
16007 Enable or disable calls to out-of-line helpers to implement atomic operations.
16008 These helpers will, at runtime, determine if the LSE instructions from
16009 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16010 instructions that are present in the base ARMv8.0 ISA.
16011
16012 This option is only applicable when compiling for the base ARMv8.0
16013 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
16014 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16015 used directly. The same applies when using @option{-mcpu=} when the
16016 selected cpu supports the @samp{lse} feature.
16017
16018 @item -march=@var{name}
16019 @opindex march
16020 Specify the name of the target architecture and, optionally, one or
16021 more feature modifiers. This option has the form
16022 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16023
16024 The permissible values for @var{arch} are @samp{armv8-a},
16025 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
16026 @samp{armv8.5-a} or @var{native}.
16027
16028 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
16029 support for the ARMv8.5-A architecture extensions.
16030
16031 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
16032 support for the ARMv8.4-A architecture extensions.
16033
16034 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
16035 support for the ARMv8.3-A architecture extensions.
16036
16037 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
16038 support for the ARMv8.2-A architecture extensions.
16039
16040 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
16041 support for the ARMv8.1-A architecture extension. In particular, it
16042 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
16043
16044 The value @samp{native} is available on native AArch64 GNU/Linux and
16045 causes the compiler to pick the architecture of the host system. This
16046 option has no effect if the compiler is unable to recognize the
16047 architecture of the host system,
16048
16049 The permissible values for @var{feature} are listed in the sub-section
16050 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16051 Feature Modifiers}. Where conflicting feature modifiers are
16052 specified, the right-most feature is used.
16053
16054 GCC uses @var{name} to determine what kind of instructions it can emit
16055 when generating assembly code. If @option{-march} is specified
16056 without either of @option{-mtune} or @option{-mcpu} also being
16057 specified, the code is tuned to perform well across a range of target
16058 processors implementing the target architecture.
16059
16060 @item -mtune=@var{name}
16061 @opindex mtune
16062 Specify the name of the target processor for which GCC should tune the
16063 performance of the code. Permissible values for this option are:
16064 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16065 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16066 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16067 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16068 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16069 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16070 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16071 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
16072 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16073 @samp{thunderxt83}, @samp{thunderx2t99},
16074 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16075 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16076 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16077 @samp{native}.
16078
16079 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16080 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16081 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16082 should tune for a big.LITTLE system.
16083
16084 Additionally on native AArch64 GNU/Linux systems the value
16085 @samp{native} tunes performance to the host system. This option has no effect
16086 if the compiler is unable to recognize the processor of the host system.
16087
16088 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16089 are specified, the code is tuned to perform well across a range
16090 of target processors.
16091
16092 This option cannot be suffixed by feature modifiers.
16093
16094 @item -mcpu=@var{name}
16095 @opindex mcpu
16096 Specify the name of the target processor, optionally suffixed by one
16097 or more feature modifiers. This option has the form
16098 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16099 the permissible values for @var{cpu} are the same as those available
16100 for @option{-mtune}. The permissible values for @var{feature} are
16101 documented in the sub-section on
16102 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16103 Feature Modifiers}. Where conflicting feature modifiers are
16104 specified, the right-most feature is used.
16105
16106 GCC uses @var{name} to determine what kind of instructions it can emit when
16107 generating assembly code (as if by @option{-march}) and to determine
16108 the target processor for which to tune for performance (as if
16109 by @option{-mtune}). Where this option is used in conjunction
16110 with @option{-march} or @option{-mtune}, those options take precedence
16111 over the appropriate part of this option.
16112
16113 @item -moverride=@var{string}
16114 @opindex moverride
16115 Override tuning decisions made by the back-end in response to a
16116 @option{-mtune=} switch. The syntax, semantics, and accepted values
16117 for @var{string} in this option are not guaranteed to be consistent
16118 across releases.
16119
16120 This option is only intended to be useful when developing GCC.
16121
16122 @item -mverbose-cost-dump
16123 @opindex mverbose-cost-dump
16124 Enable verbose cost model dumping in the debug dump files. This option is
16125 provided for use in debugging the compiler.
16126
16127 @item -mpc-relative-literal-loads
16128 @itemx -mno-pc-relative-literal-loads
16129 @opindex mpc-relative-literal-loads
16130 @opindex mno-pc-relative-literal-loads
16131 Enable or disable PC-relative literal loads. With this option literal pools are
16132 accessed using a single instruction and emitted after each function. This
16133 limits the maximum size of functions to 1MB. This is enabled by default for
16134 @option{-mcmodel=tiny}.
16135
16136 @item -msign-return-address=@var{scope}
16137 @opindex msign-return-address
16138 Select the function scope on which return address signing will be applied.
16139 Permissible values are @samp{none}, which disables return address signing,
16140 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16141 functions, and @samp{all}, which enables pointer signing for all functions. The
16142 default value is @samp{none}. This option has been deprecated by
16143 -mbranch-protection.
16144
16145 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16146 @opindex mbranch-protection
16147 Select the branch protection features to use.
16148 @samp{none} is the default and turns off all types of branch protection.
16149 @samp{standard} turns on all types of branch protection features. If a feature
16150 has additional tuning options, then @samp{standard} sets it to its standard
16151 level.
16152 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16153 level: signing functions that save the return address to memory (non-leaf
16154 functions will practically always do this) using the a-key. The optional
16155 argument @samp{leaf} can be used to extend the signing to include leaf
16156 functions. The optional argument @samp{b-key} can be used to sign the functions
16157 with the B-key instead of the A-key.
16158 @samp{bti} turns on branch target identification mechanism.
16159
16160 @item -msve-vector-bits=@var{bits}
16161 @opindex msve-vector-bits
16162 Specify the number of bits in an SVE vector register. This option only has
16163 an effect when SVE is enabled.
16164
16165 GCC supports two forms of SVE code generation: ``vector-length
16166 agnostic'' output that works with any size of vector register and
16167 ``vector-length specific'' output that allows GCC to make assumptions
16168 about the vector length when it is useful for optimization reasons.
16169 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16170 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16171 Specifying @samp{scalable} selects vector-length agnostic
16172 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16173 agnostic output. All other values generate vector-length specific code.
16174 The behavior of these values may change in future releases and no value except
16175 @samp{scalable} should be relied on for producing code that is portable across
16176 different hardware SVE vector lengths.
16177
16178 The default is @samp{-msve-vector-bits=scalable}, which produces
16179 vector-length agnostic code.
16180 @end table
16181
16182 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16183 @anchor{aarch64-feature-modifiers}
16184 @cindex @option{-march} feature modifiers
16185 @cindex @option{-mcpu} feature modifiers
16186 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16187 the following and their inverses @option{no@var{feature}}:
16188
16189 @table @samp
16190 @item crc
16191 Enable CRC extension. This is on by default for
16192 @option{-march=armv8.1-a}.
16193 @item crypto
16194 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16195 instructions.
16196 @item fp
16197 Enable floating-point instructions. This is on by default for all possible
16198 values for options @option{-march} and @option{-mcpu}.
16199 @item simd
16200 Enable Advanced SIMD instructions. This also enables floating-point
16201 instructions. This is on by default for all possible values for options
16202 @option{-march} and @option{-mcpu}.
16203 @item sve
16204 Enable Scalable Vector Extension instructions. This also enables Advanced
16205 SIMD and floating-point instructions.
16206 @item lse
16207 Enable Large System Extension instructions. This is on by default for
16208 @option{-march=armv8.1-a}.
16209 @item rdma
16210 Enable Round Double Multiply Accumulate instructions. This is on by default
16211 for @option{-march=armv8.1-a}.
16212 @item fp16
16213 Enable FP16 extension. This also enables floating-point instructions.
16214 @item fp16fml
16215 Enable FP16 fmla extension. This also enables FP16 extensions and
16216 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.
16217
16218 @item rcpc
16219 Enable the RcPc extension. This does not change code generation from GCC,
16220 but is passed on to the assembler, enabling inline asm statements to use
16221 instructions from the RcPc extension.
16222 @item dotprod
16223 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16224 @item aes
16225 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16226 SIMD instructions.
16227 @item sha2
16228 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16229 @item sha3
16230 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16231 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16232 @item sm4
16233 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16234 Use of this option with architectures prior to Armv8.2-A is not supported.
16235 @item profile
16236 Enable the Statistical Profiling extension. This option is only to enable the
16237 extension at the assembler level and does not affect code generation.
16238 @item rng
16239 Enable the Armv8.5-a Random Number instructions. This option is only to
16240 enable the extension at the assembler level and does not affect code
16241 generation.
16242 @item memtag
16243 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16244 enable the extension at the assembler level and does not affect code
16245 generation.
16246 @item sb
16247 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16248 enable the extension at the assembler level and does not affect code
16249 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16250 @item ssbs
16251 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16252 is only to enable the extension at the assembler level and does not affect code
16253 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16254 @item predres
16255 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16256 This option is only to enable the extension at the assembler level and does
16257 not affect code generation. This option is enabled by default for
16258 @item sve2
16259 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16260 instructions.
16261 @item sve2-bitperm
16262 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16263 @item sve2-sm4
16264 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16265 @item sve2-aes
16266 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16267 @item sve2-sha3
16268 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16269 @option{-march=armv8.5-a}.
16270 @item tme
16271 Enable the Transactional Memory Extension.
16272
16273 @end table
16274
16275 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16276 which implies @option{fp}.
16277 Conversely, @option{nofp} implies @option{nosimd}, which implies
16278 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16279
16280 @node Adapteva Epiphany Options
16281 @subsection Adapteva Epiphany Options
16282
16283 These @samp{-m} options are defined for Adapteva Epiphany:
16284
16285 @table @gcctabopt
16286 @item -mhalf-reg-file
16287 @opindex mhalf-reg-file
16288 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16289 That allows code to run on hardware variants that lack these registers.
16290
16291 @item -mprefer-short-insn-regs
16292 @opindex mprefer-short-insn-regs
16293 Preferentially allocate registers that allow short instruction generation.
16294 This can result in increased instruction count, so this may either reduce or
16295 increase overall code size.
16296
16297 @item -mbranch-cost=@var{num}
16298 @opindex mbranch-cost
16299 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16300 This cost is only a heuristic and is not guaranteed to produce
16301 consistent results across releases.
16302
16303 @item -mcmove
16304 @opindex mcmove
16305 Enable the generation of conditional moves.
16306
16307 @item -mnops=@var{num}
16308 @opindex mnops
16309 Emit @var{num} NOPs before every other generated instruction.
16310
16311 @item -mno-soft-cmpsf
16312 @opindex mno-soft-cmpsf
16313 @opindex msoft-cmpsf
16314 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16315 and test the flags. This is faster than a software comparison, but can
16316 get incorrect results in the presence of NaNs, or when two different small
16317 numbers are compared such that their difference is calculated as zero.
16318 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16319 software comparisons.
16320
16321 @item -mstack-offset=@var{num}
16322 @opindex mstack-offset
16323 Set the offset between the top of the stack and the stack pointer.
16324 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16325 can be used by leaf functions without stack allocation.
16326 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16327 Note also that this option changes the ABI; compiling a program with a
16328 different stack offset than the libraries have been compiled with
16329 generally does not work.
16330 This option can be useful if you want to evaluate if a different stack
16331 offset would give you better code, but to actually use a different stack
16332 offset to build working programs, it is recommended to configure the
16333 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16334
16335 @item -mno-round-nearest
16336 @opindex mno-round-nearest
16337 @opindex mround-nearest
16338 Make the scheduler assume that the rounding mode has been set to
16339 truncating. The default is @option{-mround-nearest}.
16340
16341 @item -mlong-calls
16342 @opindex mlong-calls
16343 If not otherwise specified by an attribute, assume all calls might be beyond
16344 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16345 function address into a register before performing a (otherwise direct) call.
16346 This is the default.
16347
16348 @item -mshort-calls
16349 @opindex short-calls
16350 If not otherwise specified by an attribute, assume all direct calls are
16351 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16352 for direct calls. The default is @option{-mlong-calls}.
16353
16354 @item -msmall16
16355 @opindex msmall16
16356 Assume addresses can be loaded as 16-bit unsigned values. This does not
16357 apply to function addresses for which @option{-mlong-calls} semantics
16358 are in effect.
16359
16360 @item -mfp-mode=@var{mode}
16361 @opindex mfp-mode
16362 Set the prevailing mode of the floating-point unit.
16363 This determines the floating-point mode that is provided and expected
16364 at function call and return time. Making this mode match the mode you
16365 predominantly need at function start can make your programs smaller and
16366 faster by avoiding unnecessary mode switches.
16367
16368 @var{mode} can be set to one the following values:
16369
16370 @table @samp
16371 @item caller
16372 Any mode at function entry is valid, and retained or restored when
16373 the function returns, and when it calls other functions.
16374 This mode is useful for compiling libraries or other compilation units
16375 you might want to incorporate into different programs with different
16376 prevailing FPU modes, and the convenience of being able to use a single
16377 object file outweighs the size and speed overhead for any extra
16378 mode switching that might be needed, compared with what would be needed
16379 with a more specific choice of prevailing FPU mode.
16380
16381 @item truncate
16382 This is the mode used for floating-point calculations with
16383 truncating (i.e.@: round towards zero) rounding mode. That includes
16384 conversion from floating point to integer.
16385
16386 @item round-nearest
16387 This is the mode used for floating-point calculations with
16388 round-to-nearest-or-even rounding mode.
16389
16390 @item int
16391 This is the mode used to perform integer calculations in the FPU, e.g.@:
16392 integer multiply, or integer multiply-and-accumulate.
16393 @end table
16394
16395 The default is @option{-mfp-mode=caller}
16396
16397 @item -mno-split-lohi
16398 @itemx -mno-postinc
16399 @itemx -mno-postmodify
16400 @opindex mno-split-lohi
16401 @opindex msplit-lohi
16402 @opindex mno-postinc
16403 @opindex mpostinc
16404 @opindex mno-postmodify
16405 @opindex mpostmodify
16406 Code generation tweaks that disable, respectively, splitting of 32-bit
16407 loads, generation of post-increment addresses, and generation of
16408 post-modify addresses. The defaults are @option{msplit-lohi},
16409 @option{-mpost-inc}, and @option{-mpost-modify}.
16410
16411 @item -mnovect-double
16412 @opindex mno-vect-double
16413 @opindex mvect-double
16414 Change the preferred SIMD mode to SImode. The default is
16415 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16416
16417 @item -max-vect-align=@var{num}
16418 @opindex max-vect-align
16419 The maximum alignment for SIMD vector mode types.
16420 @var{num} may be 4 or 8. The default is 8.
16421 Note that this is an ABI change, even though many library function
16422 interfaces are unaffected if they don't use SIMD vector modes
16423 in places that affect size and/or alignment of relevant types.
16424
16425 @item -msplit-vecmove-early
16426 @opindex msplit-vecmove-early
16427 Split vector moves into single word moves before reload. In theory this
16428 can give better register allocation, but so far the reverse seems to be
16429 generally the case.
16430
16431 @item -m1reg-@var{reg}
16432 @opindex m1reg-
16433 Specify a register to hold the constant @minus{}1, which makes loading small negative
16434 constants and certain bitmasks faster.
16435 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16436 which specify use of that register as a fixed register,
16437 and @samp{none}, which means that no register is used for this
16438 purpose. The default is @option{-m1reg-none}.
16439
16440 @end table
16441
16442 @node AMD GCN Options
16443 @subsection AMD GCN Options
16444 @cindex AMD GCN Options
16445
16446 These options are defined specifically for the AMD GCN port.
16447
16448 @table @gcctabopt
16449
16450 @item -march=@var{gpu}
16451 @opindex march
16452 @itemx -mtune=@var{gpu}
16453 @opindex mtune
16454 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16455 are
16456
16457 @table @samp
16458 @opindex fiji
16459 @item fiji
16460 Compile for GCN3 Fiji devices (gfx803).
16461
16462 @item gfx900
16463 Compile for GCN5 Vega 10 devices (gfx900).
16464
16465 @item gfx906
16466 Compile for GCN5 Vega 20 devices (gfx906).
16467
16468 @end table
16469
16470 @item -mstack-size=@var{bytes}
16471 @opindex mstack-size
16472 Specify how many @var{bytes} of stack space will be requested for each GPU
16473 thread (wave-front). Beware that there may be many threads and limited memory
16474 available. The size of the stack allocation may also have an impact on
16475 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16476 1MB otherwise.
16477
16478 @end table
16479
16480 @node ARC Options
16481 @subsection ARC Options
16482 @cindex ARC options
16483
16484 The following options control the architecture variant for which code
16485 is being compiled:
16486
16487 @c architecture variants
16488 @table @gcctabopt
16489
16490 @item -mbarrel-shifter
16491 @opindex mbarrel-shifter
16492 Generate instructions supported by barrel shifter. This is the default
16493 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16494
16495 @item -mjli-always
16496 @opindex mjli-alawys
16497 Force to call a function using jli_s instruction. This option is
16498 valid only for ARCv2 architecture.
16499
16500 @item -mcpu=@var{cpu}
16501 @opindex mcpu
16502 Set architecture type, register usage, and instruction scheduling
16503 parameters for @var{cpu}. There are also shortcut alias options
16504 available for backward compatibility and convenience. Supported
16505 values for @var{cpu} are
16506
16507 @table @samp
16508 @opindex mA6
16509 @opindex mARC600
16510 @item arc600
16511 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16512
16513 @item arc601
16514 @opindex mARC601
16515 Compile for ARC601. Alias: @option{-mARC601}.
16516
16517 @item arc700
16518 @opindex mA7
16519 @opindex mARC700
16520 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16521 This is the default when configured with @option{--with-cpu=arc700}@.
16522
16523 @item arcem
16524 Compile for ARC EM.
16525
16526 @item archs
16527 Compile for ARC HS.
16528
16529 @item em
16530 Compile for ARC EM CPU with no hardware extensions.
16531
16532 @item em4
16533 Compile for ARC EM4 CPU.
16534
16535 @item em4_dmips
16536 Compile for ARC EM4 DMIPS CPU.
16537
16538 @item em4_fpus
16539 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16540 extension.
16541
16542 @item em4_fpuda
16543 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16544 double assist instructions.
16545
16546 @item hs
16547 Compile for ARC HS CPU with no hardware extensions except the atomic
16548 instructions.
16549
16550 @item hs34
16551 Compile for ARC HS34 CPU.
16552
16553 @item hs38
16554 Compile for ARC HS38 CPU.
16555
16556 @item hs38_linux
16557 Compile for ARC HS38 CPU with all hardware extensions on.
16558
16559 @item arc600_norm
16560 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16561
16562 @item arc600_mul32x16
16563 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16564 instructions enabled.
16565
16566 @item arc600_mul64
16567 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16568 instructions enabled.
16569
16570 @item arc601_norm
16571 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16572
16573 @item arc601_mul32x16
16574 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16575 instructions enabled.
16576
16577 @item arc601_mul64
16578 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16579 instructions enabled.
16580
16581 @item nps400
16582 Compile for ARC 700 on NPS400 chip.
16583
16584 @item em_mini
16585 Compile for ARC EM minimalist configuration featuring reduced register
16586 set.
16587
16588 @end table
16589
16590 @item -mdpfp
16591 @opindex mdpfp
16592 @itemx -mdpfp-compact
16593 @opindex mdpfp-compact
16594 Generate double-precision FPX instructions, tuned for the compact
16595 implementation.
16596
16597 @item -mdpfp-fast
16598 @opindex mdpfp-fast
16599 Generate double-precision FPX instructions, tuned for the fast
16600 implementation.
16601
16602 @item -mno-dpfp-lrsr
16603 @opindex mno-dpfp-lrsr
16604 Disable @code{lr} and @code{sr} instructions from using FPX extension
16605 aux registers.
16606
16607 @item -mea
16608 @opindex mea
16609 Generate extended arithmetic instructions. Currently only
16610 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16611 supported. This is always enabled for @option{-mcpu=ARC700}.
16612
16613 @item -mno-mpy
16614 @opindex mno-mpy
16615 @opindex mmpy
16616 Do not generate @code{mpy}-family instructions for ARC700. This option is
16617 deprecated.
16618
16619 @item -mmul32x16
16620 @opindex mmul32x16
16621 Generate 32x16-bit multiply and multiply-accumulate instructions.
16622
16623 @item -mmul64
16624 @opindex mmul64
16625 Generate @code{mul64} and @code{mulu64} instructions.
16626 Only valid for @option{-mcpu=ARC600}.
16627
16628 @item -mnorm
16629 @opindex mnorm
16630 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16631 is in effect.
16632
16633 @item -mspfp
16634 @opindex mspfp
16635 @itemx -mspfp-compact
16636 @opindex mspfp-compact
16637 Generate single-precision FPX instructions, tuned for the compact
16638 implementation.
16639
16640 @item -mspfp-fast
16641 @opindex mspfp-fast
16642 Generate single-precision FPX instructions, tuned for the fast
16643 implementation.
16644
16645 @item -msimd
16646 @opindex msimd
16647 Enable generation of ARC SIMD instructions via target-specific
16648 builtins. Only valid for @option{-mcpu=ARC700}.
16649
16650 @item -msoft-float
16651 @opindex msoft-float
16652 This option ignored; it is provided for compatibility purposes only.
16653 Software floating-point code is emitted by default, and this default
16654 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16655 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16656 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16657
16658 @item -mswap
16659 @opindex mswap
16660 Generate @code{swap} instructions.
16661
16662 @item -matomic
16663 @opindex matomic
16664 This enables use of the locked load/store conditional extension to implement
16665 atomic memory built-in functions. Not available for ARC 6xx or ARC
16666 EM cores.
16667
16668 @item -mdiv-rem
16669 @opindex mdiv-rem
16670 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16671
16672 @item -mcode-density
16673 @opindex mcode-density
16674 Enable code density instructions for ARC EM.
16675 This option is on by default for ARC HS.
16676
16677 @item -mll64
16678 @opindex mll64
16679 Enable double load/store operations for ARC HS cores.
16680
16681 @item -mtp-regno=@var{regno}
16682 @opindex mtp-regno
16683 Specify thread pointer register number.
16684
16685 @item -mmpy-option=@var{multo}
16686 @opindex mmpy-option
16687 Compile ARCv2 code with a multiplier design option. You can specify
16688 the option using either a string or numeric value for @var{multo}.
16689 @samp{wlh1} is the default value. The recognized values are:
16690
16691 @table @samp
16692 @item 0
16693 @itemx none
16694 No multiplier available.
16695
16696 @item 1
16697 @itemx w
16698 16x16 multiplier, fully pipelined.
16699 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16700
16701 @item 2
16702 @itemx wlh1
16703 32x32 multiplier, fully
16704 pipelined (1 stage). The following instructions are additionally
16705 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16706
16707 @item 3
16708 @itemx wlh2
16709 32x32 multiplier, fully pipelined
16710 (2 stages). The following instructions are additionally enabled: @code{mpy},
16711 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16712
16713 @item 4
16714 @itemx wlh3
16715 Two 16x16 multipliers, blocking,
16716 sequential. The following instructions are additionally enabled: @code{mpy},
16717 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16718
16719 @item 5
16720 @itemx wlh4
16721 One 16x16 multiplier, blocking,
16722 sequential. The following instructions are additionally enabled: @code{mpy},
16723 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16724
16725 @item 6
16726 @itemx wlh5
16727 One 32x4 multiplier, blocking,
16728 sequential. The following instructions are additionally enabled: @code{mpy},
16729 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16730
16731 @item 7
16732 @itemx plus_dmpy
16733 ARC HS SIMD support.
16734
16735 @item 8
16736 @itemx plus_macd
16737 ARC HS SIMD support.
16738
16739 @item 9
16740 @itemx plus_qmacw
16741 ARC HS SIMD support.
16742
16743 @end table
16744
16745 This option is only available for ARCv2 cores@.
16746
16747 @item -mfpu=@var{fpu}
16748 @opindex mfpu
16749 Enables support for specific floating-point hardware extensions for ARCv2
16750 cores. Supported values for @var{fpu} are:
16751
16752 @table @samp
16753
16754 @item fpus
16755 Enables support for single-precision floating-point hardware
16756 extensions@.
16757
16758 @item fpud
16759 Enables support for double-precision floating-point hardware
16760 extensions. The single-precision floating-point extension is also
16761 enabled. Not available for ARC EM@.
16762
16763 @item fpuda
16764 Enables support for double-precision floating-point hardware
16765 extensions using double-precision assist instructions. The single-precision
16766 floating-point extension is also enabled. This option is
16767 only available for ARC EM@.
16768
16769 @item fpuda_div
16770 Enables support for double-precision floating-point hardware
16771 extensions using double-precision assist instructions.
16772 The single-precision floating-point, square-root, and divide
16773 extensions are also enabled. This option is
16774 only available for ARC EM@.
16775
16776 @item fpuda_fma
16777 Enables support for double-precision floating-point hardware
16778 extensions using double-precision assist instructions.
16779 The single-precision floating-point and fused multiply and add
16780 hardware extensions are also enabled. This option is
16781 only available for ARC EM@.
16782
16783 @item fpuda_all
16784 Enables support for double-precision floating-point hardware
16785 extensions using double-precision assist instructions.
16786 All single-precision floating-point hardware extensions are also
16787 enabled. This option is only available for ARC EM@.
16788
16789 @item fpus_div
16790 Enables support for single-precision floating-point, square-root and divide
16791 hardware extensions@.
16792
16793 @item fpud_div
16794 Enables support for double-precision floating-point, square-root and divide
16795 hardware extensions. This option
16796 includes option @samp{fpus_div}. Not available for ARC EM@.
16797
16798 @item fpus_fma
16799 Enables support for single-precision floating-point and
16800 fused multiply and add hardware extensions@.
16801
16802 @item fpud_fma
16803 Enables support for double-precision floating-point and
16804 fused multiply and add hardware extensions. This option
16805 includes option @samp{fpus_fma}. Not available for ARC EM@.
16806
16807 @item fpus_all
16808 Enables support for all single-precision floating-point hardware
16809 extensions@.
16810
16811 @item fpud_all
16812 Enables support for all single- and double-precision floating-point
16813 hardware extensions. Not available for ARC EM@.
16814
16815 @end table
16816
16817 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16818 @opindex mirq-ctrl-saved
16819 Specifies general-purposes registers that the processor automatically
16820 saves/restores on interrupt entry and exit. @var{register-range} is
16821 specified as two registers separated by a dash. The register range
16822 always starts with @code{r0}, the upper limit is @code{fp} register.
16823 @var{blink} and @var{lp_count} are optional. This option is only
16824 valid for ARC EM and ARC HS cores.
16825
16826 @item -mrgf-banked-regs=@var{number}
16827 @opindex mrgf-banked-regs
16828 Specifies the number of registers replicated in second register bank
16829 on entry to fast interrupt. Fast interrupts are interrupts with the
16830 highest priority level P0. These interrupts save only PC and STATUS32
16831 registers to avoid memory transactions during interrupt entry and exit
16832 sequences. Use this option when you are using fast interrupts in an
16833 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16834
16835 @item -mlpc-width=@var{width}
16836 @opindex mlpc-width
16837 Specify the width of the @code{lp_count} register. Valid values for
16838 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16839 fixed to 32 bits. If the width is less than 32, the compiler does not
16840 attempt to transform loops in your program to use the zero-delay loop
16841 mechanism unless it is known that the @code{lp_count} register can
16842 hold the required loop-counter value. Depending on the width
16843 specified, the compiler and run-time library might continue to use the
16844 loop mechanism for various needs. This option defines macro
16845 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16846
16847 @item -mrf16
16848 @opindex mrf16
16849 This option instructs the compiler to generate code for a 16-entry
16850 register file. This option defines the @code{__ARC_RF16__}
16851 preprocessor macro.
16852
16853 @item -mbranch-index
16854 @opindex mbranch-index
16855 Enable use of @code{bi} or @code{bih} instructions to implement jump
16856 tables.
16857
16858 @end table
16859
16860 The following options are passed through to the assembler, and also
16861 define preprocessor macro symbols.
16862
16863 @c Flags used by the assembler, but for which we define preprocessor
16864 @c macro symbols as well.
16865 @table @gcctabopt
16866 @item -mdsp-packa
16867 @opindex mdsp-packa
16868 Passed down to the assembler to enable the DSP Pack A extensions.
16869 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16870 deprecated.
16871
16872 @item -mdvbf
16873 @opindex mdvbf
16874 Passed down to the assembler to enable the dual Viterbi butterfly
16875 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16876 option is deprecated.
16877
16878 @c ARC700 4.10 extension instruction
16879 @item -mlock
16880 @opindex mlock
16881 Passed down to the assembler to enable the locked load/store
16882 conditional extension. Also sets the preprocessor symbol
16883 @code{__Xlock}.
16884
16885 @item -mmac-d16
16886 @opindex mmac-d16
16887 Passed down to the assembler. Also sets the preprocessor symbol
16888 @code{__Xxmac_d16}. This option is deprecated.
16889
16890 @item -mmac-24
16891 @opindex mmac-24
16892 Passed down to the assembler. Also sets the preprocessor symbol
16893 @code{__Xxmac_24}. This option is deprecated.
16894
16895 @c ARC700 4.10 extension instruction
16896 @item -mrtsc
16897 @opindex mrtsc
16898 Passed down to the assembler to enable the 64-bit time-stamp counter
16899 extension instruction. Also sets the preprocessor symbol
16900 @code{__Xrtsc}. This option is deprecated.
16901
16902 @c ARC700 4.10 extension instruction
16903 @item -mswape
16904 @opindex mswape
16905 Passed down to the assembler to enable the swap byte ordering
16906 extension instruction. Also sets the preprocessor symbol
16907 @code{__Xswape}.
16908
16909 @item -mtelephony
16910 @opindex mtelephony
16911 Passed down to the assembler to enable dual- and single-operand
16912 instructions for telephony. Also sets the preprocessor symbol
16913 @code{__Xtelephony}. This option is deprecated.
16914
16915 @item -mxy
16916 @opindex mxy
16917 Passed down to the assembler to enable the XY memory extension. Also
16918 sets the preprocessor symbol @code{__Xxy}.
16919
16920 @end table
16921
16922 The following options control how the assembly code is annotated:
16923
16924 @c Assembly annotation options
16925 @table @gcctabopt
16926 @item -misize
16927 @opindex misize
16928 Annotate assembler instructions with estimated addresses.
16929
16930 @item -mannotate-align
16931 @opindex mannotate-align
16932 Explain what alignment considerations lead to the decision to make an
16933 instruction short or long.
16934
16935 @end table
16936
16937 The following options are passed through to the linker:
16938
16939 @c options passed through to the linker
16940 @table @gcctabopt
16941 @item -marclinux
16942 @opindex marclinux
16943 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16944 This option is enabled by default in tool chains built for
16945 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16946 when profiling is not requested.
16947
16948 @item -marclinux_prof
16949 @opindex marclinux_prof
16950 Passed through to the linker, to specify use of the
16951 @code{arclinux_prof} emulation. This option is enabled by default in
16952 tool chains built for @w{@code{arc-linux-uclibc}} and
16953 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16954
16955 @end table
16956
16957 The following options control the semantics of generated code:
16958
16959 @c semantically relevant code generation options
16960 @table @gcctabopt
16961 @item -mlong-calls
16962 @opindex mlong-calls
16963 Generate calls as register indirect calls, thus providing access
16964 to the full 32-bit address range.
16965
16966 @item -mmedium-calls
16967 @opindex mmedium-calls
16968 Don't use less than 25-bit addressing range for calls, which is the
16969 offset available for an unconditional branch-and-link
16970 instruction. Conditional execution of function calls is suppressed, to
16971 allow use of the 25-bit range, rather than the 21-bit range with
16972 conditional branch-and-link. This is the default for tool chains built
16973 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16974
16975 @item -G @var{num}
16976 @opindex G
16977 Put definitions of externally-visible data in a small data section if
16978 that data is no bigger than @var{num} bytes. The default value of
16979 @var{num} is 4 for any ARC configuration, or 8 when we have double
16980 load/store operations.
16981
16982 @item -mno-sdata
16983 @opindex mno-sdata
16984 @opindex msdata
16985 Do not generate sdata references. This is the default for tool chains
16986 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16987 targets.
16988
16989 @item -mvolatile-cache
16990 @opindex mvolatile-cache
16991 Use ordinarily cached memory accesses for volatile references. This is the
16992 default.
16993
16994 @item -mno-volatile-cache
16995 @opindex mno-volatile-cache
16996 @opindex mvolatile-cache
16997 Enable cache bypass for volatile references.
16998
16999 @end table
17000
17001 The following options fine tune code generation:
17002 @c code generation tuning options
17003 @table @gcctabopt
17004 @item -malign-call
17005 @opindex malign-call
17006 Do alignment optimizations for call instructions.
17007
17008 @item -mauto-modify-reg
17009 @opindex mauto-modify-reg
17010 Enable the use of pre/post modify with register displacement.
17011
17012 @item -mbbit-peephole
17013 @opindex mbbit-peephole
17014 Enable bbit peephole2.
17015
17016 @item -mno-brcc
17017 @opindex mno-brcc
17018 This option disables a target-specific pass in @file{arc_reorg} to
17019 generate compare-and-branch (@code{br@var{cc}}) instructions.
17020 It has no effect on
17021 generation of these instructions driven by the combiner pass.
17022
17023 @item -mcase-vector-pcrel
17024 @opindex mcase-vector-pcrel
17025 Use PC-relative switch case tables to enable case table shortening.
17026 This is the default for @option{-Os}.
17027
17028 @item -mcompact-casesi
17029 @opindex mcompact-casesi
17030 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
17031 and only available for ARCv1 cores. This option is deprecated.
17032
17033 @item -mno-cond-exec
17034 @opindex mno-cond-exec
17035 Disable the ARCompact-specific pass to generate conditional
17036 execution instructions.
17037
17038 Due to delay slot scheduling and interactions between operand numbers,
17039 literal sizes, instruction lengths, and the support for conditional execution,
17040 the target-independent pass to generate conditional execution is often lacking,
17041 so the ARC port has kept a special pass around that tries to find more
17042 conditional execution generation opportunities after register allocation,
17043 branch shortening, and delay slot scheduling have been done. This pass
17044 generally, but not always, improves performance and code size, at the cost of
17045 extra compilation time, which is why there is an option to switch it off.
17046 If you have a problem with call instructions exceeding their allowable
17047 offset range because they are conditionalized, you should consider using
17048 @option{-mmedium-calls} instead.
17049
17050 @item -mearly-cbranchsi
17051 @opindex mearly-cbranchsi
17052 Enable pre-reload use of the @code{cbranchsi} pattern.
17053
17054 @item -mexpand-adddi
17055 @opindex mexpand-adddi
17056 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17057 @code{add.f}, @code{adc} etc. This option is deprecated.
17058
17059 @item -mindexed-loads
17060 @opindex mindexed-loads
17061 Enable the use of indexed loads. This can be problematic because some
17062 optimizers then assume that indexed stores exist, which is not
17063 the case.
17064
17065 @item -mlra
17066 @opindex mlra
17067 Enable Local Register Allocation. This is still experimental for ARC,
17068 so by default the compiler uses standard reload
17069 (i.e.@: @option{-mno-lra}).
17070
17071 @item -mlra-priority-none
17072 @opindex mlra-priority-none
17073 Don't indicate any priority for target registers.
17074
17075 @item -mlra-priority-compact
17076 @opindex mlra-priority-compact
17077 Indicate target register priority for r0..r3 / r12..r15.
17078
17079 @item -mlra-priority-noncompact
17080 @opindex mlra-priority-noncompact
17081 Reduce target register priority for r0..r3 / r12..r15.
17082
17083 @item -mmillicode
17084 @opindex mmillicode
17085 When optimizing for size (using @option{-Os}), prologues and epilogues
17086 that have to save or restore a large number of registers are often
17087 shortened by using call to a special function in libgcc; this is
17088 referred to as a @emph{millicode} call. As these calls can pose
17089 performance issues, and/or cause linking issues when linking in a
17090 nonstandard way, this option is provided to turn on or off millicode
17091 call generation.
17092
17093 @item -mcode-density-frame
17094 @opindex mcode-density-frame
17095 This option enable the compiler to emit @code{enter} and @code{leave}
17096 instructions. These instructions are only valid for CPUs with
17097 code-density feature.
17098
17099 @item -mmixed-code
17100 @opindex mmixed-code
17101 Tweak register allocation to help 16-bit instruction generation.
17102 This generally has the effect of decreasing the average instruction size
17103 while increasing the instruction count.
17104
17105 @item -mq-class
17106 @opindex mq-class
17107 Enable @samp{q} instruction alternatives.
17108 This is the default for @option{-Os}.
17109
17110 @item -mRcq
17111 @opindex mRcq
17112 Enable @samp{Rcq} constraint handling.
17113 Most short code generation depends on this.
17114 This is the default.
17115
17116 @item -mRcw
17117 @opindex mRcw
17118 Enable @samp{Rcw} constraint handling.
17119 Most ccfsm condexec mostly depends on this.
17120 This is the default.
17121
17122 @item -msize-level=@var{level}
17123 @opindex msize-level
17124 Fine-tune size optimization with regards to instruction lengths and alignment.
17125 The recognized values for @var{level} are:
17126 @table @samp
17127 @item 0
17128 No size optimization. This level is deprecated and treated like @samp{1}.
17129
17130 @item 1
17131 Short instructions are used opportunistically.
17132
17133 @item 2
17134 In addition, alignment of loops and of code after barriers are dropped.
17135
17136 @item 3
17137 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17138
17139 @end table
17140
17141 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17142 the behavior when this is not set is equivalent to level @samp{1}.
17143
17144 @item -mtune=@var{cpu}
17145 @opindex mtune
17146 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17147 by @option{-mcpu=}.
17148
17149 Supported values for @var{cpu} are
17150
17151 @table @samp
17152 @item ARC600
17153 Tune for ARC600 CPU.
17154
17155 @item ARC601
17156 Tune for ARC601 CPU.
17157
17158 @item ARC700
17159 Tune for ARC700 CPU with standard multiplier block.
17160
17161 @item ARC700-xmac
17162 Tune for ARC700 CPU with XMAC block.
17163
17164 @item ARC725D
17165 Tune for ARC725D CPU.
17166
17167 @item ARC750D
17168 Tune for ARC750D CPU.
17169
17170 @end table
17171
17172 @item -mmultcost=@var{num}
17173 @opindex mmultcost
17174 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17175 normal instruction.
17176
17177 @item -munalign-prob-threshold=@var{probability}
17178 @opindex munalign-prob-threshold
17179 Set probability threshold for unaligning branches.
17180 When tuning for @samp{ARC700} and optimizing for speed, branches without
17181 filled delay slot are preferably emitted unaligned and long, unless
17182 profiling indicates that the probability for the branch to be taken
17183 is below @var{probability}. @xref{Cross-profiling}.
17184 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17185
17186 @end table
17187
17188 The following options are maintained for backward compatibility, but
17189 are now deprecated and will be removed in a future release:
17190
17191 @c Deprecated options
17192 @table @gcctabopt
17193
17194 @item -margonaut
17195 @opindex margonaut
17196 Obsolete FPX.
17197
17198 @item -mbig-endian
17199 @opindex mbig-endian
17200 @itemx -EB
17201 @opindex EB
17202 Compile code for big-endian targets. Use of these options is now
17203 deprecated. Big-endian code is supported by configuring GCC to build
17204 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17205 for which big endian is the default.
17206
17207 @item -mlittle-endian
17208 @opindex mlittle-endian
17209 @itemx -EL
17210 @opindex EL
17211 Compile code for little-endian targets. Use of these options is now
17212 deprecated. Little-endian code is supported by configuring GCC to build
17213 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17214 for which little endian is the default.
17215
17216 @item -mbarrel_shifter
17217 @opindex mbarrel_shifter
17218 Replaced by @option{-mbarrel-shifter}.
17219
17220 @item -mdpfp_compact
17221 @opindex mdpfp_compact
17222 Replaced by @option{-mdpfp-compact}.
17223
17224 @item -mdpfp_fast
17225 @opindex mdpfp_fast
17226 Replaced by @option{-mdpfp-fast}.
17227
17228 @item -mdsp_packa
17229 @opindex mdsp_packa
17230 Replaced by @option{-mdsp-packa}.
17231
17232 @item -mEA
17233 @opindex mEA
17234 Replaced by @option{-mea}.
17235
17236 @item -mmac_24
17237 @opindex mmac_24
17238 Replaced by @option{-mmac-24}.
17239
17240 @item -mmac_d16
17241 @opindex mmac_d16
17242 Replaced by @option{-mmac-d16}.
17243
17244 @item -mspfp_compact
17245 @opindex mspfp_compact
17246 Replaced by @option{-mspfp-compact}.
17247
17248 @item -mspfp_fast
17249 @opindex mspfp_fast
17250 Replaced by @option{-mspfp-fast}.
17251
17252 @item -mtune=@var{cpu}
17253 @opindex mtune
17254 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17255 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17256 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17257
17258 @item -multcost=@var{num}
17259 @opindex multcost
17260 Replaced by @option{-mmultcost}.
17261
17262 @end table
17263
17264 @node ARM Options
17265 @subsection ARM Options
17266 @cindex ARM options
17267
17268 These @samp{-m} options are defined for the ARM port:
17269
17270 @table @gcctabopt
17271 @item -mabi=@var{name}
17272 @opindex mabi
17273 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17274 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17275
17276 @item -mapcs-frame
17277 @opindex mapcs-frame
17278 Generate a stack frame that is compliant with the ARM Procedure Call
17279 Standard for all functions, even if this is not strictly necessary for
17280 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17281 with this option causes the stack frames not to be generated for
17282 leaf functions. The default is @option{-mno-apcs-frame}.
17283 This option is deprecated.
17284
17285 @item -mapcs
17286 @opindex mapcs
17287 This is a synonym for @option{-mapcs-frame} and is deprecated.
17288
17289 @ignore
17290 @c not currently implemented
17291 @item -mapcs-stack-check
17292 @opindex mapcs-stack-check
17293 Generate code to check the amount of stack space available upon entry to
17294 every function (that actually uses some stack space). If there is
17295 insufficient space available then either the function
17296 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17297 called, depending upon the amount of stack space required. The runtime
17298 system is required to provide these functions. The default is
17299 @option{-mno-apcs-stack-check}, since this produces smaller code.
17300
17301 @c not currently implemented
17302 @item -mapcs-reentrant
17303 @opindex mapcs-reentrant
17304 Generate reentrant, position-independent code. The default is
17305 @option{-mno-apcs-reentrant}.
17306 @end ignore
17307
17308 @item -mthumb-interwork
17309 @opindex mthumb-interwork
17310 Generate code that supports calling between the ARM and Thumb
17311 instruction sets. Without this option, on pre-v5 architectures, the
17312 two instruction sets cannot be reliably used inside one program. The
17313 default is @option{-mno-thumb-interwork}, since slightly larger code
17314 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17315 configurations this option is meaningless.
17316
17317 @item -mno-sched-prolog
17318 @opindex mno-sched-prolog
17319 @opindex msched-prolog
17320 Prevent the reordering of instructions in the function prologue, or the
17321 merging of those instruction with the instructions in the function's
17322 body. This means that all functions start with a recognizable set
17323 of instructions (or in fact one of a choice from a small set of
17324 different function prologues), and this information can be used to
17325 locate the start of functions inside an executable piece of code. The
17326 default is @option{-msched-prolog}.
17327
17328 @item -mfloat-abi=@var{name}
17329 @opindex mfloat-abi
17330 Specifies which floating-point ABI to use. Permissible values
17331 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17332
17333 Specifying @samp{soft} causes GCC to generate output containing
17334 library calls for floating-point operations.
17335 @samp{softfp} allows the generation of code using hardware floating-point
17336 instructions, but still uses the soft-float calling conventions.
17337 @samp{hard} allows generation of floating-point instructions
17338 and uses FPU-specific calling conventions.
17339
17340 The default depends on the specific target configuration. Note that
17341 the hard-float and soft-float ABIs are not link-compatible; you must
17342 compile your entire program with the same ABI, and link with a
17343 compatible set of libraries.
17344
17345 @item -mgeneral-regs-only
17346 @opindex mgeneral-regs-only
17347 Generate code which uses only the general-purpose registers. This will prevent
17348 the compiler from using floating-point and Advanced SIMD registers but will not
17349 impose any restrictions on the assembler.
17350
17351 @item -mlittle-endian
17352 @opindex mlittle-endian
17353 Generate code for a processor running in little-endian mode. This is
17354 the default for all standard configurations.
17355
17356 @item -mbig-endian
17357 @opindex mbig-endian
17358 Generate code for a processor running in big-endian mode; the default is
17359 to compile code for a little-endian processor.
17360
17361 @item -mbe8
17362 @itemx -mbe32
17363 @opindex mbe8
17364 When linking a big-endian image select between BE8 and BE32 formats.
17365 The option has no effect for little-endian images and is ignored. The
17366 default is dependent on the selected target architecture. For ARMv6
17367 and later architectures the default is BE8, for older architectures
17368 the default is BE32. BE32 format has been deprecated by ARM.
17369
17370 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17371 @opindex march
17372 This specifies the name of the target ARM architecture. GCC uses this
17373 name to determine what kind of instructions it can emit when generating
17374 assembly code. This option can be used in conjunction with or instead
17375 of the @option{-mcpu=} option.
17376
17377 Permissible names are:
17378 @samp{armv4t},
17379 @samp{armv5t}, @samp{armv5te},
17380 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17381 @samp{armv6z}, @samp{armv6zk},
17382 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17383 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17384 @samp{armv8.4-a},
17385 @samp{armv8.5-a},
17386 @samp{armv7-r},
17387 @samp{armv8-r},
17388 @samp{armv6-m}, @samp{armv6s-m},
17389 @samp{armv7-m}, @samp{armv7e-m},
17390 @samp{armv8-m.base}, @samp{armv8-m.main},
17391 @samp{iwmmxt} and @samp{iwmmxt2}.
17392
17393 Additionally, the following architectures, which lack support for the
17394 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17395
17396 Many of the architectures support extensions. These can be added by
17397 appending @samp{+@var{extension}} to the architecture name. Extension
17398 options are processed in order and capabilities accumulate. An extension
17399 will also enable any necessary base extensions
17400 upon which it depends. For example, the @samp{+crypto} extension
17401 will always enable the @samp{+simd} extension. The exception to the
17402 additive construction is for extensions that are prefixed with
17403 @samp{+no@dots{}}: these extensions disable the specified option and
17404 any other extensions that may depend on the presence of that
17405 extension.
17406
17407 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17408 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17409 entirely disabled by the @samp{+nofp} option that follows it.
17410
17411 Most extension names are generically named, but have an effect that is
17412 dependent upon the architecture to which it is applied. For example,
17413 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17414 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17415 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17416 variant for @samp{armv8-a}.
17417
17418 The table below lists the supported extensions for each architecture.
17419 Architectures not mentioned do not support any extensions.
17420
17421 @table @samp
17422 @item armv5te
17423 @itemx armv6
17424 @itemx armv6j
17425 @itemx armv6k
17426 @itemx armv6kz
17427 @itemx armv6t2
17428 @itemx armv6z
17429 @itemx armv6zk
17430 @table @samp
17431 @item +fp
17432 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17433 used as an alias for this extension.
17434
17435 @item +nofp
17436 Disable the floating-point instructions.
17437 @end table
17438
17439 @item armv7
17440 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17441 @table @samp
17442 @item +fp
17443 The VFPv3 floating-point instructions, with 16 double-precision
17444 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17445 for this extension. Note that floating-point is not supported by the
17446 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17447 ARMv7-R architectures.
17448
17449 @item +nofp
17450 Disable the floating-point instructions.
17451 @end table
17452
17453 @item armv7-a
17454 @table @samp
17455 @item +mp
17456 The multiprocessing extension.
17457
17458 @item +sec
17459 The security extension.
17460
17461 @item +fp
17462 The VFPv3 floating-point instructions, with 16 double-precision
17463 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17464 for this extension.
17465
17466 @item +simd
17467 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17468 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17469 for this extension.
17470
17471 @item +vfpv3
17472 The VFPv3 floating-point instructions, with 32 double-precision
17473 registers.
17474
17475 @item +vfpv3-d16-fp16
17476 The VFPv3 floating-point instructions, with 16 double-precision
17477 registers and the half-precision floating-point conversion operations.
17478
17479 @item +vfpv3-fp16
17480 The VFPv3 floating-point instructions, with 32 double-precision
17481 registers and the half-precision floating-point conversion operations.
17482
17483 @item +vfpv4-d16
17484 The VFPv4 floating-point instructions, with 16 double-precision
17485 registers.
17486
17487 @item +vfpv4
17488 The VFPv4 floating-point instructions, with 32 double-precision
17489 registers.
17490
17491 @item +neon-fp16
17492 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17493 the half-precision floating-point conversion operations.
17494
17495 @item +neon-vfpv4
17496 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17497
17498 @item +nosimd
17499 Disable the Advanced SIMD instructions (does not disable floating point).
17500
17501 @item +nofp
17502 Disable the floating-point and Advanced SIMD instructions.
17503 @end table
17504
17505 @item armv7ve
17506 The extended version of the ARMv7-A architecture with support for
17507 virtualization.
17508 @table @samp
17509 @item +fp
17510 The VFPv4 floating-point instructions, with 16 double-precision registers.
17511 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17512
17513 @item +simd
17514 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17515 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17516
17517 @item +vfpv3-d16
17518 The VFPv3 floating-point instructions, with 16 double-precision
17519 registers.
17520
17521 @item +vfpv3
17522 The VFPv3 floating-point instructions, with 32 double-precision
17523 registers.
17524
17525 @item +vfpv3-d16-fp16
17526 The VFPv3 floating-point instructions, with 16 double-precision
17527 registers and the half-precision floating-point conversion operations.
17528
17529 @item +vfpv3-fp16
17530 The VFPv3 floating-point instructions, with 32 double-precision
17531 registers and the half-precision floating-point conversion operations.
17532
17533 @item +vfpv4-d16
17534 The VFPv4 floating-point instructions, with 16 double-precision
17535 registers.
17536
17537 @item +vfpv4
17538 The VFPv4 floating-point instructions, with 32 double-precision
17539 registers.
17540
17541 @item +neon
17542 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17543 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17544
17545 @item +neon-fp16
17546 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17547 the half-precision floating-point conversion operations.
17548
17549 @item +nosimd
17550 Disable the Advanced SIMD instructions (does not disable floating point).
17551
17552 @item +nofp
17553 Disable the floating-point and Advanced SIMD instructions.
17554 @end table
17555
17556 @item armv8-a
17557 @table @samp
17558 @item +crc
17559 The Cyclic Redundancy Check (CRC) instructions.
17560 @item +simd
17561 The ARMv8-A Advanced SIMD and floating-point instructions.
17562 @item +crypto
17563 The cryptographic instructions.
17564 @item +nocrypto
17565 Disable the cryptographic instructions.
17566 @item +nofp
17567 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17568 @item +sb
17569 Speculation Barrier Instruction.
17570 @item +predres
17571 Execution and Data Prediction Restriction Instructions.
17572 @end table
17573
17574 @item armv8.1-a
17575 @table @samp
17576 @item +simd
17577 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17578
17579 @item +crypto
17580 The cryptographic instructions. This also enables the Advanced SIMD and
17581 floating-point instructions.
17582
17583 @item +nocrypto
17584 Disable the cryptographic instructions.
17585
17586 @item +nofp
17587 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17588
17589 @item +sb
17590 Speculation Barrier Instruction.
17591
17592 @item +predres
17593 Execution and Data Prediction Restriction Instructions.
17594 @end table
17595
17596 @item armv8.2-a
17597 @itemx armv8.3-a
17598 @table @samp
17599 @item +fp16
17600 The half-precision floating-point data processing instructions.
17601 This also enables the Advanced SIMD and floating-point instructions.
17602
17603 @item +fp16fml
17604 The half-precision floating-point fmla extension. This also enables
17605 the half-precision floating-point extension and Advanced SIMD and
17606 floating-point instructions.
17607
17608 @item +simd
17609 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17610
17611 @item +crypto
17612 The cryptographic instructions. This also enables the Advanced SIMD and
17613 floating-point instructions.
17614
17615 @item +dotprod
17616 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17617
17618 @item +nocrypto
17619 Disable the cryptographic extension.
17620
17621 @item +nofp
17622 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17623
17624 @item +sb
17625 Speculation Barrier Instruction.
17626
17627 @item +predres
17628 Execution and Data Prediction Restriction Instructions.
17629 @end table
17630
17631 @item armv8.4-a
17632 @table @samp
17633 @item +fp16
17634 The half-precision floating-point data processing instructions.
17635 This also enables the Advanced SIMD and floating-point instructions as well
17636 as the Dot Product extension and the half-precision floating-point fmla
17637 extension.
17638
17639 @item +simd
17640 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17641 Dot Product extension.
17642
17643 @item +crypto
17644 The cryptographic instructions. This also enables the Advanced SIMD and
17645 floating-point instructions as well as the Dot Product extension.
17646
17647 @item +nocrypto
17648 Disable the cryptographic extension.
17649
17650 @item +nofp
17651 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17652
17653 @item +sb
17654 Speculation Barrier Instruction.
17655
17656 @item +predres
17657 Execution and Data Prediction Restriction Instructions.
17658 @end table
17659
17660 @item armv8.5-a
17661 @table @samp
17662 @item +fp16
17663 The half-precision floating-point data processing instructions.
17664 This also enables the Advanced SIMD and floating-point instructions as well
17665 as the Dot Product extension and the half-precision floating-point fmla
17666 extension.
17667
17668 @item +simd
17669 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17670 Dot Product extension.
17671
17672 @item +crypto
17673 The cryptographic instructions. This also enables the Advanced SIMD and
17674 floating-point instructions as well as the Dot Product extension.
17675
17676 @item +nocrypto
17677 Disable the cryptographic extension.
17678
17679 @item +nofp
17680 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17681 @end table
17682
17683 @item armv7-r
17684 @table @samp
17685 @item +fp.sp
17686 The single-precision VFPv3 floating-point instructions. The extension
17687 @samp{+vfpv3xd} can be used as an alias for this extension.
17688
17689 @item +fp
17690 The VFPv3 floating-point instructions with 16 double-precision registers.
17691 The extension +vfpv3-d16 can be used as an alias for this extension.
17692
17693 @item +vfpv3xd-d16-fp16
17694 The single-precision VFPv3 floating-point instructions with 16 double-precision
17695 registers and the half-precision floating-point conversion operations.
17696
17697 @item +vfpv3-d16-fp16
17698 The VFPv3 floating-point instructions with 16 double-precision
17699 registers and the half-precision floating-point conversion operations.
17700
17701 @item +nofp
17702 Disable the floating-point extension.
17703
17704 @item +idiv
17705 The ARM-state integer division instructions.
17706
17707 @item +noidiv
17708 Disable the ARM-state integer division extension.
17709 @end table
17710
17711 @item armv7e-m
17712 @table @samp
17713 @item +fp
17714 The single-precision VFPv4 floating-point instructions.
17715
17716 @item +fpv5
17717 The single-precision FPv5 floating-point instructions.
17718
17719 @item +fp.dp
17720 The single- and double-precision FPv5 floating-point instructions.
17721
17722 @item +nofp
17723 Disable the floating-point extensions.
17724 @end table
17725
17726 @item armv8-m.main
17727 @table @samp
17728 @item +dsp
17729 The DSP instructions.
17730
17731 @item +nodsp
17732 Disable the DSP extension.
17733
17734 @item +fp
17735 The single-precision floating-point instructions.
17736
17737 @item +fp.dp
17738 The single- and double-precision floating-point instructions.
17739
17740 @item +nofp
17741 Disable the floating-point extension.
17742 @end table
17743
17744 @item armv8-r
17745 @table @samp
17746 @item +crc
17747 The Cyclic Redundancy Check (CRC) instructions.
17748 @item +fp.sp
17749 The single-precision FPv5 floating-point instructions.
17750 @item +simd
17751 The ARMv8-A Advanced SIMD and floating-point instructions.
17752 @item +crypto
17753 The cryptographic instructions.
17754 @item +nocrypto
17755 Disable the cryptographic instructions.
17756 @item +nofp
17757 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17758 @end table
17759
17760 @end table
17761
17762 @option{-march=native} causes the compiler to auto-detect the architecture
17763 of the build computer. At present, this feature is only supported on
17764 GNU/Linux, and not all architectures are recognized. If the auto-detect
17765 is unsuccessful the option has no effect.
17766
17767 @item -mtune=@var{name}
17768 @opindex mtune
17769 This option specifies the name of the target ARM processor for
17770 which GCC should tune the performance of the code.
17771 For some ARM implementations better performance can be obtained by using
17772 this option.
17773 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17774 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17775 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17776 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17777 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17778 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17779 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17780 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17781 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17782 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17783 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17784 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17785 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17786 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17787 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17788 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17789 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17790 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17791 @samp{cortex-m35p},
17792 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17793 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17794 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17795 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17796 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17797
17798 Additionally, this option can specify that GCC should tune the performance
17799 of the code for a big.LITTLE system. Permissible names are:
17800 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17801 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17802 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17803 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17804
17805 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17806 performance for a blend of processors within architecture @var{arch}.
17807 The aim is to generate code that run well on the current most popular
17808 processors, balancing between optimizations that benefit some CPUs in the
17809 range, and avoiding performance pitfalls of other CPUs. The effects of
17810 this option may change in future GCC versions as CPU models come and go.
17811
17812 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17813 the extension options do not affect the tuning of the generated code.
17814
17815 @option{-mtune=native} causes the compiler to auto-detect the CPU
17816 of the build computer. At present, this feature is only supported on
17817 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17818 unsuccessful the option has no effect.
17819
17820 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17821 @opindex mcpu
17822 This specifies the name of the target ARM processor. GCC uses this name
17823 to derive the name of the target ARM architecture (as if specified
17824 by @option{-march}) and the ARM processor type for which to tune for
17825 performance (as if specified by @option{-mtune}). Where this option
17826 is used in conjunction with @option{-march} or @option{-mtune},
17827 those options take precedence over the appropriate part of this option.
17828
17829 Many of the supported CPUs implement optional architectural
17830 extensions. Where this is so the architectural extensions are
17831 normally enabled by default. If implementations that lack the
17832 extension exist, then the extension syntax can be used to disable
17833 those extensions that have been omitted. For floating-point and
17834 Advanced SIMD (Neon) instructions, the settings of the options
17835 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17836 floating-point and Advanced SIMD instructions will only be used if
17837 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17838 @option{-mfpu} other than @samp{auto} will override the available
17839 floating-point and SIMD extension instructions.
17840
17841 For example, @samp{cortex-a9} can be found in three major
17842 configurations: integer only, with just a floating-point unit or with
17843 floating-point and Advanced SIMD. The default is to enable all the
17844 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17845 be used to disable just the SIMD or both the SIMD and floating-point
17846 instructions respectively.
17847
17848 Permissible names for this option are the same as those for
17849 @option{-mtune}.
17850
17851 The following extension options are common to the listed CPUs:
17852
17853 @table @samp
17854 @item +nodsp
17855 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17856
17857 @item +nofp
17858 Disables the floating-point instructions on @samp{arm9e},
17859 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17860 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17861 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17862 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17863 Disables the floating-point and SIMD instructions on
17864 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17865 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17866 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17867 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17868 @samp{cortex-a53} and @samp{cortex-a55}.
17869
17870 @item +nofp.dp
17871 Disables the double-precision component of the floating-point instructions
17872 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17873 @samp{cortex-m7}.
17874
17875 @item +nosimd
17876 Disables the SIMD (but not floating-point) instructions on
17877 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17878 and @samp{cortex-a9}.
17879
17880 @item +crypto
17881 Enables the cryptographic instructions on @samp{cortex-a32},
17882 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17883 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17884 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17885 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17886 @samp{cortex-a75.cortex-a55}.
17887 @end table
17888
17889 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17890 VFPv3 with 16 double-precision registers. It supports the following
17891 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17892 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17893 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17894 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17895 the extensions to @option{-march=armv7-a}.
17896
17897 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17898 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17899 See @option{-mtune} for more information.
17900
17901 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17902 of the build computer. At present, this feature is only supported on
17903 GNU/Linux, and not all architectures are recognized. If the auto-detect
17904 is unsuccessful the option has no effect.
17905
17906 @item -mfpu=@var{name}
17907 @opindex mfpu
17908 This specifies what floating-point hardware (or hardware emulation) is
17909 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17910 @samp{vfpv3},
17911 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17912 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17913 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17914 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17915 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17916 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17917 is an alias for @samp{vfpv2}.
17918
17919 The setting @samp{auto} is the default and is special. It causes the
17920 compiler to select the floating-point and Advanced SIMD instructions
17921 based on the settings of @option{-mcpu} and @option{-march}.
17922
17923 If the selected floating-point hardware includes the NEON extension
17924 (e.g.@: @option{-mfpu=neon}), note that floating-point
17925 operations are not generated by GCC's auto-vectorization pass unless
17926 @option{-funsafe-math-optimizations} is also specified. This is
17927 because NEON hardware does not fully implement the IEEE 754 standard for
17928 floating-point arithmetic (in particular denormal values are treated as
17929 zero), so the use of NEON instructions may lead to a loss of precision.
17930
17931 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}).
17932
17933 @item -mfp16-format=@var{name}
17934 @opindex mfp16-format
17935 Specify the format of the @code{__fp16} half-precision floating-point type.
17936 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17937 the default is @samp{none}, in which case the @code{__fp16} type is not
17938 defined. @xref{Half-Precision}, for more information.
17939
17940 @item -mstructure-size-boundary=@var{n}
17941 @opindex mstructure-size-boundary
17942 The sizes of all structures and unions are rounded up to a multiple
17943 of the number of bits set by this option. Permissible values are 8, 32
17944 and 64. The default value varies for different toolchains. For the COFF
17945 targeted toolchain the default value is 8. A value of 64 is only allowed
17946 if the underlying ABI supports it.
17947
17948 Specifying a larger number can produce faster, more efficient code, but
17949 can also increase the size of the program. Different values are potentially
17950 incompatible. Code compiled with one value cannot necessarily expect to
17951 work with code or libraries compiled with another value, if they exchange
17952 information using structures or unions.
17953
17954 This option is deprecated.
17955
17956 @item -mabort-on-noreturn
17957 @opindex mabort-on-noreturn
17958 Generate a call to the function @code{abort} at the end of a
17959 @code{noreturn} function. It is executed if the function tries to
17960 return.
17961
17962 @item -mlong-calls
17963 @itemx -mno-long-calls
17964 @opindex mlong-calls
17965 @opindex mno-long-calls
17966 Tells the compiler to perform function calls by first loading the
17967 address of the function into a register and then performing a subroutine
17968 call on this register. This switch is needed if the target function
17969 lies outside of the 64-megabyte addressing range of the offset-based
17970 version of subroutine call instruction.
17971
17972 Even if this switch is enabled, not all function calls are turned
17973 into long calls. The heuristic is that static functions, functions
17974 that have the @code{short_call} attribute, functions that are inside
17975 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17976 definitions have already been compiled within the current compilation
17977 unit are not turned into long calls. The exceptions to this rule are
17978 that weak function definitions, functions with the @code{long_call}
17979 attribute or the @code{section} attribute, and functions that are within
17980 the scope of a @code{#pragma long_calls} directive are always
17981 turned into long calls.
17982
17983 This feature is not enabled by default. Specifying
17984 @option{-mno-long-calls} restores the default behavior, as does
17985 placing the function calls within the scope of a @code{#pragma
17986 long_calls_off} directive. Note these switches have no effect on how
17987 the compiler generates code to handle function calls via function
17988 pointers.
17989
17990 @item -msingle-pic-base
17991 @opindex msingle-pic-base
17992 Treat the register used for PIC addressing as read-only, rather than
17993 loading it in the prologue for each function. The runtime system is
17994 responsible for initializing this register with an appropriate value
17995 before execution begins.
17996
17997 @item -mpic-register=@var{reg}
17998 @opindex mpic-register
17999 Specify the register to be used for PIC addressing.
18000 For standard PIC base case, the default is any suitable register
18001 determined by compiler. For single PIC base case, the default is
18002 @samp{R9} if target is EABI based or stack-checking is enabled,
18003 otherwise the default is @samp{R10}.
18004
18005 @item -mpic-data-is-text-relative
18006 @opindex mpic-data-is-text-relative
18007 Assume that the displacement between the text and data segments is fixed
18008 at static link time. This permits using PC-relative addressing
18009 operations to access data known to be in the data segment. For
18010 non-VxWorks RTP targets, this option is enabled by default. When
18011 disabled on such targets, it will enable @option{-msingle-pic-base} by
18012 default.
18013
18014 @item -mpoke-function-name
18015 @opindex mpoke-function-name
18016 Write the name of each function into the text section, directly
18017 preceding the function prologue. The generated code is similar to this:
18018
18019 @smallexample
18020 t0
18021 .ascii "arm_poke_function_name", 0
18022 .align
18023 t1
18024 .word 0xff000000 + (t1 - t0)
18025 arm_poke_function_name
18026 mov ip, sp
18027 stmfd sp!, @{fp, ip, lr, pc@}
18028 sub fp, ip, #4
18029 @end smallexample
18030
18031 When performing a stack backtrace, code can inspect the value of
18032 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
18033 location @code{pc - 12} and the top 8 bits are set, then we know that
18034 there is a function name embedded immediately preceding this location
18035 and has length @code{((pc[-3]) & 0xff000000)}.
18036
18037 @item -mthumb
18038 @itemx -marm
18039 @opindex marm
18040 @opindex mthumb
18041
18042 Select between generating code that executes in ARM and Thumb
18043 states. The default for most configurations is to generate code
18044 that executes in ARM state, but the default can be changed by
18045 configuring GCC with the @option{--with-mode=}@var{state}
18046 configure option.
18047
18048 You can also override the ARM and Thumb mode for each function
18049 by using the @code{target("thumb")} and @code{target("arm")} function attributes
18050 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
18051
18052 @item -mflip-thumb
18053 @opindex mflip-thumb
18054 Switch ARM/Thumb modes on alternating functions.
18055 This option is provided for regression testing of mixed Thumb/ARM code
18056 generation, and is not intended for ordinary use in compiling code.
18057
18058 @item -mtpcs-frame
18059 @opindex mtpcs-frame
18060 Generate a stack frame that is compliant with the Thumb Procedure Call
18061 Standard for all non-leaf functions. (A leaf function is one that does
18062 not call any other functions.) The default is @option{-mno-tpcs-frame}.
18063
18064 @item -mtpcs-leaf-frame
18065 @opindex mtpcs-leaf-frame
18066 Generate a stack frame that is compliant with the Thumb Procedure Call
18067 Standard for all leaf functions. (A leaf function is one that does
18068 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
18069
18070 @item -mcallee-super-interworking
18071 @opindex mcallee-super-interworking
18072 Gives all externally visible functions in the file being compiled an ARM
18073 instruction set header which switches to Thumb mode before executing the
18074 rest of the function. This allows these functions to be called from
18075 non-interworking code. This option is not valid in AAPCS configurations
18076 because interworking is enabled by default.
18077
18078 @item -mcaller-super-interworking
18079 @opindex mcaller-super-interworking
18080 Allows calls via function pointers (including virtual functions) to
18081 execute correctly regardless of whether the target code has been
18082 compiled for interworking or not. There is a small overhead in the cost
18083 of executing a function pointer if this option is enabled. This option
18084 is not valid in AAPCS configurations because interworking is enabled
18085 by default.
18086
18087 @item -mtp=@var{name}
18088 @opindex mtp
18089 Specify the access model for the thread local storage pointer. The valid
18090 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
18091 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
18092 (supported in the arm6k architecture), and @samp{auto}, which uses the
18093 best available method for the selected processor. The default setting is
18094 @samp{auto}.
18095
18096 @item -mtls-dialect=@var{dialect}
18097 @opindex mtls-dialect
18098 Specify the dialect to use for accessing thread local storage. Two
18099 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
18100 @samp{gnu} dialect selects the original GNU scheme for supporting
18101 local and global dynamic TLS models. The @samp{gnu2} dialect
18102 selects the GNU descriptor scheme, which provides better performance
18103 for shared libraries. The GNU descriptor scheme is compatible with
18104 the original scheme, but does require new assembler, linker and
18105 library support. Initial and local exec TLS models are unaffected by
18106 this option and always use the original scheme.
18107
18108 @item -mword-relocations
18109 @opindex mword-relocations
18110 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18111 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18112 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18113 is specified. This option conflicts with @option{-mslow-flash-data}.
18114
18115 @item -mfix-cortex-m3-ldrd
18116 @opindex mfix-cortex-m3-ldrd
18117 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18118 with overlapping destination and base registers are used. This option avoids
18119 generating these instructions. This option is enabled by default when
18120 @option{-mcpu=cortex-m3} is specified.
18121
18122 @item -munaligned-access
18123 @itemx -mno-unaligned-access
18124 @opindex munaligned-access
18125 @opindex mno-unaligned-access
18126 Enables (or disables) reading and writing of 16- and 32- bit values
18127 from addresses that are not 16- or 32- bit aligned. By default
18128 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18129 ARMv8-M Baseline architectures, and enabled for all other
18130 architectures. If unaligned access is not enabled then words in packed
18131 data structures are accessed a byte at a time.
18132
18133 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18134 generated object file to either true or false, depending upon the
18135 setting of this option. If unaligned access is enabled then the
18136 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18137 defined.
18138
18139 @item -mneon-for-64bits
18140 @opindex mneon-for-64bits
18141 This option is deprecated and has no effect.
18142
18143 @item -mslow-flash-data
18144 @opindex mslow-flash-data
18145 Assume loading data from flash is slower than fetching instruction.
18146 Therefore literal load is minimized for better performance.
18147 This option is only supported when compiling for ARMv7 M-profile and
18148 off by default. It conflicts with @option{-mword-relocations}.
18149
18150 @item -masm-syntax-unified
18151 @opindex masm-syntax-unified
18152 Assume inline assembler is using unified asm syntax. The default is
18153 currently off which implies divided syntax. This option has no impact
18154 on Thumb2. However, this may change in future releases of GCC.
18155 Divided syntax should be considered deprecated.
18156
18157 @item -mrestrict-it
18158 @opindex mrestrict-it
18159 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18160 IT blocks can only contain a single 16-bit instruction from a select
18161 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18162
18163 @item -mprint-tune-info
18164 @opindex mprint-tune-info
18165 Print CPU tuning information as comment in assembler file. This is
18166 an option used only for regression testing of the compiler and not
18167 intended for ordinary use in compiling code. This option is disabled
18168 by default.
18169
18170 @item -mverbose-cost-dump
18171 @opindex mverbose-cost-dump
18172 Enable verbose cost model dumping in the debug dump files. This option is
18173 provided for use in debugging the compiler.
18174
18175 @item -mpure-code
18176 @opindex mpure-code
18177 Do not allow constant data to be placed in code sections.
18178 Additionally, when compiling for ELF object format give all text sections the
18179 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18180 is only available when generating non-pic code for M-profile targets with the
18181 MOVT instruction.
18182
18183 @item -mcmse
18184 @opindex mcmse
18185 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18186 Development Tools Engineering Specification", which can be found on
18187 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18188
18189 @item -mfdpic
18190 @itemx -mno-fdpic
18191 @opindex mfdpic
18192 @opindex mno-fdpic
18193 Select the FDPIC ABI, which uses 64-bit function descriptors to
18194 represent pointers to functions. When the compiler is configured for
18195 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18196 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18197 provided. On other targets, it only enables the FDPIC-specific code
18198 generation features, and the user should explicitly provide the
18199 PIC/PIE-related options as needed.
18200
18201 Note that static linking is not supported because it would still
18202 involve the dynamic linker when the program self-relocates. If such
18203 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18204
18205 The opposite @option{-mno-fdpic} option is useful (and required) to
18206 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18207 toolchain as the one used to build the userland programs.
18208
18209 @end table
18210
18211 @node AVR Options
18212 @subsection AVR Options
18213 @cindex AVR Options
18214
18215 These options are defined for AVR implementations:
18216
18217 @table @gcctabopt
18218 @item -mmcu=@var{mcu}
18219 @opindex mmcu
18220 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18221
18222 The default for this option is@tie{}@samp{avr2}.
18223
18224 GCC supports the following AVR devices and ISAs:
18225
18226 @include avr-mmcu.texi
18227
18228 @item -mabsdata
18229 @opindex mabsdata
18230
18231 Assume that all data in static storage can be accessed by LDS / STS
18232 instructions. This option has only an effect on reduced Tiny devices like
18233 ATtiny40. See also the @code{absdata}
18234 @ref{AVR Variable Attributes,variable attribute}.
18235
18236 @item -maccumulate-args
18237 @opindex maccumulate-args
18238 Accumulate outgoing function arguments and acquire/release the needed
18239 stack space for outgoing function arguments once in function
18240 prologue/epilogue. Without this option, outgoing arguments are pushed
18241 before calling a function and popped afterwards.
18242
18243 Popping the arguments after the function call can be expensive on
18244 AVR so that accumulating the stack space might lead to smaller
18245 executables because arguments need not be removed from the
18246 stack after such a function call.
18247
18248 This option can lead to reduced code size for functions that perform
18249 several calls to functions that get their arguments on the stack like
18250 calls to printf-like functions.
18251
18252 @item -mbranch-cost=@var{cost}
18253 @opindex mbranch-cost
18254 Set the branch costs for conditional branch instructions to
18255 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18256 integers. The default branch cost is 0.
18257
18258 @item -mcall-prologues
18259 @opindex mcall-prologues
18260 Functions prologues/epilogues are expanded as calls to appropriate
18261 subroutines. Code size is smaller.
18262
18263 @item -mgas-isr-prologues
18264 @opindex mgas-isr-prologues
18265 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18266 instruction supported by GNU Binutils.
18267 If this option is on, the feature can still be disabled for individual
18268 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18269 function attribute. This feature is activated per default
18270 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18271 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18272
18273 @item -mint8
18274 @opindex mint8
18275 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18276 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18277 and @code{long long} is 4 bytes. Please note that this option does not
18278 conform to the C standards, but it results in smaller code
18279 size.
18280
18281 @item -mmain-is-OS_task
18282 @opindex mmain-is-OS_task
18283 Do not save registers in @code{main}. The effect is the same like
18284 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18285 to @code{main}. It is activated per default if optimization is on.
18286
18287 @item -mn-flash=@var{num}
18288 @opindex mn-flash
18289 Assume that the flash memory has a size of
18290 @var{num} times 64@tie{}KiB.
18291
18292 @item -mno-interrupts
18293 @opindex mno-interrupts
18294 Generated code is not compatible with hardware interrupts.
18295 Code size is smaller.
18296
18297 @item -mrelax
18298 @opindex mrelax
18299 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18300 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18301 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18302 the assembler's command line and the @option{--relax} option to the
18303 linker's command line.
18304
18305 Jump relaxing is performed by the linker because jump offsets are not
18306 known before code is located. Therefore, the assembler code generated by the
18307 compiler is the same, but the instructions in the executable may
18308 differ from instructions in the assembler code.
18309
18310 Relaxing must be turned on if linker stubs are needed, see the
18311 section on @code{EIND} and linker stubs below.
18312
18313 @item -mrmw
18314 @opindex mrmw
18315 Assume that the device supports the Read-Modify-Write
18316 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18317
18318 @item -mshort-calls
18319 @opindex mshort-calls
18320
18321 Assume that @code{RJMP} and @code{RCALL} can target the whole
18322 program memory.
18323
18324 This option is used internally for multilib selection. It is
18325 not an optimization option, and you don't need to set it by hand.
18326
18327 @item -msp8
18328 @opindex msp8
18329 Treat the stack pointer register as an 8-bit register,
18330 i.e.@: assume the high byte of the stack pointer is zero.
18331 In general, you don't need to set this option by hand.
18332
18333 This option is used internally by the compiler to select and
18334 build multilibs for architectures @code{avr2} and @code{avr25}.
18335 These architectures mix devices with and without @code{SPH}.
18336 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18337 the compiler driver adds or removes this option from the compiler
18338 proper's command line, because the compiler then knows if the device
18339 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18340 register or not.
18341
18342 @item -mstrict-X
18343 @opindex mstrict-X
18344 Use address register @code{X} in a way proposed by the hardware. This means
18345 that @code{X} is only used in indirect, post-increment or
18346 pre-decrement addressing.
18347
18348 Without this option, the @code{X} register may be used in the same way
18349 as @code{Y} or @code{Z} which then is emulated by additional
18350 instructions.
18351 For example, loading a value with @code{X+const} addressing with a
18352 small non-negative @code{const < 64} to a register @var{Rn} is
18353 performed as
18354
18355 @example
18356 adiw r26, const ; X += const
18357 ld @var{Rn}, X ; @var{Rn} = *X
18358 sbiw r26, const ; X -= const
18359 @end example
18360
18361 @item -mtiny-stack
18362 @opindex mtiny-stack
18363 Only change the lower 8@tie{}bits of the stack pointer.
18364
18365 @item -mfract-convert-truncate
18366 @opindex mfract-convert-truncate
18367 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18368
18369 @item -nodevicelib
18370 @opindex nodevicelib
18371 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18372
18373 @item -Waddr-space-convert
18374 @opindex Waddr-space-convert
18375 @opindex Wno-addr-space-convert
18376 Warn about conversions between address spaces in the case where the
18377 resulting address space is not contained in the incoming address space.
18378
18379 @item -Wmisspelled-isr
18380 @opindex Wmisspelled-isr
18381 @opindex Wno-misspelled-isr
18382 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18383 Enabled by default.
18384 @end table
18385
18386 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18387 @cindex @code{EIND}
18388 Pointers in the implementation are 16@tie{}bits wide.
18389 The address of a function or label is represented as word address so
18390 that indirect jumps and calls can target any code address in the
18391 range of 64@tie{}Ki words.
18392
18393 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18394 bytes of program memory space, there is a special function register called
18395 @code{EIND} that serves as most significant part of the target address
18396 when @code{EICALL} or @code{EIJMP} instructions are used.
18397
18398 Indirect jumps and calls on these devices are handled as follows by
18399 the compiler and are subject to some limitations:
18400
18401 @itemize @bullet
18402
18403 @item
18404 The compiler never sets @code{EIND}.
18405
18406 @item
18407 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18408 instructions or might read @code{EIND} directly in order to emulate an
18409 indirect call/jump by means of a @code{RET} instruction.
18410
18411 @item
18412 The compiler assumes that @code{EIND} never changes during the startup
18413 code or during the application. In particular, @code{EIND} is not
18414 saved/restored in function or interrupt service routine
18415 prologue/epilogue.
18416
18417 @item
18418 For indirect calls to functions and computed goto, the linker
18419 generates @emph{stubs}. Stubs are jump pads sometimes also called
18420 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18421 The stub contains a direct jump to the desired address.
18422
18423 @item
18424 Linker relaxation must be turned on so that the linker generates
18425 the stubs correctly in all situations. See the compiler option
18426 @option{-mrelax} and the linker option @option{--relax}.
18427 There are corner cases where the linker is supposed to generate stubs
18428 but aborts without relaxation and without a helpful error message.
18429
18430 @item
18431 The default linker script is arranged for code with @code{EIND = 0}.
18432 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18433 linker script has to be used in order to place the sections whose
18434 name start with @code{.trampolines} into the segment where @code{EIND}
18435 points to.
18436
18437 @item
18438 The startup code from libgcc never sets @code{EIND}.
18439 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18440 For the impact of AVR-LibC on @code{EIND}, see the
18441 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18442
18443 @item
18444 It is legitimate for user-specific startup code to set up @code{EIND}
18445 early, for example by means of initialization code located in
18446 section @code{.init3}. Such code runs prior to general startup code
18447 that initializes RAM and calls constructors, but after the bit
18448 of startup code from AVR-LibC that sets @code{EIND} to the segment
18449 where the vector table is located.
18450 @example
18451 #include <avr/io.h>
18452
18453 static void
18454 __attribute__((section(".init3"),naked,used,no_instrument_function))
18455 init3_set_eind (void)
18456 @{
18457 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18458 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18459 @}
18460 @end example
18461
18462 @noindent
18463 The @code{__trampolines_start} symbol is defined in the linker script.
18464
18465 @item
18466 Stubs are generated automatically by the linker if
18467 the following two conditions are met:
18468 @itemize @minus
18469
18470 @item The address of a label is taken by means of the @code{gs} modifier
18471 (short for @emph{generate stubs}) like so:
18472 @example
18473 LDI r24, lo8(gs(@var{func}))
18474 LDI r25, hi8(gs(@var{func}))
18475 @end example
18476 @item The final location of that label is in a code segment
18477 @emph{outside} the segment where the stubs are located.
18478 @end itemize
18479
18480 @item
18481 The compiler emits such @code{gs} modifiers for code labels in the
18482 following situations:
18483 @itemize @minus
18484 @item Taking address of a function or code label.
18485 @item Computed goto.
18486 @item If prologue-save function is used, see @option{-mcall-prologues}
18487 command-line option.
18488 @item Switch/case dispatch tables. If you do not want such dispatch
18489 tables you can specify the @option{-fno-jump-tables} command-line option.
18490 @item C and C++ constructors/destructors called during startup/shutdown.
18491 @item If the tools hit a @code{gs()} modifier explained above.
18492 @end itemize
18493
18494 @item
18495 Jumping to non-symbolic addresses like so is @emph{not} supported:
18496
18497 @example
18498 int main (void)
18499 @{
18500 /* Call function at word address 0x2 */
18501 return ((int(*)(void)) 0x2)();
18502 @}
18503 @end example
18504
18505 Instead, a stub has to be set up, i.e.@: the function has to be called
18506 through a symbol (@code{func_4} in the example):
18507
18508 @example
18509 int main (void)
18510 @{
18511 extern int func_4 (void);
18512
18513 /* Call function at byte address 0x4 */
18514 return func_4();
18515 @}
18516 @end example
18517
18518 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18519 Alternatively, @code{func_4} can be defined in the linker script.
18520 @end itemize
18521
18522 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18523 @cindex @code{RAMPD}
18524 @cindex @code{RAMPX}
18525 @cindex @code{RAMPY}
18526 @cindex @code{RAMPZ}
18527 Some AVR devices support memories larger than the 64@tie{}KiB range
18528 that can be accessed with 16-bit pointers. To access memory locations
18529 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18530 register is used as high part of the address:
18531 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18532 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18533 register, respectively, to get a wide address. Similarly,
18534 @code{RAMPD} is used together with direct addressing.
18535
18536 @itemize
18537 @item
18538 The startup code initializes the @code{RAMP} special function
18539 registers with zero.
18540
18541 @item
18542 If a @ref{AVR Named Address Spaces,named address space} other than
18543 generic or @code{__flash} is used, then @code{RAMPZ} is set
18544 as needed before the operation.
18545
18546 @item
18547 If the device supports RAM larger than 64@tie{}KiB and the compiler
18548 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18549 is reset to zero after the operation.
18550
18551 @item
18552 If the device comes with a specific @code{RAMP} register, the ISR
18553 prologue/epilogue saves/restores that SFR and initializes it with
18554 zero in case the ISR code might (implicitly) use it.
18555
18556 @item
18557 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18558 If you use inline assembler to read from locations outside the
18559 16-bit address range and change one of the @code{RAMP} registers,
18560 you must reset it to zero after the access.
18561
18562 @end itemize
18563
18564 @subsubsection AVR Built-in Macros
18565
18566 GCC defines several built-in macros so that the user code can test
18567 for the presence or absence of features. Almost any of the following
18568 built-in macros are deduced from device capabilities and thus
18569 triggered by the @option{-mmcu=} command-line option.
18570
18571 For even more AVR-specific built-in macros see
18572 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18573
18574 @table @code
18575
18576 @item __AVR_ARCH__
18577 Build-in macro that resolves to a decimal number that identifies the
18578 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18579 Possible values are:
18580
18581 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18582 @code{4}, @code{5}, @code{51}, @code{6}
18583
18584 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18585 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18586
18587 respectively and
18588
18589 @code{100},
18590 @code{102}, @code{103}, @code{104},
18591 @code{105}, @code{106}, @code{107}
18592
18593 for @var{mcu}=@code{avrtiny},
18594 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18595 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18596 If @var{mcu} specifies a device, this built-in macro is set
18597 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18598 defined to @code{4}.
18599
18600 @item __AVR_@var{Device}__
18601 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18602 the device's name. For example, @option{-mmcu=atmega8} defines the
18603 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18604 @code{__AVR_ATtiny261A__}, etc.
18605
18606 The built-in macros' names follow
18607 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18608 the device name as from the AVR user manual. The difference between
18609 @var{Device} in the built-in macro and @var{device} in
18610 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18611
18612 If @var{device} is not a device but only a core architecture like
18613 @samp{avr51}, this macro is not defined.
18614
18615 @item __AVR_DEVICE_NAME__
18616 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18617 the device's name. For example, with @option{-mmcu=atmega8} the macro
18618 is defined to @code{atmega8}.
18619
18620 If @var{device} is not a device but only a core architecture like
18621 @samp{avr51}, this macro is not defined.
18622
18623 @item __AVR_XMEGA__
18624 The device / architecture belongs to the XMEGA family of devices.
18625
18626 @item __AVR_HAVE_ELPM__
18627 The device has the @code{ELPM} instruction.
18628
18629 @item __AVR_HAVE_ELPMX__
18630 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18631 R@var{n},Z+} instructions.
18632
18633 @item __AVR_HAVE_MOVW__
18634 The device has the @code{MOVW} instruction to perform 16-bit
18635 register-register moves.
18636
18637 @item __AVR_HAVE_LPMX__
18638 The device has the @code{LPM R@var{n},Z} and
18639 @code{LPM R@var{n},Z+} instructions.
18640
18641 @item __AVR_HAVE_MUL__
18642 The device has a hardware multiplier.
18643
18644 @item __AVR_HAVE_JMP_CALL__
18645 The device has the @code{JMP} and @code{CALL} instructions.
18646 This is the case for devices with more than 8@tie{}KiB of program
18647 memory.
18648
18649 @item __AVR_HAVE_EIJMP_EICALL__
18650 @itemx __AVR_3_BYTE_PC__
18651 The device has the @code{EIJMP} and @code{EICALL} instructions.
18652 This is the case for devices with more than 128@tie{}KiB of program memory.
18653 This also means that the program counter
18654 (PC) is 3@tie{}bytes wide.
18655
18656 @item __AVR_2_BYTE_PC__
18657 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18658 with up to 128@tie{}KiB of program memory.
18659
18660 @item __AVR_HAVE_8BIT_SP__
18661 @itemx __AVR_HAVE_16BIT_SP__
18662 The stack pointer (SP) register is treated as 8-bit respectively
18663 16-bit register by the compiler.
18664 The definition of these macros is affected by @option{-mtiny-stack}.
18665
18666 @item __AVR_HAVE_SPH__
18667 @itemx __AVR_SP8__
18668 The device has the SPH (high part of stack pointer) special function
18669 register or has an 8-bit stack pointer, respectively.
18670 The definition of these macros is affected by @option{-mmcu=} and
18671 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18672 by @option{-msp8}.
18673
18674 @item __AVR_HAVE_RAMPD__
18675 @itemx __AVR_HAVE_RAMPX__
18676 @itemx __AVR_HAVE_RAMPY__
18677 @itemx __AVR_HAVE_RAMPZ__
18678 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18679 @code{RAMPZ} special function register, respectively.
18680
18681 @item __NO_INTERRUPTS__
18682 This macro reflects the @option{-mno-interrupts} command-line option.
18683
18684 @item __AVR_ERRATA_SKIP__
18685 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18686 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18687 instructions because of a hardware erratum. Skip instructions are
18688 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18689 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18690 set.
18691
18692 @item __AVR_ISA_RMW__
18693 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18694
18695 @item __AVR_SFR_OFFSET__=@var{offset}
18696 Instructions that can address I/O special function registers directly
18697 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18698 address as if addressed by an instruction to access RAM like @code{LD}
18699 or @code{STS}. This offset depends on the device architecture and has
18700 to be subtracted from the RAM address in order to get the
18701 respective I/O@tie{}address.
18702
18703 @item __AVR_SHORT_CALLS__
18704 The @option{-mshort-calls} command line option is set.
18705
18706 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18707 Some devices support reading from flash memory by means of @code{LD*}
18708 instructions. The flash memory is seen in the data address space
18709 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18710 is not defined, this feature is not available. If defined,
18711 the address space is linear and there is no need to put
18712 @code{.rodata} into RAM. This is handled by the default linker
18713 description file, and is currently available for
18714 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18715 there is no need to use address spaces like @code{__flash} or
18716 features like attribute @code{progmem} and @code{pgm_read_*}.
18717
18718 @item __WITH_AVRLIBC__
18719 The compiler is configured to be used together with AVR-Libc.
18720 See the @option{--with-avrlibc} configure option.
18721
18722 @end table
18723
18724 @node Blackfin Options
18725 @subsection Blackfin Options
18726 @cindex Blackfin Options
18727
18728 @table @gcctabopt
18729 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18730 @opindex mcpu=
18731 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18732 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18733 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18734 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18735 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18736 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18737 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18738 @samp{bf561}, @samp{bf592}.
18739
18740 The optional @var{sirevision} specifies the silicon revision of the target
18741 Blackfin processor. Any workarounds available for the targeted silicon revision
18742 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18743 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18744 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18745 hexadecimal digits representing the major and minor numbers in the silicon
18746 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18747 is not defined. If @var{sirevision} is @samp{any}, the
18748 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18749 If this optional @var{sirevision} is not used, GCC assumes the latest known
18750 silicon revision of the targeted Blackfin processor.
18751
18752 GCC defines a preprocessor macro for the specified @var{cpu}.
18753 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18754 provided by libgloss to be linked in if @option{-msim} is not given.
18755
18756 Without this option, @samp{bf532} is used as the processor by default.
18757
18758 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18759 only the preprocessor macro is defined.
18760
18761 @item -msim
18762 @opindex msim
18763 Specifies that the program will be run on the simulator. This causes
18764 the simulator BSP provided by libgloss to be linked in. This option
18765 has effect only for @samp{bfin-elf} toolchain.
18766 Certain other options, such as @option{-mid-shared-library} and
18767 @option{-mfdpic}, imply @option{-msim}.
18768
18769 @item -momit-leaf-frame-pointer
18770 @opindex momit-leaf-frame-pointer
18771 Don't keep the frame pointer in a register for leaf functions. This
18772 avoids the instructions to save, set up and restore frame pointers and
18773 makes an extra register available in leaf functions.
18774
18775 @item -mspecld-anomaly
18776 @opindex mspecld-anomaly
18777 When enabled, the compiler ensures that the generated code does not
18778 contain speculative loads after jump instructions. If this option is used,
18779 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18780
18781 @item -mno-specld-anomaly
18782 @opindex mno-specld-anomaly
18783 @opindex mspecld-anomaly
18784 Don't generate extra code to prevent speculative loads from occurring.
18785
18786 @item -mcsync-anomaly
18787 @opindex mcsync-anomaly
18788 When enabled, the compiler ensures that the generated code does not
18789 contain CSYNC or SSYNC instructions too soon after conditional branches.
18790 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18791
18792 @item -mno-csync-anomaly
18793 @opindex mno-csync-anomaly
18794 @opindex mcsync-anomaly
18795 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18796 occurring too soon after a conditional branch.
18797
18798 @item -mlow64k
18799 @opindex mlow64k
18800 When enabled, the compiler is free to take advantage of the knowledge that
18801 the entire program fits into the low 64k of memory.
18802
18803 @item -mno-low64k
18804 @opindex mno-low64k
18805 Assume that the program is arbitrarily large. This is the default.
18806
18807 @item -mstack-check-l1
18808 @opindex mstack-check-l1
18809 Do stack checking using information placed into L1 scratchpad memory by the
18810 uClinux kernel.
18811
18812 @item -mid-shared-library
18813 @opindex mid-shared-library
18814 Generate code that supports shared libraries via the library ID method.
18815 This allows for execute in place and shared libraries in an environment
18816 without virtual memory management. This option implies @option{-fPIC}.
18817 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18818
18819 @item -mno-id-shared-library
18820 @opindex mno-id-shared-library
18821 @opindex mid-shared-library
18822 Generate code that doesn't assume ID-based shared libraries are being used.
18823 This is the default.
18824
18825 @item -mleaf-id-shared-library
18826 @opindex mleaf-id-shared-library
18827 Generate code that supports shared libraries via the library ID method,
18828 but assumes that this library or executable won't link against any other
18829 ID shared libraries. That allows the compiler to use faster code for jumps
18830 and calls.
18831
18832 @item -mno-leaf-id-shared-library
18833 @opindex mno-leaf-id-shared-library
18834 @opindex mleaf-id-shared-library
18835 Do not assume that the code being compiled won't link against any ID shared
18836 libraries. Slower code is generated for jump and call insns.
18837
18838 @item -mshared-library-id=n
18839 @opindex mshared-library-id
18840 Specifies the identification number of the ID-based shared library being
18841 compiled. Specifying a value of 0 generates more compact code; specifying
18842 other values forces the allocation of that number to the current
18843 library but is no more space- or time-efficient than omitting this option.
18844
18845 @item -msep-data
18846 @opindex msep-data
18847 Generate code that allows the data segment to be located in a different
18848 area of memory from the text segment. This allows for execute in place in
18849 an environment without virtual memory management by eliminating relocations
18850 against the text section.
18851
18852 @item -mno-sep-data
18853 @opindex mno-sep-data
18854 @opindex msep-data
18855 Generate code that assumes that the data segment follows the text segment.
18856 This is the default.
18857
18858 @item -mlong-calls
18859 @itemx -mno-long-calls
18860 @opindex mlong-calls
18861 @opindex mno-long-calls
18862 Tells the compiler to perform function calls by first loading the
18863 address of the function into a register and then performing a subroutine
18864 call on this register. This switch is needed if the target function
18865 lies outside of the 24-bit addressing range of the offset-based
18866 version of subroutine call instruction.
18867
18868 This feature is not enabled by default. Specifying
18869 @option{-mno-long-calls} restores the default behavior. Note these
18870 switches have no effect on how the compiler generates code to handle
18871 function calls via function pointers.
18872
18873 @item -mfast-fp
18874 @opindex mfast-fp
18875 Link with the fast floating-point library. This library relaxes some of
18876 the IEEE floating-point standard's rules for checking inputs against
18877 Not-a-Number (NAN), in the interest of performance.
18878
18879 @item -minline-plt
18880 @opindex minline-plt
18881 Enable inlining of PLT entries in function calls to functions that are
18882 not known to bind locally. It has no effect without @option{-mfdpic}.
18883
18884 @item -mmulticore
18885 @opindex mmulticore
18886 Build a standalone application for multicore Blackfin processors.
18887 This option causes proper start files and link scripts supporting
18888 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18889 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18890
18891 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18892 selects the one-application-per-core programming model. Without
18893 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18894 programming model is used. In this model, the main function of Core B
18895 should be named as @code{coreb_main}.
18896
18897 If this option is not used, the single-core application programming
18898 model is used.
18899
18900 @item -mcorea
18901 @opindex mcorea
18902 Build a standalone application for Core A of BF561 when using
18903 the one-application-per-core programming model. Proper start files
18904 and link scripts are used to support Core A, and the macro
18905 @code{__BFIN_COREA} is defined.
18906 This option can only be used in conjunction with @option{-mmulticore}.
18907
18908 @item -mcoreb
18909 @opindex mcoreb
18910 Build a standalone application for Core B of BF561 when using
18911 the one-application-per-core programming model. Proper start files
18912 and link scripts are used to support Core B, and the macro
18913 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18914 should be used instead of @code{main}.
18915 This option can only be used in conjunction with @option{-mmulticore}.
18916
18917 @item -msdram
18918 @opindex msdram
18919 Build a standalone application for SDRAM. Proper start files and
18920 link scripts are used to put the application into SDRAM, and the macro
18921 @code{__BFIN_SDRAM} is defined.
18922 The loader should initialize SDRAM before loading the application.
18923
18924 @item -micplb
18925 @opindex micplb
18926 Assume that ICPLBs are enabled at run time. This has an effect on certain
18927 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18928 are enabled; for standalone applications the default is off.
18929 @end table
18930
18931 @node C6X Options
18932 @subsection C6X Options
18933 @cindex C6X Options
18934
18935 @table @gcctabopt
18936 @item -march=@var{name}
18937 @opindex march
18938 This specifies the name of the target architecture. GCC uses this
18939 name to determine what kind of instructions it can emit when generating
18940 assembly code. Permissible names are: @samp{c62x},
18941 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18942
18943 @item -mbig-endian
18944 @opindex mbig-endian
18945 Generate code for a big-endian target.
18946
18947 @item -mlittle-endian
18948 @opindex mlittle-endian
18949 Generate code for a little-endian target. This is the default.
18950
18951 @item -msim
18952 @opindex msim
18953 Choose startup files and linker script suitable for the simulator.
18954
18955 @item -msdata=default
18956 @opindex msdata=default
18957 Put small global and static data in the @code{.neardata} section,
18958 which is pointed to by register @code{B14}. Put small uninitialized
18959 global and static data in the @code{.bss} section, which is adjacent
18960 to the @code{.neardata} section. Put small read-only data into the
18961 @code{.rodata} section. The corresponding sections used for large
18962 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18963
18964 @item -msdata=all
18965 @opindex msdata=all
18966 Put all data, not just small objects, into the sections reserved for
18967 small data, and use addressing relative to the @code{B14} register to
18968 access them.
18969
18970 @item -msdata=none
18971 @opindex msdata=none
18972 Make no use of the sections reserved for small data, and use absolute
18973 addresses to access all data. Put all initialized global and static
18974 data in the @code{.fardata} section, and all uninitialized data in the
18975 @code{.far} section. Put all constant data into the @code{.const}
18976 section.
18977 @end table
18978
18979 @node CRIS Options
18980 @subsection CRIS Options
18981 @cindex CRIS Options
18982
18983 These options are defined specifically for the CRIS ports.
18984
18985 @table @gcctabopt
18986 @item -march=@var{architecture-type}
18987 @itemx -mcpu=@var{architecture-type}
18988 @opindex march
18989 @opindex mcpu
18990 Generate code for the specified architecture. The choices for
18991 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18992 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18993 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18994 @samp{v10}.
18995
18996 @item -mtune=@var{architecture-type}
18997 @opindex mtune
18998 Tune to @var{architecture-type} everything applicable about the generated
18999 code, except for the ABI and the set of available instructions. The
19000 choices for @var{architecture-type} are the same as for
19001 @option{-march=@var{architecture-type}}.
19002
19003 @item -mmax-stack-frame=@var{n}
19004 @opindex mmax-stack-frame
19005 Warn when the stack frame of a function exceeds @var{n} bytes.
19006
19007 @item -metrax4
19008 @itemx -metrax100
19009 @opindex metrax4
19010 @opindex metrax100
19011 The options @option{-metrax4} and @option{-metrax100} are synonyms for
19012 @option{-march=v3} and @option{-march=v8} respectively.
19013
19014 @item -mmul-bug-workaround
19015 @itemx -mno-mul-bug-workaround
19016 @opindex mmul-bug-workaround
19017 @opindex mno-mul-bug-workaround
19018 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
19019 models where it applies. This option is active by default.
19020
19021 @item -mpdebug
19022 @opindex mpdebug
19023 Enable CRIS-specific verbose debug-related information in the assembly
19024 code. This option also has the effect of turning off the @samp{#NO_APP}
19025 formatted-code indicator to the assembler at the beginning of the
19026 assembly file.
19027
19028 @item -mcc-init
19029 @opindex mcc-init
19030 Do not use condition-code results from previous instruction; always emit
19031 compare and test instructions before use of condition codes.
19032
19033 @item -mno-side-effects
19034 @opindex mno-side-effects
19035 @opindex mside-effects
19036 Do not emit instructions with side effects in addressing modes other than
19037 post-increment.
19038
19039 @item -mstack-align
19040 @itemx -mno-stack-align
19041 @itemx -mdata-align
19042 @itemx -mno-data-align
19043 @itemx -mconst-align
19044 @itemx -mno-const-align
19045 @opindex mstack-align
19046 @opindex mno-stack-align
19047 @opindex mdata-align
19048 @opindex mno-data-align
19049 @opindex mconst-align
19050 @opindex mno-const-align
19051 These options (@samp{no-} options) arrange (eliminate arrangements) for the
19052 stack frame, individual data and constants to be aligned for the maximum
19053 single data access size for the chosen CPU model. The default is to
19054 arrange for 32-bit alignment. ABI details such as structure layout are
19055 not affected by these options.
19056
19057 @item -m32-bit
19058 @itemx -m16-bit
19059 @itemx -m8-bit
19060 @opindex m32-bit
19061 @opindex m16-bit
19062 @opindex m8-bit
19063 Similar to the stack- data- and const-align options above, these options
19064 arrange for stack frame, writable data and constants to all be 32-bit,
19065 16-bit or 8-bit aligned. The default is 32-bit alignment.
19066
19067 @item -mno-prologue-epilogue
19068 @itemx -mprologue-epilogue
19069 @opindex mno-prologue-epilogue
19070 @opindex mprologue-epilogue
19071 With @option{-mno-prologue-epilogue}, the normal function prologue and
19072 epilogue which set up the stack frame are omitted and no return
19073 instructions or return sequences are generated in the code. Use this
19074 option only together with visual inspection of the compiled code: no
19075 warnings or errors are generated when call-saved registers must be saved,
19076 or storage for local variables needs to be allocated.
19077
19078 @item -mno-gotplt
19079 @itemx -mgotplt
19080 @opindex mno-gotplt
19081 @opindex mgotplt
19082 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
19083 instruction sequences that load addresses for functions from the PLT part
19084 of the GOT rather than (traditional on other architectures) calls to the
19085 PLT@. The default is @option{-mgotplt}.
19086
19087 @item -melf
19088 @opindex melf
19089 Legacy no-op option only recognized with the cris-axis-elf and
19090 cris-axis-linux-gnu targets.
19091
19092 @item -mlinux
19093 @opindex mlinux
19094 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
19095
19096 @item -sim
19097 @opindex sim
19098 This option, recognized for the cris-axis-elf, arranges
19099 to link with input-output functions from a simulator library. Code,
19100 initialized data and zero-initialized data are allocated consecutively.
19101
19102 @item -sim2
19103 @opindex sim2
19104 Like @option{-sim}, but pass linker options to locate initialized data at
19105 0x40000000 and zero-initialized data at 0x80000000.
19106 @end table
19107
19108 @node CR16 Options
19109 @subsection CR16 Options
19110 @cindex CR16 Options
19111
19112 These options are defined specifically for the CR16 ports.
19113
19114 @table @gcctabopt
19115
19116 @item -mmac
19117 @opindex mmac
19118 Enable the use of multiply-accumulate instructions. Disabled by default.
19119
19120 @item -mcr16cplus
19121 @itemx -mcr16c
19122 @opindex mcr16cplus
19123 @opindex mcr16c
19124 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19125 is default.
19126
19127 @item -msim
19128 @opindex msim
19129 Links the library libsim.a which is in compatible with simulator. Applicable
19130 to ELF compiler only.
19131
19132 @item -mint32
19133 @opindex mint32
19134 Choose integer type as 32-bit wide.
19135
19136 @item -mbit-ops
19137 @opindex mbit-ops
19138 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
19139
19140 @item -mdata-model=@var{model}
19141 @opindex mdata-model
19142 Choose a data model. The choices for @var{model} are @samp{near},
19143 @samp{far} or @samp{medium}. @samp{medium} is default.
19144 However, @samp{far} is not valid with @option{-mcr16c}, as the
19145 CR16C architecture does not support the far data model.
19146 @end table
19147
19148 @node C-SKY Options
19149 @subsection C-SKY Options
19150 @cindex C-SKY Options
19151
19152 GCC supports these options when compiling for C-SKY V2 processors.
19153
19154 @table @gcctabopt
19155
19156 @item -march=@var{arch}
19157 @opindex march=
19158 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19159 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19160 The default is @samp{ck810}.
19161
19162 @item -mcpu=@var{cpu}
19163 @opindex mcpu=
19164 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19165 @samp{ck801}, @samp{ck801t},
19166 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19167 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19168 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19169 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19170 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19171 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19172 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19173 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19174 @samp{ck803eftr1}, @samp{ck803efhtr1},
19175 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19176 @samp{ck803sef}, @samp{ck803seft},
19177 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19178 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19179 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19180 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19181
19182 @item -mbig-endian
19183 @opindex mbig-endian
19184 @itemx -EB
19185 @opindex EB
19186 @itemx -mlittle-endian
19187 @opindex mlittle-endian
19188 @itemx -EL
19189 @opindex EL
19190
19191 Select big- or little-endian code. The default is little-endian.
19192
19193 @item -mhard-float
19194 @opindex mhard-float
19195 @itemx -msoft-float
19196 @opindex msoft-float
19197
19198 Select hardware or software floating-point implementations.
19199 The default is soft float.
19200
19201 @item -mdouble-float
19202 @itemx -mno-double-float
19203 @opindex mdouble-float
19204 When @option{-mhard-float} is in effect, enable generation of
19205 double-precision float instructions. This is the default except
19206 when compiling for CK803.
19207
19208 @item -mfdivdu
19209 @itemx -mno-fdivdu
19210 @opindex mfdivdu
19211 When @option{-mhard-float} is in effect, enable generation of
19212 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19213 This is the default except when compiling for CK803.
19214
19215 @item -mfpu=@var{fpu}
19216 @opindex mfpu=
19217 Select the floating-point processor. This option can only be used with
19218 @option{-mhard-float}.
19219 Values for @var{fpu} are
19220 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19221 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19222 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19223
19224 @item -melrw
19225 @itemx -mno-elrw
19226 @opindex melrw
19227 Enable the extended @code{lrw} instruction. This option defaults to on
19228 for CK801 and off otherwise.
19229
19230 @item -mistack
19231 @itemx -mno-istack
19232 @opindex mistack
19233 Enable interrupt stack instructions; the default is off.
19234
19235 The @option{-mistack} option is required to handle the
19236 @code{interrupt} and @code{isr} function attributes
19237 (@pxref{C-SKY Function Attributes}).
19238
19239 @item -mmp
19240 @opindex mmp
19241 Enable multiprocessor instructions; the default is off.
19242
19243 @item -mcp
19244 @opindex mcp
19245 Enable coprocessor instructions; the default is off.
19246
19247 @item -mcache
19248 @opindex mcache
19249 Enable coprocessor instructions; the default is off.
19250
19251 @item -msecurity
19252 @opindex msecurity
19253 Enable C-SKY security instructions; the default is off.
19254
19255 @item -mtrust
19256 @opindex mtrust
19257 Enable C-SKY trust instructions; the default is off.
19258
19259 @item -mdsp
19260 @opindex mdsp
19261 @itemx -medsp
19262 @opindex medsp
19263 @itemx -mvdsp
19264 @opindex mvdsp
19265 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19266 All of these options default to off.
19267
19268 @item -mdiv
19269 @itemx -mno-div
19270 @opindex mdiv
19271 Generate divide instructions. Default is off.
19272
19273 @item -msmart
19274 @itemx -mno-smart
19275 @opindex msmart
19276 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19277 use of 16-bit instructions. This option is ignored for CK801 where this
19278 is the required behavior, and it defaults to on for CK802.
19279 For other targets, the default is off.
19280
19281 @item -mhigh-registers
19282 @itemx -mno-high-registers
19283 @opindex mhigh-registers
19284 Generate code using the high registers numbered 16-31. This option
19285 is not supported on CK801, CK802, or CK803, and is enabled by default
19286 for other processors.
19287
19288 @item -manchor
19289 @itemx -mno-anchor
19290 @opindex manchor
19291 Generate code using global anchor symbol addresses.
19292
19293 @item -mpushpop
19294 @itemx -mno-pushpop
19295 @opindex mpushpop
19296 Generate code using @code{push} and @code{pop} instructions. This option
19297 defaults to on.
19298
19299 @item -mmultiple-stld
19300 @itemx -mstm
19301 @itemx -mno-multiple-stld
19302 @itemx -mno-stm
19303 @opindex mmultiple-stld
19304 Generate code using @code{stm} and @code{ldm} instructions. This option
19305 isn't supported on CK801 but is enabled by default on other processors.
19306
19307 @item -mconstpool
19308 @itemx -mno-constpool
19309 @opindex mconstpool
19310 Create constant pools in the compiler instead of deferring it to the
19311 assembler. This option is the default and required for correct code
19312 generation on CK801 and CK802, and is optional on other processors.
19313
19314 @item -mstack-size
19315 @item -mno-stack-size
19316 @opindex mstack-size
19317 Emit @code{.stack_size} directives for each function in the assembly
19318 output. This option defaults to off.
19319
19320 @item -mccrt
19321 @itemx -mno-ccrt
19322 @opindex mccrt
19323 Generate code for the C-SKY compiler runtime instead of libgcc. This
19324 option defaults to off.
19325
19326 @item -mbranch-cost=@var{n}
19327 @opindex mbranch-cost=
19328 Set the branch costs to roughly @code{n} instructions. The default is 1.
19329
19330 @item -msched-prolog
19331 @itemx -mno-sched-prolog
19332 @opindex msched-prolog
19333 Permit scheduling of function prologue and epilogue sequences. Using
19334 this option can result in code that is not compliant with the C-SKY V2 ABI
19335 prologue requirements and that cannot be debugged or backtraced.
19336 It is disabled by default.
19337
19338 @end table
19339
19340 @node Darwin Options
19341 @subsection Darwin Options
19342 @cindex Darwin options
19343
19344 These options are defined for all architectures running the Darwin operating
19345 system.
19346
19347 FSF GCC on Darwin does not create ``fat'' object files; it creates
19348 an object file for the single architecture that GCC was built to
19349 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19350 @option{-arch} options are used; it does so by running the compiler or
19351 linker multiple times and joining the results together with
19352 @file{lipo}.
19353
19354 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19355 @samp{i686}) is determined by the flags that specify the ISA
19356 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19357 @option{-force_cpusubtype_ALL} option can be used to override this.
19358
19359 The Darwin tools vary in their behavior when presented with an ISA
19360 mismatch. The assembler, @file{as}, only permits instructions to
19361 be used that are valid for the subtype of the file it is generating,
19362 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19363 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19364 and prints an error if asked to create a shared library with a less
19365 restrictive subtype than its input files (for instance, trying to put
19366 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19367 for executables, @command{ld}, quietly gives the executable the most
19368 restrictive subtype of any of its input files.
19369
19370 @table @gcctabopt
19371 @item -F@var{dir}
19372 @opindex F
19373 Add the framework directory @var{dir} to the head of the list of
19374 directories to be searched for header files. These directories are
19375 interleaved with those specified by @option{-I} options and are
19376 scanned in a left-to-right order.
19377
19378 A framework directory is a directory with frameworks in it. A
19379 framework is a directory with a @file{Headers} and/or
19380 @file{PrivateHeaders} directory contained directly in it that ends
19381 in @file{.framework}. The name of a framework is the name of this
19382 directory excluding the @file{.framework}. Headers associated with
19383 the framework are found in one of those two directories, with
19384 @file{Headers} being searched first. A subframework is a framework
19385 directory that is in a framework's @file{Frameworks} directory.
19386 Includes of subframework headers can only appear in a header of a
19387 framework that contains the subframework, or in a sibling subframework
19388 header. Two subframeworks are siblings if they occur in the same
19389 framework. A subframework should not have the same name as a
19390 framework; a warning is issued if this is violated. Currently a
19391 subframework cannot have subframeworks; in the future, the mechanism
19392 may be extended to support this. The standard frameworks can be found
19393 in @file{/System/Library/Frameworks} and
19394 @file{/Library/Frameworks}. An example include looks like
19395 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19396 the name of the framework and @file{header.h} is found in the
19397 @file{PrivateHeaders} or @file{Headers} directory.
19398
19399 @item -iframework@var{dir}
19400 @opindex iframework
19401 Like @option{-F} except the directory is a treated as a system
19402 directory. The main difference between this @option{-iframework} and
19403 @option{-F} is that with @option{-iframework} the compiler does not
19404 warn about constructs contained within header files found via
19405 @var{dir}. This option is valid only for the C family of languages.
19406
19407 @item -gused
19408 @opindex gused
19409 Emit debugging information for symbols that are used. For stabs
19410 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19411 This is by default ON@.
19412
19413 @item -gfull
19414 @opindex gfull
19415 Emit debugging information for all symbols and types.
19416
19417 @item -mmacosx-version-min=@var{version}
19418 The earliest version of MacOS X that this executable will run on
19419 is @var{version}. Typical values of @var{version} include @code{10.1},
19420 @code{10.2}, and @code{10.3.9}.
19421
19422 If the compiler was built to use the system's headers by default,
19423 then the default for this option is the system version on which the
19424 compiler is running, otherwise the default is to make choices that
19425 are compatible with as many systems and code bases as possible.
19426
19427 @item -mkernel
19428 @opindex mkernel
19429 Enable kernel development mode. The @option{-mkernel} option sets
19430 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19431 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19432 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19433 applicable. This mode also sets @option{-mno-altivec},
19434 @option{-msoft-float}, @option{-fno-builtin} and
19435 @option{-mlong-branch} for PowerPC targets.
19436
19437 @item -mone-byte-bool
19438 @opindex mone-byte-bool
19439 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19440 By default @code{sizeof(bool)} is @code{4} when compiling for
19441 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19442 option has no effect on x86.
19443
19444 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19445 to generate code that is not binary compatible with code generated
19446 without that switch. Using this switch may require recompiling all
19447 other modules in a program, including system libraries. Use this
19448 switch to conform to a non-default data model.
19449
19450 @item -mfix-and-continue
19451 @itemx -ffix-and-continue
19452 @itemx -findirect-data
19453 @opindex mfix-and-continue
19454 @opindex ffix-and-continue
19455 @opindex findirect-data
19456 Generate code suitable for fast turnaround development, such as to
19457 allow GDB to dynamically load @file{.o} files into already-running
19458 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19459 are provided for backwards compatibility.
19460
19461 @item -all_load
19462 @opindex all_load
19463 Loads all members of static archive libraries.
19464 See man ld(1) for more information.
19465
19466 @item -arch_errors_fatal
19467 @opindex arch_errors_fatal
19468 Cause the errors having to do with files that have the wrong architecture
19469 to be fatal.
19470
19471 @item -bind_at_load
19472 @opindex bind_at_load
19473 Causes the output file to be marked such that the dynamic linker will
19474 bind all undefined references when the file is loaded or launched.
19475
19476 @item -bundle
19477 @opindex bundle
19478 Produce a Mach-o bundle format file.
19479 See man ld(1) for more information.
19480
19481 @item -bundle_loader @var{executable}
19482 @opindex bundle_loader
19483 This option specifies the @var{executable} that will load the build
19484 output file being linked. See man ld(1) for more information.
19485
19486 @item -dynamiclib
19487 @opindex dynamiclib
19488 When passed this option, GCC produces a dynamic library instead of
19489 an executable when linking, using the Darwin @file{libtool} command.
19490
19491 @item -force_cpusubtype_ALL
19492 @opindex force_cpusubtype_ALL
19493 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19494 one controlled by the @option{-mcpu} or @option{-march} option.
19495
19496 @item -allowable_client @var{client_name}
19497 @itemx -client_name
19498 @itemx -compatibility_version
19499 @itemx -current_version
19500 @itemx -dead_strip
19501 @itemx -dependency-file
19502 @itemx -dylib_file
19503 @itemx -dylinker_install_name
19504 @itemx -dynamic
19505 @itemx -exported_symbols_list
19506 @itemx -filelist
19507 @need 800
19508 @itemx -flat_namespace
19509 @itemx -force_flat_namespace
19510 @itemx -headerpad_max_install_names
19511 @itemx -image_base
19512 @itemx -init
19513 @itemx -install_name
19514 @itemx -keep_private_externs
19515 @itemx -multi_module
19516 @itemx -multiply_defined
19517 @itemx -multiply_defined_unused
19518 @need 800
19519 @itemx -noall_load
19520 @itemx -no_dead_strip_inits_and_terms
19521 @itemx -nofixprebinding
19522 @itemx -nomultidefs
19523 @itemx -noprebind
19524 @itemx -noseglinkedit
19525 @itemx -pagezero_size
19526 @itemx -prebind
19527 @itemx -prebind_all_twolevel_modules
19528 @itemx -private_bundle
19529 @need 800
19530 @itemx -read_only_relocs
19531 @itemx -sectalign
19532 @itemx -sectobjectsymbols
19533 @itemx -whyload
19534 @itemx -seg1addr
19535 @itemx -sectcreate
19536 @itemx -sectobjectsymbols
19537 @itemx -sectorder
19538 @itemx -segaddr
19539 @itemx -segs_read_only_addr
19540 @need 800
19541 @itemx -segs_read_write_addr
19542 @itemx -seg_addr_table
19543 @itemx -seg_addr_table_filename
19544 @itemx -seglinkedit
19545 @itemx -segprot
19546 @itemx -segs_read_only_addr
19547 @itemx -segs_read_write_addr
19548 @itemx -single_module
19549 @itemx -static
19550 @itemx -sub_library
19551 @need 800
19552 @itemx -sub_umbrella
19553 @itemx -twolevel_namespace
19554 @itemx -umbrella
19555 @itemx -undefined
19556 @itemx -unexported_symbols_list
19557 @itemx -weak_reference_mismatches
19558 @itemx -whatsloaded
19559 @opindex allowable_client
19560 @opindex client_name
19561 @opindex compatibility_version
19562 @opindex current_version
19563 @opindex dead_strip
19564 @opindex dependency-file
19565 @opindex dylib_file
19566 @opindex dylinker_install_name
19567 @opindex dynamic
19568 @opindex exported_symbols_list
19569 @opindex filelist
19570 @opindex flat_namespace
19571 @opindex force_flat_namespace
19572 @opindex headerpad_max_install_names
19573 @opindex image_base
19574 @opindex init
19575 @opindex install_name
19576 @opindex keep_private_externs
19577 @opindex multi_module
19578 @opindex multiply_defined
19579 @opindex multiply_defined_unused
19580 @opindex noall_load
19581 @opindex no_dead_strip_inits_and_terms
19582 @opindex nofixprebinding
19583 @opindex nomultidefs
19584 @opindex noprebind
19585 @opindex noseglinkedit
19586 @opindex pagezero_size
19587 @opindex prebind
19588 @opindex prebind_all_twolevel_modules
19589 @opindex private_bundle
19590 @opindex read_only_relocs
19591 @opindex sectalign
19592 @opindex sectobjectsymbols
19593 @opindex whyload
19594 @opindex seg1addr
19595 @opindex sectcreate
19596 @opindex sectobjectsymbols
19597 @opindex sectorder
19598 @opindex segaddr
19599 @opindex segs_read_only_addr
19600 @opindex segs_read_write_addr
19601 @opindex seg_addr_table
19602 @opindex seg_addr_table_filename
19603 @opindex seglinkedit
19604 @opindex segprot
19605 @opindex segs_read_only_addr
19606 @opindex segs_read_write_addr
19607 @opindex single_module
19608 @opindex static
19609 @opindex sub_library
19610 @opindex sub_umbrella
19611 @opindex twolevel_namespace
19612 @opindex umbrella
19613 @opindex undefined
19614 @opindex unexported_symbols_list
19615 @opindex weak_reference_mismatches
19616 @opindex whatsloaded
19617 These options are passed to the Darwin linker. The Darwin linker man page
19618 describes them in detail.
19619 @end table
19620
19621 @node DEC Alpha Options
19622 @subsection DEC Alpha Options
19623
19624 These @samp{-m} options are defined for the DEC Alpha implementations:
19625
19626 @table @gcctabopt
19627 @item -mno-soft-float
19628 @itemx -msoft-float
19629 @opindex mno-soft-float
19630 @opindex msoft-float
19631 Use (do not use) the hardware floating-point instructions for
19632 floating-point operations. When @option{-msoft-float} is specified,
19633 functions in @file{libgcc.a} are used to perform floating-point
19634 operations. Unless they are replaced by routines that emulate the
19635 floating-point operations, or compiled in such a way as to call such
19636 emulations routines, these routines issue floating-point
19637 operations. If you are compiling for an Alpha without floating-point
19638 operations, you must ensure that the library is built so as not to call
19639 them.
19640
19641 Note that Alpha implementations without floating-point operations are
19642 required to have floating-point registers.
19643
19644 @item -mfp-reg
19645 @itemx -mno-fp-regs
19646 @opindex mfp-reg
19647 @opindex mno-fp-regs
19648 Generate code that uses (does not use) the floating-point register set.
19649 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19650 register set is not used, floating-point operands are passed in integer
19651 registers as if they were integers and floating-point results are passed
19652 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19653 so any function with a floating-point argument or return value called by code
19654 compiled with @option{-mno-fp-regs} must also be compiled with that
19655 option.
19656
19657 A typical use of this option is building a kernel that does not use,
19658 and hence need not save and restore, any floating-point registers.
19659
19660 @item -mieee
19661 @opindex mieee
19662 The Alpha architecture implements floating-point hardware optimized for
19663 maximum performance. It is mostly compliant with the IEEE floating-point
19664 standard. However, for full compliance, software assistance is
19665 required. This option generates code fully IEEE-compliant code
19666 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19667 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19668 defined during compilation. The resulting code is less efficient but is
19669 able to correctly support denormalized numbers and exceptional IEEE
19670 values such as not-a-number and plus/minus infinity. Other Alpha
19671 compilers call this option @option{-ieee_with_no_inexact}.
19672
19673 @item -mieee-with-inexact
19674 @opindex mieee-with-inexact
19675 This is like @option{-mieee} except the generated code also maintains
19676 the IEEE @var{inexact-flag}. Turning on this option causes the
19677 generated code to implement fully-compliant IEEE math. In addition to
19678 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19679 macro. On some Alpha implementations the resulting code may execute
19680 significantly slower than the code generated by default. Since there is
19681 very little code that depends on the @var{inexact-flag}, you should
19682 normally not specify this option. Other Alpha compilers call this
19683 option @option{-ieee_with_inexact}.
19684
19685 @item -mfp-trap-mode=@var{trap-mode}
19686 @opindex mfp-trap-mode
19687 This option controls what floating-point related traps are enabled.
19688 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19689 The trap mode can be set to one of four values:
19690
19691 @table @samp
19692 @item n
19693 This is the default (normal) setting. The only traps that are enabled
19694 are the ones that cannot be disabled in software (e.g., division by zero
19695 trap).
19696
19697 @item u
19698 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19699 as well.
19700
19701 @item su
19702 Like @samp{u}, but the instructions are marked to be safe for software
19703 completion (see Alpha architecture manual for details).
19704
19705 @item sui
19706 Like @samp{su}, but inexact traps are enabled as well.
19707 @end table
19708
19709 @item -mfp-rounding-mode=@var{rounding-mode}
19710 @opindex mfp-rounding-mode
19711 Selects the IEEE rounding mode. Other Alpha compilers call this option
19712 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19713 of:
19714
19715 @table @samp
19716 @item n
19717 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19718 the nearest machine number or towards the even machine number in case
19719 of a tie.
19720
19721 @item m
19722 Round towards minus infinity.
19723
19724 @item c
19725 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19726
19727 @item d
19728 Dynamic rounding mode. A field in the floating-point control register
19729 (@var{fpcr}, see Alpha architecture reference manual) controls the
19730 rounding mode in effect. The C library initializes this register for
19731 rounding towards plus infinity. Thus, unless your program modifies the
19732 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19733 @end table
19734
19735 @item -mtrap-precision=@var{trap-precision}
19736 @opindex mtrap-precision
19737 In the Alpha architecture, floating-point traps are imprecise. This
19738 means without software assistance it is impossible to recover from a
19739 floating trap and program execution normally needs to be terminated.
19740 GCC can generate code that can assist operating system trap handlers
19741 in determining the exact location that caused a floating-point trap.
19742 Depending on the requirements of an application, different levels of
19743 precisions can be selected:
19744
19745 @table @samp
19746 @item p
19747 Program precision. This option is the default and means a trap handler
19748 can only identify which program caused a floating-point exception.
19749
19750 @item f
19751 Function precision. The trap handler can determine the function that
19752 caused a floating-point exception.
19753
19754 @item i
19755 Instruction precision. The trap handler can determine the exact
19756 instruction that caused a floating-point exception.
19757 @end table
19758
19759 Other Alpha compilers provide the equivalent options called
19760 @option{-scope_safe} and @option{-resumption_safe}.
19761
19762 @item -mieee-conformant
19763 @opindex mieee-conformant
19764 This option marks the generated code as IEEE conformant. You must not
19765 use this option unless you also specify @option{-mtrap-precision=i} and either
19766 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19767 is to emit the line @samp{.eflag 48} in the function prologue of the
19768 generated assembly file.
19769
19770 @item -mbuild-constants
19771 @opindex mbuild-constants
19772 Normally GCC examines a 32- or 64-bit integer constant to
19773 see if it can construct it from smaller constants in two or three
19774 instructions. If it cannot, it outputs the constant as a literal and
19775 generates code to load it from the data segment at run time.
19776
19777 Use this option to require GCC to construct @emph{all} integer constants
19778 using code, even if it takes more instructions (the maximum is six).
19779
19780 You typically use this option to build a shared library dynamic
19781 loader. Itself a shared library, it must relocate itself in memory
19782 before it can find the variables and constants in its own data segment.
19783
19784 @item -mbwx
19785 @itemx -mno-bwx
19786 @itemx -mcix
19787 @itemx -mno-cix
19788 @itemx -mfix
19789 @itemx -mno-fix
19790 @itemx -mmax
19791 @itemx -mno-max
19792 @opindex mbwx
19793 @opindex mno-bwx
19794 @opindex mcix
19795 @opindex mno-cix
19796 @opindex mfix
19797 @opindex mno-fix
19798 @opindex mmax
19799 @opindex mno-max
19800 Indicate whether GCC should generate code to use the optional BWX,
19801 CIX, FIX and MAX instruction sets. The default is to use the instruction
19802 sets supported by the CPU type specified via @option{-mcpu=} option or that
19803 of the CPU on which GCC was built if none is specified.
19804
19805 @item -mfloat-vax
19806 @itemx -mfloat-ieee
19807 @opindex mfloat-vax
19808 @opindex mfloat-ieee
19809 Generate code that uses (does not use) VAX F and G floating-point
19810 arithmetic instead of IEEE single and double precision.
19811
19812 @item -mexplicit-relocs
19813 @itemx -mno-explicit-relocs
19814 @opindex mexplicit-relocs
19815 @opindex mno-explicit-relocs
19816 Older Alpha assemblers provided no way to generate symbol relocations
19817 except via assembler macros. Use of these macros does not allow
19818 optimal instruction scheduling. GNU binutils as of version 2.12
19819 supports a new syntax that allows the compiler to explicitly mark
19820 which relocations should apply to which instructions. This option
19821 is mostly useful for debugging, as GCC detects the capabilities of
19822 the assembler when it is built and sets the default accordingly.
19823
19824 @item -msmall-data
19825 @itemx -mlarge-data
19826 @opindex msmall-data
19827 @opindex mlarge-data
19828 When @option{-mexplicit-relocs} is in effect, static data is
19829 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19830 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19831 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19832 16-bit relocations off of the @code{$gp} register. This limits the
19833 size of the small data area to 64KB, but allows the variables to be
19834 directly accessed via a single instruction.
19835
19836 The default is @option{-mlarge-data}. With this option the data area
19837 is limited to just below 2GB@. Programs that require more than 2GB of
19838 data must use @code{malloc} or @code{mmap} to allocate the data in the
19839 heap instead of in the program's data segment.
19840
19841 When generating code for shared libraries, @option{-fpic} implies
19842 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19843
19844 @item -msmall-text
19845 @itemx -mlarge-text
19846 @opindex msmall-text
19847 @opindex mlarge-text
19848 When @option{-msmall-text} is used, the compiler assumes that the
19849 code of the entire program (or shared library) fits in 4MB, and is
19850 thus reachable with a branch instruction. When @option{-msmall-data}
19851 is used, the compiler can assume that all local symbols share the
19852 same @code{$gp} value, and thus reduce the number of instructions
19853 required for a function call from 4 to 1.
19854
19855 The default is @option{-mlarge-text}.
19856
19857 @item -mcpu=@var{cpu_type}
19858 @opindex mcpu
19859 Set the instruction set and instruction scheduling parameters for
19860 machine type @var{cpu_type}. You can specify either the @samp{EV}
19861 style name or the corresponding chip number. GCC supports scheduling
19862 parameters for the EV4, EV5 and EV6 family of processors and
19863 chooses the default values for the instruction set from the processor
19864 you specify. If you do not specify a processor type, GCC defaults
19865 to the processor on which the compiler was built.
19866
19867 Supported values for @var{cpu_type} are
19868
19869 @table @samp
19870 @item ev4
19871 @itemx ev45
19872 @itemx 21064
19873 Schedules as an EV4 and has no instruction set extensions.
19874
19875 @item ev5
19876 @itemx 21164
19877 Schedules as an EV5 and has no instruction set extensions.
19878
19879 @item ev56
19880 @itemx 21164a
19881 Schedules as an EV5 and supports the BWX extension.
19882
19883 @item pca56
19884 @itemx 21164pc
19885 @itemx 21164PC
19886 Schedules as an EV5 and supports the BWX and MAX extensions.
19887
19888 @item ev6
19889 @itemx 21264
19890 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19891
19892 @item ev67
19893 @itemx 21264a
19894 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19895 @end table
19896
19897 Native toolchains also support the value @samp{native},
19898 which selects the best architecture option for the host processor.
19899 @option{-mcpu=native} has no effect if GCC does not recognize
19900 the processor.
19901
19902 @item -mtune=@var{cpu_type}
19903 @opindex mtune
19904 Set only the instruction scheduling parameters for machine type
19905 @var{cpu_type}. The instruction set is not changed.
19906
19907 Native toolchains also support the value @samp{native},
19908 which selects the best architecture option for the host processor.
19909 @option{-mtune=native} has no effect if GCC does not recognize
19910 the processor.
19911
19912 @item -mmemory-latency=@var{time}
19913 @opindex mmemory-latency
19914 Sets the latency the scheduler should assume for typical memory
19915 references as seen by the application. This number is highly
19916 dependent on the memory access patterns used by the application
19917 and the size of the external cache on the machine.
19918
19919 Valid options for @var{time} are
19920
19921 @table @samp
19922 @item @var{number}
19923 A decimal number representing clock cycles.
19924
19925 @item L1
19926 @itemx L2
19927 @itemx L3
19928 @itemx main
19929 The compiler contains estimates of the number of clock cycles for
19930 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19931 (also called Dcache, Scache, and Bcache), as well as to main memory.
19932 Note that L3 is only valid for EV5.
19933
19934 @end table
19935 @end table
19936
19937 @node eBPF Options
19938 @subsection eBPF Options
19939 @cindex eBPF Options
19940
19941 @table @gcctabopt
19942 @item -mframe-limit=@var{bytes}
19943 This specifies the hard limit for frame sizes, in bytes. Currently,
19944 the value that can be specified should be less than or equal to
19945 @samp{32767}. Defaults to whatever limit is imposed by the version of
19946 the Linux kernel targeted.
19947
19948 @item -mkernel=@var{version}
19949 @opindex mkernel
19950 This specifies the minimum version of the kernel that will run the
19951 compiled program. GCC uses this version to determine which
19952 instructions to use, what kernel helpers to allow, etc. Currently,
19953 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19954 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19955 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19956 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19957 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19958 @samp{5.2}, @samp{latest} and @samp{native}.
19959
19960 @item -mbig-endian
19961 @opindex mbig-endian
19962 Generate code for a big-endian target.
19963
19964 @item -mlittle-endian
19965 @opindex mlittle-endian
19966 Generate code for a little-endian target. This is the default.
19967 @end table
19968
19969 @node FR30 Options
19970 @subsection FR30 Options
19971 @cindex FR30 Options
19972
19973 These options are defined specifically for the FR30 port.
19974
19975 @table @gcctabopt
19976
19977 @item -msmall-model
19978 @opindex msmall-model
19979 Use the small address space model. This can produce smaller code, but
19980 it does assume that all symbolic values and addresses fit into a
19981 20-bit range.
19982
19983 @item -mno-lsim
19984 @opindex mno-lsim
19985 Assume that runtime support has been provided and so there is no need
19986 to include the simulator library (@file{libsim.a}) on the linker
19987 command line.
19988
19989 @end table
19990
19991 @node FT32 Options
19992 @subsection FT32 Options
19993 @cindex FT32 Options
19994
19995 These options are defined specifically for the FT32 port.
19996
19997 @table @gcctabopt
19998
19999 @item -msim
20000 @opindex msim
20001 Specifies that the program will be run on the simulator. This causes
20002 an alternate runtime startup and library to be linked.
20003 You must not use this option when generating programs that will run on
20004 real hardware; you must provide your own runtime library for whatever
20005 I/O functions are needed.
20006
20007 @item -mlra
20008 @opindex mlra
20009 Enable Local Register Allocation. This is still experimental for FT32,
20010 so by default the compiler uses standard reload.
20011
20012 @item -mnodiv
20013 @opindex mnodiv
20014 Do not use div and mod instructions.
20015
20016 @item -mft32b
20017 @opindex mft32b
20018 Enable use of the extended instructions of the FT32B processor.
20019
20020 @item -mcompress
20021 @opindex mcompress
20022 Compress all code using the Ft32B code compression scheme.
20023
20024 @item -mnopm
20025 @opindex mnopm
20026 Do not generate code that reads program memory.
20027
20028 @end table
20029
20030 @node FRV Options
20031 @subsection FRV Options
20032 @cindex FRV Options
20033
20034 @table @gcctabopt
20035 @item -mgpr-32
20036 @opindex mgpr-32
20037
20038 Only use the first 32 general-purpose registers.
20039
20040 @item -mgpr-64
20041 @opindex mgpr-64
20042
20043 Use all 64 general-purpose registers.
20044
20045 @item -mfpr-32
20046 @opindex mfpr-32
20047
20048 Use only the first 32 floating-point registers.
20049
20050 @item -mfpr-64
20051 @opindex mfpr-64
20052
20053 Use all 64 floating-point registers.
20054
20055 @item -mhard-float
20056 @opindex mhard-float
20057
20058 Use hardware instructions for floating-point operations.
20059
20060 @item -msoft-float
20061 @opindex msoft-float
20062
20063 Use library routines for floating-point operations.
20064
20065 @item -malloc-cc
20066 @opindex malloc-cc
20067
20068 Dynamically allocate condition code registers.
20069
20070 @item -mfixed-cc
20071 @opindex mfixed-cc
20072
20073 Do not try to dynamically allocate condition code registers, only
20074 use @code{icc0} and @code{fcc0}.
20075
20076 @item -mdword
20077 @opindex mdword
20078
20079 Change ABI to use double word insns.
20080
20081 @item -mno-dword
20082 @opindex mno-dword
20083 @opindex mdword
20084
20085 Do not use double word instructions.
20086
20087 @item -mdouble
20088 @opindex mdouble
20089
20090 Use floating-point double instructions.
20091
20092 @item -mno-double
20093 @opindex mno-double
20094
20095 Do not use floating-point double instructions.
20096
20097 @item -mmedia
20098 @opindex mmedia
20099
20100 Use media instructions.
20101
20102 @item -mno-media
20103 @opindex mno-media
20104
20105 Do not use media instructions.
20106
20107 @item -mmuladd
20108 @opindex mmuladd
20109
20110 Use multiply and add/subtract instructions.
20111
20112 @item -mno-muladd
20113 @opindex mno-muladd
20114
20115 Do not use multiply and add/subtract instructions.
20116
20117 @item -mfdpic
20118 @opindex mfdpic
20119
20120 Select the FDPIC ABI, which uses function descriptors to represent
20121 pointers to functions. Without any PIC/PIE-related options, it
20122 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
20123 assumes GOT entries and small data are within a 12-bit range from the
20124 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
20125 are computed with 32 bits.
20126 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20127
20128 @item -minline-plt
20129 @opindex minline-plt
20130
20131 Enable inlining of PLT entries in function calls to functions that are
20132 not known to bind locally. It has no effect without @option{-mfdpic}.
20133 It's enabled by default if optimizing for speed and compiling for
20134 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
20135 optimization option such as @option{-O3} or above is present in the
20136 command line.
20137
20138 @item -mTLS
20139 @opindex mTLS
20140
20141 Assume a large TLS segment when generating thread-local code.
20142
20143 @item -mtls
20144 @opindex mtls
20145
20146 Do not assume a large TLS segment when generating thread-local code.
20147
20148 @item -mgprel-ro
20149 @opindex mgprel-ro
20150
20151 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20152 that is known to be in read-only sections. It's enabled by default,
20153 except for @option{-fpic} or @option{-fpie}: even though it may help
20154 make the global offset table smaller, it trades 1 instruction for 4.
20155 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20156 one of which may be shared by multiple symbols, and it avoids the need
20157 for a GOT entry for the referenced symbol, so it's more likely to be a
20158 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
20159
20160 @item -multilib-library-pic
20161 @opindex multilib-library-pic
20162
20163 Link with the (library, not FD) pic libraries. It's implied by
20164 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20165 @option{-fpic} without @option{-mfdpic}. You should never have to use
20166 it explicitly.
20167
20168 @item -mlinked-fp
20169 @opindex mlinked-fp
20170
20171 Follow the EABI requirement of always creating a frame pointer whenever
20172 a stack frame is allocated. This option is enabled by default and can
20173 be disabled with @option{-mno-linked-fp}.
20174
20175 @item -mlong-calls
20176 @opindex mlong-calls
20177
20178 Use indirect addressing to call functions outside the current
20179 compilation unit. This allows the functions to be placed anywhere
20180 within the 32-bit address space.
20181
20182 @item -malign-labels
20183 @opindex malign-labels
20184
20185 Try to align labels to an 8-byte boundary by inserting NOPs into the
20186 previous packet. This option only has an effect when VLIW packing
20187 is enabled. It doesn't create new packets; it merely adds NOPs to
20188 existing ones.
20189
20190 @item -mlibrary-pic
20191 @opindex mlibrary-pic
20192
20193 Generate position-independent EABI code.
20194
20195 @item -macc-4
20196 @opindex macc-4
20197
20198 Use only the first four media accumulator registers.
20199
20200 @item -macc-8
20201 @opindex macc-8
20202
20203 Use all eight media accumulator registers.
20204
20205 @item -mpack
20206 @opindex mpack
20207
20208 Pack VLIW instructions.
20209
20210 @item -mno-pack
20211 @opindex mno-pack
20212
20213 Do not pack VLIW instructions.
20214
20215 @item -mno-eflags
20216 @opindex mno-eflags
20217
20218 Do not mark ABI switches in e_flags.
20219
20220 @item -mcond-move
20221 @opindex mcond-move
20222
20223 Enable the use of conditional-move instructions (default).
20224
20225 This switch is mainly for debugging the compiler and will likely be removed
20226 in a future version.
20227
20228 @item -mno-cond-move
20229 @opindex mno-cond-move
20230
20231 Disable the use of conditional-move instructions.
20232
20233 This switch is mainly for debugging the compiler and will likely be removed
20234 in a future version.
20235
20236 @item -mscc
20237 @opindex mscc
20238
20239 Enable the use of conditional set instructions (default).
20240
20241 This switch is mainly for debugging the compiler and will likely be removed
20242 in a future version.
20243
20244 @item -mno-scc
20245 @opindex mno-scc
20246
20247 Disable the use of conditional set instructions.
20248
20249 This switch is mainly for debugging the compiler and will likely be removed
20250 in a future version.
20251
20252 @item -mcond-exec
20253 @opindex mcond-exec
20254
20255 Enable the use of conditional execution (default).
20256
20257 This switch is mainly for debugging the compiler and will likely be removed
20258 in a future version.
20259
20260 @item -mno-cond-exec
20261 @opindex mno-cond-exec
20262
20263 Disable the use of conditional execution.
20264
20265 This switch is mainly for debugging the compiler and will likely be removed
20266 in a future version.
20267
20268 @item -mvliw-branch
20269 @opindex mvliw-branch
20270
20271 Run a pass to pack branches into VLIW instructions (default).
20272
20273 This switch is mainly for debugging the compiler and will likely be removed
20274 in a future version.
20275
20276 @item -mno-vliw-branch
20277 @opindex mno-vliw-branch
20278
20279 Do not run a pass to pack branches into VLIW instructions.
20280
20281 This switch is mainly for debugging the compiler and will likely be removed
20282 in a future version.
20283
20284 @item -mmulti-cond-exec
20285 @opindex mmulti-cond-exec
20286
20287 Enable optimization of @code{&&} and @code{||} in conditional execution
20288 (default).
20289
20290 This switch is mainly for debugging the compiler and will likely be removed
20291 in a future version.
20292
20293 @item -mno-multi-cond-exec
20294 @opindex mno-multi-cond-exec
20295
20296 Disable optimization of @code{&&} and @code{||} in conditional execution.
20297
20298 This switch is mainly for debugging the compiler and will likely be removed
20299 in a future version.
20300
20301 @item -mnested-cond-exec
20302 @opindex mnested-cond-exec
20303
20304 Enable nested conditional execution optimizations (default).
20305
20306 This switch is mainly for debugging the compiler and will likely be removed
20307 in a future version.
20308
20309 @item -mno-nested-cond-exec
20310 @opindex mno-nested-cond-exec
20311
20312 Disable nested conditional execution optimizations.
20313
20314 This switch is mainly for debugging the compiler and will likely be removed
20315 in a future version.
20316
20317 @item -moptimize-membar
20318 @opindex moptimize-membar
20319
20320 This switch removes redundant @code{membar} instructions from the
20321 compiler-generated code. It is enabled by default.
20322
20323 @item -mno-optimize-membar
20324 @opindex mno-optimize-membar
20325 @opindex moptimize-membar
20326
20327 This switch disables the automatic removal of redundant @code{membar}
20328 instructions from the generated code.
20329
20330 @item -mtomcat-stats
20331 @opindex mtomcat-stats
20332
20333 Cause gas to print out tomcat statistics.
20334
20335 @item -mcpu=@var{cpu}
20336 @opindex mcpu
20337
20338 Select the processor type for which to generate code. Possible values are
20339 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20340 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20341
20342 @end table
20343
20344 @node GNU/Linux Options
20345 @subsection GNU/Linux Options
20346
20347 These @samp{-m} options are defined for GNU/Linux targets:
20348
20349 @table @gcctabopt
20350 @item -mglibc
20351 @opindex mglibc
20352 Use the GNU C library. This is the default except
20353 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20354 @samp{*-*-linux-*android*} targets.
20355
20356 @item -muclibc
20357 @opindex muclibc
20358 Use uClibc C library. This is the default on
20359 @samp{*-*-linux-*uclibc*} targets.
20360
20361 @item -mmusl
20362 @opindex mmusl
20363 Use the musl C library. This is the default on
20364 @samp{*-*-linux-*musl*} targets.
20365
20366 @item -mbionic
20367 @opindex mbionic
20368 Use Bionic C library. This is the default on
20369 @samp{*-*-linux-*android*} targets.
20370
20371 @item -mandroid
20372 @opindex mandroid
20373 Compile code compatible with Android platform. This is the default on
20374 @samp{*-*-linux-*android*} targets.
20375
20376 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20377 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20378 this option makes the GCC driver pass Android-specific options to the linker.
20379 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20380 to be defined.
20381
20382 @item -tno-android-cc
20383 @opindex tno-android-cc
20384 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20385 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20386 @option{-fno-rtti} by default.
20387
20388 @item -tno-android-ld
20389 @opindex tno-android-ld
20390 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20391 linking options to the linker.
20392
20393 @end table
20394
20395 @node H8/300 Options
20396 @subsection H8/300 Options
20397
20398 These @samp{-m} options are defined for the H8/300 implementations:
20399
20400 @table @gcctabopt
20401 @item -mrelax
20402 @opindex mrelax
20403 Shorten some address references at link time, when possible; uses the
20404 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20405 ld, Using ld}, for a fuller description.
20406
20407 @item -mh
20408 @opindex mh
20409 Generate code for the H8/300H@.
20410
20411 @item -ms
20412 @opindex ms
20413 Generate code for the H8S@.
20414
20415 @item -mn
20416 @opindex mn
20417 Generate code for the H8S and H8/300H in the normal mode. This switch
20418 must be used either with @option{-mh} or @option{-ms}.
20419
20420 @item -ms2600
20421 @opindex ms2600
20422 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20423
20424 @item -mexr
20425 @opindex mexr
20426 Extended registers are stored on stack before execution of function
20427 with monitor attribute. Default option is @option{-mexr}.
20428 This option is valid only for H8S targets.
20429
20430 @item -mno-exr
20431 @opindex mno-exr
20432 @opindex mexr
20433 Extended registers are not stored on stack before execution of function
20434 with monitor attribute. Default option is @option{-mno-exr}.
20435 This option is valid only for H8S targets.
20436
20437 @item -mint32
20438 @opindex mint32
20439 Make @code{int} data 32 bits by default.
20440
20441 @item -malign-300
20442 @opindex malign-300
20443 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20444 The default for the H8/300H and H8S is to align longs and floats on
20445 4-byte boundaries.
20446 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20447 This option has no effect on the H8/300.
20448 @end table
20449
20450 @node HPPA Options
20451 @subsection HPPA Options
20452 @cindex HPPA Options
20453
20454 These @samp{-m} options are defined for the HPPA family of computers:
20455
20456 @table @gcctabopt
20457 @item -march=@var{architecture-type}
20458 @opindex march
20459 Generate code for the specified architecture. The choices for
20460 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20461 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20462 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20463 architecture option for your machine. Code compiled for lower numbered
20464 architectures runs on higher numbered architectures, but not the
20465 other way around.
20466
20467 @item -mpa-risc-1-0
20468 @itemx -mpa-risc-1-1
20469 @itemx -mpa-risc-2-0
20470 @opindex mpa-risc-1-0
20471 @opindex mpa-risc-1-1
20472 @opindex mpa-risc-2-0
20473 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20474
20475 @item -mcaller-copies
20476 @opindex mcaller-copies
20477 The caller copies function arguments passed by hidden reference. This
20478 option should be used with care as it is not compatible with the default
20479 32-bit runtime. However, only aggregates larger than eight bytes are
20480 passed by hidden reference and the option provides better compatibility
20481 with OpenMP.
20482
20483 @item -mjump-in-delay
20484 @opindex mjump-in-delay
20485 This option is ignored and provided for compatibility purposes only.
20486
20487 @item -mdisable-fpregs
20488 @opindex mdisable-fpregs
20489 Prevent floating-point registers from being used in any manner. This is
20490 necessary for compiling kernels that perform lazy context switching of
20491 floating-point registers. If you use this option and attempt to perform
20492 floating-point operations, the compiler aborts.
20493
20494 @item -mdisable-indexing
20495 @opindex mdisable-indexing
20496 Prevent the compiler from using indexing address modes. This avoids some
20497 rather obscure problems when compiling MIG generated code under MACH@.
20498
20499 @item -mno-space-regs
20500 @opindex mno-space-regs
20501 @opindex mspace-regs
20502 Generate code that assumes the target has no space registers. This allows
20503 GCC to generate faster indirect calls and use unscaled index address modes.
20504
20505 Such code is suitable for level 0 PA systems and kernels.
20506
20507 @item -mfast-indirect-calls
20508 @opindex mfast-indirect-calls
20509 Generate code that assumes calls never cross space boundaries. This
20510 allows GCC to emit code that performs faster indirect calls.
20511
20512 This option does not work in the presence of shared libraries or nested
20513 functions.
20514
20515 @item -mfixed-range=@var{register-range}
20516 @opindex mfixed-range
20517 Generate code treating the given register range as fixed registers.
20518 A fixed register is one that the register allocator cannot use. This is
20519 useful when compiling kernel code. A register range is specified as
20520 two registers separated by a dash. Multiple register ranges can be
20521 specified separated by a comma.
20522
20523 @item -mlong-load-store
20524 @opindex mlong-load-store
20525 Generate 3-instruction load and store sequences as sometimes required by
20526 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20527 the HP compilers.
20528
20529 @item -mportable-runtime
20530 @opindex mportable-runtime
20531 Use the portable calling conventions proposed by HP for ELF systems.
20532
20533 @item -mgas
20534 @opindex mgas
20535 Enable the use of assembler directives only GAS understands.
20536
20537 @item -mschedule=@var{cpu-type}
20538 @opindex mschedule
20539 Schedule code according to the constraints for the machine type
20540 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20541 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20542 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20543 proper scheduling option for your machine. The default scheduling is
20544 @samp{8000}.
20545
20546 @item -mlinker-opt
20547 @opindex mlinker-opt
20548 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20549 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20550 linkers in which they give bogus error messages when linking some programs.
20551
20552 @item -msoft-float
20553 @opindex msoft-float
20554 Generate output containing library calls for floating point.
20555 @strong{Warning:} the requisite libraries are not available for all HPPA
20556 targets. Normally the facilities of the machine's usual C compiler are
20557 used, but this cannot be done directly in cross-compilation. You must make
20558 your own arrangements to provide suitable library functions for
20559 cross-compilation.
20560
20561 @option{-msoft-float} changes the calling convention in the output file;
20562 therefore, it is only useful if you compile @emph{all} of a program with
20563 this option. In particular, you need to compile @file{libgcc.a}, the
20564 library that comes with GCC, with @option{-msoft-float} in order for
20565 this to work.
20566
20567 @item -msio
20568 @opindex msio
20569 Generate the predefine, @code{_SIO}, for server IO@. The default is
20570 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20571 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20572 options are available under HP-UX and HI-UX@.
20573
20574 @item -mgnu-ld
20575 @opindex mgnu-ld
20576 Use options specific to GNU @command{ld}.
20577 This passes @option{-shared} to @command{ld} when
20578 building a shared library. It is the default when GCC is configured,
20579 explicitly or implicitly, with the GNU linker. This option does not
20580 affect which @command{ld} is called; it only changes what parameters
20581 are passed to that @command{ld}.
20582 The @command{ld} that is called is determined by the
20583 @option{--with-ld} configure option, GCC's program search path, and
20584 finally by the user's @env{PATH}. The linker used by GCC can be printed
20585 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20586 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20587
20588 @item -mhp-ld
20589 @opindex mhp-ld
20590 Use options specific to HP @command{ld}.
20591 This passes @option{-b} to @command{ld} when building
20592 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20593 links. It is the default when GCC is configured, explicitly or
20594 implicitly, with the HP linker. This option does not affect
20595 which @command{ld} is called; it only changes what parameters are passed to that
20596 @command{ld}.
20597 The @command{ld} that is called is determined by the @option{--with-ld}
20598 configure option, GCC's program search path, and finally by the user's
20599 @env{PATH}. The linker used by GCC can be printed using @samp{which
20600 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20601 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20602
20603 @item -mlong-calls
20604 @opindex mno-long-calls
20605 @opindex mlong-calls
20606 Generate code that uses long call sequences. This ensures that a call
20607 is always able to reach linker generated stubs. The default is to generate
20608 long calls only when the distance from the call site to the beginning
20609 of the function or translation unit, as the case may be, exceeds a
20610 predefined limit set by the branch type being used. The limits for
20611 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20612 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20613 240,000 bytes.
20614
20615 Distances are measured from the beginning of functions when using the
20616 @option{-ffunction-sections} option, or when using the @option{-mgas}
20617 and @option{-mno-portable-runtime} options together under HP-UX with
20618 the SOM linker.
20619
20620 It is normally not desirable to use this option as it degrades
20621 performance. However, it may be useful in large applications,
20622 particularly when partial linking is used to build the application.
20623
20624 The types of long calls used depends on the capabilities of the
20625 assembler and linker, and the type of code being generated. The
20626 impact on systems that support long absolute calls, and long pic
20627 symbol-difference or pc-relative calls should be relatively small.
20628 However, an indirect call is used on 32-bit ELF systems in pic code
20629 and it is quite long.
20630
20631 @item -munix=@var{unix-std}
20632 @opindex march
20633 Generate compiler predefines and select a startfile for the specified
20634 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20635 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20636 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20637 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20638 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20639 and later.
20640
20641 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20642 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20643 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20644 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20645 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20646 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20647
20648 It is @emph{important} to note that this option changes the interfaces
20649 for various library routines. It also affects the operational behavior
20650 of the C library. Thus, @emph{extreme} care is needed in using this
20651 option.
20652
20653 Library code that is intended to operate with more than one UNIX
20654 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20655 as appropriate. Most GNU software doesn't provide this capability.
20656
20657 @item -nolibdld
20658 @opindex nolibdld
20659 Suppress the generation of link options to search libdld.sl when the
20660 @option{-static} option is specified on HP-UX 10 and later.
20661
20662 @item -static
20663 @opindex static
20664 The HP-UX implementation of setlocale in libc has a dependency on
20665 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20666 when the @option{-static} option is specified, special link options
20667 are needed to resolve this dependency.
20668
20669 On HP-UX 10 and later, the GCC driver adds the necessary options to
20670 link with libdld.sl when the @option{-static} option is specified.
20671 This causes the resulting binary to be dynamic. On the 64-bit port,
20672 the linkers generate dynamic binaries by default in any case. The
20673 @option{-nolibdld} option can be used to prevent the GCC driver from
20674 adding these link options.
20675
20676 @item -threads
20677 @opindex threads
20678 Add support for multithreading with the @dfn{dce thread} library
20679 under HP-UX@. This option sets flags for both the preprocessor and
20680 linker.
20681 @end table
20682
20683 @node IA-64 Options
20684 @subsection IA-64 Options
20685 @cindex IA-64 Options
20686
20687 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20688
20689 @table @gcctabopt
20690 @item -mbig-endian
20691 @opindex mbig-endian
20692 Generate code for a big-endian target. This is the default for HP-UX@.
20693
20694 @item -mlittle-endian
20695 @opindex mlittle-endian
20696 Generate code for a little-endian target. This is the default for AIX5
20697 and GNU/Linux.
20698
20699 @item -mgnu-as
20700 @itemx -mno-gnu-as
20701 @opindex mgnu-as
20702 @opindex mno-gnu-as
20703 Generate (or don't) code for the GNU assembler. This is the default.
20704 @c Also, this is the default if the configure option @option{--with-gnu-as}
20705 @c is used.
20706
20707 @item -mgnu-ld
20708 @itemx -mno-gnu-ld
20709 @opindex mgnu-ld
20710 @opindex mno-gnu-ld
20711 Generate (or don't) code for the GNU linker. This is the default.
20712 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20713 @c is used.
20714
20715 @item -mno-pic
20716 @opindex mno-pic
20717 Generate code that does not use a global pointer register. The result
20718 is not position independent code, and violates the IA-64 ABI@.
20719
20720 @item -mvolatile-asm-stop
20721 @itemx -mno-volatile-asm-stop
20722 @opindex mvolatile-asm-stop
20723 @opindex mno-volatile-asm-stop
20724 Generate (or don't) a stop bit immediately before and after volatile asm
20725 statements.
20726
20727 @item -mregister-names
20728 @itemx -mno-register-names
20729 @opindex mregister-names
20730 @opindex mno-register-names
20731 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20732 the stacked registers. This may make assembler output more readable.
20733
20734 @item -mno-sdata
20735 @itemx -msdata
20736 @opindex mno-sdata
20737 @opindex msdata
20738 Disable (or enable) optimizations that use the small data section. This may
20739 be useful for working around optimizer bugs.
20740
20741 @item -mconstant-gp
20742 @opindex mconstant-gp
20743 Generate code that uses a single constant global pointer value. This is
20744 useful when compiling kernel code.
20745
20746 @item -mauto-pic
20747 @opindex mauto-pic
20748 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20749 This is useful when compiling firmware code.
20750
20751 @item -minline-float-divide-min-latency
20752 @opindex minline-float-divide-min-latency
20753 Generate code for inline divides of floating-point values
20754 using the minimum latency algorithm.
20755
20756 @item -minline-float-divide-max-throughput
20757 @opindex minline-float-divide-max-throughput
20758 Generate code for inline divides of floating-point values
20759 using the maximum throughput algorithm.
20760
20761 @item -mno-inline-float-divide
20762 @opindex mno-inline-float-divide
20763 Do not generate inline code for divides of floating-point values.
20764
20765 @item -minline-int-divide-min-latency
20766 @opindex minline-int-divide-min-latency
20767 Generate code for inline divides of integer values
20768 using the minimum latency algorithm.
20769
20770 @item -minline-int-divide-max-throughput
20771 @opindex minline-int-divide-max-throughput
20772 Generate code for inline divides of integer values
20773 using the maximum throughput algorithm.
20774
20775 @item -mno-inline-int-divide
20776 @opindex mno-inline-int-divide
20777 @opindex minline-int-divide
20778 Do not generate inline code for divides of integer values.
20779
20780 @item -minline-sqrt-min-latency
20781 @opindex minline-sqrt-min-latency
20782 Generate code for inline square roots
20783 using the minimum latency algorithm.
20784
20785 @item -minline-sqrt-max-throughput
20786 @opindex minline-sqrt-max-throughput
20787 Generate code for inline square roots
20788 using the maximum throughput algorithm.
20789
20790 @item -mno-inline-sqrt
20791 @opindex mno-inline-sqrt
20792 Do not generate inline code for @code{sqrt}.
20793
20794 @item -mfused-madd
20795 @itemx -mno-fused-madd
20796 @opindex mfused-madd
20797 @opindex mno-fused-madd
20798 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20799 instructions. The default is to use these instructions.
20800
20801 @item -mno-dwarf2-asm
20802 @itemx -mdwarf2-asm
20803 @opindex mno-dwarf2-asm
20804 @opindex mdwarf2-asm
20805 Don't (or do) generate assembler code for the DWARF line number debugging
20806 info. This may be useful when not using the GNU assembler.
20807
20808 @item -mearly-stop-bits
20809 @itemx -mno-early-stop-bits
20810 @opindex mearly-stop-bits
20811 @opindex mno-early-stop-bits
20812 Allow stop bits to be placed earlier than immediately preceding the
20813 instruction that triggered the stop bit. This can improve instruction
20814 scheduling, but does not always do so.
20815
20816 @item -mfixed-range=@var{register-range}
20817 @opindex mfixed-range
20818 Generate code treating the given register range as fixed registers.
20819 A fixed register is one that the register allocator cannot use. This is
20820 useful when compiling kernel code. A register range is specified as
20821 two registers separated by a dash. Multiple register ranges can be
20822 specified separated by a comma.
20823
20824 @item -mtls-size=@var{tls-size}
20825 @opindex mtls-size
20826 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20827 64.
20828
20829 @item -mtune=@var{cpu-type}
20830 @opindex mtune
20831 Tune the instruction scheduling for a particular CPU, Valid values are
20832 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20833 and @samp{mckinley}.
20834
20835 @item -milp32
20836 @itemx -mlp64
20837 @opindex milp32
20838 @opindex mlp64
20839 Generate code for a 32-bit or 64-bit environment.
20840 The 32-bit environment sets int, long and pointer to 32 bits.
20841 The 64-bit environment sets int to 32 bits and long and pointer
20842 to 64 bits. These are HP-UX specific flags.
20843
20844 @item -mno-sched-br-data-spec
20845 @itemx -msched-br-data-spec
20846 @opindex mno-sched-br-data-spec
20847 @opindex msched-br-data-spec
20848 (Dis/En)able data speculative scheduling before reload.
20849 This results in generation of @code{ld.a} instructions and
20850 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20851 The default setting is disabled.
20852
20853 @item -msched-ar-data-spec
20854 @itemx -mno-sched-ar-data-spec
20855 @opindex msched-ar-data-spec
20856 @opindex mno-sched-ar-data-spec
20857 (En/Dis)able data speculative scheduling after reload.
20858 This results in generation of @code{ld.a} instructions and
20859 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20860 The default setting is enabled.
20861
20862 @item -mno-sched-control-spec
20863 @itemx -msched-control-spec
20864 @opindex mno-sched-control-spec
20865 @opindex msched-control-spec
20866 (Dis/En)able control speculative scheduling. This feature is
20867 available only during region scheduling (i.e.@: before reload).
20868 This results in generation of the @code{ld.s} instructions and
20869 the corresponding check instructions @code{chk.s}.
20870 The default setting is disabled.
20871
20872 @item -msched-br-in-data-spec
20873 @itemx -mno-sched-br-in-data-spec
20874 @opindex msched-br-in-data-spec
20875 @opindex mno-sched-br-in-data-spec
20876 (En/Dis)able speculative scheduling of the instructions that
20877 are dependent on the data speculative loads before reload.
20878 This is effective only with @option{-msched-br-data-spec} enabled.
20879 The default setting is enabled.
20880
20881 @item -msched-ar-in-data-spec
20882 @itemx -mno-sched-ar-in-data-spec
20883 @opindex msched-ar-in-data-spec
20884 @opindex mno-sched-ar-in-data-spec
20885 (En/Dis)able speculative scheduling of the instructions that
20886 are dependent on the data speculative loads after reload.
20887 This is effective only with @option{-msched-ar-data-spec} enabled.
20888 The default setting is enabled.
20889
20890 @item -msched-in-control-spec
20891 @itemx -mno-sched-in-control-spec
20892 @opindex msched-in-control-spec
20893 @opindex mno-sched-in-control-spec
20894 (En/Dis)able speculative scheduling of the instructions that
20895 are dependent on the control speculative loads.
20896 This is effective only with @option{-msched-control-spec} enabled.
20897 The default setting is enabled.
20898
20899 @item -mno-sched-prefer-non-data-spec-insns
20900 @itemx -msched-prefer-non-data-spec-insns
20901 @opindex mno-sched-prefer-non-data-spec-insns
20902 @opindex msched-prefer-non-data-spec-insns
20903 If enabled, data-speculative instructions are chosen for schedule
20904 only if there are no other choices at the moment. This makes
20905 the use of the data speculation much more conservative.
20906 The default setting is disabled.
20907
20908 @item -mno-sched-prefer-non-control-spec-insns
20909 @itemx -msched-prefer-non-control-spec-insns
20910 @opindex mno-sched-prefer-non-control-spec-insns
20911 @opindex msched-prefer-non-control-spec-insns
20912 If enabled, control-speculative instructions are chosen for schedule
20913 only if there are no other choices at the moment. This makes
20914 the use of the control speculation much more conservative.
20915 The default setting is disabled.
20916
20917 @item -mno-sched-count-spec-in-critical-path
20918 @itemx -msched-count-spec-in-critical-path
20919 @opindex mno-sched-count-spec-in-critical-path
20920 @opindex msched-count-spec-in-critical-path
20921 If enabled, speculative dependencies are considered during
20922 computation of the instructions priorities. This makes the use of the
20923 speculation a bit more conservative.
20924 The default setting is disabled.
20925
20926 @item -msched-spec-ldc
20927 @opindex msched-spec-ldc
20928 Use a simple data speculation check. This option is on by default.
20929
20930 @item -msched-control-spec-ldc
20931 @opindex msched-spec-ldc
20932 Use a simple check for control speculation. This option is on by default.
20933
20934 @item -msched-stop-bits-after-every-cycle
20935 @opindex msched-stop-bits-after-every-cycle
20936 Place a stop bit after every cycle when scheduling. This option is on
20937 by default.
20938
20939 @item -msched-fp-mem-deps-zero-cost
20940 @opindex msched-fp-mem-deps-zero-cost
20941 Assume that floating-point stores and loads are not likely to cause a conflict
20942 when placed into the same instruction group. This option is disabled by
20943 default.
20944
20945 @item -msel-sched-dont-check-control-spec
20946 @opindex msel-sched-dont-check-control-spec
20947 Generate checks for control speculation in selective scheduling.
20948 This flag is disabled by default.
20949
20950 @item -msched-max-memory-insns=@var{max-insns}
20951 @opindex msched-max-memory-insns
20952 Limit on the number of memory insns per instruction group, giving lower
20953 priority to subsequent memory insns attempting to schedule in the same
20954 instruction group. Frequently useful to prevent cache bank conflicts.
20955 The default value is 1.
20956
20957 @item -msched-max-memory-insns-hard-limit
20958 @opindex msched-max-memory-insns-hard-limit
20959 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20960 disallowing more than that number in an instruction group.
20961 Otherwise, the limit is ``soft'', meaning that non-memory operations
20962 are preferred when the limit is reached, but memory operations may still
20963 be scheduled.
20964
20965 @end table
20966
20967 @node LM32 Options
20968 @subsection LM32 Options
20969 @cindex LM32 options
20970
20971 These @option{-m} options are defined for the LatticeMico32 architecture:
20972
20973 @table @gcctabopt
20974 @item -mbarrel-shift-enabled
20975 @opindex mbarrel-shift-enabled
20976 Enable barrel-shift instructions.
20977
20978 @item -mdivide-enabled
20979 @opindex mdivide-enabled
20980 Enable divide and modulus instructions.
20981
20982 @item -mmultiply-enabled
20983 @opindex multiply-enabled
20984 Enable multiply instructions.
20985
20986 @item -msign-extend-enabled
20987 @opindex msign-extend-enabled
20988 Enable sign extend instructions.
20989
20990 @item -muser-enabled
20991 @opindex muser-enabled
20992 Enable user-defined instructions.
20993
20994 @end table
20995
20996 @node M32C Options
20997 @subsection M32C Options
20998 @cindex M32C options
20999
21000 @table @gcctabopt
21001 @item -mcpu=@var{name}
21002 @opindex mcpu=
21003 Select the CPU for which code is generated. @var{name} may be one of
21004 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
21005 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
21006 the M32C/80 series.
21007
21008 @item -msim
21009 @opindex msim
21010 Specifies that the program will be run on the simulator. This causes
21011 an alternate runtime library to be linked in which supports, for
21012 example, file I/O@. You must not use this option when generating
21013 programs that will run on real hardware; you must provide your own
21014 runtime library for whatever I/O functions are needed.
21015
21016 @item -memregs=@var{number}
21017 @opindex memregs=
21018 Specifies the number of memory-based pseudo-registers GCC uses
21019 during code generation. These pseudo-registers are used like real
21020 registers, so there is a tradeoff between GCC's ability to fit the
21021 code into available registers, and the performance penalty of using
21022 memory instead of registers. Note that all modules in a program must
21023 be compiled with the same value for this option. Because of that, you
21024 must not use this option with GCC's default runtime libraries.
21025
21026 @end table
21027
21028 @node M32R/D Options
21029 @subsection M32R/D Options
21030 @cindex M32R/D options
21031
21032 These @option{-m} options are defined for Renesas M32R/D architectures:
21033
21034 @table @gcctabopt
21035 @item -m32r2
21036 @opindex m32r2
21037 Generate code for the M32R/2@.
21038
21039 @item -m32rx
21040 @opindex m32rx
21041 Generate code for the M32R/X@.
21042
21043 @item -m32r
21044 @opindex m32r
21045 Generate code for the M32R@. This is the default.
21046
21047 @item -mmodel=small
21048 @opindex mmodel=small
21049 Assume all objects live in the lower 16MB of memory (so that their addresses
21050 can be loaded with the @code{ld24} instruction), and assume all subroutines
21051 are reachable with the @code{bl} instruction.
21052 This is the default.
21053
21054 The addressability of a particular object can be set with the
21055 @code{model} attribute.
21056
21057 @item -mmodel=medium
21058 @opindex mmodel=medium
21059 Assume objects may be anywhere in the 32-bit address space (the compiler
21060 generates @code{seth/add3} instructions to load their addresses), and
21061 assume all subroutines are reachable with the @code{bl} instruction.
21062
21063 @item -mmodel=large
21064 @opindex mmodel=large
21065 Assume objects may be anywhere in the 32-bit address space (the compiler
21066 generates @code{seth/add3} instructions to load their addresses), and
21067 assume subroutines may not be reachable with the @code{bl} instruction
21068 (the compiler generates the much slower @code{seth/add3/jl}
21069 instruction sequence).
21070
21071 @item -msdata=none
21072 @opindex msdata=none
21073 Disable use of the small data area. Variables are put into
21074 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
21075 @code{section} attribute has been specified).
21076 This is the default.
21077
21078 The small data area consists of sections @code{.sdata} and @code{.sbss}.
21079 Objects may be explicitly put in the small data area with the
21080 @code{section} attribute using one of these sections.
21081
21082 @item -msdata=sdata
21083 @opindex msdata=sdata
21084 Put small global and static data in the small data area, but do not
21085 generate special code to reference them.
21086
21087 @item -msdata=use
21088 @opindex msdata=use
21089 Put small global and static data in the small data area, and generate
21090 special instructions to reference them.
21091
21092 @item -G @var{num}
21093 @opindex G
21094 @cindex smaller data references
21095 Put global and static objects less than or equal to @var{num} bytes
21096 into the small data or BSS sections instead of the normal data or BSS
21097 sections. The default value of @var{num} is 8.
21098 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
21099 for this option to have any effect.
21100
21101 All modules should be compiled with the same @option{-G @var{num}} value.
21102 Compiling with different values of @var{num} may or may not work; if it
21103 doesn't the linker gives an error message---incorrect code is not
21104 generated.
21105
21106 @item -mdebug
21107 @opindex mdebug
21108 Makes the M32R-specific code in the compiler display some statistics
21109 that might help in debugging programs.
21110
21111 @item -malign-loops
21112 @opindex malign-loops
21113 Align all loops to a 32-byte boundary.
21114
21115 @item -mno-align-loops
21116 @opindex mno-align-loops
21117 Do not enforce a 32-byte alignment for loops. This is the default.
21118
21119 @item -missue-rate=@var{number}
21120 @opindex missue-rate=@var{number}
21121 Issue @var{number} instructions per cycle. @var{number} can only be 1
21122 or 2.
21123
21124 @item -mbranch-cost=@var{number}
21125 @opindex mbranch-cost=@var{number}
21126 @var{number} can only be 1 or 2. If it is 1 then branches are
21127 preferred over conditional code, if it is 2, then the opposite applies.
21128
21129 @item -mflush-trap=@var{number}
21130 @opindex mflush-trap=@var{number}
21131 Specifies the trap number to use to flush the cache. The default is
21132 12. Valid numbers are between 0 and 15 inclusive.
21133
21134 @item -mno-flush-trap
21135 @opindex mno-flush-trap
21136 Specifies that the cache cannot be flushed by using a trap.
21137
21138 @item -mflush-func=@var{name}
21139 @opindex mflush-func=@var{name}
21140 Specifies the name of the operating system function to call to flush
21141 the cache. The default is @samp{_flush_cache}, but a function call
21142 is only used if a trap is not available.
21143
21144 @item -mno-flush-func
21145 @opindex mno-flush-func
21146 Indicates that there is no OS function for flushing the cache.
21147
21148 @end table
21149
21150 @node M680x0 Options
21151 @subsection M680x0 Options
21152 @cindex M680x0 options
21153
21154 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21155 The default settings depend on which architecture was selected when
21156 the compiler was configured; the defaults for the most common choices
21157 are given below.
21158
21159 @table @gcctabopt
21160 @item -march=@var{arch}
21161 @opindex march
21162 Generate code for a specific M680x0 or ColdFire instruction set
21163 architecture. Permissible values of @var{arch} for M680x0
21164 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21165 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
21166 architectures are selected according to Freescale's ISA classification
21167 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21168 @samp{isab} and @samp{isac}.
21169
21170 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21171 code for a ColdFire target. The @var{arch} in this macro is one of the
21172 @option{-march} arguments given above.
21173
21174 When used together, @option{-march} and @option{-mtune} select code
21175 that runs on a family of similar processors but that is optimized
21176 for a particular microarchitecture.
21177
21178 @item -mcpu=@var{cpu}
21179 @opindex mcpu
21180 Generate code for a specific M680x0 or ColdFire processor.
21181 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21182 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21183 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21184 below, which also classifies the CPUs into families:
21185
21186 @multitable @columnfractions 0.20 0.80
21187 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21188 @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}
21189 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21190 @item @samp{5206e} @tab @samp{5206e}
21191 @item @samp{5208} @tab @samp{5207} @samp{5208}
21192 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21193 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21194 @item @samp{5216} @tab @samp{5214} @samp{5216}
21195 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21196 @item @samp{5225} @tab @samp{5224} @samp{5225}
21197 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21198 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21199 @item @samp{5249} @tab @samp{5249}
21200 @item @samp{5250} @tab @samp{5250}
21201 @item @samp{5271} @tab @samp{5270} @samp{5271}
21202 @item @samp{5272} @tab @samp{5272}
21203 @item @samp{5275} @tab @samp{5274} @samp{5275}
21204 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21205 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21206 @item @samp{5307} @tab @samp{5307}
21207 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21208 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21209 @item @samp{5407} @tab @samp{5407}
21210 @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}
21211 @end multitable
21212
21213 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21214 @var{arch} is compatible with @var{cpu}. Other combinations of
21215 @option{-mcpu} and @option{-march} are rejected.
21216
21217 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21218 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21219 where the value of @var{family} is given by the table above.
21220
21221 @item -mtune=@var{tune}
21222 @opindex mtune
21223 Tune the code for a particular microarchitecture within the
21224 constraints set by @option{-march} and @option{-mcpu}.
21225 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21226 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21227 and @samp{cpu32}. The ColdFire microarchitectures
21228 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21229
21230 You can also use @option{-mtune=68020-40} for code that needs
21231 to run relatively well on 68020, 68030 and 68040 targets.
21232 @option{-mtune=68020-60} is similar but includes 68060 targets
21233 as well. These two options select the same tuning decisions as
21234 @option{-m68020-40} and @option{-m68020-60} respectively.
21235
21236 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21237 when tuning for 680x0 architecture @var{arch}. It also defines
21238 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21239 option is used. If GCC is tuning for a range of architectures,
21240 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21241 it defines the macros for every architecture in the range.
21242
21243 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21244 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21245 of the arguments given above.
21246
21247 @item -m68000
21248 @itemx -mc68000
21249 @opindex m68000
21250 @opindex mc68000
21251 Generate output for a 68000. This is the default
21252 when the compiler is configured for 68000-based systems.
21253 It is equivalent to @option{-march=68000}.
21254
21255 Use this option for microcontrollers with a 68000 or EC000 core,
21256 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21257
21258 @item -m68010
21259 @opindex m68010
21260 Generate output for a 68010. This is the default
21261 when the compiler is configured for 68010-based systems.
21262 It is equivalent to @option{-march=68010}.
21263
21264 @item -m68020
21265 @itemx -mc68020
21266 @opindex m68020
21267 @opindex mc68020
21268 Generate output for a 68020. This is the default
21269 when the compiler is configured for 68020-based systems.
21270 It is equivalent to @option{-march=68020}.
21271
21272 @item -m68030
21273 @opindex m68030
21274 Generate output for a 68030. This is the default when the compiler is
21275 configured for 68030-based systems. It is equivalent to
21276 @option{-march=68030}.
21277
21278 @item -m68040
21279 @opindex m68040
21280 Generate output for a 68040. This is the default when the compiler is
21281 configured for 68040-based systems. It is equivalent to
21282 @option{-march=68040}.
21283
21284 This option inhibits the use of 68881/68882 instructions that have to be
21285 emulated by software on the 68040. Use this option if your 68040 does not
21286 have code to emulate those instructions.
21287
21288 @item -m68060
21289 @opindex m68060
21290 Generate output for a 68060. This is the default when the compiler is
21291 configured for 68060-based systems. It is equivalent to
21292 @option{-march=68060}.
21293
21294 This option inhibits the use of 68020 and 68881/68882 instructions that
21295 have to be emulated by software on the 68060. Use this option if your 68060
21296 does not have code to emulate those instructions.
21297
21298 @item -mcpu32
21299 @opindex mcpu32
21300 Generate output for a CPU32. This is the default
21301 when the compiler is configured for CPU32-based systems.
21302 It is equivalent to @option{-march=cpu32}.
21303
21304 Use this option for microcontrollers with a
21305 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21306 68336, 68340, 68341, 68349 and 68360.
21307
21308 @item -m5200
21309 @opindex m5200
21310 Generate output for a 520X ColdFire CPU@. This is the default
21311 when the compiler is configured for 520X-based systems.
21312 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21313 in favor of that option.
21314
21315 Use this option for microcontroller with a 5200 core, including
21316 the MCF5202, MCF5203, MCF5204 and MCF5206.
21317
21318 @item -m5206e
21319 @opindex m5206e
21320 Generate output for a 5206e ColdFire CPU@. The option is now
21321 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21322
21323 @item -m528x
21324 @opindex m528x
21325 Generate output for a member of the ColdFire 528X family.
21326 The option is now deprecated in favor of the equivalent
21327 @option{-mcpu=528x}.
21328
21329 @item -m5307
21330 @opindex m5307
21331 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21332 in favor of the equivalent @option{-mcpu=5307}.
21333
21334 @item -m5407
21335 @opindex m5407
21336 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21337 in favor of the equivalent @option{-mcpu=5407}.
21338
21339 @item -mcfv4e
21340 @opindex mcfv4e
21341 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21342 This includes use of hardware floating-point instructions.
21343 The option is equivalent to @option{-mcpu=547x}, and is now
21344 deprecated in favor of that option.
21345
21346 @item -m68020-40
21347 @opindex m68020-40
21348 Generate output for a 68040, without using any of the new instructions.
21349 This results in code that can run relatively efficiently on either a
21350 68020/68881 or a 68030 or a 68040. The generated code does use the
21351 68881 instructions that are emulated on the 68040.
21352
21353 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21354
21355 @item -m68020-60
21356 @opindex m68020-60
21357 Generate output for a 68060, without using any of the new instructions.
21358 This results in code that can run relatively efficiently on either a
21359 68020/68881 or a 68030 or a 68040. The generated code does use the
21360 68881 instructions that are emulated on the 68060.
21361
21362 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21363
21364 @item -mhard-float
21365 @itemx -m68881
21366 @opindex mhard-float
21367 @opindex m68881
21368 Generate floating-point instructions. This is the default for 68020
21369 and above, and for ColdFire devices that have an FPU@. It defines the
21370 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21371 on ColdFire targets.
21372
21373 @item -msoft-float
21374 @opindex msoft-float
21375 Do not generate floating-point instructions; use library calls instead.
21376 This is the default for 68000, 68010, and 68832 targets. It is also
21377 the default for ColdFire devices that have no FPU.
21378
21379 @item -mdiv
21380 @itemx -mno-div
21381 @opindex mdiv
21382 @opindex mno-div
21383 Generate (do not generate) ColdFire hardware divide and remainder
21384 instructions. If @option{-march} is used without @option{-mcpu},
21385 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21386 architectures. Otherwise, the default is taken from the target CPU
21387 (either the default CPU, or the one specified by @option{-mcpu}). For
21388 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21389 @option{-mcpu=5206e}.
21390
21391 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21392
21393 @item -mshort
21394 @opindex mshort
21395 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21396 Additionally, parameters passed on the stack are also aligned to a
21397 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21398
21399 @item -mno-short
21400 @opindex mno-short
21401 Do not consider type @code{int} to be 16 bits wide. This is the default.
21402
21403 @item -mnobitfield
21404 @itemx -mno-bitfield
21405 @opindex mnobitfield
21406 @opindex mno-bitfield
21407 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21408 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21409
21410 @item -mbitfield
21411 @opindex mbitfield
21412 Do use the bit-field instructions. The @option{-m68020} option implies
21413 @option{-mbitfield}. This is the default if you use a configuration
21414 designed for a 68020.
21415
21416 @item -mrtd
21417 @opindex mrtd
21418 Use a different function-calling convention, in which functions
21419 that take a fixed number of arguments return with the @code{rtd}
21420 instruction, which pops their arguments while returning. This
21421 saves one instruction in the caller since there is no need to pop
21422 the arguments there.
21423
21424 This calling convention is incompatible with the one normally
21425 used on Unix, so you cannot use it if you need to call libraries
21426 compiled with the Unix compiler.
21427
21428 Also, you must provide function prototypes for all functions that
21429 take variable numbers of arguments (including @code{printf});
21430 otherwise incorrect code is generated for calls to those
21431 functions.
21432
21433 In addition, seriously incorrect code results if you call a
21434 function with too many arguments. (Normally, extra arguments are
21435 harmlessly ignored.)
21436
21437 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21438 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21439
21440 The default is @option{-mno-rtd}.
21441
21442 @item -malign-int
21443 @itemx -mno-align-int
21444 @opindex malign-int
21445 @opindex mno-align-int
21446 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21447 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21448 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21449 Aligning variables on 32-bit boundaries produces code that runs somewhat
21450 faster on processors with 32-bit busses at the expense of more memory.
21451
21452 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21453 aligns structures containing the above types differently than
21454 most published application binary interface specifications for the m68k.
21455
21456 @item -mpcrel
21457 @opindex mpcrel
21458 Use the pc-relative addressing mode of the 68000 directly, instead of
21459 using a global offset table. At present, this option implies @option{-fpic},
21460 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21461 not presently supported with @option{-mpcrel}, though this could be supported for
21462 68020 and higher processors.
21463
21464 @item -mno-strict-align
21465 @itemx -mstrict-align
21466 @opindex mno-strict-align
21467 @opindex mstrict-align
21468 Do not (do) assume that unaligned memory references are handled by
21469 the system.
21470
21471 @item -msep-data
21472 Generate code that allows the data segment to be located in a different
21473 area of memory from the text segment. This allows for execute-in-place in
21474 an environment without virtual memory management. This option implies
21475 @option{-fPIC}.
21476
21477 @item -mno-sep-data
21478 Generate code that assumes that the data segment follows the text segment.
21479 This is the default.
21480
21481 @item -mid-shared-library
21482 Generate code that supports shared libraries via the library ID method.
21483 This allows for execute-in-place and shared libraries in an environment
21484 without virtual memory management. This option implies @option{-fPIC}.
21485
21486 @item -mno-id-shared-library
21487 Generate code that doesn't assume ID-based shared libraries are being used.
21488 This is the default.
21489
21490 @item -mshared-library-id=n
21491 Specifies the identification number of the ID-based shared library being
21492 compiled. Specifying a value of 0 generates more compact code; specifying
21493 other values forces the allocation of that number to the current
21494 library, but is no more space- or time-efficient than omitting this option.
21495
21496 @item -mxgot
21497 @itemx -mno-xgot
21498 @opindex mxgot
21499 @opindex mno-xgot
21500 When generating position-independent code for ColdFire, generate code
21501 that works if the GOT has more than 8192 entries. This code is
21502 larger and slower than code generated without this option. On M680x0
21503 processors, this option is not needed; @option{-fPIC} suffices.
21504
21505 GCC normally uses a single instruction to load values from the GOT@.
21506 While this is relatively efficient, it only works if the GOT
21507 is smaller than about 64k. Anything larger causes the linker
21508 to report an error such as:
21509
21510 @cindex relocation truncated to fit (ColdFire)
21511 @smallexample
21512 relocation truncated to fit: R_68K_GOT16O foobar
21513 @end smallexample
21514
21515 If this happens, you should recompile your code with @option{-mxgot}.
21516 It should then work with very large GOTs. However, code generated with
21517 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21518 the value of a global symbol.
21519
21520 Note that some linkers, including newer versions of the GNU linker,
21521 can create multiple GOTs and sort GOT entries. If you have such a linker,
21522 you should only need to use @option{-mxgot} when compiling a single
21523 object file that accesses more than 8192 GOT entries. Very few do.
21524
21525 These options have no effect unless GCC is generating
21526 position-independent code.
21527
21528 @item -mlong-jump-table-offsets
21529 @opindex mlong-jump-table-offsets
21530 Use 32-bit offsets in @code{switch} tables. The default is to use
21531 16-bit offsets.
21532
21533 @end table
21534
21535 @node MCore Options
21536 @subsection MCore Options
21537 @cindex MCore options
21538
21539 These are the @samp{-m} options defined for the Motorola M*Core
21540 processors.
21541
21542 @table @gcctabopt
21543
21544 @item -mhardlit
21545 @itemx -mno-hardlit
21546 @opindex mhardlit
21547 @opindex mno-hardlit
21548 Inline constants into the code stream if it can be done in two
21549 instructions or less.
21550
21551 @item -mdiv
21552 @itemx -mno-div
21553 @opindex mdiv
21554 @opindex mno-div
21555 Use the divide instruction. (Enabled by default).
21556
21557 @item -mrelax-immediate
21558 @itemx -mno-relax-immediate
21559 @opindex mrelax-immediate
21560 @opindex mno-relax-immediate
21561 Allow arbitrary-sized immediates in bit operations.
21562
21563 @item -mwide-bitfields
21564 @itemx -mno-wide-bitfields
21565 @opindex mwide-bitfields
21566 @opindex mno-wide-bitfields
21567 Always treat bit-fields as @code{int}-sized.
21568
21569 @item -m4byte-functions
21570 @itemx -mno-4byte-functions
21571 @opindex m4byte-functions
21572 @opindex mno-4byte-functions
21573 Force all functions to be aligned to a 4-byte boundary.
21574
21575 @item -mcallgraph-data
21576 @itemx -mno-callgraph-data
21577 @opindex mcallgraph-data
21578 @opindex mno-callgraph-data
21579 Emit callgraph information.
21580
21581 @item -mslow-bytes
21582 @itemx -mno-slow-bytes
21583 @opindex mslow-bytes
21584 @opindex mno-slow-bytes
21585 Prefer word access when reading byte quantities.
21586
21587 @item -mlittle-endian
21588 @itemx -mbig-endian
21589 @opindex mlittle-endian
21590 @opindex mbig-endian
21591 Generate code for a little-endian target.
21592
21593 @item -m210
21594 @itemx -m340
21595 @opindex m210
21596 @opindex m340
21597 Generate code for the 210 processor.
21598
21599 @item -mno-lsim
21600 @opindex mno-lsim
21601 Assume that runtime support has been provided and so omit the
21602 simulator library (@file{libsim.a)} from the linker command line.
21603
21604 @item -mstack-increment=@var{size}
21605 @opindex mstack-increment
21606 Set the maximum amount for a single stack increment operation. Large
21607 values can increase the speed of programs that contain functions
21608 that need a large amount of stack space, but they can also trigger a
21609 segmentation fault if the stack is extended too much. The default
21610 value is 0x1000.
21611
21612 @end table
21613
21614 @node MeP Options
21615 @subsection MeP Options
21616 @cindex MeP options
21617
21618 @table @gcctabopt
21619
21620 @item -mabsdiff
21621 @opindex mabsdiff
21622 Enables the @code{abs} instruction, which is the absolute difference
21623 between two registers.
21624
21625 @item -mall-opts
21626 @opindex mall-opts
21627 Enables all the optional instructions---average, multiply, divide, bit
21628 operations, leading zero, absolute difference, min/max, clip, and
21629 saturation.
21630
21631
21632 @item -maverage
21633 @opindex maverage
21634 Enables the @code{ave} instruction, which computes the average of two
21635 registers.
21636
21637 @item -mbased=@var{n}
21638 @opindex mbased=
21639 Variables of size @var{n} bytes or smaller are placed in the
21640 @code{.based} section by default. Based variables use the @code{$tp}
21641 register as a base register, and there is a 128-byte limit to the
21642 @code{.based} section.
21643
21644 @item -mbitops
21645 @opindex mbitops
21646 Enables the bit operation instructions---bit test (@code{btstm}), set
21647 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21648 test-and-set (@code{tas}).
21649
21650 @item -mc=@var{name}
21651 @opindex mc=
21652 Selects which section constant data is placed in. @var{name} may
21653 be @samp{tiny}, @samp{near}, or @samp{far}.
21654
21655 @item -mclip
21656 @opindex mclip
21657 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21658 useful unless you also provide @option{-mminmax}.
21659
21660 @item -mconfig=@var{name}
21661 @opindex mconfig=
21662 Selects one of the built-in core configurations. Each MeP chip has
21663 one or more modules in it; each module has a core CPU and a variety of
21664 coprocessors, optional instructions, and peripherals. The
21665 @code{MeP-Integrator} tool, not part of GCC, provides these
21666 configurations through this option; using this option is the same as
21667 using all the corresponding command-line options. The default
21668 configuration is @samp{default}.
21669
21670 @item -mcop
21671 @opindex mcop
21672 Enables the coprocessor instructions. By default, this is a 32-bit
21673 coprocessor. Note that the coprocessor is normally enabled via the
21674 @option{-mconfig=} option.
21675
21676 @item -mcop32
21677 @opindex mcop32
21678 Enables the 32-bit coprocessor's instructions.
21679
21680 @item -mcop64
21681 @opindex mcop64
21682 Enables the 64-bit coprocessor's instructions.
21683
21684 @item -mivc2
21685 @opindex mivc2
21686 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21687
21688 @item -mdc
21689 @opindex mdc
21690 Causes constant variables to be placed in the @code{.near} section.
21691
21692 @item -mdiv
21693 @opindex mdiv
21694 Enables the @code{div} and @code{divu} instructions.
21695
21696 @item -meb
21697 @opindex meb
21698 Generate big-endian code.
21699
21700 @item -mel
21701 @opindex mel
21702 Generate little-endian code.
21703
21704 @item -mio-volatile
21705 @opindex mio-volatile
21706 Tells the compiler that any variable marked with the @code{io}
21707 attribute is to be considered volatile.
21708
21709 @item -ml
21710 @opindex ml
21711 Causes variables to be assigned to the @code{.far} section by default.
21712
21713 @item -mleadz
21714 @opindex mleadz
21715 Enables the @code{leadz} (leading zero) instruction.
21716
21717 @item -mm
21718 @opindex mm
21719 Causes variables to be assigned to the @code{.near} section by default.
21720
21721 @item -mminmax
21722 @opindex mminmax
21723 Enables the @code{min} and @code{max} instructions.
21724
21725 @item -mmult
21726 @opindex mmult
21727 Enables the multiplication and multiply-accumulate instructions.
21728
21729 @item -mno-opts
21730 @opindex mno-opts
21731 Disables all the optional instructions enabled by @option{-mall-opts}.
21732
21733 @item -mrepeat
21734 @opindex mrepeat
21735 Enables the @code{repeat} and @code{erepeat} instructions, used for
21736 low-overhead looping.
21737
21738 @item -ms
21739 @opindex ms
21740 Causes all variables to default to the @code{.tiny} section. Note
21741 that there is a 65536-byte limit to this section. Accesses to these
21742 variables use the @code{%gp} base register.
21743
21744 @item -msatur
21745 @opindex msatur
21746 Enables the saturation instructions. Note that the compiler does not
21747 currently generate these itself, but this option is included for
21748 compatibility with other tools, like @code{as}.
21749
21750 @item -msdram
21751 @opindex msdram
21752 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21753
21754 @item -msim
21755 @opindex msim
21756 Link the simulator run-time libraries.
21757
21758 @item -msimnovec
21759 @opindex msimnovec
21760 Link the simulator runtime libraries, excluding built-in support
21761 for reset and exception vectors and tables.
21762
21763 @item -mtf
21764 @opindex mtf
21765 Causes all functions to default to the @code{.far} section. Without
21766 this option, functions default to the @code{.near} section.
21767
21768 @item -mtiny=@var{n}
21769 @opindex mtiny=
21770 Variables that are @var{n} bytes or smaller are allocated to the
21771 @code{.tiny} section. These variables use the @code{$gp} base
21772 register. The default for this option is 4, but note that there's a
21773 65536-byte limit to the @code{.tiny} section.
21774
21775 @end table
21776
21777 @node MicroBlaze Options
21778 @subsection MicroBlaze Options
21779 @cindex MicroBlaze Options
21780
21781 @table @gcctabopt
21782
21783 @item -msoft-float
21784 @opindex msoft-float
21785 Use software emulation for floating point (default).
21786
21787 @item -mhard-float
21788 @opindex mhard-float
21789 Use hardware floating-point instructions.
21790
21791 @item -mmemcpy
21792 @opindex mmemcpy
21793 Do not optimize block moves, use @code{memcpy}.
21794
21795 @item -mno-clearbss
21796 @opindex mno-clearbss
21797 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21798
21799 @item -mcpu=@var{cpu-type}
21800 @opindex mcpu=
21801 Use features of, and schedule code for, the given CPU.
21802 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21803 where @var{X} is a major version, @var{YY} is the minor version, and
21804 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21805 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21806
21807 @item -mxl-soft-mul
21808 @opindex mxl-soft-mul
21809 Use software multiply emulation (default).
21810
21811 @item -mxl-soft-div
21812 @opindex mxl-soft-div
21813 Use software emulation for divides (default).
21814
21815 @item -mxl-barrel-shift
21816 @opindex mxl-barrel-shift
21817 Use the hardware barrel shifter.
21818
21819 @item -mxl-pattern-compare
21820 @opindex mxl-pattern-compare
21821 Use pattern compare instructions.
21822
21823 @item -msmall-divides
21824 @opindex msmall-divides
21825 Use table lookup optimization for small signed integer divisions.
21826
21827 @item -mxl-stack-check
21828 @opindex mxl-stack-check
21829 This option is deprecated. Use @option{-fstack-check} instead.
21830
21831 @item -mxl-gp-opt
21832 @opindex mxl-gp-opt
21833 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21834
21835 @item -mxl-multiply-high
21836 @opindex mxl-multiply-high
21837 Use multiply high instructions for high part of 32x32 multiply.
21838
21839 @item -mxl-float-convert
21840 @opindex mxl-float-convert
21841 Use hardware floating-point conversion instructions.
21842
21843 @item -mxl-float-sqrt
21844 @opindex mxl-float-sqrt
21845 Use hardware floating-point square root instruction.
21846
21847 @item -mbig-endian
21848 @opindex mbig-endian
21849 Generate code for a big-endian target.
21850
21851 @item -mlittle-endian
21852 @opindex mlittle-endian
21853 Generate code for a little-endian target.
21854
21855 @item -mxl-reorder
21856 @opindex mxl-reorder
21857 Use reorder instructions (swap and byte reversed load/store).
21858
21859 @item -mxl-mode-@var{app-model}
21860 Select application model @var{app-model}. Valid models are
21861 @table @samp
21862 @item executable
21863 normal executable (default), uses startup code @file{crt0.o}.
21864
21865 @item -mpic-data-is-text-relative
21866 @opindex mpic-data-is-text-relative
21867 Assume that the displacement between the text and data segments is fixed
21868 at static link time. This allows data to be referenced by offset from start of
21869 text address instead of GOT since PC-relative addressing is not supported.
21870
21871 @item xmdstub
21872 for use with Xilinx Microprocessor Debugger (XMD) based
21873 software intrusive debug agent called xmdstub. This uses startup file
21874 @file{crt1.o} and sets the start address of the program to 0x800.
21875
21876 @item bootstrap
21877 for applications that are loaded using a bootloader.
21878 This model uses startup file @file{crt2.o} which does not contain a processor
21879 reset vector handler. This is suitable for transferring control on a
21880 processor reset to the bootloader rather than the application.
21881
21882 @item novectors
21883 for applications that do not require any of the
21884 MicroBlaze vectors. This option may be useful for applications running
21885 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21886 @end table
21887
21888 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21889 @option{-mxl-mode-@var{app-model}}.
21890
21891 @end table
21892
21893 @node MIPS Options
21894 @subsection MIPS Options
21895 @cindex MIPS options
21896
21897 @table @gcctabopt
21898
21899 @item -EB
21900 @opindex EB
21901 Generate big-endian code.
21902
21903 @item -EL
21904 @opindex EL
21905 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21906 configurations.
21907
21908 @item -march=@var{arch}
21909 @opindex march
21910 Generate code that runs on @var{arch}, which can be the name of a
21911 generic MIPS ISA, or the name of a particular processor.
21912 The ISA names are:
21913 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21914 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21915 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21916 @samp{mips64r5} and @samp{mips64r6}.
21917 The processor names are:
21918 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21919 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21920 @samp{5kc}, @samp{5kf},
21921 @samp{20kc},
21922 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21923 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21924 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21925 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21926 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21927 @samp{i6400}, @samp{i6500},
21928 @samp{interaptiv},
21929 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21930 @samp{gs464e}, @samp{gs264e},
21931 @samp{m4k},
21932 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21933 @samp{m5100}, @samp{m5101},
21934 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21935 @samp{orion},
21936 @samp{p5600}, @samp{p6600},
21937 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21938 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21939 @samp{r6000}, @samp{r8000},
21940 @samp{rm7000}, @samp{rm9000},
21941 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21942 @samp{sb1},
21943 @samp{sr71000},
21944 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21945 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21946 @samp{xlr} and @samp{xlp}.
21947 The special value @samp{from-abi} selects the
21948 most compatible architecture for the selected ABI (that is,
21949 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21950
21951 The native Linux/GNU toolchain also supports the value @samp{native},
21952 which selects the best architecture option for the host processor.
21953 @option{-march=native} has no effect if GCC does not recognize
21954 the processor.
21955
21956 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21957 (for example, @option{-march=r2k}). Prefixes are optional, and
21958 @samp{vr} may be written @samp{r}.
21959
21960 Names of the form @samp{@var{n}f2_1} refer to processors with
21961 FPUs clocked at half the rate of the core, names of the form
21962 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21963 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21964 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21965 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21966 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21967 accepted as synonyms for @samp{@var{n}f1_1}.
21968
21969 GCC defines two macros based on the value of this option. The first
21970 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21971 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21972 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21973 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21974 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21975
21976 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21977 above. In other words, it has the full prefix and does not
21978 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21979 the macro names the resolved architecture (either @code{"mips1"} or
21980 @code{"mips3"}). It names the default architecture when no
21981 @option{-march} option is given.
21982
21983 @item -mtune=@var{arch}
21984 @opindex mtune
21985 Optimize for @var{arch}. Among other things, this option controls
21986 the way instructions are scheduled, and the perceived cost of arithmetic
21987 operations. The list of @var{arch} values is the same as for
21988 @option{-march}.
21989
21990 When this option is not used, GCC optimizes for the processor
21991 specified by @option{-march}. By using @option{-march} and
21992 @option{-mtune} together, it is possible to generate code that
21993 runs on a family of processors, but optimize the code for one
21994 particular member of that family.
21995
21996 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21997 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21998 @option{-march} ones described above.
21999
22000 @item -mips1
22001 @opindex mips1
22002 Equivalent to @option{-march=mips1}.
22003
22004 @item -mips2
22005 @opindex mips2
22006 Equivalent to @option{-march=mips2}.
22007
22008 @item -mips3
22009 @opindex mips3
22010 Equivalent to @option{-march=mips3}.
22011
22012 @item -mips4
22013 @opindex mips4
22014 Equivalent to @option{-march=mips4}.
22015
22016 @item -mips32
22017 @opindex mips32
22018 Equivalent to @option{-march=mips32}.
22019
22020 @item -mips32r3
22021 @opindex mips32r3
22022 Equivalent to @option{-march=mips32r3}.
22023
22024 @item -mips32r5
22025 @opindex mips32r5
22026 Equivalent to @option{-march=mips32r5}.
22027
22028 @item -mips32r6
22029 @opindex mips32r6
22030 Equivalent to @option{-march=mips32r6}.
22031
22032 @item -mips64
22033 @opindex mips64
22034 Equivalent to @option{-march=mips64}.
22035
22036 @item -mips64r2
22037 @opindex mips64r2
22038 Equivalent to @option{-march=mips64r2}.
22039
22040 @item -mips64r3
22041 @opindex mips64r3
22042 Equivalent to @option{-march=mips64r3}.
22043
22044 @item -mips64r5
22045 @opindex mips64r5
22046 Equivalent to @option{-march=mips64r5}.
22047
22048 @item -mips64r6
22049 @opindex mips64r6
22050 Equivalent to @option{-march=mips64r6}.
22051
22052 @item -mips16
22053 @itemx -mno-mips16
22054 @opindex mips16
22055 @opindex mno-mips16
22056 Generate (do not generate) MIPS16 code. If GCC is targeting a
22057 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
22058
22059 MIPS16 code generation can also be controlled on a per-function basis
22060 by means of @code{mips16} and @code{nomips16} attributes.
22061 @xref{Function Attributes}, for more information.
22062
22063 @item -mflip-mips16
22064 @opindex mflip-mips16
22065 Generate MIPS16 code on alternating functions. This option is provided
22066 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
22067 not intended for ordinary use in compiling user code.
22068
22069 @item -minterlink-compressed
22070 @itemx -mno-interlink-compressed
22071 @opindex minterlink-compressed
22072 @opindex mno-interlink-compressed
22073 Require (do not require) that code using the standard (uncompressed) MIPS ISA
22074 be link-compatible with MIPS16 and microMIPS code, and vice versa.
22075
22076 For example, code using the standard ISA encoding cannot jump directly
22077 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
22078 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
22079 knows that the target of the jump is not compressed.
22080
22081 @item -minterlink-mips16
22082 @itemx -mno-interlink-mips16
22083 @opindex minterlink-mips16
22084 @opindex mno-interlink-mips16
22085 Aliases of @option{-minterlink-compressed} and
22086 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
22087 and are retained for backwards compatibility.
22088
22089 @item -mabi=32
22090 @itemx -mabi=o64
22091 @itemx -mabi=n32
22092 @itemx -mabi=64
22093 @itemx -mabi=eabi
22094 @opindex mabi=32
22095 @opindex mabi=o64
22096 @opindex mabi=n32
22097 @opindex mabi=64
22098 @opindex mabi=eabi
22099 Generate code for the given ABI@.
22100
22101 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22102 generates 64-bit code when you select a 64-bit architecture, but you
22103 can use @option{-mgp32} to get 32-bit code instead.
22104
22105 For information about the O64 ABI, see
22106 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
22107
22108 GCC supports a variant of the o32 ABI in which floating-point registers
22109 are 64 rather than 32 bits wide. You can select this combination with
22110 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
22111 and @code{mfhc1} instructions and is therefore only supported for
22112 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22113
22114 The register assignments for arguments and return values remain the
22115 same, but each scalar value is passed in a single 64-bit register
22116 rather than a pair of 32-bit registers. For example, scalar
22117 floating-point values are returned in @samp{$f0} only, not a
22118 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
22119 remains the same in that the even-numbered double-precision registers
22120 are saved.
22121
22122 Two additional variants of the o32 ABI are supported to enable
22123 a transition from 32-bit to 64-bit registers. These are FPXX
22124 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
22125 The FPXX extension mandates that all code must execute correctly
22126 when run using 32-bit or 64-bit registers. The code can be interlinked
22127 with either FP32 or FP64, but not both.
22128 The FP64A extension is similar to the FP64 extension but forbids the
22129 use of odd-numbered single-precision registers. This can be used
22130 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
22131 processors and allows both FP32 and FP64A code to interlink and
22132 run in the same process without changing FPU modes.
22133
22134 @item -mabicalls
22135 @itemx -mno-abicalls
22136 @opindex mabicalls
22137 @opindex mno-abicalls
22138 Generate (do not generate) code that is suitable for SVR4-style
22139 dynamic objects. @option{-mabicalls} is the default for SVR4-based
22140 systems.
22141
22142 @item -mshared
22143 @itemx -mno-shared
22144 Generate (do not generate) code that is fully position-independent,
22145 and that can therefore be linked into shared libraries. This option
22146 only affects @option{-mabicalls}.
22147
22148 All @option{-mabicalls} code has traditionally been position-independent,
22149 regardless of options like @option{-fPIC} and @option{-fpic}. However,
22150 as an extension, the GNU toolchain allows executables to use absolute
22151 accesses for locally-binding symbols. It can also use shorter GP
22152 initialization sequences and generate direct calls to locally-defined
22153 functions. This mode is selected by @option{-mno-shared}.
22154
22155 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22156 objects that can only be linked by the GNU linker. However, the option
22157 does not affect the ABI of the final executable; it only affects the ABI
22158 of relocatable objects. Using @option{-mno-shared} generally makes
22159 executables both smaller and quicker.
22160
22161 @option{-mshared} is the default.
22162
22163 @item -mplt
22164 @itemx -mno-plt
22165 @opindex mplt
22166 @opindex mno-plt
22167 Assume (do not assume) that the static and dynamic linkers
22168 support PLTs and copy relocations. This option only affects
22169 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
22170 has no effect without @option{-msym32}.
22171
22172 You can make @option{-mplt} the default by configuring
22173 GCC with @option{--with-mips-plt}. The default is
22174 @option{-mno-plt} otherwise.
22175
22176 @item -mxgot
22177 @itemx -mno-xgot
22178 @opindex mxgot
22179 @opindex mno-xgot
22180 Lift (do not lift) the usual restrictions on the size of the global
22181 offset table.
22182
22183 GCC normally uses a single instruction to load values from the GOT@.
22184 While this is relatively efficient, it only works if the GOT
22185 is smaller than about 64k. Anything larger causes the linker
22186 to report an error such as:
22187
22188 @cindex relocation truncated to fit (MIPS)
22189 @smallexample
22190 relocation truncated to fit: R_MIPS_GOT16 foobar
22191 @end smallexample
22192
22193 If this happens, you should recompile your code with @option{-mxgot}.
22194 This works with very large GOTs, although the code is also
22195 less efficient, since it takes three instructions to fetch the
22196 value of a global symbol.
22197
22198 Note that some linkers can create multiple GOTs. If you have such a
22199 linker, you should only need to use @option{-mxgot} when a single object
22200 file accesses more than 64k's worth of GOT entries. Very few do.
22201
22202 These options have no effect unless GCC is generating position
22203 independent code.
22204
22205 @item -mgp32
22206 @opindex mgp32
22207 Assume that general-purpose registers are 32 bits wide.
22208
22209 @item -mgp64
22210 @opindex mgp64
22211 Assume that general-purpose registers are 64 bits wide.
22212
22213 @item -mfp32
22214 @opindex mfp32
22215 Assume that floating-point registers are 32 bits wide.
22216
22217 @item -mfp64
22218 @opindex mfp64
22219 Assume that floating-point registers are 64 bits wide.
22220
22221 @item -mfpxx
22222 @opindex mfpxx
22223 Do not assume the width of floating-point registers.
22224
22225 @item -mhard-float
22226 @opindex mhard-float
22227 Use floating-point coprocessor instructions.
22228
22229 @item -msoft-float
22230 @opindex msoft-float
22231 Do not use floating-point coprocessor instructions. Implement
22232 floating-point calculations using library calls instead.
22233
22234 @item -mno-float
22235 @opindex mno-float
22236 Equivalent to @option{-msoft-float}, but additionally asserts that the
22237 program being compiled does not perform any floating-point operations.
22238 This option is presently supported only by some bare-metal MIPS
22239 configurations, where it may select a special set of libraries
22240 that lack all floating-point support (including, for example, the
22241 floating-point @code{printf} formats).
22242 If code compiled with @option{-mno-float} accidentally contains
22243 floating-point operations, it is likely to suffer a link-time
22244 or run-time failure.
22245
22246 @item -msingle-float
22247 @opindex msingle-float
22248 Assume that the floating-point coprocessor only supports single-precision
22249 operations.
22250
22251 @item -mdouble-float
22252 @opindex mdouble-float
22253 Assume that the floating-point coprocessor supports double-precision
22254 operations. This is the default.
22255
22256 @item -modd-spreg
22257 @itemx -mno-odd-spreg
22258 @opindex modd-spreg
22259 @opindex mno-odd-spreg
22260 Enable the use of odd-numbered single-precision floating-point registers
22261 for the o32 ABI. This is the default for processors that are known to
22262 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22263 is set by default.
22264
22265 @item -mabs=2008
22266 @itemx -mabs=legacy
22267 @opindex mabs=2008
22268 @opindex mabs=legacy
22269 These options control the treatment of the special not-a-number (NaN)
22270 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22271 @code{neg.@i{fmt}} machine instructions.
22272
22273 By default or when @option{-mabs=legacy} is used the legacy
22274 treatment is selected. In this case these instructions are considered
22275 arithmetic and avoided where correct operation is required and the
22276 input operand might be a NaN. A longer sequence of instructions that
22277 manipulate the sign bit of floating-point datum manually is used
22278 instead unless the @option{-ffinite-math-only} option has also been
22279 specified.
22280
22281 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22282 this case these instructions are considered non-arithmetic and therefore
22283 operating correctly in all cases, including in particular where the
22284 input operand is a NaN. These instructions are therefore always used
22285 for the respective operations.
22286
22287 @item -mnan=2008
22288 @itemx -mnan=legacy
22289 @opindex mnan=2008
22290 @opindex mnan=legacy
22291 These options control the encoding of the special not-a-number (NaN)
22292 IEEE 754 floating-point data.
22293
22294 The @option{-mnan=legacy} option selects the legacy encoding. In this
22295 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22296 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22297 by the first bit of their trailing significand field being 1.
22298
22299 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22300 this case qNaNs are denoted by the first bit of their trailing
22301 significand field being 1, whereas sNaNs are denoted by the first bit of
22302 their trailing significand field being 0.
22303
22304 The default is @option{-mnan=legacy} unless GCC has been configured with
22305 @option{--with-nan=2008}.
22306
22307 @item -mllsc
22308 @itemx -mno-llsc
22309 @opindex mllsc
22310 @opindex mno-llsc
22311 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22312 implement atomic memory built-in functions. When neither option is
22313 specified, GCC uses the instructions if the target architecture
22314 supports them.
22315
22316 @option{-mllsc} is useful if the runtime environment can emulate the
22317 instructions and @option{-mno-llsc} can be useful when compiling for
22318 nonstandard ISAs. You can make either option the default by
22319 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22320 respectively. @option{--with-llsc} is the default for some
22321 configurations; see the installation documentation for details.
22322
22323 @item -mdsp
22324 @itemx -mno-dsp
22325 @opindex mdsp
22326 @opindex mno-dsp
22327 Use (do not use) revision 1 of the MIPS DSP ASE@.
22328 @xref{MIPS DSP Built-in Functions}. This option defines the
22329 preprocessor macro @code{__mips_dsp}. It also defines
22330 @code{__mips_dsp_rev} to 1.
22331
22332 @item -mdspr2
22333 @itemx -mno-dspr2
22334 @opindex mdspr2
22335 @opindex mno-dspr2
22336 Use (do not use) revision 2 of the MIPS DSP ASE@.
22337 @xref{MIPS DSP Built-in Functions}. This option defines the
22338 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22339 It also defines @code{__mips_dsp_rev} to 2.
22340
22341 @item -msmartmips
22342 @itemx -mno-smartmips
22343 @opindex msmartmips
22344 @opindex mno-smartmips
22345 Use (do not use) the MIPS SmartMIPS ASE.
22346
22347 @item -mpaired-single
22348 @itemx -mno-paired-single
22349 @opindex mpaired-single
22350 @opindex mno-paired-single
22351 Use (do not use) paired-single floating-point instructions.
22352 @xref{MIPS Paired-Single Support}. This option requires
22353 hardware floating-point support to be enabled.
22354
22355 @item -mdmx
22356 @itemx -mno-mdmx
22357 @opindex mdmx
22358 @opindex mno-mdmx
22359 Use (do not use) MIPS Digital Media Extension instructions.
22360 This option can only be used when generating 64-bit code and requires
22361 hardware floating-point support to be enabled.
22362
22363 @item -mips3d
22364 @itemx -mno-mips3d
22365 @opindex mips3d
22366 @opindex mno-mips3d
22367 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22368 The option @option{-mips3d} implies @option{-mpaired-single}.
22369
22370 @item -mmicromips
22371 @itemx -mno-micromips
22372 @opindex mmicromips
22373 @opindex mno-mmicromips
22374 Generate (do not generate) microMIPS code.
22375
22376 MicroMIPS code generation can also be controlled on a per-function basis
22377 by means of @code{micromips} and @code{nomicromips} attributes.
22378 @xref{Function Attributes}, for more information.
22379
22380 @item -mmt
22381 @itemx -mno-mt
22382 @opindex mmt
22383 @opindex mno-mt
22384 Use (do not use) MT Multithreading instructions.
22385
22386 @item -mmcu
22387 @itemx -mno-mcu
22388 @opindex mmcu
22389 @opindex mno-mcu
22390 Use (do not use) the MIPS MCU ASE instructions.
22391
22392 @item -meva
22393 @itemx -mno-eva
22394 @opindex meva
22395 @opindex mno-eva
22396 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22397
22398 @item -mvirt
22399 @itemx -mno-virt
22400 @opindex mvirt
22401 @opindex mno-virt
22402 Use (do not use) the MIPS Virtualization (VZ) instructions.
22403
22404 @item -mxpa
22405 @itemx -mno-xpa
22406 @opindex mxpa
22407 @opindex mno-xpa
22408 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22409
22410 @item -mcrc
22411 @itemx -mno-crc
22412 @opindex mcrc
22413 @opindex mno-crc
22414 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22415
22416 @item -mginv
22417 @itemx -mno-ginv
22418 @opindex mginv
22419 @opindex mno-ginv
22420 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22421
22422 @item -mloongson-mmi
22423 @itemx -mno-loongson-mmi
22424 @opindex mloongson-mmi
22425 @opindex mno-loongson-mmi
22426 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22427
22428 @item -mloongson-ext
22429 @itemx -mno-loongson-ext
22430 @opindex mloongson-ext
22431 @opindex mno-loongson-ext
22432 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22433
22434 @item -mloongson-ext2
22435 @itemx -mno-loongson-ext2
22436 @opindex mloongson-ext2
22437 @opindex mno-loongson-ext2
22438 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22439
22440 @item -mlong64
22441 @opindex mlong64
22442 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22443 an explanation of the default and the way that the pointer size is
22444 determined.
22445
22446 @item -mlong32
22447 @opindex mlong32
22448 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22449
22450 The default size of @code{int}s, @code{long}s and pointers depends on
22451 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22452 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22453 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22454 or the same size as integer registers, whichever is smaller.
22455
22456 @item -msym32
22457 @itemx -mno-sym32
22458 @opindex msym32
22459 @opindex mno-sym32
22460 Assume (do not assume) that all symbols have 32-bit values, regardless
22461 of the selected ABI@. This option is useful in combination with
22462 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22463 to generate shorter and faster references to symbolic addresses.
22464
22465 @item -G @var{num}
22466 @opindex G
22467 Put definitions of externally-visible data in a small data section
22468 if that data is no bigger than @var{num} bytes. GCC can then generate
22469 more efficient accesses to the data; see @option{-mgpopt} for details.
22470
22471 The default @option{-G} option depends on the configuration.
22472
22473 @item -mlocal-sdata
22474 @itemx -mno-local-sdata
22475 @opindex mlocal-sdata
22476 @opindex mno-local-sdata
22477 Extend (do not extend) the @option{-G} behavior to local data too,
22478 such as to static variables in C@. @option{-mlocal-sdata} is the
22479 default for all configurations.
22480
22481 If the linker complains that an application is using too much small data,
22482 you might want to try rebuilding the less performance-critical parts with
22483 @option{-mno-local-sdata}. You might also want to build large
22484 libraries with @option{-mno-local-sdata}, so that the libraries leave
22485 more room for the main program.
22486
22487 @item -mextern-sdata
22488 @itemx -mno-extern-sdata
22489 @opindex mextern-sdata
22490 @opindex mno-extern-sdata
22491 Assume (do not assume) that externally-defined data is in
22492 a small data section if the size of that data is within the @option{-G} limit.
22493 @option{-mextern-sdata} is the default for all configurations.
22494
22495 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22496 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22497 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22498 is placed in a small data section. If @var{Var} is defined by another
22499 module, you must either compile that module with a high-enough
22500 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22501 definition. If @var{Var} is common, you must link the application
22502 with a high-enough @option{-G} setting.
22503
22504 The easiest way of satisfying these restrictions is to compile
22505 and link every module with the same @option{-G} option. However,
22506 you may wish to build a library that supports several different
22507 small data limits. You can do this by compiling the library with
22508 the highest supported @option{-G} setting and additionally using
22509 @option{-mno-extern-sdata} to stop the library from making assumptions
22510 about externally-defined data.
22511
22512 @item -mgpopt
22513 @itemx -mno-gpopt
22514 @opindex mgpopt
22515 @opindex mno-gpopt
22516 Use (do not use) GP-relative accesses for symbols that are known to be
22517 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22518 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22519 configurations.
22520
22521 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22522 might not hold the value of @code{_gp}. For example, if the code is
22523 part of a library that might be used in a boot monitor, programs that
22524 call boot monitor routines pass an unknown value in @code{$gp}.
22525 (In such situations, the boot monitor itself is usually compiled
22526 with @option{-G0}.)
22527
22528 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22529 @option{-mno-extern-sdata}.
22530
22531 @item -membedded-data
22532 @itemx -mno-embedded-data
22533 @opindex membedded-data
22534 @opindex mno-embedded-data
22535 Allocate variables to the read-only data section first if possible, then
22536 next in the small data section if possible, otherwise in data. This gives
22537 slightly slower code than the default, but reduces the amount of RAM required
22538 when executing, and thus may be preferred for some embedded systems.
22539
22540 @item -muninit-const-in-rodata
22541 @itemx -mno-uninit-const-in-rodata
22542 @opindex muninit-const-in-rodata
22543 @opindex mno-uninit-const-in-rodata
22544 Put uninitialized @code{const} variables in the read-only data section.
22545 This option is only meaningful in conjunction with @option{-membedded-data}.
22546
22547 @item -mcode-readable=@var{setting}
22548 @opindex mcode-readable
22549 Specify whether GCC may generate code that reads from executable sections.
22550 There are three possible settings:
22551
22552 @table @gcctabopt
22553 @item -mcode-readable=yes
22554 Instructions may freely access executable sections. This is the
22555 default setting.
22556
22557 @item -mcode-readable=pcrel
22558 MIPS16 PC-relative load instructions can access executable sections,
22559 but other instructions must not do so. This option is useful on 4KSc
22560 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22561 It is also useful on processors that can be configured to have a dual
22562 instruction/data SRAM interface and that, like the M4K, automatically
22563 redirect PC-relative loads to the instruction RAM.
22564
22565 @item -mcode-readable=no
22566 Instructions must not access executable sections. This option can be
22567 useful on targets that are configured to have a dual instruction/data
22568 SRAM interface but that (unlike the M4K) do not automatically redirect
22569 PC-relative loads to the instruction RAM.
22570 @end table
22571
22572 @item -msplit-addresses
22573 @itemx -mno-split-addresses
22574 @opindex msplit-addresses
22575 @opindex mno-split-addresses
22576 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22577 relocation operators. This option has been superseded by
22578 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22579
22580 @item -mexplicit-relocs
22581 @itemx -mno-explicit-relocs
22582 @opindex mexplicit-relocs
22583 @opindex mno-explicit-relocs
22584 Use (do not use) assembler relocation operators when dealing with symbolic
22585 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22586 is to use assembler macros instead.
22587
22588 @option{-mexplicit-relocs} is the default if GCC was configured
22589 to use an assembler that supports relocation operators.
22590
22591 @item -mcheck-zero-division
22592 @itemx -mno-check-zero-division
22593 @opindex mcheck-zero-division
22594 @opindex mno-check-zero-division
22595 Trap (do not trap) on integer division by zero.
22596
22597 The default is @option{-mcheck-zero-division}.
22598
22599 @item -mdivide-traps
22600 @itemx -mdivide-breaks
22601 @opindex mdivide-traps
22602 @opindex mdivide-breaks
22603 MIPS systems check for division by zero by generating either a
22604 conditional trap or a break instruction. Using traps results in
22605 smaller code, but is only supported on MIPS II and later. Also, some
22606 versions of the Linux kernel have a bug that prevents trap from
22607 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22608 allow conditional traps on architectures that support them and
22609 @option{-mdivide-breaks} to force the use of breaks.
22610
22611 The default is usually @option{-mdivide-traps}, but this can be
22612 overridden at configure time using @option{--with-divide=breaks}.
22613 Divide-by-zero checks can be completely disabled using
22614 @option{-mno-check-zero-division}.
22615
22616 @item -mload-store-pairs
22617 @itemx -mno-load-store-pairs
22618 @opindex mload-store-pairs
22619 @opindex mno-load-store-pairs
22620 Enable (disable) an optimization that pairs consecutive load or store
22621 instructions to enable load/store bonding. This option is enabled by
22622 default but only takes effect when the selected architecture is known
22623 to support bonding.
22624
22625 @item -mmemcpy
22626 @itemx -mno-memcpy
22627 @opindex mmemcpy
22628 @opindex mno-memcpy
22629 Force (do not force) the use of @code{memcpy} for non-trivial block
22630 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22631 most constant-sized copies.
22632
22633 @item -mlong-calls
22634 @itemx -mno-long-calls
22635 @opindex mlong-calls
22636 @opindex mno-long-calls
22637 Disable (do not disable) use of the @code{jal} instruction. Calling
22638 functions using @code{jal} is more efficient but requires the caller
22639 and callee to be in the same 256 megabyte segment.
22640
22641 This option has no effect on abicalls code. The default is
22642 @option{-mno-long-calls}.
22643
22644 @item -mmad
22645 @itemx -mno-mad
22646 @opindex mmad
22647 @opindex mno-mad
22648 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22649 instructions, as provided by the R4650 ISA@.
22650
22651 @item -mimadd
22652 @itemx -mno-imadd
22653 @opindex mimadd
22654 @opindex mno-imadd
22655 Enable (disable) use of the @code{madd} and @code{msub} integer
22656 instructions. The default is @option{-mimadd} on architectures
22657 that support @code{madd} and @code{msub} except for the 74k
22658 architecture where it was found to generate slower code.
22659
22660 @item -mfused-madd
22661 @itemx -mno-fused-madd
22662 @opindex mfused-madd
22663 @opindex mno-fused-madd
22664 Enable (disable) use of the floating-point multiply-accumulate
22665 instructions, when they are available. The default is
22666 @option{-mfused-madd}.
22667
22668 On the R8000 CPU when multiply-accumulate instructions are used,
22669 the intermediate product is calculated to infinite precision
22670 and is not subject to the FCSR Flush to Zero bit. This may be
22671 undesirable in some circumstances. On other processors the result
22672 is numerically identical to the equivalent computation using
22673 separate multiply, add, subtract and negate instructions.
22674
22675 @item -nocpp
22676 @opindex nocpp
22677 Tell the MIPS assembler to not run its preprocessor over user
22678 assembler files (with a @samp{.s} suffix) when assembling them.
22679
22680 @item -mfix-24k
22681 @itemx -mno-fix-24k
22682 @opindex mfix-24k
22683 @opindex mno-fix-24k
22684 Work around the 24K E48 (lost data on stores during refill) errata.
22685 The workarounds are implemented by the assembler rather than by GCC@.
22686
22687 @item -mfix-r4000
22688 @itemx -mno-fix-r4000
22689 @opindex mfix-r4000
22690 @opindex mno-fix-r4000
22691 Work around certain R4000 CPU errata:
22692 @itemize @minus
22693 @item
22694 A double-word or a variable shift may give an incorrect result if executed
22695 immediately after starting an integer division.
22696 @item
22697 A double-word or a variable shift may give an incorrect result if executed
22698 while an integer multiplication is in progress.
22699 @item
22700 An integer division may give an incorrect result if started in a delay slot
22701 of a taken branch or a jump.
22702 @end itemize
22703
22704 @item -mfix-r4400
22705 @itemx -mno-fix-r4400
22706 @opindex mfix-r4400
22707 @opindex mno-fix-r4400
22708 Work around certain R4400 CPU errata:
22709 @itemize @minus
22710 @item
22711 A double-word or a variable shift may give an incorrect result if executed
22712 immediately after starting an integer division.
22713 @end itemize
22714
22715 @item -mfix-r10000
22716 @itemx -mno-fix-r10000
22717 @opindex mfix-r10000
22718 @opindex mno-fix-r10000
22719 Work around certain R10000 errata:
22720 @itemize @minus
22721 @item
22722 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22723 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22724 @end itemize
22725
22726 This option can only be used if the target architecture supports
22727 branch-likely instructions. @option{-mfix-r10000} is the default when
22728 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22729 otherwise.
22730
22731 @item -mfix-r5900
22732 @itemx -mno-fix-r5900
22733 @opindex mfix-r5900
22734 Do not attempt to schedule the preceding instruction into the delay slot
22735 of a branch instruction placed at the end of a short loop of six
22736 instructions or fewer and always schedule a @code{nop} instruction there
22737 instead. The short loop bug under certain conditions causes loops to
22738 execute only once or twice, due to a hardware bug in the R5900 chip. The
22739 workaround is implemented by the assembler rather than by GCC@.
22740
22741 @item -mfix-rm7000
22742 @itemx -mno-fix-rm7000
22743 @opindex mfix-rm7000
22744 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22745 workarounds are implemented by the assembler rather than by GCC@.
22746
22747 @item -mfix-vr4120
22748 @itemx -mno-fix-vr4120
22749 @opindex mfix-vr4120
22750 Work around certain VR4120 errata:
22751 @itemize @minus
22752 @item
22753 @code{dmultu} does not always produce the correct result.
22754 @item
22755 @code{div} and @code{ddiv} do not always produce the correct result if one
22756 of the operands is negative.
22757 @end itemize
22758 The workarounds for the division errata rely on special functions in
22759 @file{libgcc.a}. At present, these functions are only provided by
22760 the @code{mips64vr*-elf} configurations.
22761
22762 Other VR4120 errata require a NOP to be inserted between certain pairs of
22763 instructions. These errata are handled by the assembler, not by GCC itself.
22764
22765 @item -mfix-vr4130
22766 @opindex mfix-vr4130
22767 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22768 workarounds are implemented by the assembler rather than by GCC,
22769 although GCC avoids using @code{mflo} and @code{mfhi} if the
22770 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22771 instructions are available instead.
22772
22773 @item -mfix-sb1
22774 @itemx -mno-fix-sb1
22775 @opindex mfix-sb1
22776 Work around certain SB-1 CPU core errata.
22777 (This flag currently works around the SB-1 revision 2
22778 ``F1'' and ``F2'' floating-point errata.)
22779
22780 @item -mr10k-cache-barrier=@var{setting}
22781 @opindex mr10k-cache-barrier
22782 Specify whether GCC should insert cache barriers to avoid the
22783 side effects of speculation on R10K processors.
22784
22785 In common with many processors, the R10K tries to predict the outcome
22786 of a conditional branch and speculatively executes instructions from
22787 the ``taken'' branch. It later aborts these instructions if the
22788 predicted outcome is wrong. However, on the R10K, even aborted
22789 instructions can have side effects.
22790
22791 This problem only affects kernel stores and, depending on the system,
22792 kernel loads. As an example, a speculatively-executed store may load
22793 the target memory into cache and mark the cache line as dirty, even if
22794 the store itself is later aborted. If a DMA operation writes to the
22795 same area of memory before the ``dirty'' line is flushed, the cached
22796 data overwrites the DMA-ed data. See the R10K processor manual
22797 for a full description, including other potential problems.
22798
22799 One workaround is to insert cache barrier instructions before every memory
22800 access that might be speculatively executed and that might have side
22801 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22802 controls GCC's implementation of this workaround. It assumes that
22803 aborted accesses to any byte in the following regions does not have
22804 side effects:
22805
22806 @enumerate
22807 @item
22808 the memory occupied by the current function's stack frame;
22809
22810 @item
22811 the memory occupied by an incoming stack argument;
22812
22813 @item
22814 the memory occupied by an object with a link-time-constant address.
22815 @end enumerate
22816
22817 It is the kernel's responsibility to ensure that speculative
22818 accesses to these regions are indeed safe.
22819
22820 If the input program contains a function declaration such as:
22821
22822 @smallexample
22823 void foo (void);
22824 @end smallexample
22825
22826 then the implementation of @code{foo} must allow @code{j foo} and
22827 @code{jal foo} to be executed speculatively. GCC honors this
22828 restriction for functions it compiles itself. It expects non-GCC
22829 functions (such as hand-written assembly code) to do the same.
22830
22831 The option has three forms:
22832
22833 @table @gcctabopt
22834 @item -mr10k-cache-barrier=load-store
22835 Insert a cache barrier before a load or store that might be
22836 speculatively executed and that might have side effects even
22837 if aborted.
22838
22839 @item -mr10k-cache-barrier=store
22840 Insert a cache barrier before a store that might be speculatively
22841 executed and that might have side effects even if aborted.
22842
22843 @item -mr10k-cache-barrier=none
22844 Disable the insertion of cache barriers. This is the default setting.
22845 @end table
22846
22847 @item -mflush-func=@var{func}
22848 @itemx -mno-flush-func
22849 @opindex mflush-func
22850 Specifies the function to call to flush the I and D caches, or to not
22851 call any such function. If called, the function must take the same
22852 arguments as the common @code{_flush_func}, that is, the address of the
22853 memory range for which the cache is being flushed, the size of the
22854 memory range, and the number 3 (to flush both caches). The default
22855 depends on the target GCC was configured for, but commonly is either
22856 @code{_flush_func} or @code{__cpu_flush}.
22857
22858 @item mbranch-cost=@var{num}
22859 @opindex mbranch-cost
22860 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22861 This cost is only a heuristic and is not guaranteed to produce
22862 consistent results across releases. A zero cost redundantly selects
22863 the default, which is based on the @option{-mtune} setting.
22864
22865 @item -mbranch-likely
22866 @itemx -mno-branch-likely
22867 @opindex mbranch-likely
22868 @opindex mno-branch-likely
22869 Enable or disable use of Branch Likely instructions, regardless of the
22870 default for the selected architecture. By default, Branch Likely
22871 instructions may be generated if they are supported by the selected
22872 architecture. An exception is for the MIPS32 and MIPS64 architectures
22873 and processors that implement those architectures; for those, Branch
22874 Likely instructions are not be generated by default because the MIPS32
22875 and MIPS64 architectures specifically deprecate their use.
22876
22877 @item -mcompact-branches=never
22878 @itemx -mcompact-branches=optimal
22879 @itemx -mcompact-branches=always
22880 @opindex mcompact-branches=never
22881 @opindex mcompact-branches=optimal
22882 @opindex mcompact-branches=always
22883 These options control which form of branches will be generated. The
22884 default is @option{-mcompact-branches=optimal}.
22885
22886 The @option{-mcompact-branches=never} option ensures that compact branch
22887 instructions will never be generated.
22888
22889 The @option{-mcompact-branches=always} option ensures that a compact
22890 branch instruction will be generated if available. If a compact branch
22891 instruction is not available, a delay slot form of the branch will be
22892 used instead.
22893
22894 This option is supported from MIPS Release 6 onwards.
22895
22896 The @option{-mcompact-branches=optimal} option will cause a delay slot
22897 branch to be used if one is available in the current ISA and the delay
22898 slot is successfully filled. If the delay slot is not filled, a compact
22899 branch will be chosen if one is available.
22900
22901 @item -mfp-exceptions
22902 @itemx -mno-fp-exceptions
22903 @opindex mfp-exceptions
22904 Specifies whether FP exceptions are enabled. This affects how
22905 FP instructions are scheduled for some processors.
22906 The default is that FP exceptions are
22907 enabled.
22908
22909 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22910 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22911 FP pipe.
22912
22913 @item -mvr4130-align
22914 @itemx -mno-vr4130-align
22915 @opindex mvr4130-align
22916 The VR4130 pipeline is two-way superscalar, but can only issue two
22917 instructions together if the first one is 8-byte aligned. When this
22918 option is enabled, GCC aligns pairs of instructions that it
22919 thinks should execute in parallel.
22920
22921 This option only has an effect when optimizing for the VR4130.
22922 It normally makes code faster, but at the expense of making it bigger.
22923 It is enabled by default at optimization level @option{-O3}.
22924
22925 @item -msynci
22926 @itemx -mno-synci
22927 @opindex msynci
22928 Enable (disable) generation of @code{synci} instructions on
22929 architectures that support it. The @code{synci} instructions (if
22930 enabled) are generated when @code{__builtin___clear_cache} is
22931 compiled.
22932
22933 This option defaults to @option{-mno-synci}, but the default can be
22934 overridden by configuring GCC with @option{--with-synci}.
22935
22936 When compiling code for single processor systems, it is generally safe
22937 to use @code{synci}. However, on many multi-core (SMP) systems, it
22938 does not invalidate the instruction caches on all cores and may lead
22939 to undefined behavior.
22940
22941 @item -mrelax-pic-calls
22942 @itemx -mno-relax-pic-calls
22943 @opindex mrelax-pic-calls
22944 Try to turn PIC calls that are normally dispatched via register
22945 @code{$25} into direct calls. This is only possible if the linker can
22946 resolve the destination at link time and if the destination is within
22947 range for a direct call.
22948
22949 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22950 an assembler and a linker that support the @code{.reloc} assembly
22951 directive and @option{-mexplicit-relocs} is in effect. With
22952 @option{-mno-explicit-relocs}, this optimization can be performed by the
22953 assembler and the linker alone without help from the compiler.
22954
22955 @item -mmcount-ra-address
22956 @itemx -mno-mcount-ra-address
22957 @opindex mmcount-ra-address
22958 @opindex mno-mcount-ra-address
22959 Emit (do not emit) code that allows @code{_mcount} to modify the
22960 calling function's return address. When enabled, this option extends
22961 the usual @code{_mcount} interface with a new @var{ra-address}
22962 parameter, which has type @code{intptr_t *} and is passed in register
22963 @code{$12}. @code{_mcount} can then modify the return address by
22964 doing both of the following:
22965 @itemize
22966 @item
22967 Returning the new address in register @code{$31}.
22968 @item
22969 Storing the new address in @code{*@var{ra-address}},
22970 if @var{ra-address} is nonnull.
22971 @end itemize
22972
22973 The default is @option{-mno-mcount-ra-address}.
22974
22975 @item -mframe-header-opt
22976 @itemx -mno-frame-header-opt
22977 @opindex mframe-header-opt
22978 Enable (disable) frame header optimization in the o32 ABI. When using the
22979 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22980 function to write out register arguments. When enabled, this optimization
22981 will suppress the allocation of the frame header if it can be determined that
22982 it is unused.
22983
22984 This optimization is off by default at all optimization levels.
22985
22986 @item -mlxc1-sxc1
22987 @itemx -mno-lxc1-sxc1
22988 @opindex mlxc1-sxc1
22989 When applicable, enable (disable) the generation of @code{lwxc1},
22990 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22991
22992 @item -mmadd4
22993 @itemx -mno-madd4
22994 @opindex mmadd4
22995 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22996 @code{madd.d} and related instructions. Enabled by default.
22997
22998 @end table
22999
23000 @node MMIX Options
23001 @subsection MMIX Options
23002 @cindex MMIX Options
23003
23004 These options are defined for the MMIX:
23005
23006 @table @gcctabopt
23007 @item -mlibfuncs
23008 @itemx -mno-libfuncs
23009 @opindex mlibfuncs
23010 @opindex mno-libfuncs
23011 Specify that intrinsic library functions are being compiled, passing all
23012 values in registers, no matter the size.
23013
23014 @item -mepsilon
23015 @itemx -mno-epsilon
23016 @opindex mepsilon
23017 @opindex mno-epsilon
23018 Generate floating-point comparison instructions that compare with respect
23019 to the @code{rE} epsilon register.
23020
23021 @item -mabi=mmixware
23022 @itemx -mabi=gnu
23023 @opindex mabi=mmixware
23024 @opindex mabi=gnu
23025 Generate code that passes function parameters and return values that (in
23026 the called function) are seen as registers @code{$0} and up, as opposed to
23027 the GNU ABI which uses global registers @code{$231} and up.
23028
23029 @item -mzero-extend
23030 @itemx -mno-zero-extend
23031 @opindex mzero-extend
23032 @opindex mno-zero-extend
23033 When reading data from memory in sizes shorter than 64 bits, use (do not
23034 use) zero-extending load instructions by default, rather than
23035 sign-extending ones.
23036
23037 @item -mknuthdiv
23038 @itemx -mno-knuthdiv
23039 @opindex mknuthdiv
23040 @opindex mno-knuthdiv
23041 Make the result of a division yielding a remainder have the same sign as
23042 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
23043 remainder follows the sign of the dividend. Both methods are
23044 arithmetically valid, the latter being almost exclusively used.
23045
23046 @item -mtoplevel-symbols
23047 @itemx -mno-toplevel-symbols
23048 @opindex mtoplevel-symbols
23049 @opindex mno-toplevel-symbols
23050 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
23051 code can be used with the @code{PREFIX} assembly directive.
23052
23053 @item -melf
23054 @opindex melf
23055 Generate an executable in the ELF format, rather than the default
23056 @samp{mmo} format used by the @command{mmix} simulator.
23057
23058 @item -mbranch-predict
23059 @itemx -mno-branch-predict
23060 @opindex mbranch-predict
23061 @opindex mno-branch-predict
23062 Use (do not use) the probable-branch instructions, when static branch
23063 prediction indicates a probable branch.
23064
23065 @item -mbase-addresses
23066 @itemx -mno-base-addresses
23067 @opindex mbase-addresses
23068 @opindex mno-base-addresses
23069 Generate (do not generate) code that uses @emph{base addresses}. Using a
23070 base address automatically generates a request (handled by the assembler
23071 and the linker) for a constant to be set up in a global register. The
23072 register is used for one or more base address requests within the range 0
23073 to 255 from the value held in the register. The generally leads to short
23074 and fast code, but the number of different data items that can be
23075 addressed is limited. This means that a program that uses lots of static
23076 data may require @option{-mno-base-addresses}.
23077
23078 @item -msingle-exit
23079 @itemx -mno-single-exit
23080 @opindex msingle-exit
23081 @opindex mno-single-exit
23082 Force (do not force) generated code to have a single exit point in each
23083 function.
23084 @end table
23085
23086 @node MN10300 Options
23087 @subsection MN10300 Options
23088 @cindex MN10300 options
23089
23090 These @option{-m} options are defined for Matsushita MN10300 architectures:
23091
23092 @table @gcctabopt
23093 @item -mmult-bug
23094 @opindex mmult-bug
23095 Generate code to avoid bugs in the multiply instructions for the MN10300
23096 processors. This is the default.
23097
23098 @item -mno-mult-bug
23099 @opindex mno-mult-bug
23100 Do not generate code to avoid bugs in the multiply instructions for the
23101 MN10300 processors.
23102
23103 @item -mam33
23104 @opindex mam33
23105 Generate code using features specific to the AM33 processor.
23106
23107 @item -mno-am33
23108 @opindex mno-am33
23109 Do not generate code using features specific to the AM33 processor. This
23110 is the default.
23111
23112 @item -mam33-2
23113 @opindex mam33-2
23114 Generate code using features specific to the AM33/2.0 processor.
23115
23116 @item -mam34
23117 @opindex mam34
23118 Generate code using features specific to the AM34 processor.
23119
23120 @item -mtune=@var{cpu-type}
23121 @opindex mtune
23122 Use the timing characteristics of the indicated CPU type when
23123 scheduling instructions. This does not change the targeted processor
23124 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
23125 @samp{am33-2} or @samp{am34}.
23126
23127 @item -mreturn-pointer-on-d0
23128 @opindex mreturn-pointer-on-d0
23129 When generating a function that returns a pointer, return the pointer
23130 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
23131 only in @code{a0}, and attempts to call such functions without a prototype
23132 result in errors. Note that this option is on by default; use
23133 @option{-mno-return-pointer-on-d0} to disable it.
23134
23135 @item -mno-crt0
23136 @opindex mno-crt0
23137 Do not link in the C run-time initialization object file.
23138
23139 @item -mrelax
23140 @opindex mrelax
23141 Indicate to the linker that it should perform a relaxation optimization pass
23142 to shorten branches, calls and absolute memory addresses. This option only
23143 has an effect when used on the command line for the final link step.
23144
23145 This option makes symbolic debugging impossible.
23146
23147 @item -mliw
23148 @opindex mliw
23149 Allow the compiler to generate @emph{Long Instruction Word}
23150 instructions if the target is the @samp{AM33} or later. This is the
23151 default. This option defines the preprocessor macro @code{__LIW__}.
23152
23153 @item -mno-liw
23154 @opindex mno-liw
23155 Do not allow the compiler to generate @emph{Long Instruction Word}
23156 instructions. This option defines the preprocessor macro
23157 @code{__NO_LIW__}.
23158
23159 @item -msetlb
23160 @opindex msetlb
23161 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23162 instructions if the target is the @samp{AM33} or later. This is the
23163 default. This option defines the preprocessor macro @code{__SETLB__}.
23164
23165 @item -mno-setlb
23166 @opindex mno-setlb
23167 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23168 instructions. This option defines the preprocessor macro
23169 @code{__NO_SETLB__}.
23170
23171 @end table
23172
23173 @node Moxie Options
23174 @subsection Moxie Options
23175 @cindex Moxie Options
23176
23177 @table @gcctabopt
23178
23179 @item -meb
23180 @opindex meb
23181 Generate big-endian code. This is the default for @samp{moxie-*-*}
23182 configurations.
23183
23184 @item -mel
23185 @opindex mel
23186 Generate little-endian code.
23187
23188 @item -mmul.x
23189 @opindex mmul.x
23190 Generate mul.x and umul.x instructions. This is the default for
23191 @samp{moxiebox-*-*} configurations.
23192
23193 @item -mno-crt0
23194 @opindex mno-crt0
23195 Do not link in the C run-time initialization object file.
23196
23197 @end table
23198
23199 @node MSP430 Options
23200 @subsection MSP430 Options
23201 @cindex MSP430 Options
23202
23203 These options are defined for the MSP430:
23204
23205 @table @gcctabopt
23206
23207 @item -masm-hex
23208 @opindex masm-hex
23209 Force assembly output to always use hex constants. Normally such
23210 constants are signed decimals, but this option is available for
23211 testsuite and/or aesthetic purposes.
23212
23213 @item -mmcu=
23214 @opindex mmcu=
23215 Select the MCU to target. This is used to create a C preprocessor
23216 symbol based upon the MCU name, converted to upper case and pre- and
23217 post-fixed with @samp{__}. This in turn is used by the
23218 @file{msp430.h} header file to select an MCU-specific supplementary
23219 header file.
23220
23221 The option also sets the ISA to use. If the MCU name is one that is
23222 known to only support the 430 ISA then that is selected, otherwise the
23223 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23224 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23225 name selects the 430X ISA.
23226
23227 In addition an MCU-specific linker script is added to the linker
23228 command line. The script's name is the name of the MCU with
23229 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23230 command line defines the C preprocessor symbol @code{__XXX__} and
23231 cause the linker to search for a script called @file{xxx.ld}.
23232
23233 The ISA and hardware multiply supported for the different MCUs is hard-coded
23234 into GCC. However, an external @samp{devices.csv} file can be used to
23235 extend device support beyond those that have been hard-coded.
23236
23237 GCC searches for the @samp{devices.csv} file using the following methods in the
23238 given precedence order, where the first method takes precendence over the
23239 second which takes precedence over the third.
23240
23241 @table @asis
23242 @item Include path specified with @code{-I} and @code{-L}
23243 @samp{devices.csv} will be searched for in each of the directories specified by
23244 include paths and linker library search paths.
23245 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
23246 Define the value of the global environment variable
23247 @samp{MSP430_GCC_INCLUDE_DIR}
23248 to the full path to the directory containing devices.csv, and GCC will search
23249 this directory for devices.csv. If devices.csv is found, this directory will
23250 also be registered as an include path, and linker library path. Header files
23251 and linker scripts in this directory can therefore be used without manually
23252 specifying @code{-I} and @code{-L} on the command line.
23253 @item The @samp{msp430-elf/include/devices} directory
23254 Finally, GCC will examine @samp{msp430-elf/include/devices} from the
23255 toolchain root directory. This directory does not exist in a default
23256 installation, but if the user has created it and copied @samp{devices.csv}
23257 there, then the MCU data will be read. As above, this directory will
23258 also be registered as an include path, and linker library path.
23259
23260 @end table
23261 If none of the above search methods find @samp{devices.csv}, then the
23262 hard-coded MCU data is used.
23263
23264
23265 @item -mwarn-mcu
23266 @itemx -mno-warn-mcu
23267 @opindex mwarn-mcu
23268 @opindex mno-warn-mcu
23269 This option enables or disables warnings about conflicts between the
23270 MCU name specified by the @option{-mmcu} option and the ISA set by the
23271 @option{-mcpu} option and/or the hardware multiply support set by the
23272 @option{-mhwmult} option. It also toggles warnings about unrecognized
23273 MCU names. This option is on by default.
23274
23275 @item -mcpu=
23276 @opindex mcpu=
23277 Specifies the ISA to use. Accepted values are @samp{msp430},
23278 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23279 @option{-mmcu=} option should be used to select the ISA.
23280
23281 @item -msim
23282 @opindex msim
23283 Link to the simulator runtime libraries and linker script. Overrides
23284 any scripts that would be selected by the @option{-mmcu=} option.
23285
23286 @item -mlarge
23287 @opindex mlarge
23288 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23289
23290 @item -msmall
23291 @opindex msmall
23292 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23293
23294 @item -mrelax
23295 @opindex mrelax
23296 This option is passed to the assembler and linker, and allows the
23297 linker to perform certain optimizations that cannot be done until
23298 the final link.
23299
23300 @item mhwmult=
23301 @opindex mhwmult=
23302 Describes the type of hardware multiply supported by the target.
23303 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23304 for the original 16-bit-only multiply supported by early MCUs.
23305 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23306 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23307 A value of @samp{auto} can also be given. This tells GCC to deduce
23308 the hardware multiply support based upon the MCU name provided by the
23309 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23310 the MCU name is not recognized then no hardware multiply support is
23311 assumed. @code{auto} is the default setting.
23312
23313 Hardware multiplies are normally performed by calling a library
23314 routine. This saves space in the generated code. When compiling at
23315 @option{-O3} or higher however the hardware multiplier is invoked
23316 inline. This makes for bigger, but faster code.
23317
23318 The hardware multiply routines disable interrupts whilst running and
23319 restore the previous interrupt state when they finish. This makes
23320 them safe to use inside interrupt handlers as well as in normal code.
23321
23322 @item -minrt
23323 @opindex minrt
23324 Enable the use of a minimum runtime environment - no static
23325 initializers or constructors. This is intended for memory-constrained
23326 devices. The compiler includes special symbols in some objects
23327 that tell the linker and runtime which code fragments are required.
23328
23329 @item -mtiny-printf
23330 @opindex mtiny-printf
23331 Enable reduced code size @code{printf} and @code{puts} library functions.
23332 The @samp{tiny} implementations of these functions are not reentrant, so
23333 must be used with caution in multi-threaded applications.
23334
23335 Support for streams has been removed and the string to be printed will
23336 always be sent to stdout via the @code{write} syscall. The string is not
23337 buffered before it is sent to write.
23338
23339 This option requires Newlib Nano IO, so GCC must be configured with
23340 @samp{--enable-newlib-nano-formatted-io}.
23341
23342 @item -mcode-region=
23343 @itemx -mdata-region=
23344 @opindex mcode-region
23345 @opindex mdata-region
23346 These options tell the compiler where to place functions and data that
23347 do not have one of the @code{lower}, @code{upper}, @code{either} or
23348 @code{section} attributes. Possible values are @code{lower},
23349 @code{upper}, @code{either} or @code{any}. The first three behave
23350 like the corresponding attribute. The fourth possible value -
23351 @code{any} - is the default. It leaves placement entirely up to the
23352 linker script and how it assigns the standard sections
23353 (@code{.text}, @code{.data}, etc) to the memory regions.
23354
23355 @item -msilicon-errata=
23356 @opindex msilicon-errata
23357 This option passes on a request to assembler to enable the fixes for
23358 the named silicon errata.
23359
23360 @item -msilicon-errata-warn=
23361 @opindex msilicon-errata-warn
23362 This option passes on a request to the assembler to enable warning
23363 messages when a silicon errata might need to be applied.
23364
23365 @item -mwarn-devices-csv
23366 @itemx -mno-warn-devices-csv
23367 @opindex mwarn-devices-csv
23368 @opindex mno-warn-devices-csv
23369 Warn if @samp{devices.csv} is not found or there are problem parsing it
23370 (default: on).
23371
23372 @end table
23373
23374 @node NDS32 Options
23375 @subsection NDS32 Options
23376 @cindex NDS32 Options
23377
23378 These options are defined for NDS32 implementations:
23379
23380 @table @gcctabopt
23381
23382 @item -mbig-endian
23383 @opindex mbig-endian
23384 Generate code in big-endian mode.
23385
23386 @item -mlittle-endian
23387 @opindex mlittle-endian
23388 Generate code in little-endian mode.
23389
23390 @item -mreduced-regs
23391 @opindex mreduced-regs
23392 Use reduced-set registers for register allocation.
23393
23394 @item -mfull-regs
23395 @opindex mfull-regs
23396 Use full-set registers for register allocation.
23397
23398 @item -mcmov
23399 @opindex mcmov
23400 Generate conditional move instructions.
23401
23402 @item -mno-cmov
23403 @opindex mno-cmov
23404 Do not generate conditional move instructions.
23405
23406 @item -mext-perf
23407 @opindex mext-perf
23408 Generate performance extension instructions.
23409
23410 @item -mno-ext-perf
23411 @opindex mno-ext-perf
23412 Do not generate performance extension instructions.
23413
23414 @item -mext-perf2
23415 @opindex mext-perf2
23416 Generate performance extension 2 instructions.
23417
23418 @item -mno-ext-perf2
23419 @opindex mno-ext-perf2
23420 Do not generate performance extension 2 instructions.
23421
23422 @item -mext-string
23423 @opindex mext-string
23424 Generate string extension instructions.
23425
23426 @item -mno-ext-string
23427 @opindex mno-ext-string
23428 Do not generate string extension instructions.
23429
23430 @item -mv3push
23431 @opindex mv3push
23432 Generate v3 push25/pop25 instructions.
23433
23434 @item -mno-v3push
23435 @opindex mno-v3push
23436 Do not generate v3 push25/pop25 instructions.
23437
23438 @item -m16-bit
23439 @opindex m16-bit
23440 Generate 16-bit instructions.
23441
23442 @item -mno-16-bit
23443 @opindex mno-16-bit
23444 Do not generate 16-bit instructions.
23445
23446 @item -misr-vector-size=@var{num}
23447 @opindex misr-vector-size
23448 Specify the size of each interrupt vector, which must be 4 or 16.
23449
23450 @item -mcache-block-size=@var{num}
23451 @opindex mcache-block-size
23452 Specify the size of each cache block,
23453 which must be a power of 2 between 4 and 512.
23454
23455 @item -march=@var{arch}
23456 @opindex march
23457 Specify the name of the target architecture.
23458
23459 @item -mcmodel=@var{code-model}
23460 @opindex mcmodel
23461 Set the code model to one of
23462 @table @asis
23463 @item @samp{small}
23464 All the data and read-only data segments must be within 512KB addressing space.
23465 The text segment must be within 16MB addressing space.
23466 @item @samp{medium}
23467 The data segment must be within 512KB while the read-only data segment can be
23468 within 4GB addressing space. The text segment should be still within 16MB
23469 addressing space.
23470 @item @samp{large}
23471 All the text and data segments can be within 4GB addressing space.
23472 @end table
23473
23474 @item -mctor-dtor
23475 @opindex mctor-dtor
23476 Enable constructor/destructor feature.
23477
23478 @item -mrelax
23479 @opindex mrelax
23480 Guide linker to relax instructions.
23481
23482 @end table
23483
23484 @node Nios II Options
23485 @subsection Nios II Options
23486 @cindex Nios II options
23487 @cindex Altera Nios II options
23488
23489 These are the options defined for the Altera Nios II processor.
23490
23491 @table @gcctabopt
23492
23493 @item -G @var{num}
23494 @opindex G
23495 @cindex smaller data references
23496 Put global and static objects less than or equal to @var{num} bytes
23497 into the small data or BSS sections instead of the normal data or BSS
23498 sections. The default value of @var{num} is 8.
23499
23500 @item -mgpopt=@var{option}
23501 @itemx -mgpopt
23502 @itemx -mno-gpopt
23503 @opindex mgpopt
23504 @opindex mno-gpopt
23505 Generate (do not generate) GP-relative accesses. The following
23506 @var{option} names are recognized:
23507
23508 @table @samp
23509
23510 @item none
23511 Do not generate GP-relative accesses.
23512
23513 @item local
23514 Generate GP-relative accesses for small data objects that are not
23515 external, weak, or uninitialized common symbols.
23516 Also use GP-relative addressing for objects that
23517 have been explicitly placed in a small data section via a @code{section}
23518 attribute.
23519
23520 @item global
23521 As for @samp{local}, but also generate GP-relative accesses for
23522 small data objects that are external, weak, or common. If you use this option,
23523 you must ensure that all parts of your program (including libraries) are
23524 compiled with the same @option{-G} setting.
23525
23526 @item data
23527 Generate GP-relative accesses for all data objects in the program. If you
23528 use this option, the entire data and BSS segments
23529 of your program must fit in 64K of memory and you must use an appropriate
23530 linker script to allocate them within the addressable range of the
23531 global pointer.
23532
23533 @item all
23534 Generate GP-relative addresses for function pointers as well as data
23535 pointers. If you use this option, the entire text, data, and BSS segments
23536 of your program must fit in 64K of memory and you must use an appropriate
23537 linker script to allocate them within the addressable range of the
23538 global pointer.
23539
23540 @end table
23541
23542 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23543 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23544
23545 The default is @option{-mgpopt} except when @option{-fpic} or
23546 @option{-fPIC} is specified to generate position-independent code.
23547 Note that the Nios II ABI does not permit GP-relative accesses from
23548 shared libraries.
23549
23550 You may need to specify @option{-mno-gpopt} explicitly when building
23551 programs that include large amounts of small data, including large
23552 GOT data sections. In this case, the 16-bit offset for GP-relative
23553 addressing may not be large enough to allow access to the entire
23554 small data section.
23555
23556 @item -mgprel-sec=@var{regexp}
23557 @opindex mgprel-sec
23558 This option specifies additional section names that can be accessed via
23559 GP-relative addressing. It is most useful in conjunction with
23560 @code{section} attributes on variable declarations
23561 (@pxref{Common Variable Attributes}) and a custom linker script.
23562 The @var{regexp} is a POSIX Extended Regular Expression.
23563
23564 This option does not affect the behavior of the @option{-G} option, and
23565 the specified sections are in addition to the standard @code{.sdata}
23566 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23567
23568 @item -mr0rel-sec=@var{regexp}
23569 @opindex mr0rel-sec
23570 This option specifies names of sections that can be accessed via a
23571 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23572 of the 32-bit address space. It is most useful in conjunction with
23573 @code{section} attributes on variable declarations
23574 (@pxref{Common Variable Attributes}) and a custom linker script.
23575 The @var{regexp} is a POSIX Extended Regular Expression.
23576
23577 In contrast to the use of GP-relative addressing for small data,
23578 zero-based addressing is never generated by default and there are no
23579 conventional section names used in standard linker scripts for sections
23580 in the low or high areas of memory.
23581
23582 @item -mel
23583 @itemx -meb
23584 @opindex mel
23585 @opindex meb
23586 Generate little-endian (default) or big-endian (experimental) code,
23587 respectively.
23588
23589 @item -march=@var{arch}
23590 @opindex march
23591 This specifies the name of the target Nios II architecture. GCC uses this
23592 name to determine what kind of instructions it can emit when generating
23593 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23594
23595 The preprocessor macro @code{__nios2_arch__} is available to programs,
23596 with value 1 or 2, indicating the targeted ISA level.
23597
23598 @item -mbypass-cache
23599 @itemx -mno-bypass-cache
23600 @opindex mno-bypass-cache
23601 @opindex mbypass-cache
23602 Force all load and store instructions to always bypass cache by
23603 using I/O variants of the instructions. The default is not to
23604 bypass the cache.
23605
23606 @item -mno-cache-volatile
23607 @itemx -mcache-volatile
23608 @opindex mcache-volatile
23609 @opindex mno-cache-volatile
23610 Volatile memory access bypass the cache using the I/O variants of
23611 the load and store instructions. The default is not to bypass the cache.
23612
23613 @item -mno-fast-sw-div
23614 @itemx -mfast-sw-div
23615 @opindex mno-fast-sw-div
23616 @opindex mfast-sw-div
23617 Do not use table-based fast divide for small numbers. The default
23618 is to use the fast divide at @option{-O3} and above.
23619
23620 @item -mno-hw-mul
23621 @itemx -mhw-mul
23622 @itemx -mno-hw-mulx
23623 @itemx -mhw-mulx
23624 @itemx -mno-hw-div
23625 @itemx -mhw-div
23626 @opindex mno-hw-mul
23627 @opindex mhw-mul
23628 @opindex mno-hw-mulx
23629 @opindex mhw-mulx
23630 @opindex mno-hw-div
23631 @opindex mhw-div
23632 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23633 instructions by the compiler. The default is to emit @code{mul}
23634 and not emit @code{div} and @code{mulx}.
23635
23636 @item -mbmx
23637 @itemx -mno-bmx
23638 @itemx -mcdx
23639 @itemx -mno-cdx
23640 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23641 CDX (code density) instructions. Enabling these instructions also
23642 requires @option{-march=r2}. Since these instructions are optional
23643 extensions to the R2 architecture, the default is not to emit them.
23644
23645 @item -mcustom-@var{insn}=@var{N}
23646 @itemx -mno-custom-@var{insn}
23647 @opindex mcustom-@var{insn}
23648 @opindex mno-custom-@var{insn}
23649 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23650 custom instruction with encoding @var{N} when generating code that uses
23651 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23652 instruction 253 for single-precision floating-point add operations instead
23653 of the default behavior of using a library call.
23654
23655 The following values of @var{insn} are supported. Except as otherwise
23656 noted, floating-point operations are expected to be implemented with
23657 normal IEEE 754 semantics and correspond directly to the C operators or the
23658 equivalent GCC built-in functions (@pxref{Other Builtins}).
23659
23660 Single-precision floating point:
23661 @table @asis
23662
23663 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23664 Binary arithmetic operations.
23665
23666 @item @samp{fnegs}
23667 Unary negation.
23668
23669 @item @samp{fabss}
23670 Unary absolute value.
23671
23672 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23673 Comparison operations.
23674
23675 @item @samp{fmins}, @samp{fmaxs}
23676 Floating-point minimum and maximum. These instructions are only
23677 generated if @option{-ffinite-math-only} is specified.
23678
23679 @item @samp{fsqrts}
23680 Unary square root operation.
23681
23682 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23683 Floating-point trigonometric and exponential functions. These instructions
23684 are only generated if @option{-funsafe-math-optimizations} is also specified.
23685
23686 @end table
23687
23688 Double-precision floating point:
23689 @table @asis
23690
23691 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23692 Binary arithmetic operations.
23693
23694 @item @samp{fnegd}
23695 Unary negation.
23696
23697 @item @samp{fabsd}
23698 Unary absolute value.
23699
23700 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23701 Comparison operations.
23702
23703 @item @samp{fmind}, @samp{fmaxd}
23704 Double-precision minimum and maximum. These instructions are only
23705 generated if @option{-ffinite-math-only} is specified.
23706
23707 @item @samp{fsqrtd}
23708 Unary square root operation.
23709
23710 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23711 Double-precision trigonometric and exponential functions. These instructions
23712 are only generated if @option{-funsafe-math-optimizations} is also specified.
23713
23714 @end table
23715
23716 Conversions:
23717 @table @asis
23718 @item @samp{fextsd}
23719 Conversion from single precision to double precision.
23720
23721 @item @samp{ftruncds}
23722 Conversion from double precision to single precision.
23723
23724 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23725 Conversion from floating point to signed or unsigned integer types, with
23726 truncation towards zero.
23727
23728 @item @samp{round}
23729 Conversion from single-precision floating point to signed integer,
23730 rounding to the nearest integer and ties away from zero.
23731 This corresponds to the @code{__builtin_lroundf} function when
23732 @option{-fno-math-errno} is used.
23733
23734 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23735 Conversion from signed or unsigned integer types to floating-point types.
23736
23737 @end table
23738
23739 In addition, all of the following transfer instructions for internal
23740 registers X and Y must be provided to use any of the double-precision
23741 floating-point instructions. Custom instructions taking two
23742 double-precision source operands expect the first operand in the
23743 64-bit register X. The other operand (or only operand of a unary
23744 operation) is given to the custom arithmetic instruction with the
23745 least significant half in source register @var{src1} and the most
23746 significant half in @var{src2}. A custom instruction that returns a
23747 double-precision result returns the most significant 32 bits in the
23748 destination register and the other half in 32-bit register Y.
23749 GCC automatically generates the necessary code sequences to write
23750 register X and/or read register Y when double-precision floating-point
23751 instructions are used.
23752
23753 @table @asis
23754
23755 @item @samp{fwrx}
23756 Write @var{src1} into the least significant half of X and @var{src2} into
23757 the most significant half of X.
23758
23759 @item @samp{fwry}
23760 Write @var{src1} into Y.
23761
23762 @item @samp{frdxhi}, @samp{frdxlo}
23763 Read the most or least (respectively) significant half of X and store it in
23764 @var{dest}.
23765
23766 @item @samp{frdy}
23767 Read the value of Y and store it into @var{dest}.
23768 @end table
23769
23770 Note that you can gain more local control over generation of Nios II custom
23771 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23772 and @code{target("no-custom-@var{insn}")} function attributes
23773 (@pxref{Function Attributes})
23774 or pragmas (@pxref{Function Specific Option Pragmas}).
23775
23776 @item -mcustom-fpu-cfg=@var{name}
23777 @opindex mcustom-fpu-cfg
23778
23779 This option enables a predefined, named set of custom instruction encodings
23780 (see @option{-mcustom-@var{insn}} above).
23781 Currently, the following sets are defined:
23782
23783 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23784 @gccoptlist{-mcustom-fmuls=252 @gol
23785 -mcustom-fadds=253 @gol
23786 -mcustom-fsubs=254 @gol
23787 -fsingle-precision-constant}
23788
23789 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23790 @gccoptlist{-mcustom-fmuls=252 @gol
23791 -mcustom-fadds=253 @gol
23792 -mcustom-fsubs=254 @gol
23793 -mcustom-fdivs=255 @gol
23794 -fsingle-precision-constant}
23795
23796 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23797 @gccoptlist{-mcustom-floatus=243 @gol
23798 -mcustom-fixsi=244 @gol
23799 -mcustom-floatis=245 @gol
23800 -mcustom-fcmpgts=246 @gol
23801 -mcustom-fcmples=249 @gol
23802 -mcustom-fcmpeqs=250 @gol
23803 -mcustom-fcmpnes=251 @gol
23804 -mcustom-fmuls=252 @gol
23805 -mcustom-fadds=253 @gol
23806 -mcustom-fsubs=254 @gol
23807 -mcustom-fdivs=255 @gol
23808 -fsingle-precision-constant}
23809
23810 Custom instruction assignments given by individual
23811 @option{-mcustom-@var{insn}=} options override those given by
23812 @option{-mcustom-fpu-cfg=}, regardless of the
23813 order of the options on the command line.
23814
23815 Note that you can gain more local control over selection of a FPU
23816 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23817 function attribute (@pxref{Function Attributes})
23818 or pragma (@pxref{Function Specific Option Pragmas}).
23819
23820 @end table
23821
23822 These additional @samp{-m} options are available for the Altera Nios II
23823 ELF (bare-metal) target:
23824
23825 @table @gcctabopt
23826
23827 @item -mhal
23828 @opindex mhal
23829 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23830 startup and termination code, and is typically used in conjunction with
23831 @option{-msys-crt0=} to specify the location of the alternate startup code
23832 provided by the HAL BSP.
23833
23834 @item -msmallc
23835 @opindex msmallc
23836 Link with a limited version of the C library, @option{-lsmallc}, rather than
23837 Newlib.
23838
23839 @item -msys-crt0=@var{startfile}
23840 @opindex msys-crt0
23841 @var{startfile} is the file name of the startfile (crt0) to use
23842 when linking. This option is only useful in conjunction with @option{-mhal}.
23843
23844 @item -msys-lib=@var{systemlib}
23845 @opindex msys-lib
23846 @var{systemlib} is the library name of the library that provides
23847 low-level system calls required by the C library,
23848 e.g.@: @code{read} and @code{write}.
23849 This option is typically used to link with a library provided by a HAL BSP.
23850
23851 @end table
23852
23853 @node Nvidia PTX Options
23854 @subsection Nvidia PTX Options
23855 @cindex Nvidia PTX options
23856 @cindex nvptx options
23857
23858 These options are defined for Nvidia PTX:
23859
23860 @table @gcctabopt
23861
23862 @item -m32
23863 @itemx -m64
23864 @opindex m32
23865 @opindex m64
23866 Generate code for 32-bit or 64-bit ABI.
23867
23868 @item -misa=@var{ISA-string}
23869 @opindex march
23870 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23871 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23872 @samp{sm_35}. The default ISA is sm_30.
23873
23874 @item -mmainkernel
23875 @opindex mmainkernel
23876 Link in code for a __main kernel. This is for stand-alone instead of
23877 offloading execution.
23878
23879 @item -moptimize
23880 @opindex moptimize
23881 Apply partitioned execution optimizations. This is the default when any
23882 level of optimization is selected.
23883
23884 @item -msoft-stack
23885 @opindex msoft-stack
23886 Generate code that does not use @code{.local} memory
23887 directly for stack storage. Instead, a per-warp stack pointer is
23888 maintained explicitly. This enables variable-length stack allocation (with
23889 variable-length arrays or @code{alloca}), and when global memory is used for
23890 underlying storage, makes it possible to access automatic variables from other
23891 threads, or with atomic instructions. This code generation variant is used
23892 for OpenMP offloading, but the option is exposed on its own for the purpose
23893 of testing the compiler; to generate code suitable for linking into programs
23894 using OpenMP offloading, use option @option{-mgomp}.
23895
23896 @item -muniform-simt
23897 @opindex muniform-simt
23898 Switch to code generation variant that allows to execute all threads in each
23899 warp, while maintaining memory state and side effects as if only one thread
23900 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23901 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23902 current lane index equals the master lane index), and the register being
23903 assigned is copied via a shuffle instruction from the master lane. Outside of
23904 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23905 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23906 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23907 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23908 with current lane index to compute the master lane index.
23909
23910 @item -mgomp
23911 @opindex mgomp
23912 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23913 @option{-muniform-simt} options, and selects corresponding multilib variant.
23914
23915 @end table
23916
23917 @node OpenRISC Options
23918 @subsection OpenRISC Options
23919 @cindex OpenRISC Options
23920
23921 These options are defined for OpenRISC:
23922
23923 @table @gcctabopt
23924
23925 @item -mboard=@var{name}
23926 @opindex mboard
23927 Configure a board specific runtime. This will be passed to the linker for
23928 newlib board library linking. The default is @code{or1ksim}.
23929
23930 @item -mnewlib
23931 @opindex mnewlib
23932 This option is ignored; it is for compatibility purposes only. This used to
23933 select linker and preprocessor options for use with newlib.
23934
23935 @item -msoft-div
23936 @itemx -mhard-div
23937 @opindex msoft-div
23938 @opindex mhard-div
23939 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23940 This default is hardware divide.
23941
23942 @item -msoft-mul
23943 @itemx -mhard-mul
23944 @opindex msoft-mul
23945 @opindex mhard-mul
23946 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23947 This default is hardware multiply.
23948
23949 @item -msoft-float
23950 @itemx -mhard-float
23951 @opindex msoft-float
23952 @opindex mhard-float
23953 Select software or hardware for floating point operations.
23954 The default is software.
23955
23956 @item -mdouble-float
23957 @opindex mdouble-float
23958 When @option{-mhard-float} is selected, enables generation of double-precision
23959 floating point instructions. By default functions from @file{libgcc} are used
23960 to perform double-precision floating point operations.
23961
23962 @item -munordered-float
23963 @opindex munordered-float
23964 When @option{-mhard-float} is selected, enables generation of unordered
23965 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23966 functions from @file{libgcc} are used to perform unordered floating point
23967 compare and set flag operations.
23968
23969 @item -mcmov
23970 @opindex mcmov
23971 Enable generation of conditional move (@code{l.cmov}) instructions. By
23972 default the equivalent will be generated using using set and branch.
23973
23974 @item -mror
23975 @opindex mror
23976 Enable generation of rotate right (@code{l.ror}) instructions. By default
23977 functions from @file{libgcc} are used to perform rotate right operations.
23978
23979 @item -mrori
23980 @opindex mrori
23981 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23982 By default functions from @file{libgcc} are used to perform rotate right with
23983 immediate operations.
23984
23985 @item -msext
23986 @opindex msext
23987 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23988 memory loads are used to perform sign extension.
23989
23990 @item -msfimm
23991 @opindex msfimm
23992 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23993 instructions. By default extra instructions will be generated to store the
23994 immediate to a register first.
23995
23996 @item -mshftimm
23997 @opindex mshftimm
23998 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23999 @code{l.slli}) instructions. By default extra instructions will be generated
24000 to store the immediate to a register first.
24001
24002
24003 @end table
24004
24005 @node PDP-11 Options
24006 @subsection PDP-11 Options
24007 @cindex PDP-11 Options
24008
24009 These options are defined for the PDP-11:
24010
24011 @table @gcctabopt
24012 @item -mfpu
24013 @opindex mfpu
24014 Use hardware FPP floating point. This is the default. (FIS floating
24015 point on the PDP-11/40 is not supported.) Implies -m45.
24016
24017 @item -msoft-float
24018 @opindex msoft-float
24019 Do not use hardware floating point.
24020
24021 @item -mac0
24022 @opindex mac0
24023 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
24024
24025 @item -mno-ac0
24026 @opindex mno-ac0
24027 Return floating-point results in memory. This is the default.
24028
24029 @item -m40
24030 @opindex m40
24031 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
24032
24033 @item -m45
24034 @opindex m45
24035 Generate code for a PDP-11/45. This is the default.
24036
24037 @item -m10
24038 @opindex m10
24039 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
24040
24041 @item -mint16
24042 @itemx -mno-int32
24043 @opindex mint16
24044 @opindex mno-int32
24045 Use 16-bit @code{int}. This is the default.
24046
24047 @item -mint32
24048 @itemx -mno-int16
24049 @opindex mint32
24050 @opindex mno-int16
24051 Use 32-bit @code{int}.
24052
24053 @item -msplit
24054 @opindex msplit
24055 Target has split instruction and data space. Implies -m45.
24056
24057 @item -munix-asm
24058 @opindex munix-asm
24059 Use Unix assembler syntax.
24060
24061 @item -mdec-asm
24062 @opindex mdec-asm
24063 Use DEC assembler syntax.
24064
24065 @item -mgnu-asm
24066 @opindex mgnu-asm
24067 Use GNU assembler syntax. This is the default.
24068
24069 @item -mlra
24070 @opindex mlra
24071 Use the new LRA register allocator. By default, the old ``reload''
24072 allocator is used.
24073 @end table
24074
24075 @node picoChip Options
24076 @subsection picoChip Options
24077 @cindex picoChip options
24078
24079 These @samp{-m} options are defined for picoChip implementations:
24080
24081 @table @gcctabopt
24082
24083 @item -mae=@var{ae_type}
24084 @opindex mcpu
24085 Set the instruction set, register set, and instruction scheduling
24086 parameters for array element type @var{ae_type}. Supported values
24087 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
24088
24089 @option{-mae=ANY} selects a completely generic AE type. Code
24090 generated with this option runs on any of the other AE types. The
24091 code is not as efficient as it would be if compiled for a specific
24092 AE type, and some types of operation (e.g., multiplication) do not
24093 work properly on all types of AE.
24094
24095 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
24096 for compiled code, and is the default.
24097
24098 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
24099 option may suffer from poor performance of byte (char) manipulation,
24100 since the DSP AE does not provide hardware support for byte load/stores.
24101
24102 @item -msymbol-as-address
24103 Enable the compiler to directly use a symbol name as an address in a
24104 load/store instruction, without first loading it into a
24105 register. Typically, the use of this option generates larger
24106 programs, which run faster than when the option isn't used. However, the
24107 results vary from program to program, so it is left as a user option,
24108 rather than being permanently enabled.
24109
24110 @item -mno-inefficient-warnings
24111 Disables warnings about the generation of inefficient code. These
24112 warnings can be generated, for example, when compiling code that
24113 performs byte-level memory operations on the MAC AE type. The MAC AE has
24114 no hardware support for byte-level memory operations, so all byte
24115 load/stores must be synthesized from word load/store operations. This is
24116 inefficient and a warning is generated to indicate
24117 that you should rewrite the code to avoid byte operations, or to target
24118 an AE type that has the necessary hardware support. This option disables
24119 these warnings.
24120
24121 @end table
24122
24123 @node PowerPC Options
24124 @subsection PowerPC Options
24125 @cindex PowerPC options
24126
24127 These are listed under @xref{RS/6000 and PowerPC Options}.
24128
24129 @node PRU Options
24130 @subsection PRU Options
24131 @cindex PRU Options
24132
24133 These command-line options are defined for PRU target:
24134
24135 @table @gcctabopt
24136 @item -minrt
24137 @opindex minrt
24138 Link with a minimum runtime environment, with no support for static
24139 initializers and constructors. Using this option can significantly reduce
24140 the size of the final ELF binary. Beware that the compiler could still
24141 generate code with static initializers and constructors. It is up to the
24142 programmer to ensure that the source program will not use those features.
24143
24144 @item -mmcu=@var{mcu}
24145 @opindex mmcu
24146 Specify the PRU MCU variant to use. Check Newlib for the exact list of
24147 supported MCUs.
24148
24149 @item -mno-relax
24150 @opindex mno-relax
24151 Make GCC pass the @option{--no-relax} command-line option to the linker
24152 instead of the @option{--relax} option.
24153
24154 @item -mloop
24155 @opindex mloop
24156 Allow (or do not allow) GCC to use the LOOP instruction.
24157
24158 @item -mabi=@var{variant}
24159 @opindex mabi
24160 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
24161 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
24162 more naturally with certain GCC assumptions. These are the differences:
24163
24164 @table @samp
24165 @item Function Pointer Size
24166 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
24167 supports only 32-bit data and code pointers.
24168
24169 @item Optional Return Value Pointer
24170 Function return values larger than 64 bits are passed by using a hidden
24171 pointer as the first argument of the function. TI ABI, though, mandates that
24172 the pointer can be NULL in case the caller is not using the returned value.
24173 GNU always passes and expects a valid return value pointer.
24174
24175 @end table
24176
24177 The current @option{-mabi=ti} implementation simply raises a compile error
24178 when any of the above code constructs is detected. As a consequence
24179 the standard C library cannot be built and it is omitted when linking with
24180 @option{-mabi=ti}.
24181
24182 Relaxation is a GNU feature and for safety reasons is disabled when using
24183 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
24184 instructions, so the GNU linker cannot adjust them when shortening adjacent
24185 LDI32 pseudo instructions.
24186
24187 @end table
24188
24189 @node RISC-V Options
24190 @subsection RISC-V Options
24191 @cindex RISC-V Options
24192
24193 These command-line options are defined for RISC-V targets:
24194
24195 @table @gcctabopt
24196 @item -mbranch-cost=@var{n}
24197 @opindex mbranch-cost
24198 Set the cost of branches to roughly @var{n} instructions.
24199
24200 @item -mplt
24201 @itemx -mno-plt
24202 @opindex plt
24203 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24204 non-PIC. The default is @option{-mplt}.
24205
24206 @item -mabi=@var{ABI-string}
24207 @opindex mabi
24208 Specify integer and floating-point calling convention. @var{ABI-string}
24209 contains two parts: the size of integer types and the registers used for
24210 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24211 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24212 32-bit), and that floating-point values up to 64 bits wide are passed in F
24213 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24214 allows the compiler to generate code that uses the F and D extensions but only
24215 allows floating-point values up to 32 bits long to be passed in registers; or
24216 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24217 passed in registers.
24218
24219 The default for this argument is system dependent, users who want a specific
24220 calling convention should specify one explicitly. The valid calling
24221 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24222 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24223 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24224 invalid because the ABI requires 64-bit values be passed in F registers, but F
24225 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24226 only be used with the @samp{rv32e} architecture. This ABI is not well
24227 specified at present, and is subject to change.
24228
24229 @item -mfdiv
24230 @itemx -mno-fdiv
24231 @opindex mfdiv
24232 Do or don't use hardware floating-point divide and square root instructions.
24233 This requires the F or D extensions for floating-point registers. The default
24234 is to use them if the specified architecture has these instructions.
24235
24236 @item -mdiv
24237 @itemx -mno-div
24238 @opindex mdiv
24239 Do or don't use hardware instructions for integer division. This requires the
24240 M extension. The default is to use them if the specified architecture has
24241 these instructions.
24242
24243 @item -march=@var{ISA-string}
24244 @opindex march
24245 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24246 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24247 @samp{rv32imaf}.
24248
24249 @item -mtune=@var{processor-string}
24250 @opindex mtune
24251 Optimize the output for the given processor, specified by microarchitecture
24252 name. Permissible values for this option are: @samp{rocket},
24253 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24254 and @samp{size}.
24255
24256 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24257
24258 The @samp{size} choice is not intended for use by end-users. This is used
24259 when @option{-Os} is specified. It overrides the instruction cost info
24260 provided by @option{-mtune=}, but does not override the pipeline info. This
24261 helps reduce code size while still giving good performance.
24262
24263 @item -mpreferred-stack-boundary=@var{num}
24264 @opindex mpreferred-stack-boundary
24265 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24266 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24267 the default is 4 (16 bytes or 128-bits).
24268
24269 @strong{Warning:} If you use this switch, then you must build all modules with
24270 the same value, including any libraries. This includes the system libraries
24271 and startup modules.
24272
24273 @item -msmall-data-limit=@var{n}
24274 @opindex msmall-data-limit
24275 Put global and static data smaller than @var{n} bytes into a special section
24276 (on some targets).
24277
24278 @item -msave-restore
24279 @itemx -mno-save-restore
24280 @opindex msave-restore
24281 Do or don't use smaller but slower prologue and epilogue code that uses
24282 library function calls. The default is to use fast inline prologues and
24283 epilogues.
24284
24285 @item -mstrict-align
24286 @itemx -mno-strict-align
24287 @opindex mstrict-align
24288 Do not or do generate unaligned memory accesses. The default is set depending
24289 on whether the processor we are optimizing for supports fast unaligned access
24290 or not.
24291
24292 @item -mcmodel=medlow
24293 @opindex mcmodel=medlow
24294 Generate code for the medium-low code model. The program and its statically
24295 defined symbols must lie within a single 2 GiB address range and must lie
24296 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24297 statically or dynamically linked. This is the default code model.
24298
24299 @item -mcmodel=medany
24300 @opindex mcmodel=medany
24301 Generate code for the medium-any code model. The program and its statically
24302 defined symbols must be within any single 2 GiB address range. Programs can be
24303 statically or dynamically linked.
24304
24305 @item -mexplicit-relocs
24306 @itemx -mno-exlicit-relocs
24307 Use or do not use assembler relocation operators when dealing with symbolic
24308 addresses. The alternative is to use assembler macros instead, which may
24309 limit optimization.
24310
24311 @item -mrelax
24312 @itemx -mno-relax
24313 Take advantage of linker relaxations to reduce the number of instructions
24314 required to materialize symbol addresses. The default is to take advantage of
24315 linker relaxations.
24316
24317 @item -memit-attribute
24318 @itemx -mno-emit-attribute
24319 Emit (do not emit) RISC-V attribute to record extra information into ELF
24320 objects. This feature requires at least binutils 2.32.
24321
24322 @item -malign-data=@var{type}
24323 @opindex malign-data
24324 Control how GCC aligns variables and constants of array, structure, or union
24325 types. Supported values for @var{type} are @samp{xlen} which uses x register
24326 width as the alignment value, and @samp{natural} which uses natural alignment.
24327 @samp{xlen} is the default.
24328 @end table
24329
24330 @node RL78 Options
24331 @subsection RL78 Options
24332 @cindex RL78 Options
24333
24334 @table @gcctabopt
24335
24336 @item -msim
24337 @opindex msim
24338 Links in additional target libraries to support operation within a
24339 simulator.
24340
24341 @item -mmul=none
24342 @itemx -mmul=g10
24343 @itemx -mmul=g13
24344 @itemx -mmul=g14
24345 @itemx -mmul=rl78
24346 @opindex mmul
24347 Specifies the type of hardware multiplication and division support to
24348 be used. The simplest is @code{none}, which uses software for both
24349 multiplication and division. This is the default. The @code{g13}
24350 value is for the hardware multiply/divide peripheral found on the
24351 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24352 the multiplication and division instructions supported by the RL78/G14
24353 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24354 the value @code{mg10} is an alias for @code{none}.
24355
24356 In addition a C preprocessor macro is defined, based upon the setting
24357 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24358 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24359
24360 @item -mcpu=g10
24361 @itemx -mcpu=g13
24362 @itemx -mcpu=g14
24363 @itemx -mcpu=rl78
24364 @opindex mcpu
24365 Specifies the RL78 core to target. The default is the G14 core, also
24366 known as an S3 core or just RL78. The G13 or S2 core does not have
24367 multiply or divide instructions, instead it uses a hardware peripheral
24368 for these operations. The G10 or S1 core does not have register
24369 banks, so it uses a different calling convention.
24370
24371 If this option is set it also selects the type of hardware multiply
24372 support to use, unless this is overridden by an explicit
24373 @option{-mmul=none} option on the command line. Thus specifying
24374 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24375 peripheral and specifying @option{-mcpu=g10} disables the use of
24376 hardware multiplications altogether.
24377
24378 Note, although the RL78/G14 core is the default target, specifying
24379 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24380 change the behavior of the toolchain since it also enables G14
24381 hardware multiply support. If these options are not specified on the
24382 command line then software multiplication routines will be used even
24383 though the code targets the RL78 core. This is for backwards
24384 compatibility with older toolchains which did not have hardware
24385 multiply and divide support.
24386
24387 In addition a C preprocessor macro is defined, based upon the setting
24388 of this option. Possible values are: @code{__RL78_G10__},
24389 @code{__RL78_G13__} or @code{__RL78_G14__}.
24390
24391 @item -mg10
24392 @itemx -mg13
24393 @itemx -mg14
24394 @itemx -mrl78
24395 @opindex mg10
24396 @opindex mg13
24397 @opindex mg14
24398 @opindex mrl78
24399 These are aliases for the corresponding @option{-mcpu=} option. They
24400 are provided for backwards compatibility.
24401
24402 @item -mallregs
24403 @opindex mallregs
24404 Allow the compiler to use all of the available registers. By default
24405 registers @code{r24..r31} are reserved for use in interrupt handlers.
24406 With this option enabled these registers can be used in ordinary
24407 functions as well.
24408
24409 @item -m64bit-doubles
24410 @itemx -m32bit-doubles
24411 @opindex m64bit-doubles
24412 @opindex m32bit-doubles
24413 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24414 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24415 @option{-m32bit-doubles}.
24416
24417 @item -msave-mduc-in-interrupts
24418 @itemx -mno-save-mduc-in-interrupts
24419 @opindex msave-mduc-in-interrupts
24420 @opindex mno-save-mduc-in-interrupts
24421 Specifies that interrupt handler functions should preserve the
24422 MDUC registers. This is only necessary if normal code might use
24423 the MDUC registers, for example because it performs multiplication
24424 and division operations. The default is to ignore the MDUC registers
24425 as this makes the interrupt handlers faster. The target option -mg13
24426 needs to be passed for this to work as this feature is only available
24427 on the G13 target (S2 core). The MDUC registers will only be saved
24428 if the interrupt handler performs a multiplication or division
24429 operation or it calls another function.
24430
24431 @end table
24432
24433 @node RS/6000 and PowerPC Options
24434 @subsection IBM RS/6000 and PowerPC Options
24435 @cindex RS/6000 and PowerPC Options
24436 @cindex IBM RS/6000 and PowerPC Options
24437
24438 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24439 @table @gcctabopt
24440 @item -mpowerpc-gpopt
24441 @itemx -mno-powerpc-gpopt
24442 @itemx -mpowerpc-gfxopt
24443 @itemx -mno-powerpc-gfxopt
24444 @need 800
24445 @itemx -mpowerpc64
24446 @itemx -mno-powerpc64
24447 @itemx -mmfcrf
24448 @itemx -mno-mfcrf
24449 @itemx -mpopcntb
24450 @itemx -mno-popcntb
24451 @itemx -mpopcntd
24452 @itemx -mno-popcntd
24453 @itemx -mfprnd
24454 @itemx -mno-fprnd
24455 @need 800
24456 @itemx -mcmpb
24457 @itemx -mno-cmpb
24458 @itemx -mhard-dfp
24459 @itemx -mno-hard-dfp
24460 @opindex mpowerpc-gpopt
24461 @opindex mno-powerpc-gpopt
24462 @opindex mpowerpc-gfxopt
24463 @opindex mno-powerpc-gfxopt
24464 @opindex mpowerpc64
24465 @opindex mno-powerpc64
24466 @opindex mmfcrf
24467 @opindex mno-mfcrf
24468 @opindex mpopcntb
24469 @opindex mno-popcntb
24470 @opindex mpopcntd
24471 @opindex mno-popcntd
24472 @opindex mfprnd
24473 @opindex mno-fprnd
24474 @opindex mcmpb
24475 @opindex mno-cmpb
24476 @opindex mhard-dfp
24477 @opindex mno-hard-dfp
24478 You use these options to specify which instructions are available on the
24479 processor you are using. The default value of these options is
24480 determined when configuring GCC@. Specifying the
24481 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24482 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24483 rather than the options listed above.
24484
24485 Specifying @option{-mpowerpc-gpopt} allows
24486 GCC to use the optional PowerPC architecture instructions in the
24487 General Purpose group, including floating-point square root. Specifying
24488 @option{-mpowerpc-gfxopt} allows GCC to
24489 use the optional PowerPC architecture instructions in the Graphics
24490 group, including floating-point select.
24491
24492 The @option{-mmfcrf} option allows GCC to generate the move from
24493 condition register field instruction implemented on the POWER4
24494 processor and other processors that support the PowerPC V2.01
24495 architecture.
24496 The @option{-mpopcntb} option allows GCC to generate the popcount and
24497 double-precision FP reciprocal estimate instruction implemented on the
24498 POWER5 processor and other processors that support the PowerPC V2.02
24499 architecture.
24500 The @option{-mpopcntd} option allows GCC to generate the popcount
24501 instruction implemented on the POWER7 processor and other processors
24502 that support the PowerPC V2.06 architecture.
24503 The @option{-mfprnd} option allows GCC to generate the FP round to
24504 integer instructions implemented on the POWER5+ processor and other
24505 processors that support the PowerPC V2.03 architecture.
24506 The @option{-mcmpb} option allows GCC to generate the compare bytes
24507 instruction implemented on the POWER6 processor and other processors
24508 that support the PowerPC V2.05 architecture.
24509 The @option{-mhard-dfp} option allows GCC to generate the decimal
24510 floating-point instructions implemented on some POWER processors.
24511
24512 The @option{-mpowerpc64} option allows GCC to generate the additional
24513 64-bit instructions that are found in the full PowerPC64 architecture
24514 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24515 @option{-mno-powerpc64}.
24516
24517 @item -mcpu=@var{cpu_type}
24518 @opindex mcpu
24519 Set architecture type, register usage, and
24520 instruction scheduling parameters for machine type @var{cpu_type}.
24521 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24522 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24523 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24524 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24525 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24526 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24527 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24528 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24529 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24530 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24531 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24532 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24533
24534 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24535 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24536 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24537 architecture machine types, with an appropriate, generic processor
24538 model assumed for scheduling purposes.
24539
24540 Specifying @samp{native} as cpu type detects and selects the
24541 architecture option that corresponds to the host processor of the
24542 system performing the compilation.
24543 @option{-mcpu=native} has no effect if GCC does not recognize the
24544 processor.
24545
24546 The other options specify a specific processor. Code generated under
24547 those options runs best on that processor, and may not run at all on
24548 others.
24549
24550 The @option{-mcpu} options automatically enable or disable the
24551 following options:
24552
24553 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24554 -mpopcntb -mpopcntd -mpowerpc64 @gol
24555 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24556 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24557 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24558 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24559
24560 The particular options set for any particular CPU varies between
24561 compiler versions, depending on what setting seems to produce optimal
24562 code for that CPU; it doesn't necessarily reflect the actual hardware's
24563 capabilities. If you wish to set an individual option to a particular
24564 value, you may specify it after the @option{-mcpu} option, like
24565 @option{-mcpu=970 -mno-altivec}.
24566
24567 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24568 not enabled or disabled by the @option{-mcpu} option at present because
24569 AIX does not have full support for these options. You may still
24570 enable or disable them individually if you're sure it'll work in your
24571 environment.
24572
24573 @item -mtune=@var{cpu_type}
24574 @opindex mtune
24575 Set the instruction scheduling parameters for machine type
24576 @var{cpu_type}, but do not set the architecture type or register usage,
24577 as @option{-mcpu=@var{cpu_type}} does. The same
24578 values for @var{cpu_type} are used for @option{-mtune} as for
24579 @option{-mcpu}. If both are specified, the code generated uses the
24580 architecture and registers set by @option{-mcpu}, but the
24581 scheduling parameters set by @option{-mtune}.
24582
24583 @item -mcmodel=small
24584 @opindex mcmodel=small
24585 Generate PowerPC64 code for the small model: The TOC is limited to
24586 64k.
24587
24588 @item -mcmodel=medium
24589 @opindex mcmodel=medium
24590 Generate PowerPC64 code for the medium model: The TOC and other static
24591 data may be up to a total of 4G in size. This is the default for 64-bit
24592 Linux.
24593
24594 @item -mcmodel=large
24595 @opindex mcmodel=large
24596 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24597 in size. Other data and code is only limited by the 64-bit address
24598 space.
24599
24600 @item -maltivec
24601 @itemx -mno-altivec
24602 @opindex maltivec
24603 @opindex mno-altivec
24604 Generate code that uses (does not use) AltiVec instructions, and also
24605 enable the use of built-in functions that allow more direct access to
24606 the AltiVec instruction set. You may also need to set
24607 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24608 enhancements.
24609
24610 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24611 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24612 match array element order corresponding to the endianness of the
24613 target. That is, element zero identifies the leftmost element in a
24614 vector register when targeting a big-endian platform, and identifies
24615 the rightmost element in a vector register when targeting a
24616 little-endian platform.
24617
24618 @item -mvrsave
24619 @itemx -mno-vrsave
24620 @opindex mvrsave
24621 @opindex mno-vrsave
24622 Generate VRSAVE instructions when generating AltiVec code.
24623
24624 @item -msecure-plt
24625 @opindex msecure-plt
24626 Generate code that allows @command{ld} and @command{ld.so}
24627 to build executables and shared
24628 libraries with non-executable @code{.plt} and @code{.got} sections.
24629 This is a PowerPC
24630 32-bit SYSV ABI option.
24631
24632 @item -mbss-plt
24633 @opindex mbss-plt
24634 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24635 fills in, and
24636 requires @code{.plt} and @code{.got}
24637 sections that are both writable and executable.
24638 This is a PowerPC 32-bit SYSV ABI option.
24639
24640 @item -misel
24641 @itemx -mno-isel
24642 @opindex misel
24643 @opindex mno-isel
24644 This switch enables or disables the generation of ISEL instructions.
24645
24646 @item -mvsx
24647 @itemx -mno-vsx
24648 @opindex mvsx
24649 @opindex mno-vsx
24650 Generate code that uses (does not use) vector/scalar (VSX)
24651 instructions, and also enable the use of built-in functions that allow
24652 more direct access to the VSX instruction set.
24653
24654 @item -mcrypto
24655 @itemx -mno-crypto
24656 @opindex mcrypto
24657 @opindex mno-crypto
24658 Enable the use (disable) of the built-in functions that allow direct
24659 access to the cryptographic instructions that were added in version
24660 2.07 of the PowerPC ISA.
24661
24662 @item -mhtm
24663 @itemx -mno-htm
24664 @opindex mhtm
24665 @opindex mno-htm
24666 Enable (disable) the use of the built-in functions that allow direct
24667 access to the Hardware Transactional Memory (HTM) instructions that
24668 were added in version 2.07 of the PowerPC ISA.
24669
24670 @item -mpower8-fusion
24671 @itemx -mno-power8-fusion
24672 @opindex mpower8-fusion
24673 @opindex mno-power8-fusion
24674 Generate code that keeps (does not keeps) some integer operations
24675 adjacent so that the instructions can be fused together on power8 and
24676 later processors.
24677
24678 @item -mpower8-vector
24679 @itemx -mno-power8-vector
24680 @opindex mpower8-vector
24681 @opindex mno-power8-vector
24682 Generate code that uses (does not use) the vector and scalar
24683 instructions that were added in version 2.07 of the PowerPC ISA. Also
24684 enable the use of built-in functions that allow more direct access to
24685 the vector instructions.
24686
24687 @item -mquad-memory
24688 @itemx -mno-quad-memory
24689 @opindex mquad-memory
24690 @opindex mno-quad-memory
24691 Generate code that uses (does not use) the non-atomic quad word memory
24692 instructions. The @option{-mquad-memory} option requires use of
24693 64-bit mode.
24694
24695 @item -mquad-memory-atomic
24696 @itemx -mno-quad-memory-atomic
24697 @opindex mquad-memory-atomic
24698 @opindex mno-quad-memory-atomic
24699 Generate code that uses (does not use) the atomic quad word memory
24700 instructions. The @option{-mquad-memory-atomic} option requires use of
24701 64-bit mode.
24702
24703 @item -mfloat128
24704 @itemx -mno-float128
24705 @opindex mfloat128
24706 @opindex mno-float128
24707 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24708 and use either software emulation for IEEE 128-bit floating point or
24709 hardware instructions.
24710
24711 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24712 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24713 use the IEEE 128-bit floating point support. The IEEE 128-bit
24714 floating point support only works on PowerPC Linux systems.
24715
24716 The default for @option{-mfloat128} is enabled on PowerPC Linux
24717 systems using the VSX instruction set, and disabled on other systems.
24718
24719 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24720 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24721 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24722 floating point instructions. Otherwise, if you do not specify to
24723 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24724 system, IEEE 128-bit floating point will be done with software
24725 emulation.
24726
24727 @item -mfloat128-hardware
24728 @itemx -mno-float128-hardware
24729 @opindex mfloat128-hardware
24730 @opindex mno-float128-hardware
24731 Enable/disable using ISA 3.0 hardware instructions to support the
24732 @var{__float128} data type.
24733
24734 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24735 Linux systems using the ISA 3.0 instruction set, and disabled on other
24736 systems.
24737
24738 @item -m32
24739 @itemx -m64
24740 @opindex m32
24741 @opindex m64
24742 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24743 targets (including GNU/Linux). The 32-bit environment sets int, long
24744 and pointer to 32 bits and generates code that runs on any PowerPC
24745 variant. The 64-bit environment sets int to 32 bits and long and
24746 pointer to 64 bits, and generates code for PowerPC64, as for
24747 @option{-mpowerpc64}.
24748
24749 @item -mfull-toc
24750 @itemx -mno-fp-in-toc
24751 @itemx -mno-sum-in-toc
24752 @itemx -mminimal-toc
24753 @opindex mfull-toc
24754 @opindex mno-fp-in-toc
24755 @opindex mno-sum-in-toc
24756 @opindex mminimal-toc
24757 Modify generation of the TOC (Table Of Contents), which is created for
24758 every executable file. The @option{-mfull-toc} option is selected by
24759 default. In that case, GCC allocates at least one TOC entry for
24760 each unique non-automatic variable reference in your program. GCC
24761 also places floating-point constants in the TOC@. However, only
24762 16,384 entries are available in the TOC@.
24763
24764 If you receive a linker error message that saying you have overflowed
24765 the available TOC space, you can reduce the amount of TOC space used
24766 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24767 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24768 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24769 generate code to calculate the sum of an address and a constant at
24770 run time instead of putting that sum into the TOC@. You may specify one
24771 or both of these options. Each causes GCC to produce very slightly
24772 slower and larger code at the expense of conserving TOC space.
24773
24774 If you still run out of space in the TOC even when you specify both of
24775 these options, specify @option{-mminimal-toc} instead. This option causes
24776 GCC to make only one TOC entry for every file. When you specify this
24777 option, GCC produces code that is slower and larger but which
24778 uses extremely little TOC space. You may wish to use this option
24779 only on files that contain less frequently-executed code.
24780
24781 @item -maix64
24782 @itemx -maix32
24783 @opindex maix64
24784 @opindex maix32
24785 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24786 @code{long} type, and the infrastructure needed to support them.
24787 Specifying @option{-maix64} implies @option{-mpowerpc64},
24788 while @option{-maix32} disables the 64-bit ABI and
24789 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24790
24791 @item -mxl-compat
24792 @itemx -mno-xl-compat
24793 @opindex mxl-compat
24794 @opindex mno-xl-compat
24795 Produce code that conforms more closely to IBM XL compiler semantics
24796 when using AIX-compatible ABI@. Pass floating-point arguments to
24797 prototyped functions beyond the register save area (RSA) on the stack
24798 in addition to argument FPRs. Do not assume that most significant
24799 double in 128-bit long double value is properly rounded when comparing
24800 values and converting to double. Use XL symbol names for long double
24801 support routines.
24802
24803 The AIX calling convention was extended but not initially documented to
24804 handle an obscure K&R C case of calling a function that takes the
24805 address of its arguments with fewer arguments than declared. IBM XL
24806 compilers access floating-point arguments that do not fit in the
24807 RSA from the stack when a subroutine is compiled without
24808 optimization. Because always storing floating-point arguments on the
24809 stack is inefficient and rarely needed, this option is not enabled by
24810 default and only is necessary when calling subroutines compiled by IBM
24811 XL compilers without optimization.
24812
24813 @item -mpe
24814 @opindex mpe
24815 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24816 application written to use message passing with special startup code to
24817 enable the application to run. The system must have PE installed in the
24818 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24819 must be overridden with the @option{-specs=} option to specify the
24820 appropriate directory location. The Parallel Environment does not
24821 support threads, so the @option{-mpe} option and the @option{-pthread}
24822 option are incompatible.
24823
24824 @item -malign-natural
24825 @itemx -malign-power
24826 @opindex malign-natural
24827 @opindex malign-power
24828 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24829 @option{-malign-natural} overrides the ABI-defined alignment of larger
24830 types, such as floating-point doubles, on their natural size-based boundary.
24831 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24832 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24833
24834 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24835 is not supported.
24836
24837 @item -msoft-float
24838 @itemx -mhard-float
24839 @opindex msoft-float
24840 @opindex mhard-float
24841 Generate code that does not use (uses) the floating-point register set.
24842 Software floating-point emulation is provided if you use the
24843 @option{-msoft-float} option, and pass the option to GCC when linking.
24844
24845 @item -mmultiple
24846 @itemx -mno-multiple
24847 @opindex mmultiple
24848 @opindex mno-multiple
24849 Generate code that uses (does not use) the load multiple word
24850 instructions and the store multiple word instructions. These
24851 instructions are generated by default on POWER systems, and not
24852 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24853 PowerPC systems, since those instructions do not work when the
24854 processor is in little-endian mode. The exceptions are PPC740 and
24855 PPC750 which permit these instructions in little-endian mode.
24856
24857 @item -mupdate
24858 @itemx -mno-update
24859 @opindex mupdate
24860 @opindex mno-update
24861 Generate code that uses (does not use) the load or store instructions
24862 that update the base register to the address of the calculated memory
24863 location. These instructions are generated by default. If you use
24864 @option{-mno-update}, there is a small window between the time that the
24865 stack pointer is updated and the address of the previous frame is
24866 stored, which means code that walks the stack frame across interrupts or
24867 signals may get corrupted data.
24868
24869 @item -mavoid-indexed-addresses
24870 @itemx -mno-avoid-indexed-addresses
24871 @opindex mavoid-indexed-addresses
24872 @opindex mno-avoid-indexed-addresses
24873 Generate code that tries to avoid (not avoid) the use of indexed load
24874 or store instructions. These instructions can incur a performance
24875 penalty on Power6 processors in certain situations, such as when
24876 stepping through large arrays that cross a 16M boundary. This option
24877 is enabled by default when targeting Power6 and disabled otherwise.
24878
24879 @item -mfused-madd
24880 @itemx -mno-fused-madd
24881 @opindex mfused-madd
24882 @opindex mno-fused-madd
24883 Generate code that uses (does not use) the floating-point multiply and
24884 accumulate instructions. These instructions are generated by default
24885 if hardware floating point is used. The machine-dependent
24886 @option{-mfused-madd} option is now mapped to the machine-independent
24887 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24888 mapped to @option{-ffp-contract=off}.
24889
24890 @item -mmulhw
24891 @itemx -mno-mulhw
24892 @opindex mmulhw
24893 @opindex mno-mulhw
24894 Generate code that uses (does not use) the half-word multiply and
24895 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24896 These instructions are generated by default when targeting those
24897 processors.
24898
24899 @item -mdlmzb
24900 @itemx -mno-dlmzb
24901 @opindex mdlmzb
24902 @opindex mno-dlmzb
24903 Generate code that uses (does not use) the string-search @samp{dlmzb}
24904 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24905 generated by default when targeting those processors.
24906
24907 @item -mno-bit-align
24908 @itemx -mbit-align
24909 @opindex mno-bit-align
24910 @opindex mbit-align
24911 On System V.4 and embedded PowerPC systems do not (do) force structures
24912 and unions that contain bit-fields to be aligned to the base type of the
24913 bit-field.
24914
24915 For example, by default a structure containing nothing but 8
24916 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24917 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24918 the structure is aligned to a 1-byte boundary and is 1 byte in
24919 size.
24920
24921 @item -mno-strict-align
24922 @itemx -mstrict-align
24923 @opindex mno-strict-align
24924 @opindex mstrict-align
24925 On System V.4 and embedded PowerPC systems do not (do) assume that
24926 unaligned memory references are handled by the system.
24927
24928 @item -mrelocatable
24929 @itemx -mno-relocatable
24930 @opindex mrelocatable
24931 @opindex mno-relocatable
24932 Generate code that allows (does not allow) a static executable to be
24933 relocated to a different address at run time. A simple embedded
24934 PowerPC system loader should relocate the entire contents of
24935 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24936 a table of 32-bit addresses generated by this option. For this to
24937 work, all objects linked together must be compiled with
24938 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24939 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24940
24941 @item -mrelocatable-lib
24942 @itemx -mno-relocatable-lib
24943 @opindex mrelocatable-lib
24944 @opindex mno-relocatable-lib
24945 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24946 @code{.fixup} section to allow static executables to be relocated at
24947 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24948 alignment of @option{-mrelocatable}. Objects compiled with
24949 @option{-mrelocatable-lib} may be linked with objects compiled with
24950 any combination of the @option{-mrelocatable} options.
24951
24952 @item -mno-toc
24953 @itemx -mtoc
24954 @opindex mno-toc
24955 @opindex mtoc
24956 On System V.4 and embedded PowerPC systems do not (do) assume that
24957 register 2 contains a pointer to a global area pointing to the addresses
24958 used in the program.
24959
24960 @item -mlittle
24961 @itemx -mlittle-endian
24962 @opindex mlittle
24963 @opindex mlittle-endian
24964 On System V.4 and embedded PowerPC systems compile code for the
24965 processor in little-endian mode. The @option{-mlittle-endian} option is
24966 the same as @option{-mlittle}.
24967
24968 @item -mbig
24969 @itemx -mbig-endian
24970 @opindex mbig
24971 @opindex mbig-endian
24972 On System V.4 and embedded PowerPC systems compile code for the
24973 processor in big-endian mode. The @option{-mbig-endian} option is
24974 the same as @option{-mbig}.
24975
24976 @item -mdynamic-no-pic
24977 @opindex mdynamic-no-pic
24978 On Darwin and Mac OS X systems, compile code so that it is not
24979 relocatable, but that its external references are relocatable. The
24980 resulting code is suitable for applications, but not shared
24981 libraries.
24982
24983 @item -msingle-pic-base
24984 @opindex msingle-pic-base
24985 Treat the register used for PIC addressing as read-only, rather than
24986 loading it in the prologue for each function. The runtime system is
24987 responsible for initializing this register with an appropriate value
24988 before execution begins.
24989
24990 @item -mprioritize-restricted-insns=@var{priority}
24991 @opindex mprioritize-restricted-insns
24992 This option controls the priority that is assigned to
24993 dispatch-slot restricted instructions during the second scheduling
24994 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24995 or @samp{2} to assign no, highest, or second-highest (respectively)
24996 priority to dispatch-slot restricted
24997 instructions.
24998
24999 @item -msched-costly-dep=@var{dependence_type}
25000 @opindex msched-costly-dep
25001 This option controls which dependences are considered costly
25002 by the target during instruction scheduling. The argument
25003 @var{dependence_type} takes one of the following values:
25004
25005 @table @asis
25006 @item @samp{no}
25007 No dependence is costly.
25008
25009 @item @samp{all}
25010 All dependences are costly.
25011
25012 @item @samp{true_store_to_load}
25013 A true dependence from store to load is costly.
25014
25015 @item @samp{store_to_load}
25016 Any dependence from store to load is costly.
25017
25018 @item @var{number}
25019 Any dependence for which the latency is greater than or equal to
25020 @var{number} is costly.
25021 @end table
25022
25023 @item -minsert-sched-nops=@var{scheme}
25024 @opindex minsert-sched-nops
25025 This option controls which NOP insertion scheme is used during
25026 the second scheduling pass. The argument @var{scheme} takes one of the
25027 following values:
25028
25029 @table @asis
25030 @item @samp{no}
25031 Don't insert NOPs.
25032
25033 @item @samp{pad}
25034 Pad with NOPs any dispatch group that has vacant issue slots,
25035 according to the scheduler's grouping.
25036
25037 @item @samp{regroup_exact}
25038 Insert NOPs to force costly dependent insns into
25039 separate groups. Insert exactly as many NOPs as needed to force an insn
25040 to a new group, according to the estimated processor grouping.
25041
25042 @item @var{number}
25043 Insert NOPs to force costly dependent insns into
25044 separate groups. Insert @var{number} NOPs to force an insn to a new group.
25045 @end table
25046
25047 @item -mcall-sysv
25048 @opindex mcall-sysv
25049 On System V.4 and embedded PowerPC systems compile code using calling
25050 conventions that adhere to the March 1995 draft of the System V
25051 Application Binary Interface, PowerPC processor supplement. This is the
25052 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
25053
25054 @item -mcall-sysv-eabi
25055 @itemx -mcall-eabi
25056 @opindex mcall-sysv-eabi
25057 @opindex mcall-eabi
25058 Specify both @option{-mcall-sysv} and @option{-meabi} options.
25059
25060 @item -mcall-sysv-noeabi
25061 @opindex mcall-sysv-noeabi
25062 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
25063
25064 @item -mcall-aixdesc
25065 @opindex m
25066 On System V.4 and embedded PowerPC systems compile code for the AIX
25067 operating system.
25068
25069 @item -mcall-linux
25070 @opindex mcall-linux
25071 On System V.4 and embedded PowerPC systems compile code for the
25072 Linux-based GNU system.
25073
25074 @item -mcall-freebsd
25075 @opindex mcall-freebsd
25076 On System V.4 and embedded PowerPC systems compile code for the
25077 FreeBSD operating system.
25078
25079 @item -mcall-netbsd
25080 @opindex mcall-netbsd
25081 On System V.4 and embedded PowerPC systems compile code for the
25082 NetBSD operating system.
25083
25084 @item -mcall-openbsd
25085 @opindex mcall-netbsd
25086 On System V.4 and embedded PowerPC systems compile code for the
25087 OpenBSD operating system.
25088
25089 @item -mtraceback=@var{traceback_type}
25090 @opindex mtraceback
25091 Select the type of traceback table. Valid values for @var{traceback_type}
25092 are @samp{full}, @samp{part}, and @samp{no}.
25093
25094 @item -maix-struct-return
25095 @opindex maix-struct-return
25096 Return all structures in memory (as specified by the AIX ABI)@.
25097
25098 @item -msvr4-struct-return
25099 @opindex msvr4-struct-return
25100 Return structures smaller than 8 bytes in registers (as specified by the
25101 SVR4 ABI)@.
25102
25103 @item -mabi=@var{abi-type}
25104 @opindex mabi
25105 Extend the current ABI with a particular extension, or remove such extension.
25106 Valid values are @samp{altivec}, @samp{no-altivec},
25107 @samp{ibmlongdouble}, @samp{ieeelongdouble},
25108 @samp{elfv1}, @samp{elfv2}@.
25109
25110 @item -mabi=ibmlongdouble
25111 @opindex mabi=ibmlongdouble
25112 Change the current ABI to use IBM extended-precision long double.
25113 This is not likely to work if your system defaults to using IEEE
25114 extended-precision long double. If you change the long double type
25115 from IEEE extended-precision, the compiler will issue a warning unless
25116 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25117 to be enabled.
25118
25119 @item -mabi=ieeelongdouble
25120 @opindex mabi=ieeelongdouble
25121 Change the current ABI to use IEEE extended-precision long double.
25122 This is not likely to work if your system defaults to using IBM
25123 extended-precision long double. If you change the long double type
25124 from IBM extended-precision, the compiler will issue a warning unless
25125 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25126 to be enabled.
25127
25128 @item -mabi=elfv1
25129 @opindex mabi=elfv1
25130 Change the current ABI to use the ELFv1 ABI.
25131 This is the default ABI for big-endian PowerPC 64-bit Linux.
25132 Overriding the default ABI requires special system support and is
25133 likely to fail in spectacular ways.
25134
25135 @item -mabi=elfv2
25136 @opindex mabi=elfv2
25137 Change the current ABI to use the ELFv2 ABI.
25138 This is the default ABI for little-endian PowerPC 64-bit Linux.
25139 Overriding the default ABI requires special system support and is
25140 likely to fail in spectacular ways.
25141
25142 @item -mgnu-attribute
25143 @itemx -mno-gnu-attribute
25144 @opindex mgnu-attribute
25145 @opindex mno-gnu-attribute
25146 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25147 .gnu.attributes section that specify ABI variations in function
25148 parameters or return values.
25149
25150 @item -mprototype
25151 @itemx -mno-prototype
25152 @opindex mprototype
25153 @opindex mno-prototype
25154 On System V.4 and embedded PowerPC systems assume that all calls to
25155 variable argument functions are properly prototyped. Otherwise, the
25156 compiler must insert an instruction before every non-prototyped call to
25157 set or clear bit 6 of the condition code register (@code{CR}) to
25158 indicate whether floating-point values are passed in the floating-point
25159 registers in case the function takes variable arguments. With
25160 @option{-mprototype}, only calls to prototyped variable argument functions
25161 set or clear the bit.
25162
25163 @item -msim
25164 @opindex msim
25165 On embedded PowerPC systems, assume that the startup module is called
25166 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25167 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25168 configurations.
25169
25170 @item -mmvme
25171 @opindex mmvme
25172 On embedded PowerPC systems, assume that the startup module is called
25173 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25174 @file{libc.a}.
25175
25176 @item -mads
25177 @opindex mads
25178 On embedded PowerPC systems, assume that the startup module is called
25179 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25180 @file{libc.a}.
25181
25182 @item -myellowknife
25183 @opindex myellowknife
25184 On embedded PowerPC systems, assume that the startup module is called
25185 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25186 @file{libc.a}.
25187
25188 @item -mvxworks
25189 @opindex mvxworks
25190 On System V.4 and embedded PowerPC systems, specify that you are
25191 compiling for a VxWorks system.
25192
25193 @item -memb
25194 @opindex memb
25195 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25196 header to indicate that @samp{eabi} extended relocations are used.
25197
25198 @item -meabi
25199 @itemx -mno-eabi
25200 @opindex meabi
25201 @opindex mno-eabi
25202 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25203 Embedded Applications Binary Interface (EABI), which is a set of
25204 modifications to the System V.4 specifications. Selecting @option{-meabi}
25205 means that the stack is aligned to an 8-byte boundary, a function
25206 @code{__eabi} is called from @code{main} to set up the EABI
25207 environment, and the @option{-msdata} option can use both @code{r2} and
25208 @code{r13} to point to two separate small data areas. Selecting
25209 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25210 no EABI initialization function is called from @code{main}, and the
25211 @option{-msdata} option only uses @code{r13} to point to a single
25212 small data area. The @option{-meabi} option is on by default if you
25213 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25214
25215 @item -msdata=eabi
25216 @opindex msdata=eabi
25217 On System V.4 and embedded PowerPC systems, put small initialized
25218 @code{const} global and static data in the @code{.sdata2} section, which
25219 is pointed to by register @code{r2}. Put small initialized
25220 non-@code{const} global and static data in the @code{.sdata} section,
25221 which is pointed to by register @code{r13}. Put small uninitialized
25222 global and static data in the @code{.sbss} section, which is adjacent to
25223 the @code{.sdata} section. The @option{-msdata=eabi} option is
25224 incompatible with the @option{-mrelocatable} option. The
25225 @option{-msdata=eabi} option also sets the @option{-memb} option.
25226
25227 @item -msdata=sysv
25228 @opindex msdata=sysv
25229 On System V.4 and embedded PowerPC systems, put small global and static
25230 data in the @code{.sdata} section, which is pointed to by register
25231 @code{r13}. Put small uninitialized global and static data in the
25232 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25233 The @option{-msdata=sysv} option is incompatible with the
25234 @option{-mrelocatable} option.
25235
25236 @item -msdata=default
25237 @itemx -msdata
25238 @opindex msdata=default
25239 @opindex msdata
25240 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25241 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25242 same as @option{-msdata=sysv}.
25243
25244 @item -msdata=data
25245 @opindex msdata=data
25246 On System V.4 and embedded PowerPC systems, put small global
25247 data in the @code{.sdata} section. Put small uninitialized global
25248 data in the @code{.sbss} section. Do not use register @code{r13}
25249 to address small data however. This is the default behavior unless
25250 other @option{-msdata} options are used.
25251
25252 @item -msdata=none
25253 @itemx -mno-sdata
25254 @opindex msdata=none
25255 @opindex mno-sdata
25256 On embedded PowerPC systems, put all initialized global and static data
25257 in the @code{.data} section, and all uninitialized data in the
25258 @code{.bss} section.
25259
25260 @item -mreadonly-in-sdata
25261 @opindex mreadonly-in-sdata
25262 @opindex mno-readonly-in-sdata
25263 Put read-only objects in the @code{.sdata} section as well. This is the
25264 default.
25265
25266 @item -mblock-move-inline-limit=@var{num}
25267 @opindex mblock-move-inline-limit
25268 Inline all block moves (such as calls to @code{memcpy} or structure
25269 copies) less than or equal to @var{num} bytes. The minimum value for
25270 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25271 targets. The default value is target-specific.
25272
25273 @item -mblock-compare-inline-limit=@var{num}
25274 @opindex mblock-compare-inline-limit
25275 Generate non-looping inline code for all block compares (such as calls
25276 to @code{memcmp} or structure compares) less than or equal to @var{num}
25277 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25278 block compare is disabled. The default value is target-specific.
25279
25280 @item -mblock-compare-inline-loop-limit=@var{num}
25281 @opindex mblock-compare-inline-loop-limit
25282 Generate an inline expansion using loop code for all block compares that
25283 are less than or equal to @var{num} bytes, but greater than the limit
25284 for non-loop inline block compare expansion. If the block length is not
25285 constant, at most @var{num} bytes will be compared before @code{memcmp}
25286 is called to compare the remainder of the block. The default value is
25287 target-specific.
25288
25289 @item -mstring-compare-inline-limit=@var{num}
25290 @opindex mstring-compare-inline-limit
25291 Compare at most @var{num} string bytes with inline code.
25292 If the difference or end of string is not found at the
25293 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25294 take care of the rest of the comparison. The default is 64 bytes.
25295
25296 @item -G @var{num}
25297 @opindex G
25298 @cindex smaller data references (PowerPC)
25299 @cindex .sdata/.sdata2 references (PowerPC)
25300 On embedded PowerPC systems, put global and static items less than or
25301 equal to @var{num} bytes into the small data or BSS sections instead of
25302 the normal data or BSS section. By default, @var{num} is 8. The
25303 @option{-G @var{num}} switch is also passed to the linker.
25304 All modules should be compiled with the same @option{-G @var{num}} value.
25305
25306 @item -mregnames
25307 @itemx -mno-regnames
25308 @opindex mregnames
25309 @opindex mno-regnames
25310 On System V.4 and embedded PowerPC systems do (do not) emit register
25311 names in the assembly language output using symbolic forms.
25312
25313 @item -mlongcall
25314 @itemx -mno-longcall
25315 @opindex mlongcall
25316 @opindex mno-longcall
25317 By default assume that all calls are far away so that a longer and more
25318 expensive calling sequence is required. This is required for calls
25319 farther than 32 megabytes (33,554,432 bytes) from the current location.
25320 A short call is generated if the compiler knows
25321 the call cannot be that far away. This setting can be overridden by
25322 the @code{shortcall} function attribute, or by @code{#pragma
25323 longcall(0)}.
25324
25325 Some linkers are capable of detecting out-of-range calls and generating
25326 glue code on the fly. On these systems, long calls are unnecessary and
25327 generate slower code. As of this writing, the AIX linker can do this,
25328 as can the GNU linker for PowerPC/64. It is planned to add this feature
25329 to the GNU linker for 32-bit PowerPC systems as well.
25330
25331 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25332 GCC can generate long calls using an inline PLT call sequence (see
25333 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25334 ELFv1 (big-endian) do not support inline PLT calls.
25335
25336 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25337 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25338 addresses represent the callee and the branch island. The
25339 Darwin/PPC linker prefers the first address and generates a @code{bl
25340 callee} if the PPC @code{bl} instruction reaches the callee directly;
25341 otherwise, the linker generates @code{bl L42} to call the branch
25342 island. The branch island is appended to the body of the
25343 calling function; it computes the full 32-bit address of the callee
25344 and jumps to it.
25345
25346 On Mach-O (Darwin) systems, this option directs the compiler emit to
25347 the glue for every direct call, and the Darwin linker decides whether
25348 to use or discard it.
25349
25350 In the future, GCC may ignore all longcall specifications
25351 when the linker is known to generate glue.
25352
25353 @item -mpltseq
25354 @itemx -mno-pltseq
25355 @opindex mpltseq
25356 @opindex mno-pltseq
25357 Implement (do not implement) -fno-plt and long calls using an inline
25358 PLT call sequence that supports lazy linking and long calls to
25359 functions in dlopen'd shared libraries. Inline PLT calls are only
25360 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25361 linkers, and are enabled by default if the support is detected when
25362 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25363 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25364 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25365 linked together.
25366
25367 @item -mtls-markers
25368 @itemx -mno-tls-markers
25369 @opindex mtls-markers
25370 @opindex mno-tls-markers
25371 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25372 specifying the function argument. The relocation allows the linker to
25373 reliably associate function call with argument setup instructions for
25374 TLS optimization, which in turn allows GCC to better schedule the
25375 sequence.
25376
25377 @item -mrecip
25378 @itemx -mno-recip
25379 @opindex mrecip
25380 This option enables use of the reciprocal estimate and
25381 reciprocal square root estimate instructions with additional
25382 Newton-Raphson steps to increase precision instead of doing a divide or
25383 square root and divide for floating-point arguments. You should use
25384 the @option{-ffast-math} option when using @option{-mrecip} (or at
25385 least @option{-funsafe-math-optimizations},
25386 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25387 @option{-fno-trapping-math}). Note that while the throughput of the
25388 sequence is generally higher than the throughput of the non-reciprocal
25389 instruction, the precision of the sequence can be decreased by up to 2
25390 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25391 roots.
25392
25393 @item -mrecip=@var{opt}
25394 @opindex mrecip=opt
25395 This option controls which reciprocal estimate instructions
25396 may be used. @var{opt} is a comma-separated list of options, which may
25397 be preceded by a @code{!} to invert the option:
25398
25399 @table @samp
25400
25401 @item all
25402 Enable all estimate instructions.
25403
25404 @item default
25405 Enable the default instructions, equivalent to @option{-mrecip}.
25406
25407 @item none
25408 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25409
25410 @item div
25411 Enable the reciprocal approximation instructions for both
25412 single and double precision.
25413
25414 @item divf
25415 Enable the single-precision reciprocal approximation instructions.
25416
25417 @item divd
25418 Enable the double-precision reciprocal approximation instructions.
25419
25420 @item rsqrt
25421 Enable the reciprocal square root approximation instructions for both
25422 single and double precision.
25423
25424 @item rsqrtf
25425 Enable the single-precision reciprocal square root approximation instructions.
25426
25427 @item rsqrtd
25428 Enable the double-precision reciprocal square root approximation instructions.
25429
25430 @end table
25431
25432 So, for example, @option{-mrecip=all,!rsqrtd} enables
25433 all of the reciprocal estimate instructions, except for the
25434 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25435 which handle the double-precision reciprocal square root calculations.
25436
25437 @item -mrecip-precision
25438 @itemx -mno-recip-precision
25439 @opindex mrecip-precision
25440 Assume (do not assume) that the reciprocal estimate instructions
25441 provide higher-precision estimates than is mandated by the PowerPC
25442 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25443 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25444 The double-precision square root estimate instructions are not generated by
25445 default on low-precision machines, since they do not provide an
25446 estimate that converges after three steps.
25447
25448 @item -mveclibabi=@var{type}
25449 @opindex mveclibabi
25450 Specifies the ABI type to use for vectorizing intrinsics using an
25451 external library. The only type supported at present is @samp{mass},
25452 which specifies to use IBM's Mathematical Acceleration Subsystem
25453 (MASS) libraries for vectorizing intrinsics using external libraries.
25454 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25455 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25456 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25457 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25458 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25459 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25460 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25461 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25462 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25463 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25464 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25465 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25466 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25467 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25468 for power7. Both @option{-ftree-vectorize} and
25469 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25470 libraries must be specified at link time.
25471
25472 @item -mfriz
25473 @itemx -mno-friz
25474 @opindex mfriz
25475 Generate (do not generate) the @code{friz} instruction when the
25476 @option{-funsafe-math-optimizations} option is used to optimize
25477 rounding of floating-point values to 64-bit integer and back to floating
25478 point. The @code{friz} instruction does not return the same value if
25479 the floating-point number is too large to fit in an integer.
25480
25481 @item -mpointers-to-nested-functions
25482 @itemx -mno-pointers-to-nested-functions
25483 @opindex mpointers-to-nested-functions
25484 Generate (do not generate) code to load up the static chain register
25485 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25486 systems where a function pointer points to a 3-word descriptor giving
25487 the function address, TOC value to be loaded in register @code{r2}, and
25488 static chain value to be loaded in register @code{r11}. The
25489 @option{-mpointers-to-nested-functions} is on by default. You cannot
25490 call through pointers to nested functions or pointers
25491 to functions compiled in other languages that use the static chain if
25492 you use @option{-mno-pointers-to-nested-functions}.
25493
25494 @item -msave-toc-indirect
25495 @itemx -mno-save-toc-indirect
25496 @opindex msave-toc-indirect
25497 Generate (do not generate) code to save the TOC value in the reserved
25498 stack location in the function prologue if the function calls through
25499 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25500 saved in the prologue, it is saved just before the call through the
25501 pointer. The @option{-mno-save-toc-indirect} option is the default.
25502
25503 @item -mcompat-align-parm
25504 @itemx -mno-compat-align-parm
25505 @opindex mcompat-align-parm
25506 Generate (do not generate) code to pass structure parameters with a
25507 maximum alignment of 64 bits, for compatibility with older versions
25508 of GCC.
25509
25510 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25511 structure parameter on a 128-bit boundary when that structure contained
25512 a member requiring 128-bit alignment. This is corrected in more
25513 recent versions of GCC. This option may be used to generate code
25514 that is compatible with functions compiled with older versions of
25515 GCC.
25516
25517 The @option{-mno-compat-align-parm} option is the default.
25518
25519 @item -mstack-protector-guard=@var{guard}
25520 @itemx -mstack-protector-guard-reg=@var{reg}
25521 @itemx -mstack-protector-guard-offset=@var{offset}
25522 @itemx -mstack-protector-guard-symbol=@var{symbol}
25523 @opindex mstack-protector-guard
25524 @opindex mstack-protector-guard-reg
25525 @opindex mstack-protector-guard-offset
25526 @opindex mstack-protector-guard-symbol
25527 Generate stack protection code using canary at @var{guard}. Supported
25528 locations are @samp{global} for global canary or @samp{tls} for per-thread
25529 canary in the TLS block (the default with GNU libc version 2.4 or later).
25530
25531 With the latter choice the options
25532 @option{-mstack-protector-guard-reg=@var{reg}} and
25533 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25534 which register to use as base register for reading the canary, and from what
25535 offset from that base register. The default for those is as specified in the
25536 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25537 the offset with a symbol reference to a canary in the TLS block.
25538
25539 @item -mpcrel
25540 @itemx -mno-pcrel
25541 @opindex mpcrel
25542 @opindex mno-pcrel
25543 Generate (do not generate) pc-relative addressing when the option
25544 @option{-mcpu=future} is used.
25545 @end table
25546
25547 @node RX Options
25548 @subsection RX Options
25549 @cindex RX Options
25550
25551 These command-line options are defined for RX targets:
25552
25553 @table @gcctabopt
25554 @item -m64bit-doubles
25555 @itemx -m32bit-doubles
25556 @opindex m64bit-doubles
25557 @opindex m32bit-doubles
25558 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25559 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25560 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25561 works on 32-bit values, which is why the default is
25562 @option{-m32bit-doubles}.
25563
25564 @item -fpu
25565 @itemx -nofpu
25566 @opindex fpu
25567 @opindex nofpu
25568 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25569 floating-point hardware. The default is enabled for the RX600
25570 series and disabled for the RX200 series.
25571
25572 Floating-point instructions are only generated for 32-bit floating-point
25573 values, however, so the FPU hardware is not used for doubles if the
25574 @option{-m64bit-doubles} option is used.
25575
25576 @emph{Note} If the @option{-fpu} option is enabled then
25577 @option{-funsafe-math-optimizations} is also enabled automatically.
25578 This is because the RX FPU instructions are themselves unsafe.
25579
25580 @item -mcpu=@var{name}
25581 @opindex mcpu
25582 Selects the type of RX CPU to be targeted. Currently three types are
25583 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25584 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25585
25586 The only difference between @samp{RX600} and @samp{RX610} is that the
25587 @samp{RX610} does not support the @code{MVTIPL} instruction.
25588
25589 The @samp{RX200} series does not have a hardware floating-point unit
25590 and so @option{-nofpu} is enabled by default when this type is
25591 selected.
25592
25593 @item -mbig-endian-data
25594 @itemx -mlittle-endian-data
25595 @opindex mbig-endian-data
25596 @opindex mlittle-endian-data
25597 Store data (but not code) in the big-endian format. The default is
25598 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25599 format.
25600
25601 @item -msmall-data-limit=@var{N}
25602 @opindex msmall-data-limit
25603 Specifies the maximum size in bytes of global and static variables
25604 which can be placed into the small data area. Using the small data
25605 area can lead to smaller and faster code, but the size of area is
25606 limited and it is up to the programmer to ensure that the area does
25607 not overflow. Also when the small data area is used one of the RX's
25608 registers (usually @code{r13}) is reserved for use pointing to this
25609 area, so it is no longer available for use by the compiler. This
25610 could result in slower and/or larger code if variables are pushed onto
25611 the stack instead of being held in this register.
25612
25613 Note, common variables (variables that have not been initialized) and
25614 constants are not placed into the small data area as they are assigned
25615 to other sections in the output executable.
25616
25617 The default value is zero, which disables this feature. Note, this
25618 feature is not enabled by default with higher optimization levels
25619 (@option{-O2} etc) because of the potentially detrimental effects of
25620 reserving a register. It is up to the programmer to experiment and
25621 discover whether this feature is of benefit to their program. See the
25622 description of the @option{-mpid} option for a description of how the
25623 actual register to hold the small data area pointer is chosen.
25624
25625 @item -msim
25626 @itemx -mno-sim
25627 @opindex msim
25628 @opindex mno-sim
25629 Use the simulator runtime. The default is to use the libgloss
25630 board-specific runtime.
25631
25632 @item -mas100-syntax
25633 @itemx -mno-as100-syntax
25634 @opindex mas100-syntax
25635 @opindex mno-as100-syntax
25636 When generating assembler output use a syntax that is compatible with
25637 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25638 assembler, but it has some restrictions so it is not generated by default.
25639
25640 @item -mmax-constant-size=@var{N}
25641 @opindex mmax-constant-size
25642 Specifies the maximum size, in bytes, of a constant that can be used as
25643 an operand in a RX instruction. Although the RX instruction set does
25644 allow constants of up to 4 bytes in length to be used in instructions,
25645 a longer value equates to a longer instruction. Thus in some
25646 circumstances it can be beneficial to restrict the size of constants
25647 that are used in instructions. Constants that are too big are instead
25648 placed into a constant pool and referenced via register indirection.
25649
25650 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25651 or 4 means that constants of any size are allowed.
25652
25653 @item -mrelax
25654 @opindex mrelax
25655 Enable linker relaxation. Linker relaxation is a process whereby the
25656 linker attempts to reduce the size of a program by finding shorter
25657 versions of various instructions. Disabled by default.
25658
25659 @item -mint-register=@var{N}
25660 @opindex mint-register
25661 Specify the number of registers to reserve for fast interrupt handler
25662 functions. The value @var{N} can be between 0 and 4. A value of 1
25663 means that register @code{r13} is reserved for the exclusive use
25664 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25665 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25666 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25667 A value of 0, the default, does not reserve any registers.
25668
25669 @item -msave-acc-in-interrupts
25670 @opindex msave-acc-in-interrupts
25671 Specifies that interrupt handler functions should preserve the
25672 accumulator register. This is only necessary if normal code might use
25673 the accumulator register, for example because it performs 64-bit
25674 multiplications. The default is to ignore the accumulator as this
25675 makes the interrupt handlers faster.
25676
25677 @item -mpid
25678 @itemx -mno-pid
25679 @opindex mpid
25680 @opindex mno-pid
25681 Enables the generation of position independent data. When enabled any
25682 access to constant data is done via an offset from a base address
25683 held in a register. This allows the location of constant data to be
25684 determined at run time without requiring the executable to be
25685 relocated, which is a benefit to embedded applications with tight
25686 memory constraints. Data that can be modified is not affected by this
25687 option.
25688
25689 Note, using this feature reserves a register, usually @code{r13}, for
25690 the constant data base address. This can result in slower and/or
25691 larger code, especially in complicated functions.
25692
25693 The actual register chosen to hold the constant data base address
25694 depends upon whether the @option{-msmall-data-limit} and/or the
25695 @option{-mint-register} command-line options are enabled. Starting
25696 with register @code{r13} and proceeding downwards, registers are
25697 allocated first to satisfy the requirements of @option{-mint-register},
25698 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25699 is possible for the small data area register to be @code{r8} if both
25700 @option{-mint-register=4} and @option{-mpid} are specified on the
25701 command line.
25702
25703 By default this feature is not enabled. The default can be restored
25704 via the @option{-mno-pid} command-line option.
25705
25706 @item -mno-warn-multiple-fast-interrupts
25707 @itemx -mwarn-multiple-fast-interrupts
25708 @opindex mno-warn-multiple-fast-interrupts
25709 @opindex mwarn-multiple-fast-interrupts
25710 Prevents GCC from issuing a warning message if it finds more than one
25711 fast interrupt handler when it is compiling a file. The default is to
25712 issue a warning for each extra fast interrupt handler found, as the RX
25713 only supports one such interrupt.
25714
25715 @item -mallow-string-insns
25716 @itemx -mno-allow-string-insns
25717 @opindex mallow-string-insns
25718 @opindex mno-allow-string-insns
25719 Enables or disables the use of the string manipulation instructions
25720 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25721 @code{SWHILE} and also the @code{RMPA} instruction. These
25722 instructions may prefetch data, which is not safe to do if accessing
25723 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25724 for more information).
25725
25726 The default is to allow these instructions, but it is not possible for
25727 GCC to reliably detect all circumstances where a string instruction
25728 might be used to access an I/O register, so their use cannot be
25729 disabled automatically. Instead it is reliant upon the programmer to
25730 use the @option{-mno-allow-string-insns} option if their program
25731 accesses I/O space.
25732
25733 When the instructions are enabled GCC defines the C preprocessor
25734 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25735 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25736
25737 @item -mjsr
25738 @itemx -mno-jsr
25739 @opindex mjsr
25740 @opindex mno-jsr
25741 Use only (or not only) @code{JSR} instructions to access functions.
25742 This option can be used when code size exceeds the range of @code{BSR}
25743 instructions. Note that @option{-mno-jsr} does not mean to not use
25744 @code{JSR} but instead means that any type of branch may be used.
25745 @end table
25746
25747 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25748 has special significance to the RX port when used with the
25749 @code{interrupt} function attribute. This attribute indicates a
25750 function intended to process fast interrupts. GCC ensures
25751 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25752 and/or @code{r13} and only provided that the normal use of the
25753 corresponding registers have been restricted via the
25754 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25755 options.
25756
25757 @node S/390 and zSeries Options
25758 @subsection S/390 and zSeries Options
25759 @cindex S/390 and zSeries Options
25760
25761 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25762
25763 @table @gcctabopt
25764 @item -mhard-float
25765 @itemx -msoft-float
25766 @opindex mhard-float
25767 @opindex msoft-float
25768 Use (do not use) the hardware floating-point instructions and registers
25769 for floating-point operations. When @option{-msoft-float} is specified,
25770 functions in @file{libgcc.a} are used to perform floating-point
25771 operations. When @option{-mhard-float} is specified, the compiler
25772 generates IEEE floating-point instructions. This is the default.
25773
25774 @item -mhard-dfp
25775 @itemx -mno-hard-dfp
25776 @opindex mhard-dfp
25777 @opindex mno-hard-dfp
25778 Use (do not use) the hardware decimal-floating-point instructions for
25779 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25780 specified, functions in @file{libgcc.a} are used to perform
25781 decimal-floating-point operations. When @option{-mhard-dfp} is
25782 specified, the compiler generates decimal-floating-point hardware
25783 instructions. This is the default for @option{-march=z9-ec} or higher.
25784
25785 @item -mlong-double-64
25786 @itemx -mlong-double-128
25787 @opindex mlong-double-64
25788 @opindex mlong-double-128
25789 These switches control the size of @code{long double} type. A size
25790 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25791 type. This is the default.
25792
25793 @item -mbackchain
25794 @itemx -mno-backchain
25795 @opindex mbackchain
25796 @opindex mno-backchain
25797 Store (do not store) the address of the caller's frame as backchain pointer
25798 into the callee's stack frame.
25799 A backchain may be needed to allow debugging using tools that do not understand
25800 DWARF call frame information.
25801 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25802 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25803 the backchain is placed into the topmost word of the 96/160 byte register
25804 save area.
25805
25806 In general, code compiled with @option{-mbackchain} is call-compatible with
25807 code compiled with @option{-mmo-backchain}; however, use of the backchain
25808 for debugging purposes usually requires that the whole binary is built with
25809 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25810 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25811 to build a linux kernel use @option{-msoft-float}.
25812
25813 The default is to not maintain the backchain.
25814
25815 @item -mpacked-stack
25816 @itemx -mno-packed-stack
25817 @opindex mpacked-stack
25818 @opindex mno-packed-stack
25819 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25820 specified, the compiler uses the all fields of the 96/160 byte register save
25821 area only for their default purpose; unused fields still take up stack space.
25822 When @option{-mpacked-stack} is specified, register save slots are densely
25823 packed at the top of the register save area; unused space is reused for other
25824 purposes, allowing for more efficient use of the available stack space.
25825 However, when @option{-mbackchain} is also in effect, the topmost word of
25826 the save area is always used to store the backchain, and the return address
25827 register is always saved two words below the backchain.
25828
25829 As long as the stack frame backchain is not used, code generated with
25830 @option{-mpacked-stack} is call-compatible with code generated with
25831 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25832 S/390 or zSeries generated code that uses the stack frame backchain at run
25833 time, not just for debugging purposes. Such code is not call-compatible
25834 with code compiled with @option{-mpacked-stack}. Also, note that the
25835 combination of @option{-mbackchain},
25836 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25837 to build a linux kernel use @option{-msoft-float}.
25838
25839 The default is to not use the packed stack layout.
25840
25841 @item -msmall-exec
25842 @itemx -mno-small-exec
25843 @opindex msmall-exec
25844 @opindex mno-small-exec
25845 Generate (or do not generate) code using the @code{bras} instruction
25846 to do subroutine calls.
25847 This only works reliably if the total executable size does not
25848 exceed 64k. The default is to use the @code{basr} instruction instead,
25849 which does not have this limitation.
25850
25851 @item -m64
25852 @itemx -m31
25853 @opindex m64
25854 @opindex m31
25855 When @option{-m31} is specified, generate code compliant to the
25856 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25857 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25858 particular to generate 64-bit instructions. For the @samp{s390}
25859 targets, the default is @option{-m31}, while the @samp{s390x}
25860 targets default to @option{-m64}.
25861
25862 @item -mzarch
25863 @itemx -mesa
25864 @opindex mzarch
25865 @opindex mesa
25866 When @option{-mzarch} is specified, generate code using the
25867 instructions available on z/Architecture.
25868 When @option{-mesa} is specified, generate code using the
25869 instructions available on ESA/390. Note that @option{-mesa} is
25870 not possible with @option{-m64}.
25871 When generating code compliant to the GNU/Linux for S/390 ABI,
25872 the default is @option{-mesa}. When generating code compliant
25873 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25874
25875 @item -mhtm
25876 @itemx -mno-htm
25877 @opindex mhtm
25878 @opindex mno-htm
25879 The @option{-mhtm} option enables a set of builtins making use of
25880 instructions available with the transactional execution facility
25881 introduced with the IBM zEnterprise EC12 machine generation
25882 @ref{S/390 System z Built-in Functions}.
25883 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25884
25885 @item -mvx
25886 @itemx -mno-vx
25887 @opindex mvx
25888 @opindex mno-vx
25889 When @option{-mvx} is specified, generate code using the instructions
25890 available with the vector extension facility introduced with the IBM
25891 z13 machine generation.
25892 This option changes the ABI for some vector type values with regard to
25893 alignment and calling conventions. In case vector type values are
25894 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25895 command will be added to mark the resulting binary with the ABI used.
25896 @option{-mvx} is enabled by default when using @option{-march=z13}.
25897
25898 @item -mzvector
25899 @itemx -mno-zvector
25900 @opindex mzvector
25901 @opindex mno-zvector
25902 The @option{-mzvector} option enables vector language extensions and
25903 builtins using instructions available with the vector extension
25904 facility introduced with the IBM z13 machine generation.
25905 This option adds support for @samp{vector} to be used as a keyword to
25906 define vector type variables and arguments. @samp{vector} is only
25907 available when GNU extensions are enabled. It will not be expanded
25908 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25909 In addition to the GCC low-level builtins @option{-mzvector} enables
25910 a set of builtins added for compatibility with AltiVec-style
25911 implementations like Power and Cell. In order to make use of these
25912 builtins the header file @file{vecintrin.h} needs to be included.
25913 @option{-mzvector} is disabled by default.
25914
25915 @item -mmvcle
25916 @itemx -mno-mvcle
25917 @opindex mmvcle
25918 @opindex mno-mvcle
25919 Generate (or do not generate) code using the @code{mvcle} instruction
25920 to perform block moves. When @option{-mno-mvcle} is specified,
25921 use a @code{mvc} loop instead. This is the default unless optimizing for
25922 size.
25923
25924 @item -mdebug
25925 @itemx -mno-debug
25926 @opindex mdebug
25927 @opindex mno-debug
25928 Print (or do not print) additional debug information when compiling.
25929 The default is to not print debug information.
25930
25931 @item -march=@var{cpu-type}
25932 @opindex march
25933 Generate code that runs on @var{cpu-type}, which is the name of a
25934 system representing a certain processor type. Possible values for
25935 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25936 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25937 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25938 @samp{z14}/@samp{arch12}, and @samp{native}.
25939
25940 The default is @option{-march=z900}.
25941
25942 Specifying @samp{native} as cpu type can be used to select the best
25943 architecture option for the host processor.
25944 @option{-march=native} has no effect if GCC does not recognize the
25945 processor.
25946
25947 @item -mtune=@var{cpu-type}
25948 @opindex mtune
25949 Tune to @var{cpu-type} everything applicable about the generated code,
25950 except for the ABI and the set of available instructions.
25951 The list of @var{cpu-type} values is the same as for @option{-march}.
25952 The default is the value used for @option{-march}.
25953
25954 @item -mtpf-trace
25955 @itemx -mno-tpf-trace
25956 @opindex mtpf-trace
25957 @opindex mno-tpf-trace
25958 Generate code that adds (does not add) in TPF OS specific branches to trace
25959 routines in the operating system. This option is off by default, even
25960 when compiling for the TPF OS@.
25961
25962 @item -mfused-madd
25963 @itemx -mno-fused-madd
25964 @opindex mfused-madd
25965 @opindex mno-fused-madd
25966 Generate code that uses (does not use) the floating-point multiply and
25967 accumulate instructions. These instructions are generated by default if
25968 hardware floating point is used.
25969
25970 @item -mwarn-framesize=@var{framesize}
25971 @opindex mwarn-framesize
25972 Emit a warning if the current function exceeds the given frame size. Because
25973 this is a compile-time check it doesn't need to be a real problem when the program
25974 runs. It is intended to identify functions that most probably cause
25975 a stack overflow. It is useful to be used in an environment with limited stack
25976 size e.g.@: the linux kernel.
25977
25978 @item -mwarn-dynamicstack
25979 @opindex mwarn-dynamicstack
25980 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25981 arrays. This is generally a bad idea with a limited stack size.
25982
25983 @item -mstack-guard=@var{stack-guard}
25984 @itemx -mstack-size=@var{stack-size}
25985 @opindex mstack-guard
25986 @opindex mstack-size
25987 If these options are provided the S/390 back end emits additional instructions in
25988 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25989 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25990 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25991 the frame size of the compiled function is chosen.
25992 These options are intended to be used to help debugging stack overflow problems.
25993 The additionally emitted code causes only little overhead and hence can also be
25994 used in production-like systems without greater performance degradation. The given
25995 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25996 @var{stack-guard} without exceeding 64k.
25997 In order to be efficient the extra code makes the assumption that the stack starts
25998 at an address aligned to the value given by @var{stack-size}.
25999 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
26000
26001 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
26002 @opindex mhotpatch
26003 If the hotpatch option is enabled, a ``hot-patching'' function
26004 prologue is generated for all functions in the compilation unit.
26005 The funtion label is prepended with the given number of two-byte
26006 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
26007 the label, 2 * @var{post-halfwords} bytes are appended, using the
26008 largest NOP like instructions the architecture allows (maximum
26009 1000000).
26010
26011 If both arguments are zero, hotpatching is disabled.
26012
26013 This option can be overridden for individual functions with the
26014 @code{hotpatch} attribute.
26015 @end table
26016
26017 @node Score Options
26018 @subsection Score Options
26019 @cindex Score Options
26020
26021 These options are defined for Score implementations:
26022
26023 @table @gcctabopt
26024 @item -meb
26025 @opindex meb
26026 Compile code for big-endian mode. This is the default.
26027
26028 @item -mel
26029 @opindex mel
26030 Compile code for little-endian mode.
26031
26032 @item -mnhwloop
26033 @opindex mnhwloop
26034 Disable generation of @code{bcnz} instructions.
26035
26036 @item -muls
26037 @opindex muls
26038 Enable generation of unaligned load and store instructions.
26039
26040 @item -mmac
26041 @opindex mmac
26042 Enable the use of multiply-accumulate instructions. Disabled by default.
26043
26044 @item -mscore5
26045 @opindex mscore5
26046 Specify the SCORE5 as the target architecture.
26047
26048 @item -mscore5u
26049 @opindex mscore5u
26050 Specify the SCORE5U of the target architecture.
26051
26052 @item -mscore7
26053 @opindex mscore7
26054 Specify the SCORE7 as the target architecture. This is the default.
26055
26056 @item -mscore7d
26057 @opindex mscore7d
26058 Specify the SCORE7D as the target architecture.
26059 @end table
26060
26061 @node SH Options
26062 @subsection SH Options
26063
26064 These @samp{-m} options are defined for the SH implementations:
26065
26066 @table @gcctabopt
26067 @item -m1
26068 @opindex m1
26069 Generate code for the SH1.
26070
26071 @item -m2
26072 @opindex m2
26073 Generate code for the SH2.
26074
26075 @item -m2e
26076 Generate code for the SH2e.
26077
26078 @item -m2a-nofpu
26079 @opindex m2a-nofpu
26080 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
26081 that the floating-point unit is not used.
26082
26083 @item -m2a-single-only
26084 @opindex m2a-single-only
26085 Generate code for the SH2a-FPU, in such a way that no double-precision
26086 floating-point operations are used.
26087
26088 @item -m2a-single
26089 @opindex m2a-single
26090 Generate code for the SH2a-FPU assuming the floating-point unit is in
26091 single-precision mode by default.
26092
26093 @item -m2a
26094 @opindex m2a
26095 Generate code for the SH2a-FPU assuming the floating-point unit is in
26096 double-precision mode by default.
26097
26098 @item -m3
26099 @opindex m3
26100 Generate code for the SH3.
26101
26102 @item -m3e
26103 @opindex m3e
26104 Generate code for the SH3e.
26105
26106 @item -m4-nofpu
26107 @opindex m4-nofpu
26108 Generate code for the SH4 without a floating-point unit.
26109
26110 @item -m4-single-only
26111 @opindex m4-single-only
26112 Generate code for the SH4 with a floating-point unit that only
26113 supports single-precision arithmetic.
26114
26115 @item -m4-single
26116 @opindex m4-single
26117 Generate code for the SH4 assuming the floating-point unit is in
26118 single-precision mode by default.
26119
26120 @item -m4
26121 @opindex m4
26122 Generate code for the SH4.
26123
26124 @item -m4-100
26125 @opindex m4-100
26126 Generate code for SH4-100.
26127
26128 @item -m4-100-nofpu
26129 @opindex m4-100-nofpu
26130 Generate code for SH4-100 in such a way that the
26131 floating-point unit is not used.
26132
26133 @item -m4-100-single
26134 @opindex m4-100-single
26135 Generate code for SH4-100 assuming the floating-point unit is in
26136 single-precision mode by default.
26137
26138 @item -m4-100-single-only
26139 @opindex m4-100-single-only
26140 Generate code for SH4-100 in such a way that no double-precision
26141 floating-point operations are used.
26142
26143 @item -m4-200
26144 @opindex m4-200
26145 Generate code for SH4-200.
26146
26147 @item -m4-200-nofpu
26148 @opindex m4-200-nofpu
26149 Generate code for SH4-200 without in such a way that the
26150 floating-point unit is not used.
26151
26152 @item -m4-200-single
26153 @opindex m4-200-single
26154 Generate code for SH4-200 assuming the floating-point unit is in
26155 single-precision mode by default.
26156
26157 @item -m4-200-single-only
26158 @opindex m4-200-single-only
26159 Generate code for SH4-200 in such a way that no double-precision
26160 floating-point operations are used.
26161
26162 @item -m4-300
26163 @opindex m4-300
26164 Generate code for SH4-300.
26165
26166 @item -m4-300-nofpu
26167 @opindex m4-300-nofpu
26168 Generate code for SH4-300 without in such a way that the
26169 floating-point unit is not used.
26170
26171 @item -m4-300-single
26172 @opindex m4-300-single
26173 Generate code for SH4-300 in such a way that no double-precision
26174 floating-point operations are used.
26175
26176 @item -m4-300-single-only
26177 @opindex m4-300-single-only
26178 Generate code for SH4-300 in such a way that no double-precision
26179 floating-point operations are used.
26180
26181 @item -m4-340
26182 @opindex m4-340
26183 Generate code for SH4-340 (no MMU, no FPU).
26184
26185 @item -m4-500
26186 @opindex m4-500
26187 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26188 assembler.
26189
26190 @item -m4a-nofpu
26191 @opindex m4a-nofpu
26192 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26193 floating-point unit is not used.
26194
26195 @item -m4a-single-only
26196 @opindex m4a-single-only
26197 Generate code for the SH4a, in such a way that no double-precision
26198 floating-point operations are used.
26199
26200 @item -m4a-single
26201 @opindex m4a-single
26202 Generate code for the SH4a assuming the floating-point unit is in
26203 single-precision mode by default.
26204
26205 @item -m4a
26206 @opindex m4a
26207 Generate code for the SH4a.
26208
26209 @item -m4al
26210 @opindex m4al
26211 Same as @option{-m4a-nofpu}, except that it implicitly passes
26212 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26213 instructions at the moment.
26214
26215 @item -mb
26216 @opindex mb
26217 Compile code for the processor in big-endian mode.
26218
26219 @item -ml
26220 @opindex ml
26221 Compile code for the processor in little-endian mode.
26222
26223 @item -mdalign
26224 @opindex mdalign
26225 Align doubles at 64-bit boundaries. Note that this changes the calling
26226 conventions, and thus some functions from the standard C library do
26227 not work unless you recompile it first with @option{-mdalign}.
26228
26229 @item -mrelax
26230 @opindex mrelax
26231 Shorten some address references at link time, when possible; uses the
26232 linker option @option{-relax}.
26233
26234 @item -mbigtable
26235 @opindex mbigtable
26236 Use 32-bit offsets in @code{switch} tables. The default is to use
26237 16-bit offsets.
26238
26239 @item -mbitops
26240 @opindex mbitops
26241 Enable the use of bit manipulation instructions on SH2A.
26242
26243 @item -mfmovd
26244 @opindex mfmovd
26245 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26246 alignment constraints.
26247
26248 @item -mrenesas
26249 @opindex mrenesas
26250 Comply with the calling conventions defined by Renesas.
26251
26252 @item -mno-renesas
26253 @opindex mno-renesas
26254 Comply with the calling conventions defined for GCC before the Renesas
26255 conventions were available. This option is the default for all
26256 targets of the SH toolchain.
26257
26258 @item -mnomacsave
26259 @opindex mnomacsave
26260 Mark the @code{MAC} register as call-clobbered, even if
26261 @option{-mrenesas} is given.
26262
26263 @item -mieee
26264 @itemx -mno-ieee
26265 @opindex mieee
26266 @opindex mno-ieee
26267 Control the IEEE compliance of floating-point comparisons, which affects the
26268 handling of cases where the result of a comparison is unordered. By default
26269 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26270 enabled @option{-mno-ieee} is implicitly set, which results in faster
26271 floating-point greater-equal and less-equal comparisons. The implicit settings
26272 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26273
26274 @item -minline-ic_invalidate
26275 @opindex minline-ic_invalidate
26276 Inline code to invalidate instruction cache entries after setting up
26277 nested function trampolines.
26278 This option has no effect if @option{-musermode} is in effect and the selected
26279 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26280 instruction.
26281 If the selected code generation option does not allow the use of the @code{icbi}
26282 instruction, and @option{-musermode} is not in effect, the inlined code
26283 manipulates the instruction cache address array directly with an associative
26284 write. This not only requires privileged mode at run time, but it also
26285 fails if the cache line had been mapped via the TLB and has become unmapped.
26286
26287 @item -misize
26288 @opindex misize
26289 Dump instruction size and location in the assembly code.
26290
26291 @item -mpadstruct
26292 @opindex mpadstruct
26293 This option is deprecated. It pads structures to multiple of 4 bytes,
26294 which is incompatible with the SH ABI@.
26295
26296 @item -matomic-model=@var{model}
26297 @opindex matomic-model=@var{model}
26298 Sets the model of atomic operations and additional parameters as a comma
26299 separated list. For details on the atomic built-in functions see
26300 @ref{__atomic Builtins}. The following models and parameters are supported:
26301
26302 @table @samp
26303
26304 @item none
26305 Disable compiler generated atomic sequences and emit library calls for atomic
26306 operations. This is the default if the target is not @code{sh*-*-linux*}.
26307
26308 @item soft-gusa
26309 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26310 built-in functions. The generated atomic sequences require additional support
26311 from the interrupt/exception handling code of the system and are only suitable
26312 for SH3* and SH4* single-core systems. This option is enabled by default when
26313 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26314 this option also partially utilizes the hardware atomic instructions
26315 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26316 @samp{strict} is specified.
26317
26318 @item soft-tcb
26319 Generate software atomic sequences that use a variable in the thread control
26320 block. This is a variation of the gUSA sequences which can also be used on
26321 SH1* and SH2* targets. The generated atomic sequences require additional
26322 support from the interrupt/exception handling code of the system and are only
26323 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26324 parameter has to be specified as well.
26325
26326 @item soft-imask
26327 Generate software atomic sequences that temporarily disable interrupts by
26328 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26329 in privileged mode and is only suitable for single-core systems. Additional
26330 support from the interrupt/exception handling code of the system is not
26331 required. This model is enabled by default when the target is
26332 @code{sh*-*-linux*} and SH1* or SH2*.
26333
26334 @item hard-llcs
26335 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26336 instructions only. This is only available on SH4A and is suitable for
26337 multi-core systems. Since the hardware instructions support only 32 bit atomic
26338 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26339 Code compiled with this option is also compatible with other software
26340 atomic model interrupt/exception handling systems if executed on an SH4A
26341 system. Additional support from the interrupt/exception handling code of the
26342 system is not required for this model.
26343
26344 @item gbr-offset=
26345 This parameter specifies the offset in bytes of the variable in the thread
26346 control block structure that should be used by the generated atomic sequences
26347 when the @samp{soft-tcb} model has been selected. For other models this
26348 parameter is ignored. The specified value must be an integer multiple of four
26349 and in the range 0-1020.
26350
26351 @item strict
26352 This parameter prevents mixed usage of multiple atomic models, even if they
26353 are compatible, and makes the compiler generate atomic sequences of the
26354 specified model only.
26355
26356 @end table
26357
26358 @item -mtas
26359 @opindex mtas
26360 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26361 Notice that depending on the particular hardware and software configuration
26362 this can degrade overall performance due to the operand cache line flushes
26363 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26364 processors the @code{tas.b} instruction must be used with caution since it
26365 can result in data corruption for certain cache configurations.
26366
26367 @item -mprefergot
26368 @opindex mprefergot
26369 When generating position-independent code, emit function calls using
26370 the Global Offset Table instead of the Procedure Linkage Table.
26371
26372 @item -musermode
26373 @itemx -mno-usermode
26374 @opindex musermode
26375 @opindex mno-usermode
26376 Don't allow (allow) the compiler generating privileged mode code. Specifying
26377 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26378 inlined code would not work in user mode. @option{-musermode} is the default
26379 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26380 @option{-musermode} has no effect, since there is no user mode.
26381
26382 @item -multcost=@var{number}
26383 @opindex multcost=@var{number}
26384 Set the cost to assume for a multiply insn.
26385
26386 @item -mdiv=@var{strategy}
26387 @opindex mdiv=@var{strategy}
26388 Set the division strategy to be used for integer division operations.
26389 @var{strategy} can be one of:
26390
26391 @table @samp
26392
26393 @item call-div1
26394 Calls a library function that uses the single-step division instruction
26395 @code{div1} to perform the operation. Division by zero calculates an
26396 unspecified result and does not trap. This is the default except for SH4,
26397 SH2A and SHcompact.
26398
26399 @item call-fp
26400 Calls a library function that performs the operation in double precision
26401 floating point. Division by zero causes a floating-point exception. This is
26402 the default for SHcompact with FPU. Specifying this for targets that do not
26403 have a double precision FPU defaults to @code{call-div1}.
26404
26405 @item call-table
26406 Calls a library function that uses a lookup table for small divisors and
26407 the @code{div1} instruction with case distinction for larger divisors. Division
26408 by zero calculates an unspecified result and does not trap. This is the default
26409 for SH4. Specifying this for targets that do not have dynamic shift
26410 instructions defaults to @code{call-div1}.
26411
26412 @end table
26413
26414 When a division strategy has not been specified the default strategy is
26415 selected based on the current target. For SH2A the default strategy is to
26416 use the @code{divs} and @code{divu} instructions instead of library function
26417 calls.
26418
26419 @item -maccumulate-outgoing-args
26420 @opindex maccumulate-outgoing-args
26421 Reserve space once for outgoing arguments in the function prologue rather
26422 than around each call. Generally beneficial for performance and size. Also
26423 needed for unwinding to avoid changing the stack frame around conditional code.
26424
26425 @item -mdivsi3_libfunc=@var{name}
26426 @opindex mdivsi3_libfunc=@var{name}
26427 Set the name of the library function used for 32-bit signed division to
26428 @var{name}.
26429 This only affects the name used in the @samp{call} division strategies, and
26430 the compiler still expects the same sets of input/output/clobbered registers as
26431 if this option were not present.
26432
26433 @item -mfixed-range=@var{register-range}
26434 @opindex mfixed-range
26435 Generate code treating the given register range as fixed registers.
26436 A fixed register is one that the register allocator cannot use. This is
26437 useful when compiling kernel code. A register range is specified as
26438 two registers separated by a dash. Multiple register ranges can be
26439 specified separated by a comma.
26440
26441 @item -mbranch-cost=@var{num}
26442 @opindex mbranch-cost=@var{num}
26443 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26444 make the compiler try to generate more branch-free code if possible.
26445 If not specified the value is selected depending on the processor type that
26446 is being compiled for.
26447
26448 @item -mzdcbranch
26449 @itemx -mno-zdcbranch
26450 @opindex mzdcbranch
26451 @opindex mno-zdcbranch
26452 Assume (do not assume) that zero displacement conditional branch instructions
26453 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26454 compiler prefers zero displacement branch code sequences. This is
26455 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26456 disabled by specifying @option{-mno-zdcbranch}.
26457
26458 @item -mcbranch-force-delay-slot
26459 @opindex mcbranch-force-delay-slot
26460 Force the usage of delay slots for conditional branches, which stuffs the delay
26461 slot with a @code{nop} if a suitable instruction cannot be found. By default
26462 this option is disabled. It can be enabled to work around hardware bugs as
26463 found in the original SH7055.
26464
26465 @item -mfused-madd
26466 @itemx -mno-fused-madd
26467 @opindex mfused-madd
26468 @opindex mno-fused-madd
26469 Generate code that uses (does not use) the floating-point multiply and
26470 accumulate instructions. These instructions are generated by default
26471 if hardware floating point is used. The machine-dependent
26472 @option{-mfused-madd} option is now mapped to the machine-independent
26473 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26474 mapped to @option{-ffp-contract=off}.
26475
26476 @item -mfsca
26477 @itemx -mno-fsca
26478 @opindex mfsca
26479 @opindex mno-fsca
26480 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26481 and cosine approximations. The option @option{-mfsca} must be used in
26482 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26483 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26484 approximations even if @option{-funsafe-math-optimizations} is in effect.
26485
26486 @item -mfsrra
26487 @itemx -mno-fsrra
26488 @opindex mfsrra
26489 @opindex mno-fsrra
26490 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26491 reciprocal square root approximations. The option @option{-mfsrra} must be used
26492 in combination with @option{-funsafe-math-optimizations} and
26493 @option{-ffinite-math-only}. It is enabled by default when generating code for
26494 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26495 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26496 in effect.
26497
26498 @item -mpretend-cmove
26499 @opindex mpretend-cmove
26500 Prefer zero-displacement conditional branches for conditional move instruction
26501 patterns. This can result in faster code on the SH4 processor.
26502
26503 @item -mfdpic
26504 @opindex fdpic
26505 Generate code using the FDPIC ABI.
26506
26507 @end table
26508
26509 @node Solaris 2 Options
26510 @subsection Solaris 2 Options
26511 @cindex Solaris 2 options
26512
26513 These @samp{-m} options are supported on Solaris 2:
26514
26515 @table @gcctabopt
26516 @item -mclear-hwcap
26517 @opindex mclear-hwcap
26518 @option{-mclear-hwcap} tells the compiler to remove the hardware
26519 capabilities generated by the Solaris assembler. This is only necessary
26520 when object files use ISA extensions not supported by the current
26521 machine, but check at runtime whether or not to use them.
26522
26523 @item -mimpure-text
26524 @opindex mimpure-text
26525 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26526 the compiler to not pass @option{-z text} to the linker when linking a
26527 shared object. Using this option, you can link position-dependent
26528 code into a shared object.
26529
26530 @option{-mimpure-text} suppresses the ``relocations remain against
26531 allocatable but non-writable sections'' linker error message.
26532 However, the necessary relocations trigger copy-on-write, and the
26533 shared object is not actually shared across processes. Instead of
26534 using @option{-mimpure-text}, you should compile all source code with
26535 @option{-fpic} or @option{-fPIC}.
26536
26537 @end table
26538
26539 These switches are supported in addition to the above on Solaris 2:
26540
26541 @table @gcctabopt
26542 @item -pthreads
26543 @opindex pthreads
26544 This is a synonym for @option{-pthread}.
26545 @end table
26546
26547 @node SPARC Options
26548 @subsection SPARC Options
26549 @cindex SPARC options
26550
26551 These @samp{-m} options are supported on the SPARC:
26552
26553 @table @gcctabopt
26554 @item -mno-app-regs
26555 @itemx -mapp-regs
26556 @opindex mno-app-regs
26557 @opindex mapp-regs
26558 Specify @option{-mapp-regs} to generate output using the global registers
26559 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26560 global register 1, each global register 2 through 4 is then treated as an
26561 allocable register that is clobbered by function calls. This is the default.
26562
26563 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26564 specify @option{-mno-app-regs}. You should compile libraries and system
26565 software with this option.
26566
26567 @item -mflat
26568 @itemx -mno-flat
26569 @opindex mflat
26570 @opindex mno-flat
26571 With @option{-mflat}, the compiler does not generate save/restore instructions
26572 and uses a ``flat'' or single register window model. This model is compatible
26573 with the regular register window model. The local registers and the input
26574 registers (0--5) are still treated as ``call-saved'' registers and are
26575 saved on the stack as needed.
26576
26577 With @option{-mno-flat} (the default), the compiler generates save/restore
26578 instructions (except for leaf functions). This is the normal operating mode.
26579
26580 @item -mfpu
26581 @itemx -mhard-float
26582 @opindex mfpu
26583 @opindex mhard-float
26584 Generate output containing floating-point instructions. This is the
26585 default.
26586
26587 @item -mno-fpu
26588 @itemx -msoft-float
26589 @opindex mno-fpu
26590 @opindex msoft-float
26591 Generate output containing library calls for floating point.
26592 @strong{Warning:} the requisite libraries are not available for all SPARC
26593 targets. Normally the facilities of the machine's usual C compiler are
26594 used, but this cannot be done directly in cross-compilation. You must make
26595 your own arrangements to provide suitable library functions for
26596 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26597 @samp{sparclite-*-*} do provide software floating-point support.
26598
26599 @option{-msoft-float} changes the calling convention in the output file;
26600 therefore, it is only useful if you compile @emph{all} of a program with
26601 this option. In particular, you need to compile @file{libgcc.a}, the
26602 library that comes with GCC, with @option{-msoft-float} in order for
26603 this to work.
26604
26605 @item -mhard-quad-float
26606 @opindex mhard-quad-float
26607 Generate output containing quad-word (long double) floating-point
26608 instructions.
26609
26610 @item -msoft-quad-float
26611 @opindex msoft-quad-float
26612 Generate output containing library calls for quad-word (long double)
26613 floating-point instructions. The functions called are those specified
26614 in the SPARC ABI@. This is the default.
26615
26616 As of this writing, there are no SPARC implementations that have hardware
26617 support for the quad-word floating-point instructions. They all invoke
26618 a trap handler for one of these instructions, and then the trap handler
26619 emulates the effect of the instruction. Because of the trap handler overhead,
26620 this is much slower than calling the ABI library routines. Thus the
26621 @option{-msoft-quad-float} option is the default.
26622
26623 @item -mno-unaligned-doubles
26624 @itemx -munaligned-doubles
26625 @opindex mno-unaligned-doubles
26626 @opindex munaligned-doubles
26627 Assume that doubles have 8-byte alignment. This is the default.
26628
26629 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26630 alignment only if they are contained in another type, or if they have an
26631 absolute address. Otherwise, it assumes they have 4-byte alignment.
26632 Specifying this option avoids some rare compatibility problems with code
26633 generated by other compilers. It is not the default because it results
26634 in a performance loss, especially for floating-point code.
26635
26636 @item -muser-mode
26637 @itemx -mno-user-mode
26638 @opindex muser-mode
26639 @opindex mno-user-mode
26640 Do not generate code that can only run in supervisor mode. This is relevant
26641 only for the @code{casa} instruction emitted for the LEON3 processor. This
26642 is the default.
26643
26644 @item -mfaster-structs
26645 @itemx -mno-faster-structs
26646 @opindex mfaster-structs
26647 @opindex mno-faster-structs
26648 With @option{-mfaster-structs}, the compiler assumes that structures
26649 should have 8-byte alignment. This enables the use of pairs of
26650 @code{ldd} and @code{std} instructions for copies in structure
26651 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26652 However, the use of this changed alignment directly violates the SPARC
26653 ABI@. Thus, it's intended only for use on targets where the developer
26654 acknowledges that their resulting code is not directly in line with
26655 the rules of the ABI@.
26656
26657 @item -mstd-struct-return
26658 @itemx -mno-std-struct-return
26659 @opindex mstd-struct-return
26660 @opindex mno-std-struct-return
26661 With @option{-mstd-struct-return}, the compiler generates checking code
26662 in functions returning structures or unions to detect size mismatches
26663 between the two sides of function calls, as per the 32-bit ABI@.
26664
26665 The default is @option{-mno-std-struct-return}. This option has no effect
26666 in 64-bit mode.
26667
26668 @item -mlra
26669 @itemx -mno-lra
26670 @opindex mlra
26671 @opindex mno-lra
26672 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26673 so @option{-mno-lra} needs to be passed to get old Reload.
26674
26675 @item -mcpu=@var{cpu_type}
26676 @opindex mcpu
26677 Set the instruction set, register set, and instruction scheduling parameters
26678 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26679 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26680 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26681 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26682 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26683 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26684
26685 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26686 which selects the best architecture option for the host processor.
26687 @option{-mcpu=native} has no effect if GCC does not recognize
26688 the processor.
26689
26690 Default instruction scheduling parameters are used for values that select
26691 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26692 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26693
26694 Here is a list of each supported architecture and their supported
26695 implementations.
26696
26697 @table @asis
26698 @item v7
26699 cypress, leon3v7
26700
26701 @item v8
26702 supersparc, hypersparc, leon, leon3
26703
26704 @item sparclite
26705 f930, f934, sparclite86x
26706
26707 @item sparclet
26708 tsc701
26709
26710 @item v9
26711 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26712 niagara7, m8
26713 @end table
26714
26715 By default (unless configured otherwise), GCC generates code for the V7
26716 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26717 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26718 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26719 SPARCStation 1, 2, IPX etc.
26720
26721 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26722 architecture. The only difference from V7 code is that the compiler emits
26723 the integer multiply and integer divide instructions which exist in SPARC-V8
26724 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26725 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26726 2000 series.
26727
26728 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26729 the SPARC architecture. This adds the integer multiply, integer divide step
26730 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26731 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26732 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26733 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26734 MB86934 chip, which is the more recent SPARClite with FPU@.
26735
26736 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26737 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26738 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26739 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26740 optimizes it for the TEMIC SPARClet chip.
26741
26742 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26743 architecture. This adds 64-bit integer and floating-point move instructions,
26744 3 additional floating-point condition code registers and conditional move
26745 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26746 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26747 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26748 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26749 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26750 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26751 additionally optimizes it for Sun UltraSPARC T2 chips. With
26752 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26753 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26754 additionally optimizes it for Sun UltraSPARC T4 chips. With
26755 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26756 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26757 additionally optimizes it for Oracle M8 chips.
26758
26759 @item -mtune=@var{cpu_type}
26760 @opindex mtune
26761 Set the instruction scheduling parameters for machine type
26762 @var{cpu_type}, but do not set the instruction set or register set that the
26763 option @option{-mcpu=@var{cpu_type}} does.
26764
26765 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26766 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26767 that select a particular CPU implementation. Those are
26768 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26769 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26770 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26771 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26772 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26773 and GNU/Linux toolchains, @samp{native} can also be used.
26774
26775 @item -mv8plus
26776 @itemx -mno-v8plus
26777 @opindex mv8plus
26778 @opindex mno-v8plus
26779 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26780 difference from the V8 ABI is that the global and out registers are
26781 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26782 mode for all SPARC-V9 processors.
26783
26784 @item -mvis
26785 @itemx -mno-vis
26786 @opindex mvis
26787 @opindex mno-vis
26788 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26789 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26790
26791 @item -mvis2
26792 @itemx -mno-vis2
26793 @opindex mvis2
26794 @opindex mno-vis2
26795 With @option{-mvis2}, GCC generates code that takes advantage of
26796 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26797 default is @option{-mvis2} when targeting a cpu that supports such
26798 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26799 also sets @option{-mvis}.
26800
26801 @item -mvis3
26802 @itemx -mno-vis3
26803 @opindex mvis3
26804 @opindex mno-vis3
26805 With @option{-mvis3}, GCC generates code that takes advantage of
26806 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26807 default is @option{-mvis3} when targeting a cpu that supports such
26808 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26809 also sets @option{-mvis2} and @option{-mvis}.
26810
26811 @item -mvis4
26812 @itemx -mno-vis4
26813 @opindex mvis4
26814 @opindex mno-vis4
26815 With @option{-mvis4}, GCC generates code that takes advantage of
26816 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26817 default is @option{-mvis4} when targeting a cpu that supports such
26818 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26819 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26820
26821 @item -mvis4b
26822 @itemx -mno-vis4b
26823 @opindex mvis4b
26824 @opindex mno-vis4b
26825 With @option{-mvis4b}, GCC generates code that takes advantage of
26826 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26827 the additional VIS instructions introduced in the Oracle SPARC
26828 Architecture 2017. The default is @option{-mvis4b} when targeting a
26829 cpu that supports such instructions, such as m8 and later. Setting
26830 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26831 @option{-mvis2} and @option{-mvis}.
26832
26833 @item -mcbcond
26834 @itemx -mno-cbcond
26835 @opindex mcbcond
26836 @opindex mno-cbcond
26837 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26838 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26839 when targeting a CPU that supports such instructions, such as Niagara-4 and
26840 later.
26841
26842 @item -mfmaf
26843 @itemx -mno-fmaf
26844 @opindex mfmaf
26845 @opindex mno-fmaf
26846 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26847 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26848 when targeting a CPU that supports such instructions, such as Niagara-3 and
26849 later.
26850
26851 @item -mfsmuld
26852 @itemx -mno-fsmuld
26853 @opindex mfsmuld
26854 @opindex mno-fsmuld
26855 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26856 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26857 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26858 or V9 with FPU except @option{-mcpu=leon}.
26859
26860 @item -mpopc
26861 @itemx -mno-popc
26862 @opindex mpopc
26863 @opindex mno-popc
26864 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26865 Population Count instruction. The default is @option{-mpopc}
26866 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26867 later.
26868
26869 @item -msubxc
26870 @itemx -mno-subxc
26871 @opindex msubxc
26872 @opindex mno-subxc
26873 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26874 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26875 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26876 later.
26877
26878 @item -mfix-at697f
26879 @opindex mfix-at697f
26880 Enable the documented workaround for the single erratum of the Atmel AT697F
26881 processor (which corresponds to erratum #13 of the AT697E processor).
26882
26883 @item -mfix-ut699
26884 @opindex mfix-ut699
26885 Enable the documented workarounds for the floating-point errata and the data
26886 cache nullify errata of the UT699 processor.
26887
26888 @item -mfix-ut700
26889 @opindex mfix-ut700
26890 Enable the documented workaround for the back-to-back store errata of
26891 the UT699E/UT700 processor.
26892
26893 @item -mfix-gr712rc
26894 @opindex mfix-gr712rc
26895 Enable the documented workaround for the back-to-back store errata of
26896 the GR712RC processor.
26897 @end table
26898
26899 These @samp{-m} options are supported in addition to the above
26900 on SPARC-V9 processors in 64-bit environments:
26901
26902 @table @gcctabopt
26903 @item -m32
26904 @itemx -m64
26905 @opindex m32
26906 @opindex m64
26907 Generate code for a 32-bit or 64-bit environment.
26908 The 32-bit environment sets int, long and pointer to 32 bits.
26909 The 64-bit environment sets int to 32 bits and long and pointer
26910 to 64 bits.
26911
26912 @item -mcmodel=@var{which}
26913 @opindex mcmodel
26914 Set the code model to one of
26915
26916 @table @samp
26917 @item medlow
26918 The Medium/Low code model: 64-bit addresses, programs
26919 must be linked in the low 32 bits of memory. Programs can be statically
26920 or dynamically linked.
26921
26922 @item medmid
26923 The Medium/Middle code model: 64-bit addresses, programs
26924 must be linked in the low 44 bits of memory, the text and data segments must
26925 be less than 2GB in size and the data segment must be located within 2GB of
26926 the text segment.
26927
26928 @item medany
26929 The Medium/Anywhere code model: 64-bit addresses, programs
26930 may be linked anywhere in memory, the text and data segments must be less
26931 than 2GB in size and the data segment must be located within 2GB of the
26932 text segment.
26933
26934 @item embmedany
26935 The Medium/Anywhere code model for embedded systems:
26936 64-bit addresses, the text and data segments must be less than 2GB in
26937 size, both starting anywhere in memory (determined at link time). The
26938 global register %g4 points to the base of the data segment. Programs
26939 are statically linked and PIC is not supported.
26940 @end table
26941
26942 @item -mmemory-model=@var{mem-model}
26943 @opindex mmemory-model
26944 Set the memory model in force on the processor to one of
26945
26946 @table @samp
26947 @item default
26948 The default memory model for the processor and operating system.
26949
26950 @item rmo
26951 Relaxed Memory Order
26952
26953 @item pso
26954 Partial Store Order
26955
26956 @item tso
26957 Total Store Order
26958
26959 @item sc
26960 Sequential Consistency
26961 @end table
26962
26963 These memory models are formally defined in Appendix D of the SPARC-V9
26964 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26965
26966 @item -mstack-bias
26967 @itemx -mno-stack-bias
26968 @opindex mstack-bias
26969 @opindex mno-stack-bias
26970 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26971 frame pointer if present, are offset by @minus{}2047 which must be added back
26972 when making stack frame references. This is the default in 64-bit mode.
26973 Otherwise, assume no such offset is present.
26974 @end table
26975
26976 @node System V Options
26977 @subsection Options for System V
26978
26979 These additional options are available on System V Release 4 for
26980 compatibility with other compilers on those systems:
26981
26982 @table @gcctabopt
26983 @item -G
26984 @opindex G
26985 Create a shared object.
26986 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26987
26988 @item -Qy
26989 @opindex Qy
26990 Identify the versions of each tool used by the compiler, in a
26991 @code{.ident} assembler directive in the output.
26992
26993 @item -Qn
26994 @opindex Qn
26995 Refrain from adding @code{.ident} directives to the output file (this is
26996 the default).
26997
26998 @item -YP,@var{dirs}
26999 @opindex YP
27000 Search the directories @var{dirs}, and no others, for libraries
27001 specified with @option{-l}.
27002
27003 @item -Ym,@var{dir}
27004 @opindex Ym
27005 Look in the directory @var{dir} to find the M4 preprocessor.
27006 The assembler uses this option.
27007 @c This is supposed to go with a -Yd for predefined M4 macro files, but
27008 @c the generic assembler that comes with Solaris takes just -Ym.
27009 @end table
27010
27011 @node TILE-Gx Options
27012 @subsection TILE-Gx Options
27013 @cindex TILE-Gx options
27014
27015 These @samp{-m} options are supported on the TILE-Gx:
27016
27017 @table @gcctabopt
27018 @item -mcmodel=small
27019 @opindex mcmodel=small
27020 Generate code for the small model. The distance for direct calls is
27021 limited to 500M in either direction. PC-relative addresses are 32
27022 bits. Absolute addresses support the full address range.
27023
27024 @item -mcmodel=large
27025 @opindex mcmodel=large
27026 Generate code for the large model. There is no limitation on call
27027 distance, pc-relative addresses, or absolute addresses.
27028
27029 @item -mcpu=@var{name}
27030 @opindex mcpu
27031 Selects the type of CPU to be targeted. Currently the only supported
27032 type is @samp{tilegx}.
27033
27034 @item -m32
27035 @itemx -m64
27036 @opindex m32
27037 @opindex m64
27038 Generate code for a 32-bit or 64-bit environment. The 32-bit
27039 environment sets int, long, and pointer to 32 bits. The 64-bit
27040 environment sets int to 32 bits and long and pointer to 64 bits.
27041
27042 @item -mbig-endian
27043 @itemx -mlittle-endian
27044 @opindex mbig-endian
27045 @opindex mlittle-endian
27046 Generate code in big/little endian mode, respectively.
27047 @end table
27048
27049 @node TILEPro Options
27050 @subsection TILEPro Options
27051 @cindex TILEPro options
27052
27053 These @samp{-m} options are supported on the TILEPro:
27054
27055 @table @gcctabopt
27056 @item -mcpu=@var{name}
27057 @opindex mcpu
27058 Selects the type of CPU to be targeted. Currently the only supported
27059 type is @samp{tilepro}.
27060
27061 @item -m32
27062 @opindex m32
27063 Generate code for a 32-bit environment, which sets int, long, and
27064 pointer to 32 bits. This is the only supported behavior so the flag
27065 is essentially ignored.
27066 @end table
27067
27068 @node V850 Options
27069 @subsection V850 Options
27070 @cindex V850 Options
27071
27072 These @samp{-m} options are defined for V850 implementations:
27073
27074 @table @gcctabopt
27075 @item -mlong-calls
27076 @itemx -mno-long-calls
27077 @opindex mlong-calls
27078 @opindex mno-long-calls
27079 Treat all calls as being far away (near). If calls are assumed to be
27080 far away, the compiler always loads the function's address into a
27081 register, and calls indirect through the pointer.
27082
27083 @item -mno-ep
27084 @itemx -mep
27085 @opindex mno-ep
27086 @opindex mep
27087 Do not optimize (do optimize) basic blocks that use the same index
27088 pointer 4 or more times to copy pointer into the @code{ep} register, and
27089 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
27090 option is on by default if you optimize.
27091
27092 @item -mno-prolog-function
27093 @itemx -mprolog-function
27094 @opindex mno-prolog-function
27095 @opindex mprolog-function
27096 Do not use (do use) external functions to save and restore registers
27097 at the prologue and epilogue of a function. The external functions
27098 are slower, but use less code space if more than one function saves
27099 the same number of registers. The @option{-mprolog-function} option
27100 is on by default if you optimize.
27101
27102 @item -mspace
27103 @opindex mspace
27104 Try to make the code as small as possible. At present, this just turns
27105 on the @option{-mep} and @option{-mprolog-function} options.
27106
27107 @item -mtda=@var{n}
27108 @opindex mtda
27109 Put static or global variables whose size is @var{n} bytes or less into
27110 the tiny data area that register @code{ep} points to. The tiny data
27111 area can hold up to 256 bytes in total (128 bytes for byte references).
27112
27113 @item -msda=@var{n}
27114 @opindex msda
27115 Put static or global variables whose size is @var{n} bytes or less into
27116 the small data area that register @code{gp} points to. The small data
27117 area can hold up to 64 kilobytes.
27118
27119 @item -mzda=@var{n}
27120 @opindex mzda
27121 Put static or global variables whose size is @var{n} bytes or less into
27122 the first 32 kilobytes of memory.
27123
27124 @item -mv850
27125 @opindex mv850
27126 Specify that the target processor is the V850.
27127
27128 @item -mv850e3v5
27129 @opindex mv850e3v5
27130 Specify that the target processor is the V850E3V5. The preprocessor
27131 constant @code{__v850e3v5__} is defined if this option is used.
27132
27133 @item -mv850e2v4
27134 @opindex mv850e2v4
27135 Specify that the target processor is the V850E3V5. This is an alias for
27136 the @option{-mv850e3v5} option.
27137
27138 @item -mv850e2v3
27139 @opindex mv850e2v3
27140 Specify that the target processor is the V850E2V3. The preprocessor
27141 constant @code{__v850e2v3__} is defined if this option is used.
27142
27143 @item -mv850e2
27144 @opindex mv850e2
27145 Specify that the target processor is the V850E2. The preprocessor
27146 constant @code{__v850e2__} is defined if this option is used.
27147
27148 @item -mv850e1
27149 @opindex mv850e1
27150 Specify that the target processor is the V850E1. The preprocessor
27151 constants @code{__v850e1__} and @code{__v850e__} are defined if
27152 this option is used.
27153
27154 @item -mv850es
27155 @opindex mv850es
27156 Specify that the target processor is the V850ES. This is an alias for
27157 the @option{-mv850e1} option.
27158
27159 @item -mv850e
27160 @opindex mv850e
27161 Specify that the target processor is the V850E@. The preprocessor
27162 constant @code{__v850e__} is defined if this option is used.
27163
27164 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27165 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27166 are defined then a default target processor is chosen and the
27167 relevant @samp{__v850*__} preprocessor constant is defined.
27168
27169 The preprocessor constants @code{__v850} and @code{__v851__} are always
27170 defined, regardless of which processor variant is the target.
27171
27172 @item -mdisable-callt
27173 @itemx -mno-disable-callt
27174 @opindex mdisable-callt
27175 @opindex mno-disable-callt
27176 This option suppresses generation of the @code{CALLT} instruction for the
27177 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27178 architecture.
27179
27180 This option is enabled by default when the RH850 ABI is
27181 in use (see @option{-mrh850-abi}), and disabled by default when the
27182 GCC ABI is in use. If @code{CALLT} instructions are being generated
27183 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27184
27185 @item -mrelax
27186 @itemx -mno-relax
27187 @opindex mrelax
27188 @opindex mno-relax
27189 Pass on (or do not pass on) the @option{-mrelax} command-line option
27190 to the assembler.
27191
27192 @item -mlong-jumps
27193 @itemx -mno-long-jumps
27194 @opindex mlong-jumps
27195 @opindex mno-long-jumps
27196 Disable (or re-enable) the generation of PC-relative jump instructions.
27197
27198 @item -msoft-float
27199 @itemx -mhard-float
27200 @opindex msoft-float
27201 @opindex mhard-float
27202 Disable (or re-enable) the generation of hardware floating point
27203 instructions. This option is only significant when the target
27204 architecture is @samp{V850E2V3} or higher. If hardware floating point
27205 instructions are being generated then the C preprocessor symbol
27206 @code{__FPU_OK__} is defined, otherwise the symbol
27207 @code{__NO_FPU__} is defined.
27208
27209 @item -mloop
27210 @opindex mloop
27211 Enables the use of the e3v5 LOOP instruction. The use of this
27212 instruction is not enabled by default when the e3v5 architecture is
27213 selected because its use is still experimental.
27214
27215 @item -mrh850-abi
27216 @itemx -mghs
27217 @opindex mrh850-abi
27218 @opindex mghs
27219 Enables support for the RH850 version of the V850 ABI. This is the
27220 default. With this version of the ABI the following rules apply:
27221
27222 @itemize
27223 @item
27224 Integer sized structures and unions are returned via a memory pointer
27225 rather than a register.
27226
27227 @item
27228 Large structures and unions (more than 8 bytes in size) are passed by
27229 value.
27230
27231 @item
27232 Functions are aligned to 16-bit boundaries.
27233
27234 @item
27235 The @option{-m8byte-align} command-line option is supported.
27236
27237 @item
27238 The @option{-mdisable-callt} command-line option is enabled by
27239 default. The @option{-mno-disable-callt} command-line option is not
27240 supported.
27241 @end itemize
27242
27243 When this version of the ABI is enabled the C preprocessor symbol
27244 @code{__V850_RH850_ABI__} is defined.
27245
27246 @item -mgcc-abi
27247 @opindex mgcc-abi
27248 Enables support for the old GCC version of the V850 ABI. With this
27249 version of the ABI the following rules apply:
27250
27251 @itemize
27252 @item
27253 Integer sized structures and unions are returned in register @code{r10}.
27254
27255 @item
27256 Large structures and unions (more than 8 bytes in size) are passed by
27257 reference.
27258
27259 @item
27260 Functions are aligned to 32-bit boundaries, unless optimizing for
27261 size.
27262
27263 @item
27264 The @option{-m8byte-align} command-line option is not supported.
27265
27266 @item
27267 The @option{-mdisable-callt} command-line option is supported but not
27268 enabled by default.
27269 @end itemize
27270
27271 When this version of the ABI is enabled the C preprocessor symbol
27272 @code{__V850_GCC_ABI__} is defined.
27273
27274 @item -m8byte-align
27275 @itemx -mno-8byte-align
27276 @opindex m8byte-align
27277 @opindex mno-8byte-align
27278 Enables support for @code{double} and @code{long long} types to be
27279 aligned on 8-byte boundaries. The default is to restrict the
27280 alignment of all objects to at most 4-bytes. When
27281 @option{-m8byte-align} is in effect the C preprocessor symbol
27282 @code{__V850_8BYTE_ALIGN__} is defined.
27283
27284 @item -mbig-switch
27285 @opindex mbig-switch
27286 Generate code suitable for big switch tables. Use this option only if
27287 the assembler/linker complain about out of range branches within a switch
27288 table.
27289
27290 @item -mapp-regs
27291 @opindex mapp-regs
27292 This option causes r2 and r5 to be used in the code generated by
27293 the compiler. This setting is the default.
27294
27295 @item -mno-app-regs
27296 @opindex mno-app-regs
27297 This option causes r2 and r5 to be treated as fixed registers.
27298
27299 @end table
27300
27301 @node VAX Options
27302 @subsection VAX Options
27303 @cindex VAX options
27304
27305 These @samp{-m} options are defined for the VAX:
27306
27307 @table @gcctabopt
27308 @item -munix
27309 @opindex munix
27310 Do not output certain jump instructions (@code{aobleq} and so on)
27311 that the Unix assembler for the VAX cannot handle across long
27312 ranges.
27313
27314 @item -mgnu
27315 @opindex mgnu
27316 Do output those jump instructions, on the assumption that the
27317 GNU assembler is being used.
27318
27319 @item -mg
27320 @opindex mg
27321 Output code for G-format floating-point numbers instead of D-format.
27322 @end table
27323
27324 @node Visium Options
27325 @subsection Visium Options
27326 @cindex Visium options
27327
27328 @table @gcctabopt
27329
27330 @item -mdebug
27331 @opindex mdebug
27332 A program which performs file I/O and is destined to run on an MCM target
27333 should be linked with this option. It causes the libraries libc.a and
27334 libdebug.a to be linked. The program should be run on the target under
27335 the control of the GDB remote debugging stub.
27336
27337 @item -msim
27338 @opindex msim
27339 A program which performs file I/O and is destined to run on the simulator
27340 should be linked with option. This causes libraries libc.a and libsim.a to
27341 be linked.
27342
27343 @item -mfpu
27344 @itemx -mhard-float
27345 @opindex mfpu
27346 @opindex mhard-float
27347 Generate code containing floating-point instructions. This is the
27348 default.
27349
27350 @item -mno-fpu
27351 @itemx -msoft-float
27352 @opindex mno-fpu
27353 @opindex msoft-float
27354 Generate code containing library calls for floating-point.
27355
27356 @option{-msoft-float} changes the calling convention in the output file;
27357 therefore, it is only useful if you compile @emph{all} of a program with
27358 this option. In particular, you need to compile @file{libgcc.a}, the
27359 library that comes with GCC, with @option{-msoft-float} in order for
27360 this to work.
27361
27362 @item -mcpu=@var{cpu_type}
27363 @opindex mcpu
27364 Set the instruction set, register set, and instruction scheduling parameters
27365 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27366 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27367
27368 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27369
27370 By default (unless configured otherwise), GCC generates code for the GR5
27371 variant of the Visium architecture.
27372
27373 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27374 architecture. The only difference from GR5 code is that the compiler will
27375 generate block move instructions.
27376
27377 @item -mtune=@var{cpu_type}
27378 @opindex mtune
27379 Set the instruction scheduling parameters for machine type @var{cpu_type},
27380 but do not set the instruction set or register set that the option
27381 @option{-mcpu=@var{cpu_type}} would.
27382
27383 @item -msv-mode
27384 @opindex msv-mode
27385 Generate code for the supervisor mode, where there are no restrictions on
27386 the access to general registers. This is the default.
27387
27388 @item -muser-mode
27389 @opindex muser-mode
27390 Generate code for the user mode, where the access to some general registers
27391 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27392 mode; on the GR6, only registers r29 to r31 are affected.
27393 @end table
27394
27395 @node VMS Options
27396 @subsection VMS Options
27397
27398 These @samp{-m} options are defined for the VMS implementations:
27399
27400 @table @gcctabopt
27401 @item -mvms-return-codes
27402 @opindex mvms-return-codes
27403 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27404 condition (e.g.@: error) codes.
27405
27406 @item -mdebug-main=@var{prefix}
27407 @opindex mdebug-main=@var{prefix}
27408 Flag the first routine whose name starts with @var{prefix} as the main
27409 routine for the debugger.
27410
27411 @item -mmalloc64
27412 @opindex mmalloc64
27413 Default to 64-bit memory allocation routines.
27414
27415 @item -mpointer-size=@var{size}
27416 @opindex mpointer-size=@var{size}
27417 Set the default size of pointers. Possible options for @var{size} are
27418 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27419 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27420 The later option disables @code{pragma pointer_size}.
27421 @end table
27422
27423 @node VxWorks Options
27424 @subsection VxWorks Options
27425 @cindex VxWorks Options
27426
27427 The options in this section are defined for all VxWorks targets.
27428 Options specific to the target hardware are listed with the other
27429 options for that target.
27430
27431 @table @gcctabopt
27432 @item -mrtp
27433 @opindex mrtp
27434 GCC can generate code for both VxWorks kernels and real time processes
27435 (RTPs). This option switches from the former to the latter. It also
27436 defines the preprocessor macro @code{__RTP__}.
27437
27438 @item -non-static
27439 @opindex non-static
27440 Link an RTP executable against shared libraries rather than static
27441 libraries. The options @option{-static} and @option{-shared} can
27442 also be used for RTPs (@pxref{Link Options}); @option{-static}
27443 is the default.
27444
27445 @item -Bstatic
27446 @itemx -Bdynamic
27447 @opindex Bstatic
27448 @opindex Bdynamic
27449 These options are passed down to the linker. They are defined for
27450 compatibility with Diab.
27451
27452 @item -Xbind-lazy
27453 @opindex Xbind-lazy
27454 Enable lazy binding of function calls. This option is equivalent to
27455 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27456
27457 @item -Xbind-now
27458 @opindex Xbind-now
27459 Disable lazy binding of function calls. This option is the default and
27460 is defined for compatibility with Diab.
27461 @end table
27462
27463 @node x86 Options
27464 @subsection x86 Options
27465 @cindex x86 Options
27466
27467 These @samp{-m} options are defined for the x86 family of computers.
27468
27469 @table @gcctabopt
27470
27471 @item -march=@var{cpu-type}
27472 @opindex march
27473 Generate instructions for the machine type @var{cpu-type}. In contrast to
27474 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27475 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27476 to generate code that may not run at all on processors other than the one
27477 indicated. Specifying @option{-march=@var{cpu-type}} implies
27478 @option{-mtune=@var{cpu-type}}.
27479
27480 The choices for @var{cpu-type} are:
27481
27482 @table @samp
27483 @item native
27484 This selects the CPU to generate code for at compilation time by determining
27485 the processor type of the compiling machine. Using @option{-march=native}
27486 enables all instruction subsets supported by the local machine (hence
27487 the result might not run on different machines). Using @option{-mtune=native}
27488 produces code optimized for the local machine under the constraints
27489 of the selected instruction set.
27490
27491 @item x86-64
27492 A generic CPU with 64-bit extensions.
27493
27494 @item i386
27495 Original Intel i386 CPU@.
27496
27497 @item i486
27498 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27499
27500 @item i586
27501 @itemx pentium
27502 Intel Pentium CPU with no MMX support.
27503
27504 @item lakemont
27505 Intel Lakemont MCU, based on Intel Pentium CPU.
27506
27507 @item pentium-mmx
27508 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27509
27510 @item pentiumpro
27511 Intel Pentium Pro CPU@.
27512
27513 @item i686
27514 When used with @option{-march}, the Pentium Pro
27515 instruction set is used, so the code runs on all i686 family chips.
27516 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27517
27518 @item pentium2
27519 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27520 support.
27521
27522 @item pentium3
27523 @itemx pentium3m
27524 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27525 set support.
27526
27527 @item pentium-m
27528 Intel Pentium M; low-power version of Intel Pentium III CPU
27529 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27530
27531 @item pentium4
27532 @itemx pentium4m
27533 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27534
27535 @item prescott
27536 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27537 set support.
27538
27539 @item nocona
27540 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27541 SSE2 and SSE3 instruction set support.
27542
27543 @item core2
27544 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27545 instruction set support.
27546
27547 @item nehalem
27548 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27549 SSE4.1, SSE4.2 and POPCNT instruction set support.
27550
27551 @item westmere
27552 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27553 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27554
27555 @item sandybridge
27556 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27557 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27558
27559 @item ivybridge
27560 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27561 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27562 instruction set support.
27563
27564 @item haswell
27565 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27566 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27567 BMI, BMI2 and F16C instruction set support.
27568
27569 @item broadwell
27570 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27571 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27572 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27573
27574 @item skylake
27575 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27576 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27577 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27578 XSAVES instruction set support.
27579
27580 @item bonnell
27581 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27582 instruction set support.
27583
27584 @item silvermont
27585 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27586 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27587
27588 @item goldmont
27589 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27590 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27591 instruction set support.
27592
27593 @item goldmont-plus
27594 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27595 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27596 PTWRITE, RDPID, SGX and UMIP instruction set support.
27597
27598 @item tremont
27599 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27600 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27601 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27602
27603 @item knl
27604 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27605 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27606 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27607 AVX512CD instruction set support.
27608
27609 @item knm
27610 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27611 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27612 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27613 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27614
27615 @item skylake-avx512
27616 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27617 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27618 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27619 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27620
27621 @item cannonlake
27622 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27623 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27624 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27625 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27626 AVX512IFMA, SHA and UMIP instruction set support.
27627
27628 @item icelake-client
27629 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27630 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27631 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27632 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27633 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27634 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27635
27636 @item icelake-server
27637 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27638 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27639 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27640 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27641 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27642 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27643 set support.
27644
27645 @item cascadelake
27646 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27647 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27648 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27649 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27650
27651 @item cooperlake
27652 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27653 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27654 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27655 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27656 set support.
27657
27658 @item tigerlake
27659 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27660 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27661 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27662 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27663 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27664 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27665 set support.
27666
27667 @item k6
27668 AMD K6 CPU with MMX instruction set support.
27669
27670 @item k6-2
27671 @itemx k6-3
27672 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27673
27674 @item athlon
27675 @itemx athlon-tbird
27676 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27677 support.
27678
27679 @item athlon-4
27680 @itemx athlon-xp
27681 @itemx athlon-mp
27682 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27683 instruction set support.
27684
27685 @item k8
27686 @itemx opteron
27687 @itemx athlon64
27688 @itemx athlon-fx
27689 Processors based on the AMD K8 core with x86-64 instruction set support,
27690 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27691 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27692 instruction set extensions.)
27693
27694 @item k8-sse3
27695 @itemx opteron-sse3
27696 @itemx athlon64-sse3
27697 Improved versions of AMD K8 cores with SSE3 instruction set support.
27698
27699 @item amdfam10
27700 @itemx barcelona
27701 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27702 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27703 instruction set extensions.)
27704
27705 @item bdver1
27706 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27707 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27708 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27709 @item bdver2
27710 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27711 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27712 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27713 extensions.)
27714 @item bdver3
27715 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27716 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27717 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27718 64-bit instruction set extensions.
27719 @item bdver4
27720 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27721 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27722 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27723 SSE4.2, ABM and 64-bit instruction set extensions.
27724
27725 @item znver1
27726 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27727 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27728 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27729 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27730 instruction set extensions.
27731 @item znver2
27732 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27733 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27734 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27735 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27736 instruction set extensions.)
27737
27738
27739 @item btver1
27740 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27741 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27742 instruction set extensions.)
27743
27744 @item btver2
27745 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27746 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27747 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27748
27749 @item winchip-c6
27750 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27751 set support.
27752
27753 @item winchip2
27754 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27755 instruction set support.
27756
27757 @item c3
27758 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27759 (No scheduling is implemented for this chip.)
27760
27761 @item c3-2
27762 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27763 (No scheduling is implemented for this chip.)
27764
27765 @item c7
27766 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27767 (No scheduling is implemented for this chip.)
27768
27769 @item samuel-2
27770 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27771 (No scheduling is implemented for this chip.)
27772
27773 @item nehemiah
27774 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27775 (No scheduling is implemented for this chip.)
27776
27777 @item esther
27778 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27779 (No scheduling is implemented for this chip.)
27780
27781 @item eden-x2
27782 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27783 (No scheduling is implemented for this chip.)
27784
27785 @item eden-x4
27786 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27787 AVX and AVX2 instruction set support.
27788 (No scheduling is implemented for this chip.)
27789
27790 @item nano
27791 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27792 instruction set support.
27793 (No scheduling is implemented for this chip.)
27794
27795 @item nano-1000
27796 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27797 instruction set support.
27798 (No scheduling is implemented for this chip.)
27799
27800 @item nano-2000
27801 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27802 instruction set support.
27803 (No scheduling is implemented for this chip.)
27804
27805 @item nano-3000
27806 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27807 instruction set support.
27808 (No scheduling is implemented for this chip.)
27809
27810 @item nano-x2
27811 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27812 instruction set support.
27813 (No scheduling is implemented for this chip.)
27814
27815 @item nano-x4
27816 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27817 instruction set support.
27818 (No scheduling is implemented for this chip.)
27819
27820 @item geode
27821 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27822 @end table
27823
27824 @item -mtune=@var{cpu-type}
27825 @opindex mtune
27826 Tune to @var{cpu-type} everything applicable about the generated code, except
27827 for the ABI and the set of available instructions.
27828 While picking a specific @var{cpu-type} schedules things appropriately
27829 for that particular chip, the compiler does not generate any code that
27830 cannot run on the default machine type unless you use a
27831 @option{-march=@var{cpu-type}} option.
27832 For example, if GCC is configured for i686-pc-linux-gnu
27833 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27834 but still runs on i686 machines.
27835
27836 The choices for @var{cpu-type} are the same as for @option{-march}.
27837 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27838
27839 @table @samp
27840 @item generic
27841 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27842 If you know the CPU on which your code will run, then you should use
27843 the corresponding @option{-mtune} or @option{-march} option instead of
27844 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27845 of your application will have, then you should use this option.
27846
27847 As new processors are deployed in the marketplace, the behavior of this
27848 option will change. Therefore, if you upgrade to a newer version of
27849 GCC, code generation controlled by this option will change to reflect
27850 the processors
27851 that are most common at the time that version of GCC is released.
27852
27853 There is no @option{-march=generic} option because @option{-march}
27854 indicates the instruction set the compiler can use, and there is no
27855 generic instruction set applicable to all processors. In contrast,
27856 @option{-mtune} indicates the processor (or, in this case, collection of
27857 processors) for which the code is optimized.
27858
27859 @item intel
27860 Produce code optimized for the most current Intel processors, which are
27861 Haswell and Silvermont for this version of GCC. If you know the CPU
27862 on which your code will run, then you should use the corresponding
27863 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27864 But, if you want your application performs better on both Haswell and
27865 Silvermont, then you should use this option.
27866
27867 As new Intel processors are deployed in the marketplace, the behavior of
27868 this option will change. Therefore, if you upgrade to a newer version of
27869 GCC, code generation controlled by this option will change to reflect
27870 the most current Intel processors at the time that version of GCC is
27871 released.
27872
27873 There is no @option{-march=intel} option because @option{-march} indicates
27874 the instruction set the compiler can use, and there is no common
27875 instruction set applicable to all processors. In contrast,
27876 @option{-mtune} indicates the processor (or, in this case, collection of
27877 processors) for which the code is optimized.
27878 @end table
27879
27880 @item -mcpu=@var{cpu-type}
27881 @opindex mcpu
27882 A deprecated synonym for @option{-mtune}.
27883
27884 @item -mfpmath=@var{unit}
27885 @opindex mfpmath
27886 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27887 for @var{unit} are:
27888
27889 @table @samp
27890 @item 387
27891 Use the standard 387 floating-point coprocessor present on the majority of chips and
27892 emulated otherwise. Code compiled with this option runs almost everywhere.
27893 The temporary results are computed in 80-bit precision instead of the precision
27894 specified by the type, resulting in slightly different results compared to most
27895 of other chips. See @option{-ffloat-store} for more detailed description.
27896
27897 This is the default choice for non-Darwin x86-32 targets.
27898
27899 @item sse
27900 Use scalar floating-point instructions present in the SSE instruction set.
27901 This instruction set is supported by Pentium III and newer chips,
27902 and in the AMD line
27903 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27904 instruction set supports only single-precision arithmetic, thus the double and
27905 extended-precision arithmetic are still done using 387. A later version, present
27906 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27907 arithmetic too.
27908
27909 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27910 or @option{-msse2} switches to enable SSE extensions and make this option
27911 effective. For the x86-64 compiler, these extensions are enabled by default.
27912
27913 The resulting code should be considerably faster in the majority of cases and avoid
27914 the numerical instability problems of 387 code, but may break some existing
27915 code that expects temporaries to be 80 bits.
27916
27917 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27918 and the default choice for x86-32 targets with the SSE2 instruction set
27919 when @option{-ffast-math} is enabled.
27920
27921 @item sse,387
27922 @itemx sse+387
27923 @itemx both
27924 Attempt to utilize both instruction sets at once. This effectively doubles the
27925 amount of available registers, and on chips with separate execution units for
27926 387 and SSE the execution resources too. Use this option with care, as it is
27927 still experimental, because the GCC register allocator does not model separate
27928 functional units well, resulting in unstable performance.
27929 @end table
27930
27931 @item -masm=@var{dialect}
27932 @opindex masm=@var{dialect}
27933 Output assembly instructions using selected @var{dialect}. Also affects
27934 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27935 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27936 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27937 not support @samp{intel}.
27938
27939 @item -mieee-fp
27940 @itemx -mno-ieee-fp
27941 @opindex mieee-fp
27942 @opindex mno-ieee-fp
27943 Control whether or not the compiler uses IEEE floating-point
27944 comparisons. These correctly handle the case where the result of a
27945 comparison is unordered.
27946
27947 @item -m80387
27948 @itemx -mhard-float
27949 @opindex 80387
27950 @opindex mhard-float
27951 Generate output containing 80387 instructions for floating point.
27952
27953 @item -mno-80387
27954 @itemx -msoft-float
27955 @opindex no-80387
27956 @opindex msoft-float
27957 Generate output containing library calls for floating point.
27958
27959 @strong{Warning:} the requisite libraries are not part of GCC@.
27960 Normally the facilities of the machine's usual C compiler are used, but
27961 this cannot be done directly in cross-compilation. You must make your
27962 own arrangements to provide suitable library functions for
27963 cross-compilation.
27964
27965 On machines where a function returns floating-point results in the 80387
27966 register stack, some floating-point opcodes may be emitted even if
27967 @option{-msoft-float} is used.
27968
27969 @item -mno-fp-ret-in-387
27970 @opindex mno-fp-ret-in-387
27971 @opindex mfp-ret-in-387
27972 Do not use the FPU registers for return values of functions.
27973
27974 The usual calling convention has functions return values of types
27975 @code{float} and @code{double} in an FPU register, even if there
27976 is no FPU@. The idea is that the operating system should emulate
27977 an FPU@.
27978
27979 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27980 in ordinary CPU registers instead.
27981
27982 @item -mno-fancy-math-387
27983 @opindex mno-fancy-math-387
27984 @opindex mfancy-math-387
27985 Some 387 emulators do not support the @code{sin}, @code{cos} and
27986 @code{sqrt} instructions for the 387. Specify this option to avoid
27987 generating those instructions.
27988 This option is overridden when @option{-march}
27989 indicates that the target CPU always has an FPU and so the
27990 instruction does not need emulation. These
27991 instructions are not generated unless you also use the
27992 @option{-funsafe-math-optimizations} switch.
27993
27994 @item -malign-double
27995 @itemx -mno-align-double
27996 @opindex malign-double
27997 @opindex mno-align-double
27998 Control whether GCC aligns @code{double}, @code{long double}, and
27999 @code{long long} variables on a two-word boundary or a one-word
28000 boundary. Aligning @code{double} variables on a two-word boundary
28001 produces code that runs somewhat faster on a Pentium at the
28002 expense of more memory.
28003
28004 On x86-64, @option{-malign-double} is enabled by default.
28005
28006 @strong{Warning:} if you use the @option{-malign-double} switch,
28007 structures containing the above types are aligned differently than
28008 the published application binary interface specifications for the x86-32
28009 and are not binary compatible with structures in code compiled
28010 without that switch.
28011
28012 @item -m96bit-long-double
28013 @itemx -m128bit-long-double
28014 @opindex m96bit-long-double
28015 @opindex m128bit-long-double
28016 These switches control the size of @code{long double} type. The x86-32
28017 application binary interface specifies the size to be 96 bits,
28018 so @option{-m96bit-long-double} is the default in 32-bit mode.
28019
28020 Modern architectures (Pentium and newer) prefer @code{long double}
28021 to be aligned to an 8- or 16-byte boundary. In arrays or structures
28022 conforming to the ABI, this is not possible. So specifying
28023 @option{-m128bit-long-double} aligns @code{long double}
28024 to a 16-byte boundary by padding the @code{long double} with an additional
28025 32-bit zero.
28026
28027 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
28028 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
28029
28030 Notice that neither of these options enable any extra precision over the x87
28031 standard of 80 bits for a @code{long double}.
28032
28033 @strong{Warning:} if you override the default value for your target ABI, this
28034 changes the size of
28035 structures and arrays containing @code{long double} variables,
28036 as well as modifying the function calling convention for functions taking
28037 @code{long double}. Hence they are not binary-compatible
28038 with code compiled without that switch.
28039
28040 @item -mlong-double-64
28041 @itemx -mlong-double-80
28042 @itemx -mlong-double-128
28043 @opindex mlong-double-64
28044 @opindex mlong-double-80
28045 @opindex mlong-double-128
28046 These switches control the size of @code{long double} type. A size
28047 of 64 bits makes the @code{long double} type equivalent to the @code{double}
28048 type. This is the default for 32-bit Bionic C library. A size
28049 of 128 bits makes the @code{long double} type equivalent to the
28050 @code{__float128} type. This is the default for 64-bit Bionic C library.
28051
28052 @strong{Warning:} if you override the default value for your target ABI, this
28053 changes the size of
28054 structures and arrays containing @code{long double} variables,
28055 as well as modifying the function calling convention for functions taking
28056 @code{long double}. Hence they are not binary-compatible
28057 with code compiled without that switch.
28058
28059 @item -malign-data=@var{type}
28060 @opindex malign-data
28061 Control how GCC aligns variables. Supported values for @var{type} are
28062 @samp{compat} uses increased alignment value compatible uses GCC 4.8
28063 and earlier, @samp{abi} uses alignment value as specified by the
28064 psABI, and @samp{cacheline} uses increased alignment value to match
28065 the cache line size. @samp{compat} is the default.
28066
28067 @item -mlarge-data-threshold=@var{threshold}
28068 @opindex mlarge-data-threshold
28069 When @option{-mcmodel=medium} is specified, data objects larger than
28070 @var{threshold} are placed in the large data section. This value must be the
28071 same across all objects linked into the binary, and defaults to 65535.
28072
28073 @item -mrtd
28074 @opindex mrtd
28075 Use a different function-calling convention, in which functions that
28076 take a fixed number of arguments return with the @code{ret @var{num}}
28077 instruction, which pops their arguments while returning. This saves one
28078 instruction in the caller since there is no need to pop the arguments
28079 there.
28080
28081 You can specify that an individual function is called with this calling
28082 sequence with the function attribute @code{stdcall}. You can also
28083 override the @option{-mrtd} option by using the function attribute
28084 @code{cdecl}. @xref{Function Attributes}.
28085
28086 @strong{Warning:} this calling convention is incompatible with the one
28087 normally used on Unix, so you cannot use it if you need to call
28088 libraries compiled with the Unix compiler.
28089
28090 Also, you must provide function prototypes for all functions that
28091 take variable numbers of arguments (including @code{printf});
28092 otherwise incorrect code is generated for calls to those
28093 functions.
28094
28095 In addition, seriously incorrect code results if you call a
28096 function with too many arguments. (Normally, extra arguments are
28097 harmlessly ignored.)
28098
28099 @item -mregparm=@var{num}
28100 @opindex mregparm
28101 Control how many registers are used to pass integer arguments. By
28102 default, no registers are used to pass arguments, and at most 3
28103 registers can be used. You can control this behavior for a specific
28104 function by using the function attribute @code{regparm}.
28105 @xref{Function Attributes}.
28106
28107 @strong{Warning:} if you use this switch, and
28108 @var{num} is nonzero, then you must build all modules with the same
28109 value, including any libraries. This includes the system libraries and
28110 startup modules.
28111
28112 @item -msseregparm
28113 @opindex msseregparm
28114 Use SSE register passing conventions for float and double arguments
28115 and return values. You can control this behavior for a specific
28116 function by using the function attribute @code{sseregparm}.
28117 @xref{Function Attributes}.
28118
28119 @strong{Warning:} if you use this switch then you must build all
28120 modules with the same value, including any libraries. This includes
28121 the system libraries and startup modules.
28122
28123 @item -mvect8-ret-in-mem
28124 @opindex mvect8-ret-in-mem
28125 Return 8-byte vectors in memory instead of MMX registers. This is the
28126 default on VxWorks to match the ABI of the Sun Studio compilers until
28127 version 12. @emph{Only} use this option if you need to remain
28128 compatible with existing code produced by those previous compiler
28129 versions or older versions of GCC@.
28130
28131 @item -mpc32
28132 @itemx -mpc64
28133 @itemx -mpc80
28134 @opindex mpc32
28135 @opindex mpc64
28136 @opindex mpc80
28137
28138 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28139 is specified, the significands of results of floating-point operations are
28140 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28141 significands of results of floating-point operations to 53 bits (double
28142 precision) and @option{-mpc80} rounds the significands of results of
28143 floating-point operations to 64 bits (extended double precision), which is
28144 the default. When this option is used, floating-point operations in higher
28145 precisions are not available to the programmer without setting the FPU
28146 control word explicitly.
28147
28148 Setting the rounding of floating-point operations to less than the default
28149 80 bits can speed some programs by 2% or more. Note that some mathematical
28150 libraries assume that extended-precision (80-bit) floating-point operations
28151 are enabled by default; routines in such libraries could suffer significant
28152 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28153 when this option is used to set the precision to less than extended precision.
28154
28155 @item -mstackrealign
28156 @opindex mstackrealign
28157 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28158 option generates an alternate prologue and epilogue that realigns the
28159 run-time stack if necessary. This supports mixing legacy codes that keep
28160 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28161 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28162 applicable to individual functions.
28163
28164 @item -mpreferred-stack-boundary=@var{num}
28165 @opindex mpreferred-stack-boundary
28166 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28167 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28168 the default is 4 (16 bytes or 128 bits).
28169
28170 @strong{Warning:} When generating code for the x86-64 architecture with
28171 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28172 used to keep the stack boundary aligned to 8 byte boundary. Since
28173 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28174 intended to be used in controlled environment where stack space is
28175 important limitation. This option leads to wrong code when functions
28176 compiled with 16 byte stack alignment (such as functions from a standard
28177 library) are called with misaligned stack. In this case, SSE
28178 instructions may lead to misaligned memory access traps. In addition,
28179 variable arguments are handled incorrectly for 16 byte aligned
28180 objects (including x87 long double and __int128), leading to wrong
28181 results. You must build all modules with
28182 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28183 includes the system libraries and startup modules.
28184
28185 @item -mincoming-stack-boundary=@var{num}
28186 @opindex mincoming-stack-boundary
28187 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28188 boundary. If @option{-mincoming-stack-boundary} is not specified,
28189 the one specified by @option{-mpreferred-stack-boundary} is used.
28190
28191 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28192 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28193 suffer significant run time performance penalties. On Pentium III, the
28194 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28195 properly if it is not 16-byte aligned.
28196
28197 To ensure proper alignment of this values on the stack, the stack boundary
28198 must be as aligned as that required by any value stored on the stack.
28199 Further, every function must be generated such that it keeps the stack
28200 aligned. Thus calling a function compiled with a higher preferred
28201 stack boundary from a function compiled with a lower preferred stack
28202 boundary most likely misaligns the stack. It is recommended that
28203 libraries that use callbacks always use the default setting.
28204
28205 This extra alignment does consume extra stack space, and generally
28206 increases code size. Code that is sensitive to stack space usage, such
28207 as embedded systems and operating system kernels, may want to reduce the
28208 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28209
28210 @need 200
28211 @item -mmmx
28212 @opindex mmmx
28213 @need 200
28214 @itemx -msse
28215 @opindex msse
28216 @need 200
28217 @itemx -msse2
28218 @opindex msse2
28219 @need 200
28220 @itemx -msse3
28221 @opindex msse3
28222 @need 200
28223 @itemx -mssse3
28224 @opindex mssse3
28225 @need 200
28226 @itemx -msse4
28227 @opindex msse4
28228 @need 200
28229 @itemx -msse4a
28230 @opindex msse4a
28231 @need 200
28232 @itemx -msse4.1
28233 @opindex msse4.1
28234 @need 200
28235 @itemx -msse4.2
28236 @opindex msse4.2
28237 @need 200
28238 @itemx -mavx
28239 @opindex mavx
28240 @need 200
28241 @itemx -mavx2
28242 @opindex mavx2
28243 @need 200
28244 @itemx -mavx512f
28245 @opindex mavx512f
28246 @need 200
28247 @itemx -mavx512pf
28248 @opindex mavx512pf
28249 @need 200
28250 @itemx -mavx512er
28251 @opindex mavx512er
28252 @need 200
28253 @itemx -mavx512cd
28254 @opindex mavx512cd
28255 @need 200
28256 @itemx -mavx512vl
28257 @opindex mavx512vl
28258 @need 200
28259 @itemx -mavx512bw
28260 @opindex mavx512bw
28261 @need 200
28262 @itemx -mavx512dq
28263 @opindex mavx512dq
28264 @need 200
28265 @itemx -mavx512ifma
28266 @opindex mavx512ifma
28267 @need 200
28268 @itemx -mavx512vbmi
28269 @opindex mavx512vbmi
28270 @need 200
28271 @itemx -msha
28272 @opindex msha
28273 @need 200
28274 @itemx -maes
28275 @opindex maes
28276 @need 200
28277 @itemx -mpclmul
28278 @opindex mpclmul
28279 @need 200
28280 @itemx -mclflushopt
28281 @opindex mclflushopt
28282 @need 200
28283 @itemx -mclwb
28284 @opindex mclwb
28285 @need 200
28286 @itemx -mfsgsbase
28287 @opindex mfsgsbase
28288 @need 200
28289 @itemx -mptwrite
28290 @opindex mptwrite
28291 @need 200
28292 @itemx -mrdrnd
28293 @opindex mrdrnd
28294 @need 200
28295 @itemx -mf16c
28296 @opindex mf16c
28297 @need 200
28298 @itemx -mfma
28299 @opindex mfma
28300 @need 200
28301 @itemx -mpconfig
28302 @opindex mpconfig
28303 @need 200
28304 @itemx -mwbnoinvd
28305 @opindex mwbnoinvd
28306 @need 200
28307 @itemx -mfma4
28308 @opindex mfma4
28309 @need 200
28310 @itemx -mprfchw
28311 @opindex mprfchw
28312 @need 200
28313 @itemx -mrdpid
28314 @opindex mrdpid
28315 @need 200
28316 @itemx -mprefetchwt1
28317 @opindex mprefetchwt1
28318 @need 200
28319 @itemx -mrdseed
28320 @opindex mrdseed
28321 @need 200
28322 @itemx -msgx
28323 @opindex msgx
28324 @need 200
28325 @itemx -mxop
28326 @opindex mxop
28327 @need 200
28328 @itemx -mlwp
28329 @opindex mlwp
28330 @need 200
28331 @itemx -m3dnow
28332 @opindex m3dnow
28333 @need 200
28334 @itemx -m3dnowa
28335 @opindex m3dnowa
28336 @need 200
28337 @itemx -mpopcnt
28338 @opindex mpopcnt
28339 @need 200
28340 @itemx -mabm
28341 @opindex mabm
28342 @need 200
28343 @itemx -madx
28344 @opindex madx
28345 @need 200
28346 @itemx -mbmi
28347 @opindex mbmi
28348 @need 200
28349 @itemx -mbmi2
28350 @opindex mbmi2
28351 @need 200
28352 @itemx -mlzcnt
28353 @opindex mlzcnt
28354 @need 200
28355 @itemx -mfxsr
28356 @opindex mfxsr
28357 @need 200
28358 @itemx -mxsave
28359 @opindex mxsave
28360 @need 200
28361 @itemx -mxsaveopt
28362 @opindex mxsaveopt
28363 @need 200
28364 @itemx -mxsavec
28365 @opindex mxsavec
28366 @need 200
28367 @itemx -mxsaves
28368 @opindex mxsaves
28369 @need 200
28370 @itemx -mrtm
28371 @opindex mrtm
28372 @need 200
28373 @itemx -mhle
28374 @opindex mhle
28375 @need 200
28376 @itemx -mtbm
28377 @opindex mtbm
28378 @need 200
28379 @itemx -mmwaitx
28380 @opindex mmwaitx
28381 @need 200
28382 @itemx -mclzero
28383 @opindex mclzero
28384 @need 200
28385 @itemx -mpku
28386 @opindex mpku
28387 @need 200
28388 @itemx -mavx512vbmi2
28389 @opindex mavx512vbmi2
28390 @need 200
28391 @itemx -mavx512bf16
28392 @opindex mavx512bf16
28393 @need 200
28394 @itemx -mgfni
28395 @opindex mgfni
28396 @need 200
28397 @itemx -mvaes
28398 @opindex mvaes
28399 @need 200
28400 @itemx -mwaitpkg
28401 @opindex mwaitpkg
28402 @need 200
28403 @itemx -mvpclmulqdq
28404 @opindex mvpclmulqdq
28405 @need 200
28406 @itemx -mavx512bitalg
28407 @opindex mavx512bitalg
28408 @need 200
28409 @itemx -mmovdiri
28410 @opindex mmovdiri
28411 @need 200
28412 @itemx -mmovdir64b
28413 @opindex mmovdir64b
28414 @need 200
28415 @itemx -menqcmd
28416 @opindex menqcmd
28417 @need 200
28418 @itemx -mavx512vpopcntdq
28419 @opindex mavx512vpopcntdq
28420 @need 200
28421 @itemx -mavx512vp2intersect
28422 @opindex mavx512vp2intersect
28423 @need 200
28424 @itemx -mavx5124fmaps
28425 @opindex mavx5124fmaps
28426 @need 200
28427 @itemx -mavx512vnni
28428 @opindex mavx512vnni
28429 @need 200
28430 @itemx -mavx5124vnniw
28431 @opindex mavx5124vnniw
28432 @need 200
28433 @itemx -mcldemote
28434 @opindex mcldemote
28435 These switches enable the use of instructions in the MMX, SSE,
28436 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28437 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28438 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28439 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28440 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28441 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28442 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28443 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28444 extended instruction sets. Each has a corresponding @option{-mno-} option to
28445 disable use of these instructions.
28446
28447 These extensions are also available as built-in functions: see
28448 @ref{x86 Built-in Functions}, for details of the functions enabled and
28449 disabled by these switches.
28450
28451 To generate SSE/SSE2 instructions automatically from floating-point
28452 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28453
28454 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28455 generates new AVX instructions or AVX equivalence for all SSEx instructions
28456 when needed.
28457
28458 These options enable GCC to use these extended instructions in
28459 generated code, even without @option{-mfpmath=sse}. Applications that
28460 perform run-time CPU detection must compile separate files for each
28461 supported architecture, using the appropriate flags. In particular,
28462 the file containing the CPU detection code should be compiled without
28463 these options.
28464
28465 @item -mdump-tune-features
28466 @opindex mdump-tune-features
28467 This option instructs GCC to dump the names of the x86 performance
28468 tuning features and default settings. The names can be used in
28469 @option{-mtune-ctrl=@var{feature-list}}.
28470
28471 @item -mtune-ctrl=@var{feature-list}
28472 @opindex mtune-ctrl=@var{feature-list}
28473 This option is used to do fine grain control of x86 code generation features.
28474 @var{feature-list} is a comma separated list of @var{feature} names. See also
28475 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28476 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28477 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28478 developers. Using it may lead to code paths not covered by testing and can
28479 potentially result in compiler ICEs or runtime errors.
28480
28481 @item -mno-default
28482 @opindex mno-default
28483 This option instructs GCC to turn off all tunable features. See also
28484 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28485
28486 @item -mcld
28487 @opindex mcld
28488 This option instructs GCC to emit a @code{cld} instruction in the prologue
28489 of functions that use string instructions. String instructions depend on
28490 the DF flag to select between autoincrement or autodecrement mode. While the
28491 ABI specifies the DF flag to be cleared on function entry, some operating
28492 systems violate this specification by not clearing the DF flag in their
28493 exception dispatchers. The exception handler can be invoked with the DF flag
28494 set, which leads to wrong direction mode when string instructions are used.
28495 This option can be enabled by default on 32-bit x86 targets by configuring
28496 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28497 instructions can be suppressed with the @option{-mno-cld} compiler option
28498 in this case.
28499
28500 @item -mvzeroupper
28501 @opindex mvzeroupper
28502 This option instructs GCC to emit a @code{vzeroupper} instruction
28503 before a transfer of control flow out of the function to minimize
28504 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28505 intrinsics.
28506
28507 @item -mprefer-avx128
28508 @opindex mprefer-avx128
28509 This option instructs GCC to use 128-bit AVX instructions instead of
28510 256-bit AVX instructions in the auto-vectorizer.
28511
28512 @item -mprefer-vector-width=@var{opt}
28513 @opindex mprefer-vector-width
28514 This option instructs GCC to use @var{opt}-bit vector width in instructions
28515 instead of default on the selected platform.
28516
28517 @table @samp
28518 @item none
28519 No extra limitations applied to GCC other than defined by the selected platform.
28520
28521 @item 128
28522 Prefer 128-bit vector width for instructions.
28523
28524 @item 256
28525 Prefer 256-bit vector width for instructions.
28526
28527 @item 512
28528 Prefer 512-bit vector width for instructions.
28529 @end table
28530
28531 @item -mcx16
28532 @opindex mcx16
28533 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28534 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28535 objects. This is useful for atomic updates of data structures exceeding one
28536 machine word in size. The compiler uses this instruction to implement
28537 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28538 128-bit integers, a library call is always used.
28539
28540 @item -msahf
28541 @opindex msahf
28542 This option enables generation of @code{SAHF} instructions in 64-bit code.
28543 Early Intel Pentium 4 CPUs with Intel 64 support,
28544 prior to the introduction of Pentium 4 G1 step in December 2005,
28545 lacked the @code{LAHF} and @code{SAHF} instructions
28546 which are supported by AMD64.
28547 These are load and store instructions, respectively, for certain status flags.
28548 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28549 @code{drem}, and @code{remainder} built-in functions;
28550 see @ref{Other Builtins} for details.
28551
28552 @item -mmovbe
28553 @opindex mmovbe
28554 This option enables use of the @code{movbe} instruction to implement
28555 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28556
28557 @item -mshstk
28558 @opindex mshstk
28559 The @option{-mshstk} option enables shadow stack built-in functions
28560 from x86 Control-flow Enforcement Technology (CET).
28561
28562 @item -mcrc32
28563 @opindex mcrc32
28564 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28565 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28566 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28567
28568 @item -mrecip
28569 @opindex mrecip
28570 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28571 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28572 with an additional Newton-Raphson step
28573 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28574 (and their vectorized
28575 variants) for single-precision floating-point arguments. These instructions
28576 are generated only when @option{-funsafe-math-optimizations} is enabled
28577 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28578 Note that while the throughput of the sequence is higher than the throughput
28579 of the non-reciprocal instruction, the precision of the sequence can be
28580 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28581
28582 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28583 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28584 combination), and doesn't need @option{-mrecip}.
28585
28586 Also note that GCC emits the above sequence with additional Newton-Raphson step
28587 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28588 already with @option{-ffast-math} (or the above option combination), and
28589 doesn't need @option{-mrecip}.
28590
28591 @item -mrecip=@var{opt}
28592 @opindex mrecip=opt
28593 This option controls which reciprocal estimate instructions
28594 may be used. @var{opt} is a comma-separated list of options, which may
28595 be preceded by a @samp{!} to invert the option:
28596
28597 @table @samp
28598 @item all
28599 Enable all estimate instructions.
28600
28601 @item default
28602 Enable the default instructions, equivalent to @option{-mrecip}.
28603
28604 @item none
28605 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28606
28607 @item div
28608 Enable the approximation for scalar division.
28609
28610 @item vec-div
28611 Enable the approximation for vectorized division.
28612
28613 @item sqrt
28614 Enable the approximation for scalar square root.
28615
28616 @item vec-sqrt
28617 Enable the approximation for vectorized square root.
28618 @end table
28619
28620 So, for example, @option{-mrecip=all,!sqrt} enables
28621 all of the reciprocal approximations, except for square root.
28622
28623 @item -mveclibabi=@var{type}
28624 @opindex mveclibabi
28625 Specifies the ABI type to use for vectorizing intrinsics using an
28626 external library. Supported values for @var{type} are @samp{svml}
28627 for the Intel short
28628 vector math library and @samp{acml} for the AMD math core library.
28629 To use this option, both @option{-ftree-vectorize} and
28630 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28631 ABI-compatible library must be specified at link time.
28632
28633 GCC currently emits calls to @code{vmldExp2},
28634 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28635 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28636 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28637 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28638 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28639 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28640 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28641 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28642 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28643 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28644 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28645 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28646 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28647 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28648 when @option{-mveclibabi=acml} is used.
28649
28650 @item -mabi=@var{name}
28651 @opindex mabi
28652 Generate code for the specified calling convention. Permissible values
28653 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28654 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28655 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28656 You can control this behavior for specific functions by
28657 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28658 @xref{Function Attributes}.
28659
28660 @item -mforce-indirect-call
28661 @opindex mforce-indirect-call
28662 Force all calls to functions to be indirect. This is useful
28663 when using Intel Processor Trace where it generates more precise timing
28664 information for function calls.
28665
28666 @item -mmanual-endbr
28667 @opindex mmanual-endbr
28668 Insert ENDBR instruction at function entry only via the @code{cf_check}
28669 function attribute. This is useful when used with the option
28670 @option{-fcf-protection=branch} to control ENDBR insertion at the
28671 function entry.
28672
28673 @item -mcall-ms2sysv-xlogues
28674 @opindex mcall-ms2sysv-xlogues
28675 @opindex mno-call-ms2sysv-xlogues
28676 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28677 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28678 default, the code for saving and restoring these registers is emitted inline,
28679 resulting in fairly lengthy prologues and epilogues. Using
28680 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28681 use stubs in the static portion of libgcc to perform these saves and restores,
28682 thus reducing function size at the cost of a few extra instructions.
28683
28684 @item -mtls-dialect=@var{type}
28685 @opindex mtls-dialect
28686 Generate code to access thread-local storage using the @samp{gnu} or
28687 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28688 @samp{gnu2} is more efficient, but it may add compile- and run-time
28689 requirements that cannot be satisfied on all systems.
28690
28691 @item -mpush-args
28692 @itemx -mno-push-args
28693 @opindex mpush-args
28694 @opindex mno-push-args
28695 Use PUSH operations to store outgoing parameters. This method is shorter
28696 and usually equally fast as method using SUB/MOV operations and is enabled
28697 by default. In some cases disabling it may improve performance because of
28698 improved scheduling and reduced dependencies.
28699
28700 @item -maccumulate-outgoing-args
28701 @opindex maccumulate-outgoing-args
28702 If enabled, the maximum amount of space required for outgoing arguments is
28703 computed in the function prologue. This is faster on most modern CPUs
28704 because of reduced dependencies, improved scheduling and reduced stack usage
28705 when the preferred stack boundary is not equal to 2. The drawback is a notable
28706 increase in code size. This switch implies @option{-mno-push-args}.
28707
28708 @item -mthreads
28709 @opindex mthreads
28710 Support thread-safe exception handling on MinGW. Programs that rely
28711 on thread-safe exception handling must compile and link all code with the
28712 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28713 @option{-D_MT}; when linking, it links in a special thread helper library
28714 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28715
28716 @item -mms-bitfields
28717 @itemx -mno-ms-bitfields
28718 @opindex mms-bitfields
28719 @opindex mno-ms-bitfields
28720
28721 Enable/disable bit-field layout compatible with the native Microsoft
28722 Windows compiler.
28723
28724 If @code{packed} is used on a structure, or if bit-fields are used,
28725 it may be that the Microsoft ABI lays out the structure differently
28726 than the way GCC normally does. Particularly when moving packed
28727 data between functions compiled with GCC and the native Microsoft compiler
28728 (either via function call or as data in a file), it may be necessary to access
28729 either format.
28730
28731 This option is enabled by default for Microsoft Windows
28732 targets. This behavior can also be controlled locally by use of variable
28733 or type attributes. For more information, see @ref{x86 Variable Attributes}
28734 and @ref{x86 Type Attributes}.
28735
28736 The Microsoft structure layout algorithm is fairly simple with the exception
28737 of the bit-field packing.
28738 The padding and alignment of members of structures and whether a bit-field
28739 can straddle a storage-unit boundary are determine by these rules:
28740
28741 @enumerate
28742 @item Structure members are stored sequentially in the order in which they are
28743 declared: the first member has the lowest memory address and the last member
28744 the highest.
28745
28746 @item Every data object has an alignment requirement. The alignment requirement
28747 for all data except structures, unions, and arrays is either the size of the
28748 object or the current packing size (specified with either the
28749 @code{aligned} attribute or the @code{pack} pragma),
28750 whichever is less. For structures, unions, and arrays,
28751 the alignment requirement is the largest alignment requirement of its members.
28752 Every object is allocated an offset so that:
28753
28754 @smallexample
28755 offset % alignment_requirement == 0
28756 @end smallexample
28757
28758 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28759 unit if the integral types are the same size and if the next bit-field fits
28760 into the current allocation unit without crossing the boundary imposed by the
28761 common alignment requirements of the bit-fields.
28762 @end enumerate
28763
28764 MSVC interprets zero-length bit-fields in the following ways:
28765
28766 @enumerate
28767 @item If a zero-length bit-field is inserted between two bit-fields that
28768 are normally coalesced, the bit-fields are not coalesced.
28769
28770 For example:
28771
28772 @smallexample
28773 struct
28774 @{
28775 unsigned long bf_1 : 12;
28776 unsigned long : 0;
28777 unsigned long bf_2 : 12;
28778 @} t1;
28779 @end smallexample
28780
28781 @noindent
28782 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28783 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28784
28785 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28786 alignment of the zero-length bit-field is greater than the member that follows it,
28787 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28788
28789 For example:
28790
28791 @smallexample
28792 struct
28793 @{
28794 char foo : 4;
28795 short : 0;
28796 char bar;
28797 @} t2;
28798
28799 struct
28800 @{
28801 char foo : 4;
28802 short : 0;
28803 double bar;
28804 @} t3;
28805 @end smallexample
28806
28807 @noindent
28808 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28809 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28810 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28811 of the structure.
28812
28813 Taking this into account, it is important to note the following:
28814
28815 @enumerate
28816 @item If a zero-length bit-field follows a normal bit-field, the type of the
28817 zero-length bit-field may affect the alignment of the structure as whole. For
28818 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28819 normal bit-field, and is of type short.
28820
28821 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28822 still affect the alignment of the structure:
28823
28824 @smallexample
28825 struct
28826 @{
28827 char foo : 6;
28828 long : 0;
28829 @} t4;
28830 @end smallexample
28831
28832 @noindent
28833 Here, @code{t4} takes up 4 bytes.
28834 @end enumerate
28835
28836 @item Zero-length bit-fields following non-bit-field members are ignored:
28837
28838 @smallexample
28839 struct
28840 @{
28841 char foo;
28842 long : 0;
28843 char bar;
28844 @} t5;
28845 @end smallexample
28846
28847 @noindent
28848 Here, @code{t5} takes up 2 bytes.
28849 @end enumerate
28850
28851
28852 @item -mno-align-stringops
28853 @opindex mno-align-stringops
28854 @opindex malign-stringops
28855 Do not align the destination of inlined string operations. This switch reduces
28856 code size and improves performance in case the destination is already aligned,
28857 but GCC doesn't know about it.
28858
28859 @item -minline-all-stringops
28860 @opindex minline-all-stringops
28861 By default GCC inlines string operations only when the destination is
28862 known to be aligned to least a 4-byte boundary.
28863 This enables more inlining and increases code
28864 size, but may improve performance of code that depends on fast
28865 @code{memcpy} and @code{memset} for short lengths.
28866 The option enables inline expansion of @code{strlen} for all
28867 pointer alignments.
28868
28869 @item -minline-stringops-dynamically
28870 @opindex minline-stringops-dynamically
28871 For string operations of unknown size, use run-time checks with
28872 inline code for small blocks and a library call for large blocks.
28873
28874 @item -mstringop-strategy=@var{alg}
28875 @opindex mstringop-strategy=@var{alg}
28876 Override the internal decision heuristic for the particular algorithm to use
28877 for inlining string operations. The allowed values for @var{alg} are:
28878
28879 @table @samp
28880 @item rep_byte
28881 @itemx rep_4byte
28882 @itemx rep_8byte
28883 Expand using i386 @code{rep} prefix of the specified size.
28884
28885 @item byte_loop
28886 @itemx loop
28887 @itemx unrolled_loop
28888 Expand into an inline loop.
28889
28890 @item libcall
28891 Always use a library call.
28892 @end table
28893
28894 @item -mmemcpy-strategy=@var{strategy}
28895 @opindex mmemcpy-strategy=@var{strategy}
28896 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28897 should be inlined and what inline algorithm to use when the expected size
28898 of the copy operation is known. @var{strategy}
28899 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28900 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28901 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28902 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28903 in the list must be specified in increasing order. The minimal byte size for
28904 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28905 preceding range.
28906
28907 @item -mmemset-strategy=@var{strategy}
28908 @opindex mmemset-strategy=@var{strategy}
28909 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28910 @code{__builtin_memset} expansion.
28911
28912 @item -momit-leaf-frame-pointer
28913 @opindex momit-leaf-frame-pointer
28914 Don't keep the frame pointer in a register for leaf functions. This
28915 avoids the instructions to save, set up, and restore frame pointers and
28916 makes an extra register available in leaf functions. The option
28917 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28918 which might make debugging harder.
28919
28920 @item -mtls-direct-seg-refs
28921 @itemx -mno-tls-direct-seg-refs
28922 @opindex mtls-direct-seg-refs
28923 Controls whether TLS variables may be accessed with offsets from the
28924 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28925 or whether the thread base pointer must be added. Whether or not this
28926 is valid depends on the operating system, and whether it maps the
28927 segment to cover the entire TLS area.
28928
28929 For systems that use the GNU C Library, the default is on.
28930
28931 @item -msse2avx
28932 @itemx -mno-sse2avx
28933 @opindex msse2avx
28934 Specify that the assembler should encode SSE instructions with VEX
28935 prefix. The option @option{-mavx} turns this on by default.
28936
28937 @item -mfentry
28938 @itemx -mno-fentry
28939 @opindex mfentry
28940 If profiling is active (@option{-pg}), put the profiling
28941 counter call before the prologue.
28942 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28943 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28944
28945 @item -mrecord-mcount
28946 @itemx -mno-record-mcount
28947 @opindex mrecord-mcount
28948 If profiling is active (@option{-pg}), generate a __mcount_loc section
28949 that contains pointers to each profiling call. This is useful for
28950 automatically patching and out calls.
28951
28952 @item -mnop-mcount
28953 @itemx -mno-nop-mcount
28954 @opindex mnop-mcount
28955 If profiling is active (@option{-pg}), generate the calls to
28956 the profiling functions as NOPs. This is useful when they
28957 should be patched in later dynamically. This is likely only
28958 useful together with @option{-mrecord-mcount}.
28959
28960 @item -minstrument-return=@var{type}
28961 @opindex minstrument-return
28962 Instrument function exit in -pg -mfentry instrumented functions with
28963 call to specified function. This only instruments true returns ending
28964 with ret, but not sibling calls ending with jump. Valid types
28965 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28966 or @var{nop5} to generate a 5 byte nop.
28967
28968 @item -mrecord-return
28969 @itemx -mno-record-return
28970 @opindex mrecord-return
28971 Generate a __return_loc section pointing to all return instrumentation code.
28972
28973 @item -mfentry-name=@var{name}
28974 @opindex mfentry-name
28975 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28976
28977 @item -mfentry-section=@var{name}
28978 @opindex mfentry-section
28979 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28980
28981 @item -mskip-rax-setup
28982 @itemx -mno-skip-rax-setup
28983 @opindex mskip-rax-setup
28984 When generating code for the x86-64 architecture with SSE extensions
28985 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28986 register when there are no variable arguments passed in vector registers.
28987
28988 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28989 saving vector registers on stack when passing variable arguments, the
28990 impacts of this option are callees may waste some stack space,
28991 misbehave or jump to a random location. GCC 4.4 or newer don't have
28992 those issues, regardless the RAX register value.
28993
28994 @item -m8bit-idiv
28995 @itemx -mno-8bit-idiv
28996 @opindex m8bit-idiv
28997 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28998 much faster than 32-bit/64-bit integer divide. This option generates a
28999 run-time check. If both dividend and divisor are within range of 0
29000 to 255, 8-bit unsigned integer divide is used instead of
29001 32-bit/64-bit integer divide.
29002
29003 @item -mavx256-split-unaligned-load
29004 @itemx -mavx256-split-unaligned-store
29005 @opindex mavx256-split-unaligned-load
29006 @opindex mavx256-split-unaligned-store
29007 Split 32-byte AVX unaligned load and store.
29008
29009 @item -mstack-protector-guard=@var{guard}
29010 @itemx -mstack-protector-guard-reg=@var{reg}
29011 @itemx -mstack-protector-guard-offset=@var{offset}
29012 @opindex mstack-protector-guard
29013 @opindex mstack-protector-guard-reg
29014 @opindex mstack-protector-guard-offset
29015 Generate stack protection code using canary at @var{guard}. Supported
29016 locations are @samp{global} for global canary or @samp{tls} for per-thread
29017 canary in the TLS block (the default). This option has effect only when
29018 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
29019
29020 With the latter choice the options
29021 @option{-mstack-protector-guard-reg=@var{reg}} and
29022 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29023 which segment register (@code{%fs} or @code{%gs}) to use as base register
29024 for reading the canary, and from what offset from that base register.
29025 The default for those is as specified in the relevant ABI.
29026
29027 @item -mgeneral-regs-only
29028 @opindex mgeneral-regs-only
29029 Generate code that uses only the general-purpose registers. This
29030 prevents the compiler from using floating-point, vector, mask and bound
29031 registers.
29032
29033 @item -mindirect-branch=@var{choice}
29034 @opindex mindirect-branch
29035 Convert indirect call and jump with @var{choice}. The default is
29036 @samp{keep}, which keeps indirect call and jump unmodified.
29037 @samp{thunk} converts indirect call and jump to call and return thunk.
29038 @samp{thunk-inline} converts indirect call and jump to inlined call
29039 and return thunk. @samp{thunk-extern} converts indirect call and jump
29040 to external call and return thunk provided in a separate object file.
29041 You can control this behavior for a specific function by using the
29042 function attribute @code{indirect_branch}. @xref{Function Attributes}.
29043
29044 Note that @option{-mcmodel=large} is incompatible with
29045 @option{-mindirect-branch=thunk} and
29046 @option{-mindirect-branch=thunk-extern} since the thunk function may
29047 not be reachable in the large code model.
29048
29049 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
29050 @option{-fcf-protection=branch} since the external thunk cannot be modified
29051 to disable control-flow check.
29052
29053 @item -mfunction-return=@var{choice}
29054 @opindex mfunction-return
29055 Convert function return with @var{choice}. The default is @samp{keep},
29056 which keeps function return unmodified. @samp{thunk} converts function
29057 return to call and return thunk. @samp{thunk-inline} converts function
29058 return to inlined call and return thunk. @samp{thunk-extern} converts
29059 function return to external call and return thunk provided in a separate
29060 object file. You can control this behavior for a specific function by
29061 using the function attribute @code{function_return}.
29062 @xref{Function Attributes}.
29063
29064 Note that @option{-mcmodel=large} is incompatible with
29065 @option{-mfunction-return=thunk} and
29066 @option{-mfunction-return=thunk-extern} since the thunk function may
29067 not be reachable in the large code model.
29068
29069
29070 @item -mindirect-branch-register
29071 @opindex mindirect-branch-register
29072 Force indirect call and jump via register.
29073
29074 @end table
29075
29076 These @samp{-m} switches are supported in addition to the above
29077 on x86-64 processors in 64-bit environments.
29078
29079 @table @gcctabopt
29080 @item -m32
29081 @itemx -m64
29082 @itemx -mx32
29083 @itemx -m16
29084 @itemx -miamcu
29085 @opindex m32
29086 @opindex m64
29087 @opindex mx32
29088 @opindex m16
29089 @opindex miamcu
29090 Generate code for a 16-bit, 32-bit or 64-bit environment.
29091 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
29092 to 32 bits, and
29093 generates code that runs on any i386 system.
29094
29095 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
29096 types to 64 bits, and generates code for the x86-64 architecture.
29097 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
29098 and @option{-mdynamic-no-pic} options.
29099
29100 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
29101 to 32 bits, and
29102 generates code for the x86-64 architecture.
29103
29104 The @option{-m16} option is the same as @option{-m32}, except for that
29105 it outputs the @code{.code16gcc} assembly directive at the beginning of
29106 the assembly output so that the binary can run in 16-bit mode.
29107
29108 The @option{-miamcu} option generates code which conforms to Intel MCU
29109 psABI. It requires the @option{-m32} option to be turned on.
29110
29111 @item -mno-red-zone
29112 @opindex mno-red-zone
29113 @opindex mred-zone
29114 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
29115 by the x86-64 ABI; it is a 128-byte area beyond the location of the
29116 stack pointer that is not modified by signal or interrupt handlers
29117 and therefore can be used for temporary data without adjusting the stack
29118 pointer. The flag @option{-mno-red-zone} disables this red zone.
29119
29120 @item -mcmodel=small
29121 @opindex mcmodel=small
29122 Generate code for the small code model: the program and its symbols must
29123 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
29124 Programs can be statically or dynamically linked. This is the default
29125 code model.
29126
29127 @item -mcmodel=kernel
29128 @opindex mcmodel=kernel
29129 Generate code for the kernel code model. The kernel runs in the
29130 negative 2 GB of the address space.
29131 This model has to be used for Linux kernel code.
29132
29133 @item -mcmodel=medium
29134 @opindex mcmodel=medium
29135 Generate code for the medium model: the program is linked in the lower 2
29136 GB of the address space. Small symbols are also placed there. Symbols
29137 with sizes larger than @option{-mlarge-data-threshold} are put into
29138 large data or BSS sections and can be located above 2GB. Programs can
29139 be statically or dynamically linked.
29140
29141 @item -mcmodel=large
29142 @opindex mcmodel=large
29143 Generate code for the large model. This model makes no assumptions
29144 about addresses and sizes of sections.
29145
29146 @item -maddress-mode=long
29147 @opindex maddress-mode=long
29148 Generate code for long address mode. This is only supported for 64-bit
29149 and x32 environments. It is the default address mode for 64-bit
29150 environments.
29151
29152 @item -maddress-mode=short
29153 @opindex maddress-mode=short
29154 Generate code for short address mode. This is only supported for 32-bit
29155 and x32 environments. It is the default address mode for 32-bit and
29156 x32 environments.
29157 @end table
29158
29159 @node x86 Windows Options
29160 @subsection x86 Windows Options
29161 @cindex x86 Windows Options
29162 @cindex Windows Options for x86
29163
29164 These additional options are available for Microsoft Windows targets:
29165
29166 @table @gcctabopt
29167 @item -mconsole
29168 @opindex mconsole
29169 This option
29170 specifies that a console application is to be generated, by
29171 instructing the linker to set the PE header subsystem type
29172 required for console applications.
29173 This option is available for Cygwin and MinGW targets and is
29174 enabled by default on those targets.
29175
29176 @item -mdll
29177 @opindex mdll
29178 This option is available for Cygwin and MinGW targets. It
29179 specifies that a DLL---a dynamic link library---is to be
29180 generated, enabling the selection of the required runtime
29181 startup object and entry point.
29182
29183 @item -mnop-fun-dllimport
29184 @opindex mnop-fun-dllimport
29185 This option is available for Cygwin and MinGW targets. It
29186 specifies that the @code{dllimport} attribute should be ignored.
29187
29188 @item -mthread
29189 @opindex mthread
29190 This option is available for MinGW targets. It specifies
29191 that MinGW-specific thread support is to be used.
29192
29193 @item -municode
29194 @opindex municode
29195 This option is available for MinGW-w64 targets. It causes
29196 the @code{UNICODE} preprocessor macro to be predefined, and
29197 chooses Unicode-capable runtime startup code.
29198
29199 @item -mwin32
29200 @opindex mwin32
29201 This option is available for Cygwin and MinGW targets. It
29202 specifies that the typical Microsoft Windows predefined macros are to
29203 be set in the pre-processor, but does not influence the choice
29204 of runtime library/startup code.
29205
29206 @item -mwindows
29207 @opindex mwindows
29208 This option is available for Cygwin and MinGW targets. It
29209 specifies that a GUI application is to be generated by
29210 instructing the linker to set the PE header subsystem type
29211 appropriately.
29212
29213 @item -fno-set-stack-executable
29214 @opindex fno-set-stack-executable
29215 @opindex fset-stack-executable
29216 This option is available for MinGW targets. It specifies that
29217 the executable flag for the stack used by nested functions isn't
29218 set. This is necessary for binaries running in kernel mode of
29219 Microsoft Windows, as there the User32 API, which is used to set executable
29220 privileges, isn't available.
29221
29222 @item -fwritable-relocated-rdata
29223 @opindex fno-writable-relocated-rdata
29224 @opindex fwritable-relocated-rdata
29225 This option is available for MinGW and Cygwin targets. It specifies
29226 that relocated-data in read-only section is put into the @code{.data}
29227 section. This is a necessary for older runtimes not supporting
29228 modification of @code{.rdata} sections for pseudo-relocation.
29229
29230 @item -mpe-aligned-commons
29231 @opindex mpe-aligned-commons
29232 This option is available for Cygwin and MinGW targets. It
29233 specifies that the GNU extension to the PE file format that
29234 permits the correct alignment of COMMON variables should be
29235 used when generating code. It is enabled by default if
29236 GCC detects that the target assembler found during configuration
29237 supports the feature.
29238 @end table
29239
29240 See also under @ref{x86 Options} for standard options.
29241
29242 @node Xstormy16 Options
29243 @subsection Xstormy16 Options
29244 @cindex Xstormy16 Options
29245
29246 These options are defined for Xstormy16:
29247
29248 @table @gcctabopt
29249 @item -msim
29250 @opindex msim
29251 Choose startup files and linker script suitable for the simulator.
29252 @end table
29253
29254 @node Xtensa Options
29255 @subsection Xtensa Options
29256 @cindex Xtensa Options
29257
29258 These options are supported for Xtensa targets:
29259
29260 @table @gcctabopt
29261 @item -mconst16
29262 @itemx -mno-const16
29263 @opindex mconst16
29264 @opindex mno-const16
29265 Enable or disable use of @code{CONST16} instructions for loading
29266 constant values. The @code{CONST16} instruction is currently not a
29267 standard option from Tensilica. When enabled, @code{CONST16}
29268 instructions are always used in place of the standard @code{L32R}
29269 instructions. The use of @code{CONST16} is enabled by default only if
29270 the @code{L32R} instruction is not available.
29271
29272 @item -mfused-madd
29273 @itemx -mno-fused-madd
29274 @opindex mfused-madd
29275 @opindex mno-fused-madd
29276 Enable or disable use of fused multiply/add and multiply/subtract
29277 instructions in the floating-point option. This has no effect if the
29278 floating-point option is not also enabled. Disabling fused multiply/add
29279 and multiply/subtract instructions forces the compiler to use separate
29280 instructions for the multiply and add/subtract operations. This may be
29281 desirable in some cases where strict IEEE 754-compliant results are
29282 required: the fused multiply add/subtract instructions do not round the
29283 intermediate result, thereby producing results with @emph{more} bits of
29284 precision than specified by the IEEE standard. Disabling fused multiply
29285 add/subtract instructions also ensures that the program output is not
29286 sensitive to the compiler's ability to combine multiply and add/subtract
29287 operations.
29288
29289 @item -mserialize-volatile
29290 @itemx -mno-serialize-volatile
29291 @opindex mserialize-volatile
29292 @opindex mno-serialize-volatile
29293 When this option is enabled, GCC inserts @code{MEMW} instructions before
29294 @code{volatile} memory references to guarantee sequential consistency.
29295 The default is @option{-mserialize-volatile}. Use
29296 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29297
29298 @item -mforce-no-pic
29299 @opindex mforce-no-pic
29300 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29301 position-independent code (PIC), this option disables PIC for compiling
29302 kernel code.
29303
29304 @item -mtext-section-literals
29305 @itemx -mno-text-section-literals
29306 @opindex mtext-section-literals
29307 @opindex mno-text-section-literals
29308 These options control the treatment of literal pools. The default is
29309 @option{-mno-text-section-literals}, which places literals in a separate
29310 section in the output file. This allows the literal pool to be placed
29311 in a data RAM/ROM, and it also allows the linker to combine literal
29312 pools from separate object files to remove redundant literals and
29313 improve code size. With @option{-mtext-section-literals}, the literals
29314 are interspersed in the text section in order to keep them as close as
29315 possible to their references. This may be necessary for large assembly
29316 files. Literals for each function are placed right before that function.
29317
29318 @item -mauto-litpools
29319 @itemx -mno-auto-litpools
29320 @opindex mauto-litpools
29321 @opindex mno-auto-litpools
29322 These options control the treatment of literal pools. The default is
29323 @option{-mno-auto-litpools}, which places literals in a separate
29324 section in the output file unless @option{-mtext-section-literals} is
29325 used. With @option{-mauto-litpools} the literals are interspersed in
29326 the text section by the assembler. Compiler does not produce explicit
29327 @code{.literal} directives and loads literals into registers with
29328 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29329 do relaxation and place literals as necessary. This option allows
29330 assembler to create several literal pools per function and assemble
29331 very big functions, which may not be possible with
29332 @option{-mtext-section-literals}.
29333
29334 @item -mtarget-align
29335 @itemx -mno-target-align
29336 @opindex mtarget-align
29337 @opindex mno-target-align
29338 When this option is enabled, GCC instructs the assembler to
29339 automatically align instructions to reduce branch penalties at the
29340 expense of some code density. The assembler attempts to widen density
29341 instructions to align branch targets and the instructions following call
29342 instructions. If there are not enough preceding safe density
29343 instructions to align a target, no widening is performed. The
29344 default is @option{-mtarget-align}. These options do not affect the
29345 treatment of auto-aligned instructions like @code{LOOP}, which the
29346 assembler always aligns, either by widening density instructions or
29347 by inserting NOP instructions.
29348
29349 @item -mlongcalls
29350 @itemx -mno-longcalls
29351 @opindex mlongcalls
29352 @opindex mno-longcalls
29353 When this option is enabled, GCC instructs the assembler to translate
29354 direct calls to indirect calls unless it can determine that the target
29355 of a direct call is in the range allowed by the call instruction. This
29356 translation typically occurs for calls to functions in other source
29357 files. Specifically, the assembler translates a direct @code{CALL}
29358 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29359 The default is @option{-mno-longcalls}. This option should be used in
29360 programs where the call target can potentially be out of range. This
29361 option is implemented in the assembler, not the compiler, so the
29362 assembly code generated by GCC still shows direct call
29363 instructions---look at the disassembled object code to see the actual
29364 instructions. Note that the assembler uses an indirect call for
29365 every cross-file call, not just those that really are out of range.
29366 @end table
29367
29368 @node zSeries Options
29369 @subsection zSeries Options
29370 @cindex zSeries options
29371
29372 These are listed under @xref{S/390 and zSeries Options}.
29373
29374
29375 @c man end
29376
29377 @node Spec Files
29378 @section Specifying Subprocesses and the Switches to Pass to Them
29379 @cindex Spec Files
29380
29381 @command{gcc} is a driver program. It performs its job by invoking a
29382 sequence of other programs to do the work of compiling, assembling and
29383 linking. GCC interprets its command-line parameters and uses these to
29384 deduce which programs it should invoke, and which command-line options
29385 it ought to place on their command lines. This behavior is controlled
29386 by @dfn{spec strings}. In most cases there is one spec string for each
29387 program that GCC can invoke, but a few programs have multiple spec
29388 strings to control their behavior. The spec strings built into GCC can
29389 be overridden by using the @option{-specs=} command-line switch to specify
29390 a spec file.
29391
29392 @dfn{Spec files} are plain-text files that are used to construct spec
29393 strings. They consist of a sequence of directives separated by blank
29394 lines. The type of directive is determined by the first non-whitespace
29395 character on the line, which can be one of the following:
29396
29397 @table @code
29398 @item %@var{command}
29399 Issues a @var{command} to the spec file processor. The commands that can
29400 appear here are:
29401
29402 @table @code
29403 @item %include <@var{file}>
29404 @cindex @code{%include}
29405 Search for @var{file} and insert its text at the current point in the
29406 specs file.
29407
29408 @item %include_noerr <@var{file}>
29409 @cindex @code{%include_noerr}
29410 Just like @samp{%include}, but do not generate an error message if the include
29411 file cannot be found.
29412
29413 @item %rename @var{old_name} @var{new_name}
29414 @cindex @code{%rename}
29415 Rename the spec string @var{old_name} to @var{new_name}.
29416
29417 @end table
29418
29419 @item *[@var{spec_name}]:
29420 This tells the compiler to create, override or delete the named spec
29421 string. All lines after this directive up to the next directive or
29422 blank line are considered to be the text for the spec string. If this
29423 results in an empty string then the spec is deleted. (Or, if the
29424 spec did not exist, then nothing happens.) Otherwise, if the spec
29425 does not currently exist a new spec is created. If the spec does
29426 exist then its contents are overridden by the text of this
29427 directive, unless the first character of that text is the @samp{+}
29428 character, in which case the text is appended to the spec.
29429
29430 @item [@var{suffix}]:
29431 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29432 and up to the next directive or blank line are considered to make up the
29433 spec string for the indicated suffix. When the compiler encounters an
29434 input file with the named suffix, it processes the spec string in
29435 order to work out how to compile that file. For example:
29436
29437 @smallexample
29438 .ZZ:
29439 z-compile -input %i
29440 @end smallexample
29441
29442 This says that any input file whose name ends in @samp{.ZZ} should be
29443 passed to the program @samp{z-compile}, which should be invoked with the
29444 command-line switch @option{-input} and with the result of performing the
29445 @samp{%i} substitution. (See below.)
29446
29447 As an alternative to providing a spec string, the text following a
29448 suffix directive can be one of the following:
29449
29450 @table @code
29451 @item @@@var{language}
29452 This says that the suffix is an alias for a known @var{language}. This is
29453 similar to using the @option{-x} command-line switch to GCC to specify a
29454 language explicitly. For example:
29455
29456 @smallexample
29457 .ZZ:
29458 @@c++
29459 @end smallexample
29460
29461 Says that .ZZ files are, in fact, C++ source files.
29462
29463 @item #@var{name}
29464 This causes an error messages saying:
29465
29466 @smallexample
29467 @var{name} compiler not installed on this system.
29468 @end smallexample
29469 @end table
29470
29471 GCC already has an extensive list of suffixes built into it.
29472 This directive adds an entry to the end of the list of suffixes, but
29473 since the list is searched from the end backwards, it is effectively
29474 possible to override earlier entries using this technique.
29475
29476 @end table
29477
29478 GCC has the following spec strings built into it. Spec files can
29479 override these strings or create their own. Note that individual
29480 targets can also add their own spec strings to this list.
29481
29482 @smallexample
29483 asm Options to pass to the assembler
29484 asm_final Options to pass to the assembler post-processor
29485 cpp Options to pass to the C preprocessor
29486 cc1 Options to pass to the C compiler
29487 cc1plus Options to pass to the C++ compiler
29488 endfile Object files to include at the end of the link
29489 link Options to pass to the linker
29490 lib Libraries to include on the command line to the linker
29491 libgcc Decides which GCC support library to pass to the linker
29492 linker Sets the name of the linker
29493 predefines Defines to be passed to the C preprocessor
29494 signed_char Defines to pass to CPP to say whether @code{char} is signed
29495 by default
29496 startfile Object files to include at the start of the link
29497 @end smallexample
29498
29499 Here is a small example of a spec file:
29500
29501 @smallexample
29502 %rename lib old_lib
29503
29504 *lib:
29505 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29506 @end smallexample
29507
29508 This example renames the spec called @samp{lib} to @samp{old_lib} and
29509 then overrides the previous definition of @samp{lib} with a new one.
29510 The new definition adds in some extra command-line options before
29511 including the text of the old definition.
29512
29513 @dfn{Spec strings} are a list of command-line options to be passed to their
29514 corresponding program. In addition, the spec strings can contain
29515 @samp{%}-prefixed sequences to substitute variable text or to
29516 conditionally insert text into the command line. Using these constructs
29517 it is possible to generate quite complex command lines.
29518
29519 Here is a table of all defined @samp{%}-sequences for spec
29520 strings. Note that spaces are not generated automatically around the
29521 results of expanding these sequences. Therefore you can concatenate them
29522 together or combine them with constant text in a single argument.
29523
29524 @table @code
29525 @item %%
29526 Substitute one @samp{%} into the program name or argument.
29527
29528 @item %i
29529 Substitute the name of the input file being processed.
29530
29531 @item %b
29532 Substitute the basename of the input file being processed.
29533 This is the substring up to (and not including) the last period
29534 and not including the directory.
29535
29536 @item %B
29537 This is the same as @samp{%b}, but include the file suffix (text after
29538 the last period).
29539
29540 @item %d
29541 Marks the argument containing or following the @samp{%d} as a
29542 temporary file name, so that that file is deleted if GCC exits
29543 successfully. Unlike @samp{%g}, this contributes no text to the
29544 argument.
29545
29546 @item %g@var{suffix}
29547 Substitute a file name that has suffix @var{suffix} and is chosen
29548 once per compilation, and mark the argument in the same way as
29549 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29550 name is now chosen in a way that is hard to predict even when previously
29551 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29552 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29553 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29554 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29555 was simply substituted with a file name chosen once per compilation,
29556 without regard to any appended suffix (which was therefore treated
29557 just like ordinary text), making such attacks more likely to succeed.
29558
29559 @item %u@var{suffix}
29560 Like @samp{%g}, but generates a new temporary file name
29561 each time it appears instead of once per compilation.
29562
29563 @item %U@var{suffix}
29564 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29565 new one if there is no such last file name. In the absence of any
29566 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29567 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29568 involves the generation of two distinct file names, one
29569 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29570 simply substituted with a file name chosen for the previous @samp{%u},
29571 without regard to any appended suffix.
29572
29573 @item %j@var{suffix}
29574 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29575 writable, and if @option{-save-temps} is not used;
29576 otherwise, substitute the name
29577 of a temporary file, just like @samp{%u}. This temporary file is not
29578 meant for communication between processes, but rather as a junk
29579 disposal mechanism.
29580
29581 @item %|@var{suffix}
29582 @itemx %m@var{suffix}
29583 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29584 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29585 all. These are the two most common ways to instruct a program that it
29586 should read from standard input or write to standard output. If you
29587 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29588 construct: see for example @file{gcc/fortran/lang-specs.h}.
29589
29590 @item %.@var{SUFFIX}
29591 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29592 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29593 terminated by the next space or %.
29594
29595 @item %w
29596 Marks the argument containing or following the @samp{%w} as the
29597 designated output file of this compilation. This puts the argument
29598 into the sequence of arguments that @samp{%o} substitutes.
29599
29600 @item %o
29601 Substitutes the names of all the output files, with spaces
29602 automatically placed around them. You should write spaces
29603 around the @samp{%o} as well or the results are undefined.
29604 @samp{%o} is for use in the specs for running the linker.
29605 Input files whose names have no recognized suffix are not compiled
29606 at all, but they are included among the output files, so they are
29607 linked.
29608
29609 @item %O
29610 Substitutes the suffix for object files. Note that this is
29611 handled specially when it immediately follows @samp{%g, %u, or %U},
29612 because of the need for those to form complete file names. The
29613 handling is such that @samp{%O} is treated exactly as if it had already
29614 been substituted, except that @samp{%g, %u, and %U} do not currently
29615 support additional @var{suffix} characters following @samp{%O} as they do
29616 following, for example, @samp{.o}.
29617
29618 @item %p
29619 Substitutes the standard macro predefinitions for the
29620 current target machine. Use this when running @command{cpp}.
29621
29622 @item %P
29623 Like @samp{%p}, but puts @samp{__} before and after the name of each
29624 predefined macro, except for macros that start with @samp{__} or with
29625 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29626 C@.
29627
29628 @item %I
29629 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29630 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29631 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29632 and @option{-imultilib} as necessary.
29633
29634 @item %s
29635 Current argument is the name of a library or startup file of some sort.
29636 Search for that file in a standard list of directories and substitute
29637 the full name found. The current working directory is included in the
29638 list of directories scanned.
29639
29640 @item %T
29641 Current argument is the name of a linker script. Search for that file
29642 in the current list of directories to scan for libraries. If the file
29643 is located insert a @option{--script} option into the command line
29644 followed by the full path name found. If the file is not found then
29645 generate an error message. Note: the current working directory is not
29646 searched.
29647
29648 @item %e@var{str}
29649 Print @var{str} as an error message. @var{str} is terminated by a newline.
29650 Use this when inconsistent options are detected.
29651
29652 @item %(@var{name})
29653 Substitute the contents of spec string @var{name} at this point.
29654
29655 @item %x@{@var{option}@}
29656 Accumulate an option for @samp{%X}.
29657
29658 @item %X
29659 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29660 spec string.
29661
29662 @item %Y
29663 Output the accumulated assembler options specified by @option{-Wa}.
29664
29665 @item %Z
29666 Output the accumulated preprocessor options specified by @option{-Wp}.
29667
29668 @item %a
29669 Process the @code{asm} spec. This is used to compute the
29670 switches to be passed to the assembler.
29671
29672 @item %A
29673 Process the @code{asm_final} spec. This is a spec string for
29674 passing switches to an assembler post-processor, if such a program is
29675 needed.
29676
29677 @item %l
29678 Process the @code{link} spec. This is the spec for computing the
29679 command line passed to the linker. Typically it makes use of the
29680 @samp{%L %G %S %D and %E} sequences.
29681
29682 @item %D
29683 Dump out a @option{-L} option for each directory that GCC believes might
29684 contain startup files. If the target supports multilibs then the
29685 current multilib directory is prepended to each of these paths.
29686
29687 @item %L
29688 Process the @code{lib} spec. This is a spec string for deciding which
29689 libraries are included on the command line to the linker.
29690
29691 @item %G
29692 Process the @code{libgcc} spec. This is a spec string for deciding
29693 which GCC support library is included on the command line to the linker.
29694
29695 @item %S
29696 Process the @code{startfile} spec. This is a spec for deciding which
29697 object files are the first ones passed to the linker. Typically
29698 this might be a file named @file{crt0.o}.
29699
29700 @item %E
29701 Process the @code{endfile} spec. This is a spec string that specifies
29702 the last object files that are passed to the linker.
29703
29704 @item %C
29705 Process the @code{cpp} spec. This is used to construct the arguments
29706 to be passed to the C preprocessor.
29707
29708 @item %1
29709 Process the @code{cc1} spec. This is used to construct the options to be
29710 passed to the actual C compiler (@command{cc1}).
29711
29712 @item %2
29713 Process the @code{cc1plus} spec. This is used to construct the options to be
29714 passed to the actual C++ compiler (@command{cc1plus}).
29715
29716 @item %*
29717 Substitute the variable part of a matched option. See below.
29718 Note that each comma in the substituted string is replaced by
29719 a single space.
29720
29721 @item %<S
29722 Remove all occurrences of @code{-S} from the command line. Note---this
29723 command is position dependent. @samp{%} commands in the spec string
29724 before this one see @code{-S}, @samp{%} commands in the spec string
29725 after this one do not.
29726
29727 @item %:@var{function}(@var{args})
29728 Call the named function @var{function}, passing it @var{args}.
29729 @var{args} is first processed as a nested spec string, then split
29730 into an argument vector in the usual fashion. The function returns
29731 a string which is processed as if it had appeared literally as part
29732 of the current spec.
29733
29734 The following built-in spec functions are provided:
29735
29736 @table @code
29737 @item @code{getenv}
29738 The @code{getenv} spec function takes two arguments: an environment
29739 variable name and a string. If the environment variable is not
29740 defined, a fatal error is issued. Otherwise, the return value is the
29741 value of the environment variable concatenated with the string. For
29742 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29743
29744 @smallexample
29745 %:getenv(TOPDIR /include)
29746 @end smallexample
29747
29748 expands to @file{/path/to/top/include}.
29749
29750 @item @code{if-exists}
29751 The @code{if-exists} spec function takes one argument, an absolute
29752 pathname to a file. If the file exists, @code{if-exists} returns the
29753 pathname. Here is a small example of its usage:
29754
29755 @smallexample
29756 *startfile:
29757 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29758 @end smallexample
29759
29760 @item @code{if-exists-else}
29761 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29762 spec function, except that it takes two arguments. The first argument is
29763 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29764 returns the pathname. If it does not exist, it returns the second argument.
29765 This way, @code{if-exists-else} can be used to select one file or another,
29766 based on the existence of the first. Here is a small example of its usage:
29767
29768 @smallexample
29769 *startfile:
29770 crt0%O%s %:if-exists(crti%O%s) \
29771 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29772 @end smallexample
29773
29774 @item @code{replace-outfile}
29775 The @code{replace-outfile} spec function takes two arguments. It looks for the
29776 first argument in the outfiles array and replaces it with the second argument. Here
29777 is a small example of its usage:
29778
29779 @smallexample
29780 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29781 @end smallexample
29782
29783 @item @code{remove-outfile}
29784 The @code{remove-outfile} spec function takes one argument. It looks for the
29785 first argument in the outfiles array and removes it. Here is a small example
29786 its usage:
29787
29788 @smallexample
29789 %:remove-outfile(-lm)
29790 @end smallexample
29791
29792 @item @code{pass-through-libs}
29793 The @code{pass-through-libs} spec function takes any number of arguments. It
29794 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29795 assumes are the names of linker input library archive files) and returns a
29796 result containing all the found arguments each prepended by
29797 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29798 intended to be passed to the LTO linker plugin.
29799
29800 @smallexample
29801 %:pass-through-libs(%G %L %G)
29802 @end smallexample
29803
29804 @item @code{print-asm-header}
29805 The @code{print-asm-header} function takes no arguments and simply
29806 prints a banner like:
29807
29808 @smallexample
29809 Assembler options
29810 =================
29811
29812 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29813 @end smallexample
29814
29815 It is used to separate compiler options from assembler options
29816 in the @option{--target-help} output.
29817 @end table
29818
29819 @item %@{S@}
29820 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29821 If that switch is not specified, this substitutes nothing. Note that
29822 the leading dash is omitted when specifying this option, and it is
29823 automatically inserted if the substitution is performed. Thus the spec
29824 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29825 and outputs the command-line option @option{-foo}.
29826
29827 @item %W@{S@}
29828 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29829 deleted on failure.
29830
29831 @item %@{S*@}
29832 Substitutes all the switches specified to GCC whose names start
29833 with @code{-S}, but which also take an argument. This is used for
29834 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29835 GCC considers @option{-o foo} as being
29836 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29837 text, including the space. Thus two arguments are generated.
29838
29839 @item %@{S*&T*@}
29840 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29841 (the order of @code{S} and @code{T} in the spec is not significant).
29842 There can be any number of ampersand-separated variables; for each the
29843 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29844
29845 @item %@{S:X@}
29846 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29847
29848 @item %@{!S:X@}
29849 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29850
29851 @item %@{S*:X@}
29852 Substitutes @code{X} if one or more switches whose names start with
29853 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29854 once, no matter how many such switches appeared. However, if @code{%*}
29855 appears somewhere in @code{X}, then @code{X} is substituted once
29856 for each matching switch, with the @code{%*} replaced by the part of
29857 that switch matching the @code{*}.
29858
29859 If @code{%*} appears as the last part of a spec sequence then a space
29860 is added after the end of the last substitution. If there is more
29861 text in the sequence, however, then a space is not generated. This
29862 allows the @code{%*} substitution to be used as part of a larger
29863 string. For example, a spec string like this:
29864
29865 @smallexample
29866 %@{mcu=*:--script=%*/memory.ld@}
29867 @end smallexample
29868
29869 @noindent
29870 when matching an option like @option{-mcu=newchip} produces:
29871
29872 @smallexample
29873 --script=newchip/memory.ld
29874 @end smallexample
29875
29876 @item %@{.S:X@}
29877 Substitutes @code{X}, if processing a file with suffix @code{S}.
29878
29879 @item %@{!.S:X@}
29880 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29881
29882 @item %@{,S:X@}
29883 Substitutes @code{X}, if processing a file for language @code{S}.
29884
29885 @item %@{!,S:X@}
29886 Substitutes @code{X}, if not processing a file for language @code{S}.
29887
29888 @item %@{S|P:X@}
29889 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29890 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29891 @code{*} sequences as well, although they have a stronger binding than
29892 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29893 alternatives must be starred, and only the first matching alternative
29894 is substituted.
29895
29896 For example, a spec string like this:
29897
29898 @smallexample
29899 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29900 @end smallexample
29901
29902 @noindent
29903 outputs the following command-line options from the following input
29904 command-line options:
29905
29906 @smallexample
29907 fred.c -foo -baz
29908 jim.d -bar -boggle
29909 -d fred.c -foo -baz -boggle
29910 -d jim.d -bar -baz -boggle
29911 @end smallexample
29912
29913 @item %@{S:X; T:Y; :D@}
29914
29915 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29916 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29917 be as many clauses as you need. This may be combined with @code{.},
29918 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29919
29920
29921 @end table
29922
29923 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29924 or similar construct can use a backslash to ignore the special meaning
29925 of the character following it, thus allowing literal matching of a
29926 character that is otherwise specially treated. For example,
29927 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29928 @option{-std=iso9899:1999} option is given.
29929
29930 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29931 construct may contain other nested @samp{%} constructs or spaces, or
29932 even newlines. They are processed as usual, as described above.
29933 Trailing white space in @code{X} is ignored. White space may also
29934 appear anywhere on the left side of the colon in these constructs,
29935 except between @code{.} or @code{*} and the corresponding word.
29936
29937 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29938 handled specifically in these constructs. If another value of
29939 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29940 @option{-W} switch is found later in the command line, the earlier
29941 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29942 just one letter, which passes all matching options.
29943
29944 The character @samp{|} at the beginning of the predicate text is used to
29945 indicate that a command should be piped to the following command, but
29946 only if @option{-pipe} is specified.
29947
29948 It is built into GCC which switches take arguments and which do not.
29949 (You might think it would be useful to generalize this to allow each
29950 compiler's spec to say which switches take arguments. But this cannot
29951 be done in a consistent fashion. GCC cannot even decide which input
29952 files have been specified without knowing which switches take arguments,
29953 and it must know which input files to compile in order to tell which
29954 compilers to run).
29955
29956 GCC also knows implicitly that arguments starting in @option{-l} are to be
29957 treated as compiler output files, and passed to the linker in their
29958 proper position among the other output files.
29959
29960 @node Environment Variables
29961 @section Environment Variables Affecting GCC
29962 @cindex environment variables
29963
29964 @c man begin ENVIRONMENT
29965 This section describes several environment variables that affect how GCC
29966 operates. Some of them work by specifying directories or prefixes to use
29967 when searching for various kinds of files. Some are used to specify other
29968 aspects of the compilation environment.
29969
29970 Note that you can also specify places to search using options such as
29971 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29972 take precedence over places specified using environment variables, which
29973 in turn take precedence over those specified by the configuration of GCC@.
29974 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29975 GNU Compiler Collection (GCC) Internals}.
29976
29977 @table @env
29978 @item LANG
29979 @itemx LC_CTYPE
29980 @c @itemx LC_COLLATE
29981 @itemx LC_MESSAGES
29982 @c @itemx LC_MONETARY
29983 @c @itemx LC_NUMERIC
29984 @c @itemx LC_TIME
29985 @itemx LC_ALL
29986 @findex LANG
29987 @findex LC_CTYPE
29988 @c @findex LC_COLLATE
29989 @findex LC_MESSAGES
29990 @c @findex LC_MONETARY
29991 @c @findex LC_NUMERIC
29992 @c @findex LC_TIME
29993 @findex LC_ALL
29994 @cindex locale
29995 These environment variables control the way that GCC uses
29996 localization information which allows GCC to work with different
29997 national conventions. GCC inspects the locale categories
29998 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29999 so. These locale categories can be set to any value supported by your
30000 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
30001 Kingdom encoded in UTF-8.
30002
30003 The @env{LC_CTYPE} environment variable specifies character
30004 classification. GCC uses it to determine the character boundaries in
30005 a string; this is needed for some multibyte encodings that contain quote
30006 and escape characters that are otherwise interpreted as a string
30007 end or escape.
30008
30009 The @env{LC_MESSAGES} environment variable specifies the language to
30010 use in diagnostic messages.
30011
30012 If the @env{LC_ALL} environment variable is set, it overrides the value
30013 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
30014 and @env{LC_MESSAGES} default to the value of the @env{LANG}
30015 environment variable. If none of these variables are set, GCC
30016 defaults to traditional C English behavior.
30017
30018 @item TMPDIR
30019 @findex TMPDIR
30020 If @env{TMPDIR} is set, it specifies the directory to use for temporary
30021 files. GCC uses temporary files to hold the output of one stage of
30022 compilation which is to be used as input to the next stage: for example,
30023 the output of the preprocessor, which is the input to the compiler
30024 proper.
30025
30026 @item GCC_COMPARE_DEBUG
30027 @findex GCC_COMPARE_DEBUG
30028 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
30029 @option{-fcompare-debug} to the compiler driver. See the documentation
30030 of this option for more details.
30031
30032 @item GCC_EXEC_PREFIX
30033 @findex GCC_EXEC_PREFIX
30034 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
30035 names of the subprograms executed by the compiler. No slash is added
30036 when this prefix is combined with the name of a subprogram, but you can
30037 specify a prefix that ends with a slash if you wish.
30038
30039 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
30040 an appropriate prefix to use based on the pathname it is invoked with.
30041
30042 If GCC cannot find the subprogram using the specified prefix, it
30043 tries looking in the usual places for the subprogram.
30044
30045 The default value of @env{GCC_EXEC_PREFIX} is
30046 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
30047 the installed compiler. In many cases @var{prefix} is the value
30048 of @code{prefix} when you ran the @file{configure} script.
30049
30050 Other prefixes specified with @option{-B} take precedence over this prefix.
30051
30052 This prefix is also used for finding files such as @file{crt0.o} that are
30053 used for linking.
30054
30055 In addition, the prefix is used in an unusual way in finding the
30056 directories to search for header files. For each of the standard
30057 directories whose name normally begins with @samp{/usr/local/lib/gcc}
30058 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
30059 replacing that beginning with the specified prefix to produce an
30060 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
30061 @file{foo/bar} just before it searches the standard directory
30062 @file{/usr/local/lib/bar}.
30063 If a standard directory begins with the configured
30064 @var{prefix} then the value of @var{prefix} is replaced by
30065 @env{GCC_EXEC_PREFIX} when looking for header files.
30066
30067 @item COMPILER_PATH
30068 @findex COMPILER_PATH
30069 The value of @env{COMPILER_PATH} is a colon-separated list of
30070 directories, much like @env{PATH}. GCC tries the directories thus
30071 specified when searching for subprograms, if it cannot find the
30072 subprograms using @env{GCC_EXEC_PREFIX}.
30073
30074 @item LIBRARY_PATH
30075 @findex LIBRARY_PATH
30076 The value of @env{LIBRARY_PATH} is a colon-separated list of
30077 directories, much like @env{PATH}. When configured as a native compiler,
30078 GCC tries the directories thus specified when searching for special
30079 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
30080 using GCC also uses these directories when searching for ordinary
30081 libraries for the @option{-l} option (but directories specified with
30082 @option{-L} come first).
30083
30084 @item LANG
30085 @findex LANG
30086 @cindex locale definition
30087 This variable is used to pass locale information to the compiler. One way in
30088 which this information is used is to determine the character set to be used
30089 when character literals, string literals and comments are parsed in C and C++.
30090 When the compiler is configured to allow multibyte characters,
30091 the following values for @env{LANG} are recognized:
30092
30093 @table @samp
30094 @item C-JIS
30095 Recognize JIS characters.
30096 @item C-SJIS
30097 Recognize SJIS characters.
30098 @item C-EUCJP
30099 Recognize EUCJP characters.
30100 @end table
30101
30102 If @env{LANG} is not defined, or if it has some other value, then the
30103 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
30104 recognize and translate multibyte characters.
30105 @end table
30106
30107 @noindent
30108 Some additional environment variables affect the behavior of the
30109 preprocessor.
30110
30111 @include cppenv.texi
30112
30113 @c man end
30114
30115 @node Precompiled Headers
30116 @section Using Precompiled Headers
30117 @cindex precompiled headers
30118 @cindex speed of compilation
30119
30120 Often large projects have many header files that are included in every
30121 source file. The time the compiler takes to process these header files
30122 over and over again can account for nearly all of the time required to
30123 build the project. To make builds faster, GCC allows you to
30124 @dfn{precompile} a header file.
30125
30126 To create a precompiled header file, simply compile it as you would any
30127 other file, if necessary using the @option{-x} option to make the driver
30128 treat it as a C or C++ header file. You may want to use a
30129 tool like @command{make} to keep the precompiled header up-to-date when
30130 the headers it contains change.
30131
30132 A precompiled header file is searched for when @code{#include} is
30133 seen in the compilation. As it searches for the included file
30134 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30135 compiler looks for a precompiled header in each directory just before it
30136 looks for the include file in that directory. The name searched for is
30137 the name specified in the @code{#include} with @samp{.gch} appended. If
30138 the precompiled header file cannot be used, it is ignored.
30139
30140 For instance, if you have @code{#include "all.h"}, and you have
30141 @file{all.h.gch} in the same directory as @file{all.h}, then the
30142 precompiled header file is used if possible, and the original
30143 header is used otherwise.
30144
30145 Alternatively, you might decide to put the precompiled header file in a
30146 directory and use @option{-I} to ensure that directory is searched
30147 before (or instead of) the directory containing the original header.
30148 Then, if you want to check that the precompiled header file is always
30149 used, you can put a file of the same name as the original header in this
30150 directory containing an @code{#error} command.
30151
30152 This also works with @option{-include}. So yet another way to use
30153 precompiled headers, good for projects not designed with precompiled
30154 header files in mind, is to simply take most of the header files used by
30155 a project, include them from another header file, precompile that header
30156 file, and @option{-include} the precompiled header. If the header files
30157 have guards against multiple inclusion, they are skipped because
30158 they've already been included (in the precompiled header).
30159
30160 If you need to precompile the same header file for different
30161 languages, targets, or compiler options, you can instead make a
30162 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30163 header in the directory, perhaps using @option{-o}. It doesn't matter
30164 what you call the files in the directory; every precompiled header in
30165 the directory is considered. The first precompiled header
30166 encountered in the directory that is valid for this compilation is
30167 used; they're searched in no particular order.
30168
30169 There are many other possibilities, limited only by your imagination,
30170 good sense, and the constraints of your build system.
30171
30172 A precompiled header file can be used only when these conditions apply:
30173
30174 @itemize
30175 @item
30176 Only one precompiled header can be used in a particular compilation.
30177
30178 @item
30179 A precompiled header cannot be used once the first C token is seen. You
30180 can have preprocessor directives before a precompiled header; you cannot
30181 include a precompiled header from inside another header.
30182
30183 @item
30184 The precompiled header file must be produced for the same language as
30185 the current compilation. You cannot use a C precompiled header for a C++
30186 compilation.
30187
30188 @item
30189 The precompiled header file must have been produced by the same compiler
30190 binary as the current compilation is using.
30191
30192 @item
30193 Any macros defined before the precompiled header is included must
30194 either be defined in the same way as when the precompiled header was
30195 generated, or must not affect the precompiled header, which usually
30196 means that they don't appear in the precompiled header at all.
30197
30198 The @option{-D} option is one way to define a macro before a
30199 precompiled header is included; using a @code{#define} can also do it.
30200 There are also some options that define macros implicitly, like
30201 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30202 defined this way.
30203
30204 @item If debugging information is output when using the precompiled
30205 header, using @option{-g} or similar, the same kind of debugging information
30206 must have been output when building the precompiled header. However,
30207 a precompiled header built using @option{-g} can be used in a compilation
30208 when no debugging information is being output.
30209
30210 @item The same @option{-m} options must generally be used when building
30211 and using the precompiled header. @xref{Submodel Options},
30212 for any cases where this rule is relaxed.
30213
30214 @item Each of the following options must be the same when building and using
30215 the precompiled header:
30216
30217 @gccoptlist{-fexceptions}
30218
30219 @item
30220 Some other command-line options starting with @option{-f},
30221 @option{-p}, or @option{-O} must be defined in the same way as when
30222 the precompiled header was generated. At present, it's not clear
30223 which options are safe to change and which are not; the safest choice
30224 is to use exactly the same options when generating and using the
30225 precompiled header. The following are known to be safe:
30226
30227 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30228 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30229 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30230 -pedantic-errors}
30231
30232 @end itemize
30233
30234 For all of these except the last, the compiler automatically
30235 ignores the precompiled header if the conditions aren't met. If you
30236 find an option combination that doesn't work and doesn't cause the
30237 precompiled header to be ignored, please consider filing a bug report,
30238 see @ref{Bugs}.
30239
30240 If you do use differing options when generating and using the
30241 precompiled header, the actual behavior is a mixture of the
30242 behavior for the options. For instance, if you use @option{-g} to
30243 generate the precompiled header but not when using it, you may or may
30244 not get debugging information for routines in the precompiled header.