Make C2X imply -fno-fp-int-builtin-inexact.
[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-format=@r{[}text@r{|}json@r{]} @gol
277 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
278 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
279 -fdiagnostics-minimum-margin-width=@var{width} @gol
280 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
281 -fdiagnostics-show-template-tree -fno-elide-type @gol
282 -fno-show-column}
283
284 @item Warning Options
285 @xref{Warning Options,,Options to Request or Suppress Warnings}.
286 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
287 -pedantic-errors @gol
288 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
289 -Waggregate-return -Waligned-new @gol
290 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
291 -Walloca -Walloca-larger-than=@var{byte-size} @gol
292 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
293 -Wno-attributes -Wattribute-alias=@var{n} @gol
294 -Wbool-compare -Wbool-operation @gol
295 -Wno-builtin-declaration-mismatch @gol
296 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
297 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
298 -Wc++20-compat @gol
299 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
300 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
301 -Wclobbered -Wcomment -Wconditionally-supported @gol
302 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
303 -Wdelete-incomplete @gol
304 -Wno-attribute-warning @gol
305 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
306 -Wdisabled-optimization @gol
307 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
308 -Wno-div-by-zero -Wdouble-promotion @gol
309 -Wduplicated-branches -Wduplicated-cond @gol
310 -Wempty-body -Wenum-compare -Wenum-conversion @gol
311 -Wno-endif-labels -Wexpansion-to-defined @gol
312 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
313 -Wfloat-equal -Wformat -Wformat=2 @gol
314 -Wno-format-contains-nul -Wno-format-extra-args @gol
315 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
316 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
317 -Wformat-y2k -Wframe-address @gol
318 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
319 -Wjump-misses-init @gol
320 -Whsa -Wif-not-aligned @gol
321 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
322 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
323 -Wimplicit-function-declaration -Wimplicit-int @gol
324 -Winaccessible-base @gol
325 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
326 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
327 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
328 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
329 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
330 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
331 -Wmissing-field-initializers -Wmissing-format-attribute @gol
332 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
333 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
334 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
335 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
336 -Woverride-init-side-effects -Woverlength-strings @gol
337 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
338 -Wparentheses -Wno-pedantic-ms-format @gol
339 -Wplacement-new -Wplacement-new=@var{n} @gol
340 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
341 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
342 -Wrestrict -Wno-return-local-addr @gol
343 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
344 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
345 -Wshift-overflow -Wshift-overflow=@var{n} @gol
346 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
347 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
348 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
349 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
350 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
351 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
352 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
353 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
354 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
355 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
356 -Wswitch-unreachable -Wsync-nand @gol
357 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
358 -Wtype-limits -Wundef @gol
359 -Wuninitialized -Wunknown-pragmas @gol
360 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
361 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
362 -Wunused-parameter -Wno-unused-result @gol
363 -Wunused-value -Wunused-variable @gol
364 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
365 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
366 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
367 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
368 -Wwrite-strings @gol
369 -Wzero-as-null-pointer-constant}
370
371 @item C and Objective-C-only Warning Options
372 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
373 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
374 -Wold-style-declaration -Wold-style-definition @gol
375 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
376 -Wdeclaration-after-statement -Wpointer-sign}
377
378 @item Debugging Options
379 @xref{Debugging Options,,Options for Debugging Your Program}.
380 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
381 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
382 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
383 -gas-loc-support -gno-as-loc-support @gol
384 -gas-locview-support -gno-as-locview-support @gol
385 -gcolumn-info -gno-column-info @gol
386 -gstatement-frontiers -gno-statement-frontiers @gol
387 -gvariable-location-views -gno-variable-location-views @gol
388 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
389 -ginline-points -gno-inline-points @gol
390 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
391 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
392 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
393 -fno-eliminate-unused-debug-types @gol
394 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
395 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
396 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
397 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
398 -fvar-tracking -fvar-tracking-assignments}
399
400 @item Optimization Options
401 @xref{Optimize Options,,Options that Control Optimization}.
402 @gccoptlist{-faggressive-loop-optimizations @gol
403 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
405 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
406 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
407 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
408 -fauto-inc-dec -fbranch-probabilities @gol
409 -fcaller-saves @gol
410 -fcombine-stack-adjustments -fconserve-stack @gol
411 -fcompare-elim -fcprop-registers -fcrossjumping @gol
412 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
413 -fcx-limited-range @gol
414 -fdata-sections -fdce -fdelayed-branch @gol
415 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
416 -fdevirtualize-at-ltrans -fdse @gol
417 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
418 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
419 -ffinite-loops @gol
420 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
421 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
422 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
423 -fif-conversion2 -findirect-inlining @gol
424 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
425 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
426 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
427 -fipa-reference -fipa-reference-addressable @gol
428 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
429 -flive-patching=@var{level} @gol
430 -fira-region=@var{region} -fira-hoist-pressure @gol
431 -fira-loop-pressure -fno-ira-share-save-slots @gol
432 -fno-ira-share-spill-slots @gol
433 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
434 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
435 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
436 -floop-block -floop-interchange -floop-strip-mine @gol
437 -floop-unroll-and-jam -floop-nest-optimize @gol
438 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
439 -flto-partition=@var{alg} -fmerge-all-constants @gol
440 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
441 -fmove-loop-invariants -fno-branch-count-reg @gol
442 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
443 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
444 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
445 -fno-sched-spec -fno-signed-zeros @gol
446 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
447 -fomit-frame-pointer -foptimize-sibling-calls @gol
448 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
449 -fprefetch-loop-arrays @gol
450 -fprofile-correction @gol
451 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
452 -fprofile-reorder-functions @gol
453 -freciprocal-math -free -frename-registers -freorder-blocks @gol
454 -freorder-blocks-algorithm=@var{algorithm} @gol
455 -freorder-blocks-and-partition -freorder-functions @gol
456 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
457 -frounding-math -fsave-optimization-record @gol
458 -fsched2-use-superblocks -fsched-pressure @gol
459 -fsched-spec-load -fsched-spec-load-dangerous @gol
460 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
461 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
462 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
463 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
464 -fschedule-fusion @gol
465 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
466 -fselective-scheduling -fselective-scheduling2 @gol
467 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
468 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
469 -fsignaling-nans @gol
470 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
471 -fsplit-paths @gol
472 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
473 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
474 -fthread-jumps -ftracer -ftree-bit-ccp @gol
475 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
476 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
477 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
478 -ftree-loop-if-convert -ftree-loop-im @gol
479 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
480 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
481 -ftree-loop-vectorize @gol
482 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
483 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
484 -ftree-switch-conversion -ftree-tail-merge @gol
485 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
486 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
487 -funsafe-math-optimizations -funswitch-loops @gol
488 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
489 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
490 --param @var{name}=@var{value}
491 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
492
493 @item Program Instrumentation Options
494 @xref{Instrumentation Options,,Program Instrumentation Options}.
495 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
496 -fprofile-abs-path @gol
497 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
498 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
499 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
500 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
501 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
502 -fsanitize-undefined-trap-on-error -fbounds-check @gol
503 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
504 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
505 -fstack-protector-explicit -fstack-check @gol
506 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
507 -fno-stack-limit -fsplit-stack @gol
508 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
509 -fvtv-counts -fvtv-debug @gol
510 -finstrument-functions @gol
511 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
512 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
513
514 @item Preprocessor Options
515 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
516 @gccoptlist{-A@var{question}=@var{answer} @gol
517 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
518 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
519 -dD -dI -dM -dN -dU @gol
520 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
521 -fexec-charset=@var{charset} -fextended-identifiers @gol
522 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
523 -fmax-include-depth=@var{depth} @gol
524 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
525 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
526 -fwide-exec-charset=@var{charset} -fworking-directory @gol
527 -H -imacros @var{file} -include @var{file} @gol
528 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
529 -no-integrated-cpp -P -pthread -remap @gol
530 -traditional -traditional-cpp -trigraphs @gol
531 -U@var{macro} -undef @gol
532 -Wp,@var{option} -Xpreprocessor @var{option}}
533
534 @item Assembler Options
535 @xref{Assembler Options,,Passing Options to the Assembler}.
536 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
537
538 @item Linker Options
539 @xref{Link Options,,Options for Linking}.
540 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
541 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
542 -e @var{entry} --entry=@var{entry} @gol
543 -pie -pthread -r -rdynamic @gol
544 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
545 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
546 -shared -shared-libgcc -symbolic @gol
547 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
548 -u @var{symbol} -z @var{keyword}}
549
550 @item Directory Options
551 @xref{Directory Options,,Options for Directory Search}.
552 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
553 -idirafter @var{dir} @gol
554 -imacros @var{file} -imultilib @var{dir} @gol
555 -iplugindir=@var{dir} -iprefix @var{file} @gol
556 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
557 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
558 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
559 -nostdinc -nostdinc++ --sysroot=@var{dir}}
560
561 @item Code Generation Options
562 @xref{Code Gen Options,,Options for Code Generation Conventions}.
563 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
564 -ffixed-@var{reg} -fexceptions @gol
565 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
566 -fasynchronous-unwind-tables @gol
567 -fno-gnu-unique @gol
568 -finhibit-size-directive -fno-common -fno-ident @gol
569 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
570 -fno-jump-tables @gol
571 -frecord-gcc-switches @gol
572 -freg-struct-return -fshort-enums -fshort-wchar @gol
573 -fverbose-asm -fpack-struct[=@var{n}] @gol
574 -fleading-underscore -ftls-model=@var{model} @gol
575 -fstack-reuse=@var{reuse_level} @gol
576 -ftrampolines -ftrapv -fwrapv @gol
577 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
578 -fstrict-volatile-bitfields -fsync-libcalls}
579
580 @item Developer Options
581 @xref{Developer Options,,GCC Developer Options}.
582 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
583 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
584 -fdbg-cnt=@var{counter-value-list} @gol
585 -fdisable-ipa-@var{pass_name} @gol
586 -fdisable-rtl-@var{pass_name} @gol
587 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
588 -fdisable-tree-@var{pass_name} @gol
589 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
590 -fdump-debug -fdump-earlydebug @gol
591 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
592 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
593 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
594 -fdump-lang-all @gol
595 -fdump-lang-@var{switch} @gol
596 -fdump-lang-@var{switch}-@var{options} @gol
597 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
598 -fdump-passes @gol
599 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
600 -fdump-statistics @gol
601 -fdump-tree-all @gol
602 -fdump-tree-@var{switch} @gol
603 -fdump-tree-@var{switch}-@var{options} @gol
604 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
605 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
606 -fenable-@var{kind}-@var{pass} @gol
607 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
608 -fira-verbose=@var{n} @gol
609 -flto-report -flto-report-wpa -fmem-report-wpa @gol
610 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
611 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
612 -fprofile-report @gol
613 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
614 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
615 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
616 -fvar-tracking-assignments-toggle -gtoggle @gol
617 -print-file-name=@var{library} -print-libgcc-file-name @gol
618 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
619 -print-prog-name=@var{program} -print-search-dirs -Q @gol
620 -print-sysroot -print-sysroot-headers-suffix @gol
621 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
622
623 @item Machine-Dependent Options
624 @xref{Submodel Options,,Machine-Dependent Options}.
625 @c This list is ordered alphanumerically by subsection name.
626 @c Try and put the significant identifier (CPU or system) first,
627 @c so users have a clue at guessing where the ones they want will be.
628
629 @emph{AArch64 Options}
630 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
631 -mgeneral-regs-only @gol
632 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
633 -mstrict-align -mno-strict-align @gol
634 -momit-leaf-frame-pointer @gol
635 -mtls-dialect=desc -mtls-dialect=traditional @gol
636 -mtls-size=@var{size} @gol
637 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
638 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
639 -mpc-relative-literal-loads @gol
640 -msign-return-address=@var{scope} @gol
641 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
642 +@var{b-key}]|@var{bti} @gol
643 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
644 -moverride=@var{string} -mverbose-cost-dump @gol
645 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
646 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
647 -moutline-atomics }
648
649 @emph{Adapteva Epiphany Options}
650 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
651 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
652 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
653 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
654 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
655 -msplit-vecmove-early -m1reg-@var{reg}}
656
657 @emph{AMD GCN Options}
658 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
659
660 @emph{ARC Options}
661 @gccoptlist{-mbarrel-shifter -mjli-always @gol
662 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
663 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
664 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
665 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
666 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
667 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
668 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
669 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
670 -mvolatile-cache -mtp-regno=@var{regno} @gol
671 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
672 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
673 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
674 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
675 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
676 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
677 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
678 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
679
680 @emph{ARM Options}
681 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
682 -mabi=@var{name} @gol
683 -mapcs-stack-check -mno-apcs-stack-check @gol
684 -mapcs-reentrant -mno-apcs-reentrant @gol
685 -mgeneral-regs-only @gol
686 -msched-prolog -mno-sched-prolog @gol
687 -mlittle-endian -mbig-endian @gol
688 -mbe8 -mbe32 @gol
689 -mfloat-abi=@var{name} @gol
690 -mfp16-format=@var{name}
691 -mthumb-interwork -mno-thumb-interwork @gol
692 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
693 -mtune=@var{name} -mprint-tune-info @gol
694 -mstructure-size-boundary=@var{n} @gol
695 -mabort-on-noreturn @gol
696 -mlong-calls -mno-long-calls @gol
697 -msingle-pic-base -mno-single-pic-base @gol
698 -mpic-register=@var{reg} @gol
699 -mnop-fun-dllimport @gol
700 -mpoke-function-name @gol
701 -mthumb -marm -mflip-thumb @gol
702 -mtpcs-frame -mtpcs-leaf-frame @gol
703 -mcaller-super-interworking -mcallee-super-interworking @gol
704 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
705 -mword-relocations @gol
706 -mfix-cortex-m3-ldrd @gol
707 -munaligned-access @gol
708 -mneon-for-64bits @gol
709 -mslow-flash-data @gol
710 -masm-syntax-unified @gol
711 -mrestrict-it @gol
712 -mverbose-cost-dump @gol
713 -mpure-code @gol
714 -mcmse @gol
715 -mfdpic}
716
717 @emph{AVR Options}
718 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
719 -mbranch-cost=@var{cost} @gol
720 -mcall-prologues -mgas-isr-prologues -mint8 @gol
721 -mn_flash=@var{size} -mno-interrupts @gol
722 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
723 -mfract-convert-truncate @gol
724 -mshort-calls -nodevicelib @gol
725 -Waddr-space-convert -Wmisspelled-isr}
726
727 @emph{Blackfin Options}
728 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
729 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
730 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
731 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
732 -mno-id-shared-library -mshared-library-id=@var{n} @gol
733 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
734 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
735 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
736 -micplb}
737
738 @emph{C6X Options}
739 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
740 -msim -msdata=@var{sdata-type}}
741
742 @emph{CRIS Options}
743 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
744 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
745 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
746 -mstack-align -mdata-align -mconst-align @gol
747 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
748 -melf -maout -melinux -mlinux -sim -sim2 @gol
749 -mmul-bug-workaround -mno-mul-bug-workaround}
750
751 @emph{CR16 Options}
752 @gccoptlist{-mmac @gol
753 -mcr16cplus -mcr16c @gol
754 -msim -mint32 -mbit-ops
755 -mdata-model=@var{model}}
756
757 @emph{C-SKY Options}
758 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
759 -mbig-endian -EB -mlittle-endian -EL @gol
760 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
761 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
762 -mdsp -medsp -mvdsp @gol
763 -mdiv -msmart -mhigh-registers -manchor @gol
764 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
765 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
766
767 @emph{Darwin Options}
768 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
769 -arch_only -bind_at_load -bundle -bundle_loader @gol
770 -client_name -compatibility_version -current_version @gol
771 -dead_strip @gol
772 -dependency-file -dylib_file -dylinker_install_name @gol
773 -dynamic -dynamiclib -exported_symbols_list @gol
774 -filelist -flat_namespace -force_cpusubtype_ALL @gol
775 -force_flat_namespace -headerpad_max_install_names @gol
776 -iframework @gol
777 -image_base -init -install_name -keep_private_externs @gol
778 -multi_module -multiply_defined -multiply_defined_unused @gol
779 -noall_load -no_dead_strip_inits_and_terms @gol
780 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
781 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
782 -private_bundle -read_only_relocs -sectalign @gol
783 -sectobjectsymbols -whyload -seg1addr @gol
784 -sectcreate -sectobjectsymbols -sectorder @gol
785 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
786 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
787 -segprot -segs_read_only_addr -segs_read_write_addr @gol
788 -single_module -static -sub_library -sub_umbrella @gol
789 -twolevel_namespace -umbrella -undefined @gol
790 -unexported_symbols_list -weak_reference_mismatches @gol
791 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
792 -mkernel -mone-byte-bool}
793
794 @emph{DEC Alpha Options}
795 @gccoptlist{-mno-fp-regs -msoft-float @gol
796 -mieee -mieee-with-inexact -mieee-conformant @gol
797 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
798 -mtrap-precision=@var{mode} -mbuild-constants @gol
799 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
800 -mbwx -mmax -mfix -mcix @gol
801 -mfloat-vax -mfloat-ieee @gol
802 -mexplicit-relocs -msmall-data -mlarge-data @gol
803 -msmall-text -mlarge-text @gol
804 -mmemory-latency=@var{time}}
805
806 @emph{eBPF Options}
807 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
808 -mframe-limit=@var{bytes}}
809
810 @emph{FR30 Options}
811 @gccoptlist{-msmall-model -mno-lsim}
812
813 @emph{FT32 Options}
814 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
815
816 @emph{FRV Options}
817 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
818 -mhard-float -msoft-float @gol
819 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
820 -mdouble -mno-double @gol
821 -mmedia -mno-media -mmuladd -mno-muladd @gol
822 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
823 -mlinked-fp -mlong-calls -malign-labels @gol
824 -mlibrary-pic -macc-4 -macc-8 @gol
825 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
826 -moptimize-membar -mno-optimize-membar @gol
827 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
828 -mvliw-branch -mno-vliw-branch @gol
829 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
830 -mno-nested-cond-exec -mtomcat-stats @gol
831 -mTLS -mtls @gol
832 -mcpu=@var{cpu}}
833
834 @emph{GNU/Linux Options}
835 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
836 -tno-android-cc -tno-android-ld}
837
838 @emph{H8/300 Options}
839 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
840
841 @emph{HPPA Options}
842 @gccoptlist{-march=@var{architecture-type} @gol
843 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
844 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
845 -mfixed-range=@var{register-range} @gol
846 -mjump-in-delay -mlinker-opt -mlong-calls @gol
847 -mlong-load-store -mno-disable-fpregs @gol
848 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
849 -mno-jump-in-delay -mno-long-load-store @gol
850 -mno-portable-runtime -mno-soft-float @gol
851 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
852 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
853 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
854 -munix=@var{unix-std} -nolibdld -static -threads}
855
856 @emph{IA-64 Options}
857 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
858 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
859 -mconstant-gp -mauto-pic -mfused-madd @gol
860 -minline-float-divide-min-latency @gol
861 -minline-float-divide-max-throughput @gol
862 -mno-inline-float-divide @gol
863 -minline-int-divide-min-latency @gol
864 -minline-int-divide-max-throughput @gol
865 -mno-inline-int-divide @gol
866 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
867 -mno-inline-sqrt @gol
868 -mdwarf2-asm -mearly-stop-bits @gol
869 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
870 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
871 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
872 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
873 -msched-spec-ldc -msched-spec-control-ldc @gol
874 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
875 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
876 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
877 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
878
879 @emph{LM32 Options}
880 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
881 -msign-extend-enabled -muser-enabled}
882
883 @emph{M32R/D Options}
884 @gccoptlist{-m32r2 -m32rx -m32r @gol
885 -mdebug @gol
886 -malign-loops -mno-align-loops @gol
887 -missue-rate=@var{number} @gol
888 -mbranch-cost=@var{number} @gol
889 -mmodel=@var{code-size-model-type} @gol
890 -msdata=@var{sdata-type} @gol
891 -mno-flush-func -mflush-func=@var{name} @gol
892 -mno-flush-trap -mflush-trap=@var{number} @gol
893 -G @var{num}}
894
895 @emph{M32C Options}
896 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
897
898 @emph{M680x0 Options}
899 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
900 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
901 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
902 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
903 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
904 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
905 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
906 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
907 -mxgot -mno-xgot -mlong-jump-table-offsets}
908
909 @emph{MCore Options}
910 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
911 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
912 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
913 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
914 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
915
916 @emph{MeP Options}
917 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
918 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
919 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
920 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
921 -mtiny=@var{n}}
922
923 @emph{MicroBlaze Options}
924 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
925 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
926 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
927 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
928 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
929 -mpic-data-is-text-relative}
930
931 @emph{MIPS Options}
932 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
933 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
934 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
935 -mips16 -mno-mips16 -mflip-mips16 @gol
936 -minterlink-compressed -mno-interlink-compressed @gol
937 -minterlink-mips16 -mno-interlink-mips16 @gol
938 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
939 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
940 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
941 -mno-float -msingle-float -mdouble-float @gol
942 -modd-spreg -mno-odd-spreg @gol
943 -mabs=@var{mode} -mnan=@var{encoding} @gol
944 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
945 -mmcu -mmno-mcu @gol
946 -meva -mno-eva @gol
947 -mvirt -mno-virt @gol
948 -mxpa -mno-xpa @gol
949 -mcrc -mno-crc @gol
950 -mginv -mno-ginv @gol
951 -mmicromips -mno-micromips @gol
952 -mmsa -mno-msa @gol
953 -mloongson-mmi -mno-loongson-mmi @gol
954 -mloongson-ext -mno-loongson-ext @gol
955 -mloongson-ext2 -mno-loongson-ext2 @gol
956 -mfpu=@var{fpu-type} @gol
957 -msmartmips -mno-smartmips @gol
958 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
959 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
960 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
961 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
962 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
963 -membedded-data -mno-embedded-data @gol
964 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
965 -mcode-readable=@var{setting} @gol
966 -msplit-addresses -mno-split-addresses @gol
967 -mexplicit-relocs -mno-explicit-relocs @gol
968 -mcheck-zero-division -mno-check-zero-division @gol
969 -mdivide-traps -mdivide-breaks @gol
970 -mload-store-pairs -mno-load-store-pairs @gol
971 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
972 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
973 -mfix-24k -mno-fix-24k @gol
974 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
975 -mfix-r5900 -mno-fix-r5900 @gol
976 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
977 -mfix-vr4120 -mno-fix-vr4120 @gol
978 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
979 -mflush-func=@var{func} -mno-flush-func @gol
980 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
981 -mcompact-branches=@var{policy} @gol
982 -mfp-exceptions -mno-fp-exceptions @gol
983 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
984 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
985 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
986 -mframe-header-opt -mno-frame-header-opt}
987
988 @emph{MMIX Options}
989 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
990 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
991 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
992 -mno-base-addresses -msingle-exit -mno-single-exit}
993
994 @emph{MN10300 Options}
995 @gccoptlist{-mmult-bug -mno-mult-bug @gol
996 -mno-am33 -mam33 -mam33-2 -mam34 @gol
997 -mtune=@var{cpu-type} @gol
998 -mreturn-pointer-on-d0 @gol
999 -mno-crt0 -mrelax -mliw -msetlb}
1000
1001 @emph{Moxie Options}
1002 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1003
1004 @emph{MSP430 Options}
1005 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1006 -mwarn-mcu @gol
1007 -mcode-region= -mdata-region= @gol
1008 -msilicon-errata= -msilicon-errata-warn= @gol
1009 -mhwmult= -minrt}
1010
1011 @emph{NDS32 Options}
1012 @gccoptlist{-mbig-endian -mlittle-endian @gol
1013 -mreduced-regs -mfull-regs @gol
1014 -mcmov -mno-cmov @gol
1015 -mext-perf -mno-ext-perf @gol
1016 -mext-perf2 -mno-ext-perf2 @gol
1017 -mext-string -mno-ext-string @gol
1018 -mv3push -mno-v3push @gol
1019 -m16bit -mno-16bit @gol
1020 -misr-vector-size=@var{num} @gol
1021 -mcache-block-size=@var{num} @gol
1022 -march=@var{arch} @gol
1023 -mcmodel=@var{code-model} @gol
1024 -mctor-dtor -mrelax}
1025
1026 @emph{Nios II Options}
1027 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1028 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1029 -mel -meb @gol
1030 -mno-bypass-cache -mbypass-cache @gol
1031 -mno-cache-volatile -mcache-volatile @gol
1032 -mno-fast-sw-div -mfast-sw-div @gol
1033 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1034 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1035 -mcustom-fpu-cfg=@var{name} @gol
1036 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1037 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1038
1039 @emph{Nvidia PTX Options}
1040 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1041
1042 @emph{OpenRISC Options}
1043 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1044 -msoft-mul -msoft-div @gol
1045 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1046 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1047
1048 @emph{PDP-11 Options}
1049 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1050 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1051 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1052
1053 @emph{picoChip Options}
1054 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1055 -msymbol-as-address -mno-inefficient-warnings}
1056
1057 @emph{PowerPC Options}
1058 See RS/6000 and PowerPC Options.
1059
1060 @emph{PRU Options}
1061 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1062 -mabi=@var{variant} @gol}
1063
1064 @emph{RISC-V Options}
1065 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1066 -mplt -mno-plt @gol
1067 -mabi=@var{ABI-string} @gol
1068 -mfdiv -mno-fdiv @gol
1069 -mdiv -mno-div @gol
1070 -march=@var{ISA-string} @gol
1071 -mtune=@var{processor-string} @gol
1072 -mpreferred-stack-boundary=@var{num} @gol
1073 -msmall-data-limit=@var{N-bytes} @gol
1074 -msave-restore -mno-save-restore @gol
1075 -mstrict-align -mno-strict-align @gol
1076 -mcmodel=medlow -mcmodel=medany @gol
1077 -mexplicit-relocs -mno-explicit-relocs @gol
1078 -mrelax -mno-relax @gol
1079 -mriscv-attribute -mmo-riscv-attribute @gol
1080 -malign-data=@var{type}}
1081
1082 @emph{RL78 Options}
1083 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1084 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1085 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1086
1087 @emph{RS/6000 and PowerPC Options}
1088 @gccoptlist{-mcpu=@var{cpu-type} @gol
1089 -mtune=@var{cpu-type} @gol
1090 -mcmodel=@var{code-model} @gol
1091 -mpowerpc64 @gol
1092 -maltivec -mno-altivec @gol
1093 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1094 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1095 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1096 -mfprnd -mno-fprnd @gol
1097 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1098 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1099 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1100 -malign-power -malign-natural @gol
1101 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1102 -mupdate -mno-update @gol
1103 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1104 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1105 -mstrict-align -mno-strict-align -mrelocatable @gol
1106 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1107 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1108 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1109 -mprioritize-restricted-insns=@var{priority} @gol
1110 -msched-costly-dep=@var{dependence_type} @gol
1111 -minsert-sched-nops=@var{scheme} @gol
1112 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1113 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1114 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1115 -mtraceback=@var{traceback_type} @gol
1116 -maix-struct-return -msvr4-struct-return @gol
1117 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1118 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1119 -mblock-move-inline-limit=@var{num} @gol
1120 -mblock-compare-inline-limit=@var{num} @gol
1121 -mblock-compare-inline-loop-limit=@var{num} @gol
1122 -mstring-compare-inline-limit=@var{num} @gol
1123 -misel -mno-isel @gol
1124 -mvrsave -mno-vrsave @gol
1125 -mmulhw -mno-mulhw @gol
1126 -mdlmzb -mno-dlmzb @gol
1127 -mprototype -mno-prototype @gol
1128 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1129 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1130 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1131 -mno-recip-precision @gol
1132 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1133 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1134 -msave-toc-indirect -mno-save-toc-indirect @gol
1135 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1136 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1137 -mquad-memory -mno-quad-memory @gol
1138 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1139 -mcompat-align-parm -mno-compat-align-parm @gol
1140 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1141 -mgnu-attribute -mno-gnu-attribute @gol
1142 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1143 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1144
1145 @emph{RX Options}
1146 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1147 -mcpu=@gol
1148 -mbig-endian-data -mlittle-endian-data @gol
1149 -msmall-data @gol
1150 -msim -mno-sim@gol
1151 -mas100-syntax -mno-as100-syntax@gol
1152 -mrelax@gol
1153 -mmax-constant-size=@gol
1154 -mint-register=@gol
1155 -mpid@gol
1156 -mallow-string-insns -mno-allow-string-insns@gol
1157 -mjsr@gol
1158 -mno-warn-multiple-fast-interrupts@gol
1159 -msave-acc-in-interrupts}
1160
1161 @emph{S/390 and zSeries Options}
1162 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1163 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1164 -mlong-double-64 -mlong-double-128 @gol
1165 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1166 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1167 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1168 -mhtm -mvx -mzvector @gol
1169 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1170 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1171 -mhotpatch=@var{halfwords},@var{halfwords}}
1172
1173 @emph{Score Options}
1174 @gccoptlist{-meb -mel @gol
1175 -mnhwloop @gol
1176 -muls @gol
1177 -mmac @gol
1178 -mscore5 -mscore5u -mscore7 -mscore7d}
1179
1180 @emph{SH Options}
1181 @gccoptlist{-m1 -m2 -m2e @gol
1182 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1183 -m3 -m3e @gol
1184 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1185 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1186 -mb -ml -mdalign -mrelax @gol
1187 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1188 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1189 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1190 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1191 -maccumulate-outgoing-args @gol
1192 -matomic-model=@var{atomic-model} @gol
1193 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1194 -mcbranch-force-delay-slot @gol
1195 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1196 -mpretend-cmove -mtas}
1197
1198 @emph{Solaris 2 Options}
1199 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1200 -pthreads}
1201
1202 @emph{SPARC Options}
1203 @gccoptlist{-mcpu=@var{cpu-type} @gol
1204 -mtune=@var{cpu-type} @gol
1205 -mcmodel=@var{code-model} @gol
1206 -mmemory-model=@var{mem-model} @gol
1207 -m32 -m64 -mapp-regs -mno-app-regs @gol
1208 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1209 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1210 -mhard-quad-float -msoft-quad-float @gol
1211 -mstack-bias -mno-stack-bias @gol
1212 -mstd-struct-return -mno-std-struct-return @gol
1213 -munaligned-doubles -mno-unaligned-doubles @gol
1214 -muser-mode -mno-user-mode @gol
1215 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1216 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1217 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1218 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1219 -mpopc -mno-popc -msubxc -mno-subxc @gol
1220 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1221 -mlra -mno-lra}
1222
1223 @emph{System V Options}
1224 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1225
1226 @emph{TILE-Gx Options}
1227 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1228 -mcmodel=@var{code-model}}
1229
1230 @emph{TILEPro Options}
1231 @gccoptlist{-mcpu=@var{cpu} -m32}
1232
1233 @emph{V850 Options}
1234 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1235 -mprolog-function -mno-prolog-function -mspace @gol
1236 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1237 -mapp-regs -mno-app-regs @gol
1238 -mdisable-callt -mno-disable-callt @gol
1239 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1240 -mv850e -mv850 -mv850e3v5 @gol
1241 -mloop @gol
1242 -mrelax @gol
1243 -mlong-jumps @gol
1244 -msoft-float @gol
1245 -mhard-float @gol
1246 -mgcc-abi @gol
1247 -mrh850-abi @gol
1248 -mbig-switch}
1249
1250 @emph{VAX Options}
1251 @gccoptlist{-mg -mgnu -munix}
1252
1253 @emph{Visium Options}
1254 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1255 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1256
1257 @emph{VMS Options}
1258 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1259 -mpointer-size=@var{size}}
1260
1261 @emph{VxWorks Options}
1262 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1263 -Xbind-lazy -Xbind-now}
1264
1265 @emph{x86 Options}
1266 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1267 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1268 -mfpmath=@var{unit} @gol
1269 -masm=@var{dialect} -mno-fancy-math-387 @gol
1270 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1271 -mno-wide-multiply -mrtd -malign-double @gol
1272 -mpreferred-stack-boundary=@var{num} @gol
1273 -mincoming-stack-boundary=@var{num} @gol
1274 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1275 -mrecip -mrecip=@var{opt} @gol
1276 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1277 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1278 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1279 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1280 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1281 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1282 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1283 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1284 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1285 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1286 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1287 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1288 -mrdseed -msgx -mavx512vp2intersect@gol
1289 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1290 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1291 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1292 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1293 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1294 -mregparm=@var{num} -msseregparm @gol
1295 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1296 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1297 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1298 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1299 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1300 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1301 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1302 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1303 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1304 -mstack-protector-guard-reg=@var{reg} @gol
1305 -mstack-protector-guard-offset=@var{offset} @gol
1306 -mstack-protector-guard-symbol=@var{symbol} @gol
1307 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1308 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1309 -mindirect-branch-register}
1310
1311 @emph{x86 Windows Options}
1312 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1313 -mnop-fun-dllimport -mthread @gol
1314 -municode -mwin32 -mwindows -fno-set-stack-executable}
1315
1316 @emph{Xstormy16 Options}
1317 @gccoptlist{-msim}
1318
1319 @emph{Xtensa Options}
1320 @gccoptlist{-mconst16 -mno-const16 @gol
1321 -mfused-madd -mno-fused-madd @gol
1322 -mforce-no-pic @gol
1323 -mserialize-volatile -mno-serialize-volatile @gol
1324 -mtext-section-literals -mno-text-section-literals @gol
1325 -mauto-litpools -mno-auto-litpools @gol
1326 -mtarget-align -mno-target-align @gol
1327 -mlongcalls -mno-longcalls}
1328
1329 @emph{zSeries Options}
1330 See S/390 and zSeries Options.
1331 @end table
1332
1333
1334 @node Overall Options
1335 @section Options Controlling the Kind of Output
1336
1337 Compilation can involve up to four stages: preprocessing, compilation
1338 proper, assembly and linking, always in that order. GCC is capable of
1339 preprocessing and compiling several files either into several
1340 assembler input files, or into one assembler input file; then each
1341 assembler input file produces an object file, and linking combines all
1342 the object files (those newly compiled, and those specified as input)
1343 into an executable file.
1344
1345 @cindex file name suffix
1346 For any given input file, the file name suffix determines what kind of
1347 compilation is done:
1348
1349 @table @gcctabopt
1350 @item @var{file}.c
1351 C source code that must be preprocessed.
1352
1353 @item @var{file}.i
1354 C source code that should not be preprocessed.
1355
1356 @item @var{file}.ii
1357 C++ source code that should not be preprocessed.
1358
1359 @item @var{file}.m
1360 Objective-C source code. Note that you must link with the @file{libobjc}
1361 library to make an Objective-C program work.
1362
1363 @item @var{file}.mi
1364 Objective-C source code that should not be preprocessed.
1365
1366 @item @var{file}.mm
1367 @itemx @var{file}.M
1368 Objective-C++ source code. Note that you must link with the @file{libobjc}
1369 library to make an Objective-C++ program work. Note that @samp{.M} refers
1370 to a literal capital M@.
1371
1372 @item @var{file}.mii
1373 Objective-C++ source code that should not be preprocessed.
1374
1375 @item @var{file}.h
1376 C, C++, Objective-C or Objective-C++ header file to be turned into a
1377 precompiled header (default), or C, C++ header file to be turned into an
1378 Ada spec (via the @option{-fdump-ada-spec} switch).
1379
1380 @item @var{file}.cc
1381 @itemx @var{file}.cp
1382 @itemx @var{file}.cxx
1383 @itemx @var{file}.cpp
1384 @itemx @var{file}.CPP
1385 @itemx @var{file}.c++
1386 @itemx @var{file}.C
1387 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1388 the last two letters must both be literally @samp{x}. Likewise,
1389 @samp{.C} refers to a literal capital C@.
1390
1391 @item @var{file}.mm
1392 @itemx @var{file}.M
1393 Objective-C++ source code that must be preprocessed.
1394
1395 @item @var{file}.mii
1396 Objective-C++ source code that should not be preprocessed.
1397
1398 @item @var{file}.hh
1399 @itemx @var{file}.H
1400 @itemx @var{file}.hp
1401 @itemx @var{file}.hxx
1402 @itemx @var{file}.hpp
1403 @itemx @var{file}.HPP
1404 @itemx @var{file}.h++
1405 @itemx @var{file}.tcc
1406 C++ header file to be turned into a precompiled header or Ada spec.
1407
1408 @item @var{file}.f
1409 @itemx @var{file}.for
1410 @itemx @var{file}.ftn
1411 Fixed form Fortran source code that should not be preprocessed.
1412
1413 @item @var{file}.F
1414 @itemx @var{file}.FOR
1415 @itemx @var{file}.fpp
1416 @itemx @var{file}.FPP
1417 @itemx @var{file}.FTN
1418 Fixed form Fortran source code that must be preprocessed (with the traditional
1419 preprocessor).
1420
1421 @item @var{file}.f90
1422 @itemx @var{file}.f95
1423 @itemx @var{file}.f03
1424 @itemx @var{file}.f08
1425 Free form Fortran source code that should not be preprocessed.
1426
1427 @item @var{file}.F90
1428 @itemx @var{file}.F95
1429 @itemx @var{file}.F03
1430 @itemx @var{file}.F08
1431 Free form Fortran source code that must be preprocessed (with the
1432 traditional preprocessor).
1433
1434 @item @var{file}.go
1435 Go source code.
1436
1437 @item @var{file}.brig
1438 BRIG files (binary representation of HSAIL).
1439
1440 @item @var{file}.d
1441 D source code.
1442
1443 @item @var{file}.di
1444 D interface file.
1445
1446 @item @var{file}.dd
1447 D documentation code (Ddoc).
1448
1449 @item @var{file}.ads
1450 Ada source code file that contains a library unit declaration (a
1451 declaration of a package, subprogram, or generic, or a generic
1452 instantiation), or a library unit renaming declaration (a package,
1453 generic, or subprogram renaming declaration). Such files are also
1454 called @dfn{specs}.
1455
1456 @item @var{file}.adb
1457 Ada source code file containing a library unit body (a subprogram or
1458 package body). Such files are also called @dfn{bodies}.
1459
1460 @c GCC also knows about some suffixes for languages not yet included:
1461 @c Ratfor:
1462 @c @var{file}.r
1463
1464 @item @var{file}.s
1465 Assembler code.
1466
1467 @item @var{file}.S
1468 @itemx @var{file}.sx
1469 Assembler code that must be preprocessed.
1470
1471 @item @var{other}
1472 An object file to be fed straight into linking.
1473 Any file name with no recognized suffix is treated this way.
1474 @end table
1475
1476 @opindex x
1477 You can specify the input language explicitly with the @option{-x} option:
1478
1479 @table @gcctabopt
1480 @item -x @var{language}
1481 Specify explicitly the @var{language} for the following input files
1482 (rather than letting the compiler choose a default based on the file
1483 name suffix). This option applies to all following input files until
1484 the next @option{-x} option. Possible values for @var{language} are:
1485 @smallexample
1486 c c-header cpp-output
1487 c++ c++-header c++-cpp-output
1488 objective-c objective-c-header objective-c-cpp-output
1489 objective-c++ objective-c++-header objective-c++-cpp-output
1490 assembler assembler-with-cpp
1491 ada
1492 d
1493 f77 f77-cpp-input f95 f95-cpp-input
1494 go
1495 brig
1496 @end smallexample
1497
1498 @item -x none
1499 Turn off any specification of a language, so that subsequent files are
1500 handled according to their file name suffixes (as they are if @option{-x}
1501 has not been used at all).
1502 @end table
1503
1504 If you only want some of the stages of compilation, you can use
1505 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1506 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1507 @command{gcc} is to stop. Note that some combinations (for example,
1508 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1509
1510 @table @gcctabopt
1511 @item -c
1512 @opindex c
1513 Compile or assemble the source files, but do not link. The linking
1514 stage simply is not done. The ultimate output is in the form of an
1515 object file for each source file.
1516
1517 By default, the object file name for a source file is made by replacing
1518 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1519
1520 Unrecognized input files, not requiring compilation or assembly, are
1521 ignored.
1522
1523 @item -S
1524 @opindex S
1525 Stop after the stage of compilation proper; do not assemble. The output
1526 is in the form of an assembler code file for each non-assembler input
1527 file specified.
1528
1529 By default, the assembler file name for a source file is made by
1530 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1531
1532 Input files that don't require compilation are ignored.
1533
1534 @item -E
1535 @opindex E
1536 Stop after the preprocessing stage; do not run the compiler proper. The
1537 output is in the form of preprocessed source code, which is sent to the
1538 standard output.
1539
1540 Input files that don't require preprocessing are ignored.
1541
1542 @cindex output file option
1543 @item -o @var{file}
1544 @opindex o
1545 Place output in file @var{file}. This applies to whatever
1546 sort of output is being produced, whether it be an executable file,
1547 an object file, an assembler file or preprocessed C code.
1548
1549 If @option{-o} is not specified, the default is to put an executable
1550 file in @file{a.out}, the object file for
1551 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1552 assembler file in @file{@var{source}.s}, a precompiled header file in
1553 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1554 standard output.
1555
1556 @item -v
1557 @opindex v
1558 Print (on standard error output) the commands executed to run the stages
1559 of compilation. Also print the version number of the compiler driver
1560 program and of the preprocessor and the compiler proper.
1561
1562 @item -###
1563 @opindex ###
1564 Like @option{-v} except the commands are not executed and arguments
1565 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1566 This is useful for shell scripts to capture the driver-generated command lines.
1567
1568 @item --help
1569 @opindex help
1570 Print (on the standard output) a description of the command-line options
1571 understood by @command{gcc}. If the @option{-v} option is also specified
1572 then @option{--help} is also passed on to the various processes
1573 invoked by @command{gcc}, so that they can display the command-line options
1574 they accept. If the @option{-Wextra} option has also been specified
1575 (prior to the @option{--help} option), then command-line options that
1576 have no documentation associated with them are also displayed.
1577
1578 @item --target-help
1579 @opindex target-help
1580 Print (on the standard output) a description of target-specific command-line
1581 options for each tool. For some targets extra target-specific
1582 information may also be printed.
1583
1584 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1585 Print (on the standard output) a description of the command-line
1586 options understood by the compiler that fit into all specified classes
1587 and qualifiers. These are the supported classes:
1588
1589 @table @asis
1590 @item @samp{optimizers}
1591 Display all of the optimization options supported by the
1592 compiler.
1593
1594 @item @samp{warnings}
1595 Display all of the options controlling warning messages
1596 produced by the compiler.
1597
1598 @item @samp{target}
1599 Display target-specific options. Unlike the
1600 @option{--target-help} option however, target-specific options of the
1601 linker and assembler are not displayed. This is because those
1602 tools do not currently support the extended @option{--help=} syntax.
1603
1604 @item @samp{params}
1605 Display the values recognized by the @option{--param}
1606 option.
1607
1608 @item @var{language}
1609 Display the options supported for @var{language}, where
1610 @var{language} is the name of one of the languages supported in this
1611 version of GCC@.
1612
1613 @item @samp{common}
1614 Display the options that are common to all languages.
1615 @end table
1616
1617 These are the supported qualifiers:
1618
1619 @table @asis
1620 @item @samp{undocumented}
1621 Display only those options that are undocumented.
1622
1623 @item @samp{joined}
1624 Display options taking an argument that appears after an equal
1625 sign in the same continuous piece of text, such as:
1626 @samp{--help=target}.
1627
1628 @item @samp{separate}
1629 Display options taking an argument that appears as a separate word
1630 following the original option, such as: @samp{-o output-file}.
1631 @end table
1632
1633 Thus for example to display all the undocumented target-specific
1634 switches supported by the compiler, use:
1635
1636 @smallexample
1637 --help=target,undocumented
1638 @end smallexample
1639
1640 The sense of a qualifier can be inverted by prefixing it with the
1641 @samp{^} character, so for example to display all binary warning
1642 options (i.e., ones that are either on or off and that do not take an
1643 argument) that have a description, use:
1644
1645 @smallexample
1646 --help=warnings,^joined,^undocumented
1647 @end smallexample
1648
1649 The argument to @option{--help=} should not consist solely of inverted
1650 qualifiers.
1651
1652 Combining several classes is possible, although this usually
1653 restricts the output so much that there is nothing to display. One
1654 case where it does work, however, is when one of the classes is
1655 @var{target}. For example, to display all the target-specific
1656 optimization options, use:
1657
1658 @smallexample
1659 --help=target,optimizers
1660 @end smallexample
1661
1662 The @option{--help=} option can be repeated on the command line. Each
1663 successive use displays its requested class of options, skipping
1664 those that have already been displayed. If @option{--help} is also
1665 specified anywhere on the command line then this takes precedence
1666 over any @option{--help=} option.
1667
1668 If the @option{-Q} option appears on the command line before the
1669 @option{--help=} option, then the descriptive text displayed by
1670 @option{--help=} is changed. Instead of describing the displayed
1671 options, an indication is given as to whether the option is enabled,
1672 disabled or set to a specific value (assuming that the compiler
1673 knows this at the point where the @option{--help=} option is used).
1674
1675 Here is a truncated example from the ARM port of @command{gcc}:
1676
1677 @smallexample
1678 % gcc -Q -mabi=2 --help=target -c
1679 The following options are target specific:
1680 -mabi= 2
1681 -mabort-on-noreturn [disabled]
1682 -mapcs [disabled]
1683 @end smallexample
1684
1685 The output is sensitive to the effects of previous command-line
1686 options, so for example it is possible to find out which optimizations
1687 are enabled at @option{-O2} by using:
1688
1689 @smallexample
1690 -Q -O2 --help=optimizers
1691 @end smallexample
1692
1693 Alternatively you can discover which binary optimizations are enabled
1694 by @option{-O3} by using:
1695
1696 @smallexample
1697 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1698 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1699 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1700 @end smallexample
1701
1702 @item --version
1703 @opindex version
1704 Display the version number and copyrights of the invoked GCC@.
1705
1706 @item -pass-exit-codes
1707 @opindex pass-exit-codes
1708 Normally the @command{gcc} program exits with the code of 1 if any
1709 phase of the compiler returns a non-success return code. If you specify
1710 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1711 the numerically highest error produced by any phase returning an error
1712 indication. The C, C++, and Fortran front ends return 4 if an internal
1713 compiler error is encountered.
1714
1715 @item -pipe
1716 @opindex pipe
1717 Use pipes rather than temporary files for communication between the
1718 various stages of compilation. This fails to work on some systems where
1719 the assembler is unable to read from a pipe; but the GNU assembler has
1720 no trouble.
1721
1722 @item -specs=@var{file}
1723 @opindex specs
1724 Process @var{file} after the compiler reads in the standard @file{specs}
1725 file, in order to override the defaults which the @command{gcc} driver
1726 program uses when determining what switches to pass to @command{cc1},
1727 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1728 @option{-specs=@var{file}} can be specified on the command line, and they
1729 are processed in order, from left to right. @xref{Spec Files}, for
1730 information about the format of the @var{file}.
1731
1732 @item -wrapper
1733 @opindex wrapper
1734 Invoke all subcommands under a wrapper program. The name of the
1735 wrapper program and its parameters are passed as a comma separated
1736 list.
1737
1738 @smallexample
1739 gcc -c t.c -wrapper gdb,--args
1740 @end smallexample
1741
1742 @noindent
1743 This invokes all subprograms of @command{gcc} under
1744 @samp{gdb --args}, thus the invocation of @command{cc1} is
1745 @samp{gdb --args cc1 @dots{}}.
1746
1747 @item -ffile-prefix-map=@var{old}=@var{new}
1748 @opindex ffile-prefix-map
1749 When compiling files residing in directory @file{@var{old}}, record
1750 any references to them in the result of the compilation as if the
1751 files resided in directory @file{@var{new}} instead. Specifying this
1752 option is equivalent to specifying all the individual
1753 @option{-f*-prefix-map} options. This can be used to make reproducible
1754 builds that are location independent. See also
1755 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1756
1757 @item -fplugin=@var{name}.so
1758 @opindex fplugin
1759 Load the plugin code in file @var{name}.so, assumed to be a
1760 shared object to be dlopen'd by the compiler. The base name of
1761 the shared object file is used to identify the plugin for the
1762 purposes of argument parsing (See
1763 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1764 Each plugin should define the callback functions specified in the
1765 Plugins API.
1766
1767 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1768 @opindex fplugin-arg
1769 Define an argument called @var{key} with a value of @var{value}
1770 for the plugin called @var{name}.
1771
1772 @item -fdump-ada-spec@r{[}-slim@r{]}
1773 @opindex fdump-ada-spec
1774 For C and C++ source and include files, generate corresponding Ada specs.
1775 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1776 GNAT User's Guide}, which provides detailed documentation on this feature.
1777
1778 @item -fada-spec-parent=@var{unit}
1779 @opindex fada-spec-parent
1780 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1781 Ada specs as child units of parent @var{unit}.
1782
1783 @item -fdump-go-spec=@var{file}
1784 @opindex fdump-go-spec
1785 For input files in any language, generate corresponding Go
1786 declarations in @var{file}. This generates Go @code{const},
1787 @code{type}, @code{var}, and @code{func} declarations which may be a
1788 useful way to start writing a Go interface to code written in some
1789 other language.
1790
1791 @include @value{srcdir}/../libiberty/at-file.texi
1792 @end table
1793
1794 @node Invoking G++
1795 @section Compiling C++ Programs
1796
1797 @cindex suffixes for C++ source
1798 @cindex C++ source file suffixes
1799 C++ source files conventionally use one of the suffixes @samp{.C},
1800 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1801 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1802 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1803 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1804 files with these names and compiles them as C++ programs even if you
1805 call the compiler the same way as for compiling C programs (usually
1806 with the name @command{gcc}).
1807
1808 @findex g++
1809 @findex c++
1810 However, the use of @command{gcc} does not add the C++ library.
1811 @command{g++} is a program that calls GCC and automatically specifies linking
1812 against the C++ library. It treats @samp{.c},
1813 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1814 files unless @option{-x} is used. This program is also useful when
1815 precompiling a C header file with a @samp{.h} extension for use in C++
1816 compilations. On many systems, @command{g++} is also installed with
1817 the name @command{c++}.
1818
1819 @cindex invoking @command{g++}
1820 When you compile C++ programs, you may specify many of the same
1821 command-line options that you use for compiling programs in any
1822 language; or command-line options meaningful for C and related
1823 languages; or options that are meaningful only for C++ programs.
1824 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1825 explanations of options for languages related to C@.
1826 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1827 explanations of options that are meaningful only for C++ programs.
1828
1829 @node C Dialect Options
1830 @section Options Controlling C Dialect
1831 @cindex dialect options
1832 @cindex language dialect options
1833 @cindex options, dialect
1834
1835 The following options control the dialect of C (or languages derived
1836 from C, such as C++, Objective-C and Objective-C++) that the compiler
1837 accepts:
1838
1839 @table @gcctabopt
1840 @cindex ANSI support
1841 @cindex ISO support
1842 @item -ansi
1843 @opindex ansi
1844 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1845 equivalent to @option{-std=c++98}.
1846
1847 This turns off certain features of GCC that are incompatible with ISO
1848 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1849 such as the @code{asm} and @code{typeof} keywords, and
1850 predefined macros such as @code{unix} and @code{vax} that identify the
1851 type of system you are using. It also enables the undesirable and
1852 rarely used ISO trigraph feature. For the C compiler,
1853 it disables recognition of C++ style @samp{//} comments as well as
1854 the @code{inline} keyword.
1855
1856 The alternate keywords @code{__asm__}, @code{__extension__},
1857 @code{__inline__} and @code{__typeof__} continue to work despite
1858 @option{-ansi}. You would not want to use them in an ISO C program, of
1859 course, but it is useful to put them in header files that might be included
1860 in compilations done with @option{-ansi}. Alternate predefined macros
1861 such as @code{__unix__} and @code{__vax__} are also available, with or
1862 without @option{-ansi}.
1863
1864 The @option{-ansi} option does not cause non-ISO programs to be
1865 rejected gratuitously. For that, @option{-Wpedantic} is required in
1866 addition to @option{-ansi}. @xref{Warning Options}.
1867
1868 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1869 option is used. Some header files may notice this macro and refrain
1870 from declaring certain functions or defining certain macros that the
1871 ISO standard doesn't call for; this is to avoid interfering with any
1872 programs that might use these names for other things.
1873
1874 Functions that are normally built in but do not have semantics
1875 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1876 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1877 built-in functions provided by GCC}, for details of the functions
1878 affected.
1879
1880 @item -std=
1881 @opindex std
1882 Determine the language standard. @xref{Standards,,Language Standards
1883 Supported by GCC}, for details of these standard versions. This option
1884 is currently only supported when compiling C or C++.
1885
1886 The compiler can accept several base standards, such as @samp{c90} or
1887 @samp{c++98}, and GNU dialects of those standards, such as
1888 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1889 compiler accepts all programs following that standard plus those
1890 using GNU extensions that do not contradict it. For example,
1891 @option{-std=c90} turns off certain features of GCC that are
1892 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1893 keywords, but not other GNU extensions that do not have a meaning in
1894 ISO C90, such as omitting the middle term of a @code{?:}
1895 expression. On the other hand, when a GNU dialect of a standard is
1896 specified, all features supported by the compiler are enabled, even when
1897 those features change the meaning of the base standard. As a result, some
1898 strict-conforming programs may be rejected. The particular standard
1899 is used by @option{-Wpedantic} to identify which features are GNU
1900 extensions given that version of the standard. For example
1901 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1902 comments, while @option{-std=gnu99 -Wpedantic} does not.
1903
1904 A value for this option must be provided; possible values are
1905
1906 @table @samp
1907 @item c90
1908 @itemx c89
1909 @itemx iso9899:1990
1910 Support all ISO C90 programs (certain GNU extensions that conflict
1911 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1912
1913 @item iso9899:199409
1914 ISO C90 as modified in amendment 1.
1915
1916 @item c99
1917 @itemx c9x
1918 @itemx iso9899:1999
1919 @itemx iso9899:199x
1920 ISO C99. This standard is substantially completely supported, modulo
1921 bugs and floating-point issues
1922 (mainly but not entirely relating to optional C99 features from
1923 Annexes F and G). See
1924 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1925 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1926
1927 @item c11
1928 @itemx c1x
1929 @itemx iso9899:2011
1930 ISO C11, the 2011 revision of the ISO C standard. This standard is
1931 substantially completely supported, modulo bugs, floating-point issues
1932 (mainly but not entirely relating to optional C11 features from
1933 Annexes F and G) and the optional Annexes K (Bounds-checking
1934 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1935
1936 @item c17
1937 @itemx c18
1938 @itemx iso9899:2017
1939 @itemx iso9899:2018
1940 ISO C17, the 2017 revision of the ISO C standard
1941 (published in 2018). This standard is
1942 same as C11 except for corrections of defects (all of which are also
1943 applied with @option{-std=c11}) and a new value of
1944 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1945
1946 @item c2x
1947 The next version of the ISO C standard, still under development. The
1948 support for this version is experimental and incomplete.
1949
1950 @item gnu90
1951 @itemx gnu89
1952 GNU dialect of ISO C90 (including some C99 features).
1953
1954 @item gnu99
1955 @itemx gnu9x
1956 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1957
1958 @item gnu11
1959 @itemx gnu1x
1960 GNU dialect of ISO C11.
1961 The name @samp{gnu1x} is deprecated.
1962
1963 @item gnu17
1964 @itemx gnu18
1965 GNU dialect of ISO C17. This is the default for C code.
1966
1967 @item gnu2x
1968 The next version of the ISO C standard, still under development, plus
1969 GNU extensions. The support for this version is experimental and
1970 incomplete.
1971
1972 @item c++98
1973 @itemx c++03
1974 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1975 additional defect reports. Same as @option{-ansi} for C++ code.
1976
1977 @item gnu++98
1978 @itemx gnu++03
1979 GNU dialect of @option{-std=c++98}.
1980
1981 @item c++11
1982 @itemx c++0x
1983 The 2011 ISO C++ standard plus amendments.
1984 The name @samp{c++0x} is deprecated.
1985
1986 @item gnu++11
1987 @itemx gnu++0x
1988 GNU dialect of @option{-std=c++11}.
1989 The name @samp{gnu++0x} is deprecated.
1990
1991 @item c++14
1992 @itemx c++1y
1993 The 2014 ISO C++ standard plus amendments.
1994 The name @samp{c++1y} is deprecated.
1995
1996 @item gnu++14
1997 @itemx gnu++1y
1998 GNU dialect of @option{-std=c++14}.
1999 This is the default for C++ code.
2000 The name @samp{gnu++1y} is deprecated.
2001
2002 @item c++17
2003 @itemx c++1z
2004 The 2017 ISO C++ standard plus amendments.
2005 The name @samp{c++1z} is deprecated.
2006
2007 @item gnu++17
2008 @itemx gnu++1z
2009 GNU dialect of @option{-std=c++17}.
2010 The name @samp{gnu++1z} is deprecated.
2011
2012 @item c++2a
2013 The next revision of the ISO C++ standard, tentatively planned for
2014 2020. Support is highly experimental, and will almost certainly
2015 change in incompatible ways in future releases.
2016
2017 @item gnu++2a
2018 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2019 and will almost certainly change in incompatible ways in future
2020 releases.
2021 @end table
2022
2023 @item -fgnu89-inline
2024 @opindex fgnu89-inline
2025 The option @option{-fgnu89-inline} tells GCC to use the traditional
2026 GNU semantics for @code{inline} functions when in C99 mode.
2027 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2028 Using this option is roughly equivalent to adding the
2029 @code{gnu_inline} function attribute to all inline functions
2030 (@pxref{Function Attributes}).
2031
2032 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2033 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2034 specifies the default behavior).
2035 This option is not supported in @option{-std=c90} or
2036 @option{-std=gnu90} mode.
2037
2038 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2039 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2040 in effect for @code{inline} functions. @xref{Common Predefined
2041 Macros,,,cpp,The C Preprocessor}.
2042
2043 @item -fpermitted-flt-eval-methods=@var{style}
2044 @opindex fpermitted-flt-eval-methods
2045 @opindex fpermitted-flt-eval-methods=c11
2046 @opindex fpermitted-flt-eval-methods=ts-18661-3
2047 ISO/IEC TS 18661-3 defines new permissible values for
2048 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2049 a semantic type that is an interchange or extended format should be
2050 evaluated to the precision and range of that type. These new values are
2051 a superset of those permitted under C99/C11, which does not specify the
2052 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2053 conforming to C11 may not have been written expecting the possibility of
2054 the new values.
2055
2056 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2057 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2058 or the extended set of values specified in ISO/IEC TS 18661-3.
2059
2060 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2061
2062 The default when in a standards compliant mode (@option{-std=c11} or similar)
2063 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2064 dialect (@option{-std=gnu11} or similar) is
2065 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2066
2067 @item -aux-info @var{filename}
2068 @opindex aux-info
2069 Output to the given filename prototyped declarations for all functions
2070 declared and/or defined in a translation unit, including those in header
2071 files. This option is silently ignored in any language other than C@.
2072
2073 Besides declarations, the file indicates, in comments, the origin of
2074 each declaration (source file and line), whether the declaration was
2075 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2076 @samp{O} for old, respectively, in the first character after the line
2077 number and the colon), and whether it came from a declaration or a
2078 definition (@samp{C} or @samp{F}, respectively, in the following
2079 character). In the case of function definitions, a K&R-style list of
2080 arguments followed by their declarations is also provided, inside
2081 comments, after the declaration.
2082
2083 @item -fallow-parameterless-variadic-functions
2084 @opindex fallow-parameterless-variadic-functions
2085 Accept variadic functions without named parameters.
2086
2087 Although it is possible to define such a function, this is not very
2088 useful as it is not possible to read the arguments. This is only
2089 supported for C as this construct is allowed by C++.
2090
2091 @item -fno-asm
2092 @opindex fno-asm
2093 @opindex fasm
2094 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2095 keyword, so that code can use these words as identifiers. You can use
2096 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2097 instead. @option{-ansi} implies @option{-fno-asm}.
2098
2099 In C++, this switch only affects the @code{typeof} keyword, since
2100 @code{asm} and @code{inline} are standard keywords. You may want to
2101 use the @option{-fno-gnu-keywords} flag instead, which has the same
2102 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2103 switch only affects the @code{asm} and @code{typeof} keywords, since
2104 @code{inline} is a standard keyword in ISO C99.
2105
2106 @item -fno-builtin
2107 @itemx -fno-builtin-@var{function}
2108 @opindex fno-builtin
2109 @opindex fbuiltin
2110 @cindex built-in functions
2111 Don't recognize built-in functions that do not begin with
2112 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2113 functions provided by GCC}, for details of the functions affected,
2114 including those which are not built-in functions when @option{-ansi} or
2115 @option{-std} options for strict ISO C conformance are used because they
2116 do not have an ISO standard meaning.
2117
2118 GCC normally generates special code to handle certain built-in functions
2119 more efficiently; for instance, calls to @code{alloca} may become single
2120 instructions which adjust the stack directly, and calls to @code{memcpy}
2121 may become inline copy loops. The resulting code is often both smaller
2122 and faster, but since the function calls no longer appear as such, you
2123 cannot set a breakpoint on those calls, nor can you change the behavior
2124 of the functions by linking with a different library. In addition,
2125 when a function is recognized as a built-in function, GCC may use
2126 information about that function to warn about problems with calls to
2127 that function, or to generate more efficient code, even if the
2128 resulting code still contains calls to that function. For example,
2129 warnings are given with @option{-Wformat} for bad calls to
2130 @code{printf} when @code{printf} is built in and @code{strlen} is
2131 known not to modify global memory.
2132
2133 With the @option{-fno-builtin-@var{function}} option
2134 only the built-in function @var{function} is
2135 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2136 function is named that is not built-in in this version of GCC, this
2137 option is ignored. There is no corresponding
2138 @option{-fbuiltin-@var{function}} option; if you wish to enable
2139 built-in functions selectively when using @option{-fno-builtin} or
2140 @option{-ffreestanding}, you may define macros such as:
2141
2142 @smallexample
2143 #define abs(n) __builtin_abs ((n))
2144 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2145 @end smallexample
2146
2147 @item -fgimple
2148 @opindex fgimple
2149
2150 Enable parsing of function definitions marked with @code{__GIMPLE}.
2151 This is an experimental feature that allows unit testing of GIMPLE
2152 passes.
2153
2154 @item -fhosted
2155 @opindex fhosted
2156 @cindex hosted environment
2157
2158 Assert that compilation targets a hosted environment. This implies
2159 @option{-fbuiltin}. A hosted environment is one in which the
2160 entire standard library is available, and in which @code{main} has a return
2161 type of @code{int}. Examples are nearly everything except a kernel.
2162 This is equivalent to @option{-fno-freestanding}.
2163
2164 @item -ffreestanding
2165 @opindex ffreestanding
2166 @cindex hosted environment
2167
2168 Assert that compilation targets a freestanding environment. This
2169 implies @option{-fno-builtin}. A freestanding environment
2170 is one in which the standard library may not exist, and program startup may
2171 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2172 This is equivalent to @option{-fno-hosted}.
2173
2174 @xref{Standards,,Language Standards Supported by GCC}, for details of
2175 freestanding and hosted environments.
2176
2177 @item -fopenacc
2178 @opindex fopenacc
2179 @cindex OpenACC accelerator programming
2180 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2181 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2182 compiler generates accelerated code according to the OpenACC Application
2183 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2184 implies @option{-pthread}, and thus is only supported on targets that
2185 have support for @option{-pthread}.
2186
2187 @item -fopenacc-dim=@var{geom}
2188 @opindex fopenacc-dim
2189 @cindex OpenACC accelerator programming
2190 Specify default compute dimensions for parallel offload regions that do
2191 not explicitly specify. The @var{geom} value is a triple of
2192 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2193 can be omitted, to use a target-specific default value.
2194
2195 @item -fopenmp
2196 @opindex fopenmp
2197 @cindex OpenMP parallel
2198 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2199 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2200 compiler generates parallel code according to the OpenMP Application
2201 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2202 implies @option{-pthread}, and thus is only supported on targets that
2203 have support for @option{-pthread}. @option{-fopenmp} implies
2204 @option{-fopenmp-simd}.
2205
2206 @item -fopenmp-simd
2207 @opindex fopenmp-simd
2208 @cindex OpenMP SIMD
2209 @cindex SIMD
2210 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2211 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2212 are ignored.
2213
2214 @item -fgnu-tm
2215 @opindex fgnu-tm
2216 When the option @option{-fgnu-tm} is specified, the compiler
2217 generates code for the Linux variant of Intel's current Transactional
2218 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2219 an experimental feature whose interface may change in future versions
2220 of GCC, as the official specification changes. Please note that not
2221 all architectures are supported for this feature.
2222
2223 For more information on GCC's support for transactional memory,
2224 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2225 Transactional Memory Library}.
2226
2227 Note that the transactional memory feature is not supported with
2228 non-call exceptions (@option{-fnon-call-exceptions}).
2229
2230 @item -fms-extensions
2231 @opindex fms-extensions
2232 Accept some non-standard constructs used in Microsoft header files.
2233
2234 In C++ code, this allows member names in structures to be similar
2235 to previous types declarations.
2236
2237 @smallexample
2238 typedef int UOW;
2239 struct ABC @{
2240 UOW UOW;
2241 @};
2242 @end smallexample
2243
2244 Some cases of unnamed fields in structures and unions are only
2245 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2246 fields within structs/unions}, for details.
2247
2248 Note that this option is off for all targets except for x86
2249 targets using ms-abi.
2250
2251 @item -fplan9-extensions
2252 @opindex fplan9-extensions
2253 Accept some non-standard constructs used in Plan 9 code.
2254
2255 This enables @option{-fms-extensions}, permits passing pointers to
2256 structures with anonymous fields to functions that expect pointers to
2257 elements of the type of the field, and permits referring to anonymous
2258 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2259 struct/union fields within structs/unions}, for details. This is only
2260 supported for C, not C++.
2261
2262 @item -fcond-mismatch
2263 @opindex fcond-mismatch
2264 Allow conditional expressions with mismatched types in the second and
2265 third arguments. The value of such an expression is void. This option
2266 is not supported for C++.
2267
2268 @item -flax-vector-conversions
2269 @opindex flax-vector-conversions
2270 Allow implicit conversions between vectors with differing numbers of
2271 elements and/or incompatible element types. This option should not be
2272 used for new code.
2273
2274 @item -funsigned-char
2275 @opindex funsigned-char
2276 Let the type @code{char} be unsigned, like @code{unsigned char}.
2277
2278 Each kind of machine has a default for what @code{char} should
2279 be. It is either like @code{unsigned char} by default or like
2280 @code{signed char} by default.
2281
2282 Ideally, a portable program should always use @code{signed char} or
2283 @code{unsigned char} when it depends on the signedness of an object.
2284 But many programs have been written to use plain @code{char} and
2285 expect it to be signed, or expect it to be unsigned, depending on the
2286 machines they were written for. This option, and its inverse, let you
2287 make such a program work with the opposite default.
2288
2289 The type @code{char} is always a distinct type from each of
2290 @code{signed char} or @code{unsigned char}, even though its behavior
2291 is always just like one of those two.
2292
2293 @item -fsigned-char
2294 @opindex fsigned-char
2295 Let the type @code{char} be signed, like @code{signed char}.
2296
2297 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2298 the negative form of @option{-funsigned-char}. Likewise, the option
2299 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2300
2301 @item -fsigned-bitfields
2302 @itemx -funsigned-bitfields
2303 @itemx -fno-signed-bitfields
2304 @itemx -fno-unsigned-bitfields
2305 @opindex fsigned-bitfields
2306 @opindex funsigned-bitfields
2307 @opindex fno-signed-bitfields
2308 @opindex fno-unsigned-bitfields
2309 These options control whether a bit-field is signed or unsigned, when the
2310 declaration does not use either @code{signed} or @code{unsigned}. By
2311 default, such a bit-field is signed, because this is consistent: the
2312 basic integer types such as @code{int} are signed types.
2313
2314 @item -fsso-struct=@var{endianness}
2315 @opindex fsso-struct
2316 Set the default scalar storage order of structures and unions to the
2317 specified endianness. The accepted values are @samp{big-endian},
2318 @samp{little-endian} and @samp{native} for the native endianness of
2319 the target (the default). This option is not supported for C++.
2320
2321 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2322 code that is not binary compatible with code generated without it if the
2323 specified endianness is not the native endianness of the target.
2324 @end table
2325
2326 @node C++ Dialect Options
2327 @section Options Controlling C++ Dialect
2328
2329 @cindex compiler options, C++
2330 @cindex C++ options, command-line
2331 @cindex options, C++
2332 This section describes the command-line options that are only meaningful
2333 for C++ programs. You can also use most of the GNU compiler options
2334 regardless of what language your program is in. For example, you
2335 might compile a file @file{firstClass.C} like this:
2336
2337 @smallexample
2338 g++ -g -fstrict-enums -O -c firstClass.C
2339 @end smallexample
2340
2341 @noindent
2342 In this example, only @option{-fstrict-enums} is an option meant
2343 only for C++ programs; you can use the other options with any
2344 language supported by GCC@.
2345
2346 Some options for compiling C programs, such as @option{-std}, are also
2347 relevant for C++ programs.
2348 @xref{C Dialect Options,,Options Controlling C Dialect}.
2349
2350 Here is a list of options that are @emph{only} for compiling C++ programs:
2351
2352 @table @gcctabopt
2353
2354 @item -fabi-version=@var{n}
2355 @opindex fabi-version
2356 Use version @var{n} of the C++ ABI@. The default is version 0.
2357
2358 Version 0 refers to the version conforming most closely to
2359 the C++ ABI specification. Therefore, the ABI obtained using version 0
2360 will change in different versions of G++ as ABI bugs are fixed.
2361
2362 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2363
2364 Version 2 is the version of the C++ ABI that first appeared in G++
2365 3.4, and was the default through G++ 4.9.
2366
2367 Version 3 corrects an error in mangling a constant address as a
2368 template argument.
2369
2370 Version 4, which first appeared in G++ 4.5, implements a standard
2371 mangling for vector types.
2372
2373 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2374 attribute const/volatile on function pointer types, decltype of a
2375 plain decl, and use of a function parameter in the declaration of
2376 another parameter.
2377
2378 Version 6, which first appeared in G++ 4.7, corrects the promotion
2379 behavior of C++11 scoped enums and the mangling of template argument
2380 packs, const/static_cast, prefix ++ and --, and a class scope function
2381 used as a template argument.
2382
2383 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2384 builtin type and corrects the mangling of lambdas in default argument
2385 scope.
2386
2387 Version 8, which first appeared in G++ 4.9, corrects the substitution
2388 behavior of function types with function-cv-qualifiers.
2389
2390 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2391 @code{nullptr_t}.
2392
2393 Version 10, which first appeared in G++ 6.1, adds mangling of
2394 attributes that affect type identity, such as ia32 calling convention
2395 attributes (e.g.@: @samp{stdcall}).
2396
2397 Version 11, which first appeared in G++ 7, corrects the mangling of
2398 sizeof... expressions and operator names. For multiple entities with
2399 the same name within a function, that are declared in different scopes,
2400 the mangling now changes starting with the twelfth occurrence. It also
2401 implies @option{-fnew-inheriting-ctors}.
2402
2403 Version 12, which first appeared in G++ 8, corrects the calling
2404 conventions for empty classes on the x86_64 target and for classes
2405 with only deleted copy/move constructors. It accidentally changes the
2406 calling convention for classes with a deleted copy constructor and a
2407 trivial move constructor.
2408
2409 Version 13, which first appeared in G++ 8.2, fixes the accidental
2410 change in version 12.
2411
2412 See also @option{-Wabi}.
2413
2414 @item -fabi-compat-version=@var{n}
2415 @opindex fabi-compat-version
2416 On targets that support strong aliases, G++
2417 works around mangling changes by creating an alias with the correct
2418 mangled name when defining a symbol with an incorrect mangled name.
2419 This switch specifies which ABI version to use for the alias.
2420
2421 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2422 compatibility). If another ABI version is explicitly selected, this
2423 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2424 use @option{-fabi-compat-version=2}.
2425
2426 If this option is not provided but @option{-Wabi=@var{n}} is, that
2427 version is used for compatibility aliases. If this option is provided
2428 along with @option{-Wabi} (without the version), the version from this
2429 option is used for the warning.
2430
2431 @item -fno-access-control
2432 @opindex fno-access-control
2433 @opindex faccess-control
2434 Turn off all access checking. This switch is mainly useful for working
2435 around bugs in the access control code.
2436
2437 @item -faligned-new
2438 @opindex faligned-new
2439 Enable support for C++17 @code{new} of types that require more
2440 alignment than @code{void* ::operator new(std::size_t)} provides. A
2441 numeric argument such as @code{-faligned-new=32} can be used to
2442 specify how much alignment (in bytes) is provided by that function,
2443 but few users will need to override the default of
2444 @code{alignof(std::max_align_t)}.
2445
2446 This flag is enabled by default for @option{-std=c++17}.
2447
2448 @item -fchar8_t
2449 @itemx -fno-char8_t
2450 @opindex fchar8_t
2451 @opindex fno-char8_t
2452 Enable support for @code{char8_t} as adopted for C++2a. This includes
2453 the addition of a new @code{char8_t} fundamental type, changes to the
2454 types of UTF-8 string and character literals, new signatures for
2455 user-defined literals, associated standard library updates, and new
2456 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2457
2458 This option enables functions to be overloaded for ordinary and UTF-8
2459 strings:
2460
2461 @smallexample
2462 int f(const char *); // #1
2463 int f(const char8_t *); // #2
2464 int v1 = f("text"); // Calls #1
2465 int v2 = f(u8"text"); // Calls #2
2466 @end smallexample
2467
2468 @noindent
2469 and introduces new signatures for user-defined literals:
2470
2471 @smallexample
2472 int operator""_udl1(char8_t);
2473 int v3 = u8'x'_udl1;
2474 int operator""_udl2(const char8_t*, std::size_t);
2475 int v4 = u8"text"_udl2;
2476 template<typename T, T...> int operator""_udl3();
2477 int v5 = u8"text"_udl3;
2478 @end smallexample
2479
2480 @noindent
2481 The change to the types of UTF-8 string and character literals introduces
2482 incompatibilities with ISO C++11 and later standards. For example, the
2483 following code is well-formed under ISO C++11, but is ill-formed when
2484 @option{-fchar8_t} is specified.
2485
2486 @smallexample
2487 char ca[] = u8"xx"; // error: char-array initialized from wide
2488 // string
2489 const char *cp = u8"xx";// error: invalid conversion from
2490 // `const char8_t*' to `const char*'
2491 int f(const char*);
2492 auto v = f(u8"xx"); // error: invalid conversion from
2493 // `const char8_t*' to `const char*'
2494 std::string s@{u8"xx"@}; // error: no matching function for call to
2495 // `std::basic_string<char>::basic_string()'
2496 using namespace std::literals;
2497 s = u8"xx"s; // error: conversion from
2498 // `basic_string<char8_t>' to non-scalar
2499 // type `basic_string<char>' requested
2500 @end smallexample
2501
2502 @item -fcheck-new
2503 @opindex fcheck-new
2504 Check that the pointer returned by @code{operator new} is non-null
2505 before attempting to modify the storage allocated. This check is
2506 normally unnecessary because the C++ standard specifies that
2507 @code{operator new} only returns @code{0} if it is declared
2508 @code{throw()}, in which case the compiler always checks the
2509 return value even without this option. In all other cases, when
2510 @code{operator new} has a non-empty exception specification, memory
2511 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2512 @samp{new (nothrow)}.
2513
2514 @item -fconcepts
2515 @opindex fconcepts
2516 Enable support for the C++ Extensions for Concepts Technical
2517 Specification, ISO 19217 (2015), which allows code like
2518
2519 @smallexample
2520 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2521 template <Addable T> T add (T a, T b) @{ return a + b; @}
2522 @end smallexample
2523
2524 @item -fconstexpr-depth=@var{n}
2525 @opindex fconstexpr-depth
2526 Set the maximum nested evaluation depth for C++11 constexpr functions
2527 to @var{n}. A limit is needed to detect endless recursion during
2528 constant expression evaluation. The minimum specified by the standard
2529 is 512.
2530
2531 @item -fconstexpr-cache-depth=@var{n}
2532 @opindex fconstexpr-cache-depth
2533 Set the maximum level of nested evaluation depth for C++11 constexpr
2534 functions that will be cached to @var{n}. This is a heuristic that
2535 trades off compilation speed (when the cache avoids repeated
2536 calculations) against memory consumption (when the cache grows very
2537 large from highly recursive evaluations). The default is 8. Very few
2538 users are likely to want to adjust it, but if your code does heavy
2539 constexpr calculations you might want to experiment to find which
2540 value works best for you.
2541
2542 @item -fconstexpr-loop-limit=@var{n}
2543 @opindex fconstexpr-loop-limit
2544 Set the maximum number of iterations for a loop in C++14 constexpr functions
2545 to @var{n}. A limit is needed to detect infinite loops during
2546 constant expression evaluation. The default is 262144 (1<<18).
2547
2548 @item -fconstexpr-ops-limit=@var{n}
2549 @opindex fconstexpr-ops-limit
2550 Set the maximum number of operations during a single constexpr evaluation.
2551 Even when number of iterations of a single loop is limited with the above limit,
2552 if there are several nested loops and each of them has many iterations but still
2553 smaller than the above limit, or if in a body of some loop or even outside
2554 of a loop too many expressions need to be evaluated, the resulting constexpr
2555 evaluation might take too long.
2556 The default is 33554432 (1<<25).
2557
2558 @item -fno-elide-constructors
2559 @opindex fno-elide-constructors
2560 @opindex felide-constructors
2561 The C++ standard allows an implementation to omit creating a temporary
2562 that is only used to initialize another object of the same type.
2563 Specifying this option disables that optimization, and forces G++ to
2564 call the copy constructor in all cases. This option also causes G++
2565 to call trivial member functions which otherwise would be expanded inline.
2566
2567 In C++17, the compiler is required to omit these temporaries, but this
2568 option still affects trivial member functions.
2569
2570 @item -fno-enforce-eh-specs
2571 @opindex fno-enforce-eh-specs
2572 @opindex fenforce-eh-specs
2573 Don't generate code to check for violation of exception specifications
2574 at run time. This option violates the C++ standard, but may be useful
2575 for reducing code size in production builds, much like defining
2576 @code{NDEBUG}. This does not give user code permission to throw
2577 exceptions in violation of the exception specifications; the compiler
2578 still optimizes based on the specifications, so throwing an
2579 unexpected exception results in undefined behavior at run time.
2580
2581 @item -fextern-tls-init
2582 @itemx -fno-extern-tls-init
2583 @opindex fextern-tls-init
2584 @opindex fno-extern-tls-init
2585 The C++11 and OpenMP standards allow @code{thread_local} and
2586 @code{threadprivate} variables to have dynamic (runtime)
2587 initialization. To support this, any use of such a variable goes
2588 through a wrapper function that performs any necessary initialization.
2589 When the use and definition of the variable are in the same
2590 translation unit, this overhead can be optimized away, but when the
2591 use is in a different translation unit there is significant overhead
2592 even if the variable doesn't actually need dynamic initialization. If
2593 the programmer can be sure that no use of the variable in a
2594 non-defining TU needs to trigger dynamic initialization (either
2595 because the variable is statically initialized, or a use of the
2596 variable in the defining TU will be executed before any uses in
2597 another TU), they can avoid this overhead with the
2598 @option{-fno-extern-tls-init} option.
2599
2600 On targets that support symbol aliases, the default is
2601 @option{-fextern-tls-init}. On targets that do not support symbol
2602 aliases, the default is @option{-fno-extern-tls-init}.
2603
2604 @item -fno-gnu-keywords
2605 @opindex fno-gnu-keywords
2606 @opindex fgnu-keywords
2607 Do not recognize @code{typeof} as a keyword, so that code can use this
2608 word as an identifier. You can use the keyword @code{__typeof__} instead.
2609 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2610 @option{-std=c++98}, @option{-std=c++11}, etc.
2611
2612 @item -fno-implicit-templates
2613 @opindex fno-implicit-templates
2614 @opindex fimplicit-templates
2615 Never emit code for non-inline templates that are instantiated
2616 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2617 If you use this option, you must take care to structure your code to
2618 include all the necessary explicit instantiations to avoid getting
2619 undefined symbols at link time.
2620 @xref{Template Instantiation}, for more information.
2621
2622 @item -fno-implicit-inline-templates
2623 @opindex fno-implicit-inline-templates
2624 @opindex fimplicit-inline-templates
2625 Don't emit code for implicit instantiations of inline templates, either.
2626 The default is to handle inlines differently so that compiles with and
2627 without optimization need the same set of explicit instantiations.
2628
2629 @item -fno-implement-inlines
2630 @opindex fno-implement-inlines
2631 @opindex fimplement-inlines
2632 To save space, do not emit out-of-line copies of inline functions
2633 controlled by @code{#pragma implementation}. This causes linker
2634 errors if these functions are not inlined everywhere they are called.
2635
2636 @item -fms-extensions
2637 @opindex fms-extensions
2638 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2639 int and getting a pointer to member function via non-standard syntax.
2640
2641 @item -fnew-inheriting-ctors
2642 @opindex fnew-inheriting-ctors
2643 Enable the P0136 adjustment to the semantics of C++11 constructor
2644 inheritance. This is part of C++17 but also considered to be a Defect
2645 Report against C++11 and C++14. This flag is enabled by default
2646 unless @option{-fabi-version=10} or lower is specified.
2647
2648 @item -fnew-ttp-matching
2649 @opindex fnew-ttp-matching
2650 Enable the P0522 resolution to Core issue 150, template template
2651 parameters and default arguments: this allows a template with default
2652 template arguments as an argument for a template template parameter
2653 with fewer template parameters. This flag is enabled by default for
2654 @option{-std=c++17}.
2655
2656 @item -fno-nonansi-builtins
2657 @opindex fno-nonansi-builtins
2658 @opindex fnonansi-builtins
2659 Disable built-in declarations of functions that are not mandated by
2660 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2661 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2662
2663 @item -fnothrow-opt
2664 @opindex fnothrow-opt
2665 Treat a @code{throw()} exception specification as if it were a
2666 @code{noexcept} specification to reduce or eliminate the text size
2667 overhead relative to a function with no exception specification. If
2668 the function has local variables of types with non-trivial
2669 destructors, the exception specification actually makes the
2670 function smaller because the EH cleanups for those variables can be
2671 optimized away. The semantic effect is that an exception thrown out of
2672 a function with such an exception specification results in a call
2673 to @code{terminate} rather than @code{unexpected}.
2674
2675 @item -fno-operator-names
2676 @opindex fno-operator-names
2677 @opindex foperator-names
2678 Do not treat the operator name keywords @code{and}, @code{bitand},
2679 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2680 synonyms as keywords.
2681
2682 @item -fno-optional-diags
2683 @opindex fno-optional-diags
2684 @opindex foptional-diags
2685 Disable diagnostics that the standard says a compiler does not need to
2686 issue. Currently, the only such diagnostic issued by G++ is the one for
2687 a name having multiple meanings within a class.
2688
2689 @item -fpermissive
2690 @opindex fpermissive
2691 Downgrade some diagnostics about nonconformant code from errors to
2692 warnings. Thus, using @option{-fpermissive} allows some
2693 nonconforming code to compile.
2694
2695 @item -fno-pretty-templates
2696 @opindex fno-pretty-templates
2697 @opindex fpretty-templates
2698 When an error message refers to a specialization of a function
2699 template, the compiler normally prints the signature of the
2700 template followed by the template arguments and any typedefs or
2701 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2702 rather than @code{void f(int)}) so that it's clear which template is
2703 involved. When an error message refers to a specialization of a class
2704 template, the compiler omits any template arguments that match
2705 the default template arguments for that template. If either of these
2706 behaviors make it harder to understand the error message rather than
2707 easier, you can use @option{-fno-pretty-templates} to disable them.
2708
2709 @item -fno-rtti
2710 @opindex fno-rtti
2711 @opindex frtti
2712 Disable generation of information about every class with virtual
2713 functions for use by the C++ run-time type identification features
2714 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2715 of the language, you can save some space by using this flag. Note that
2716 exception handling uses the same information, but G++ generates it as
2717 needed. The @code{dynamic_cast} operator can still be used for casts that
2718 do not require run-time type information, i.e.@: casts to @code{void *} or to
2719 unambiguous base classes.
2720
2721 Mixing code compiled with @option{-frtti} with that compiled with
2722 @option{-fno-rtti} may not work. For example, programs may
2723 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2724 for a class compiled with @option{-frtti}.
2725
2726 @item -fsized-deallocation
2727 @opindex fsized-deallocation
2728 Enable the built-in global declarations
2729 @smallexample
2730 void operator delete (void *, std::size_t) noexcept;
2731 void operator delete[] (void *, std::size_t) noexcept;
2732 @end smallexample
2733 as introduced in C++14. This is useful for user-defined replacement
2734 deallocation functions that, for example, use the size of the object
2735 to make deallocation faster. Enabled by default under
2736 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2737 warns about places that might want to add a definition.
2738
2739 @item -fstrict-enums
2740 @opindex fstrict-enums
2741 Allow the compiler to optimize using the assumption that a value of
2742 enumerated type can only be one of the values of the enumeration (as
2743 defined in the C++ standard; basically, a value that can be
2744 represented in the minimum number of bits needed to represent all the
2745 enumerators). This assumption may not be valid if the program uses a
2746 cast to convert an arbitrary integer value to the enumerated type.
2747
2748 @item -fstrong-eval-order
2749 @opindex fstrong-eval-order
2750 Evaluate member access, array subscripting, and shift expressions in
2751 left-to-right order, and evaluate assignment in right-to-left order,
2752 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2753 @option{-fstrong-eval-order=some} enables just the ordering of member
2754 access and shift expressions, and is the default without
2755 @option{-std=c++17}.
2756
2757 @item -ftemplate-backtrace-limit=@var{n}
2758 @opindex ftemplate-backtrace-limit
2759 Set the maximum number of template instantiation notes for a single
2760 warning or error to @var{n}. The default value is 10.
2761
2762 @item -ftemplate-depth=@var{n}
2763 @opindex ftemplate-depth
2764 Set the maximum instantiation depth for template classes to @var{n}.
2765 A limit on the template instantiation depth is needed to detect
2766 endless recursions during template class instantiation. ANSI/ISO C++
2767 conforming programs must not rely on a maximum depth greater than 17
2768 (changed to 1024 in C++11). The default value is 900, as the compiler
2769 can run out of stack space before hitting 1024 in some situations.
2770
2771 @item -fno-threadsafe-statics
2772 @opindex fno-threadsafe-statics
2773 @opindex fthreadsafe-statics
2774 Do not emit the extra code to use the routines specified in the C++
2775 ABI for thread-safe initialization of local statics. You can use this
2776 option to reduce code size slightly in code that doesn't need to be
2777 thread-safe.
2778
2779 @item -fuse-cxa-atexit
2780 @opindex fuse-cxa-atexit
2781 Register destructors for objects with static storage duration with the
2782 @code{__cxa_atexit} function rather than the @code{atexit} function.
2783 This option is required for fully standards-compliant handling of static
2784 destructors, but only works if your C library supports
2785 @code{__cxa_atexit}.
2786
2787 @item -fno-use-cxa-get-exception-ptr
2788 @opindex fno-use-cxa-get-exception-ptr
2789 @opindex fuse-cxa-get-exception-ptr
2790 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2791 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2792 if the runtime routine is not available.
2793
2794 @item -fvisibility-inlines-hidden
2795 @opindex fvisibility-inlines-hidden
2796 This switch declares that the user does not attempt to compare
2797 pointers to inline functions or methods where the addresses of the two functions
2798 are taken in different shared objects.
2799
2800 The effect of this is that GCC may, effectively, mark inline methods with
2801 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2802 appear in the export table of a DSO and do not require a PLT indirection
2803 when used within the DSO@. Enabling this option can have a dramatic effect
2804 on load and link times of a DSO as it massively reduces the size of the
2805 dynamic export table when the library makes heavy use of templates.
2806
2807 The behavior of this switch is not quite the same as marking the
2808 methods as hidden directly, because it does not affect static variables
2809 local to the function or cause the compiler to deduce that
2810 the function is defined in only one shared object.
2811
2812 You may mark a method as having a visibility explicitly to negate the
2813 effect of the switch for that method. For example, if you do want to
2814 compare pointers to a particular inline method, you might mark it as
2815 having default visibility. Marking the enclosing class with explicit
2816 visibility has no effect.
2817
2818 Explicitly instantiated inline methods are unaffected by this option
2819 as their linkage might otherwise cross a shared library boundary.
2820 @xref{Template Instantiation}.
2821
2822 @item -fvisibility-ms-compat
2823 @opindex fvisibility-ms-compat
2824 This flag attempts to use visibility settings to make GCC's C++
2825 linkage model compatible with that of Microsoft Visual Studio.
2826
2827 The flag makes these changes to GCC's linkage model:
2828
2829 @enumerate
2830 @item
2831 It sets the default visibility to @code{hidden}, like
2832 @option{-fvisibility=hidden}.
2833
2834 @item
2835 Types, but not their members, are not hidden by default.
2836
2837 @item
2838 The One Definition Rule is relaxed for types without explicit
2839 visibility specifications that are defined in more than one
2840 shared object: those declarations are permitted if they are
2841 permitted when this option is not used.
2842 @end enumerate
2843
2844 In new code it is better to use @option{-fvisibility=hidden} and
2845 export those classes that are intended to be externally visible.
2846 Unfortunately it is possible for code to rely, perhaps accidentally,
2847 on the Visual Studio behavior.
2848
2849 Among the consequences of these changes are that static data members
2850 of the same type with the same name but defined in different shared
2851 objects are different, so changing one does not change the other;
2852 and that pointers to function members defined in different shared
2853 objects may not compare equal. When this flag is given, it is a
2854 violation of the ODR to define types with the same name differently.
2855
2856 @item -fno-weak
2857 @opindex fno-weak
2858 @opindex fweak
2859 Do not use weak symbol support, even if it is provided by the linker.
2860 By default, G++ uses weak symbols if they are available. This
2861 option exists only for testing, and should not be used by end-users;
2862 it results in inferior code and has no benefits. This option may
2863 be removed in a future release of G++.
2864
2865 @item -nostdinc++
2866 @opindex nostdinc++
2867 Do not search for header files in the standard directories specific to
2868 C++, but do still search the other standard directories. (This option
2869 is used when building the C++ library.)
2870 @end table
2871
2872 In addition, these optimization, warning, and code generation options
2873 have meanings only for C++ programs:
2874
2875 @table @gcctabopt
2876 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2877 @opindex Wabi
2878 @opindex Wno-abi
2879 Warn when G++ it generates code that is probably not compatible with
2880 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2881 ABI with each major release, normally @option{-Wabi} will warn only if
2882 there is a check added later in a release series for an ABI issue
2883 discovered since the initial release. @option{-Wabi} will warn about
2884 more things if an older ABI version is selected (with
2885 @option{-fabi-version=@var{n}}).
2886
2887 @option{-Wabi} can also be used with an explicit version number to
2888 warn about compatibility with a particular @option{-fabi-version}
2889 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2890 @option{-fabi-version=2}.
2891
2892 If an explicit version number is provided and
2893 @option{-fabi-compat-version} is not specified, the version number
2894 from this option is used for compatibility aliases. If no explicit
2895 version number is provided with this option, but
2896 @option{-fabi-compat-version} is specified, that version number is
2897 used for ABI warnings.
2898
2899 Although an effort has been made to warn about
2900 all such cases, there are probably some cases that are not warned about,
2901 even though G++ is generating incompatible code. There may also be
2902 cases where warnings are emitted even though the code that is generated
2903 is compatible.
2904
2905 You should rewrite your code to avoid these warnings if you are
2906 concerned about the fact that code generated by G++ may not be binary
2907 compatible with code generated by other compilers.
2908
2909 Known incompatibilities in @option{-fabi-version=2} (which was the
2910 default from GCC 3.4 to 4.9) include:
2911
2912 @itemize @bullet
2913
2914 @item
2915 A template with a non-type template parameter of reference type was
2916 mangled incorrectly:
2917 @smallexample
2918 extern int N;
2919 template <int &> struct S @{@};
2920 void n (S<N>) @{2@}
2921 @end smallexample
2922
2923 This was fixed in @option{-fabi-version=3}.
2924
2925 @item
2926 SIMD vector types declared using @code{__attribute ((vector_size))} were
2927 mangled in a non-standard way that does not allow for overloading of
2928 functions taking vectors of different sizes.
2929
2930 The mangling was changed in @option{-fabi-version=4}.
2931
2932 @item
2933 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2934 qualifiers, and @code{decltype} of a plain declaration was folded away.
2935
2936 These mangling issues were fixed in @option{-fabi-version=5}.
2937
2938 @item
2939 Scoped enumerators passed as arguments to a variadic function are
2940 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2941 On most targets this does not actually affect the parameter passing
2942 ABI, as there is no way to pass an argument smaller than @code{int}.
2943
2944 Also, the ABI changed the mangling of template argument packs,
2945 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2946 a class scope function used as a template argument.
2947
2948 These issues were corrected in @option{-fabi-version=6}.
2949
2950 @item
2951 Lambdas in default argument scope were mangled incorrectly, and the
2952 ABI changed the mangling of @code{nullptr_t}.
2953
2954 These issues were corrected in @option{-fabi-version=7}.
2955
2956 @item
2957 When mangling a function type with function-cv-qualifiers, the
2958 un-qualified function type was incorrectly treated as a substitution
2959 candidate.
2960
2961 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2962
2963 @item
2964 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2965 unaligned accesses. Note that this did not affect the ABI of a
2966 function with a @code{nullptr_t} parameter, as parameters have a
2967 minimum alignment.
2968
2969 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2970
2971 @item
2972 Target-specific attributes that affect the identity of a type, such as
2973 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2974 did not affect the mangled name, leading to name collisions when
2975 function pointers were used as template arguments.
2976
2977 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2978
2979 @end itemize
2980
2981 It also warns about psABI-related changes. The known psABI changes at this
2982 point include:
2983
2984 @itemize @bullet
2985
2986 @item
2987 For SysV/x86-64, unions with @code{long double} members are
2988 passed in memory as specified in psABI. For example:
2989
2990 @smallexample
2991 union U @{
2992 long double ld;
2993 int i;
2994 @};
2995 @end smallexample
2996
2997 @noindent
2998 @code{union U} is always passed in memory.
2999
3000 @end itemize
3001
3002 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3003 @opindex Wabi-tag
3004 @opindex Wabi-tag
3005 Warn when a type with an ABI tag is used in a context that does not
3006 have that ABI tag. See @ref{C++ Attributes} for more information
3007 about ABI tags.
3008
3009 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3010 @opindex Wcomma-subscript
3011 @opindex Wno-comma-subscript
3012 Warn about uses of a comma expression within a subscripting expression.
3013 This usage was deprecated in C++2a. However, a comma expression wrapped
3014 in @code{( )} is not deprecated. Example:
3015
3016 @smallexample
3017 @group
3018 void f(int *a, int b, int c) @{
3019 a[b,c]; // deprecated
3020 a[(b,c)]; // OK
3021 @}
3022 @end group
3023 @end smallexample
3024
3025 Enabled by default with @option{-std=c++2a}.
3026
3027 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3028 @opindex Wctor-dtor-privacy
3029 @opindex Wno-ctor-dtor-privacy
3030 Warn when a class seems unusable because all the constructors or
3031 destructors in that class are private, and it has neither friends nor
3032 public static member functions. Also warn if there are no non-private
3033 methods, and there's at least one private member function that isn't
3034 a constructor or destructor.
3035
3036 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3037 @opindex Wdelete-non-virtual-dtor
3038 @opindex Wno-delete-non-virtual-dtor
3039 Warn when @code{delete} is used to destroy an instance of a class that
3040 has virtual functions and non-virtual destructor. It is unsafe to delete
3041 an instance of a derived class through a pointer to a base class if the
3042 base class does not have a virtual destructor. This warning is enabled
3043 by @option{-Wall}.
3044
3045 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3046 @opindex Wdeprecated-copy
3047 @opindex Wno-deprecated-copy
3048 Warn that the implicit declaration of a copy constructor or copy
3049 assignment operator is deprecated if the class has a user-provided
3050 copy constructor or copy assignment operator, in C++11 and up. This
3051 warning is enabled by @option{-Wextra}. With
3052 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3053 user-provided destructor.
3054
3055 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3056 @opindex Winit-list-lifetime
3057 @opindex Wno-init-list-lifetime
3058 Do not warn about uses of @code{std::initializer_list} that are likely
3059 to result in dangling pointers. Since the underlying array for an
3060 @code{initializer_list} is handled like a normal C++ temporary object,
3061 it is easy to inadvertently keep a pointer to the array past the end
3062 of the array's lifetime. For example:
3063
3064 @itemize @bullet
3065 @item
3066 If a function returns a temporary @code{initializer_list}, or a local
3067 @code{initializer_list} variable, the array's lifetime ends at the end
3068 of the return statement, so the value returned has a dangling pointer.
3069
3070 @item
3071 If a new-expression creates an @code{initializer_list}, the array only
3072 lives until the end of the enclosing full-expression, so the
3073 @code{initializer_list} in the heap has a dangling pointer.
3074
3075 @item
3076 When an @code{initializer_list} variable is assigned from a
3077 brace-enclosed initializer list, the temporary array created for the
3078 right side of the assignment only lives until the end of the
3079 full-expression, so at the next statement the @code{initializer_list}
3080 variable has a dangling pointer.
3081
3082 @smallexample
3083 // li's initial underlying array lives as long as li
3084 std::initializer_list<int> li = @{ 1,2,3 @};
3085 // assignment changes li to point to a temporary array
3086 li = @{ 4, 5 @};
3087 // now the temporary is gone and li has a dangling pointer
3088 int i = li.begin()[0] // undefined behavior
3089 @end smallexample
3090
3091 @item
3092 When a list constructor stores the @code{begin} pointer from the
3093 @code{initializer_list} argument, this doesn't extend the lifetime of
3094 the array, so if a class variable is constructed from a temporary
3095 @code{initializer_list}, the pointer is left dangling by the end of
3096 the variable declaration statement.
3097
3098 @end itemize
3099
3100 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3101 @opindex Wliteral-suffix
3102 @opindex Wno-literal-suffix
3103 Warn when a string or character literal is followed by a ud-suffix which does
3104 not begin with an underscore. As a conforming extension, GCC treats such
3105 suffixes as separate preprocessing tokens in order to maintain backwards
3106 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3107 For example:
3108
3109 @smallexample
3110 #define __STDC_FORMAT_MACROS
3111 #include <inttypes.h>
3112 #include <stdio.h>
3113
3114 int main() @{
3115 int64_t i64 = 123;
3116 printf("My int64: %" PRId64"\n", i64);
3117 @}
3118 @end smallexample
3119
3120 In this case, @code{PRId64} is treated as a separate preprocessing token.
3121
3122 Additionally, warn when a user-defined literal operator is declared with
3123 a literal suffix identifier that doesn't begin with an underscore. Literal
3124 suffix identifiers that don't begin with an underscore are reserved for
3125 future standardization.
3126
3127 This warning is enabled by default.
3128
3129 @item -Wlto-type-mismatch
3130 @opindex Wlto-type-mismatch
3131 @opindex Wno-lto-type-mismatch
3132
3133 During the link-time optimization warn about type mismatches in
3134 global declarations from different compilation units.
3135 Requires @option{-flto} to be enabled. Enabled by default.
3136
3137 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3138 @opindex Wnarrowing
3139 @opindex Wno-narrowing
3140 For C++11 and later standards, narrowing conversions are diagnosed by default,
3141 as required by the standard. A narrowing conversion from a constant produces
3142 an error, and a narrowing conversion from a non-constant produces a warning,
3143 but @option{-Wno-narrowing} suppresses the diagnostic.
3144 Note that this does not affect the meaning of well-formed code;
3145 narrowing conversions are still considered ill-formed in SFINAE contexts.
3146
3147 With @option{-Wnarrowing} in C++98, warn when a narrowing
3148 conversion prohibited by C++11 occurs within
3149 @samp{@{ @}}, e.g.
3150
3151 @smallexample
3152 int i = @{ 2.2 @}; // error: narrowing from double to int
3153 @end smallexample
3154
3155 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3156
3157 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3158 @opindex Wnoexcept
3159 @opindex Wno-noexcept
3160 Warn when a noexcept-expression evaluates to false because of a call
3161 to a function that does not have a non-throwing exception
3162 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3163 the compiler to never throw an exception.
3164
3165 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3166 @opindex Wnoexcept-type
3167 @opindex Wno-noexcept-type
3168 Warn if the C++17 feature making @code{noexcept} part of a function
3169 type changes the mangled name of a symbol relative to C++14. Enabled
3170 by @option{-Wabi} and @option{-Wc++17-compat}.
3171
3172 As an example:
3173
3174 @smallexample
3175 template <class T> void f(T t) @{ t(); @};
3176 void g() noexcept;
3177 void h() @{ f(g); @}
3178 @end smallexample
3179
3180 @noindent
3181 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3182 C++17 it calls @code{f<void(*)()noexcept>}.
3183
3184 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3185 @opindex Wclass-memaccess
3186 @opindex Wno-class-memaccess
3187 Warn when the destination of a call to a raw memory function such as
3188 @code{memset} or @code{memcpy} is an object of class type, and when writing
3189 into such an object might bypass the class non-trivial or deleted constructor
3190 or copy assignment, violate const-correctness or encapsulation, or corrupt
3191 virtual table pointers. Modifying the representation of such objects may
3192 violate invariants maintained by member functions of the class. For example,
3193 the call to @code{memset} below is undefined because it modifies a non-trivial
3194 class object and is, therefore, diagnosed. The safe way to either initialize
3195 or clear the storage of objects of such types is by using the appropriate
3196 constructor or assignment operator, if one is available.
3197 @smallexample
3198 std::string str = "abc";
3199 memset (&str, 0, sizeof str);
3200 @end smallexample
3201 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3202 Explicitly casting the pointer to the class object to @code{void *} or
3203 to a type that can be safely accessed by the raw memory function suppresses
3204 the warning.
3205
3206 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3207 @opindex Wnon-virtual-dtor
3208 @opindex Wno-non-virtual-dtor
3209 Warn when a class has virtual functions and an accessible non-virtual
3210 destructor itself or in an accessible polymorphic base class, in which
3211 case it is possible but unsafe to delete an instance of a derived
3212 class through a pointer to the class itself or base class. This
3213 warning is automatically enabled if @option{-Weffc++} is specified.
3214
3215 @item -Wregister @r{(C++ and Objective-C++ only)}
3216 @opindex Wregister
3217 @opindex Wno-register
3218 Warn on uses of the @code{register} storage class specifier, except
3219 when it is part of the GNU @ref{Explicit Register Variables} extension.
3220 The use of the @code{register} keyword as storage class specifier has
3221 been deprecated in C++11 and removed in C++17.
3222 Enabled by default with @option{-std=c++17}.
3223
3224 @item -Wreorder @r{(C++ and Objective-C++ only)}
3225 @opindex Wreorder
3226 @opindex Wno-reorder
3227 @cindex reordering, warning
3228 @cindex warning for reordering of member initializers
3229 Warn when the order of member initializers given in the code does not
3230 match the order in which they must be executed. For instance:
3231
3232 @smallexample
3233 struct A @{
3234 int i;
3235 int j;
3236 A(): j (0), i (1) @{ @}
3237 @};
3238 @end smallexample
3239
3240 @noindent
3241 The compiler rearranges the member initializers for @code{i}
3242 and @code{j} to match the declaration order of the members, emitting
3243 a warning to that effect. This warning is enabled by @option{-Wall}.
3244
3245 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3246 @opindex Wpessimizing-move
3247 @opindex Wno-pessimizing-move
3248 This warning warns when a call to @code{std::move} prevents copy
3249 elision. A typical scenario when copy elision can occur is when returning in
3250 a function with a class return type, when the expression being returned is the
3251 name of a non-volatile automatic object, and is not a function parameter, and
3252 has the same type as the function return type.
3253
3254 @smallexample
3255 struct T @{
3256 @dots{}
3257 @};
3258 T fn()
3259 @{
3260 T t;
3261 @dots{}
3262 return std::move (t);
3263 @}
3264 @end smallexample
3265
3266 But in this example, the @code{std::move} call prevents copy elision.
3267
3268 This warning is enabled by @option{-Wall}.
3269
3270 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3271 @opindex Wredundant-move
3272 @opindex Wno-redundant-move
3273 This warning warns about redundant calls to @code{std::move}; that is, when
3274 a move operation would have been performed even without the @code{std::move}
3275 call. This happens because the compiler is forced to treat the object as if
3276 it were an rvalue in certain situations such as returning a local variable,
3277 where copy elision isn't applicable. Consider:
3278
3279 @smallexample
3280 struct T @{
3281 @dots{}
3282 @};
3283 T fn(T t)
3284 @{
3285 @dots{}
3286 return std::move (t);
3287 @}
3288 @end smallexample
3289
3290 Here, the @code{std::move} call is redundant. Because G++ implements Core
3291 Issue 1579, another example is:
3292
3293 @smallexample
3294 struct T @{ // convertible to U
3295 @dots{}
3296 @};
3297 struct U @{
3298 @dots{}
3299 @};
3300 U fn()
3301 @{
3302 T t;
3303 @dots{}
3304 return std::move (t);
3305 @}
3306 @end smallexample
3307 In this example, copy elision isn't applicable because the type of the
3308 expression being returned and the function return type differ, yet G++
3309 treats the return value as if it were designated by an rvalue.
3310
3311 This warning is enabled by @option{-Wextra}.
3312
3313 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3314 @opindex fext-numeric-literals
3315 @opindex fno-ext-numeric-literals
3316 Accept imaginary, fixed-point, or machine-defined
3317 literal number suffixes as GNU extensions.
3318 When this option is turned off these suffixes are treated
3319 as C++11 user-defined literal numeric suffixes.
3320 This is on by default for all pre-C++11 dialects and all GNU dialects:
3321 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3322 @option{-std=gnu++14}.
3323 This option is off by default
3324 for ISO C++11 onwards (@option{-std=c++11}, ...).
3325 @end table
3326
3327 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3328
3329 @table @gcctabopt
3330 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3331 @opindex Weffc++
3332 @opindex Wno-effc++
3333 Warn about violations of the following style guidelines from Scott Meyers'
3334 @cite{Effective C++} series of books:
3335
3336 @itemize @bullet
3337 @item
3338 Define a copy constructor and an assignment operator for classes
3339 with dynamically-allocated memory.
3340
3341 @item
3342 Prefer initialization to assignment in constructors.
3343
3344 @item
3345 Have @code{operator=} return a reference to @code{*this}.
3346
3347 @item
3348 Don't try to return a reference when you must return an object.
3349
3350 @item
3351 Distinguish between prefix and postfix forms of increment and
3352 decrement operators.
3353
3354 @item
3355 Never overload @code{&&}, @code{||}, or @code{,}.
3356
3357 @end itemize
3358
3359 This option also enables @option{-Wnon-virtual-dtor}, which is also
3360 one of the effective C++ recommendations. However, the check is
3361 extended to warn about the lack of virtual destructor in accessible
3362 non-polymorphic bases classes too.
3363
3364 When selecting this option, be aware that the standard library
3365 headers do not obey all of these guidelines; use @samp{grep -v}
3366 to filter out those warnings.
3367
3368 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3369 @opindex Wstrict-null-sentinel
3370 @opindex Wno-strict-null-sentinel
3371 Warn about the use of an uncasted @code{NULL} as sentinel. When
3372 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3373 to @code{__null}. Although it is a null pointer constant rather than a
3374 null pointer, it is guaranteed to be of the same size as a pointer.
3375 But this use is not portable across different compilers.
3376
3377 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3378 @opindex Wno-non-template-friend
3379 @opindex Wnon-template-friend
3380 Disable warnings when non-template friend functions are declared
3381 within a template. In very old versions of GCC that predate implementation
3382 of the ISO standard, declarations such as
3383 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3384 could be interpreted as a particular specialization of a template
3385 function; the warning exists to diagnose compatibility problems,
3386 and is enabled by default.
3387
3388 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3389 @opindex Wold-style-cast
3390 @opindex Wno-old-style-cast
3391 Warn if an old-style (C-style) cast to a non-void type is used within
3392 a C++ program. The new-style casts (@code{dynamic_cast},
3393 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3394 less vulnerable to unintended effects and much easier to search for.
3395
3396 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3397 @opindex Woverloaded-virtual
3398 @opindex Wno-overloaded-virtual
3399 @cindex overloaded virtual function, warning
3400 @cindex warning for overloaded virtual function
3401 Warn when a function declaration hides virtual functions from a
3402 base class. For example, in:
3403
3404 @smallexample
3405 struct A @{
3406 virtual void f();
3407 @};
3408
3409 struct B: public A @{
3410 void f(int);
3411 @};
3412 @end smallexample
3413
3414 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3415 like:
3416
3417 @smallexample
3418 B* b;
3419 b->f();
3420 @end smallexample
3421
3422 @noindent
3423 fails to compile.
3424
3425 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3426 @opindex Wno-pmf-conversions
3427 @opindex Wpmf-conversions
3428 Disable the diagnostic for converting a bound pointer to member function
3429 to a plain pointer.
3430
3431 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3432 @opindex Wsign-promo
3433 @opindex Wno-sign-promo
3434 Warn when overload resolution chooses a promotion from unsigned or
3435 enumerated type to a signed type, over a conversion to an unsigned type of
3436 the same size. Previous versions of G++ tried to preserve
3437 unsignedness, but the standard mandates the current behavior.
3438
3439 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3440 @opindex Wtemplates
3441 @opindex Wno-templates
3442 Warn when a primary template declaration is encountered. Some coding
3443 rules disallow templates, and this may be used to enforce that rule.
3444 The warning is inactive inside a system header file, such as the STL, so
3445 one can still use the STL. One may also instantiate or specialize
3446 templates.
3447
3448 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3449 @opindex Wmultiple-inheritance
3450 @opindex Wno-multiple-inheritance
3451 Warn when a class is defined with multiple direct base classes. Some
3452 coding rules disallow multiple inheritance, and this may be used to
3453 enforce that rule. The warning is inactive inside a system header file,
3454 such as the STL, so one can still use the STL. One may also define
3455 classes that indirectly use multiple inheritance.
3456
3457 @item -Wvirtual-inheritance
3458 @opindex Wvirtual-inheritance
3459 @opindex Wno-virtual-inheritance
3460 Warn when a class is defined with a virtual direct base class. Some
3461 coding rules disallow multiple inheritance, and this may be used to
3462 enforce that rule. The warning is inactive inside a system header file,
3463 such as the STL, so one can still use the STL. One may also define
3464 classes that indirectly use virtual inheritance.
3465
3466 @item -Wnamespaces
3467 @opindex Wnamespaces
3468 @opindex Wno-namespaces
3469 Warn when a namespace definition is opened. Some coding rules disallow
3470 namespaces, and this may be used to enforce that rule. The warning is
3471 inactive inside a system header file, such as the STL, so one can still
3472 use the STL. One may also use using directives and qualified names.
3473
3474 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3475 @opindex Wterminate
3476 @opindex Wno-terminate
3477 Disable the warning about a throw-expression that will immediately
3478 result in a call to @code{terminate}.
3479
3480 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3481 @opindex Wno-class-conversion
3482 @opindex Wclass-conversion
3483 Disable the warning about the case when a conversion function converts an
3484 object to the same type, to a base class of that type, or to void; such
3485 a conversion function will never be called.
3486
3487 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3488 @opindex Wvolatile
3489 @opindex Wno-volatile
3490 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3491 postfix and prefix @code{++} and @code{--} expressions of
3492 @code{volatile}-qualified types, using simple assignments where the left
3493 operand is a @code{volatile}-qualified non-class type for their value,
3494 compound assignments where the left operand is a @code{volatile}-qualified
3495 non-class type, @code{volatile}-qualified function return type,
3496 @code{volatile}-qualified parameter type, and structured bindings of a
3497 @code{volatile}-qualified type. This usage was deprecated in C++20.
3498
3499 Enabled by default with @option{-std=c++2a}.
3500 @end table
3501
3502 @node Objective-C and Objective-C++ Dialect Options
3503 @section Options Controlling Objective-C and Objective-C++ Dialects
3504
3505 @cindex compiler options, Objective-C and Objective-C++
3506 @cindex Objective-C and Objective-C++ options, command-line
3507 @cindex options, Objective-C and Objective-C++
3508 (NOTE: This manual does not describe the Objective-C and Objective-C++
3509 languages themselves. @xref{Standards,,Language Standards
3510 Supported by GCC}, for references.)
3511
3512 This section describes the command-line options that are only meaningful
3513 for Objective-C and Objective-C++ programs. You can also use most of
3514 the language-independent GNU compiler options.
3515 For example, you might compile a file @file{some_class.m} like this:
3516
3517 @smallexample
3518 gcc -g -fgnu-runtime -O -c some_class.m
3519 @end smallexample
3520
3521 @noindent
3522 In this example, @option{-fgnu-runtime} is an option meant only for
3523 Objective-C and Objective-C++ programs; you can use the other options with
3524 any language supported by GCC@.
3525
3526 Note that since Objective-C is an extension of the C language, Objective-C
3527 compilations may also use options specific to the C front-end (e.g.,
3528 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3529 C++-specific options (e.g., @option{-Wabi}).
3530
3531 Here is a list of options that are @emph{only} for compiling Objective-C
3532 and Objective-C++ programs:
3533
3534 @table @gcctabopt
3535 @item -fconstant-string-class=@var{class-name}
3536 @opindex fconstant-string-class
3537 Use @var{class-name} as the name of the class to instantiate for each
3538 literal string specified with the syntax @code{@@"@dots{}"}. The default
3539 class name is @code{NXConstantString} if the GNU runtime is being used, and
3540 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3541 @option{-fconstant-cfstrings} option, if also present, overrides the
3542 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3543 to be laid out as constant CoreFoundation strings.
3544
3545 @item -fgnu-runtime
3546 @opindex fgnu-runtime
3547 Generate object code compatible with the standard GNU Objective-C
3548 runtime. This is the default for most types of systems.
3549
3550 @item -fnext-runtime
3551 @opindex fnext-runtime
3552 Generate output compatible with the NeXT runtime. This is the default
3553 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3554 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3555 used.
3556
3557 @item -fno-nil-receivers
3558 @opindex fno-nil-receivers
3559 @opindex fnil-receivers
3560 Assume that all Objective-C message dispatches (@code{[receiver
3561 message:arg]}) in this translation unit ensure that the receiver is
3562 not @code{nil}. This allows for more efficient entry points in the
3563 runtime to be used. This option is only available in conjunction with
3564 the NeXT runtime and ABI version 0 or 1.
3565
3566 @item -fobjc-abi-version=@var{n}
3567 @opindex fobjc-abi-version
3568 Use version @var{n} of the Objective-C ABI for the selected runtime.
3569 This option is currently supported only for the NeXT runtime. In that
3570 case, Version 0 is the traditional (32-bit) ABI without support for
3571 properties and other Objective-C 2.0 additions. Version 1 is the
3572 traditional (32-bit) ABI with support for properties and other
3573 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3574 nothing is specified, the default is Version 0 on 32-bit target
3575 machines, and Version 2 on 64-bit target machines.
3576
3577 @item -fobjc-call-cxx-cdtors
3578 @opindex fobjc-call-cxx-cdtors
3579 For each Objective-C class, check if any of its instance variables is a
3580 C++ object with a non-trivial default constructor. If so, synthesize a
3581 special @code{- (id) .cxx_construct} instance method which runs
3582 non-trivial default constructors on any such instance variables, in order,
3583 and then return @code{self}. Similarly, check if any instance variable
3584 is a C++ object with a non-trivial destructor, and if so, synthesize a
3585 special @code{- (void) .cxx_destruct} method which runs
3586 all such default destructors, in reverse order.
3587
3588 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3589 methods thusly generated only operate on instance variables
3590 declared in the current Objective-C class, and not those inherited
3591 from superclasses. It is the responsibility of the Objective-C
3592 runtime to invoke all such methods in an object's inheritance
3593 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3594 by the runtime immediately after a new object instance is allocated;
3595 the @code{- (void) .cxx_destruct} methods are invoked immediately
3596 before the runtime deallocates an object instance.
3597
3598 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3599 support for invoking the @code{- (id) .cxx_construct} and
3600 @code{- (void) .cxx_destruct} methods.
3601
3602 @item -fobjc-direct-dispatch
3603 @opindex fobjc-direct-dispatch
3604 Allow fast jumps to the message dispatcher. On Darwin this is
3605 accomplished via the comm page.
3606
3607 @item -fobjc-exceptions
3608 @opindex fobjc-exceptions
3609 Enable syntactic support for structured exception handling in
3610 Objective-C, similar to what is offered by C++. This option
3611 is required to use the Objective-C keywords @code{@@try},
3612 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3613 @code{@@synchronized}. This option is available with both the GNU
3614 runtime and the NeXT runtime (but not available in conjunction with
3615 the NeXT runtime on Mac OS X 10.2 and earlier).
3616
3617 @item -fobjc-gc
3618 @opindex fobjc-gc
3619 Enable garbage collection (GC) in Objective-C and Objective-C++
3620 programs. This option is only available with the NeXT runtime; the
3621 GNU runtime has a different garbage collection implementation that
3622 does not require special compiler flags.
3623
3624 @item -fobjc-nilcheck
3625 @opindex fobjc-nilcheck
3626 For the NeXT runtime with version 2 of the ABI, check for a nil
3627 receiver in method invocations before doing the actual method call.
3628 This is the default and can be disabled using
3629 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3630 checked for nil in this way no matter what this flag is set to.
3631 Currently this flag does nothing when the GNU runtime, or an older
3632 version of the NeXT runtime ABI, is used.
3633
3634 @item -fobjc-std=objc1
3635 @opindex fobjc-std
3636 Conform to the language syntax of Objective-C 1.0, the language
3637 recognized by GCC 4.0. This only affects the Objective-C additions to
3638 the C/C++ language; it does not affect conformance to C/C++ standards,
3639 which is controlled by the separate C/C++ dialect option flags. When
3640 this option is used with the Objective-C or Objective-C++ compiler,
3641 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3642 This is useful if you need to make sure that your Objective-C code can
3643 be compiled with older versions of GCC@.
3644
3645 @item -freplace-objc-classes
3646 @opindex freplace-objc-classes
3647 Emit a special marker instructing @command{ld(1)} not to statically link in
3648 the resulting object file, and allow @command{dyld(1)} to load it in at
3649 run time instead. This is used in conjunction with the Fix-and-Continue
3650 debugging mode, where the object file in question may be recompiled and
3651 dynamically reloaded in the course of program execution, without the need
3652 to restart the program itself. Currently, Fix-and-Continue functionality
3653 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3654 and later.
3655
3656 @item -fzero-link
3657 @opindex fzero-link
3658 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3659 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3660 compile time) with static class references that get initialized at load time,
3661 which improves run-time performance. Specifying the @option{-fzero-link} flag
3662 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3663 to be retained. This is useful in Zero-Link debugging mode, since it allows
3664 for individual class implementations to be modified during program execution.
3665 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3666 regardless of command-line options.
3667
3668 @item -fno-local-ivars
3669 @opindex fno-local-ivars
3670 @opindex flocal-ivars
3671 By default instance variables in Objective-C can be accessed as if
3672 they were local variables from within the methods of the class they're
3673 declared in. This can lead to shadowing between instance variables
3674 and other variables declared either locally inside a class method or
3675 globally with the same name. Specifying the @option{-fno-local-ivars}
3676 flag disables this behavior thus avoiding variable shadowing issues.
3677
3678 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3679 @opindex fivar-visibility
3680 Set the default instance variable visibility to the specified option
3681 so that instance variables declared outside the scope of any access
3682 modifier directives default to the specified visibility.
3683
3684 @item -gen-decls
3685 @opindex gen-decls
3686 Dump interface declarations for all classes seen in the source file to a
3687 file named @file{@var{sourcename}.decl}.
3688
3689 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3690 @opindex Wassign-intercept
3691 @opindex Wno-assign-intercept
3692 Warn whenever an Objective-C assignment is being intercepted by the
3693 garbage collector.
3694
3695 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3696 @opindex Wno-protocol
3697 @opindex Wprotocol
3698 If a class is declared to implement a protocol, a warning is issued for
3699 every method in the protocol that is not implemented by the class. The
3700 default behavior is to issue a warning for every method not explicitly
3701 implemented in the class, even if a method implementation is inherited
3702 from the superclass. If you use the @option{-Wno-protocol} option, then
3703 methods inherited from the superclass are considered to be implemented,
3704 and no warning is issued for them.
3705
3706 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3707 @opindex Wselector
3708 @opindex Wno-selector
3709 Warn if multiple methods of different types for the same selector are
3710 found during compilation. The check is performed on the list of methods
3711 in the final stage of compilation. Additionally, a check is performed
3712 for each selector appearing in a @code{@@selector(@dots{})}
3713 expression, and a corresponding method for that selector has been found
3714 during compilation. Because these checks scan the method table only at
3715 the end of compilation, these warnings are not produced if the final
3716 stage of compilation is not reached, for example because an error is
3717 found during compilation, or because the @option{-fsyntax-only} option is
3718 being used.
3719
3720 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3721 @opindex Wstrict-selector-match
3722 @opindex Wno-strict-selector-match
3723 Warn if multiple methods with differing argument and/or return types are
3724 found for a given selector when attempting to send a message using this
3725 selector to a receiver of type @code{id} or @code{Class}. When this flag
3726 is off (which is the default behavior), the compiler omits such warnings
3727 if any differences found are confined to types that share the same size
3728 and alignment.
3729
3730 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3731 @opindex Wundeclared-selector
3732 @opindex Wno-undeclared-selector
3733 Warn if a @code{@@selector(@dots{})} expression referring to an
3734 undeclared selector is found. A selector is considered undeclared if no
3735 method with that name has been declared before the
3736 @code{@@selector(@dots{})} expression, either explicitly in an
3737 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3738 an @code{@@implementation} section. This option always performs its
3739 checks as soon as a @code{@@selector(@dots{})} expression is found,
3740 while @option{-Wselector} only performs its checks in the final stage of
3741 compilation. This also enforces the coding style convention
3742 that methods and selectors must be declared before being used.
3743
3744 @item -print-objc-runtime-info
3745 @opindex print-objc-runtime-info
3746 Generate C header describing the largest structure that is passed by
3747 value, if any.
3748
3749 @end table
3750
3751 @node Diagnostic Message Formatting Options
3752 @section Options to Control Diagnostic Messages Formatting
3753 @cindex options to control diagnostics formatting
3754 @cindex diagnostic messages
3755 @cindex message formatting
3756
3757 Traditionally, diagnostic messages have been formatted irrespective of
3758 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3759 options described below
3760 to control the formatting algorithm for diagnostic messages,
3761 e.g.@: how many characters per line, how often source location
3762 information should be reported. Note that some language front ends may not
3763 honor these options.
3764
3765 @table @gcctabopt
3766 @item -fmessage-length=@var{n}
3767 @opindex fmessage-length
3768 Try to format error messages so that they fit on lines of about
3769 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3770 done; each error message appears on a single line. This is the
3771 default for all front ends.
3772
3773 Note - this option also affects the display of the @samp{#error} and
3774 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3775 function/type/variable attribute. It does not however affect the
3776 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3777
3778 @item -fdiagnostics-show-location=once
3779 @opindex fdiagnostics-show-location
3780 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3781 reporter to emit source location information @emph{once}; that is, in
3782 case the message is too long to fit on a single physical line and has to
3783 be wrapped, the source location won't be emitted (as prefix) again,
3784 over and over, in subsequent continuation lines. This is the default
3785 behavior.
3786
3787 @item -fdiagnostics-show-location=every-line
3788 Only meaningful in line-wrapping mode. Instructs the diagnostic
3789 messages reporter to emit the same source location information (as
3790 prefix) for physical lines that result from the process of breaking
3791 a message which is too long to fit on a single line.
3792
3793 @item -fdiagnostics-color[=@var{WHEN}]
3794 @itemx -fno-diagnostics-color
3795 @opindex fdiagnostics-color
3796 @cindex highlight, color
3797 @vindex GCC_COLORS @r{environment variable}
3798 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3799 or @samp{auto}. The default depends on how the compiler has been configured,
3800 it can be any of the above @var{WHEN} options or also @samp{never}
3801 if @env{GCC_COLORS} environment variable isn't present in the environment,
3802 and @samp{auto} otherwise.
3803 @samp{auto} means to use color only when the standard error is a terminal.
3804 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3805 aliases for @option{-fdiagnostics-color=always} and
3806 @option{-fdiagnostics-color=never}, respectively.
3807
3808 The colors are defined by the environment variable @env{GCC_COLORS}.
3809 Its value is a colon-separated list of capabilities and Select Graphic
3810 Rendition (SGR) substrings. SGR commands are interpreted by the
3811 terminal or terminal emulator. (See the section in the documentation
3812 of your text terminal for permitted values and their meanings as
3813 character attributes.) These substring values are integers in decimal
3814 representation and can be concatenated with semicolons.
3815 Common values to concatenate include
3816 @samp{1} for bold,
3817 @samp{4} for underline,
3818 @samp{5} for blink,
3819 @samp{7} for inverse,
3820 @samp{39} for default foreground color,
3821 @samp{30} to @samp{37} for foreground colors,
3822 @samp{90} to @samp{97} for 16-color mode foreground colors,
3823 @samp{38;5;0} to @samp{38;5;255}
3824 for 88-color and 256-color modes foreground colors,
3825 @samp{49} for default background color,
3826 @samp{40} to @samp{47} for background colors,
3827 @samp{100} to @samp{107} for 16-color mode background colors,
3828 and @samp{48;5;0} to @samp{48;5;255}
3829 for 88-color and 256-color modes background colors.
3830
3831 The default @env{GCC_COLORS} is
3832 @smallexample
3833 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3834 quote=01:fixit-insert=32:fixit-delete=31:\
3835 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3836 type-diff=01;32
3837 @end smallexample
3838 @noindent
3839 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3840 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3841 @samp{01} is bold, and @samp{31} is red.
3842 Setting @env{GCC_COLORS} to the empty string disables colors.
3843 Supported capabilities are as follows.
3844
3845 @table @code
3846 @item error=
3847 @vindex error GCC_COLORS @r{capability}
3848 SGR substring for error: markers.
3849
3850 @item warning=
3851 @vindex warning GCC_COLORS @r{capability}
3852 SGR substring for warning: markers.
3853
3854 @item note=
3855 @vindex note GCC_COLORS @r{capability}
3856 SGR substring for note: markers.
3857
3858 @item range1=
3859 @vindex range1 GCC_COLORS @r{capability}
3860 SGR substring for first additional range.
3861
3862 @item range2=
3863 @vindex range2 GCC_COLORS @r{capability}
3864 SGR substring for second additional range.
3865
3866 @item locus=
3867 @vindex locus GCC_COLORS @r{capability}
3868 SGR substring for location information, @samp{file:line} or
3869 @samp{file:line:column} etc.
3870
3871 @item quote=
3872 @vindex quote GCC_COLORS @r{capability}
3873 SGR substring for information printed within quotes.
3874
3875 @item fixit-insert=
3876 @vindex fixit-insert GCC_COLORS @r{capability}
3877 SGR substring for fix-it hints suggesting text to
3878 be inserted or replaced.
3879
3880 @item fixit-delete=
3881 @vindex fixit-delete GCC_COLORS @r{capability}
3882 SGR substring for fix-it hints suggesting text to
3883 be deleted.
3884
3885 @item diff-filename=
3886 @vindex diff-filename GCC_COLORS @r{capability}
3887 SGR substring for filename headers within generated patches.
3888
3889 @item diff-hunk=
3890 @vindex diff-hunk GCC_COLORS @r{capability}
3891 SGR substring for the starts of hunks within generated patches.
3892
3893 @item diff-delete=
3894 @vindex diff-delete GCC_COLORS @r{capability}
3895 SGR substring for deleted lines within generated patches.
3896
3897 @item diff-insert=
3898 @vindex diff-insert GCC_COLORS @r{capability}
3899 SGR substring for inserted lines within generated patches.
3900
3901 @item type-diff=
3902 @vindex type-diff GCC_COLORS @r{capability}
3903 SGR substring for highlighting mismatching types within template
3904 arguments in the C++ frontend.
3905 @end table
3906
3907 @item -fno-diagnostics-show-option
3908 @opindex fno-diagnostics-show-option
3909 @opindex fdiagnostics-show-option
3910 By default, each diagnostic emitted includes text indicating the
3911 command-line option that directly controls the diagnostic (if such an
3912 option is known to the diagnostic machinery). Specifying the
3913 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3914
3915 @item -fno-diagnostics-show-caret
3916 @opindex fno-diagnostics-show-caret
3917 @opindex fdiagnostics-show-caret
3918 By default, each diagnostic emitted includes the original source line
3919 and a caret @samp{^} indicating the column. This option suppresses this
3920 information. The source line is truncated to @var{n} characters, if
3921 the @option{-fmessage-length=n} option is given. When the output is done
3922 to the terminal, the width is limited to the width given by the
3923 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3924
3925 @item -fno-diagnostics-show-labels
3926 @opindex fno-diagnostics-show-labels
3927 @opindex fdiagnostics-show-labels
3928 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3929 diagnostics can label ranges of source code with pertinent information, such
3930 as the types of expressions:
3931
3932 @smallexample
3933 printf ("foo %s bar", long_i + long_j);
3934 ~^ ~~~~~~~~~~~~~~~
3935 | |
3936 char * long int
3937 @end smallexample
3938
3939 This option suppresses the printing of these labels (in the example above,
3940 the vertical bars and the ``char *'' and ``long int'' text).
3941
3942 @item -fno-diagnostics-show-line-numbers
3943 @opindex fno-diagnostics-show-line-numbers
3944 @opindex fdiagnostics-show-line-numbers
3945 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3946 a left margin is printed, showing line numbers. This option suppresses this
3947 left margin.
3948
3949 @item -fdiagnostics-minimum-margin-width=@var{width}
3950 @opindex fdiagnostics-minimum-margin-width
3951 This option controls the minimum width of the left margin printed by
3952 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3953
3954 @item -fdiagnostics-parseable-fixits
3955 @opindex fdiagnostics-parseable-fixits
3956 Emit fix-it hints in a machine-parseable format, suitable for consumption
3957 by IDEs. For each fix-it, a line will be printed after the relevant
3958 diagnostic, starting with the string ``fix-it:''. For example:
3959
3960 @smallexample
3961 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3962 @end smallexample
3963
3964 The location is expressed as a half-open range, expressed as a count of
3965 bytes, starting at byte 1 for the initial column. In the above example,
3966 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3967 given string:
3968
3969 @smallexample
3970 00000000011111111112222222222
3971 12345678901234567890123456789
3972 gtk_widget_showall (dlg);
3973 ^^^^^^^^^^^^^^^^^^
3974 gtk_widget_show_all
3975 @end smallexample
3976
3977 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3978 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3979 (e.g. vertical tab as ``\013'').
3980
3981 An empty replacement string indicates that the given range is to be removed.
3982 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3983 be inserted at the given position.
3984
3985 @item -fdiagnostics-generate-patch
3986 @opindex fdiagnostics-generate-patch
3987 Print fix-it hints to stderr in unified diff format, after any diagnostics
3988 are printed. For example:
3989
3990 @smallexample
3991 --- test.c
3992 +++ test.c
3993 @@ -42,5 +42,5 @@
3994
3995 void show_cb(GtkDialog *dlg)
3996 @{
3997 - gtk_widget_showall(dlg);
3998 + gtk_widget_show_all(dlg);
3999 @}
4000
4001 @end smallexample
4002
4003 The diff may or may not be colorized, following the same rules
4004 as for diagnostics (see @option{-fdiagnostics-color}).
4005
4006 @item -fdiagnostics-show-template-tree
4007 @opindex fdiagnostics-show-template-tree
4008
4009 In the C++ frontend, when printing diagnostics showing mismatching
4010 template types, such as:
4011
4012 @smallexample
4013 could not convert 'std::map<int, std::vector<double> >()'
4014 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4015 @end smallexample
4016
4017 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4018 tree-like structure showing the common and differing parts of the types,
4019 such as:
4020
4021 @smallexample
4022 map<
4023 [...],
4024 vector<
4025 [double != float]>>
4026 @end smallexample
4027
4028 The parts that differ are highlighted with color (``double'' and
4029 ``float'' in this case).
4030
4031 @item -fno-elide-type
4032 @opindex fno-elide-type
4033 @opindex felide-type
4034 By default when the C++ frontend prints diagnostics showing mismatching
4035 template types, common parts of the types are printed as ``[...]'' to
4036 simplify the error message. For example:
4037
4038 @smallexample
4039 could not convert 'std::map<int, std::vector<double> >()'
4040 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4041 @end smallexample
4042
4043 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4044 This flag also affects the output of the
4045 @option{-fdiagnostics-show-template-tree} flag.
4046
4047 @item -fno-show-column
4048 @opindex fno-show-column
4049 @opindex fshow-column
4050 Do not print column numbers in diagnostics. This may be necessary if
4051 diagnostics are being scanned by a program that does not understand the
4052 column numbers, such as @command{dejagnu}.
4053
4054 @item -fdiagnostics-format=@var{FORMAT}
4055 @opindex fdiagnostics-format
4056 Select a different format for printing diagnostics.
4057 @var{FORMAT} is @samp{text} or @samp{json}.
4058 The default is @samp{text}.
4059
4060 The @samp{json} format consists of a top-level JSON array containing JSON
4061 objects representing the diagnostics.
4062
4063 The JSON is emitted as one line, without formatting; the examples below
4064 have been formatted for clarity.
4065
4066 Diagnostics can have child diagnostics. For example, this error and note:
4067
4068 @smallexample
4069 misleading-indentation.c:15:3: warning: this 'if' clause does not
4070 guard... [-Wmisleading-indentation]
4071 15 | if (flag)
4072 | ^~
4073 misleading-indentation.c:17:5: note: ...this statement, but the latter
4074 is misleadingly indented as if it were guarded by the 'if'
4075 17 | y = 2;
4076 | ^
4077 @end smallexample
4078
4079 @noindent
4080 might be printed in JSON form (after formatting) like this:
4081
4082 @smallexample
4083 [
4084 @{
4085 "kind": "warning",
4086 "locations": [
4087 @{
4088 "caret": @{
4089 "column": 3,
4090 "file": "misleading-indentation.c",
4091 "line": 15
4092 @},
4093 "finish": @{
4094 "column": 4,
4095 "file": "misleading-indentation.c",
4096 "line": 15
4097 @}
4098 @}
4099 ],
4100 "message": "this \u2018if\u2019 clause does not guard...",
4101 "option": "-Wmisleading-indentation",
4102 "children": [
4103 @{
4104 "kind": "note",
4105 "locations": [
4106 @{
4107 "caret": @{
4108 "column": 5,
4109 "file": "misleading-indentation.c",
4110 "line": 17
4111 @}
4112 @}
4113 ],
4114 "message": "...this statement, but the latter is @dots{}"
4115 @}
4116 ]
4117 @},
4118 @dots{}
4119 ]
4120 @end smallexample
4121
4122 @noindent
4123 where the @code{note} is a child of the @code{warning}.
4124
4125 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4126 an @code{option} key describing the command-line option controlling the
4127 warning.
4128
4129 A diagnostic can contain zero or more locations. Each location has up
4130 to three positions within it: a @code{caret} position and optional
4131 @code{start} and @code{finish} positions. A location can also have
4132 an optional @code{label} string. For example, this error:
4133
4134 @smallexample
4135 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4136 'struct s'@} and 'T' @{aka 'struct t'@})
4137 64 | return callee_4a () + callee_4b ();
4138 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4139 | | |
4140 | | T @{aka struct t@}
4141 | S @{aka struct s@}
4142 @end smallexample
4143
4144 @noindent
4145 has three locations. Its primary location is at the ``+'' token at column
4146 23. It has two secondary locations, describing the left and right-hand sides
4147 of the expression, which have labels. It might be printed in JSON form as:
4148
4149 @smallexample
4150 @{
4151 "children": [],
4152 "kind": "error",
4153 "locations": [
4154 @{
4155 "caret": @{
4156 "column": 23, "file": "bad-binary-ops.c", "line": 64
4157 @}
4158 @},
4159 @{
4160 "caret": @{
4161 "column": 10, "file": "bad-binary-ops.c", "line": 64
4162 @},
4163 "finish": @{
4164 "column": 21, "file": "bad-binary-ops.c", "line": 64
4165 @},
4166 "label": "S @{aka struct s@}"
4167 @},
4168 @{
4169 "caret": @{
4170 "column": 25, "file": "bad-binary-ops.c", "line": 64
4171 @},
4172 "finish": @{
4173 "column": 36, "file": "bad-binary-ops.c", "line": 64
4174 @},
4175 "label": "T @{aka struct t@}"
4176 @}
4177 ],
4178 "message": "invalid operands to binary + @dots{}"
4179 @}
4180 @end smallexample
4181
4182 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4183 consisting of half-open intervals, similar to the output of
4184 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4185 with a replacement fix-it hint:
4186
4187 @smallexample
4188 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4189 mean 'color'?
4190 8 | return ptr->colour;
4191 | ^~~~~~
4192 | color
4193 @end smallexample
4194
4195 @noindent
4196 might be printed in JSON form as:
4197
4198 @smallexample
4199 @{
4200 "children": [],
4201 "fixits": [
4202 @{
4203 "next": @{
4204 "column": 21,
4205 "file": "demo.c",
4206 "line": 8
4207 @},
4208 "start": @{
4209 "column": 15,
4210 "file": "demo.c",
4211 "line": 8
4212 @},
4213 "string": "color"
4214 @}
4215 ],
4216 "kind": "error",
4217 "locations": [
4218 @{
4219 "caret": @{
4220 "column": 15,
4221 "file": "demo.c",
4222 "line": 8
4223 @},
4224 "finish": @{
4225 "column": 20,
4226 "file": "demo.c",
4227 "line": 8
4228 @}
4229 @}
4230 ],
4231 "message": "\u2018struct s\u2019 has no member named @dots{}"
4232 @}
4233 @end smallexample
4234
4235 @noindent
4236 where the fix-it hint suggests replacing the text from @code{start} up
4237 to but not including @code{next} with @code{string}'s value. Deletions
4238 are expressed via an empty value for @code{string}, insertions by
4239 having @code{start} equal @code{next}.
4240
4241 @end table
4242
4243 @node Warning Options
4244 @section Options to Request or Suppress Warnings
4245 @cindex options to control warnings
4246 @cindex warning messages
4247 @cindex messages, warning
4248 @cindex suppressing warnings
4249
4250 Warnings are diagnostic messages that report constructions that
4251 are not inherently erroneous but that are risky or suggest there
4252 may have been an error.
4253
4254 The following language-independent options do not enable specific
4255 warnings but control the kinds of diagnostics produced by GCC@.
4256
4257 @table @gcctabopt
4258 @cindex syntax checking
4259 @item -fsyntax-only
4260 @opindex fsyntax-only
4261 Check the code for syntax errors, but don't do anything beyond that.
4262
4263 @item -fmax-errors=@var{n}
4264 @opindex fmax-errors
4265 Limits the maximum number of error messages to @var{n}, at which point
4266 GCC bails out rather than attempting to continue processing the source
4267 code. If @var{n} is 0 (the default), there is no limit on the number
4268 of error messages produced. If @option{-Wfatal-errors} is also
4269 specified, then @option{-Wfatal-errors} takes precedence over this
4270 option.
4271
4272 @item -w
4273 @opindex w
4274 Inhibit all warning messages.
4275
4276 @item -Werror
4277 @opindex Werror
4278 @opindex Wno-error
4279 Make all warnings into errors.
4280
4281 @item -Werror=
4282 @opindex Werror=
4283 @opindex Wno-error=
4284 Make the specified warning into an error. The specifier for a warning
4285 is appended; for example @option{-Werror=switch} turns the warnings
4286 controlled by @option{-Wswitch} into errors. This switch takes a
4287 negative form, to be used to negate @option{-Werror} for specific
4288 warnings; for example @option{-Wno-error=switch} makes
4289 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4290 is in effect.
4291
4292 The warning message for each controllable warning includes the
4293 option that controls the warning. That option can then be used with
4294 @option{-Werror=} and @option{-Wno-error=} as described above.
4295 (Printing of the option in the warning message can be disabled using the
4296 @option{-fno-diagnostics-show-option} flag.)
4297
4298 Note that specifying @option{-Werror=}@var{foo} automatically implies
4299 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4300 imply anything.
4301
4302 @item -Wfatal-errors
4303 @opindex Wfatal-errors
4304 @opindex Wno-fatal-errors
4305 This option causes the compiler to abort compilation on the first error
4306 occurred rather than trying to keep going and printing further error
4307 messages.
4308
4309 @end table
4310
4311 You can request many specific warnings with options beginning with
4312 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4313 implicit declarations. Each of these specific warning options also
4314 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4315 example, @option{-Wno-implicit}. This manual lists only one of the
4316 two forms, whichever is not the default. For further
4317 language-specific options also refer to @ref{C++ Dialect Options} and
4318 @ref{Objective-C and Objective-C++ Dialect Options}.
4319
4320 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4321 options, such as @option{-Wunused}, which may turn on further options,
4322 such as @option{-Wunused-value}. The combined effect of positive and
4323 negative forms is that more specific options have priority over less
4324 specific ones, independently of their position in the command-line. For
4325 options of the same specificity, the last one takes effect. Options
4326 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4327 as if they appeared at the end of the command-line.
4328
4329 When an unrecognized warning option is requested (e.g.,
4330 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4331 that the option is not recognized. However, if the @option{-Wno-} form
4332 is used, the behavior is slightly different: no diagnostic is
4333 produced for @option{-Wno-unknown-warning} unless other diagnostics
4334 are being produced. This allows the use of new @option{-Wno-} options
4335 with old compilers, but if something goes wrong, the compiler
4336 warns that an unrecognized option is present.
4337
4338 @table @gcctabopt
4339 @item -Wpedantic
4340 @itemx -pedantic
4341 @opindex pedantic
4342 @opindex Wpedantic
4343 @opindex Wno-pedantic
4344 Issue all the warnings demanded by strict ISO C and ISO C++;
4345 reject all programs that use forbidden extensions, and some other
4346 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4347 version of the ISO C standard specified by any @option{-std} option used.
4348
4349 Valid ISO C and ISO C++ programs should compile properly with or without
4350 this option (though a rare few require @option{-ansi} or a
4351 @option{-std} option specifying the required version of ISO C)@. However,
4352 without this option, certain GNU extensions and traditional C and C++
4353 features are supported as well. With this option, they are rejected.
4354
4355 @option{-Wpedantic} does not cause warning messages for use of the
4356 alternate keywords whose names begin and end with @samp{__}. This alternate
4357 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4358 i.e. @samp{__intN__}.
4359 Pedantic warnings are also disabled in the expression that follows
4360 @code{__extension__}. However, only system header files should use
4361 these escape routes; application programs should avoid them.
4362 @xref{Alternate Keywords}.
4363
4364 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4365 C conformance. They soon find that it does not do quite what they want:
4366 it finds some non-ISO practices, but not all---only those for which
4367 ISO C @emph{requires} a diagnostic, and some others for which
4368 diagnostics have been added.
4369
4370 A feature to report any failure to conform to ISO C might be useful in
4371 some instances, but would require considerable additional work and would
4372 be quite different from @option{-Wpedantic}. We don't have plans to
4373 support such a feature in the near future.
4374
4375 Where the standard specified with @option{-std} represents a GNU
4376 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4377 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4378 extended dialect is based. Warnings from @option{-Wpedantic} are given
4379 where they are required by the base standard. (It does not make sense
4380 for such warnings to be given only for features not in the specified GNU
4381 C dialect, since by definition the GNU dialects of C include all
4382 features the compiler supports with the given option, and there would be
4383 nothing to warn about.)
4384
4385 @item -pedantic-errors
4386 @opindex pedantic-errors
4387 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4388 requires a diagnostic, in some cases where there is undefined behavior
4389 at compile-time and in some other cases that do not prevent compilation
4390 of programs that are valid according to the standard. This is not
4391 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4392 by this option and not enabled by the latter and vice versa.
4393
4394 @item -Wall
4395 @opindex Wall
4396 @opindex Wno-all
4397 This enables all the warnings about constructions that some users
4398 consider questionable, and that are easy to avoid (or modify to
4399 prevent the warning), even in conjunction with macros. This also
4400 enables some language-specific warnings described in @ref{C++ Dialect
4401 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4402
4403 @option{-Wall} turns on the following warning flags:
4404
4405 @gccoptlist{-Waddress @gol
4406 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4407 -Wbool-compare @gol
4408 -Wbool-operation @gol
4409 -Wc++11-compat -Wc++14-compat @gol
4410 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4411 -Wchar-subscripts @gol
4412 -Wcomment @gol
4413 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4414 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4415 -Wenum-conversion @r{in C/ObjC;} @gol
4416 -Wformat @gol
4417 -Wint-in-bool-context @gol
4418 -Wimplicit @r{(C and Objective-C only)} @gol
4419 -Wimplicit-int @r{(C and Objective-C only)} @gol
4420 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4421 -Winit-self @r{(only for C++)} @gol
4422 -Wlogical-not-parentheses @gol
4423 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4424 -Wmaybe-uninitialized @gol
4425 -Wmemset-elt-size @gol
4426 -Wmemset-transposed-args @gol
4427 -Wmisleading-indentation @r{(only for C/C++)} @gol
4428 -Wmissing-attributes @gol
4429 -Wmissing-braces @r{(only for C/ObjC)} @gol
4430 -Wmultistatement-macros @gol
4431 -Wnarrowing @r{(only for C++)} @gol
4432 -Wnonnull @gol
4433 -Wnonnull-compare @gol
4434 -Wopenmp-simd @gol
4435 -Wparentheses @gol
4436 -Wpessimizing-move @r{(only for C++)} @gol
4437 -Wpointer-sign @gol
4438 -Wreorder @gol
4439 -Wrestrict @gol
4440 -Wreturn-type @gol
4441 -Wsequence-point @gol
4442 -Wsign-compare @r{(only in C++)} @gol
4443 -Wsizeof-pointer-div @gol
4444 -Wsizeof-pointer-memaccess @gol
4445 -Wstrict-aliasing @gol
4446 -Wstrict-overflow=1 @gol
4447 -Wswitch @gol
4448 -Wtautological-compare @gol
4449 -Wtrigraphs @gol
4450 -Wuninitialized @gol
4451 -Wunknown-pragmas @gol
4452 -Wunused-function @gol
4453 -Wunused-label @gol
4454 -Wunused-value @gol
4455 -Wunused-variable @gol
4456 -Wvolatile-register-var}
4457
4458 Note that some warning flags are not implied by @option{-Wall}. Some of
4459 them warn about constructions that users generally do not consider
4460 questionable, but which occasionally you might wish to check for;
4461 others warn about constructions that are necessary or hard to avoid in
4462 some cases, and there is no simple way to modify the code to suppress
4463 the warning. Some of them are enabled by @option{-Wextra} but many of
4464 them must be enabled individually.
4465
4466 @item -Wextra
4467 @opindex W
4468 @opindex Wextra
4469 @opindex Wno-extra
4470 This enables some extra warning flags that are not enabled by
4471 @option{-Wall}. (This option used to be called @option{-W}. The older
4472 name is still supported, but the newer name is more descriptive.)
4473
4474 @gccoptlist{-Wclobbered @gol
4475 -Wcast-function-type @gol
4476 -Wdeprecated-copy @r{(C++ only)} @gol
4477 -Wempty-body @gol
4478 -Wignored-qualifiers @gol
4479 -Wimplicit-fallthrough=3 @gol
4480 -Wmissing-field-initializers @gol
4481 -Wmissing-parameter-type @r{(C only)} @gol
4482 -Wold-style-declaration @r{(C only)} @gol
4483 -Woverride-init @gol
4484 -Wsign-compare @r{(C only)} @gol
4485 -Wredundant-move @r{(only for C++)} @gol
4486 -Wtype-limits @gol
4487 -Wuninitialized @gol
4488 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4489 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4490 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4491
4492
4493 The option @option{-Wextra} also prints warning messages for the
4494 following cases:
4495
4496 @itemize @bullet
4497
4498 @item
4499 A pointer is compared against integer zero with @code{<}, @code{<=},
4500 @code{>}, or @code{>=}.
4501
4502 @item
4503 (C++ only) An enumerator and a non-enumerator both appear in a
4504 conditional expression.
4505
4506 @item
4507 (C++ only) Ambiguous virtual bases.
4508
4509 @item
4510 (C++ only) Subscripting an array that has been declared @code{register}.
4511
4512 @item
4513 (C++ only) Taking the address of a variable that has been declared
4514 @code{register}.
4515
4516 @item
4517 (C++ only) A base class is not initialized in the copy constructor
4518 of a derived class.
4519
4520 @end itemize
4521
4522 @item -Wchar-subscripts
4523 @opindex Wchar-subscripts
4524 @opindex Wno-char-subscripts
4525 Warn if an array subscript has type @code{char}. This is a common cause
4526 of error, as programmers often forget that this type is signed on some
4527 machines.
4528 This warning is enabled by @option{-Wall}.
4529
4530 @item -Wno-coverage-mismatch
4531 @opindex Wno-coverage-mismatch
4532 @opindex Wcoverage-mismatch
4533 Warn if feedback profiles do not match when using the
4534 @option{-fprofile-use} option.
4535 If a source file is changed between compiling with @option{-fprofile-generate}
4536 and with @option{-fprofile-use}, the files with the profile feedback can fail
4537 to match the source file and GCC cannot use the profile feedback
4538 information. By default, this warning is enabled and is treated as an
4539 error. @option{-Wno-coverage-mismatch} can be used to disable the
4540 warning or @option{-Wno-error=coverage-mismatch} can be used to
4541 disable the error. Disabling the error for this warning can result in
4542 poorly optimized code and is useful only in the
4543 case of very minor changes such as bug fixes to an existing code-base.
4544 Completely disabling the warning is not recommended.
4545
4546 @item -Wno-cpp
4547 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4548
4549 Suppress warning messages emitted by @code{#warning} directives.
4550
4551 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4552 @opindex Wdouble-promotion
4553 @opindex Wno-double-promotion
4554 Give a warning when a value of type @code{float} is implicitly
4555 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4556 floating-point unit implement @code{float} in hardware, but emulate
4557 @code{double} in software. On such a machine, doing computations
4558 using @code{double} values is much more expensive because of the
4559 overhead required for software emulation.
4560
4561 It is easy to accidentally do computations with @code{double} because
4562 floating-point literals are implicitly of type @code{double}. For
4563 example, in:
4564 @smallexample
4565 @group
4566 float area(float radius)
4567 @{
4568 return 3.14159 * radius * radius;
4569 @}
4570 @end group
4571 @end smallexample
4572 the compiler performs the entire computation with @code{double}
4573 because the floating-point literal is a @code{double}.
4574
4575 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4576 @opindex Wduplicate-decl-specifier
4577 @opindex Wno-duplicate-decl-specifier
4578 Warn if a declaration has duplicate @code{const}, @code{volatile},
4579 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4580 @option{-Wall}.
4581
4582 @item -Wformat
4583 @itemx -Wformat=@var{n}
4584 @opindex Wformat
4585 @opindex Wno-format
4586 @opindex ffreestanding
4587 @opindex fno-builtin
4588 @opindex Wformat=
4589 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4590 the arguments supplied have types appropriate to the format string
4591 specified, and that the conversions specified in the format string make
4592 sense. This includes standard functions, and others specified by format
4593 attributes (@pxref{Function Attributes}), in the @code{printf},
4594 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4595 not in the C standard) families (or other target-specific families).
4596 Which functions are checked without format attributes having been
4597 specified depends on the standard version selected, and such checks of
4598 functions without the attribute specified are disabled by
4599 @option{-ffreestanding} or @option{-fno-builtin}.
4600
4601 The formats are checked against the format features supported by GNU
4602 libc version 2.2. These include all ISO C90 and C99 features, as well
4603 as features from the Single Unix Specification and some BSD and GNU
4604 extensions. Other library implementations may not support all these
4605 features; GCC does not support warning about features that go beyond a
4606 particular library's limitations. However, if @option{-Wpedantic} is used
4607 with @option{-Wformat}, warnings are given about format features not
4608 in the selected standard version (but not for @code{strfmon} formats,
4609 since those are not in any version of the C standard). @xref{C Dialect
4610 Options,,Options Controlling C Dialect}.
4611
4612 @table @gcctabopt
4613 @item -Wformat=1
4614 @itemx -Wformat
4615 @opindex Wformat
4616 @opindex Wformat=1
4617 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4618 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4619 @option{-Wformat} also checks for null format arguments for several
4620 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4621 aspects of this level of format checking can be disabled by the
4622 options: @option{-Wno-format-contains-nul},
4623 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4624 @option{-Wformat} is enabled by @option{-Wall}.
4625
4626 @item -Wno-format-contains-nul
4627 @opindex Wno-format-contains-nul
4628 @opindex Wformat-contains-nul
4629 If @option{-Wformat} is specified, do not warn about format strings that
4630 contain NUL bytes.
4631
4632 @item -Wno-format-extra-args
4633 @opindex Wno-format-extra-args
4634 @opindex Wformat-extra-args
4635 If @option{-Wformat} is specified, do not warn about excess arguments to a
4636 @code{printf} or @code{scanf} format function. The C standard specifies
4637 that such arguments are ignored.
4638
4639 Where the unused arguments lie between used arguments that are
4640 specified with @samp{$} operand number specifications, normally
4641 warnings are still given, since the implementation could not know what
4642 type to pass to @code{va_arg} to skip the unused arguments. However,
4643 in the case of @code{scanf} formats, this option suppresses the
4644 warning if the unused arguments are all pointers, since the Single
4645 Unix Specification says that such unused arguments are allowed.
4646
4647 @item -Wformat-overflow
4648 @itemx -Wformat-overflow=@var{level}
4649 @opindex Wformat-overflow
4650 @opindex Wno-format-overflow
4651 Warn about calls to formatted input/output functions such as @code{sprintf}
4652 and @code{vsprintf} that might overflow the destination buffer. When the
4653 exact number of bytes written by a format directive cannot be determined
4654 at compile-time it is estimated based on heuristics that depend on the
4655 @var{level} argument and on optimization. While enabling optimization
4656 will in most cases improve the accuracy of the warning, it may also
4657 result in false positives.
4658
4659 @table @gcctabopt
4660 @item -Wformat-overflow
4661 @itemx -Wformat-overflow=1
4662 @opindex Wformat-overflow
4663 @opindex Wno-format-overflow
4664 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4665 employs a conservative approach that warns only about calls that most
4666 likely overflow the buffer. At this level, numeric arguments to format
4667 directives with unknown values are assumed to have the value of one, and
4668 strings of unknown length to be empty. Numeric arguments that are known
4669 to be bounded to a subrange of their type, or string arguments whose output
4670 is bounded either by their directive's precision or by a finite set of
4671 string literals, are assumed to take on the value within the range that
4672 results in the most bytes on output. For example, the call to @code{sprintf}
4673 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4674 the terminating NUL character (@code{'\0'}) appended by the function
4675 to the destination buffer will be written past its end. Increasing
4676 the size of the buffer by a single byte is sufficient to avoid the
4677 warning, though it may not be sufficient to avoid the overflow.
4678
4679 @smallexample
4680 void f (int a, int b)
4681 @{
4682 char buf [13];
4683 sprintf (buf, "a = %i, b = %i\n", a, b);
4684 @}
4685 @end smallexample
4686
4687 @item -Wformat-overflow=2
4688 Level @var{2} warns also about calls that might overflow the destination
4689 buffer given an argument of sufficient length or magnitude. At level
4690 @var{2}, unknown numeric arguments are assumed to have the minimum
4691 representable value for signed types with a precision greater than 1, and
4692 the maximum representable value otherwise. Unknown string arguments whose
4693 length cannot be assumed to be bounded either by the directive's precision,
4694 or by a finite set of string literals they may evaluate to, or the character
4695 array they may point to, are assumed to be 1 character long.
4696
4697 At level @var{2}, the call in the example above is again diagnosed, but
4698 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4699 @code{%i} directive will write some of its digits beyond the end of
4700 the destination buffer. To make the call safe regardless of the values
4701 of the two variables, the size of the destination buffer must be increased
4702 to at least 34 bytes. GCC includes the minimum size of the buffer in
4703 an informational note following the warning.
4704
4705 An alternative to increasing the size of the destination buffer is to
4706 constrain the range of formatted values. The maximum length of string
4707 arguments can be bounded by specifying the precision in the format
4708 directive. When numeric arguments of format directives can be assumed
4709 to be bounded by less than the precision of their type, choosing
4710 an appropriate length modifier to the format specifier will reduce
4711 the required buffer size. For example, if @var{a} and @var{b} in the
4712 example above can be assumed to be within the precision of
4713 the @code{short int} type then using either the @code{%hi} format
4714 directive or casting the argument to @code{short} reduces the maximum
4715 required size of the buffer to 24 bytes.
4716
4717 @smallexample
4718 void f (int a, int b)
4719 @{
4720 char buf [23];
4721 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4722 @}
4723 @end smallexample
4724 @end table
4725
4726 @item -Wno-format-zero-length
4727 @opindex Wno-format-zero-length
4728 @opindex Wformat-zero-length
4729 If @option{-Wformat} is specified, do not warn about zero-length formats.
4730 The C standard specifies that zero-length formats are allowed.
4731
4732
4733 @item -Wformat=2
4734 @opindex Wformat=2
4735 Enable @option{-Wformat} plus additional format checks. Currently
4736 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4737 -Wformat-y2k}.
4738
4739 @item -Wformat-nonliteral
4740 @opindex Wformat-nonliteral
4741 @opindex Wno-format-nonliteral
4742 If @option{-Wformat} is specified, also warn if the format string is not a
4743 string literal and so cannot be checked, unless the format function
4744 takes its format arguments as a @code{va_list}.
4745
4746 @item -Wformat-security
4747 @opindex Wformat-security
4748 @opindex Wno-format-security
4749 If @option{-Wformat} is specified, also warn about uses of format
4750 functions that represent possible security problems. At present, this
4751 warns about calls to @code{printf} and @code{scanf} functions where the
4752 format string is not a string literal and there are no format arguments,
4753 as in @code{printf (foo);}. This may be a security hole if the format
4754 string came from untrusted input and contains @samp{%n}. (This is
4755 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4756 in future warnings may be added to @option{-Wformat-security} that are not
4757 included in @option{-Wformat-nonliteral}.)
4758
4759 @item -Wformat-signedness
4760 @opindex Wformat-signedness
4761 @opindex Wno-format-signedness
4762 If @option{-Wformat} is specified, also warn if the format string
4763 requires an unsigned argument and the argument is signed and vice versa.
4764
4765 @item -Wformat-truncation
4766 @itemx -Wformat-truncation=@var{level}
4767 @opindex Wformat-truncation
4768 @opindex Wno-format-truncation
4769 Warn about calls to formatted input/output functions such as @code{snprintf}
4770 and @code{vsnprintf} that might result in output truncation. When the exact
4771 number of bytes written by a format directive cannot be determined at
4772 compile-time it is estimated based on heuristics that depend on
4773 the @var{level} argument and on optimization. While enabling optimization
4774 will in most cases improve the accuracy of the warning, it may also result
4775 in false positives. Except as noted otherwise, the option uses the same
4776 logic @option{-Wformat-overflow}.
4777
4778 @table @gcctabopt
4779 @item -Wformat-truncation
4780 @itemx -Wformat-truncation=1
4781 @opindex Wformat-truncation
4782 @opindex Wno-format-truncation
4783 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4784 employs a conservative approach that warns only about calls to bounded
4785 functions whose return value is unused and that will most likely result
4786 in output truncation.
4787
4788 @item -Wformat-truncation=2
4789 Level @var{2} warns also about calls to bounded functions whose return
4790 value is used and that might result in truncation given an argument of
4791 sufficient length or magnitude.
4792 @end table
4793
4794 @item -Wformat-y2k
4795 @opindex Wformat-y2k
4796 @opindex Wno-format-y2k
4797 If @option{-Wformat} is specified, also warn about @code{strftime}
4798 formats that may yield only a two-digit year.
4799 @end table
4800
4801 @item -Wnonnull
4802 @opindex Wnonnull
4803 @opindex Wno-nonnull
4804 Warn about passing a null pointer for arguments marked as
4805 requiring a non-null value by the @code{nonnull} function attribute.
4806
4807 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4808 can be disabled with the @option{-Wno-nonnull} option.
4809
4810 @item -Wnonnull-compare
4811 @opindex Wnonnull-compare
4812 @opindex Wno-nonnull-compare
4813 Warn when comparing an argument marked with the @code{nonnull}
4814 function attribute against null inside the function.
4815
4816 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4817 can be disabled with the @option{-Wno-nonnull-compare} option.
4818
4819 @item -Wnull-dereference
4820 @opindex Wnull-dereference
4821 @opindex Wno-null-dereference
4822 Warn if the compiler detects paths that trigger erroneous or
4823 undefined behavior due to dereferencing a null pointer. This option
4824 is only active when @option{-fdelete-null-pointer-checks} is active,
4825 which is enabled by optimizations in most targets. The precision of
4826 the warnings depends on the optimization options used.
4827
4828 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4829 @opindex Winaccessible-base
4830 @opindex Wno-inaccessible-base
4831 Warn when a base class is inaccessible in a class derived from it due to
4832 ambiguity. The warning is enabled by default. Note the warning for virtual
4833 bases is enabled by the @option{-Wextra} option.
4834 @smallexample
4835 @group
4836 struct A @{ int a; @};
4837
4838 struct B : A @{ @};
4839
4840 struct C : B, A @{ @};
4841 @end group
4842 @end smallexample
4843
4844 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4845 @opindex Winit-self
4846 @opindex Wno-init-self
4847 Warn about uninitialized variables that are initialized with themselves.
4848 Note this option can only be used with the @option{-Wuninitialized} option.
4849
4850 For example, GCC warns about @code{i} being uninitialized in the
4851 following snippet only when @option{-Winit-self} has been specified:
4852 @smallexample
4853 @group
4854 int f()
4855 @{
4856 int i = i;
4857 return i;
4858 @}
4859 @end group
4860 @end smallexample
4861
4862 This warning is enabled by @option{-Wall} in C++.
4863
4864 @item -Wimplicit-int @r{(C and Objective-C only)}
4865 @opindex Wimplicit-int
4866 @opindex Wno-implicit-int
4867 Warn when a declaration does not specify a type.
4868 This warning is enabled by @option{-Wall}.
4869
4870 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4871 @opindex Wimplicit-function-declaration
4872 @opindex Wno-implicit-function-declaration
4873 Give a warning whenever a function is used before being declared. In
4874 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4875 enabled by default and it is made into an error by
4876 @option{-pedantic-errors}. This warning is also enabled by
4877 @option{-Wall}.
4878
4879 @item -Wimplicit @r{(C and Objective-C only)}
4880 @opindex Wimplicit
4881 @opindex Wno-implicit
4882 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4883 This warning is enabled by @option{-Wall}.
4884
4885 @item -Wimplicit-fallthrough
4886 @opindex Wimplicit-fallthrough
4887 @opindex Wno-implicit-fallthrough
4888 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4889 and @option{-Wno-implicit-fallthrough} is the same as
4890 @option{-Wimplicit-fallthrough=0}.
4891
4892 @item -Wimplicit-fallthrough=@var{n}
4893 @opindex Wimplicit-fallthrough=
4894 Warn when a switch case falls through. For example:
4895
4896 @smallexample
4897 @group
4898 switch (cond)
4899 @{
4900 case 1:
4901 a = 1;
4902 break;
4903 case 2:
4904 a = 2;
4905 case 3:
4906 a = 3;
4907 break;
4908 @}
4909 @end group
4910 @end smallexample
4911
4912 This warning does not warn when the last statement of a case cannot
4913 fall through, e.g. when there is a return statement or a call to function
4914 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4915 also takes into account control flow statements, such as ifs, and only
4916 warns when appropriate. E.g.@:
4917
4918 @smallexample
4919 @group
4920 switch (cond)
4921 @{
4922 case 1:
4923 if (i > 3) @{
4924 bar (5);
4925 break;
4926 @} else if (i < 1) @{
4927 bar (0);
4928 @} else
4929 return;
4930 default:
4931 @dots{}
4932 @}
4933 @end group
4934 @end smallexample
4935
4936 Since there are occasions where a switch case fall through is desirable,
4937 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4938 to be used along with a null statement to suppress this warning that
4939 would normally occur:
4940
4941 @smallexample
4942 @group
4943 switch (cond)
4944 @{
4945 case 1:
4946 bar (0);
4947 __attribute__ ((fallthrough));
4948 default:
4949 @dots{}
4950 @}
4951 @end group
4952 @end smallexample
4953
4954 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4955 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4956 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4957 Instead of these attributes, it is also possible to add a fallthrough comment
4958 to silence the warning. The whole body of the C or C++ style comment should
4959 match the given regular expressions listed below. The option argument @var{n}
4960 specifies what kind of comments are accepted:
4961
4962 @itemize @bullet
4963
4964 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4965
4966 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4967 expression, any comment is used as fallthrough comment.
4968
4969 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4970 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4971
4972 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4973 following regular expressions:
4974
4975 @itemize @bullet
4976
4977 @item @code{-fallthrough}
4978
4979 @item @code{@@fallthrough@@}
4980
4981 @item @code{lint -fallthrough[ \t]*}
4982
4983 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4984
4985 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4986
4987 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4988
4989 @end itemize
4990
4991 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4992 following regular expressions:
4993
4994 @itemize @bullet
4995
4996 @item @code{-fallthrough}
4997
4998 @item @code{@@fallthrough@@}
4999
5000 @item @code{lint -fallthrough[ \t]*}
5001
5002 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5003
5004 @end itemize
5005
5006 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5007 fallthrough comments, only attributes disable the warning.
5008
5009 @end itemize
5010
5011 The comment needs to be followed after optional whitespace and other comments
5012 by @code{case} or @code{default} keywords or by a user label that precedes some
5013 @code{case} or @code{default} label.
5014
5015 @smallexample
5016 @group
5017 switch (cond)
5018 @{
5019 case 1:
5020 bar (0);
5021 /* FALLTHRU */
5022 default:
5023 @dots{}
5024 @}
5025 @end group
5026 @end smallexample
5027
5028 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5029
5030 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5031 @opindex Wif-not-aligned
5032 @opindex Wno-if-not-aligned
5033 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5034 should be issued. This is enabled by default.
5035 Use @option{-Wno-if-not-aligned} to disable it.
5036
5037 @item -Wignored-qualifiers @r{(C and C++ only)}
5038 @opindex Wignored-qualifiers
5039 @opindex Wno-ignored-qualifiers
5040 Warn if the return type of a function has a type qualifier
5041 such as @code{const}. For ISO C such a type qualifier has no effect,
5042 since the value returned by a function is not an lvalue.
5043 For C++, the warning is only emitted for scalar types or @code{void}.
5044 ISO C prohibits qualified @code{void} return types on function
5045 definitions, so such return types always receive a warning
5046 even without this option.
5047
5048 This warning is also enabled by @option{-Wextra}.
5049
5050 @item -Wignored-attributes @r{(C and C++ only)}
5051 @opindex Wignored-attributes
5052 @opindex Wno-ignored-attributes
5053 Warn when an attribute is ignored. This is different from the
5054 @option{-Wattributes} option in that it warns whenever the compiler decides
5055 to drop an attribute, not that the attribute is either unknown, used in a
5056 wrong place, etc. This warning is enabled by default.
5057
5058 @item -Wmain
5059 @opindex Wmain
5060 @opindex Wno-main
5061 Warn if the type of @code{main} is suspicious. @code{main} should be
5062 a function with external linkage, returning int, taking either zero
5063 arguments, two, or three arguments of appropriate types. This warning
5064 is enabled by default in C++ and is enabled by either @option{-Wall}
5065 or @option{-Wpedantic}.
5066
5067 @item -Wmisleading-indentation @r{(C and C++ only)}
5068 @opindex Wmisleading-indentation
5069 @opindex Wno-misleading-indentation
5070 Warn when the indentation of the code does not reflect the block structure.
5071 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5072 @code{for} clauses with a guarded statement that does not use braces,
5073 followed by an unguarded statement with the same indentation.
5074
5075 In the following example, the call to ``bar'' is misleadingly indented as
5076 if it were guarded by the ``if'' conditional.
5077
5078 @smallexample
5079 if (some_condition ())
5080 foo ();
5081 bar (); /* Gotcha: this is not guarded by the "if". */
5082 @end smallexample
5083
5084 In the case of mixed tabs and spaces, the warning uses the
5085 @option{-ftabstop=} option to determine if the statements line up
5086 (defaulting to 8).
5087
5088 The warning is not issued for code involving multiline preprocessor logic
5089 such as the following example.
5090
5091 @smallexample
5092 if (flagA)
5093 foo (0);
5094 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5095 if (flagB)
5096 #endif
5097 foo (1);
5098 @end smallexample
5099
5100 The warning is not issued after a @code{#line} directive, since this
5101 typically indicates autogenerated code, and no assumptions can be made
5102 about the layout of the file that the directive references.
5103
5104 This warning is enabled by @option{-Wall} in C and C++.
5105
5106 @item -Wmissing-attributes
5107 @opindex Wmissing-attributes
5108 @opindex Wno-missing-attributes
5109 Warn when a declaration of a function is missing one or more attributes
5110 that a related function is declared with and whose absence may adversely
5111 affect the correctness or efficiency of generated code. For example,
5112 the warning is issued for declarations of aliases that use attributes
5113 to specify less restrictive requirements than those of their targets.
5114 This typically represents a potential optimization opportunity.
5115 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5116 issued when the alias is more restrictive than the target, which could
5117 lead to incorrect code generation.
5118 Attributes considered include @code{alloc_align}, @code{alloc_size},
5119 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5120 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5121 @code{returns_nonnull}, and @code{returns_twice}.
5122
5123 In C++, the warning is issued when an explicit specialization of a primary
5124 template declared with attribute @code{alloc_align}, @code{alloc_size},
5125 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5126 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5127 @code{error}, and @code{warning} suppress the warning.
5128 (@pxref{Function Attributes}).
5129
5130 You can use the @code{copy} attribute to apply the same
5131 set of attributes to a declaration as that on another declaration without
5132 explicitly enumerating the attributes. This attribute can be applied
5133 to declarations of functions (@pxref{Common Function Attributes}),
5134 variables (@pxref{Common Variable Attributes}), or types
5135 (@pxref{Common Type Attributes}).
5136
5137 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5138
5139 For example, since the declaration of the primary function template
5140 below makes use of both attribute @code{malloc} and @code{alloc_size}
5141 the declaration of the explicit specialization of the template is
5142 diagnosed because it is missing one of the attributes.
5143
5144 @smallexample
5145 template <class T>
5146 T* __attribute__ ((malloc, alloc_size (1)))
5147 allocate (size_t);
5148
5149 template <>
5150 void* __attribute__ ((malloc)) // missing alloc_size
5151 allocate<void> (size_t);
5152 @end smallexample
5153
5154 @item -Wmissing-braces
5155 @opindex Wmissing-braces
5156 @opindex Wno-missing-braces
5157 Warn if an aggregate or union initializer is not fully bracketed. In
5158 the following example, the initializer for @code{a} is not fully
5159 bracketed, but that for @code{b} is fully bracketed. This warning is
5160 enabled by @option{-Wall} in C.
5161
5162 @smallexample
5163 int a[2][2] = @{ 0, 1, 2, 3 @};
5164 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5165 @end smallexample
5166
5167 This warning is enabled by @option{-Wall}.
5168
5169 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5170 @opindex Wmissing-include-dirs
5171 @opindex Wno-missing-include-dirs
5172 Warn if a user-supplied include directory does not exist.
5173
5174 @item -Wmissing-profile
5175 @opindex Wmissing-profile
5176 @opindex Wno-missing-profile
5177 Warn if feedback profiles are missing when using the
5178 @option{-fprofile-use} option.
5179 This option diagnoses those cases where a new function or a new file is added
5180 to the user code between compiling with @option{-fprofile-generate} and with
5181 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5182 profile feedback data files do not contain any profile feedback information for
5183 the newly added function or file respectively. Also, in the case when profile
5184 count data (.gcda) files are removed, GCC cannot use any profile feedback
5185 information. In all these cases, warnings are issued to inform the user that a
5186 profile generation step is due. @option{-Wno-missing-profile} can be used to
5187 disable the warning. Ignoring the warning can result in poorly optimized code.
5188 Completely disabling the warning is not recommended and should be done only
5189 when non-existent profile data is justified.
5190
5191 @item -Wmultistatement-macros
5192 @opindex Wmultistatement-macros
5193 @opindex Wno-multistatement-macros
5194 Warn about unsafe multiple statement macros that appear to be guarded
5195 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5196 @code{while}, in which only the first statement is actually guarded after
5197 the macro is expanded.
5198
5199 For example:
5200
5201 @smallexample
5202 #define DOIT x++; y++
5203 if (c)
5204 DOIT;
5205 @end smallexample
5206
5207 will increment @code{y} unconditionally, not just when @code{c} holds.
5208 The can usually be fixed by wrapping the macro in a do-while loop:
5209 @smallexample
5210 #define DOIT do @{ x++; y++; @} while (0)
5211 if (c)
5212 DOIT;
5213 @end smallexample
5214
5215 This warning is enabled by @option{-Wall} in C and C++.
5216
5217 @item -Wparentheses
5218 @opindex Wparentheses
5219 @opindex Wno-parentheses
5220 Warn if parentheses are omitted in certain contexts, such
5221 as when there is an assignment in a context where a truth value
5222 is expected, or when operators are nested whose precedence people
5223 often get confused about.
5224
5225 Also warn if a comparison like @code{x<=y<=z} appears; this is
5226 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5227 interpretation from that of ordinary mathematical notation.
5228
5229 Also warn for dangerous uses of the GNU extension to
5230 @code{?:} with omitted middle operand. When the condition
5231 in the @code{?}: operator is a boolean expression, the omitted value is
5232 always 1. Often programmers expect it to be a value computed
5233 inside the conditional expression instead.
5234
5235 For C++ this also warns for some cases of unnecessary parentheses in
5236 declarations, which can indicate an attempt at a function call instead
5237 of a declaration:
5238 @smallexample
5239 @{
5240 // Declares a local variable called mymutex.
5241 std::unique_lock<std::mutex> (mymutex);
5242 // User meant std::unique_lock<std::mutex> lock (mymutex);
5243 @}
5244 @end smallexample
5245
5246 This warning is enabled by @option{-Wall}.
5247
5248 @item -Wsequence-point
5249 @opindex Wsequence-point
5250 @opindex Wno-sequence-point
5251 Warn about code that may have undefined semantics because of violations
5252 of sequence point rules in the C and C++ standards.
5253
5254 The C and C++ standards define the order in which expressions in a C/C++
5255 program are evaluated in terms of @dfn{sequence points}, which represent
5256 a partial ordering between the execution of parts of the program: those
5257 executed before the sequence point, and those executed after it. These
5258 occur after the evaluation of a full expression (one which is not part
5259 of a larger expression), after the evaluation of the first operand of a
5260 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5261 function is called (but after the evaluation of its arguments and the
5262 expression denoting the called function), and in certain other places.
5263 Other than as expressed by the sequence point rules, the order of
5264 evaluation of subexpressions of an expression is not specified. All
5265 these rules describe only a partial order rather than a total order,
5266 since, for example, if two functions are called within one expression
5267 with no sequence point between them, the order in which the functions
5268 are called is not specified. However, the standards committee have
5269 ruled that function calls do not overlap.
5270
5271 It is not specified when between sequence points modifications to the
5272 values of objects take effect. Programs whose behavior depends on this
5273 have undefined behavior; the C and C++ standards specify that ``Between
5274 the previous and next sequence point an object shall have its stored
5275 value modified at most once by the evaluation of an expression.
5276 Furthermore, the prior value shall be read only to determine the value
5277 to be stored.''. If a program breaks these rules, the results on any
5278 particular implementation are entirely unpredictable.
5279
5280 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5281 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5282 diagnosed by this option, and it may give an occasional false positive
5283 result, but in general it has been found fairly effective at detecting
5284 this sort of problem in programs.
5285
5286 The C++17 standard will define the order of evaluation of operands in
5287 more cases: in particular it requires that the right-hand side of an
5288 assignment be evaluated before the left-hand side, so the above
5289 examples are no longer undefined. But this warning will still warn
5290 about them, to help people avoid writing code that is undefined in C
5291 and earlier revisions of C++.
5292
5293 The standard is worded confusingly, therefore there is some debate
5294 over the precise meaning of the sequence point rules in subtle cases.
5295 Links to discussions of the problem, including proposed formal
5296 definitions, may be found on the GCC readings page, at
5297 @uref{http://gcc.gnu.org/@/readings.html}.
5298
5299 This warning is enabled by @option{-Wall} for C and C++.
5300
5301 @item -Wno-return-local-addr
5302 @opindex Wno-return-local-addr
5303 @opindex Wreturn-local-addr
5304 Do not warn about returning a pointer (or in C++, a reference) to a
5305 variable that goes out of scope after the function returns.
5306
5307 @item -Wreturn-type
5308 @opindex Wreturn-type
5309 @opindex Wno-return-type
5310 Warn whenever a function is defined with a return type that defaults
5311 to @code{int}. Also warn about any @code{return} statement with no
5312 return value in a function whose return type is not @code{void}
5313 (falling off the end of the function body is considered returning
5314 without a value).
5315
5316 For C only, warn about a @code{return} statement with an expression in a
5317 function whose return type is @code{void}, unless the expression type is
5318 also @code{void}. As a GNU extension, the latter case is accepted
5319 without a warning unless @option{-Wpedantic} is used. Attempting
5320 to use the return value of a non-@code{void} function other than @code{main}
5321 that flows off the end by reaching the closing curly brace that terminates
5322 the function is undefined.
5323
5324 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5325 than @code{main} results in undefined behavior even when the value of
5326 the function is not used.
5327
5328 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5329
5330 @item -Wshift-count-negative
5331 @opindex Wshift-count-negative
5332 @opindex Wno-shift-count-negative
5333 Warn if shift count is negative. This warning is enabled by default.
5334
5335 @item -Wshift-count-overflow
5336 @opindex Wshift-count-overflow
5337 @opindex Wno-shift-count-overflow
5338 Warn if shift count >= width of type. This warning is enabled by default.
5339
5340 @item -Wshift-negative-value
5341 @opindex Wshift-negative-value
5342 @opindex Wno-shift-negative-value
5343 Warn if left shifting a negative value. This warning is enabled by
5344 @option{-Wextra} in C99 and C++11 modes (and newer).
5345
5346 @item -Wshift-overflow
5347 @itemx -Wshift-overflow=@var{n}
5348 @opindex Wshift-overflow
5349 @opindex Wno-shift-overflow
5350 Warn about left shift overflows. This warning is enabled by
5351 default in C99 and C++11 modes (and newer).
5352
5353 @table @gcctabopt
5354 @item -Wshift-overflow=1
5355 This is the warning level of @option{-Wshift-overflow} and is enabled
5356 by default in C99 and C++11 modes (and newer). This warning level does
5357 not warn about left-shifting 1 into the sign bit. (However, in C, such
5358 an overflow is still rejected in contexts where an integer constant expression
5359 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5360 shifts always wrap.
5361
5362 @item -Wshift-overflow=2
5363 This warning level also warns about left-shifting 1 into the sign bit,
5364 unless C++14 mode (or newer) is active.
5365 @end table
5366
5367 @item -Wswitch
5368 @opindex Wswitch
5369 @opindex Wno-switch
5370 Warn whenever a @code{switch} statement has an index of enumerated type
5371 and lacks a @code{case} for one or more of the named codes of that
5372 enumeration. (The presence of a @code{default} label prevents this
5373 warning.) @code{case} labels outside the enumeration range also
5374 provoke warnings when this option is used (even if there is a
5375 @code{default} label).
5376 This warning is enabled by @option{-Wall}.
5377
5378 @item -Wswitch-default
5379 @opindex Wswitch-default
5380 @opindex Wno-switch-default
5381 Warn whenever a @code{switch} statement does not have a @code{default}
5382 case.
5383
5384 @item -Wswitch-enum
5385 @opindex Wswitch-enum
5386 @opindex Wno-switch-enum
5387 Warn whenever a @code{switch} statement has an index of enumerated type
5388 and lacks a @code{case} for one or more of the named codes of that
5389 enumeration. @code{case} labels outside the enumeration range also
5390 provoke warnings when this option is used. The only difference
5391 between @option{-Wswitch} and this option is that this option gives a
5392 warning about an omitted enumeration code even if there is a
5393 @code{default} label.
5394
5395 @item -Wswitch-bool
5396 @opindex Wswitch-bool
5397 @opindex Wno-switch-bool
5398 Warn whenever a @code{switch} statement has an index of boolean type
5399 and the case values are outside the range of a boolean type.
5400 It is possible to suppress this warning by casting the controlling
5401 expression to a type other than @code{bool}. For example:
5402 @smallexample
5403 @group
5404 switch ((int) (a == 4))
5405 @{
5406 @dots{}
5407 @}
5408 @end group
5409 @end smallexample
5410 This warning is enabled by default for C and C++ programs.
5411
5412 @item -Wswitch-outside-range
5413 @opindex Wswitch-outside-range
5414 @opindex Wno-switch-outside-range
5415 Warn whenever a @code{switch} case has a value that is outside of its
5416 respective type range. This warning is enabled by default for
5417 C and C++ programs.
5418
5419 @item -Wswitch-unreachable
5420 @opindex Wswitch-unreachable
5421 @opindex Wno-switch-unreachable
5422 Warn whenever a @code{switch} statement contains statements between the
5423 controlling expression and the first case label, which will never be
5424 executed. For example:
5425 @smallexample
5426 @group
5427 switch (cond)
5428 @{
5429 i = 15;
5430 @dots{}
5431 case 5:
5432 @dots{}
5433 @}
5434 @end group
5435 @end smallexample
5436 @option{-Wswitch-unreachable} does not warn if the statement between the
5437 controlling expression and the first case label is just a declaration:
5438 @smallexample
5439 @group
5440 switch (cond)
5441 @{
5442 int i;
5443 @dots{}
5444 case 5:
5445 i = 5;
5446 @dots{}
5447 @}
5448 @end group
5449 @end smallexample
5450 This warning is enabled by default for C and C++ programs.
5451
5452 @item -Wsync-nand @r{(C and C++ only)}
5453 @opindex Wsync-nand
5454 @opindex Wno-sync-nand
5455 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5456 built-in functions are used. These functions changed semantics in GCC 4.4.
5457
5458 @item -Wunused-but-set-parameter
5459 @opindex Wunused-but-set-parameter
5460 @opindex Wno-unused-but-set-parameter
5461 Warn whenever a function parameter is assigned to, but otherwise unused
5462 (aside from its declaration).
5463
5464 To suppress this warning use the @code{unused} attribute
5465 (@pxref{Variable Attributes}).
5466
5467 This warning is also enabled by @option{-Wunused} together with
5468 @option{-Wextra}.
5469
5470 @item -Wunused-but-set-variable
5471 @opindex Wunused-but-set-variable
5472 @opindex Wno-unused-but-set-variable
5473 Warn whenever a local variable is assigned to, but otherwise unused
5474 (aside from its declaration).
5475 This warning is enabled by @option{-Wall}.
5476
5477 To suppress this warning use the @code{unused} attribute
5478 (@pxref{Variable Attributes}).
5479
5480 This warning is also enabled by @option{-Wunused}, which is enabled
5481 by @option{-Wall}.
5482
5483 @item -Wunused-function
5484 @opindex Wunused-function
5485 @opindex Wno-unused-function
5486 Warn whenever a static function is declared but not defined or a
5487 non-inline static function is unused.
5488 This warning is enabled by @option{-Wall}.
5489
5490 @item -Wunused-label
5491 @opindex Wunused-label
5492 @opindex Wno-unused-label
5493 Warn whenever a label is declared but not used.
5494 This warning is enabled by @option{-Wall}.
5495
5496 To suppress this warning use the @code{unused} attribute
5497 (@pxref{Variable Attributes}).
5498
5499 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5500 @opindex Wunused-local-typedefs
5501 @opindex Wno-unused-local-typedefs
5502 Warn when a typedef locally defined in a function is not used.
5503 This warning is enabled by @option{-Wall}.
5504
5505 @item -Wunused-parameter
5506 @opindex Wunused-parameter
5507 @opindex Wno-unused-parameter
5508 Warn whenever a function parameter is unused aside from its declaration.
5509
5510 To suppress this warning use the @code{unused} attribute
5511 (@pxref{Variable Attributes}).
5512
5513 @item -Wno-unused-result
5514 @opindex Wunused-result
5515 @opindex Wno-unused-result
5516 Do not warn if a caller of a function marked with attribute
5517 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5518 its return value. The default is @option{-Wunused-result}.
5519
5520 @item -Wunused-variable
5521 @opindex Wunused-variable
5522 @opindex Wno-unused-variable
5523 Warn whenever a local or static variable is unused aside from its
5524 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5525 but not for C++. This warning is enabled by @option{-Wall}.
5526
5527 To suppress this warning use the @code{unused} attribute
5528 (@pxref{Variable Attributes}).
5529
5530 @item -Wunused-const-variable
5531 @itemx -Wunused-const-variable=@var{n}
5532 @opindex Wunused-const-variable
5533 @opindex Wno-unused-const-variable
5534 Warn whenever a constant static variable is unused aside from its declaration.
5535 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5536 for C, but not for C++. In C this declares variable storage, but in C++ this
5537 is not an error since const variables take the place of @code{#define}s.
5538
5539 To suppress this warning use the @code{unused} attribute
5540 (@pxref{Variable Attributes}).
5541
5542 @table @gcctabopt
5543 @item -Wunused-const-variable=1
5544 This is the warning level that is enabled by @option{-Wunused-variable} for
5545 C. It warns only about unused static const variables defined in the main
5546 compilation unit, but not about static const variables declared in any
5547 header included.
5548
5549 @item -Wunused-const-variable=2
5550 This warning level also warns for unused constant static variables in
5551 headers (excluding system headers). This is the warning level of
5552 @option{-Wunused-const-variable} and must be explicitly requested since
5553 in C++ this isn't an error and in C it might be harder to clean up all
5554 headers included.
5555 @end table
5556
5557 @item -Wunused-value
5558 @opindex Wunused-value
5559 @opindex Wno-unused-value
5560 Warn whenever a statement computes a result that is explicitly not
5561 used. To suppress this warning cast the unused expression to
5562 @code{void}. This includes an expression-statement or the left-hand
5563 side of a comma expression that contains no side effects. For example,
5564 an expression such as @code{x[i,j]} causes a warning, while
5565 @code{x[(void)i,j]} does not.
5566
5567 This warning is enabled by @option{-Wall}.
5568
5569 @item -Wunused
5570 @opindex Wunused
5571 @opindex Wno-unused
5572 All the above @option{-Wunused} options combined.
5573
5574 In order to get a warning about an unused function parameter, you must
5575 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5576 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5577
5578 @item -Wuninitialized
5579 @opindex Wuninitialized
5580 @opindex Wno-uninitialized
5581 Warn if an automatic variable is used without first being initialized.
5582 In C++, warn if a non-static reference or non-static @code{const}
5583 member appears in a class without constructors.
5584
5585 If you want to warn about code that uses the uninitialized value of the
5586 variable in its own initializer, use the @option{-Winit-self} option.
5587
5588 These warnings occur for individual uninitialized elements of
5589 structure, union or array variables as well as for variables that are
5590 uninitialized as a whole. They do not occur for variables or elements
5591 declared @code{volatile}. Because these warnings depend on
5592 optimization, the exact variables or elements for which there are
5593 warnings depend on the precise optimization options and version of GCC
5594 used.
5595
5596 Note that there may be no warning about a variable that is used only
5597 to compute a value that itself is never used, because such
5598 computations may be deleted by data flow analysis before the warnings
5599 are printed.
5600
5601 @item -Winvalid-memory-model
5602 @opindex Winvalid-memory-model
5603 @opindex Wno-invalid-memory-model
5604 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5605 and the C11 atomic generic functions with a memory consistency argument
5606 that is either invalid for the operation or outside the range of values
5607 of the @code{memory_order} enumeration. For example, since the
5608 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5609 defined for the relaxed, release, and sequentially consistent memory
5610 orders the following code is diagnosed:
5611
5612 @smallexample
5613 void store (int *i)
5614 @{
5615 __atomic_store_n (i, 0, memory_order_consume);
5616 @}
5617 @end smallexample
5618
5619 @option{-Winvalid-memory-model} is enabled by default.
5620
5621 @item -Wmaybe-uninitialized
5622 @opindex Wmaybe-uninitialized
5623 @opindex Wno-maybe-uninitialized
5624 For an automatic (i.e.@: local) variable, if there exists a path from the
5625 function entry to a use of the variable that is initialized, but there exist
5626 some other paths for which the variable is not initialized, the compiler
5627 emits a warning if it cannot prove the uninitialized paths are not
5628 executed at run time.
5629
5630 These warnings are only possible in optimizing compilation, because otherwise
5631 GCC does not keep track of the state of variables.
5632
5633 These warnings are made optional because GCC may not be able to determine when
5634 the code is correct in spite of appearing to have an error. Here is one
5635 example of how this can happen:
5636
5637 @smallexample
5638 @group
5639 @{
5640 int x;
5641 switch (y)
5642 @{
5643 case 1: x = 1;
5644 break;
5645 case 2: x = 4;
5646 break;
5647 case 3: x = 5;
5648 @}
5649 foo (x);
5650 @}
5651 @end group
5652 @end smallexample
5653
5654 @noindent
5655 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5656 always initialized, but GCC doesn't know this. To suppress the
5657 warning, you need to provide a default case with assert(0) or
5658 similar code.
5659
5660 @cindex @code{longjmp} warnings
5661 This option also warns when a non-volatile automatic variable might be
5662 changed by a call to @code{longjmp}.
5663 The compiler sees only the calls to @code{setjmp}. It cannot know
5664 where @code{longjmp} will be called; in fact, a signal handler could
5665 call it at any point in the code. As a result, you may get a warning
5666 even when there is in fact no problem because @code{longjmp} cannot
5667 in fact be called at the place that would cause a problem.
5668
5669 Some spurious warnings can be avoided if you declare all the functions
5670 you use that never return as @code{noreturn}. @xref{Function
5671 Attributes}.
5672
5673 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5674
5675 @item -Wunknown-pragmas
5676 @opindex Wunknown-pragmas
5677 @opindex Wno-unknown-pragmas
5678 @cindex warning for unknown pragmas
5679 @cindex unknown pragmas, warning
5680 @cindex pragmas, warning of unknown
5681 Warn when a @code{#pragma} directive is encountered that is not understood by
5682 GCC@. If this command-line option is used, warnings are even issued
5683 for unknown pragmas in system header files. This is not the case if
5684 the warnings are only enabled by the @option{-Wall} command-line option.
5685
5686 @item -Wno-pragmas
5687 @opindex Wno-pragmas
5688 @opindex Wpragmas
5689 Do not warn about misuses of pragmas, such as incorrect parameters,
5690 invalid syntax, or conflicts between pragmas. See also
5691 @option{-Wunknown-pragmas}.
5692
5693 @item -Wno-prio-ctor-dtor
5694 @opindex Wno-prio-ctor-dtor
5695 @opindex Wprio-ctor-dtor
5696 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5697 The use of constructor and destructor attributes allow you to assign a
5698 priority to the constructor/destructor to control its order of execution
5699 before @code{main} is called or after it returns. The priority values must be
5700 greater than 100 as the compiler reserves priority values between 0--100 for
5701 the implementation.
5702
5703 @item -Wstrict-aliasing
5704 @opindex Wstrict-aliasing
5705 @opindex Wno-strict-aliasing
5706 This option is only active when @option{-fstrict-aliasing} is active.
5707 It warns about code that might break the strict aliasing rules that the
5708 compiler is using for optimization. The warning does not catch all
5709 cases, but does attempt to catch the more common pitfalls. It is
5710 included in @option{-Wall}.
5711 It is equivalent to @option{-Wstrict-aliasing=3}
5712
5713 @item -Wstrict-aliasing=n
5714 @opindex Wstrict-aliasing=n
5715 This option is only active when @option{-fstrict-aliasing} is active.
5716 It warns about code that might break the strict aliasing rules that the
5717 compiler is using for optimization.
5718 Higher levels correspond to higher accuracy (fewer false positives).
5719 Higher levels also correspond to more effort, similar to the way @option{-O}
5720 works.
5721 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5722
5723 Level 1: Most aggressive, quick, least accurate.
5724 Possibly useful when higher levels
5725 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5726 false negatives. However, it has many false positives.
5727 Warns for all pointer conversions between possibly incompatible types,
5728 even if never dereferenced. Runs in the front end only.
5729
5730 Level 2: Aggressive, quick, not too precise.
5731 May still have many false positives (not as many as level 1 though),
5732 and few false negatives (but possibly more than level 1).
5733 Unlike level 1, it only warns when an address is taken. Warns about
5734 incomplete types. Runs in the front end only.
5735
5736 Level 3 (default for @option{-Wstrict-aliasing}):
5737 Should have very few false positives and few false
5738 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5739 Takes care of the common pun+dereference pattern in the front end:
5740 @code{*(int*)&some_float}.
5741 If optimization is enabled, it also runs in the back end, where it deals
5742 with multiple statement cases using flow-sensitive points-to information.
5743 Only warns when the converted pointer is dereferenced.
5744 Does not warn about incomplete types.
5745
5746 @item -Wstrict-overflow
5747 @itemx -Wstrict-overflow=@var{n}
5748 @opindex Wstrict-overflow
5749 @opindex Wno-strict-overflow
5750 This option is only active when signed overflow is undefined.
5751 It warns about cases where the compiler optimizes based on the
5752 assumption that signed overflow does not occur. Note that it does not
5753 warn about all cases where the code might overflow: it only warns
5754 about cases where the compiler implements some optimization. Thus
5755 this warning depends on the optimization level.
5756
5757 An optimization that assumes that signed overflow does not occur is
5758 perfectly safe if the values of the variables involved are such that
5759 overflow never does, in fact, occur. Therefore this warning can
5760 easily give a false positive: a warning about code that is not
5761 actually a problem. To help focus on important issues, several
5762 warning levels are defined. No warnings are issued for the use of
5763 undefined signed overflow when estimating how many iterations a loop
5764 requires, in particular when determining whether a loop will be
5765 executed at all.
5766
5767 @table @gcctabopt
5768 @item -Wstrict-overflow=1
5769 Warn about cases that are both questionable and easy to avoid. For
5770 example the compiler simplifies
5771 @code{x + 1 > x} to @code{1}. This level of
5772 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5773 are not, and must be explicitly requested.
5774
5775 @item -Wstrict-overflow=2
5776 Also warn about other cases where a comparison is simplified to a
5777 constant. For example: @code{abs (x) >= 0}. This can only be
5778 simplified when signed integer overflow is undefined, because
5779 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5780 zero. @option{-Wstrict-overflow} (with no level) is the same as
5781 @option{-Wstrict-overflow=2}.
5782
5783 @item -Wstrict-overflow=3
5784 Also warn about other cases where a comparison is simplified. For
5785 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5786
5787 @item -Wstrict-overflow=4
5788 Also warn about other simplifications not covered by the above cases.
5789 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5790
5791 @item -Wstrict-overflow=5
5792 Also warn about cases where the compiler reduces the magnitude of a
5793 constant involved in a comparison. For example: @code{x + 2 > y} is
5794 simplified to @code{x + 1 >= y}. This is reported only at the
5795 highest warning level because this simplification applies to many
5796 comparisons, so this warning level gives a very large number of
5797 false positives.
5798 @end table
5799
5800 @item -Wstringop-overflow
5801 @itemx -Wstringop-overflow=@var{type}
5802 @opindex Wstringop-overflow
5803 @opindex Wno-stringop-overflow
5804 Warn for calls to string manipulation functions such as @code{memcpy} and
5805 @code{strcpy} that are determined to overflow the destination buffer. The
5806 optional argument is one greater than the type of Object Size Checking to
5807 perform to determine the size of the destination. @xref{Object Size Checking}.
5808 The argument is meaningful only for functions that operate on character arrays
5809 but not for raw memory functions like @code{memcpy} which always make use
5810 of Object Size type-0. The option also warns for calls that specify a size
5811 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5812 The option produces the best results with optimization enabled but can detect
5813 a small subset of simple buffer overflows even without optimization in
5814 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5815 correspond to the standard functions. In any case, the option warns about
5816 just a subset of buffer overflows detected by the corresponding overflow
5817 checking built-ins. For example, the option will issue a warning for
5818 the @code{strcpy} call below because it copies at least 5 characters
5819 (the string @code{"blue"} including the terminating NUL) into the buffer
5820 of size 4.
5821
5822 @smallexample
5823 enum Color @{ blue, purple, yellow @};
5824 const char* f (enum Color clr)
5825 @{
5826 static char buf [4];
5827 const char *str;
5828 switch (clr)
5829 @{
5830 case blue: str = "blue"; break;
5831 case purple: str = "purple"; break;
5832 case yellow: str = "yellow"; break;
5833 @}
5834
5835 return strcpy (buf, str); // warning here
5836 @}
5837 @end smallexample
5838
5839 Option @option{-Wstringop-overflow=2} is enabled by default.
5840
5841 @table @gcctabopt
5842 @item -Wstringop-overflow
5843 @itemx -Wstringop-overflow=1
5844 @opindex Wstringop-overflow
5845 @opindex Wno-stringop-overflow
5846 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5847 to determine the sizes of destination objects. This is the default setting
5848 of the option. At this setting the option will not warn for writes past
5849 the end of subobjects of larger objects accessed by pointers unless the
5850 size of the largest surrounding object is known. When the destination may
5851 be one of several objects it is assumed to be the largest one of them. On
5852 Linux systems, when optimization is enabled at this setting the option warns
5853 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5854 a non-zero value.
5855
5856 @item -Wstringop-overflow=2
5857 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5858 to determine the sizes of destination objects. At this setting the option
5859 will warn about overflows when writing to members of the largest complete
5860 objects whose exact size is known. It will, however, not warn for excessive
5861 writes to the same members of unknown objects referenced by pointers since
5862 they may point to arrays containing unknown numbers of elements.
5863
5864 @item -Wstringop-overflow=3
5865 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5866 to determine the sizes of destination objects. At this setting the option
5867 warns about overflowing the smallest object or data member. This is the
5868 most restrictive setting of the option that may result in warnings for safe
5869 code.
5870
5871 @item -Wstringop-overflow=4
5872 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5873 to determine the sizes of destination objects. At this setting the option
5874 will warn about overflowing any data members, and when the destination is
5875 one of several objects it uses the size of the largest of them to decide
5876 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5877 setting of the option may result in warnings for benign code.
5878 @end table
5879
5880 @item -Wstringop-truncation
5881 @opindex Wstringop-truncation
5882 @opindex Wno-stringop-truncation
5883 Warn for calls to bounded string manipulation functions such as @code{strncat},
5884 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5885 or leave the destination unchanged.
5886
5887 In the following example, the call to @code{strncat} specifies a bound that
5888 is less than the length of the source string. As a result, the copy of
5889 the source will be truncated and so the call is diagnosed. To avoid the
5890 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5891
5892 @smallexample
5893 void append (char *buf, size_t bufsize)
5894 @{
5895 strncat (buf, ".txt", 3);
5896 @}
5897 @end smallexample
5898
5899 As another example, the following call to @code{strncpy} results in copying
5900 to @code{d} just the characters preceding the terminating NUL, without
5901 appending the NUL to the end. Assuming the result of @code{strncpy} is
5902 necessarily a NUL-terminated string is a common mistake, and so the call
5903 is diagnosed. To avoid the warning when the result is not expected to be
5904 NUL-terminated, call @code{memcpy} instead.
5905
5906 @smallexample
5907 void copy (char *d, const char *s)
5908 @{
5909 strncpy (d, s, strlen (s));
5910 @}
5911 @end smallexample
5912
5913 In the following example, the call to @code{strncpy} specifies the size
5914 of the destination buffer as the bound. If the length of the source
5915 string is equal to or greater than this size the result of the copy will
5916 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5917 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5918 element of the buffer to @code{NUL}.
5919
5920 @smallexample
5921 void copy (const char *s)
5922 @{
5923 char buf[80];
5924 strncpy (buf, s, sizeof buf);
5925 @dots{}
5926 @}
5927 @end smallexample
5928
5929 In situations where a character array is intended to store a sequence
5930 of bytes with no terminating @code{NUL} such an array may be annotated
5931 with attribute @code{nonstring} to avoid this warning. Such arrays,
5932 however, are not suitable arguments to functions that expect
5933 @code{NUL}-terminated strings. To help detect accidental misuses of
5934 such arrays GCC issues warnings unless it can prove that the use is
5935 safe. @xref{Common Variable Attributes}.
5936
5937 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5938 @opindex Wsuggest-attribute=
5939 @opindex Wno-suggest-attribute=
5940 Warn for cases where adding an attribute may be beneficial. The
5941 attributes currently supported are listed below.
5942
5943 @table @gcctabopt
5944 @item -Wsuggest-attribute=pure
5945 @itemx -Wsuggest-attribute=const
5946 @itemx -Wsuggest-attribute=noreturn
5947 @itemx -Wmissing-noreturn
5948 @itemx -Wsuggest-attribute=malloc
5949 @opindex Wsuggest-attribute=pure
5950 @opindex Wno-suggest-attribute=pure
5951 @opindex Wsuggest-attribute=const
5952 @opindex Wno-suggest-attribute=const
5953 @opindex Wsuggest-attribute=noreturn
5954 @opindex Wno-suggest-attribute=noreturn
5955 @opindex Wmissing-noreturn
5956 @opindex Wno-missing-noreturn
5957 @opindex Wsuggest-attribute=malloc
5958 @opindex Wno-suggest-attribute=malloc
5959
5960 Warn about functions that might be candidates for attributes
5961 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5962 only warns for functions visible in other compilation units or (in the case of
5963 @code{pure} and @code{const}) if it cannot prove that the function returns
5964 normally. A function returns normally if it doesn't contain an infinite loop or
5965 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5966 requires option @option{-fipa-pure-const}, which is enabled by default at
5967 @option{-O} and higher. Higher optimization levels improve the accuracy
5968 of the analysis.
5969
5970 @item -Wsuggest-attribute=format
5971 @itemx -Wmissing-format-attribute
5972 @opindex Wsuggest-attribute=format
5973 @opindex Wmissing-format-attribute
5974 @opindex Wno-suggest-attribute=format
5975 @opindex Wno-missing-format-attribute
5976 @opindex Wformat
5977 @opindex Wno-format
5978
5979 Warn about function pointers that might be candidates for @code{format}
5980 attributes. Note these are only possible candidates, not absolute ones.
5981 GCC guesses that function pointers with @code{format} attributes that
5982 are used in assignment, initialization, parameter passing or return
5983 statements should have a corresponding @code{format} attribute in the
5984 resulting type. I.e.@: the left-hand side of the assignment or
5985 initialization, the type of the parameter variable, or the return type
5986 of the containing function respectively should also have a @code{format}
5987 attribute to avoid the warning.
5988
5989 GCC also warns about function definitions that might be
5990 candidates for @code{format} attributes. Again, these are only
5991 possible candidates. GCC guesses that @code{format} attributes
5992 might be appropriate for any function that calls a function like
5993 @code{vprintf} or @code{vscanf}, but this might not always be the
5994 case, and some functions for which @code{format} attributes are
5995 appropriate may not be detected.
5996
5997 @item -Wsuggest-attribute=cold
5998 @opindex Wsuggest-attribute=cold
5999 @opindex Wno-suggest-attribute=cold
6000
6001 Warn about functions that might be candidates for @code{cold} attribute. This
6002 is based on static detection and generally will only warn about functions which
6003 always leads to a call to another @code{cold} function such as wrappers of
6004 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6005 @end table
6006
6007 @item -Wsuggest-final-types
6008 @opindex Wno-suggest-final-types
6009 @opindex Wsuggest-final-types
6010 Warn about types with virtual methods where code quality would be improved
6011 if the type were declared with the C++11 @code{final} specifier,
6012 or, if possible,
6013 declared in an anonymous namespace. This allows GCC to more aggressively
6014 devirtualize the polymorphic calls. This warning is more effective with
6015 link-time optimization,
6016 where the information about the class hierarchy graph is
6017 more complete.
6018
6019 @item -Wsuggest-final-methods
6020 @opindex Wno-suggest-final-methods
6021 @opindex Wsuggest-final-methods
6022 Warn about virtual methods where code quality would be improved if the method
6023 were declared with the C++11 @code{final} specifier,
6024 or, if possible, its type were
6025 declared in an anonymous namespace or with the @code{final} specifier.
6026 This warning is
6027 more effective with link-time optimization, where the information about the
6028 class hierarchy graph is more complete. It is recommended to first consider
6029 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6030 annotations.
6031
6032 @item -Wsuggest-override
6033 Warn about overriding virtual functions that are not marked with the override
6034 keyword.
6035
6036 @item -Walloc-zero
6037 @opindex Wno-alloc-zero
6038 @opindex Walloc-zero
6039 Warn about calls to allocation functions decorated with attribute
6040 @code{alloc_size} that specify zero bytes, including those to the built-in
6041 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6042 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6043 when called with a zero size differs among implementations (and in the case
6044 of @code{realloc} has been deprecated) relying on it may result in subtle
6045 portability bugs and should be avoided.
6046
6047 @item -Walloc-size-larger-than=@var{byte-size}
6048 @opindex Walloc-size-larger-than=
6049 @opindex Wno-alloc-size-larger-than
6050 Warn about calls to functions decorated with attribute @code{alloc_size}
6051 that attempt to allocate objects larger than the specified number of bytes,
6052 or where the result of the size computation in an integer type with infinite
6053 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6054 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6055 Warnings controlled by the option can be disabled either by specifying
6056 @var{byte-size} of @samp{SIZE_MAX} or more or by
6057 @option{-Wno-alloc-size-larger-than}.
6058 @xref{Function Attributes}.
6059
6060 @item -Wno-alloc-size-larger-than
6061 @opindex Wno-alloc-size-larger-than
6062 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6063 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6064 larger.
6065
6066 @item -Walloca
6067 @opindex Wno-alloca
6068 @opindex Walloca
6069 This option warns on all uses of @code{alloca} in the source.
6070
6071 @item -Walloca-larger-than=@var{byte-size}
6072 @opindex Walloca-larger-than=
6073 @opindex Wno-alloca-larger-than
6074 This option warns on calls to @code{alloca} with an integer argument whose
6075 value is either zero, or that is not bounded by a controlling predicate
6076 that limits its value to at most @var{byte-size}. It also warns for calls
6077 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6078 types are considered unbounded even if they appear to be constrained to
6079 the expected range.
6080
6081 For example, a bounded case of @code{alloca} could be:
6082
6083 @smallexample
6084 void func (size_t n)
6085 @{
6086 void *p;
6087 if (n <= 1000)
6088 p = alloca (n);
6089 else
6090 p = malloc (n);
6091 f (p);
6092 @}
6093 @end smallexample
6094
6095 In the above example, passing @code{-Walloca-larger-than=1000} would not
6096 issue a warning because the call to @code{alloca} is known to be at most
6097 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6098 the compiler would emit a warning.
6099
6100 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6101 controlling predicate constraining its integer argument. For example:
6102
6103 @smallexample
6104 void func ()
6105 @{
6106 void *p = alloca (n);
6107 f (p);
6108 @}
6109 @end smallexample
6110
6111 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6112 a warning, but this time because of the lack of bounds checking.
6113
6114 Note, that even seemingly correct code involving signed integers could
6115 cause a warning:
6116
6117 @smallexample
6118 void func (signed int n)
6119 @{
6120 if (n < 500)
6121 @{
6122 p = alloca (n);
6123 f (p);
6124 @}
6125 @}
6126 @end smallexample
6127
6128 In the above example, @var{n} could be negative, causing a larger than
6129 expected argument to be implicitly cast into the @code{alloca} call.
6130
6131 This option also warns when @code{alloca} is used in a loop.
6132
6133 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6134 but is usually only effective when @option{-ftree-vrp} is active (default
6135 for @option{-O2} and above).
6136
6137 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6138
6139 @item -Wno-alloca-larger-than
6140 @opindex Wno-alloca-larger-than
6141 Disable @option{-Walloca-larger-than=} warnings. The option is
6142 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6143
6144 @item -Warray-bounds
6145 @itemx -Warray-bounds=@var{n}
6146 @opindex Wno-array-bounds
6147 @opindex Warray-bounds
6148 This option is only active when @option{-ftree-vrp} is active
6149 (default for @option{-O2} and above). It warns about subscripts to arrays
6150 that are always out of bounds. This warning is enabled by @option{-Wall}.
6151
6152 @table @gcctabopt
6153 @item -Warray-bounds=1
6154 This is the warning level of @option{-Warray-bounds} and is enabled
6155 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6156
6157 @item -Warray-bounds=2
6158 This warning level also warns about out of bounds access for
6159 arrays at the end of a struct and for arrays accessed through
6160 pointers. This warning level may give a larger number of
6161 false positives and is deactivated by default.
6162 @end table
6163
6164 @item -Wattribute-alias=@var{n}
6165 @itemx -Wno-attribute-alias
6166 @opindex Wattribute-alias
6167 @opindex Wno-attribute-alias
6168 Warn about declarations using the @code{alias} and similar attributes whose
6169 target is incompatible with the type of the alias.
6170 @xref{Function Attributes,,Declaring Attributes of Functions}.
6171
6172 @table @gcctabopt
6173 @item -Wattribute-alias=1
6174 The default warning level of the @option{-Wattribute-alias} option diagnoses
6175 incompatibilities between the type of the alias declaration and that of its
6176 target. Such incompatibilities are typically indicative of bugs.
6177
6178 @item -Wattribute-alias=2
6179
6180 At this level @option{-Wattribute-alias} also diagnoses cases where
6181 the attributes of the alias declaration are more restrictive than the
6182 attributes applied to its target. These mismatches can potentially
6183 result in incorrect code generation. In other cases they may be
6184 benign and could be resolved simply by adding the missing attribute to
6185 the target. For comparison, see the @option{-Wmissing-attributes}
6186 option, which controls diagnostics when the alias declaration is less
6187 restrictive than the target, rather than more restrictive.
6188
6189 Attributes considered include @code{alloc_align}, @code{alloc_size},
6190 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6191 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6192 @code{returns_nonnull}, and @code{returns_twice}.
6193 @end table
6194
6195 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6196 This is the default. You can disable these warnings with either
6197 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6198
6199 @item -Wbool-compare
6200 @opindex Wno-bool-compare
6201 @opindex Wbool-compare
6202 Warn about boolean expression compared with an integer value different from
6203 @code{true}/@code{false}. For instance, the following comparison is
6204 always false:
6205 @smallexample
6206 int n = 5;
6207 @dots{}
6208 if ((n > 1) == 2) @{ @dots{} @}
6209 @end smallexample
6210 This warning is enabled by @option{-Wall}.
6211
6212 @item -Wbool-operation
6213 @opindex Wno-bool-operation
6214 @opindex Wbool-operation
6215 Warn about suspicious operations on expressions of a boolean type. For
6216 instance, bitwise negation of a boolean is very likely a bug in the program.
6217 For C, this warning also warns about incrementing or decrementing a boolean,
6218 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6219 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6220
6221 This warning is enabled by @option{-Wall}.
6222
6223 @item -Wduplicated-branches
6224 @opindex Wno-duplicated-branches
6225 @opindex Wduplicated-branches
6226 Warn when an if-else has identical branches. This warning detects cases like
6227 @smallexample
6228 if (p != NULL)
6229 return 0;
6230 else
6231 return 0;
6232 @end smallexample
6233 It doesn't warn when both branches contain just a null statement. This warning
6234 also warn for conditional operators:
6235 @smallexample
6236 int i = x ? *p : *p;
6237 @end smallexample
6238
6239 @item -Wduplicated-cond
6240 @opindex Wno-duplicated-cond
6241 @opindex Wduplicated-cond
6242 Warn about duplicated conditions in an if-else-if chain. For instance,
6243 warn for the following code:
6244 @smallexample
6245 if (p->q != NULL) @{ @dots{} @}
6246 else if (p->q != NULL) @{ @dots{} @}
6247 @end smallexample
6248
6249 @item -Wframe-address
6250 @opindex Wno-frame-address
6251 @opindex Wframe-address
6252 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6253 is called with an argument greater than 0. Such calls may return indeterminate
6254 values or crash the program. The warning is included in @option{-Wall}.
6255
6256 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6257 @opindex Wno-discarded-qualifiers
6258 @opindex Wdiscarded-qualifiers
6259 Do not warn if type qualifiers on pointers are being discarded.
6260 Typically, the compiler warns if a @code{const char *} variable is
6261 passed to a function that takes a @code{char *} parameter. This option
6262 can be used to suppress such a warning.
6263
6264 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6265 @opindex Wno-discarded-array-qualifiers
6266 @opindex Wdiscarded-array-qualifiers
6267 Do not warn if type qualifiers on arrays which are pointer targets
6268 are being discarded. Typically, the compiler warns if a
6269 @code{const int (*)[]} variable is passed to a function that
6270 takes a @code{int (*)[]} parameter. This option can be used to
6271 suppress such a warning.
6272
6273 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6274 @opindex Wno-incompatible-pointer-types
6275 @opindex Wincompatible-pointer-types
6276 Do not warn when there is a conversion between pointers that have incompatible
6277 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6278 which warns for pointer argument passing or assignment with different
6279 signedness.
6280
6281 @item -Wno-int-conversion @r{(C and Objective-C only)}
6282 @opindex Wno-int-conversion
6283 @opindex Wint-conversion
6284 Do not warn about incompatible integer to pointer and pointer to integer
6285 conversions. This warning is about implicit conversions; for explicit
6286 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6287 @option{-Wno-pointer-to-int-cast} may be used.
6288
6289 @item -Wno-div-by-zero
6290 @opindex Wno-div-by-zero
6291 @opindex Wdiv-by-zero
6292 Do not warn about compile-time integer division by zero. Floating-point
6293 division by zero is not warned about, as it can be a legitimate way of
6294 obtaining infinities and NaNs.
6295
6296 @item -Wsystem-headers
6297 @opindex Wsystem-headers
6298 @opindex Wno-system-headers
6299 @cindex warnings from system headers
6300 @cindex system headers, warnings from
6301 Print warning messages for constructs found in system header files.
6302 Warnings from system headers are normally suppressed, on the assumption
6303 that they usually do not indicate real problems and would only make the
6304 compiler output harder to read. Using this command-line option tells
6305 GCC to emit warnings from system headers as if they occurred in user
6306 code. However, note that using @option{-Wall} in conjunction with this
6307 option does @emph{not} warn about unknown pragmas in system
6308 headers---for that, @option{-Wunknown-pragmas} must also be used.
6309
6310 @item -Wtautological-compare
6311 @opindex Wtautological-compare
6312 @opindex Wno-tautological-compare
6313 Warn if a self-comparison always evaluates to true or false. This
6314 warning detects various mistakes such as:
6315 @smallexample
6316 int i = 1;
6317 @dots{}
6318 if (i > i) @{ @dots{} @}
6319 @end smallexample
6320
6321 This warning also warns about bitwise comparisons that always evaluate
6322 to true or false, for instance:
6323 @smallexample
6324 if ((a & 16) == 10) @{ @dots{} @}
6325 @end smallexample
6326 will always be false.
6327
6328 This warning is enabled by @option{-Wall}.
6329
6330 @item -Wtrampolines
6331 @opindex Wtrampolines
6332 @opindex Wno-trampolines
6333 Warn about trampolines generated for pointers to nested functions.
6334 A trampoline is a small piece of data or code that is created at run
6335 time on the stack when the address of a nested function is taken, and is
6336 used to call the nested function indirectly. For some targets, it is
6337 made up of data only and thus requires no special treatment. But, for
6338 most targets, it is made up of code and thus requires the stack to be
6339 made executable in order for the program to work properly.
6340
6341 @item -Wfloat-equal
6342 @opindex Wfloat-equal
6343 @opindex Wno-float-equal
6344 Warn if floating-point values are used in equality comparisons.
6345
6346 The idea behind this is that sometimes it is convenient (for the
6347 programmer) to consider floating-point values as approximations to
6348 infinitely precise real numbers. If you are doing this, then you need
6349 to compute (by analyzing the code, or in some other way) the maximum or
6350 likely maximum error that the computation introduces, and allow for it
6351 when performing comparisons (and when producing output, but that's a
6352 different problem). In particular, instead of testing for equality, you
6353 should check to see whether the two values have ranges that overlap; and
6354 this is done with the relational operators, so equality comparisons are
6355 probably mistaken.
6356
6357 @item -Wtraditional @r{(C and Objective-C only)}
6358 @opindex Wtraditional
6359 @opindex Wno-traditional
6360 Warn about certain constructs that behave differently in traditional and
6361 ISO C@. Also warn about ISO C constructs that have no traditional C
6362 equivalent, and/or problematic constructs that should be avoided.
6363
6364 @itemize @bullet
6365 @item
6366 Macro parameters that appear within string literals in the macro body.
6367 In traditional C macro replacement takes place within string literals,
6368 but in ISO C it does not.
6369
6370 @item
6371 In traditional C, some preprocessor directives did not exist.
6372 Traditional preprocessors only considered a line to be a directive
6373 if the @samp{#} appeared in column 1 on the line. Therefore
6374 @option{-Wtraditional} warns about directives that traditional C
6375 understands but ignores because the @samp{#} does not appear as the
6376 first character on the line. It also suggests you hide directives like
6377 @code{#pragma} not understood by traditional C by indenting them. Some
6378 traditional implementations do not recognize @code{#elif}, so this option
6379 suggests avoiding it altogether.
6380
6381 @item
6382 A function-like macro that appears without arguments.
6383
6384 @item
6385 The unary plus operator.
6386
6387 @item
6388 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6389 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6390 constants.) Note, these suffixes appear in macros defined in the system
6391 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6392 Use of these macros in user code might normally lead to spurious
6393 warnings, however GCC's integrated preprocessor has enough context to
6394 avoid warning in these cases.
6395
6396 @item
6397 A function declared external in one block and then used after the end of
6398 the block.
6399
6400 @item
6401 A @code{switch} statement has an operand of type @code{long}.
6402
6403 @item
6404 A non-@code{static} function declaration follows a @code{static} one.
6405 This construct is not accepted by some traditional C compilers.
6406
6407 @item
6408 The ISO type of an integer constant has a different width or
6409 signedness from its traditional type. This warning is only issued if
6410 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6411 typically represent bit patterns, are not warned about.
6412
6413 @item
6414 Usage of ISO string concatenation is detected.
6415
6416 @item
6417 Initialization of automatic aggregates.
6418
6419 @item
6420 Identifier conflicts with labels. Traditional C lacks a separate
6421 namespace for labels.
6422
6423 @item
6424 Initialization of unions. If the initializer is zero, the warning is
6425 omitted. This is done under the assumption that the zero initializer in
6426 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6427 initializer warnings and relies on default initialization to zero in the
6428 traditional C case.
6429
6430 @item
6431 Conversions by prototypes between fixed/floating-point values and vice
6432 versa. The absence of these prototypes when compiling with traditional
6433 C causes serious problems. This is a subset of the possible
6434 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6435
6436 @item
6437 Use of ISO C style function definitions. This warning intentionally is
6438 @emph{not} issued for prototype declarations or variadic functions
6439 because these ISO C features appear in your code when using
6440 libiberty's traditional C compatibility macros, @code{PARAMS} and
6441 @code{VPARAMS}. This warning is also bypassed for nested functions
6442 because that feature is already a GCC extension and thus not relevant to
6443 traditional C compatibility.
6444 @end itemize
6445
6446 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6447 @opindex Wtraditional-conversion
6448 @opindex Wno-traditional-conversion
6449 Warn if a prototype causes a type conversion that is different from what
6450 would happen to the same argument in the absence of a prototype. This
6451 includes conversions of fixed point to floating and vice versa, and
6452 conversions changing the width or signedness of a fixed-point argument
6453 except when the same as the default promotion.
6454
6455 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6456 @opindex Wdeclaration-after-statement
6457 @opindex Wno-declaration-after-statement
6458 Warn when a declaration is found after a statement in a block. This
6459 construct, known from C++, was introduced with ISO C99 and is by default
6460 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6461
6462 @item -Wshadow
6463 @opindex Wshadow
6464 @opindex Wno-shadow
6465 Warn whenever a local variable or type declaration shadows another
6466 variable, parameter, type, class member (in C++), or instance variable
6467 (in Objective-C) or whenever a built-in function is shadowed. Note
6468 that in C++, the compiler warns if a local variable shadows an
6469 explicit typedef, but not if it shadows a struct/class/enum.
6470 Same as @option{-Wshadow=global}.
6471
6472 @item -Wno-shadow-ivar @r{(Objective-C only)}
6473 @opindex Wno-shadow-ivar
6474 @opindex Wshadow-ivar
6475 Do not warn whenever a local variable shadows an instance variable in an
6476 Objective-C method.
6477
6478 @item -Wshadow=global
6479 @opindex Wshadow=global
6480 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6481 This warning is enabled by @option{-Wshadow=global}.
6482
6483 @item -Wshadow=local
6484 @opindex Wshadow=local
6485 Warn when a local variable shadows another local variable or parameter.
6486 This warning is enabled by @option{-Wshadow=local}.
6487
6488 @item -Wshadow=compatible-local
6489 @opindex Wshadow=compatible-local
6490 Warn when a local variable shadows another local variable or parameter
6491 whose type is compatible with that of the shadowing variable. In C++,
6492 type compatibility here means the type of the shadowing variable can be
6493 converted to that of the shadowed variable. The creation of this flag
6494 (in addition to @option{-Wshadow=local}) is based on the idea that when
6495 a local variable shadows another one of incompatible type, it is most
6496 likely intentional, not a bug or typo, as shown in the following example:
6497
6498 @smallexample
6499 @group
6500 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6501 @{
6502 for (int i = 0; i < N; ++i)
6503 @{
6504 ...
6505 @}
6506 ...
6507 @}
6508 @end group
6509 @end smallexample
6510
6511 Since the two variable @code{i} in the example above have incompatible types,
6512 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6513 Because their types are incompatible, if a programmer accidentally uses one
6514 in place of the other, type checking will catch that and emit an error or
6515 warning. So not warning (about shadowing) in this case will not lead to
6516 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6517 possibly reduce the number of warnings triggered by intentional shadowing.
6518 Note that this does also mean that shadowing @code{const char *i} by
6519 @code{char *i} will not emit a warning.
6520
6521 This warning is enabled by @option{-Wshadow=compatible-local}.
6522
6523 @item -Wlarger-than=@var{byte-size}
6524 @opindex Wlarger-than=
6525 @opindex Wlarger-than-@var{byte-size}
6526 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6527 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6528 Warnings controlled by the option can be disabled either by specifying
6529 @var{byte-size} of @samp{SIZE_MAX} or more or by
6530 @option{-Wno-larger-than}.
6531
6532 @item -Wno-larger-than
6533 @opindex Wno-larger-than
6534 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6535 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6536
6537 @item -Wframe-larger-than=@var{byte-size}
6538 @opindex Wframe-larger-than=
6539 @opindex Wno-frame-larger-than
6540 Warn if the size of a function frame exceeds @var{byte-size}.
6541 The computation done to determine the stack frame size is approximate
6542 and not conservative.
6543 The actual requirements may be somewhat greater than @var{byte-size}
6544 even if you do not get a warning. In addition, any space allocated
6545 via @code{alloca}, variable-length arrays, or related constructs
6546 is not included by the compiler when determining
6547 whether or not to issue a warning.
6548 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6549 Warnings controlled by the option can be disabled either by specifying
6550 @var{byte-size} of @samp{SIZE_MAX} or more or by
6551 @option{-Wno-frame-larger-than}.
6552
6553 @item -Wno-frame-larger-than
6554 @opindex Wno-frame-larger-than
6555 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6556 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6557
6558 @item -Wno-free-nonheap-object
6559 @opindex Wno-free-nonheap-object
6560 @opindex Wfree-nonheap-object
6561 Do not warn when attempting to free an object that was not allocated
6562 on the heap.
6563
6564 @item -Wstack-usage=@var{byte-size}
6565 @opindex Wstack-usage
6566 @opindex Wno-stack-usage
6567 Warn if the stack usage of a function might exceed @var{byte-size}.
6568 The computation done to determine the stack usage is conservative.
6569 Any space allocated via @code{alloca}, variable-length arrays, or related
6570 constructs is included by the compiler when determining whether or not to
6571 issue a warning.
6572
6573 The message is in keeping with the output of @option{-fstack-usage}.
6574
6575 @itemize
6576 @item
6577 If the stack usage is fully static but exceeds the specified amount, it's:
6578
6579 @smallexample
6580 warning: stack usage is 1120 bytes
6581 @end smallexample
6582 @item
6583 If the stack usage is (partly) dynamic but bounded, it's:
6584
6585 @smallexample
6586 warning: stack usage might be 1648 bytes
6587 @end smallexample
6588 @item
6589 If the stack usage is (partly) dynamic and not bounded, it's:
6590
6591 @smallexample
6592 warning: stack usage might be unbounded
6593 @end smallexample
6594 @end itemize
6595
6596 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6597 Warnings controlled by the option can be disabled either by specifying
6598 @var{byte-size} of @samp{SIZE_MAX} or more or by
6599 @option{-Wno-stack-usage}.
6600
6601 @item -Wno-stack-usage
6602 @opindex Wno-stack-usage
6603 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6604 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6605
6606 @item -Wunsafe-loop-optimizations
6607 @opindex Wunsafe-loop-optimizations
6608 @opindex Wno-unsafe-loop-optimizations
6609 Warn if the loop cannot be optimized because the compiler cannot
6610 assume anything on the bounds of the loop indices. With
6611 @option{-funsafe-loop-optimizations} warn if the compiler makes
6612 such assumptions.
6613
6614 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6615 @opindex Wno-pedantic-ms-format
6616 @opindex Wpedantic-ms-format
6617 When used in combination with @option{-Wformat}
6618 and @option{-pedantic} without GNU extensions, this option
6619 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6620 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6621 which depend on the MS runtime.
6622
6623 @item -Waligned-new
6624 @opindex Waligned-new
6625 @opindex Wno-aligned-new
6626 Warn about a new-expression of a type that requires greater alignment
6627 than the @code{alignof(std::max_align_t)} but uses an allocation
6628 function without an explicit alignment parameter. This option is
6629 enabled by @option{-Wall}.
6630
6631 Normally this only warns about global allocation functions, but
6632 @option{-Waligned-new=all} also warns about class member allocation
6633 functions.
6634
6635 @item -Wplacement-new
6636 @itemx -Wplacement-new=@var{n}
6637 @opindex Wplacement-new
6638 @opindex Wno-placement-new
6639 Warn about placement new expressions with undefined behavior, such as
6640 constructing an object in a buffer that is smaller than the type of
6641 the object. For example, the placement new expression below is diagnosed
6642 because it attempts to construct an array of 64 integers in a buffer only
6643 64 bytes large.
6644 @smallexample
6645 char buf [64];
6646 new (buf) int[64];
6647 @end smallexample
6648 This warning is enabled by default.
6649
6650 @table @gcctabopt
6651 @item -Wplacement-new=1
6652 This is the default warning level of @option{-Wplacement-new}. At this
6653 level the warning is not issued for some strictly undefined constructs that
6654 GCC allows as extensions for compatibility with legacy code. For example,
6655 the following @code{new} expression is not diagnosed at this level even
6656 though it has undefined behavior according to the C++ standard because
6657 it writes past the end of the one-element array.
6658 @smallexample
6659 struct S @{ int n, a[1]; @};
6660 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6661 new (s->a)int [32]();
6662 @end smallexample
6663
6664 @item -Wplacement-new=2
6665 At this level, in addition to diagnosing all the same constructs as at level
6666 1, a diagnostic is also issued for placement new expressions that construct
6667 an object in the last member of structure whose type is an array of a single
6668 element and whose size is less than the size of the object being constructed.
6669 While the previous example would be diagnosed, the following construct makes
6670 use of the flexible member array extension to avoid the warning at level 2.
6671 @smallexample
6672 struct S @{ int n, a[]; @};
6673 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6674 new (s->a)int [32]();
6675 @end smallexample
6676
6677 @end table
6678
6679 @item -Wpointer-arith
6680 @opindex Wpointer-arith
6681 @opindex Wno-pointer-arith
6682 Warn about anything that depends on the ``size of'' a function type or
6683 of @code{void}. GNU C assigns these types a size of 1, for
6684 convenience in calculations with @code{void *} pointers and pointers
6685 to functions. In C++, warn also when an arithmetic operation involves
6686 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6687
6688 @item -Wpointer-compare
6689 @opindex Wpointer-compare
6690 @opindex Wno-pointer-compare
6691 Warn if a pointer is compared with a zero character constant. This usually
6692 means that the pointer was meant to be dereferenced. For example:
6693
6694 @smallexample
6695 const char *p = foo ();
6696 if (p == '\0')
6697 return 42;
6698 @end smallexample
6699
6700 Note that the code above is invalid in C++11.
6701
6702 This warning is enabled by default.
6703
6704 @item -Wtype-limits
6705 @opindex Wtype-limits
6706 @opindex Wno-type-limits
6707 Warn if a comparison is always true or always false due to the limited
6708 range of the data type, but do not warn for constant expressions. For
6709 example, warn if an unsigned variable is compared against zero with
6710 @code{<} or @code{>=}. This warning is also enabled by
6711 @option{-Wextra}.
6712
6713 @item -Wabsolute-value @r{(C and Objective-C only)}
6714 @opindex Wabsolute-value
6715 @opindex Wno-absolute-value
6716 Warn for calls to standard functions that compute the absolute value
6717 of an argument when a more appropriate standard function is available.
6718 For example, calling @code{abs(3.14)} triggers the warning because the
6719 appropriate function to call to compute the absolute value of a double
6720 argument is @code{fabs}. The option also triggers warnings when the
6721 argument in a call to such a function has an unsigned type. This
6722 warning can be suppressed with an explicit type cast and it is also
6723 enabled by @option{-Wextra}.
6724
6725 @include cppwarnopts.texi
6726
6727 @item -Wbad-function-cast @r{(C and Objective-C only)}
6728 @opindex Wbad-function-cast
6729 @opindex Wno-bad-function-cast
6730 Warn when a function call is cast to a non-matching type.
6731 For example, warn if a call to a function returning an integer type
6732 is cast to a pointer type.
6733
6734 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6735 @opindex Wc90-c99-compat
6736 @opindex Wno-c90-c99-compat
6737 Warn about features not present in ISO C90, but present in ISO C99.
6738 For instance, warn about use of variable length arrays, @code{long long}
6739 type, @code{bool} type, compound literals, designated initializers, and so
6740 on. This option is independent of the standards mode. Warnings are disabled
6741 in the expression that follows @code{__extension__}.
6742
6743 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6744 @opindex Wc99-c11-compat
6745 @opindex Wno-c99-c11-compat
6746 Warn about features not present in ISO C99, but present in ISO C11.
6747 For instance, warn about use of anonymous structures and unions,
6748 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6749 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6750 and so on. This option is independent of the standards mode. Warnings are
6751 disabled in the expression that follows @code{__extension__}.
6752
6753 @item -Wc++-compat @r{(C and Objective-C only)}
6754 @opindex Wc++-compat
6755 @opindex Wno-c++-compat
6756 Warn about ISO C constructs that are outside of the common subset of
6757 ISO C and ISO C++, e.g.@: request for implicit conversion from
6758 @code{void *} to a pointer to non-@code{void} type.
6759
6760 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6761 @opindex Wc++11-compat
6762 @opindex Wno-c++11-compat
6763 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6764 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6765 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6766 enabled by @option{-Wall}.
6767
6768 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6769 @opindex Wc++14-compat
6770 @opindex Wno-c++14-compat
6771 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6772 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6773
6774 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6775 @opindex Wc++17-compat
6776 @opindex Wno-c++17-compat
6777 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6778 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6779
6780 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6781 @opindex Wc++20-compat
6782 @opindex Wno-c++20-compat
6783 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6784 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6785
6786 @item -Wcast-qual
6787 @opindex Wcast-qual
6788 @opindex Wno-cast-qual
6789 Warn whenever a pointer is cast so as to remove a type qualifier from
6790 the target type. For example, warn if a @code{const char *} is cast
6791 to an ordinary @code{char *}.
6792
6793 Also warn when making a cast that introduces a type qualifier in an
6794 unsafe way. For example, casting @code{char **} to @code{const char **}
6795 is unsafe, as in this example:
6796
6797 @smallexample
6798 /* p is char ** value. */
6799 const char **q = (const char **) p;
6800 /* Assignment of readonly string to const char * is OK. */
6801 *q = "string";
6802 /* Now char** pointer points to read-only memory. */
6803 **p = 'b';
6804 @end smallexample
6805
6806 @item -Wcast-align
6807 @opindex Wcast-align
6808 @opindex Wno-cast-align
6809 Warn whenever a pointer is cast such that the required alignment of the
6810 target is increased. For example, warn if a @code{char *} is cast to
6811 an @code{int *} on machines where integers can only be accessed at
6812 two- or four-byte boundaries.
6813
6814 @item -Wcast-align=strict
6815 @opindex Wcast-align=strict
6816 Warn whenever a pointer is cast such that the required alignment of the
6817 target is increased. For example, warn if a @code{char *} is cast to
6818 an @code{int *} regardless of the target machine.
6819
6820 @item -Wcast-function-type
6821 @opindex Wcast-function-type
6822 @opindex Wno-cast-function-type
6823 Warn when a function pointer is cast to an incompatible function pointer.
6824 In a cast involving function types with a variable argument list only
6825 the types of initial arguments that are provided are considered.
6826 Any parameter of pointer-type matches any other pointer-type. Any benign
6827 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6828 on ILP32 targets. Likewise type qualifiers are ignored. The function
6829 type @code{void (*) (void)} is special and matches everything, which can
6830 be used to suppress this warning.
6831 In a cast involving pointer to member types this warning warns whenever
6832 the type cast is changing the pointer to member type.
6833 This warning is enabled by @option{-Wextra}.
6834
6835 @item -Wwrite-strings
6836 @opindex Wwrite-strings
6837 @opindex Wno-write-strings
6838 When compiling C, give string constants the type @code{const
6839 char[@var{length}]} so that copying the address of one into a
6840 non-@code{const} @code{char *} pointer produces a warning. These
6841 warnings help you find at compile time code that can try to write
6842 into a string constant, but only if you have been very careful about
6843 using @code{const} in declarations and prototypes. Otherwise, it is
6844 just a nuisance. This is why we did not make @option{-Wall} request
6845 these warnings.
6846
6847 When compiling C++, warn about the deprecated conversion from string
6848 literals to @code{char *}. This warning is enabled by default for C++
6849 programs.
6850
6851 @item -Wcatch-value
6852 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6853 @opindex Wcatch-value
6854 @opindex Wno-catch-value
6855 Warn about catch handlers that do not catch via reference.
6856 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6857 warn about polymorphic class types that are caught by value.
6858 With @option{-Wcatch-value=2} warn about all class types that are caught
6859 by value. With @option{-Wcatch-value=3} warn about all types that are
6860 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6861
6862 @item -Wclobbered
6863 @opindex Wclobbered
6864 @opindex Wno-clobbered
6865 Warn for variables that might be changed by @code{longjmp} or
6866 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6867
6868 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6869 @opindex Wconditionally-supported
6870 @opindex Wno-conditionally-supported
6871 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6872
6873 @item -Wconversion
6874 @opindex Wconversion
6875 @opindex Wno-conversion
6876 Warn for implicit conversions that may alter a value. This includes
6877 conversions between real and integer, like @code{abs (x)} when
6878 @code{x} is @code{double}; conversions between signed and unsigned,
6879 like @code{unsigned ui = -1}; and conversions to smaller types, like
6880 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6881 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6882 changed by the conversion like in @code{abs (2.0)}. Warnings about
6883 conversions between signed and unsigned integers can be disabled by
6884 using @option{-Wno-sign-conversion}.
6885
6886 For C++, also warn for confusing overload resolution for user-defined
6887 conversions; and conversions that never use a type conversion
6888 operator: conversions to @code{void}, the same type, a base class or a
6889 reference to them. Warnings about conversions between signed and
6890 unsigned integers are disabled by default in C++ unless
6891 @option{-Wsign-conversion} is explicitly enabled.
6892
6893 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6894 @opindex Wconversion-null
6895 @opindex Wno-conversion-null
6896 Do not warn for conversions between @code{NULL} and non-pointer
6897 types. @option{-Wconversion-null} is enabled by default.
6898
6899 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6900 @opindex Wzero-as-null-pointer-constant
6901 @opindex Wno-zero-as-null-pointer-constant
6902 Warn when a literal @samp{0} is used as null pointer constant. This can
6903 be useful to facilitate the conversion to @code{nullptr} in C++11.
6904
6905 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6906 @opindex Wsubobject-linkage
6907 @opindex Wno-subobject-linkage
6908 Warn if a class type has a base or a field whose type uses the anonymous
6909 namespace or depends on a type with no linkage. If a type A depends on
6910 a type B with no or internal linkage, defining it in multiple
6911 translation units would be an ODR violation because the meaning of B
6912 is different in each translation unit. If A only appears in a single
6913 translation unit, the best way to silence the warning is to give it
6914 internal linkage by putting it in an anonymous namespace as well. The
6915 compiler doesn't give this warning for types defined in the main .C
6916 file, as those are unlikely to have multiple definitions.
6917 @option{-Wsubobject-linkage} is enabled by default.
6918
6919 @item -Wdangling-else
6920 @opindex Wdangling-else
6921 @opindex Wno-dangling-else
6922 Warn about constructions where there may be confusion to which
6923 @code{if} statement an @code{else} branch belongs. Here is an example of
6924 such a case:
6925
6926 @smallexample
6927 @group
6928 @{
6929 if (a)
6930 if (b)
6931 foo ();
6932 else
6933 bar ();
6934 @}
6935 @end group
6936 @end smallexample
6937
6938 In C/C++, every @code{else} branch belongs to the innermost possible
6939 @code{if} statement, which in this example is @code{if (b)}. This is
6940 often not what the programmer expected, as illustrated in the above
6941 example by indentation the programmer chose. When there is the
6942 potential for this confusion, GCC issues a warning when this flag
6943 is specified. To eliminate the warning, add explicit braces around
6944 the innermost @code{if} statement so there is no way the @code{else}
6945 can belong to the enclosing @code{if}. The resulting code
6946 looks like this:
6947
6948 @smallexample
6949 @group
6950 @{
6951 if (a)
6952 @{
6953 if (b)
6954 foo ();
6955 else
6956 bar ();
6957 @}
6958 @}
6959 @end group
6960 @end smallexample
6961
6962 This warning is enabled by @option{-Wparentheses}.
6963
6964 @item -Wdate-time
6965 @opindex Wdate-time
6966 @opindex Wno-date-time
6967 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6968 are encountered as they might prevent bit-wise-identical reproducible
6969 compilations.
6970
6971 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6972 @opindex Wdelete-incomplete
6973 @opindex Wno-delete-incomplete
6974 Warn when deleting a pointer to incomplete type, which may cause
6975 undefined behavior at runtime. This warning is enabled by default.
6976
6977 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6978 @opindex Wuseless-cast
6979 @opindex Wno-useless-cast
6980 Warn when an expression is casted to its own type.
6981
6982 @item -Wempty-body
6983 @opindex Wempty-body
6984 @opindex Wno-empty-body
6985 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6986 while} statement. This warning is also enabled by @option{-Wextra}.
6987
6988 @item -Wenum-compare
6989 @opindex Wenum-compare
6990 @opindex Wno-enum-compare
6991 Warn about a comparison between values of different enumerated types.
6992 In C++ enumerated type mismatches in conditional expressions are also
6993 diagnosed and the warning is enabled by default. In C this warning is
6994 enabled by @option{-Wall}.
6995
6996 @item -Wenum-conversion @r{(C, Objective-C only)}
6997 @opindex Wenum-conversion
6998 @opindex Wno-enum-conversion
6999 Warn when a value of enumerated type is implicitly converted to a
7000 different enumerated type. This warning is enabled by @option{-Wextra}.
7001
7002 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7003 @opindex Wextra-semi
7004 @opindex Wno-extra-semi
7005 Warn about redundant semicolon after in-class function definition.
7006
7007 @item -Wjump-misses-init @r{(C, Objective-C only)}
7008 @opindex Wjump-misses-init
7009 @opindex Wno-jump-misses-init
7010 Warn if a @code{goto} statement or a @code{switch} statement jumps
7011 forward across the initialization of a variable, or jumps backward to a
7012 label after the variable has been initialized. This only warns about
7013 variables that are initialized when they are declared. This warning is
7014 only supported for C and Objective-C; in C++ this sort of branch is an
7015 error in any case.
7016
7017 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7018 can be disabled with the @option{-Wno-jump-misses-init} option.
7019
7020 @item -Wsign-compare
7021 @opindex Wsign-compare
7022 @opindex Wno-sign-compare
7023 @cindex warning for comparison of signed and unsigned values
7024 @cindex comparison of signed and unsigned values, warning
7025 @cindex signed and unsigned values, comparison warning
7026 Warn when a comparison between signed and unsigned values could produce
7027 an incorrect result when the signed value is converted to unsigned.
7028 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7029 also enabled by @option{-Wextra}.
7030
7031 @item -Wsign-conversion
7032 @opindex Wsign-conversion
7033 @opindex Wno-sign-conversion
7034 Warn for implicit conversions that may change the sign of an integer
7035 value, like assigning a signed integer expression to an unsigned
7036 integer variable. An explicit cast silences the warning. In C, this
7037 option is enabled also by @option{-Wconversion}.
7038
7039 @item -Wfloat-conversion
7040 @opindex Wfloat-conversion
7041 @opindex Wno-float-conversion
7042 Warn for implicit conversions that reduce the precision of a real value.
7043 This includes conversions from real to integer, and from higher precision
7044 real to lower precision real values. This option is also enabled by
7045 @option{-Wconversion}.
7046
7047 @item -Wno-scalar-storage-order
7048 @opindex Wno-scalar-storage-order
7049 @opindex Wscalar-storage-order
7050 Do not warn on suspicious constructs involving reverse scalar storage order.
7051
7052 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7053 @opindex Wsized-deallocation
7054 @opindex Wno-sized-deallocation
7055 Warn about a definition of an unsized deallocation function
7056 @smallexample
7057 void operator delete (void *) noexcept;
7058 void operator delete[] (void *) noexcept;
7059 @end smallexample
7060 without a definition of the corresponding sized deallocation function
7061 @smallexample
7062 void operator delete (void *, std::size_t) noexcept;
7063 void operator delete[] (void *, std::size_t) noexcept;
7064 @end smallexample
7065 or vice versa. Enabled by @option{-Wextra} along with
7066 @option{-fsized-deallocation}.
7067
7068 @item -Wsizeof-pointer-div
7069 @opindex Wsizeof-pointer-div
7070 @opindex Wno-sizeof-pointer-div
7071 Warn for suspicious divisions of two sizeof expressions that divide
7072 the pointer size by the element size, which is the usual way to compute
7073 the array size but won't work out correctly with pointers. This warning
7074 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7075 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7076
7077 @item -Wsizeof-pointer-memaccess
7078 @opindex Wsizeof-pointer-memaccess
7079 @opindex Wno-sizeof-pointer-memaccess
7080 Warn for suspicious length parameters to certain string and memory built-in
7081 functions if the argument uses @code{sizeof}. This warning triggers for
7082 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7083 an array, but a pointer, and suggests a possible fix, or about
7084 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7085 also warns about calls to bounded string copy functions like @code{strncat}
7086 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7087 the source array. For example, in the following function the call to
7088 @code{strncat} specifies the size of the source string as the bound. That
7089 is almost certainly a mistake and so the call is diagnosed.
7090 @smallexample
7091 void make_file (const char *name)
7092 @{
7093 char path[PATH_MAX];
7094 strncpy (path, name, sizeof path - 1);
7095 strncat (path, ".text", sizeof ".text");
7096 @dots{}
7097 @}
7098 @end smallexample
7099
7100 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7101
7102 @item -Wsizeof-array-argument
7103 @opindex Wsizeof-array-argument
7104 @opindex Wno-sizeof-array-argument
7105 Warn when the @code{sizeof} operator is applied to a parameter that is
7106 declared as an array in a function definition. This warning is enabled by
7107 default for C and C++ programs.
7108
7109 @item -Wmemset-elt-size
7110 @opindex Wmemset-elt-size
7111 @opindex Wno-memset-elt-size
7112 Warn for suspicious calls to the @code{memset} built-in function, if the
7113 first argument references an array, and the third argument is a number
7114 equal to the number of elements, but not equal to the size of the array
7115 in memory. This indicates that the user has omitted a multiplication by
7116 the element size. This warning is enabled by @option{-Wall}.
7117
7118 @item -Wmemset-transposed-args
7119 @opindex Wmemset-transposed-args
7120 @opindex Wno-memset-transposed-args
7121 Warn for suspicious calls to the @code{memset} built-in function where
7122 the second argument is not zero and the third argument is zero. For
7123 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7124 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7125 is only emitted if the third argument is a literal zero. Otherwise, if
7126 it is an expression that is folded to zero, or a cast of zero to some
7127 type, it is far less likely that the arguments have been mistakenly
7128 transposed and no warning is emitted. This warning is enabled
7129 by @option{-Wall}.
7130
7131 @item -Waddress
7132 @opindex Waddress
7133 @opindex Wno-address
7134 Warn about suspicious uses of memory addresses. These include using
7135 the address of a function in a conditional expression, such as
7136 @code{void func(void); if (func)}, and comparisons against the memory
7137 address of a string literal, such as @code{if (x == "abc")}. Such
7138 uses typically indicate a programmer error: the address of a function
7139 always evaluates to true, so their use in a conditional usually
7140 indicate that the programmer forgot the parentheses in a function
7141 call; and comparisons against string literals result in unspecified
7142 behavior and are not portable in C, so they usually indicate that the
7143 programmer intended to use @code{strcmp}. This warning is enabled by
7144 @option{-Wall}.
7145
7146 @item -Waddress-of-packed-member
7147 @opindex Waddress-of-packed-member
7148 @opindex Wno-address-of-packed-member
7149 Warn when the address of packed member of struct or union is taken,
7150 which usually results in an unaligned pointer value. This is
7151 enabled by default.
7152
7153 @item -Wlogical-op
7154 @opindex Wlogical-op
7155 @opindex Wno-logical-op
7156 Warn about suspicious uses of logical operators in expressions.
7157 This includes using logical operators in contexts where a
7158 bit-wise operator is likely to be expected. Also warns when
7159 the operands of a logical operator are the same:
7160 @smallexample
7161 extern int a;
7162 if (a < 0 && a < 0) @{ @dots{} @}
7163 @end smallexample
7164
7165 @item -Wlogical-not-parentheses
7166 @opindex Wlogical-not-parentheses
7167 @opindex Wno-logical-not-parentheses
7168 Warn about logical not used on the left hand side operand of a comparison.
7169 This option does not warn if the right operand is considered to be a boolean
7170 expression. Its purpose is to detect suspicious code like the following:
7171 @smallexample
7172 int a;
7173 @dots{}
7174 if (!a > 1) @{ @dots{} @}
7175 @end smallexample
7176
7177 It is possible to suppress the warning by wrapping the LHS into
7178 parentheses:
7179 @smallexample
7180 if ((!a) > 1) @{ @dots{} @}
7181 @end smallexample
7182
7183 This warning is enabled by @option{-Wall}.
7184
7185 @item -Waggregate-return
7186 @opindex Waggregate-return
7187 @opindex Wno-aggregate-return
7188 Warn if any functions that return structures or unions are defined or
7189 called. (In languages where you can return an array, this also elicits
7190 a warning.)
7191
7192 @item -Wno-aggressive-loop-optimizations
7193 @opindex Wno-aggressive-loop-optimizations
7194 @opindex Waggressive-loop-optimizations
7195 Warn if in a loop with constant number of iterations the compiler detects
7196 undefined behavior in some statement during one or more of the iterations.
7197
7198 @item -Wno-attributes
7199 @opindex Wno-attributes
7200 @opindex Wattributes
7201 Do not warn if an unexpected @code{__attribute__} is used, such as
7202 unrecognized attributes, function attributes applied to variables,
7203 etc. This does not stop errors for incorrect use of supported
7204 attributes.
7205
7206 @item -Wno-builtin-declaration-mismatch
7207 @opindex Wno-builtin-declaration-mismatch
7208 @opindex Wbuiltin-declaration-mismatch
7209 Warn if a built-in function is declared with an incompatible signature
7210 or as a non-function, or when a built-in function declared with a type
7211 that does not include a prototype is called with arguments whose promoted
7212 types do not match those expected by the function. When @option{-Wextra}
7213 is specified, also warn when a built-in function that takes arguments is
7214 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7215 warning is enabled by default. To avoid the warning include the appropriate
7216 header to bring the prototypes of built-in functions into scope.
7217
7218 For example, the call to @code{memset} below is diagnosed by the warning
7219 because the function expects a value of type @code{size_t} as its argument
7220 but the type of @code{32} is @code{int}. With @option{-Wextra},
7221 the declaration of the function is diagnosed as well.
7222 @smallexample
7223 extern void* memset ();
7224 void f (void *d)
7225 @{
7226 memset (d, '\0', 32);
7227 @}
7228 @end smallexample
7229
7230 @item -Wno-builtin-macro-redefined
7231 @opindex Wno-builtin-macro-redefined
7232 @opindex Wbuiltin-macro-redefined
7233 Do not warn if certain built-in macros are redefined. This suppresses
7234 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7235 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7236
7237 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7238 @opindex Wstrict-prototypes
7239 @opindex Wno-strict-prototypes
7240 Warn if a function is declared or defined without specifying the
7241 argument types. (An old-style function definition is permitted without
7242 a warning if preceded by a declaration that specifies the argument
7243 types.)
7244
7245 @item -Wold-style-declaration @r{(C and Objective-C only)}
7246 @opindex Wold-style-declaration
7247 @opindex Wno-old-style-declaration
7248 Warn for obsolescent usages, according to the C Standard, in a
7249 declaration. For example, warn if storage-class specifiers like
7250 @code{static} are not the first things in a declaration. This warning
7251 is also enabled by @option{-Wextra}.
7252
7253 @item -Wold-style-definition @r{(C and Objective-C only)}
7254 @opindex Wold-style-definition
7255 @opindex Wno-old-style-definition
7256 Warn if an old-style function definition is used. A warning is given
7257 even if there is a previous prototype.
7258
7259 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7260 @opindex Wmissing-parameter-type
7261 @opindex Wno-missing-parameter-type
7262 A function parameter is declared without a type specifier in K&R-style
7263 functions:
7264
7265 @smallexample
7266 void foo(bar) @{ @}
7267 @end smallexample
7268
7269 This warning is also enabled by @option{-Wextra}.
7270
7271 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7272 @opindex Wmissing-prototypes
7273 @opindex Wno-missing-prototypes
7274 Warn if a global function is defined without a previous prototype
7275 declaration. This warning is issued even if the definition itself
7276 provides a prototype. Use this option to detect global functions
7277 that do not have a matching prototype declaration in a header file.
7278 This option is not valid for C++ because all function declarations
7279 provide prototypes and a non-matching declaration declares an
7280 overload rather than conflict with an earlier declaration.
7281 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7282
7283 @item -Wmissing-declarations
7284 @opindex Wmissing-declarations
7285 @opindex Wno-missing-declarations
7286 Warn if a global function is defined without a previous declaration.
7287 Do so even if the definition itself provides a prototype.
7288 Use this option to detect global functions that are not declared in
7289 header files. In C, no warnings are issued for functions with previous
7290 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7291 missing prototypes. In C++, no warnings are issued for function templates,
7292 or for inline functions, or for functions in anonymous namespaces.
7293
7294 @item -Wmissing-field-initializers
7295 @opindex Wmissing-field-initializers
7296 @opindex Wno-missing-field-initializers
7297 @opindex W
7298 @opindex Wextra
7299 @opindex Wno-extra
7300 Warn if a structure's initializer has some fields missing. For
7301 example, the following code causes such a warning, because
7302 @code{x.h} is implicitly zero:
7303
7304 @smallexample
7305 struct s @{ int f, g, h; @};
7306 struct s x = @{ 3, 4 @};
7307 @end smallexample
7308
7309 This option does not warn about designated initializers, so the following
7310 modification does not trigger a warning:
7311
7312 @smallexample
7313 struct s @{ int f, g, h; @};
7314 struct s x = @{ .f = 3, .g = 4 @};
7315 @end smallexample
7316
7317 In C this option does not warn about the universal zero initializer
7318 @samp{@{ 0 @}}:
7319
7320 @smallexample
7321 struct s @{ int f, g, h; @};
7322 struct s x = @{ 0 @};
7323 @end smallexample
7324
7325 Likewise, in C++ this option does not warn about the empty @{ @}
7326 initializer, for example:
7327
7328 @smallexample
7329 struct s @{ int f, g, h; @};
7330 s x = @{ @};
7331 @end smallexample
7332
7333 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7334 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7335
7336 @item -Wno-multichar
7337 @opindex Wno-multichar
7338 @opindex Wmultichar
7339 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7340 Usually they indicate a typo in the user's code, as they have
7341 implementation-defined values, and should not be used in portable code.
7342
7343 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7344 @opindex Wnormalized=
7345 @opindex Wnormalized
7346 @opindex Wno-normalized
7347 @cindex NFC
7348 @cindex NFKC
7349 @cindex character set, input normalization
7350 In ISO C and ISO C++, two identifiers are different if they are
7351 different sequences of characters. However, sometimes when characters
7352 outside the basic ASCII character set are used, you can have two
7353 different character sequences that look the same. To avoid confusion,
7354 the ISO 10646 standard sets out some @dfn{normalization rules} which
7355 when applied ensure that two sequences that look the same are turned into
7356 the same sequence. GCC can warn you if you are using identifiers that
7357 have not been normalized; this option controls that warning.
7358
7359 There are four levels of warning supported by GCC@. The default is
7360 @option{-Wnormalized=nfc}, which warns about any identifier that is
7361 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7362 recommended form for most uses. It is equivalent to
7363 @option{-Wnormalized}.
7364
7365 Unfortunately, there are some characters allowed in identifiers by
7366 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7367 identifiers. That is, there's no way to use these symbols in portable
7368 ISO C or C++ and have all your identifiers in NFC@.
7369 @option{-Wnormalized=id} suppresses the warning for these characters.
7370 It is hoped that future versions of the standards involved will correct
7371 this, which is why this option is not the default.
7372
7373 You can switch the warning off for all characters by writing
7374 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7375 only do this if you are using some other normalization scheme (like
7376 ``D''), because otherwise you can easily create bugs that are
7377 literally impossible to see.
7378
7379 Some characters in ISO 10646 have distinct meanings but look identical
7380 in some fonts or display methodologies, especially once formatting has
7381 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7382 LETTER N'', displays just like a regular @code{n} that has been
7383 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7384 normalization scheme to convert all these into a standard form as
7385 well, and GCC warns if your code is not in NFKC if you use
7386 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7387 about every identifier that contains the letter O because it might be
7388 confused with the digit 0, and so is not the default, but may be
7389 useful as a local coding convention if the programming environment
7390 cannot be fixed to display these characters distinctly.
7391
7392 @item -Wno-attribute-warning
7393 @opindex Wno-attribute-warning
7394 @opindex Wattribute-warning
7395 Do not warn about usage of functions (@pxref{Function Attributes})
7396 declared with @code{warning} attribute. By default, this warning is
7397 enabled. @option{-Wno-attribute-warning} can be used to disable the
7398 warning or @option{-Wno-error=attribute-warning} can be used to
7399 disable the error when compiled with @option{-Werror} flag.
7400
7401 @item -Wno-deprecated
7402 @opindex Wno-deprecated
7403 @opindex Wdeprecated
7404 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7405
7406 @item -Wno-deprecated-declarations
7407 @opindex Wno-deprecated-declarations
7408 @opindex Wdeprecated-declarations
7409 Do not warn about uses of functions (@pxref{Function Attributes}),
7410 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7411 Attributes}) marked as deprecated by using the @code{deprecated}
7412 attribute.
7413
7414 @item -Wno-overflow
7415 @opindex Wno-overflow
7416 @opindex Woverflow
7417 Do not warn about compile-time overflow in constant expressions.
7418
7419 @item -Wno-odr
7420 @opindex Wno-odr
7421 @opindex Wodr
7422 Warn about One Definition Rule violations during link-time optimization.
7423 Enabled by default.
7424
7425 @item -Wopenmp-simd
7426 @opindex Wopenmp-simd
7427 @opindex Wno-openmp-simd
7428 Warn if the vectorizer cost model overrides the OpenMP
7429 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7430 option can be used to relax the cost model.
7431
7432 @item -Woverride-init @r{(C and Objective-C only)}
7433 @opindex Woverride-init
7434 @opindex Wno-override-init
7435 @opindex W
7436 @opindex Wextra
7437 @opindex Wno-extra
7438 Warn if an initialized field without side effects is overridden when
7439 using designated initializers (@pxref{Designated Inits, , Designated
7440 Initializers}).
7441
7442 This warning is included in @option{-Wextra}. To get other
7443 @option{-Wextra} warnings without this one, use @option{-Wextra
7444 -Wno-override-init}.
7445
7446 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7447 @opindex Woverride-init-side-effects
7448 @opindex Wno-override-init-side-effects
7449 Warn if an initialized field with side effects is overridden when
7450 using designated initializers (@pxref{Designated Inits, , Designated
7451 Initializers}). This warning is enabled by default.
7452
7453 @item -Wpacked
7454 @opindex Wpacked
7455 @opindex Wno-packed
7456 Warn if a structure is given the packed attribute, but the packed
7457 attribute has no effect on the layout or size of the structure.
7458 Such structures may be mis-aligned for little benefit. For
7459 instance, in this code, the variable @code{f.x} in @code{struct bar}
7460 is misaligned even though @code{struct bar} does not itself
7461 have the packed attribute:
7462
7463 @smallexample
7464 @group
7465 struct foo @{
7466 int x;
7467 char a, b, c, d;
7468 @} __attribute__((packed));
7469 struct bar @{
7470 char z;
7471 struct foo f;
7472 @};
7473 @end group
7474 @end smallexample
7475
7476 @item -Wpacked-bitfield-compat
7477 @opindex Wpacked-bitfield-compat
7478 @opindex Wno-packed-bitfield-compat
7479 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7480 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7481 the change can lead to differences in the structure layout. GCC
7482 informs you when the offset of such a field has changed in GCC 4.4.
7483 For example there is no longer a 4-bit padding between field @code{a}
7484 and @code{b} in this structure:
7485
7486 @smallexample
7487 struct foo
7488 @{
7489 char a:4;
7490 char b:8;
7491 @} __attribute__ ((packed));
7492 @end smallexample
7493
7494 This warning is enabled by default. Use
7495 @option{-Wno-packed-bitfield-compat} to disable this warning.
7496
7497 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7498 @opindex Wpacked-not-aligned
7499 @opindex Wno-packed-not-aligned
7500 Warn if a structure field with explicitly specified alignment in a
7501 packed struct or union is misaligned. For example, a warning will
7502 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7503 'struct S' is less than 8}, in this code:
7504
7505 @smallexample
7506 @group
7507 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7508 struct __attribute__ ((packed)) S @{
7509 struct S8 s8;
7510 @};
7511 @end group
7512 @end smallexample
7513
7514 This warning is enabled by @option{-Wall}.
7515
7516 @item -Wpadded
7517 @opindex Wpadded
7518 @opindex Wno-padded
7519 Warn if padding is included in a structure, either to align an element
7520 of the structure or to align the whole structure. Sometimes when this
7521 happens it is possible to rearrange the fields of the structure to
7522 reduce the padding and so make the structure smaller.
7523
7524 @item -Wredundant-decls
7525 @opindex Wredundant-decls
7526 @opindex Wno-redundant-decls
7527 Warn if anything is declared more than once in the same scope, even in
7528 cases where multiple declaration is valid and changes nothing.
7529
7530 @item -Wno-restrict
7531 @opindex Wrestrict
7532 @opindex Wno-restrict
7533 Warn when an object referenced by a @code{restrict}-qualified parameter
7534 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7535 argument, or when copies between such objects overlap. For example,
7536 the call to the @code{strcpy} function below attempts to truncate the string
7537 by replacing its initial characters with the last four. However, because
7538 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7539 the call is diagnosed.
7540
7541 @smallexample
7542 void foo (void)
7543 @{
7544 char a[] = "abcd1234";
7545 strcpy (a, a + 4);
7546 @dots{}
7547 @}
7548 @end smallexample
7549 The @option{-Wrestrict} option detects some instances of simple overlap
7550 even without optimization but works best at @option{-O2} and above. It
7551 is included in @option{-Wall}.
7552
7553 @item -Wnested-externs @r{(C and Objective-C only)}
7554 @opindex Wnested-externs
7555 @opindex Wno-nested-externs
7556 Warn if an @code{extern} declaration is encountered within a function.
7557
7558 @item -Wno-inherited-variadic-ctor
7559 @opindex Winherited-variadic-ctor
7560 @opindex Wno-inherited-variadic-ctor
7561 Suppress warnings about use of C++11 inheriting constructors when the
7562 base class inherited from has a C variadic constructor; the warning is
7563 on by default because the ellipsis is not inherited.
7564
7565 @item -Winline
7566 @opindex Winline
7567 @opindex Wno-inline
7568 Warn if a function that is declared as inline cannot be inlined.
7569 Even with this option, the compiler does not warn about failures to
7570 inline functions declared in system headers.
7571
7572 The compiler uses a variety of heuristics to determine whether or not
7573 to inline a function. For example, the compiler takes into account
7574 the size of the function being inlined and the amount of inlining
7575 that has already been done in the current function. Therefore,
7576 seemingly insignificant changes in the source program can cause the
7577 warnings produced by @option{-Winline} to appear or disappear.
7578
7579 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7580 @opindex Wno-invalid-offsetof
7581 @opindex Winvalid-offsetof
7582 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7583 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7584 to a non-standard-layout type is undefined. In existing C++ implementations,
7585 however, @code{offsetof} typically gives meaningful results.
7586 This flag is for users who are aware that they are
7587 writing nonportable code and who have deliberately chosen to ignore the
7588 warning about it.
7589
7590 The restrictions on @code{offsetof} may be relaxed in a future version
7591 of the C++ standard.
7592
7593 @item -Wint-in-bool-context
7594 @opindex Wint-in-bool-context
7595 @opindex Wno-int-in-bool-context
7596 Warn for suspicious use of integer values where boolean values are expected,
7597 such as conditional expressions (?:) using non-boolean integer constants in
7598 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7599 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7600 for all kinds of multiplications regardless of the data type.
7601 This warning is enabled by @option{-Wall}.
7602
7603 @item -Wno-int-to-pointer-cast
7604 @opindex Wno-int-to-pointer-cast
7605 @opindex Wint-to-pointer-cast
7606 Suppress warnings from casts to pointer type of an integer of a
7607 different size. In C++, casting to a pointer type of smaller size is
7608 an error. @option{Wint-to-pointer-cast} is enabled by default.
7609
7610
7611 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7612 @opindex Wno-pointer-to-int-cast
7613 @opindex Wpointer-to-int-cast
7614 Suppress warnings from casts from a pointer to an integer type of a
7615 different size.
7616
7617 @item -Winvalid-pch
7618 @opindex Winvalid-pch
7619 @opindex Wno-invalid-pch
7620 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7621 the search path but cannot be used.
7622
7623 @item -Wlong-long
7624 @opindex Wlong-long
7625 @opindex Wno-long-long
7626 Warn if @code{long long} type is used. This is enabled by either
7627 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7628 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7629
7630 @item -Wvariadic-macros
7631 @opindex Wvariadic-macros
7632 @opindex Wno-variadic-macros
7633 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7634 alternate syntax is used in ISO C99 mode. This is enabled by either
7635 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7636 messages, use @option{-Wno-variadic-macros}.
7637
7638 @item -Wvarargs
7639 @opindex Wvarargs
7640 @opindex Wno-varargs
7641 Warn upon questionable usage of the macros used to handle variable
7642 arguments like @code{va_start}. This is default. To inhibit the
7643 warning messages, use @option{-Wno-varargs}.
7644
7645 @item -Wvector-operation-performance
7646 @opindex Wvector-operation-performance
7647 @opindex Wno-vector-operation-performance
7648 Warn if vector operation is not implemented via SIMD capabilities of the
7649 architecture. Mainly useful for the performance tuning.
7650 Vector operation can be implemented @code{piecewise}, which means that the
7651 scalar operation is performed on every vector element;
7652 @code{in parallel}, which means that the vector operation is implemented
7653 using scalars of wider type, which normally is more performance efficient;
7654 and @code{as a single scalar}, which means that vector fits into a
7655 scalar type.
7656
7657 @item -Wno-virtual-move-assign
7658 @opindex Wvirtual-move-assign
7659 @opindex Wno-virtual-move-assign
7660 Suppress warnings about inheriting from a virtual base with a
7661 non-trivial C++11 move assignment operator. This is dangerous because
7662 if the virtual base is reachable along more than one path, it is
7663 moved multiple times, which can mean both objects end up in the
7664 moved-from state. If the move assignment operator is written to avoid
7665 moving from a moved-from object, this warning can be disabled.
7666
7667 @item -Wvla
7668 @opindex Wvla
7669 @opindex Wno-vla
7670 Warn if a variable-length array is used in the code.
7671 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7672 the variable-length array.
7673
7674 @item -Wvla-larger-than=@var{byte-size}
7675 @opindex Wvla-larger-than=
7676 @opindex Wno-vla-larger-than
7677 If this option is used, the compiler will warn for declarations of
7678 variable-length arrays whose size is either unbounded, or bounded
7679 by an argument that allows the array size to exceed @var{byte-size}
7680 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7681 works, but with variable-length arrays.
7682
7683 Note that GCC may optimize small variable-length arrays of a known
7684 value into plain arrays, so this warning may not get triggered for
7685 such arrays.
7686
7687 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7688 is typically only effective when @option{-ftree-vrp} is active (default
7689 for @option{-O2} and above).
7690
7691 See also @option{-Walloca-larger-than=@var{byte-size}}.
7692
7693 @item -Wno-vla-larger-than
7694 @opindex Wno-vla-larger-than
7695 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7696 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7697
7698 @item -Wvolatile-register-var
7699 @opindex Wvolatile-register-var
7700 @opindex Wno-volatile-register-var
7701 Warn if a register variable is declared volatile. The volatile
7702 modifier does not inhibit all optimizations that may eliminate reads
7703 and/or writes to register variables. This warning is enabled by
7704 @option{-Wall}.
7705
7706 @item -Wdisabled-optimization
7707 @opindex Wdisabled-optimization
7708 @opindex Wno-disabled-optimization
7709 Warn if a requested optimization pass is disabled. This warning does
7710 not generally indicate that there is anything wrong with your code; it
7711 merely indicates that GCC's optimizers are unable to handle the code
7712 effectively. Often, the problem is that your code is too big or too
7713 complex; GCC refuses to optimize programs when the optimization
7714 itself is likely to take inordinate amounts of time.
7715
7716 @item -Wpointer-sign @r{(C and Objective-C only)}
7717 @opindex Wpointer-sign
7718 @opindex Wno-pointer-sign
7719 Warn for pointer argument passing or assignment with different signedness.
7720 This option is only supported for C and Objective-C@. It is implied by
7721 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7722 @option{-Wno-pointer-sign}.
7723
7724 @item -Wstack-protector
7725 @opindex Wstack-protector
7726 @opindex Wno-stack-protector
7727 This option is only active when @option{-fstack-protector} is active. It
7728 warns about functions that are not protected against stack smashing.
7729
7730 @item -Woverlength-strings
7731 @opindex Woverlength-strings
7732 @opindex Wno-overlength-strings
7733 Warn about string constants that are longer than the ``minimum
7734 maximum'' length specified in the C standard. Modern compilers
7735 generally allow string constants that are much longer than the
7736 standard's minimum limit, but very portable programs should avoid
7737 using longer strings.
7738
7739 The limit applies @emph{after} string constant concatenation, and does
7740 not count the trailing NUL@. In C90, the limit was 509 characters; in
7741 C99, it was raised to 4095. C++98 does not specify a normative
7742 minimum maximum, so we do not diagnose overlength strings in C++@.
7743
7744 This option is implied by @option{-Wpedantic}, and can be disabled with
7745 @option{-Wno-overlength-strings}.
7746
7747 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7748 @opindex Wunsuffixed-float-constants
7749 @opindex Wno-unsuffixed-float-constants
7750
7751 Issue a warning for any floating constant that does not have
7752 a suffix. When used together with @option{-Wsystem-headers} it
7753 warns about such constants in system header files. This can be useful
7754 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7755 from the decimal floating-point extension to C99.
7756
7757 @item -Wno-designated-init @r{(C and Objective-C only)}
7758 Suppress warnings when a positional initializer is used to initialize
7759 a structure that has been marked with the @code{designated_init}
7760 attribute.
7761
7762 @item -Whsa
7763 Issue a warning when HSAIL cannot be emitted for the compiled function or
7764 OpenMP construct.
7765
7766 @end table
7767
7768 @node Debugging Options
7769 @section Options for Debugging Your Program
7770 @cindex options, debugging
7771 @cindex debugging information options
7772
7773 To tell GCC to emit extra information for use by a debugger, in almost
7774 all cases you need only to add @option{-g} to your other options.
7775
7776 GCC allows you to use @option{-g} with
7777 @option{-O}. The shortcuts taken by optimized code may occasionally
7778 be surprising: some variables you declared may not exist
7779 at all; flow of control may briefly move where you did not expect it;
7780 some statements may not be executed because they compute constant
7781 results or their values are already at hand; some statements may
7782 execute in different places because they have been moved out of loops.
7783 Nevertheless it is possible to debug optimized output. This makes
7784 it reasonable to use the optimizer for programs that might have bugs.
7785
7786 If you are not using some other optimization option, consider
7787 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7788 With no @option{-O} option at all, some compiler passes that collect
7789 information useful for debugging do not run at all, so that
7790 @option{-Og} may result in a better debugging experience.
7791
7792 @table @gcctabopt
7793 @item -g
7794 @opindex g
7795 Produce debugging information in the operating system's native format
7796 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7797 information.
7798
7799 On most systems that use stabs format, @option{-g} enables use of extra
7800 debugging information that only GDB can use; this extra information
7801 makes debugging work better in GDB but probably makes other debuggers
7802 crash or
7803 refuse to read the program. If you want to control for certain whether
7804 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7805 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7806
7807 @item -ggdb
7808 @opindex ggdb
7809 Produce debugging information for use by GDB@. This means to use the
7810 most expressive format available (DWARF, stabs, or the native format
7811 if neither of those are supported), including GDB extensions if at all
7812 possible.
7813
7814 @item -gdwarf
7815 @itemx -gdwarf-@var{version}
7816 @opindex gdwarf
7817 Produce debugging information in DWARF format (if that is supported).
7818 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7819 for most targets is 4. DWARF Version 5 is only experimental.
7820
7821 Note that with DWARF Version 2, some ports require and always
7822 use some non-conflicting DWARF 3 extensions in the unwind tables.
7823
7824 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7825 for maximum benefit.
7826
7827 GCC no longer supports DWARF Version 1, which is substantially
7828 different than Version 2 and later. For historical reasons, some
7829 other DWARF-related options such as
7830 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7831 in their names, but apply to all currently-supported versions of DWARF.
7832
7833 @item -gstabs
7834 @opindex gstabs
7835 Produce debugging information in stabs format (if that is supported),
7836 without GDB extensions. This is the format used by DBX on most BSD
7837 systems. On MIPS, Alpha and System V Release 4 systems this option
7838 produces stabs debugging output that is not understood by DBX@.
7839 On System V Release 4 systems this option requires the GNU assembler.
7840
7841 @item -gstabs+
7842 @opindex gstabs+
7843 Produce debugging information in stabs format (if that is supported),
7844 using GNU extensions understood only by the GNU debugger (GDB)@. The
7845 use of these extensions is likely to make other debuggers crash or
7846 refuse to read the program.
7847
7848 @item -gxcoff
7849 @opindex gxcoff
7850 Produce debugging information in XCOFF format (if that is supported).
7851 This is the format used by the DBX debugger on IBM RS/6000 systems.
7852
7853 @item -gxcoff+
7854 @opindex gxcoff+
7855 Produce debugging information in XCOFF format (if that is supported),
7856 using GNU extensions understood only by the GNU debugger (GDB)@. The
7857 use of these extensions is likely to make other debuggers crash or
7858 refuse to read the program, and may cause assemblers other than the GNU
7859 assembler (GAS) to fail with an error.
7860
7861 @item -gvms
7862 @opindex gvms
7863 Produce debugging information in Alpha/VMS debug format (if that is
7864 supported). This is the format used by DEBUG on Alpha/VMS systems.
7865
7866 @item -g@var{level}
7867 @itemx -ggdb@var{level}
7868 @itemx -gstabs@var{level}
7869 @itemx -gxcoff@var{level}
7870 @itemx -gvms@var{level}
7871 Request debugging information and also use @var{level} to specify how
7872 much information. The default level is 2.
7873
7874 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7875 @option{-g}.
7876
7877 Level 1 produces minimal information, enough for making backtraces in
7878 parts of the program that you don't plan to debug. This includes
7879 descriptions of functions and external variables, and line number
7880 tables, but no information about local variables.
7881
7882 Level 3 includes extra information, such as all the macro definitions
7883 present in the program. Some debuggers support macro expansion when
7884 you use @option{-g3}.
7885
7886 If you use multiple @option{-g} options, with or without level numbers,
7887 the last such option is the one that is effective.
7888
7889 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7890 confusion with @option{-gdwarf-@var{level}}.
7891 Instead use an additional @option{-g@var{level}} option to change the
7892 debug level for DWARF.
7893
7894 @item -fno-eliminate-unused-debug-symbols
7895 @opindex feliminate-unused-debug-symbols
7896 @opindex fno-eliminate-unused-debug-symbols
7897 By default, no debug information is produced for symbols that are not actually
7898 used. Use this option if you want debug information for all symbols.
7899
7900 @item -femit-class-debug-always
7901 @opindex femit-class-debug-always
7902 Instead of emitting debugging information for a C++ class in only one
7903 object file, emit it in all object files using the class. This option
7904 should be used only with debuggers that are unable to handle the way GCC
7905 normally emits debugging information for classes because using this
7906 option increases the size of debugging information by as much as a
7907 factor of two.
7908
7909 @item -fno-merge-debug-strings
7910 @opindex fmerge-debug-strings
7911 @opindex fno-merge-debug-strings
7912 Direct the linker to not merge together strings in the debugging
7913 information that are identical in different object files. Merging is
7914 not supported by all assemblers or linkers. Merging decreases the size
7915 of the debug information in the output file at the cost of increasing
7916 link processing time. Merging is enabled by default.
7917
7918 @item -fdebug-prefix-map=@var{old}=@var{new}
7919 @opindex fdebug-prefix-map
7920 When compiling files residing in directory @file{@var{old}}, record
7921 debugging information describing them as if the files resided in
7922 directory @file{@var{new}} instead. This can be used to replace a
7923 build-time path with an install-time path in the debug info. It can
7924 also be used to change an absolute path to a relative path by using
7925 @file{.} for @var{new}. This can give more reproducible builds, which
7926 are location independent, but may require an extra command to tell GDB
7927 where to find the source files. See also @option{-ffile-prefix-map}.
7928
7929 @item -fvar-tracking
7930 @opindex fvar-tracking
7931 Run variable tracking pass. It computes where variables are stored at each
7932 position in code. Better debugging information is then generated
7933 (if the debugging information format supports this information).
7934
7935 It is enabled by default when compiling with optimization (@option{-Os},
7936 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7937 the debug info format supports it.
7938
7939 @item -fvar-tracking-assignments
7940 @opindex fvar-tracking-assignments
7941 @opindex fno-var-tracking-assignments
7942 Annotate assignments to user variables early in the compilation and
7943 attempt to carry the annotations over throughout the compilation all the
7944 way to the end, in an attempt to improve debug information while
7945 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7946
7947 It can be enabled even if var-tracking is disabled, in which case
7948 annotations are created and maintained, but discarded at the end.
7949 By default, this flag is enabled together with @option{-fvar-tracking},
7950 except when selective scheduling is enabled.
7951
7952 @item -gsplit-dwarf
7953 @opindex gsplit-dwarf
7954 Separate as much DWARF debugging information as possible into a
7955 separate output file with the extension @file{.dwo}. This option allows
7956 the build system to avoid linking files with debug information. To
7957 be useful, this option requires a debugger capable of reading @file{.dwo}
7958 files.
7959
7960 @item -gdescribe-dies
7961 @opindex gdescribe-dies
7962 Add description attributes to some DWARF DIEs that have no name attribute,
7963 such as artificial variables, external references and call site
7964 parameter DIEs.
7965
7966 @item -gpubnames
7967 @opindex gpubnames
7968 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7969
7970 @item -ggnu-pubnames
7971 @opindex ggnu-pubnames
7972 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7973 suitable for conversion into a GDB@ index. This option is only useful
7974 with a linker that can produce GDB@ index version 7.
7975
7976 @item -fdebug-types-section
7977 @opindex fdebug-types-section
7978 @opindex fno-debug-types-section
7979 When using DWARF Version 4 or higher, type DIEs can be put into
7980 their own @code{.debug_types} section instead of making them part of the
7981 @code{.debug_info} section. It is more efficient to put them in a separate
7982 comdat section since the linker can then remove duplicates.
7983 But not all DWARF consumers support @code{.debug_types} sections yet
7984 and on some objects @code{.debug_types} produces larger instead of smaller
7985 debugging information.
7986
7987 @item -grecord-gcc-switches
7988 @itemx -gno-record-gcc-switches
7989 @opindex grecord-gcc-switches
7990 @opindex gno-record-gcc-switches
7991 This switch causes the command-line options used to invoke the
7992 compiler that may affect code generation to be appended to the
7993 DW_AT_producer attribute in DWARF debugging information. The options
7994 are concatenated with spaces separating them from each other and from
7995 the compiler version.
7996 It is enabled by default.
7997 See also @option{-frecord-gcc-switches} for another
7998 way of storing compiler options into the object file.
7999
8000 @item -gstrict-dwarf
8001 @opindex gstrict-dwarf
8002 Disallow using extensions of later DWARF standard version than selected
8003 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8004 DWARF extensions from later standard versions is allowed.
8005
8006 @item -gno-strict-dwarf
8007 @opindex gno-strict-dwarf
8008 Allow using extensions of later DWARF standard version than selected with
8009 @option{-gdwarf-@var{version}}.
8010
8011 @item -gas-loc-support
8012 @opindex gas-loc-support
8013 Inform the compiler that the assembler supports @code{.loc} directives.
8014 It may then use them for the assembler to generate DWARF2+ line number
8015 tables.
8016
8017 This is generally desirable, because assembler-generated line-number
8018 tables are a lot more compact than those the compiler can generate
8019 itself.
8020
8021 This option will be enabled by default if, at GCC configure time, the
8022 assembler was found to support such directives.
8023
8024 @item -gno-as-loc-support
8025 @opindex gno-as-loc-support
8026 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8027 line number tables are to be generated.
8028
8029 @item -gas-locview-support
8030 @opindex gas-locview-support
8031 Inform the compiler that the assembler supports @code{view} assignment
8032 and reset assertion checking in @code{.loc} directives.
8033
8034 This option will be enabled by default if, at GCC configure time, the
8035 assembler was found to support them.
8036
8037 @item -gno-as-locview-support
8038 Force GCC to assign view numbers internally, if
8039 @option{-gvariable-location-views} are explicitly requested.
8040
8041 @item -gcolumn-info
8042 @itemx -gno-column-info
8043 @opindex gcolumn-info
8044 @opindex gno-column-info
8045 Emit location column information into DWARF debugging information, rather
8046 than just file and line.
8047 This option is enabled by default.
8048
8049 @item -gstatement-frontiers
8050 @itemx -gno-statement-frontiers
8051 @opindex gstatement-frontiers
8052 @opindex gno-statement-frontiers
8053 This option causes GCC to create markers in the internal representation
8054 at the beginning of statements, and to keep them roughly in place
8055 throughout compilation, using them to guide the output of @code{is_stmt}
8056 markers in the line number table. This is enabled by default when
8057 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8058 @dots{}), and outputting DWARF 2 debug information at the normal level.
8059
8060 @item -gvariable-location-views
8061 @itemx -gvariable-location-views=incompat5
8062 @itemx -gno-variable-location-views
8063 @opindex gvariable-location-views
8064 @opindex gvariable-location-views=incompat5
8065 @opindex gno-variable-location-views
8066 Augment variable location lists with progressive view numbers implied
8067 from the line number table. This enables debug information consumers to
8068 inspect state at certain points of the program, even if no instructions
8069 associated with the corresponding source locations are present at that
8070 point. If the assembler lacks support for view numbers in line number
8071 tables, this will cause the compiler to emit the line number table,
8072 which generally makes them somewhat less compact. The augmented line
8073 number tables and location lists are fully backward-compatible, so they
8074 can be consumed by debug information consumers that are not aware of
8075 these augmentations, but they won't derive any benefit from them either.
8076
8077 This is enabled by default when outputting DWARF 2 debug information at
8078 the normal level, as long as there is assembler support,
8079 @option{-fvar-tracking-assignments} is enabled and
8080 @option{-gstrict-dwarf} is not. When assembler support is not
8081 available, this may still be enabled, but it will force GCC to output
8082 internal line number tables, and if
8083 @option{-ginternal-reset-location-views} is not enabled, that will most
8084 certainly lead to silently mismatching location views.
8085
8086 There is a proposed representation for view numbers that is not backward
8087 compatible with the location list format introduced in DWARF 5, that can
8088 be enabled with @option{-gvariable-location-views=incompat5}. This
8089 option may be removed in the future, is only provided as a reference
8090 implementation of the proposed representation. Debug information
8091 consumers are not expected to support this extended format, and they
8092 would be rendered unable to decode location lists using it.
8093
8094 @item -ginternal-reset-location-views
8095 @itemx -gnointernal-reset-location-views
8096 @opindex ginternal-reset-location-views
8097 @opindex gno-internal-reset-location-views
8098 Attempt to determine location views that can be omitted from location
8099 view lists. This requires the compiler to have very accurate insn
8100 length estimates, which isn't always the case, and it may cause
8101 incorrect view lists to be generated silently when using an assembler
8102 that does not support location view lists. The GNU assembler will flag
8103 any such error as a @code{view number mismatch}. This is only enabled
8104 on ports that define a reliable estimation function.
8105
8106 @item -ginline-points
8107 @itemx -gno-inline-points
8108 @opindex ginline-points
8109 @opindex gno-inline-points
8110 Generate extended debug information for inlined functions. Location
8111 view tracking markers are inserted at inlined entry points, so that
8112 address and view numbers can be computed and output in debug
8113 information. This can be enabled independently of location views, in
8114 which case the view numbers won't be output, but it can only be enabled
8115 along with statement frontiers, and it is only enabled by default if
8116 location views are enabled.
8117
8118 @item -gz@r{[}=@var{type}@r{]}
8119 @opindex gz
8120 Produce compressed debug sections in DWARF format, if that is supported.
8121 If @var{type} is not given, the default type depends on the capabilities
8122 of the assembler and linker used. @var{type} may be one of
8123 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8124 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8125 compression in traditional GNU format). If the linker doesn't support
8126 writing compressed debug sections, the option is rejected. Otherwise,
8127 if the assembler does not support them, @option{-gz} is silently ignored
8128 when producing object files.
8129
8130 @item -femit-struct-debug-baseonly
8131 @opindex femit-struct-debug-baseonly
8132 Emit debug information for struct-like types
8133 only when the base name of the compilation source file
8134 matches the base name of file in which the struct is defined.
8135
8136 This option substantially reduces the size of debugging information,
8137 but at significant potential loss in type information to the debugger.
8138 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8139 See @option{-femit-struct-debug-detailed} for more detailed control.
8140
8141 This option works only with DWARF debug output.
8142
8143 @item -femit-struct-debug-reduced
8144 @opindex femit-struct-debug-reduced
8145 Emit debug information for struct-like types
8146 only when the base name of the compilation source file
8147 matches the base name of file in which the type is defined,
8148 unless the struct is a template or defined in a system header.
8149
8150 This option significantly reduces the size of debugging information,
8151 with some potential loss in type information to the debugger.
8152 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8153 See @option{-femit-struct-debug-detailed} for more detailed control.
8154
8155 This option works only with DWARF debug output.
8156
8157 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8158 @opindex femit-struct-debug-detailed
8159 Specify the struct-like types
8160 for which the compiler generates debug information.
8161 The intent is to reduce duplicate struct debug information
8162 between different object files within the same program.
8163
8164 This option is a detailed version of
8165 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8166 which serves for most needs.
8167
8168 A specification has the syntax@*
8169 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8170
8171 The optional first word limits the specification to
8172 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8173 A struct type is used directly when it is the type of a variable, member.
8174 Indirect uses arise through pointers to structs.
8175 That is, when use of an incomplete struct is valid, the use is indirect.
8176 An example is
8177 @samp{struct one direct; struct two * indirect;}.
8178
8179 The optional second word limits the specification to
8180 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8181 Generic structs are a bit complicated to explain.
8182 For C++, these are non-explicit specializations of template classes,
8183 or non-template classes within the above.
8184 Other programming languages have generics,
8185 but @option{-femit-struct-debug-detailed} does not yet implement them.
8186
8187 The third word specifies the source files for those
8188 structs for which the compiler should emit debug information.
8189 The values @samp{none} and @samp{any} have the normal meaning.
8190 The value @samp{base} means that
8191 the base of name of the file in which the type declaration appears
8192 must match the base of the name of the main compilation file.
8193 In practice, this means that when compiling @file{foo.c}, debug information
8194 is generated for types declared in that file and @file{foo.h},
8195 but not other header files.
8196 The value @samp{sys} means those types satisfying @samp{base}
8197 or declared in system or compiler headers.
8198
8199 You may need to experiment to determine the best settings for your application.
8200
8201 The default is @option{-femit-struct-debug-detailed=all}.
8202
8203 This option works only with DWARF debug output.
8204
8205 @item -fno-dwarf2-cfi-asm
8206 @opindex fdwarf2-cfi-asm
8207 @opindex fno-dwarf2-cfi-asm
8208 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8209 instead of using GAS @code{.cfi_*} directives.
8210
8211 @item -fno-eliminate-unused-debug-types
8212 @opindex feliminate-unused-debug-types
8213 @opindex fno-eliminate-unused-debug-types
8214 Normally, when producing DWARF output, GCC avoids producing debug symbol
8215 output for types that are nowhere used in the source file being compiled.
8216 Sometimes it is useful to have GCC emit debugging
8217 information for all types declared in a compilation
8218 unit, regardless of whether or not they are actually used
8219 in that compilation unit, for example
8220 if, in the debugger, you want to cast a value to a type that is
8221 not actually used in your program (but is declared). More often,
8222 however, this results in a significant amount of wasted space.
8223 @end table
8224
8225 @node Optimize Options
8226 @section Options That Control Optimization
8227 @cindex optimize options
8228 @cindex options, optimization
8229
8230 These options control various sorts of optimizations.
8231
8232 Without any optimization option, the compiler's goal is to reduce the
8233 cost of compilation and to make debugging produce the expected
8234 results. Statements are independent: if you stop the program with a
8235 breakpoint between statements, you can then assign a new value to any
8236 variable or change the program counter to any other statement in the
8237 function and get exactly the results you expect from the source
8238 code.
8239
8240 Turning on optimization flags makes the compiler attempt to improve
8241 the performance and/or code size at the expense of compilation time
8242 and possibly the ability to debug the program.
8243
8244 The compiler performs optimization based on the knowledge it has of the
8245 program. Compiling multiple files at once to a single output file mode allows
8246 the compiler to use information gained from all of the files when compiling
8247 each of them.
8248
8249 Not all optimizations are controlled directly by a flag. Only
8250 optimizations that have a flag are listed in this section.
8251
8252 Most optimizations are completely disabled at @option{-O0} or if an
8253 @option{-O} level is not set on the command line, even if individual
8254 optimization flags are specified. Similarly, @option{-Og} suppresses
8255 many optimization passes.
8256
8257 Depending on the target and how GCC was configured, a slightly different
8258 set of optimizations may be enabled at each @option{-O} level than
8259 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8260 to find out the exact set of optimizations that are enabled at each level.
8261 @xref{Overall Options}, for examples.
8262
8263 @table @gcctabopt
8264 @item -O
8265 @itemx -O1
8266 @opindex O
8267 @opindex O1
8268 Optimize. Optimizing compilation takes somewhat more time, and a lot
8269 more memory for a large function.
8270
8271 With @option{-O}, the compiler tries to reduce code size and execution
8272 time, without performing any optimizations that take a great deal of
8273 compilation time.
8274
8275 @c Note that in addition to the default_options_table list in opts.c,
8276 @c several optimization flags default to true but control optimization
8277 @c passes that are explicitly disabled at -O0.
8278
8279 @option{-O} turns on the following optimization flags:
8280
8281 @c Please keep the following list alphabetized.
8282 @gccoptlist{-fauto-inc-dec @gol
8283 -fbranch-count-reg @gol
8284 -fcombine-stack-adjustments @gol
8285 -fcompare-elim @gol
8286 -fcprop-registers @gol
8287 -fdce @gol
8288 -fdefer-pop @gol
8289 -fdelayed-branch @gol
8290 -fdse @gol
8291 -fforward-propagate @gol
8292 -fguess-branch-probability @gol
8293 -fif-conversion @gol
8294 -fif-conversion2 @gol
8295 -finline-functions-called-once @gol
8296 -fipa-profile @gol
8297 -fipa-pure-const @gol
8298 -fipa-reference @gol
8299 -fipa-reference-addressable @gol
8300 -fmerge-constants @gol
8301 -fmove-loop-invariants @gol
8302 -fomit-frame-pointer @gol
8303 -freorder-blocks @gol
8304 -fshrink-wrap @gol
8305 -fshrink-wrap-separate @gol
8306 -fsplit-wide-types @gol
8307 -fssa-backprop @gol
8308 -fssa-phiopt @gol
8309 -ftree-bit-ccp @gol
8310 -ftree-ccp @gol
8311 -ftree-ch @gol
8312 -ftree-coalesce-vars @gol
8313 -ftree-copy-prop @gol
8314 -ftree-dce @gol
8315 -ftree-dominator-opts @gol
8316 -ftree-dse @gol
8317 -ftree-forwprop @gol
8318 -ftree-fre @gol
8319 -ftree-phiprop @gol
8320 -ftree-pta @gol
8321 -ftree-scev-cprop @gol
8322 -ftree-sink @gol
8323 -ftree-slsr @gol
8324 -ftree-sra @gol
8325 -ftree-ter @gol
8326 -funit-at-a-time}
8327
8328 @item -O2
8329 @opindex O2
8330 Optimize even more. GCC performs nearly all supported optimizations
8331 that do not involve a space-speed tradeoff.
8332 As compared to @option{-O}, this option increases both compilation time
8333 and the performance of the generated code.
8334
8335 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8336 also turns on the following optimization flags:
8337
8338 @c Please keep the following list alphabetized!
8339 @gccoptlist{-falign-functions -falign-jumps @gol
8340 -falign-labels -falign-loops @gol
8341 -fcaller-saves @gol
8342 -fcode-hoisting @gol
8343 -fcrossjumping @gol
8344 -fcse-follow-jumps -fcse-skip-blocks @gol
8345 -fdelete-null-pointer-checks @gol
8346 -fdevirtualize -fdevirtualize-speculatively @gol
8347 -fexpensive-optimizations @gol
8348 -ffinite-loops @gol
8349 -fgcse -fgcse-lm @gol
8350 -fhoist-adjacent-loads @gol
8351 -finline-functions @gol
8352 -finline-small-functions @gol
8353 -findirect-inlining @gol
8354 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8355 -fipa-ra -fipa-sra -fipa-vrp @gol
8356 -fisolate-erroneous-paths-dereference @gol
8357 -flra-remat @gol
8358 -foptimize-sibling-calls @gol
8359 -foptimize-strlen @gol
8360 -fpartial-inlining @gol
8361 -fpeephole2 @gol
8362 -freorder-blocks-algorithm=stc @gol
8363 -freorder-blocks-and-partition -freorder-functions @gol
8364 -frerun-cse-after-loop @gol
8365 -fschedule-insns -fschedule-insns2 @gol
8366 -fsched-interblock -fsched-spec @gol
8367 -fstore-merging @gol
8368 -fstrict-aliasing @gol
8369 -fthread-jumps @gol
8370 -ftree-builtin-call-dce @gol
8371 -ftree-pre @gol
8372 -ftree-switch-conversion -ftree-tail-merge @gol
8373 -ftree-vrp}
8374
8375 Please note the warning under @option{-fgcse} about
8376 invoking @option{-O2} on programs that use computed gotos.
8377
8378 @item -O3
8379 @opindex O3
8380 Optimize yet more. @option{-O3} turns on all optimizations specified
8381 by @option{-O2} and also turns on the following optimization flags:
8382
8383 @c Please keep the following list alphabetized!
8384 @gccoptlist{-fgcse-after-reload @gol
8385 -fipa-cp-clone
8386 -floop-interchange @gol
8387 -floop-unroll-and-jam @gol
8388 -fpeel-loops @gol
8389 -fpredictive-commoning @gol
8390 -fsplit-paths @gol
8391 -ftree-loop-distribute-patterns @gol
8392 -ftree-loop-distribution @gol
8393 -ftree-loop-vectorize @gol
8394 -ftree-partial-pre @gol
8395 -ftree-slp-vectorize @gol
8396 -funswitch-loops @gol
8397 -fvect-cost-model @gol
8398 -fversion-loops-for-strides}
8399
8400 @item -O0
8401 @opindex O0
8402 Reduce compilation time and make debugging produce the expected
8403 results. This is the default.
8404
8405 @item -Os
8406 @opindex Os
8407 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8408 except those that often increase code size:
8409
8410 @gccoptlist{-falign-functions -falign-jumps @gol
8411 -falign-labels -falign-loops @gol
8412 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8413
8414 It also enables @option{-finline-functions}, causes the compiler to tune for
8415 code size rather than execution speed, and performs further optimizations
8416 designed to reduce code size.
8417
8418 @item -Ofast
8419 @opindex Ofast
8420 Disregard strict standards compliance. @option{-Ofast} enables all
8421 @option{-O3} optimizations. It also enables optimizations that are not
8422 valid for all standard-compliant programs.
8423 It turns on @option{-ffast-math} and the Fortran-specific
8424 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8425 specified, and @option{-fno-protect-parens}.
8426
8427 @item -Og
8428 @opindex Og
8429 Optimize debugging experience. @option{-Og} should be the optimization
8430 level of choice for the standard edit-compile-debug cycle, offering
8431 a reasonable level of optimization while maintaining fast compilation
8432 and a good debugging experience. It is a better choice than @option{-O0}
8433 for producing debuggable code because some compiler passes
8434 that collect debug information are disabled at @option{-O0}.
8435
8436 Like @option{-O0}, @option{-Og} completely disables a number of
8437 optimization passes so that individual options controlling them have
8438 no effect. Otherwise @option{-Og} enables all @option{-O1}
8439 optimization flags except for those that may interfere with debugging:
8440
8441 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8442 -fdse -fif-conversion -fif-conversion2 @gol
8443 -finline-functions-called-once @gol
8444 -fmove-loop-invariants -fssa-phiopt @gol
8445 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8446
8447 @end table
8448
8449 If you use multiple @option{-O} options, with or without level numbers,
8450 the last such option is the one that is effective.
8451
8452 Options of the form @option{-f@var{flag}} specify machine-independent
8453 flags. Most flags have both positive and negative forms; the negative
8454 form of @option{-ffoo} is @option{-fno-foo}. In the table
8455 below, only one of the forms is listed---the one you typically
8456 use. You can figure out the other form by either removing @samp{no-}
8457 or adding it.
8458
8459 The following options control specific optimizations. They are either
8460 activated by @option{-O} options or are related to ones that are. You
8461 can use the following flags in the rare cases when ``fine-tuning'' of
8462 optimizations to be performed is desired.
8463
8464 @table @gcctabopt
8465 @item -fno-defer-pop
8466 @opindex fno-defer-pop
8467 @opindex fdefer-pop
8468 For machines that must pop arguments after a function call, always pop
8469 the arguments as soon as each function returns.
8470 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8471 this allows the compiler to let arguments accumulate on the stack for several
8472 function calls and pop them all at once.
8473
8474 @item -fforward-propagate
8475 @opindex fforward-propagate
8476 Perform a forward propagation pass on RTL@. The pass tries to combine two
8477 instructions and checks if the result can be simplified. If loop unrolling
8478 is active, two passes are performed and the second is scheduled after
8479 loop unrolling.
8480
8481 This option is enabled by default at optimization levels @option{-O},
8482 @option{-O2}, @option{-O3}, @option{-Os}.
8483
8484 @item -ffp-contract=@var{style}
8485 @opindex ffp-contract
8486 @option{-ffp-contract=off} disables floating-point expression contraction.
8487 @option{-ffp-contract=fast} enables floating-point expression contraction
8488 such as forming of fused multiply-add operations if the target has
8489 native support for them.
8490 @option{-ffp-contract=on} enables floating-point expression contraction
8491 if allowed by the language standard. This is currently not implemented
8492 and treated equal to @option{-ffp-contract=off}.
8493
8494 The default is @option{-ffp-contract=fast}.
8495
8496 @item -fomit-frame-pointer
8497 @opindex fomit-frame-pointer
8498 Omit the frame pointer in functions that don't need one. This avoids the
8499 instructions to save, set up and restore the frame pointer; on many targets
8500 it also makes an extra register available.
8501
8502 On some targets this flag has no effect because the standard calling sequence
8503 always uses a frame pointer, so it cannot be omitted.
8504
8505 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8506 is used in all functions. Several targets always omit the frame pointer in
8507 leaf functions.
8508
8509 Enabled by default at @option{-O} and higher.
8510
8511 @item -foptimize-sibling-calls
8512 @opindex foptimize-sibling-calls
8513 Optimize sibling and tail recursive calls.
8514
8515 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8516
8517 @item -foptimize-strlen
8518 @opindex foptimize-strlen
8519 Optimize various standard C string functions (e.g.@: @code{strlen},
8520 @code{strchr} or @code{strcpy}) and
8521 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8522
8523 Enabled at levels @option{-O2}, @option{-O3}.
8524
8525 @item -fno-inline
8526 @opindex fno-inline
8527 @opindex finline
8528 Do not expand any functions inline apart from those marked with
8529 the @code{always_inline} attribute. This is the default when not
8530 optimizing.
8531
8532 Single functions can be exempted from inlining by marking them
8533 with the @code{noinline} attribute.
8534
8535 @item -finline-small-functions
8536 @opindex finline-small-functions
8537 Integrate functions into their callers when their body is smaller than expected
8538 function call code (so overall size of program gets smaller). The compiler
8539 heuristically decides which functions are simple enough to be worth integrating
8540 in this way. This inlining applies to all functions, even those not declared
8541 inline.
8542
8543 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8544
8545 @item -findirect-inlining
8546 @opindex findirect-inlining
8547 Inline also indirect calls that are discovered to be known at compile
8548 time thanks to previous inlining. This option has any effect only
8549 when inlining itself is turned on by the @option{-finline-functions}
8550 or @option{-finline-small-functions} options.
8551
8552 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8553
8554 @item -finline-functions
8555 @opindex finline-functions
8556 Consider all functions for inlining, even if they are not declared inline.
8557 The compiler heuristically decides which functions are worth integrating
8558 in this way.
8559
8560 If all calls to a given function are integrated, and the function is
8561 declared @code{static}, then the function is normally not output as
8562 assembler code in its own right.
8563
8564 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8565 by @option{-fprofile-use} and @option{-fauto-profile}.
8566
8567 @item -finline-functions-called-once
8568 @opindex finline-functions-called-once
8569 Consider all @code{static} functions called once for inlining into their
8570 caller even if they are not marked @code{inline}. If a call to a given
8571 function is integrated, then the function is not output as assembler code
8572 in its own right.
8573
8574 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8575 but not @option{-Og}.
8576
8577 @item -fearly-inlining
8578 @opindex fearly-inlining
8579 Inline functions marked by @code{always_inline} and functions whose body seems
8580 smaller than the function call overhead early before doing
8581 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8582 makes profiling significantly cheaper and usually inlining faster on programs
8583 having large chains of nested wrapper functions.
8584
8585 Enabled by default.
8586
8587 @item -fipa-sra
8588 @opindex fipa-sra
8589 Perform interprocedural scalar replacement of aggregates, removal of
8590 unused parameters and replacement of parameters passed by reference
8591 by parameters passed by value.
8592
8593 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8594
8595 @item -finline-limit=@var{n}
8596 @opindex finline-limit
8597 By default, GCC limits the size of functions that can be inlined. This flag
8598 allows coarse control of this limit. @var{n} is the size of functions that
8599 can be inlined in number of pseudo instructions.
8600
8601 Inlining is actually controlled by a number of parameters, which may be
8602 specified individually by using @option{--param @var{name}=@var{value}}.
8603 The @option{-finline-limit=@var{n}} option sets some of these parameters
8604 as follows:
8605
8606 @table @gcctabopt
8607 @item max-inline-insns-single
8608 is set to @var{n}/2.
8609 @item max-inline-insns-auto
8610 is set to @var{n}/2.
8611 @end table
8612
8613 See below for a documentation of the individual
8614 parameters controlling inlining and for the defaults of these parameters.
8615
8616 @emph{Note:} there may be no value to @option{-finline-limit} that results
8617 in default behavior.
8618
8619 @emph{Note:} pseudo instruction represents, in this particular context, an
8620 abstract measurement of function's size. In no way does it represent a count
8621 of assembly instructions and as such its exact meaning might change from one
8622 release to an another.
8623
8624 @item -fno-keep-inline-dllexport
8625 @opindex fno-keep-inline-dllexport
8626 @opindex fkeep-inline-dllexport
8627 This is a more fine-grained version of @option{-fkeep-inline-functions},
8628 which applies only to functions that are declared using the @code{dllexport}
8629 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8630 Functions}.
8631
8632 @item -fkeep-inline-functions
8633 @opindex fkeep-inline-functions
8634 In C, emit @code{static} functions that are declared @code{inline}
8635 into the object file, even if the function has been inlined into all
8636 of its callers. This switch does not affect functions using the
8637 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8638 inline functions into the object file.
8639
8640 @item -fkeep-static-functions
8641 @opindex fkeep-static-functions
8642 Emit @code{static} functions into the object file, even if the function
8643 is never used.
8644
8645 @item -fkeep-static-consts
8646 @opindex fkeep-static-consts
8647 Emit variables declared @code{static const} when optimization isn't turned
8648 on, even if the variables aren't referenced.
8649
8650 GCC enables this option by default. If you want to force the compiler to
8651 check if a variable is referenced, regardless of whether or not
8652 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8653
8654 @item -fmerge-constants
8655 @opindex fmerge-constants
8656 Attempt to merge identical constants (string constants and floating-point
8657 constants) across compilation units.
8658
8659 This option is the default for optimized compilation if the assembler and
8660 linker support it. Use @option{-fno-merge-constants} to inhibit this
8661 behavior.
8662
8663 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8664
8665 @item -fmerge-all-constants
8666 @opindex fmerge-all-constants
8667 Attempt to merge identical constants and identical variables.
8668
8669 This option implies @option{-fmerge-constants}. In addition to
8670 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8671 arrays or initialized constant variables with integral or floating-point
8672 types. Languages like C or C++ require each variable, including multiple
8673 instances of the same variable in recursive calls, to have distinct locations,
8674 so using this option results in non-conforming
8675 behavior.
8676
8677 @item -fmodulo-sched
8678 @opindex fmodulo-sched
8679 Perform swing modulo scheduling immediately before the first scheduling
8680 pass. This pass looks at innermost loops and reorders their
8681 instructions by overlapping different iterations.
8682
8683 @item -fmodulo-sched-allow-regmoves
8684 @opindex fmodulo-sched-allow-regmoves
8685 Perform more aggressive SMS-based modulo scheduling with register moves
8686 allowed. By setting this flag certain anti-dependences edges are
8687 deleted, which triggers the generation of reg-moves based on the
8688 life-range analysis. This option is effective only with
8689 @option{-fmodulo-sched} enabled.
8690
8691 @item -fno-branch-count-reg
8692 @opindex fno-branch-count-reg
8693 @opindex fbranch-count-reg
8694 Disable the optimization pass that scans for opportunities to use
8695 ``decrement and branch'' instructions on a count register instead of
8696 instruction sequences that decrement a register, compare it against zero, and
8697 then branch based upon the result. This option is only meaningful on
8698 architectures that support such instructions, which include x86, PowerPC,
8699 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8700 doesn't remove the decrement and branch instructions from the generated
8701 instruction stream introduced by other optimization passes.
8702
8703 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8704 except for @option{-Og}.
8705
8706 @item -fno-function-cse
8707 @opindex fno-function-cse
8708 @opindex ffunction-cse
8709 Do not put function addresses in registers; make each instruction that
8710 calls a constant function contain the function's address explicitly.
8711
8712 This option results in less efficient code, but some strange hacks
8713 that alter the assembler output may be confused by the optimizations
8714 performed when this option is not used.
8715
8716 The default is @option{-ffunction-cse}
8717
8718 @item -fno-zero-initialized-in-bss
8719 @opindex fno-zero-initialized-in-bss
8720 @opindex fzero-initialized-in-bss
8721 If the target supports a BSS section, GCC by default puts variables that
8722 are initialized to zero into BSS@. This can save space in the resulting
8723 code.
8724
8725 This option turns off this behavior because some programs explicitly
8726 rely on variables going to the data section---e.g., so that the
8727 resulting executable can find the beginning of that section and/or make
8728 assumptions based on that.
8729
8730 The default is @option{-fzero-initialized-in-bss}.
8731
8732 @item -fthread-jumps
8733 @opindex fthread-jumps
8734 Perform optimizations that check to see if a jump branches to a
8735 location where another comparison subsumed by the first is found. If
8736 so, the first branch is redirected to either the destination of the
8737 second branch or a point immediately following it, depending on whether
8738 the condition is known to be true or false.
8739
8740 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8741
8742 @item -fsplit-wide-types
8743 @opindex fsplit-wide-types
8744 When using a type that occupies multiple registers, such as @code{long
8745 long} on a 32-bit system, split the registers apart and allocate them
8746 independently. This normally generates better code for those types,
8747 but may make debugging more difficult.
8748
8749 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8750 @option{-Os}.
8751
8752 @item -fsplit-wide-types-early
8753 @opindex fsplit-wide-types-early
8754 Fully split wide types early, instead of very late.
8755 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8756
8757 This is the default on some targets.
8758
8759 @item -fcse-follow-jumps
8760 @opindex fcse-follow-jumps
8761 In common subexpression elimination (CSE), scan through jump instructions
8762 when the target of the jump is not reached by any other path. For
8763 example, when CSE encounters an @code{if} statement with an
8764 @code{else} clause, CSE follows the jump when the condition
8765 tested is false.
8766
8767 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8768
8769 @item -fcse-skip-blocks
8770 @opindex fcse-skip-blocks
8771 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8772 follow jumps that conditionally skip over blocks. When CSE
8773 encounters a simple @code{if} statement with no else clause,
8774 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8775 body of the @code{if}.
8776
8777 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8778
8779 @item -frerun-cse-after-loop
8780 @opindex frerun-cse-after-loop
8781 Re-run common subexpression elimination after loop optimizations are
8782 performed.
8783
8784 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8785
8786 @item -fgcse
8787 @opindex fgcse
8788 Perform a global common subexpression elimination pass.
8789 This pass also performs global constant and copy propagation.
8790
8791 @emph{Note:} When compiling a program using computed gotos, a GCC
8792 extension, you may get better run-time performance if you disable
8793 the global common subexpression elimination pass by adding
8794 @option{-fno-gcse} to the command line.
8795
8796 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8797
8798 @item -fgcse-lm
8799 @opindex fgcse-lm
8800 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8801 attempts to move loads that are only killed by stores into themselves. This
8802 allows a loop containing a load/store sequence to be changed to a load outside
8803 the loop, and a copy/store within the loop.
8804
8805 Enabled by default when @option{-fgcse} is enabled.
8806
8807 @item -fgcse-sm
8808 @opindex fgcse-sm
8809 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8810 global common subexpression elimination. This pass attempts to move
8811 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8812 loops containing a load/store sequence can be changed to a load before
8813 the loop and a store after the loop.
8814
8815 Not enabled at any optimization level.
8816
8817 @item -fgcse-las
8818 @opindex fgcse-las
8819 When @option{-fgcse-las} is enabled, the global common subexpression
8820 elimination pass eliminates redundant loads that come after stores to the
8821 same memory location (both partial and full redundancies).
8822
8823 Not enabled at any optimization level.
8824
8825 @item -fgcse-after-reload
8826 @opindex fgcse-after-reload
8827 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8828 pass is performed after reload. The purpose of this pass is to clean up
8829 redundant spilling.
8830
8831 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8832
8833 @item -faggressive-loop-optimizations
8834 @opindex faggressive-loop-optimizations
8835 This option tells the loop optimizer to use language constraints to
8836 derive bounds for the number of iterations of a loop. This assumes that
8837 loop code does not invoke undefined behavior by for example causing signed
8838 integer overflows or out-of-bound array accesses. The bounds for the
8839 number of iterations of a loop are used to guide loop unrolling and peeling
8840 and loop exit test optimizations.
8841 This option is enabled by default.
8842
8843 @item -funconstrained-commons
8844 @opindex funconstrained-commons
8845 This option tells the compiler that variables declared in common blocks
8846 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8847 prevents certain optimizations that depend on knowing the array bounds.
8848
8849 @item -fcrossjumping
8850 @opindex fcrossjumping
8851 Perform cross-jumping transformation.
8852 This transformation unifies equivalent code and saves code size. The
8853 resulting code may or may not perform better than without cross-jumping.
8854
8855 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8856
8857 @item -fauto-inc-dec
8858 @opindex fauto-inc-dec
8859 Combine increments or decrements of addresses with memory accesses.
8860 This pass is always skipped on architectures that do not have
8861 instructions to support this. Enabled by default at @option{-O} and
8862 higher on architectures that support this.
8863
8864 @item -fdce
8865 @opindex fdce
8866 Perform dead code elimination (DCE) on RTL@.
8867 Enabled by default at @option{-O} and higher.
8868
8869 @item -fdse
8870 @opindex fdse
8871 Perform dead store elimination (DSE) on RTL@.
8872 Enabled by default at @option{-O} and higher.
8873
8874 @item -fif-conversion
8875 @opindex fif-conversion
8876 Attempt to transform conditional jumps into branch-less equivalents. This
8877 includes use of conditional moves, min, max, set flags and abs instructions, and
8878 some tricks doable by standard arithmetics. The use of conditional execution
8879 on chips where it is available is controlled by @option{-fif-conversion2}.
8880
8881 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8882 not with @option{-Og}.
8883
8884 @item -fif-conversion2
8885 @opindex fif-conversion2
8886 Use conditional execution (where available) to transform conditional jumps into
8887 branch-less equivalents.
8888
8889 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8890 not with @option{-Og}.
8891
8892 @item -fdeclone-ctor-dtor
8893 @opindex fdeclone-ctor-dtor
8894 The C++ ABI requires multiple entry points for constructors and
8895 destructors: one for a base subobject, one for a complete object, and
8896 one for a virtual destructor that calls operator delete afterwards.
8897 For a hierarchy with virtual bases, the base and complete variants are
8898 clones, which means two copies of the function. With this option, the
8899 base and complete variants are changed to be thunks that call a common
8900 implementation.
8901
8902 Enabled by @option{-Os}.
8903
8904 @item -fdelete-null-pointer-checks
8905 @opindex fdelete-null-pointer-checks
8906 Assume that programs cannot safely dereference null pointers, and that
8907 no code or data element resides at address zero.
8908 This option enables simple constant
8909 folding optimizations at all optimization levels. In addition, other
8910 optimization passes in GCC use this flag to control global dataflow
8911 analyses that eliminate useless checks for null pointers; these assume
8912 that a memory access to address zero always results in a trap, so
8913 that if a pointer is checked after it has already been dereferenced,
8914 it cannot be null.
8915
8916 Note however that in some environments this assumption is not true.
8917 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8918 for programs that depend on that behavior.
8919
8920 This option is enabled by default on most targets. On Nios II ELF, it
8921 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8922
8923 Passes that use the dataflow information
8924 are enabled independently at different optimization levels.
8925
8926 @item -fdevirtualize
8927 @opindex fdevirtualize
8928 Attempt to convert calls to virtual functions to direct calls. This
8929 is done both within a procedure and interprocedurally as part of
8930 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8931 propagation (@option{-fipa-cp}).
8932 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8933
8934 @item -fdevirtualize-speculatively
8935 @opindex fdevirtualize-speculatively
8936 Attempt to convert calls to virtual functions to speculative direct calls.
8937 Based on the analysis of the type inheritance graph, determine for a given call
8938 the set of likely targets. If the set is small, preferably of size 1, change
8939 the call into a conditional deciding between direct and indirect calls. The
8940 speculative calls enable more optimizations, such as inlining. When they seem
8941 useless after further optimization, they are converted back into original form.
8942
8943 @item -fdevirtualize-at-ltrans
8944 @opindex fdevirtualize-at-ltrans
8945 Stream extra information needed for aggressive devirtualization when running
8946 the link-time optimizer in local transformation mode.
8947 This option enables more devirtualization but
8948 significantly increases the size of streamed data. For this reason it is
8949 disabled by default.
8950
8951 @item -fexpensive-optimizations
8952 @opindex fexpensive-optimizations
8953 Perform a number of minor optimizations that are relatively expensive.
8954
8955 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8956
8957 @item -free
8958 @opindex free
8959 Attempt to remove redundant extension instructions. This is especially
8960 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8961 registers after writing to their lower 32-bit half.
8962
8963 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8964 @option{-O3}, @option{-Os}.
8965
8966 @item -fno-lifetime-dse
8967 @opindex fno-lifetime-dse
8968 @opindex flifetime-dse
8969 In C++ the value of an object is only affected by changes within its
8970 lifetime: when the constructor begins, the object has an indeterminate
8971 value, and any changes during the lifetime of the object are dead when
8972 the object is destroyed. Normally dead store elimination will take
8973 advantage of this; if your code relies on the value of the object
8974 storage persisting beyond the lifetime of the object, you can use this
8975 flag to disable this optimization. To preserve stores before the
8976 constructor starts (e.g.@: because your operator new clears the object
8977 storage) but still treat the object as dead after the destructor you,
8978 can use @option{-flifetime-dse=1}. The default behavior can be
8979 explicitly selected with @option{-flifetime-dse=2}.
8980 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8981
8982 @item -flive-range-shrinkage
8983 @opindex flive-range-shrinkage
8984 Attempt to decrease register pressure through register live range
8985 shrinkage. This is helpful for fast processors with small or moderate
8986 size register sets.
8987
8988 @item -fira-algorithm=@var{algorithm}
8989 @opindex fira-algorithm
8990 Use the specified coloring algorithm for the integrated register
8991 allocator. The @var{algorithm} argument can be @samp{priority}, which
8992 specifies Chow's priority coloring, or @samp{CB}, which specifies
8993 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8994 for all architectures, but for those targets that do support it, it is
8995 the default because it generates better code.
8996
8997 @item -fira-region=@var{region}
8998 @opindex fira-region
8999 Use specified regions for the integrated register allocator. The
9000 @var{region} argument should be one of the following:
9001
9002 @table @samp
9003
9004 @item all
9005 Use all loops as register allocation regions.
9006 This can give the best results for machines with a small and/or
9007 irregular register set.
9008
9009 @item mixed
9010 Use all loops except for loops with small register pressure
9011 as the regions. This value usually gives
9012 the best results in most cases and for most architectures,
9013 and is enabled by default when compiling with optimization for speed
9014 (@option{-O}, @option{-O2}, @dots{}).
9015
9016 @item one
9017 Use all functions as a single region.
9018 This typically results in the smallest code size, and is enabled by default for
9019 @option{-Os} or @option{-O0}.
9020
9021 @end table
9022
9023 @item -fira-hoist-pressure
9024 @opindex fira-hoist-pressure
9025 Use IRA to evaluate register pressure in the code hoisting pass for
9026 decisions to hoist expressions. This option usually results in smaller
9027 code, but it can slow the compiler down.
9028
9029 This option is enabled at level @option{-Os} for all targets.
9030
9031 @item -fira-loop-pressure
9032 @opindex fira-loop-pressure
9033 Use IRA to evaluate register pressure in loops for decisions to move
9034 loop invariants. This option usually results in generation
9035 of faster and smaller code on machines with large register files (>= 32
9036 registers), but it can slow the compiler down.
9037
9038 This option is enabled at level @option{-O3} for some targets.
9039
9040 @item -fno-ira-share-save-slots
9041 @opindex fno-ira-share-save-slots
9042 @opindex fira-share-save-slots
9043 Disable sharing of stack slots used for saving call-used hard
9044 registers living through a call. Each hard register gets a
9045 separate stack slot, and as a result function stack frames are
9046 larger.
9047
9048 @item -fno-ira-share-spill-slots
9049 @opindex fno-ira-share-spill-slots
9050 @opindex fira-share-spill-slots
9051 Disable sharing of stack slots allocated for pseudo-registers. Each
9052 pseudo-register that does not get a hard register gets a separate
9053 stack slot, and as a result function stack frames are larger.
9054
9055 @item -flra-remat
9056 @opindex flra-remat
9057 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9058 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9059 values if it is profitable.
9060
9061 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9062
9063 @item -fdelayed-branch
9064 @opindex fdelayed-branch
9065 If supported for the target machine, attempt to reorder instructions
9066 to exploit instruction slots available after delayed branch
9067 instructions.
9068
9069 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9070 but not at @option{-Og}.
9071
9072 @item -fschedule-insns
9073 @opindex fschedule-insns
9074 If supported for the target machine, attempt to reorder instructions to
9075 eliminate execution stalls due to required data being unavailable. This
9076 helps machines that have slow floating point or memory load instructions
9077 by allowing other instructions to be issued until the result of the load
9078 or floating-point instruction is required.
9079
9080 Enabled at levels @option{-O2}, @option{-O3}.
9081
9082 @item -fschedule-insns2
9083 @opindex fschedule-insns2
9084 Similar to @option{-fschedule-insns}, but requests an additional pass of
9085 instruction scheduling after register allocation has been done. This is
9086 especially useful on machines with a relatively small number of
9087 registers and where memory load instructions take more than one cycle.
9088
9089 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9090
9091 @item -fno-sched-interblock
9092 @opindex fno-sched-interblock
9093 @opindex fsched-interblock
9094 Disable instruction scheduling across basic blocks, which
9095 is normally enabled when scheduling before register allocation, i.e.@:
9096 with @option{-fschedule-insns} or at @option{-O2} or higher.
9097
9098 @item -fno-sched-spec
9099 @opindex fno-sched-spec
9100 @opindex fsched-spec
9101 Disable speculative motion of non-load instructions, which
9102 is normally enabled when scheduling before register allocation, i.e.@:
9103 with @option{-fschedule-insns} or at @option{-O2} or higher.
9104
9105 @item -fsched-pressure
9106 @opindex fsched-pressure
9107 Enable register pressure sensitive insn scheduling before register
9108 allocation. This only makes sense when scheduling before register
9109 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9110 @option{-O2} or higher. Usage of this option can improve the
9111 generated code and decrease its size by preventing register pressure
9112 increase above the number of available hard registers and subsequent
9113 spills in register allocation.
9114
9115 @item -fsched-spec-load
9116 @opindex fsched-spec-load
9117 Allow speculative motion of some load instructions. This only makes
9118 sense when scheduling before register allocation, i.e.@: with
9119 @option{-fschedule-insns} or at @option{-O2} or higher.
9120
9121 @item -fsched-spec-load-dangerous
9122 @opindex fsched-spec-load-dangerous
9123 Allow speculative motion of more load instructions. This only makes
9124 sense when scheduling before register allocation, i.e.@: with
9125 @option{-fschedule-insns} or at @option{-O2} or higher.
9126
9127 @item -fsched-stalled-insns
9128 @itemx -fsched-stalled-insns=@var{n}
9129 @opindex fsched-stalled-insns
9130 Define how many insns (if any) can be moved prematurely from the queue
9131 of stalled insns into the ready list during the second scheduling pass.
9132 @option{-fno-sched-stalled-insns} means that no insns are moved
9133 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9134 on how many queued insns can be moved prematurely.
9135 @option{-fsched-stalled-insns} without a value is equivalent to
9136 @option{-fsched-stalled-insns=1}.
9137
9138 @item -fsched-stalled-insns-dep
9139 @itemx -fsched-stalled-insns-dep=@var{n}
9140 @opindex fsched-stalled-insns-dep
9141 Define how many insn groups (cycles) are examined for a dependency
9142 on a stalled insn that is a candidate for premature removal from the queue
9143 of stalled insns. This has an effect only during the second scheduling pass,
9144 and only if @option{-fsched-stalled-insns} is used.
9145 @option{-fno-sched-stalled-insns-dep} is equivalent to
9146 @option{-fsched-stalled-insns-dep=0}.
9147 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9148 @option{-fsched-stalled-insns-dep=1}.
9149
9150 @item -fsched2-use-superblocks
9151 @opindex fsched2-use-superblocks
9152 When scheduling after register allocation, use superblock scheduling.
9153 This allows motion across basic block boundaries,
9154 resulting in faster schedules. This option is experimental, as not all machine
9155 descriptions used by GCC model the CPU closely enough to avoid unreliable
9156 results from the algorithm.
9157
9158 This only makes sense when scheduling after register allocation, i.e.@: with
9159 @option{-fschedule-insns2} or at @option{-O2} or higher.
9160
9161 @item -fsched-group-heuristic
9162 @opindex fsched-group-heuristic
9163 Enable the group heuristic in the scheduler. This heuristic favors
9164 the instruction that belongs to a schedule group. This is enabled
9165 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9166 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9167
9168 @item -fsched-critical-path-heuristic
9169 @opindex fsched-critical-path-heuristic
9170 Enable the critical-path heuristic in the scheduler. This heuristic favors
9171 instructions on the critical path. This is enabled by default when
9172 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9173 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9174
9175 @item -fsched-spec-insn-heuristic
9176 @opindex fsched-spec-insn-heuristic
9177 Enable the speculative instruction heuristic in the scheduler. This
9178 heuristic favors speculative instructions with greater dependency weakness.
9179 This is enabled by default when scheduling is enabled, i.e.@:
9180 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9181 or at @option{-O2} or higher.
9182
9183 @item -fsched-rank-heuristic
9184 @opindex fsched-rank-heuristic
9185 Enable the rank heuristic in the scheduler. This heuristic favors
9186 the instruction belonging to a basic block with greater size or frequency.
9187 This is enabled by default when scheduling is enabled, i.e.@:
9188 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9189 at @option{-O2} or higher.
9190
9191 @item -fsched-last-insn-heuristic
9192 @opindex fsched-last-insn-heuristic
9193 Enable the last-instruction heuristic in the scheduler. This heuristic
9194 favors the instruction that is less dependent on the last instruction
9195 scheduled. This is enabled by default when scheduling is enabled,
9196 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9197 at @option{-O2} or higher.
9198
9199 @item -fsched-dep-count-heuristic
9200 @opindex fsched-dep-count-heuristic
9201 Enable the dependent-count heuristic in the scheduler. This heuristic
9202 favors the instruction that has more instructions depending on it.
9203 This is enabled by default when scheduling is enabled, i.e.@:
9204 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9205 at @option{-O2} or higher.
9206
9207 @item -freschedule-modulo-scheduled-loops
9208 @opindex freschedule-modulo-scheduled-loops
9209 Modulo scheduling is performed before traditional scheduling. If a loop
9210 is modulo scheduled, later scheduling passes may change its schedule.
9211 Use this option to control that behavior.
9212
9213 @item -fselective-scheduling
9214 @opindex fselective-scheduling
9215 Schedule instructions using selective scheduling algorithm. Selective
9216 scheduling runs instead of the first scheduler pass.
9217
9218 @item -fselective-scheduling2
9219 @opindex fselective-scheduling2
9220 Schedule instructions using selective scheduling algorithm. Selective
9221 scheduling runs instead of the second scheduler pass.
9222
9223 @item -fsel-sched-pipelining
9224 @opindex fsel-sched-pipelining
9225 Enable software pipelining of innermost loops during selective scheduling.
9226 This option has no effect unless one of @option{-fselective-scheduling} or
9227 @option{-fselective-scheduling2} is turned on.
9228
9229 @item -fsel-sched-pipelining-outer-loops
9230 @opindex fsel-sched-pipelining-outer-loops
9231 When pipelining loops during selective scheduling, also pipeline outer loops.
9232 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9233
9234 @item -fsemantic-interposition
9235 @opindex fsemantic-interposition
9236 Some object formats, like ELF, allow interposing of symbols by the
9237 dynamic linker.
9238 This means that for symbols exported from the DSO, the compiler cannot perform
9239 interprocedural propagation, inlining and other optimizations in anticipation
9240 that the function or variable in question may change. While this feature is
9241 useful, for example, to rewrite memory allocation functions by a debugging
9242 implementation, it is expensive in the terms of code quality.
9243 With @option{-fno-semantic-interposition} the compiler assumes that
9244 if interposition happens for functions the overwriting function will have
9245 precisely the same semantics (and side effects).
9246 Similarly if interposition happens
9247 for variables, the constructor of the variable will be the same. The flag
9248 has no effect for functions explicitly declared inline
9249 (where it is never allowed for interposition to change semantics)
9250 and for symbols explicitly declared weak.
9251
9252 @item -fshrink-wrap
9253 @opindex fshrink-wrap
9254 Emit function prologues only before parts of the function that need it,
9255 rather than at the top of the function. This flag is enabled by default at
9256 @option{-O} and higher.
9257
9258 @item -fshrink-wrap-separate
9259 @opindex fshrink-wrap-separate
9260 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9261 those parts are only executed when needed.
9262 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9263 is also turned on and the target supports this.
9264
9265 @item -fcaller-saves
9266 @opindex fcaller-saves
9267 Enable allocation of values to registers that are clobbered by
9268 function calls, by emitting extra instructions to save and restore the
9269 registers around such calls. Such allocation is done only when it
9270 seems to result in better code.
9271
9272 This option is always enabled by default on certain machines, usually
9273 those which have no call-preserved registers to use instead.
9274
9275 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9276
9277 @item -fcombine-stack-adjustments
9278 @opindex fcombine-stack-adjustments
9279 Tracks stack adjustments (pushes and pops) and stack memory references
9280 and then tries to find ways to combine them.
9281
9282 Enabled by default at @option{-O1} and higher.
9283
9284 @item -fipa-ra
9285 @opindex fipa-ra
9286 Use caller save registers for allocation if those registers are not used by
9287 any called function. In that case it is not necessary to save and restore
9288 them around calls. This is only possible if called functions are part of
9289 same compilation unit as current function and they are compiled before it.
9290
9291 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9292 is disabled if generated code will be instrumented for profiling
9293 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9294 exactly (this happens on targets that do not expose prologues
9295 and epilogues in RTL).
9296
9297 @item -fconserve-stack
9298 @opindex fconserve-stack
9299 Attempt to minimize stack usage. The compiler attempts to use less
9300 stack space, even if that makes the program slower. This option
9301 implies setting the @option{large-stack-frame} parameter to 100
9302 and the @option{large-stack-frame-growth} parameter to 400.
9303
9304 @item -ftree-reassoc
9305 @opindex ftree-reassoc
9306 Perform reassociation on trees. This flag is enabled by default
9307 at @option{-O} and higher.
9308
9309 @item -fcode-hoisting
9310 @opindex fcode-hoisting
9311 Perform code hoisting. Code hoisting tries to move the
9312 evaluation of expressions executed on all paths to the function exit
9313 as early as possible. This is especially useful as a code size
9314 optimization, but it often helps for code speed as well.
9315 This flag is enabled by default at @option{-O2} and higher.
9316
9317 @item -ftree-pre
9318 @opindex ftree-pre
9319 Perform partial redundancy elimination (PRE) on trees. This flag is
9320 enabled by default at @option{-O2} and @option{-O3}.
9321
9322 @item -ftree-partial-pre
9323 @opindex ftree-partial-pre
9324 Make partial redundancy elimination (PRE) more aggressive. This flag is
9325 enabled by default at @option{-O3}.
9326
9327 @item -ftree-forwprop
9328 @opindex ftree-forwprop
9329 Perform forward propagation on trees. This flag is enabled by default
9330 at @option{-O} and higher.
9331
9332 @item -ftree-fre
9333 @opindex ftree-fre
9334 Perform full redundancy elimination (FRE) on trees. The difference
9335 between FRE and PRE is that FRE only considers expressions
9336 that are computed on all paths leading to the redundant computation.
9337 This analysis is faster than PRE, though it exposes fewer redundancies.
9338 This flag is enabled by default at @option{-O} and higher.
9339
9340 @item -ftree-phiprop
9341 @opindex ftree-phiprop
9342 Perform hoisting of loads from conditional pointers on trees. This
9343 pass is enabled by default at @option{-O} and higher.
9344
9345 @item -fhoist-adjacent-loads
9346 @opindex fhoist-adjacent-loads
9347 Speculatively hoist loads from both branches of an if-then-else if the
9348 loads are from adjacent locations in the same structure and the target
9349 architecture has a conditional move instruction. This flag is enabled
9350 by default at @option{-O2} and higher.
9351
9352 @item -ftree-copy-prop
9353 @opindex ftree-copy-prop
9354 Perform copy propagation on trees. This pass eliminates unnecessary
9355 copy operations. This flag is enabled by default at @option{-O} and
9356 higher.
9357
9358 @item -fipa-pure-const
9359 @opindex fipa-pure-const
9360 Discover which functions are pure or constant.
9361 Enabled by default at @option{-O} and higher.
9362
9363 @item -fipa-reference
9364 @opindex fipa-reference
9365 Discover which static variables do not escape the
9366 compilation unit.
9367 Enabled by default at @option{-O} and higher.
9368
9369 @item -fipa-reference-addressable
9370 @opindex fipa-reference-addressable
9371 Discover read-only, write-only and non-addressable static variables.
9372 Enabled by default at @option{-O} and higher.
9373
9374 @item -fipa-stack-alignment
9375 @opindex fipa-stack-alignment
9376 Reduce stack alignment on call sites if possible.
9377 Enabled by default.
9378
9379 @item -fipa-pta
9380 @opindex fipa-pta
9381 Perform interprocedural pointer analysis and interprocedural modification
9382 and reference analysis. This option can cause excessive memory and
9383 compile-time usage on large compilation units. It is not enabled by
9384 default at any optimization level.
9385
9386 @item -fipa-profile
9387 @opindex fipa-profile
9388 Perform interprocedural profile propagation. The functions called only from
9389 cold functions are marked as cold. Also functions executed once (such as
9390 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9391 functions and loop less parts of functions executed once are then optimized for
9392 size.
9393 Enabled by default at @option{-O} and higher.
9394
9395 @item -fipa-cp
9396 @opindex fipa-cp
9397 Perform interprocedural constant propagation.
9398 This optimization analyzes the program to determine when values passed
9399 to functions are constants and then optimizes accordingly.
9400 This optimization can substantially increase performance
9401 if the application has constants passed to functions.
9402 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9403 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9404
9405 @item -fipa-cp-clone
9406 @opindex fipa-cp-clone
9407 Perform function cloning to make interprocedural constant propagation stronger.
9408 When enabled, interprocedural constant propagation performs function cloning
9409 when externally visible function can be called with constant arguments.
9410 Because this optimization can create multiple copies of functions,
9411 it may significantly increase code size
9412 (see @option{--param ipcp-unit-growth=@var{value}}).
9413 This flag is enabled by default at @option{-O3}.
9414 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9415
9416 @item -fipa-bit-cp
9417 @opindex fipa-bit-cp
9418 When enabled, perform interprocedural bitwise constant
9419 propagation. This flag is enabled by default at @option{-O2} and
9420 by @option{-fprofile-use} and @option{-fauto-profile}.
9421 It requires that @option{-fipa-cp} is enabled.
9422
9423 @item -fipa-vrp
9424 @opindex fipa-vrp
9425 When enabled, perform interprocedural propagation of value
9426 ranges. This flag is enabled by default at @option{-O2}. It requires
9427 that @option{-fipa-cp} is enabled.
9428
9429 @item -fipa-icf
9430 @opindex fipa-icf
9431 Perform Identical Code Folding for functions and read-only variables.
9432 The optimization reduces code size and may disturb unwind stacks by replacing
9433 a function by equivalent one with a different name. The optimization works
9434 more effectively with link-time optimization enabled.
9435
9436 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9437 works on different levels and thus the optimizations are not same - there are
9438 equivalences that are found only by GCC and equivalences found only by Gold.
9439
9440 This flag is enabled by default at @option{-O2} and @option{-Os}.
9441
9442 @item -flive-patching=@var{level}
9443 @opindex flive-patching
9444 Control GCC's optimizations to produce output suitable for live-patching.
9445
9446 If the compiler's optimization uses a function's body or information extracted
9447 from its body to optimize/change another function, the latter is called an
9448 impacted function of the former. If a function is patched, its impacted
9449 functions should be patched too.
9450
9451 The impacted functions are determined by the compiler's interprocedural
9452 optimizations. For example, a caller is impacted when inlining a function
9453 into its caller,
9454 cloning a function and changing its caller to call this new clone,
9455 or extracting a function's pureness/constness information to optimize
9456 its direct or indirect callers, etc.
9457
9458 Usually, the more IPA optimizations enabled, the larger the number of
9459 impacted functions for each function. In order to control the number of
9460 impacted functions and more easily compute the list of impacted function,
9461 IPA optimizations can be partially enabled at two different levels.
9462
9463 The @var{level} argument should be one of the following:
9464
9465 @table @samp
9466
9467 @item inline-clone
9468
9469 Only enable inlining and cloning optimizations, which includes inlining,
9470 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9471 As a result, when patching a function, all its callers and its clones'
9472 callers are impacted, therefore need to be patched as well.
9473
9474 @option{-flive-patching=inline-clone} disables the following optimization flags:
9475 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9476 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9477 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9478 -fipa-stack-alignment}
9479
9480 @item inline-only-static
9481
9482 Only enable inlining of static functions.
9483 As a result, when patching a static function, all its callers are impacted
9484 and so need to be patched as well.
9485
9486 In addition to all the flags that @option{-flive-patching=inline-clone}
9487 disables,
9488 @option{-flive-patching=inline-only-static} disables the following additional
9489 optimization flags:
9490 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9491
9492 @end table
9493
9494 When @option{-flive-patching} is specified without any value, the default value
9495 is @var{inline-clone}.
9496
9497 This flag is disabled by default.
9498
9499 Note that @option{-flive-patching} is not supported with link-time optimization
9500 (@option{-flto}).
9501
9502 @item -fisolate-erroneous-paths-dereference
9503 @opindex fisolate-erroneous-paths-dereference
9504 Detect paths that trigger erroneous or undefined behavior due to
9505 dereferencing a null pointer. Isolate those paths from the main control
9506 flow and turn the statement with erroneous or undefined behavior into a trap.
9507 This flag is enabled by default at @option{-O2} and higher and depends on
9508 @option{-fdelete-null-pointer-checks} also being enabled.
9509
9510 @item -fisolate-erroneous-paths-attribute
9511 @opindex fisolate-erroneous-paths-attribute
9512 Detect paths that trigger erroneous or undefined behavior due to a null value
9513 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9514 attribute. Isolate those paths from the main control flow and turn the
9515 statement with erroneous or undefined behavior into a trap. This is not
9516 currently enabled, but may be enabled by @option{-O2} in the future.
9517
9518 @item -ftree-sink
9519 @opindex ftree-sink
9520 Perform forward store motion on trees. This flag is
9521 enabled by default at @option{-O} and higher.
9522
9523 @item -ftree-bit-ccp
9524 @opindex ftree-bit-ccp
9525 Perform sparse conditional bit constant propagation on trees and propagate
9526 pointer alignment information.
9527 This pass only operates on local scalar variables and is enabled by default
9528 at @option{-O1} and higher, except for @option{-Og}.
9529 It requires that @option{-ftree-ccp} is enabled.
9530
9531 @item -ftree-ccp
9532 @opindex ftree-ccp
9533 Perform sparse conditional constant propagation (CCP) on trees. This
9534 pass only operates on local scalar variables and is enabled by default
9535 at @option{-O} and higher.
9536
9537 @item -fssa-backprop
9538 @opindex fssa-backprop
9539 Propagate information about uses of a value up the definition chain
9540 in order to simplify the definitions. For example, this pass strips
9541 sign operations if the sign of a value never matters. The flag is
9542 enabled by default at @option{-O} and higher.
9543
9544 @item -fssa-phiopt
9545 @opindex fssa-phiopt
9546 Perform pattern matching on SSA PHI nodes to optimize conditional
9547 code. This pass is enabled by default at @option{-O1} and higher,
9548 except for @option{-Og}.
9549
9550 @item -ftree-switch-conversion
9551 @opindex ftree-switch-conversion
9552 Perform conversion of simple initializations in a switch to
9553 initializations from a scalar array. This flag is enabled by default
9554 at @option{-O2} and higher.
9555
9556 @item -ftree-tail-merge
9557 @opindex ftree-tail-merge
9558 Look for identical code sequences. When found, replace one with a jump to the
9559 other. This optimization is known as tail merging or cross jumping. This flag
9560 is enabled by default at @option{-O2} and higher. The compilation time
9561 in this pass can
9562 be limited using @option{max-tail-merge-comparisons} parameter and
9563 @option{max-tail-merge-iterations} parameter.
9564
9565 @item -ftree-dce
9566 @opindex ftree-dce
9567 Perform dead code elimination (DCE) on trees. This flag is enabled by
9568 default at @option{-O} and higher.
9569
9570 @item -ftree-builtin-call-dce
9571 @opindex ftree-builtin-call-dce
9572 Perform conditional dead code elimination (DCE) for calls to built-in functions
9573 that may set @code{errno} but are otherwise free of side effects. This flag is
9574 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9575 specified.
9576
9577 @item -ffinite-loops
9578 @opindex ffinite-loops
9579 @opindex fno-finite-loops
9580 Assume that a loop with an exit will eventually take the exit and not loop
9581 indefinitely. This allows the compiler to remove loops that otherwise have
9582 no side-effects, not considering eventual endless looping as such.
9583
9584 This option is enabled by default at @option{-O2}.
9585
9586 @item -ftree-dominator-opts
9587 @opindex ftree-dominator-opts
9588 Perform a variety of simple scalar cleanups (constant/copy
9589 propagation, redundancy elimination, range propagation and expression
9590 simplification) based on a dominator tree traversal. This also
9591 performs jump threading (to reduce jumps to jumps). This flag is
9592 enabled by default at @option{-O} and higher.
9593
9594 @item -ftree-dse
9595 @opindex ftree-dse
9596 Perform dead store elimination (DSE) on trees. A dead store is a store into
9597 a memory location that is later overwritten by another store without
9598 any intervening loads. In this case the earlier store can be deleted. This
9599 flag is enabled by default at @option{-O} and higher.
9600
9601 @item -ftree-ch
9602 @opindex ftree-ch
9603 Perform loop header copying on trees. This is beneficial since it increases
9604 effectiveness of code motion optimizations. It also saves one jump. This flag
9605 is enabled by default at @option{-O} and higher. It is not enabled
9606 for @option{-Os}, since it usually increases code size.
9607
9608 @item -ftree-loop-optimize
9609 @opindex ftree-loop-optimize
9610 Perform loop optimizations on trees. This flag is enabled by default
9611 at @option{-O} and higher.
9612
9613 @item -ftree-loop-linear
9614 @itemx -floop-strip-mine
9615 @itemx -floop-block
9616 @opindex ftree-loop-linear
9617 @opindex floop-strip-mine
9618 @opindex floop-block
9619 Perform loop nest optimizations. Same as
9620 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9621 to be configured with @option{--with-isl} to enable the Graphite loop
9622 transformation infrastructure.
9623
9624 @item -fgraphite-identity
9625 @opindex fgraphite-identity
9626 Enable the identity transformation for graphite. For every SCoP we generate
9627 the polyhedral representation and transform it back to gimple. Using
9628 @option{-fgraphite-identity} we can check the costs or benefits of the
9629 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9630 are also performed by the code generator isl, like index splitting and
9631 dead code elimination in loops.
9632
9633 @item -floop-nest-optimize
9634 @opindex floop-nest-optimize
9635 Enable the isl based loop nest optimizer. This is a generic loop nest
9636 optimizer based on the Pluto optimization algorithms. It calculates a loop
9637 structure optimized for data-locality and parallelism. This option
9638 is experimental.
9639
9640 @item -floop-parallelize-all
9641 @opindex floop-parallelize-all
9642 Use the Graphite data dependence analysis to identify loops that can
9643 be parallelized. Parallelize all the loops that can be analyzed to
9644 not contain loop carried dependences without checking that it is
9645 profitable to parallelize the loops.
9646
9647 @item -ftree-coalesce-vars
9648 @opindex ftree-coalesce-vars
9649 While transforming the program out of the SSA representation, attempt to
9650 reduce copying by coalescing versions of different user-defined
9651 variables, instead of just compiler temporaries. This may severely
9652 limit the ability to debug an optimized program compiled with
9653 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9654 prevents SSA coalescing of user variables. This option is enabled by
9655 default if optimization is enabled, and it does very little otherwise.
9656
9657 @item -ftree-loop-if-convert
9658 @opindex ftree-loop-if-convert
9659 Attempt to transform conditional jumps in the innermost loops to
9660 branch-less equivalents. The intent is to remove control-flow from
9661 the innermost loops in order to improve the ability of the
9662 vectorization pass to handle these loops. This is enabled by default
9663 if vectorization is enabled.
9664
9665 @item -ftree-loop-distribution
9666 @opindex ftree-loop-distribution
9667 Perform loop distribution. This flag can improve cache performance on
9668 big loop bodies and allow further loop optimizations, like
9669 parallelization or vectorization, to take place. For example, the loop
9670 @smallexample
9671 DO I = 1, N
9672 A(I) = B(I) + C
9673 D(I) = E(I) * F
9674 ENDDO
9675 @end smallexample
9676 is transformed to
9677 @smallexample
9678 DO I = 1, N
9679 A(I) = B(I) + C
9680 ENDDO
9681 DO I = 1, N
9682 D(I) = E(I) * F
9683 ENDDO
9684 @end smallexample
9685 This flag is enabled by default at @option{-O3}.
9686 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9687
9688 @item -ftree-loop-distribute-patterns
9689 @opindex ftree-loop-distribute-patterns
9690 Perform loop distribution of patterns that can be code generated with
9691 calls to a library. This flag is enabled by default at @option{-O3}, and
9692 by @option{-fprofile-use} and @option{-fauto-profile}.
9693
9694 This pass distributes the initialization loops and generates a call to
9695 memset zero. For example, the loop
9696 @smallexample
9697 DO I = 1, N
9698 A(I) = 0
9699 B(I) = A(I) + I
9700 ENDDO
9701 @end smallexample
9702 is transformed to
9703 @smallexample
9704 DO I = 1, N
9705 A(I) = 0
9706 ENDDO
9707 DO I = 1, N
9708 B(I) = A(I) + I
9709 ENDDO
9710 @end smallexample
9711 and the initialization loop is transformed into a call to memset zero.
9712 This flag is enabled by default at @option{-O3}.
9713 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9714
9715 @item -floop-interchange
9716 @opindex floop-interchange
9717 Perform loop interchange outside of graphite. This flag can improve cache
9718 performance on loop nest and allow further loop optimizations, like
9719 vectorization, to take place. For example, the loop
9720 @smallexample
9721 for (int i = 0; i < N; i++)
9722 for (int j = 0; j < N; j++)
9723 for (int k = 0; k < N; k++)
9724 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9725 @end smallexample
9726 is transformed to
9727 @smallexample
9728 for (int i = 0; i < N; i++)
9729 for (int k = 0; k < N; k++)
9730 for (int j = 0; j < N; j++)
9731 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9732 @end smallexample
9733 This flag is enabled by default at @option{-O3}.
9734 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9735
9736 @item -floop-unroll-and-jam
9737 @opindex floop-unroll-and-jam
9738 Apply unroll and jam transformations on feasible loops. In a loop
9739 nest this unrolls the outer loop by some factor and fuses the resulting
9740 multiple inner loops. This flag is enabled by default at @option{-O3}.
9741 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9742
9743 @item -ftree-loop-im
9744 @opindex ftree-loop-im
9745 Perform loop invariant motion on trees. This pass moves only invariants that
9746 are hard to handle at RTL level (function calls, operations that expand to
9747 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9748 operands of conditions that are invariant out of the loop, so that we can use
9749 just trivial invariantness analysis in loop unswitching. The pass also includes
9750 store motion.
9751
9752 @item -ftree-loop-ivcanon
9753 @opindex ftree-loop-ivcanon
9754 Create a canonical counter for number of iterations in loops for which
9755 determining number of iterations requires complicated analysis. Later
9756 optimizations then may determine the number easily. Useful especially
9757 in connection with unrolling.
9758
9759 @item -ftree-scev-cprop
9760 @opindex ftree-scev-cprop
9761 Perform final value replacement. If a variable is modified in a loop
9762 in such a way that its value when exiting the loop can be determined using
9763 only its initial value and the number of loop iterations, replace uses of
9764 the final value by such a computation, provided it is sufficiently cheap.
9765 This reduces data dependencies and may allow further simplifications.
9766 Enabled by default at @option{-O} and higher.
9767
9768 @item -fivopts
9769 @opindex fivopts
9770 Perform induction variable optimizations (strength reduction, induction
9771 variable merging and induction variable elimination) on trees.
9772
9773 @item -ftree-parallelize-loops=n
9774 @opindex ftree-parallelize-loops
9775 Parallelize loops, i.e., split their iteration space to run in n threads.
9776 This is only possible for loops whose iterations are independent
9777 and can be arbitrarily reordered. The optimization is only
9778 profitable on multiprocessor machines, for loops that are CPU-intensive,
9779 rather than constrained e.g.@: by memory bandwidth. This option
9780 implies @option{-pthread}, and thus is only supported on targets
9781 that have support for @option{-pthread}.
9782
9783 @item -ftree-pta
9784 @opindex ftree-pta
9785 Perform function-local points-to analysis on trees. This flag is
9786 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9787
9788 @item -ftree-sra
9789 @opindex ftree-sra
9790 Perform scalar replacement of aggregates. This pass replaces structure
9791 references with scalars to prevent committing structures to memory too
9792 early. This flag is enabled by default at @option{-O1} and higher,
9793 except for @option{-Og}.
9794
9795 @item -fstore-merging
9796 @opindex fstore-merging
9797 Perform merging of narrow stores to consecutive memory addresses. This pass
9798 merges contiguous stores of immediate values narrower than a word into fewer
9799 wider stores to reduce the number of instructions. This is enabled by default
9800 at @option{-O2} and higher as well as @option{-Os}.
9801
9802 @item -ftree-ter
9803 @opindex ftree-ter
9804 Perform temporary expression replacement during the SSA->normal phase. Single
9805 use/single def temporaries are replaced at their use location with their
9806 defining expression. This results in non-GIMPLE code, but gives the expanders
9807 much more complex trees to work on resulting in better RTL generation. This is
9808 enabled by default at @option{-O} and higher.
9809
9810 @item -ftree-slsr
9811 @opindex ftree-slsr
9812 Perform straight-line strength reduction on trees. This recognizes related
9813 expressions involving multiplications and replaces them by less expensive
9814 calculations when possible. This is enabled by default at @option{-O} and
9815 higher.
9816
9817 @item -ftree-vectorize
9818 @opindex ftree-vectorize
9819 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9820 and @option{-ftree-slp-vectorize} if not explicitly specified.
9821
9822 @item -ftree-loop-vectorize
9823 @opindex ftree-loop-vectorize
9824 Perform loop vectorization on trees. This flag is enabled by default at
9825 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9826 and @option{-fauto-profile}.
9827
9828 @item -ftree-slp-vectorize
9829 @opindex ftree-slp-vectorize
9830 Perform basic block vectorization on trees. This flag is enabled by default at
9831 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9832 and @option{-fauto-profile}.
9833
9834 @item -fvect-cost-model=@var{model}
9835 @opindex fvect-cost-model
9836 Alter the cost model used for vectorization. The @var{model} argument
9837 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9838 With the @samp{unlimited} model the vectorized code-path is assumed
9839 to be profitable while with the @samp{dynamic} model a runtime check
9840 guards the vectorized code-path to enable it only for iteration
9841 counts that will likely execute faster than when executing the original
9842 scalar loop. The @samp{cheap} model disables vectorization of
9843 loops where doing so would be cost prohibitive for example due to
9844 required runtime checks for data dependence or alignment but otherwise
9845 is equal to the @samp{dynamic} model.
9846 The default cost model depends on other optimization flags and is
9847 either @samp{dynamic} or @samp{cheap}.
9848
9849 @item -fsimd-cost-model=@var{model}
9850 @opindex fsimd-cost-model
9851 Alter the cost model used for vectorization of loops marked with the OpenMP
9852 simd directive. The @var{model} argument should be one of
9853 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9854 have the same meaning as described in @option{-fvect-cost-model} and by
9855 default a cost model defined with @option{-fvect-cost-model} is used.
9856
9857 @item -ftree-vrp
9858 @opindex ftree-vrp
9859 Perform Value Range Propagation on trees. This is similar to the
9860 constant propagation pass, but instead of values, ranges of values are
9861 propagated. This allows the optimizers to remove unnecessary range
9862 checks like array bound checks and null pointer checks. This is
9863 enabled by default at @option{-O2} and higher. Null pointer check
9864 elimination is only done if @option{-fdelete-null-pointer-checks} is
9865 enabled.
9866
9867 @item -fsplit-paths
9868 @opindex fsplit-paths
9869 Split paths leading to loop backedges. This can improve dead code
9870 elimination and common subexpression elimination. This is enabled by
9871 default at @option{-O3} and above.
9872
9873 @item -fsplit-ivs-in-unroller
9874 @opindex fsplit-ivs-in-unroller
9875 Enables expression of values of induction variables in later iterations
9876 of the unrolled loop using the value in the first iteration. This breaks
9877 long dependency chains, thus improving efficiency of the scheduling passes.
9878
9879 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9880 same effect. However, that is not reliable in cases where the loop body
9881 is more complicated than a single basic block. It also does not work at all
9882 on some architectures due to restrictions in the CSE pass.
9883
9884 This optimization is enabled by default.
9885
9886 @item -fvariable-expansion-in-unroller
9887 @opindex fvariable-expansion-in-unroller
9888 With this option, the compiler creates multiple copies of some
9889 local variables when unrolling a loop, which can result in superior code.
9890
9891 This optimization is enabled by default for PowerPC targets, but disabled
9892 by default otherwise.
9893
9894 @item -fpartial-inlining
9895 @opindex fpartial-inlining
9896 Inline parts of functions. This option has any effect only
9897 when inlining itself is turned on by the @option{-finline-functions}
9898 or @option{-finline-small-functions} options.
9899
9900 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9901
9902 @item -fpredictive-commoning
9903 @opindex fpredictive-commoning
9904 Perform predictive commoning optimization, i.e., reusing computations
9905 (especially memory loads and stores) performed in previous
9906 iterations of loops.
9907
9908 This option is enabled at level @option{-O3}.
9909 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9910
9911 @item -fprefetch-loop-arrays
9912 @opindex fprefetch-loop-arrays
9913 If supported by the target machine, generate instructions to prefetch
9914 memory to improve the performance of loops that access large arrays.
9915
9916 This option may generate better or worse code; results are highly
9917 dependent on the structure of loops within the source code.
9918
9919 Disabled at level @option{-Os}.
9920
9921 @item -fno-printf-return-value
9922 @opindex fno-printf-return-value
9923 @opindex fprintf-return-value
9924 Do not substitute constants for known return value of formatted output
9925 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9926 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9927 transformation allows GCC to optimize or even eliminate branches based
9928 on the known return value of these functions called with arguments that
9929 are either constant, or whose values are known to be in a range that
9930 makes determining the exact return value possible. For example, when
9931 @option{-fprintf-return-value} is in effect, both the branch and the
9932 body of the @code{if} statement (but not the call to @code{snprint})
9933 can be optimized away when @code{i} is a 32-bit or smaller integer
9934 because the return value is guaranteed to be at most 8.
9935
9936 @smallexample
9937 char buf[9];
9938 if (snprintf (buf, "%08x", i) >= sizeof buf)
9939 @dots{}
9940 @end smallexample
9941
9942 The @option{-fprintf-return-value} option relies on other optimizations
9943 and yields best results with @option{-O2} and above. It works in tandem
9944 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9945 options. The @option{-fprintf-return-value} option is enabled by default.
9946
9947 @item -fno-peephole
9948 @itemx -fno-peephole2
9949 @opindex fno-peephole
9950 @opindex fpeephole
9951 @opindex fno-peephole2
9952 @opindex fpeephole2
9953 Disable any machine-specific peephole optimizations. The difference
9954 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9955 are implemented in the compiler; some targets use one, some use the
9956 other, a few use both.
9957
9958 @option{-fpeephole} is enabled by default.
9959 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9960
9961 @item -fno-guess-branch-probability
9962 @opindex fno-guess-branch-probability
9963 @opindex fguess-branch-probability
9964 Do not guess branch probabilities using heuristics.
9965
9966 GCC uses heuristics to guess branch probabilities if they are
9967 not provided by profiling feedback (@option{-fprofile-arcs}). These
9968 heuristics are based on the control flow graph. If some branch probabilities
9969 are specified by @code{__builtin_expect}, then the heuristics are
9970 used to guess branch probabilities for the rest of the control flow graph,
9971 taking the @code{__builtin_expect} info into account. The interactions
9972 between the heuristics and @code{__builtin_expect} can be complex, and in
9973 some cases, it may be useful to disable the heuristics so that the effects
9974 of @code{__builtin_expect} are easier to understand.
9975
9976 It is also possible to specify expected probability of the expression
9977 with @code{__builtin_expect_with_probability} built-in function.
9978
9979 The default is @option{-fguess-branch-probability} at levels
9980 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9981
9982 @item -freorder-blocks
9983 @opindex freorder-blocks
9984 Reorder basic blocks in the compiled function in order to reduce number of
9985 taken branches and improve code locality.
9986
9987 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9988
9989 @item -freorder-blocks-algorithm=@var{algorithm}
9990 @opindex freorder-blocks-algorithm
9991 Use the specified algorithm for basic block reordering. The
9992 @var{algorithm} argument can be @samp{simple}, which does not increase
9993 code size (except sometimes due to secondary effects like alignment),
9994 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9995 put all often executed code together, minimizing the number of branches
9996 executed by making extra copies of code.
9997
9998 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9999 @samp{stc} at levels @option{-O2}, @option{-O3}.
10000
10001 @item -freorder-blocks-and-partition
10002 @opindex freorder-blocks-and-partition
10003 In addition to reordering basic blocks in the compiled function, in order
10004 to reduce number of taken branches, partitions hot and cold basic blocks
10005 into separate sections of the assembly and @file{.o} files, to improve
10006 paging and cache locality performance.
10007
10008 This optimization is automatically turned off in the presence of
10009 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10010 section attribute and on any architecture that does not support named
10011 sections. When @option{-fsplit-stack} is used this option is not
10012 enabled by default (to avoid linker errors), but may be enabled
10013 explicitly (if using a working linker).
10014
10015 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10016
10017 @item -freorder-functions
10018 @opindex freorder-functions
10019 Reorder functions in the object file in order to
10020 improve code locality. This is implemented by using special
10021 subsections @code{.text.hot} for most frequently executed functions and
10022 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10023 the linker so object file format must support named sections and linker must
10024 place them in a reasonable way.
10025
10026 This option isn't effective unless you either provide profile feedback
10027 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10028 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10029
10030 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10031
10032 @item -fstrict-aliasing
10033 @opindex fstrict-aliasing
10034 Allow the compiler to assume the strictest aliasing rules applicable to
10035 the language being compiled. For C (and C++), this activates
10036 optimizations based on the type of expressions. In particular, an
10037 object of one type is assumed never to reside at the same address as an
10038 object of a different type, unless the types are almost the same. For
10039 example, an @code{unsigned int} can alias an @code{int}, but not a
10040 @code{void*} or a @code{double}. A character type may alias any other
10041 type.
10042
10043 @anchor{Type-punning}Pay special attention to code like this:
10044 @smallexample
10045 union a_union @{
10046 int i;
10047 double d;
10048 @};
10049
10050 int f() @{
10051 union a_union t;
10052 t.d = 3.0;
10053 return t.i;
10054 @}
10055 @end smallexample
10056 The practice of reading from a different union member than the one most
10057 recently written to (called ``type-punning'') is common. Even with
10058 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10059 is accessed through the union type. So, the code above works as
10060 expected. @xref{Structures unions enumerations and bit-fields
10061 implementation}. However, this code might not:
10062 @smallexample
10063 int f() @{
10064 union a_union t;
10065 int* ip;
10066 t.d = 3.0;
10067 ip = &t.i;
10068 return *ip;
10069 @}
10070 @end smallexample
10071
10072 Similarly, access by taking the address, casting the resulting pointer
10073 and dereferencing the result has undefined behavior, even if the cast
10074 uses a union type, e.g.:
10075 @smallexample
10076 int f() @{
10077 double d = 3.0;
10078 return ((union a_union *) &d)->i;
10079 @}
10080 @end smallexample
10081
10082 The @option{-fstrict-aliasing} option is enabled at levels
10083 @option{-O2}, @option{-O3}, @option{-Os}.
10084
10085 @item -falign-functions
10086 @itemx -falign-functions=@var{n}
10087 @itemx -falign-functions=@var{n}:@var{m}
10088 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10089 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10090 @opindex falign-functions
10091 Align the start of functions to the next power-of-two greater than
10092 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10093 the first @var{m} bytes of the function can be fetched by the CPU
10094 without crossing an @var{n}-byte alignment boundary.
10095
10096 If @var{m} is not specified, it defaults to @var{n}.
10097
10098 Examples: @option{-falign-functions=32} aligns functions to the next
10099 32-byte boundary, @option{-falign-functions=24} aligns to the next
10100 32-byte boundary only if this can be done by skipping 23 bytes or less,
10101 @option{-falign-functions=32:7} aligns to the next
10102 32-byte boundary only if this can be done by skipping 6 bytes or less.
10103
10104 The second pair of @var{n2}:@var{m2} values allows you to specify
10105 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10106 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10107 otherwise aligns to the next 32-byte boundary if this can be done
10108 by skipping 2 bytes or less.
10109 If @var{m2} is not specified, it defaults to @var{n2}.
10110
10111 Some assemblers only support this flag when @var{n} is a power of two;
10112 in that case, it is rounded up.
10113
10114 @option{-fno-align-functions} and @option{-falign-functions=1} are
10115 equivalent and mean that functions are not aligned.
10116
10117 If @var{n} is not specified or is zero, use a machine-dependent default.
10118 The maximum allowed @var{n} option value is 65536.
10119
10120 Enabled at levels @option{-O2}, @option{-O3}.
10121
10122 @item -flimit-function-alignment
10123 If this option is enabled, the compiler tries to avoid unnecessarily
10124 overaligning functions. It attempts to instruct the assembler to align
10125 by the amount specified by @option{-falign-functions}, but not to
10126 skip more bytes than the size of the function.
10127
10128 @item -falign-labels
10129 @itemx -falign-labels=@var{n}
10130 @itemx -falign-labels=@var{n}:@var{m}
10131 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10132 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10133 @opindex falign-labels
10134 Align all branch targets to a power-of-two boundary.
10135
10136 Parameters of this option are analogous to the @option{-falign-functions} option.
10137 @option{-fno-align-labels} and @option{-falign-labels=1} are
10138 equivalent and mean that labels are not aligned.
10139
10140 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10141 are greater than this value, then their values are used instead.
10142
10143 If @var{n} is not specified or is zero, use a machine-dependent default
10144 which is very likely to be @samp{1}, meaning no alignment.
10145 The maximum allowed @var{n} option value is 65536.
10146
10147 Enabled at levels @option{-O2}, @option{-O3}.
10148
10149 @item -falign-loops
10150 @itemx -falign-loops=@var{n}
10151 @itemx -falign-loops=@var{n}:@var{m}
10152 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10153 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10154 @opindex falign-loops
10155 Align loops to a power-of-two boundary. If the loops are executed
10156 many times, this makes up for any execution of the dummy padding
10157 instructions.
10158
10159 Parameters of this option are analogous to the @option{-falign-functions} option.
10160 @option{-fno-align-loops} and @option{-falign-loops=1} are
10161 equivalent and mean that loops are not aligned.
10162 The maximum allowed @var{n} option value is 65536.
10163
10164 If @var{n} is not specified or is zero, use a machine-dependent default.
10165
10166 Enabled at levels @option{-O2}, @option{-O3}.
10167
10168 @item -falign-jumps
10169 @itemx -falign-jumps=@var{n}
10170 @itemx -falign-jumps=@var{n}:@var{m}
10171 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10172 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10173 @opindex falign-jumps
10174 Align branch targets to a power-of-two boundary, for branch targets
10175 where the targets can only be reached by jumping. In this case,
10176 no dummy operations need be executed.
10177
10178 Parameters of this option are analogous to the @option{-falign-functions} option.
10179 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10180 equivalent and mean that loops are not aligned.
10181
10182 If @var{n} is not specified or is zero, use a machine-dependent default.
10183 The maximum allowed @var{n} option value is 65536.
10184
10185 Enabled at levels @option{-O2}, @option{-O3}.
10186
10187 @item -funit-at-a-time
10188 @opindex funit-at-a-time
10189 This option is left for compatibility reasons. @option{-funit-at-a-time}
10190 has no effect, while @option{-fno-unit-at-a-time} implies
10191 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10192
10193 Enabled by default.
10194
10195 @item -fno-toplevel-reorder
10196 @opindex fno-toplevel-reorder
10197 @opindex ftoplevel-reorder
10198 Do not reorder top-level functions, variables, and @code{asm}
10199 statements. Output them in the same order that they appear in the
10200 input file. When this option is used, unreferenced static variables
10201 are not removed. This option is intended to support existing code
10202 that relies on a particular ordering. For new code, it is better to
10203 use attributes when possible.
10204
10205 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10206 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10207 Additionally @option{-fno-toplevel-reorder} implies
10208 @option{-fno-section-anchors}.
10209
10210 @item -fweb
10211 @opindex fweb
10212 Constructs webs as commonly used for register allocation purposes and assign
10213 each web individual pseudo register. This allows the register allocation pass
10214 to operate on pseudos directly, but also strengthens several other optimization
10215 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10216 however, make debugging impossible, since variables no longer stay in a
10217 ``home register''.
10218
10219 Enabled by default with @option{-funroll-loops}.
10220
10221 @item -fwhole-program
10222 @opindex fwhole-program
10223 Assume that the current compilation unit represents the whole program being
10224 compiled. All public functions and variables with the exception of @code{main}
10225 and those merged by attribute @code{externally_visible} become static functions
10226 and in effect are optimized more aggressively by interprocedural optimizers.
10227
10228 This option should not be used in combination with @option{-flto}.
10229 Instead relying on a linker plugin should provide safer and more precise
10230 information.
10231
10232 @item -flto[=@var{n}]
10233 @opindex flto
10234 This option runs the standard link-time optimizer. When invoked
10235 with source code, it generates GIMPLE (one of GCC's internal
10236 representations) and writes it to special ELF sections in the object
10237 file. When the object files are linked together, all the function
10238 bodies are read from these ELF sections and instantiated as if they
10239 had been part of the same translation unit.
10240
10241 To use the link-time optimizer, @option{-flto} and optimization
10242 options should be specified at compile time and during the final link.
10243 It is recommended that you compile all the files participating in the
10244 same link with the same options and also specify those options at
10245 link time.
10246 For example:
10247
10248 @smallexample
10249 gcc -c -O2 -flto foo.c
10250 gcc -c -O2 -flto bar.c
10251 gcc -o myprog -flto -O2 foo.o bar.o
10252 @end smallexample
10253
10254 The first two invocations to GCC save a bytecode representation
10255 of GIMPLE into special ELF sections inside @file{foo.o} and
10256 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10257 @file{foo.o} and @file{bar.o}, merges the two files into a single
10258 internal image, and compiles the result as usual. Since both
10259 @file{foo.o} and @file{bar.o} are merged into a single image, this
10260 causes all the interprocedural analyses and optimizations in GCC to
10261 work across the two files as if they were a single one. This means,
10262 for example, that the inliner is able to inline functions in
10263 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10264
10265 Another (simpler) way to enable link-time optimization is:
10266
10267 @smallexample
10268 gcc -o myprog -flto -O2 foo.c bar.c
10269 @end smallexample
10270
10271 The above generates bytecode for @file{foo.c} and @file{bar.c},
10272 merges them together into a single GIMPLE representation and optimizes
10273 them as usual to produce @file{myprog}.
10274
10275 The important thing to keep in mind is that to enable link-time
10276 optimizations you need to use the GCC driver to perform the link step.
10277 GCC automatically performs link-time optimization if any of the
10278 objects involved were compiled with the @option{-flto} command-line option.
10279 You can always override
10280 the automatic decision to do link-time optimization
10281 by passing @option{-fno-lto} to the link command.
10282
10283 To make whole program optimization effective, it is necessary to make
10284 certain whole program assumptions. The compiler needs to know
10285 what functions and variables can be accessed by libraries and runtime
10286 outside of the link-time optimized unit. When supported by the linker,
10287 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10288 to the compiler about used and externally visible symbols. When
10289 the linker plugin is not available, @option{-fwhole-program} should be
10290 used to allow the compiler to make these assumptions, which leads
10291 to more aggressive optimization decisions.
10292
10293 When a file is compiled with @option{-flto} without
10294 @option{-fuse-linker-plugin}, the generated object file is larger than
10295 a regular object file because it contains GIMPLE bytecodes and the usual
10296 final code (see @option{-ffat-lto-objects}. This means that
10297 object files with LTO information can be linked as normal object
10298 files; if @option{-fno-lto} is passed to the linker, no
10299 interprocedural optimizations are applied. Note that when
10300 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10301 but you cannot perform a regular, non-LTO link on them.
10302
10303 When producing the final binary, GCC only
10304 applies link-time optimizations to those files that contain bytecode.
10305 Therefore, you can mix and match object files and libraries with
10306 GIMPLE bytecodes and final object code. GCC automatically selects
10307 which files to optimize in LTO mode and which files to link without
10308 further processing.
10309
10310 Generally, options specified at link time override those
10311 specified at compile time, although in some cases GCC attempts to infer
10312 link-time options from the settings used to compile the input files.
10313
10314 If you do not specify an optimization level option @option{-O} at
10315 link time, then GCC uses the highest optimization level
10316 used when compiling the object files. Note that it is generally
10317 ineffective to specify an optimization level option only at link time and
10318 not at compile time, for two reasons. First, compiling without
10319 optimization suppresses compiler passes that gather information
10320 needed for effective optimization at link time. Second, some early
10321 optimization passes can be performed only at compile time and
10322 not at link time.
10323
10324 There are some code generation flags preserved by GCC when
10325 generating bytecodes, as they need to be used during the final link.
10326 Currently, the following options and their settings are taken from
10327 the first object file that explicitly specifies them:
10328 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10329 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10330 and all the @option{-m} target flags.
10331
10332 Certain ABI-changing flags are required to match in all compilation units,
10333 and trying to override this at link time with a conflicting value
10334 is ignored. This includes options such as @option{-freg-struct-return}
10335 and @option{-fpcc-struct-return}.
10336
10337 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10338 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10339 are passed through to the link stage and merged conservatively for
10340 conflicting translation units. Specifically
10341 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10342 precedence; and for example @option{-ffp-contract=off} takes precedence
10343 over @option{-ffp-contract=fast}. You can override them at link time.
10344
10345 To enable debug info generation you need to supply @option{-g} at
10346 compile-time. If any of the input files at link time were built
10347 with debug info generation enabled the link will enable debug info
10348 generation as well. Any elaborate debug info settings
10349 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
10350 at the linker command line and mixing different settings in different
10351 translation units is discouraged.
10352
10353 If LTO encounters objects with C linkage declared with incompatible
10354 types in separate translation units to be linked together (undefined
10355 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10356 issued. The behavior is still undefined at run time. Similar
10357 diagnostics may be raised for other languages.
10358
10359 Another feature of LTO is that it is possible to apply interprocedural
10360 optimizations on files written in different languages:
10361
10362 @smallexample
10363 gcc -c -flto foo.c
10364 g++ -c -flto bar.cc
10365 gfortran -c -flto baz.f90
10366 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10367 @end smallexample
10368
10369 Notice that the final link is done with @command{g++} to get the C++
10370 runtime libraries and @option{-lgfortran} is added to get the Fortran
10371 runtime libraries. In general, when mixing languages in LTO mode, you
10372 should use the same link command options as when mixing languages in a
10373 regular (non-LTO) compilation.
10374
10375 If object files containing GIMPLE bytecode are stored in a library archive, say
10376 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10377 are using a linker with plugin support. To create static libraries suitable
10378 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10379 and @command{ranlib};
10380 to show the symbols of object files with GIMPLE bytecode, use
10381 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10382 and @command{nm} have been compiled with plugin support. At link time, use the
10383 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10384 the LTO optimization process:
10385
10386 @smallexample
10387 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10388 @end smallexample
10389
10390 With the linker plugin enabled, the linker extracts the needed
10391 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10392 to make them part of the aggregated GIMPLE image to be optimized.
10393
10394 If you are not using a linker with plugin support and/or do not
10395 enable the linker plugin, then the objects inside @file{libfoo.a}
10396 are extracted and linked as usual, but they do not participate
10397 in the LTO optimization process. In order to make a static library suitable
10398 for both LTO optimization and usual linkage, compile its object files with
10399 @option{-flto} @option{-ffat-lto-objects}.
10400
10401 Link-time optimizations do not require the presence of the whole program to
10402 operate. If the program does not require any symbols to be exported, it is
10403 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10404 the interprocedural optimizers to use more aggressive assumptions which may
10405 lead to improved optimization opportunities.
10406 Use of @option{-fwhole-program} is not needed when linker plugin is
10407 active (see @option{-fuse-linker-plugin}).
10408
10409 The current implementation of LTO makes no
10410 attempt to generate bytecode that is portable between different
10411 types of hosts. The bytecode files are versioned and there is a
10412 strict version check, so bytecode files generated in one version of
10413 GCC do not work with an older or newer version of GCC.
10414
10415 Link-time optimization does not work well with generation of debugging
10416 information on systems other than those using a combination of ELF and
10417 DWARF.
10418
10419 If you specify the optional @var{n}, the optimization and code
10420 generation done at link time is executed in parallel using @var{n}
10421 parallel jobs by utilizing an installed @command{make} program. The
10422 environment variable @env{MAKE} may be used to override the program
10423 used.
10424
10425 You can also specify @option{-flto=jobserver} to use GNU make's
10426 job server mode to determine the number of parallel jobs. This
10427 is useful when the Makefile calling GCC is already executing in parallel.
10428 You must prepend a @samp{+} to the command recipe in the parent Makefile
10429 for this to work. This option likely only works if @env{MAKE} is
10430 GNU make. Even without the option value, GCC tries to automatically
10431 detect a running GNU make's job server.
10432
10433 Use @option{-flto=auto} to use GNU make's job server, if available,
10434 or otherwise fall back to autodetection of the number of CPU threads
10435 present in your system.
10436
10437 @item -flto-partition=@var{alg}
10438 @opindex flto-partition
10439 Specify the partitioning algorithm used by the link-time optimizer.
10440 The value is either @samp{1to1} to specify a partitioning mirroring
10441 the original source files or @samp{balanced} to specify partitioning
10442 into equally sized chunks (whenever possible) or @samp{max} to create
10443 new partition for every symbol where possible. Specifying @samp{none}
10444 as an algorithm disables partitioning and streaming completely.
10445 The default value is @samp{balanced}. While @samp{1to1} can be used
10446 as an workaround for various code ordering issues, the @samp{max}
10447 partitioning is intended for internal testing only.
10448 The value @samp{one} specifies that exactly one partition should be
10449 used while the value @samp{none} bypasses partitioning and executes
10450 the link-time optimization step directly from the WPA phase.
10451
10452 @item -flto-compression-level=@var{n}
10453 @opindex flto-compression-level
10454 This option specifies the level of compression used for intermediate
10455 language written to LTO object files, and is only meaningful in
10456 conjunction with LTO mode (@option{-flto}). Valid
10457 values are 0 (no compression) to 9 (maximum compression). Values
10458 outside this range are clamped to either 0 or 9. If the option is not
10459 given, a default balanced compression setting is used.
10460
10461 @item -fuse-linker-plugin
10462 @opindex fuse-linker-plugin
10463 Enables the use of a linker plugin during link-time optimization. This
10464 option relies on plugin support in the linker, which is available in gold
10465 or in GNU ld 2.21 or newer.
10466
10467 This option enables the extraction of object files with GIMPLE bytecode out
10468 of library archives. This improves the quality of optimization by exposing
10469 more code to the link-time optimizer. This information specifies what
10470 symbols can be accessed externally (by non-LTO object or during dynamic
10471 linking). Resulting code quality improvements on binaries (and shared
10472 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10473 See @option{-flto} for a description of the effect of this flag and how to
10474 use it.
10475
10476 This option is enabled by default when LTO support in GCC is enabled
10477 and GCC was configured for use with
10478 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10479
10480 @item -ffat-lto-objects
10481 @opindex ffat-lto-objects
10482 Fat LTO objects are object files that contain both the intermediate language
10483 and the object code. This makes them usable for both LTO linking and normal
10484 linking. This option is effective only when compiling with @option{-flto}
10485 and is ignored at link time.
10486
10487 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10488 requires the complete toolchain to be aware of LTO. It requires a linker with
10489 linker plugin support for basic functionality. Additionally,
10490 @command{nm}, @command{ar} and @command{ranlib}
10491 need to support linker plugins to allow a full-featured build environment
10492 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10493 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10494 to these tools. With non fat LTO makefiles need to be modified to use them.
10495
10496 Note that modern binutils provide plugin auto-load mechanism.
10497 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10498 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10499 @command{gcc-ranlib}).
10500
10501 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10502 support.
10503
10504 @item -fcompare-elim
10505 @opindex fcompare-elim
10506 After register allocation and post-register allocation instruction splitting,
10507 identify arithmetic instructions that compute processor flags similar to a
10508 comparison operation based on that arithmetic. If possible, eliminate the
10509 explicit comparison operation.
10510
10511 This pass only applies to certain targets that cannot explicitly represent
10512 the comparison operation before register allocation is complete.
10513
10514 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10515
10516 @item -fcprop-registers
10517 @opindex fcprop-registers
10518 After register allocation and post-register allocation instruction splitting,
10519 perform a copy-propagation pass to try to reduce scheduling dependencies
10520 and occasionally eliminate the copy.
10521
10522 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10523
10524 @item -fprofile-correction
10525 @opindex fprofile-correction
10526 Profiles collected using an instrumented binary for multi-threaded programs may
10527 be inconsistent due to missed counter updates. When this option is specified,
10528 GCC uses heuristics to correct or smooth out such inconsistencies. By
10529 default, GCC emits an error message when an inconsistent profile is detected.
10530
10531 This option is enabled by @option{-fauto-profile}.
10532
10533 @item -fprofile-use
10534 @itemx -fprofile-use=@var{path}
10535 @opindex fprofile-use
10536 Enable profile feedback-directed optimizations,
10537 and the following optimizations, many of which
10538 are generally profitable only with profile feedback available:
10539
10540 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10541 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10542 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10543 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10544 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10545 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10546 -fprofile-reorder-functions}
10547
10548 Before you can use this option, you must first generate profiling information.
10549 @xref{Instrumentation Options}, for information about the
10550 @option{-fprofile-generate} option.
10551
10552 By default, GCC emits an error message if the feedback profiles do not
10553 match the source code. This error can be turned into a warning by using
10554 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10555 optimized code. Additionally, by default, GCC also emits a warning message if
10556 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10557
10558 If @var{path} is specified, GCC looks at the @var{path} to find
10559 the profile feedback data files. See @option{-fprofile-dir}.
10560
10561 @item -fauto-profile
10562 @itemx -fauto-profile=@var{path}
10563 @opindex fauto-profile
10564 Enable sampling-based feedback-directed optimizations,
10565 and the following optimizations,
10566 many of which are generally profitable only with profile feedback available:
10567
10568 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10569 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10570 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10571 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10572 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10573 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10574 -fprofile-correction}
10575
10576 @var{path} is the name of a file containing AutoFDO profile information.
10577 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10578
10579 Producing an AutoFDO profile data file requires running your program
10580 with the @command{perf} utility on a supported GNU/Linux target system.
10581 For more information, see @uref{https://perf.wiki.kernel.org/}.
10582
10583 E.g.
10584 @smallexample
10585 perf record -e br_inst_retired:near_taken -b -o perf.data \
10586 -- your_program
10587 @end smallexample
10588
10589 Then use the @command{create_gcov} tool to convert the raw profile data
10590 to a format that can be used by GCC.@ You must also supply the
10591 unstripped binary for your program to this tool.
10592 See @uref{https://github.com/google/autofdo}.
10593
10594 E.g.
10595 @smallexample
10596 create_gcov --binary=your_program.unstripped --profile=perf.data \
10597 --gcov=profile.afdo
10598 @end smallexample
10599 @end table
10600
10601 The following options control compiler behavior regarding floating-point
10602 arithmetic. These options trade off between speed and
10603 correctness. All must be specifically enabled.
10604
10605 @table @gcctabopt
10606 @item -ffloat-store
10607 @opindex ffloat-store
10608 Do not store floating-point variables in registers, and inhibit other
10609 options that might change whether a floating-point value is taken from a
10610 register or memory.
10611
10612 @cindex floating-point precision
10613 This option prevents undesirable excess precision on machines such as
10614 the 68000 where the floating registers (of the 68881) keep more
10615 precision than a @code{double} is supposed to have. Similarly for the
10616 x86 architecture. For most programs, the excess precision does only
10617 good, but a few programs rely on the precise definition of IEEE floating
10618 point. Use @option{-ffloat-store} for such programs, after modifying
10619 them to store all pertinent intermediate computations into variables.
10620
10621 @item -fexcess-precision=@var{style}
10622 @opindex fexcess-precision
10623 This option allows further control over excess precision on machines
10624 where floating-point operations occur in a format with more precision or
10625 range than the IEEE standard and interchange floating-point types. By
10626 default, @option{-fexcess-precision=fast} is in effect; this means that
10627 operations may be carried out in a wider precision than the types specified
10628 in the source if that would result in faster code, and it is unpredictable
10629 when rounding to the types specified in the source code takes place.
10630 When compiling C, if @option{-fexcess-precision=standard} is specified then
10631 excess precision follows the rules specified in ISO C99; in particular,
10632 both casts and assignments cause values to be rounded to their
10633 semantic types (whereas @option{-ffloat-store} only affects
10634 assignments). This option is enabled by default for C if a strict
10635 conformance option such as @option{-std=c99} is used.
10636 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10637 regardless of whether a strict conformance option is used.
10638
10639 @opindex mfpmath
10640 @option{-fexcess-precision=standard} is not implemented for languages
10641 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10642 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10643 semantics apply without excess precision, and in the latter, rounding
10644 is unpredictable.
10645
10646 @item -ffast-math
10647 @opindex ffast-math
10648 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10649 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10650 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10651 @option{-fexcess-precision=fast}.
10652
10653 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10654
10655 This option is not turned on by any @option{-O} option besides
10656 @option{-Ofast} since it can result in incorrect output for programs
10657 that depend on an exact implementation of IEEE or ISO rules/specifications
10658 for math functions. It may, however, yield faster code for programs
10659 that do not require the guarantees of these specifications.
10660
10661 @item -fno-math-errno
10662 @opindex fno-math-errno
10663 @opindex fmath-errno
10664 Do not set @code{errno} after calling math functions that are executed
10665 with a single instruction, e.g., @code{sqrt}. A program that relies on
10666 IEEE exceptions for math error handling may want to use this flag
10667 for speed while maintaining IEEE arithmetic compatibility.
10668
10669 This option is not turned on by any @option{-O} option since
10670 it can result in incorrect output for programs that depend on
10671 an exact implementation of IEEE or ISO rules/specifications for
10672 math functions. It may, however, yield faster code for programs
10673 that do not require the guarantees of these specifications.
10674
10675 The default is @option{-fmath-errno}.
10676
10677 On Darwin systems, the math library never sets @code{errno}. There is
10678 therefore no reason for the compiler to consider the possibility that
10679 it might, and @option{-fno-math-errno} is the default.
10680
10681 @item -funsafe-math-optimizations
10682 @opindex funsafe-math-optimizations
10683
10684 Allow optimizations for floating-point arithmetic that (a) assume
10685 that arguments and results are valid and (b) may violate IEEE or
10686 ANSI standards. When used at link time, it may include libraries
10687 or startup files that change the default FPU control word or other
10688 similar optimizations.
10689
10690 This option is not turned on by any @option{-O} option since
10691 it can result in incorrect output for programs that depend on
10692 an exact implementation of IEEE or ISO rules/specifications for
10693 math functions. It may, however, yield faster code for programs
10694 that do not require the guarantees of these specifications.
10695 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10696 @option{-fassociative-math} and @option{-freciprocal-math}.
10697
10698 The default is @option{-fno-unsafe-math-optimizations}.
10699
10700 @item -fassociative-math
10701 @opindex fassociative-math
10702
10703 Allow re-association of operands in series of floating-point operations.
10704 This violates the ISO C and C++ language standard by possibly changing
10705 computation result. NOTE: re-ordering may change the sign of zero as
10706 well as ignore NaNs and inhibit or create underflow or overflow (and
10707 thus cannot be used on code that relies on rounding behavior like
10708 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10709 and thus may not be used when ordered comparisons are required.
10710 This option requires that both @option{-fno-signed-zeros} and
10711 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10712 much sense with @option{-frounding-math}. For Fortran the option
10713 is automatically enabled when both @option{-fno-signed-zeros} and
10714 @option{-fno-trapping-math} are in effect.
10715
10716 The default is @option{-fno-associative-math}.
10717
10718 @item -freciprocal-math
10719 @opindex freciprocal-math
10720
10721 Allow the reciprocal of a value to be used instead of dividing by
10722 the value if this enables optimizations. For example @code{x / y}
10723 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10724 is subject to common subexpression elimination. Note that this loses
10725 precision and increases the number of flops operating on the value.
10726
10727 The default is @option{-fno-reciprocal-math}.
10728
10729 @item -ffinite-math-only
10730 @opindex ffinite-math-only
10731 Allow optimizations for floating-point arithmetic that assume
10732 that arguments and results are not NaNs or +-Infs.
10733
10734 This option is not turned on by any @option{-O} option since
10735 it can result in incorrect output for programs that depend on
10736 an exact implementation of IEEE or ISO rules/specifications for
10737 math functions. It may, however, yield faster code for programs
10738 that do not require the guarantees of these specifications.
10739
10740 The default is @option{-fno-finite-math-only}.
10741
10742 @item -fno-signed-zeros
10743 @opindex fno-signed-zeros
10744 @opindex fsigned-zeros
10745 Allow optimizations for floating-point arithmetic that ignore the
10746 signedness of zero. IEEE arithmetic specifies the behavior of
10747 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10748 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10749 This option implies that the sign of a zero result isn't significant.
10750
10751 The default is @option{-fsigned-zeros}.
10752
10753 @item -fno-trapping-math
10754 @opindex fno-trapping-math
10755 @opindex ftrapping-math
10756 Compile code assuming that floating-point operations cannot generate
10757 user-visible traps. These traps include division by zero, overflow,
10758 underflow, inexact result and invalid operation. This option requires
10759 that @option{-fno-signaling-nans} be in effect. Setting this option may
10760 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10761
10762 This option should never be turned on by any @option{-O} option since
10763 it can result in incorrect output for programs that depend on
10764 an exact implementation of IEEE or ISO rules/specifications for
10765 math functions.
10766
10767 The default is @option{-ftrapping-math}.
10768
10769 @item -frounding-math
10770 @opindex frounding-math
10771 Disable transformations and optimizations that assume default floating-point
10772 rounding behavior. This is round-to-zero for all floating point
10773 to integer conversions, and round-to-nearest for all other arithmetic
10774 truncations. This option should be specified for programs that change
10775 the FP rounding mode dynamically, or that may be executed with a
10776 non-default rounding mode. This option disables constant folding of
10777 floating-point expressions at compile time (which may be affected by
10778 rounding mode) and arithmetic transformations that are unsafe in the
10779 presence of sign-dependent rounding modes.
10780
10781 The default is @option{-fno-rounding-math}.
10782
10783 This option is experimental and does not currently guarantee to
10784 disable all GCC optimizations that are affected by rounding mode.
10785 Future versions of GCC may provide finer control of this setting
10786 using C99's @code{FENV_ACCESS} pragma. This command-line option
10787 will be used to specify the default state for @code{FENV_ACCESS}.
10788
10789 @item -fsignaling-nans
10790 @opindex fsignaling-nans
10791 Compile code assuming that IEEE signaling NaNs may generate user-visible
10792 traps during floating-point operations. Setting this option disables
10793 optimizations that may change the number of exceptions visible with
10794 signaling NaNs. This option implies @option{-ftrapping-math}.
10795
10796 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10797 be defined.
10798
10799 The default is @option{-fno-signaling-nans}.
10800
10801 This option is experimental and does not currently guarantee to
10802 disable all GCC optimizations that affect signaling NaN behavior.
10803
10804 @item -fno-fp-int-builtin-inexact
10805 @opindex fno-fp-int-builtin-inexact
10806 @opindex ffp-int-builtin-inexact
10807 Do not allow the built-in functions @code{ceil}, @code{floor},
10808 @code{round} and @code{trunc}, and their @code{float} and @code{long
10809 double} variants, to generate code that raises the ``inexact''
10810 floating-point exception for noninteger arguments. ISO C99 and C11
10811 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10812 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
10813 ISO C2X, does not allow these functions to do so.
10814
10815 The default is @option{-ffp-int-builtin-inexact}, allowing the
10816 exception to be raised, unless C2X or a later C standard is selected.
10817 This option does nothing unless @option{-ftrapping-math} is in effect.
10818
10819 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10820 generate a call to a library function then the ``inexact'' exception
10821 may be raised if the library implementation does not follow TS 18661.
10822
10823 @item -fsingle-precision-constant
10824 @opindex fsingle-precision-constant
10825 Treat floating-point constants as single precision instead of
10826 implicitly converting them to double-precision constants.
10827
10828 @item -fcx-limited-range
10829 @opindex fcx-limited-range
10830 When enabled, this option states that a range reduction step is not
10831 needed when performing complex division. Also, there is no checking
10832 whether the result of a complex multiplication or division is @code{NaN
10833 + I*NaN}, with an attempt to rescue the situation in that case. The
10834 default is @option{-fno-cx-limited-range}, but is enabled by
10835 @option{-ffast-math}.
10836
10837 This option controls the default setting of the ISO C99
10838 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10839 all languages.
10840
10841 @item -fcx-fortran-rules
10842 @opindex fcx-fortran-rules
10843 Complex multiplication and division follow Fortran rules. Range
10844 reduction is done as part of complex division, but there is no checking
10845 whether the result of a complex multiplication or division is @code{NaN
10846 + I*NaN}, with an attempt to rescue the situation in that case.
10847
10848 The default is @option{-fno-cx-fortran-rules}.
10849
10850 @end table
10851
10852 The following options control optimizations that may improve
10853 performance, but are not enabled by any @option{-O} options. This
10854 section includes experimental options that may produce broken code.
10855
10856 @table @gcctabopt
10857 @item -fbranch-probabilities
10858 @opindex fbranch-probabilities
10859 After running a program compiled with @option{-fprofile-arcs}
10860 (@pxref{Instrumentation Options}),
10861 you can compile it a second time using
10862 @option{-fbranch-probabilities}, to improve optimizations based on
10863 the number of times each branch was taken. When a program
10864 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10865 counts to a file called @file{@var{sourcename}.gcda} for each source
10866 file. The information in this data file is very dependent on the
10867 structure of the generated code, so you must use the same source code
10868 and the same optimization options for both compilations.
10869
10870 With @option{-fbranch-probabilities}, GCC puts a
10871 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10872 These can be used to improve optimization. Currently, they are only
10873 used in one place: in @file{reorg.c}, instead of guessing which path a
10874 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10875 exactly determine which path is taken more often.
10876
10877 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10878
10879 @item -fprofile-values
10880 @opindex fprofile-values
10881 If combined with @option{-fprofile-arcs}, it adds code so that some
10882 data about values of expressions in the program is gathered.
10883
10884 With @option{-fbranch-probabilities}, it reads back the data gathered
10885 from profiling values of expressions for usage in optimizations.
10886
10887 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10888 @option{-fauto-profile}.
10889
10890 @item -fprofile-reorder-functions
10891 @opindex fprofile-reorder-functions
10892 Function reordering based on profile instrumentation collects
10893 first time of execution of a function and orders these functions
10894 in ascending order.
10895
10896 Enabled with @option{-fprofile-use}.
10897
10898 @item -fvpt
10899 @opindex fvpt
10900 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10901 to add code to gather information about values of expressions.
10902
10903 With @option{-fbranch-probabilities}, it reads back the data gathered
10904 and actually performs the optimizations based on them.
10905 Currently the optimizations include specialization of division operations
10906 using the knowledge about the value of the denominator.
10907
10908 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10909
10910 @item -frename-registers
10911 @opindex frename-registers
10912 Attempt to avoid false dependencies in scheduled code by making use
10913 of registers left over after register allocation. This optimization
10914 most benefits processors with lots of registers. Depending on the
10915 debug information format adopted by the target, however, it can
10916 make debugging impossible, since variables no longer stay in
10917 a ``home register''.
10918
10919 Enabled by default with @option{-funroll-loops}.
10920
10921 @item -fschedule-fusion
10922 @opindex fschedule-fusion
10923 Performs a target dependent pass over the instruction stream to schedule
10924 instructions of same type together because target machine can execute them
10925 more efficiently if they are adjacent to each other in the instruction flow.
10926
10927 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10928
10929 @item -ftracer
10930 @opindex ftracer
10931 Perform tail duplication to enlarge superblock size. This transformation
10932 simplifies the control flow of the function allowing other optimizations to do
10933 a better job.
10934
10935 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10936
10937 @item -funroll-loops
10938 @opindex funroll-loops
10939 Unroll loops whose number of iterations can be determined at compile time or
10940 upon entry to the loop. @option{-funroll-loops} implies
10941 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10942 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10943 a small constant number of iterations). This option makes code larger, and may
10944 or may not make it run faster.
10945
10946 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10947
10948 @item -funroll-all-loops
10949 @opindex funroll-all-loops
10950 Unroll all loops, even if their number of iterations is uncertain when
10951 the loop is entered. This usually makes programs run more slowly.
10952 @option{-funroll-all-loops} implies the same options as
10953 @option{-funroll-loops}.
10954
10955 @item -fpeel-loops
10956 @opindex fpeel-loops
10957 Peels loops for which there is enough information that they do not
10958 roll much (from profile feedback or static analysis). It also turns on
10959 complete loop peeling (i.e.@: complete removal of loops with small constant
10960 number of iterations).
10961
10962 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10963
10964 @item -fmove-loop-invariants
10965 @opindex fmove-loop-invariants
10966 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10967 at level @option{-O1} and higher, except for @option{-Og}.
10968
10969 @item -fsplit-loops
10970 @opindex fsplit-loops
10971 Split a loop into two if it contains a condition that's always true
10972 for one side of the iteration space and false for the other.
10973
10974 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10975
10976 @item -funswitch-loops
10977 @opindex funswitch-loops
10978 Move branches with loop invariant conditions out of the loop, with duplicates
10979 of the loop on both branches (modified according to result of the condition).
10980
10981 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10982
10983 @item -fversion-loops-for-strides
10984 @opindex fversion-loops-for-strides
10985 If a loop iterates over an array with a variable stride, create another
10986 version of the loop that assumes the stride is always one. For example:
10987
10988 @smallexample
10989 for (int i = 0; i < n; ++i)
10990 x[i * stride] = @dots{};
10991 @end smallexample
10992
10993 becomes:
10994
10995 @smallexample
10996 if (stride == 1)
10997 for (int i = 0; i < n; ++i)
10998 x[i] = @dots{};
10999 else
11000 for (int i = 0; i < n; ++i)
11001 x[i * stride] = @dots{};
11002 @end smallexample
11003
11004 This is particularly useful for assumed-shape arrays in Fortran where
11005 (for example) it allows better vectorization assuming contiguous accesses.
11006 This flag is enabled by default at @option{-O3}.
11007 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11008
11009 @item -ffunction-sections
11010 @itemx -fdata-sections
11011 @opindex ffunction-sections
11012 @opindex fdata-sections
11013 Place each function or data item into its own section in the output
11014 file if the target supports arbitrary sections. The name of the
11015 function or the name of the data item determines the section's name
11016 in the output file.
11017
11018 Use these options on systems where the linker can perform optimizations to
11019 improve locality of reference in the instruction space. Most systems using the
11020 ELF object format have linkers with such optimizations. On AIX, the linker
11021 rearranges sections (CSECTs) based on the call graph. The performance impact
11022 varies.
11023
11024 Together with a linker garbage collection (linker @option{--gc-sections}
11025 option) these options may lead to smaller statically-linked executables (after
11026 stripping).
11027
11028 On ELF/DWARF systems these options do not degenerate the quality of the debug
11029 information. There could be issues with other object files/debug info formats.
11030
11031 Only use these options when there are significant benefits from doing so. When
11032 you specify these options, the assembler and linker create larger object and
11033 executable files and are also slower. These options affect code generation.
11034 They prevent optimizations by the compiler and assembler using relative
11035 locations inside a translation unit since the locations are unknown until
11036 link time. An example of such an optimization is relaxing calls to short call
11037 instructions.
11038
11039 @item -fstdarg-opt
11040 @opindex fstdarg-opt
11041 Optimize the prologue of variadic argument functions with respect to usage of
11042 those arguments.
11043
11044 @item -fsection-anchors
11045 @opindex fsection-anchors
11046 Try to reduce the number of symbolic address calculations by using
11047 shared ``anchor'' symbols to address nearby objects. This transformation
11048 can help to reduce the number of GOT entries and GOT accesses on some
11049 targets.
11050
11051 For example, the implementation of the following function @code{foo}:
11052
11053 @smallexample
11054 static int a, b, c;
11055 int foo (void) @{ return a + b + c; @}
11056 @end smallexample
11057
11058 @noindent
11059 usually calculates the addresses of all three variables, but if you
11060 compile it with @option{-fsection-anchors}, it accesses the variables
11061 from a common anchor point instead. The effect is similar to the
11062 following pseudocode (which isn't valid C):
11063
11064 @smallexample
11065 int foo (void)
11066 @{
11067 register int *xr = &x;
11068 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11069 @}
11070 @end smallexample
11071
11072 Not all targets support this option.
11073
11074 @item --param @var{name}=@var{value}
11075 @opindex param
11076 In some places, GCC uses various constants to control the amount of
11077 optimization that is done. For example, GCC does not inline functions
11078 that contain more than a certain number of instructions. You can
11079 control some of these constants on the command line using the
11080 @option{--param} option.
11081
11082 The names of specific parameters, and the meaning of the values, are
11083 tied to the internals of the compiler, and are subject to change
11084 without notice in future releases.
11085
11086 In order to get minimal, maximal and default value of a parameter,
11087 one can use @option{--help=param -Q} options.
11088
11089 In each case, the @var{value} is an integer. The allowable choices for
11090 @var{name} are:
11091
11092 @table @gcctabopt
11093 @item predictable-branch-outcome
11094 When branch is predicted to be taken with probability lower than this threshold
11095 (in percent), then it is considered well predictable.
11096
11097 @item max-rtl-if-conversion-insns
11098 RTL if-conversion tries to remove conditional branches around a block and
11099 replace them with conditionally executed instructions. This parameter
11100 gives the maximum number of instructions in a block which should be
11101 considered for if-conversion. The compiler will
11102 also use other heuristics to decide whether if-conversion is likely to be
11103 profitable.
11104
11105 @item max-rtl-if-conversion-predictable-cost
11106 @itemx max-rtl-if-conversion-unpredictable-cost
11107 RTL if-conversion will try to remove conditional branches around a block
11108 and replace them with conditionally executed instructions. These parameters
11109 give the maximum permissible cost for the sequence that would be generated
11110 by if-conversion depending on whether the branch is statically determined
11111 to be predictable or not. The units for this parameter are the same as
11112 those for the GCC internal seq_cost metric. The compiler will try to
11113 provide a reasonable default for this parameter using the BRANCH_COST
11114 target macro.
11115
11116 @item max-crossjump-edges
11117 The maximum number of incoming edges to consider for cross-jumping.
11118 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11119 the number of edges incoming to each block. Increasing values mean
11120 more aggressive optimization, making the compilation time increase with
11121 probably small improvement in executable size.
11122
11123 @item min-crossjump-insns
11124 The minimum number of instructions that must be matched at the end
11125 of two blocks before cross-jumping is performed on them. This
11126 value is ignored in the case where all instructions in the block being
11127 cross-jumped from are matched.
11128
11129 @item max-grow-copy-bb-insns
11130 The maximum code size expansion factor when copying basic blocks
11131 instead of jumping. The expansion is relative to a jump instruction.
11132
11133 @item max-goto-duplication-insns
11134 The maximum number of instructions to duplicate to a block that jumps
11135 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11136 passes, GCC factors computed gotos early in the compilation process,
11137 and unfactors them as late as possible. Only computed jumps at the
11138 end of a basic blocks with no more than max-goto-duplication-insns are
11139 unfactored.
11140
11141 @item max-delay-slot-insn-search
11142 The maximum number of instructions to consider when looking for an
11143 instruction to fill a delay slot. If more than this arbitrary number of
11144 instructions are searched, the time savings from filling the delay slot
11145 are minimal, so stop searching. Increasing values mean more
11146 aggressive optimization, making the compilation time increase with probably
11147 small improvement in execution time.
11148
11149 @item max-delay-slot-live-search
11150 When trying to fill delay slots, the maximum number of instructions to
11151 consider when searching for a block with valid live register
11152 information. Increasing this arbitrarily chosen value means more
11153 aggressive optimization, increasing the compilation time. This parameter
11154 should be removed when the delay slot code is rewritten to maintain the
11155 control-flow graph.
11156
11157 @item max-gcse-memory
11158 The approximate maximum amount of memory that can be allocated in
11159 order to perform the global common subexpression elimination
11160 optimization. If more memory than specified is required, the
11161 optimization is not done.
11162
11163 @item max-gcse-insertion-ratio
11164 If the ratio of expression insertions to deletions is larger than this value
11165 for any expression, then RTL PRE inserts or removes the expression and thus
11166 leaves partially redundant computations in the instruction stream.
11167
11168 @item max-pending-list-length
11169 The maximum number of pending dependencies scheduling allows
11170 before flushing the current state and starting over. Large functions
11171 with few branches or calls can create excessively large lists which
11172 needlessly consume memory and resources.
11173
11174 @item max-modulo-backtrack-attempts
11175 The maximum number of backtrack attempts the scheduler should make
11176 when modulo scheduling a loop. Larger values can exponentially increase
11177 compilation time.
11178
11179 @item max-inline-insns-single
11180 @item max-inline-insns-single-O2
11181 Several parameters control the tree inliner used in GCC@. This number sets the
11182 maximum number of instructions (counted in GCC's internal representation) in a
11183 single function that the tree inliner considers for inlining. This only
11184 affects functions declared inline and methods implemented in a class
11185 declaration (C++).
11186
11187 For functions compiled with optimization levels
11188 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-single} is
11189 applied. In other cases @option{max-inline-insns-single-O2} is applied.
11190
11191
11192 @item max-inline-insns-auto
11193 @item max-inline-insns-auto-O2
11194 When you use @option{-finline-functions} (included in @option{-O3}),
11195 a lot of functions that would otherwise not be considered for inlining
11196 by the compiler are investigated. To those functions, a different
11197 (more restrictive) limit compared to functions declared inline can
11198 be applied.
11199
11200 For functions compiled with optimization levels
11201 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
11202 applied. In other cases @option{max-inline-insns-auto-O2} is applied.
11203
11204 @item max-inline-insns-small
11205 This is bound applied to calls which are considered relevant with
11206 @option{-finline-small-functions}.
11207
11208 @item max-inline-insns-size
11209 This is bound applied to calls which are optimized for size. Small growth
11210 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11211
11212 @item uninlined-function-insns
11213 Number of instructions accounted by inliner for function overhead such as
11214 function prologue and epilogue.
11215
11216 @item uninlined-function-time
11217 Extra time accounted by inliner for function overhead such as time needed to
11218 execute function prologue and epilogue
11219
11220 @item inline-heuristics-hint-percent
11221 @item inline-heuristics-hint-percent-O2
11222 The scale (in percents) applied to @option{inline-insns-single},
11223 @option{inline-insns-single-O2}, @option{inline-insns-auto},
11224 @option{inline-insns-auto-O2} when inline heuristics hints that inlining is
11225 very profitable (will enable later optimizations).
11226
11227 For functions compiled with optimization levels
11228 @option{-O3} and @option{-Ofast} parameter
11229 @option{inline-heuristics-hint-percent} is applied. In other cases
11230 @option{inline-heuristics-hint-percent-O2} is applied.
11231
11232 @item uninlined-thunk-insns
11233 @item uninlined-thunk-time
11234 Same as @option{--param uninlined-function-insns} and
11235 @option{--param uninlined-function-time} but applied to function thunks
11236
11237 @item inline-min-speedup
11238 @item inline-min-speedup-O2
11239 When estimated performance improvement of caller + callee runtime exceeds this
11240 threshold (in percent), the function can be inlined regardless of the limit on
11241 @option{--param max-inline-insns-single} and @option{--param
11242 max-inline-insns-auto}.
11243
11244 For functions compiled with optimization levels
11245 @option{-O3} and @option{-Ofast} parameter @option{inline-min-speedup} is
11246 applied. In other cases @option{inline-min-speedup-O2} is applied.
11247
11248 @item large-function-insns
11249 The limit specifying really large functions. For functions larger than this
11250 limit after inlining, inlining is constrained by
11251 @option{--param large-function-growth}. This parameter is useful primarily
11252 to avoid extreme compilation time caused by non-linear algorithms used by the
11253 back end.
11254
11255 @item large-function-growth
11256 Specifies maximal growth of large function caused by inlining in percents.
11257 For example, parameter value 100 limits large function growth to 2.0 times
11258 the original size.
11259
11260 @item large-unit-insns
11261 The limit specifying large translation unit. Growth caused by inlining of
11262 units larger than this limit is limited by @option{--param inline-unit-growth}.
11263 For small units this might be too tight.
11264 For example, consider a unit consisting of function A
11265 that is inline and B that just calls A three times. If B is small relative to
11266 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11267 large units consisting of small inlineable functions, however, the overall unit
11268 growth limit is needed to avoid exponential explosion of code size. Thus for
11269 smaller units, the size is increased to @option{--param large-unit-insns}
11270 before applying @option{--param inline-unit-growth}.
11271
11272 @item inline-unit-growth
11273 Specifies maximal overall growth of the compilation unit caused by inlining.
11274 For example, parameter value 20 limits unit growth to 1.2 times the original
11275 size. Cold functions (either marked cold via an attribute or by profile
11276 feedback) are not accounted into the unit size.
11277
11278 @item ipcp-unit-growth
11279 Specifies maximal overall growth of the compilation unit caused by
11280 interprocedural constant propagation. For example, parameter value 10 limits
11281 unit growth to 1.1 times the original size.
11282
11283 @item large-stack-frame
11284 The limit specifying large stack frames. While inlining the algorithm is trying
11285 to not grow past this limit too much.
11286
11287 @item large-stack-frame-growth
11288 Specifies maximal growth of large stack frames caused by inlining in percents.
11289 For example, parameter value 1000 limits large stack frame growth to 11 times
11290 the original size.
11291
11292 @item max-inline-insns-recursive
11293 @itemx max-inline-insns-recursive-auto
11294 Specifies the maximum number of instructions an out-of-line copy of a
11295 self-recursive inline
11296 function can grow into by performing recursive inlining.
11297
11298 @option{--param max-inline-insns-recursive} applies to functions
11299 declared inline.
11300 For functions not declared inline, recursive inlining
11301 happens only when @option{-finline-functions} (included in @option{-O3}) is
11302 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11303
11304 @item max-inline-recursive-depth
11305 @itemx max-inline-recursive-depth-auto
11306 Specifies the maximum recursion depth used for recursive inlining.
11307
11308 @option{--param max-inline-recursive-depth} applies to functions
11309 declared inline. For functions not declared inline, recursive inlining
11310 happens only when @option{-finline-functions} (included in @option{-O3}) is
11311 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11312
11313 @item min-inline-recursive-probability
11314 Recursive inlining is profitable only for function having deep recursion
11315 in average and can hurt for function having little recursion depth by
11316 increasing the prologue size or complexity of function body to other
11317 optimizers.
11318
11319 When profile feedback is available (see @option{-fprofile-generate}) the actual
11320 recursion depth can be guessed from the probability that function recurses
11321 via a given call expression. This parameter limits inlining only to call
11322 expressions whose probability exceeds the given threshold (in percents).
11323
11324 @item early-inlining-insns
11325 @item early-inlining-insns-O2
11326 Specify growth that the early inliner can make. In effect it increases
11327 the amount of inlining for code having a large abstraction penalty.
11328
11329 For functions compiled with optimization levels
11330 @option{-O3} and @option{-Ofast} parameter @option{early-inlining-insns} is
11331 applied. In other cases @option{early-inlining-insns-O2} is applied.
11332
11333 @item max-early-inliner-iterations
11334 Limit of iterations of the early inliner. This basically bounds
11335 the number of nested indirect calls the early inliner can resolve.
11336 Deeper chains are still handled by late inlining.
11337
11338 @item comdat-sharing-probability
11339 Probability (in percent) that C++ inline function with comdat visibility
11340 are shared across multiple compilation units.
11341
11342 @item profile-func-internal-id
11343 A parameter to control whether to use function internal id in profile
11344 database lookup. If the value is 0, the compiler uses an id that
11345 is based on function assembler name and filename, which makes old profile
11346 data more tolerant to source changes such as function reordering etc.
11347
11348 @item min-vect-loop-bound
11349 The minimum number of iterations under which loops are not vectorized
11350 when @option{-ftree-vectorize} is used. The number of iterations after
11351 vectorization needs to be greater than the value specified by this option
11352 to allow vectorization.
11353
11354 @item gcse-cost-distance-ratio
11355 Scaling factor in calculation of maximum distance an expression
11356 can be moved by GCSE optimizations. This is currently supported only in the
11357 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11358 is with simple expressions, i.e., the expressions that have cost
11359 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11360 hoisting of simple expressions.
11361
11362 @item gcse-unrestricted-cost
11363 Cost, roughly measured as the cost of a single typical machine
11364 instruction, at which GCSE optimizations do not constrain
11365 the distance an expression can travel. This is currently
11366 supported only in the code hoisting pass. The lesser the cost,
11367 the more aggressive code hoisting is. Specifying 0
11368 allows all expressions to travel unrestricted distances.
11369
11370 @item max-hoist-depth
11371 The depth of search in the dominator tree for expressions to hoist.
11372 This is used to avoid quadratic behavior in hoisting algorithm.
11373 The value of 0 does not limit on the search, but may slow down compilation
11374 of huge functions.
11375
11376 @item max-tail-merge-comparisons
11377 The maximum amount of similar bbs to compare a bb with. This is used to
11378 avoid quadratic behavior in tree tail merging.
11379
11380 @item max-tail-merge-iterations
11381 The maximum amount of iterations of the pass over the function. This is used to
11382 limit compilation time in tree tail merging.
11383
11384 @item store-merging-allow-unaligned
11385 Allow the store merging pass to introduce unaligned stores if it is legal to
11386 do so.
11387
11388 @item max-stores-to-merge
11389 The maximum number of stores to attempt to merge into wider stores in the store
11390 merging pass.
11391
11392 @item max-unrolled-insns
11393 The maximum number of instructions that a loop may have to be unrolled.
11394 If a loop is unrolled, this parameter also determines how many times
11395 the loop code is unrolled.
11396
11397 @item max-average-unrolled-insns
11398 The maximum number of instructions biased by probabilities of their execution
11399 that a loop may have to be unrolled. If a loop is unrolled,
11400 this parameter also determines how many times the loop code is unrolled.
11401
11402 @item max-unroll-times
11403 The maximum number of unrollings of a single loop.
11404
11405 @item max-peeled-insns
11406 The maximum number of instructions that a loop may have to be peeled.
11407 If a loop is peeled, this parameter also determines how many times
11408 the loop code is peeled.
11409
11410 @item max-peel-times
11411 The maximum number of peelings of a single loop.
11412
11413 @item max-peel-branches
11414 The maximum number of branches on the hot path through the peeled sequence.
11415
11416 @item max-completely-peeled-insns
11417 The maximum number of insns of a completely peeled loop.
11418
11419 @item max-completely-peel-times
11420 The maximum number of iterations of a loop to be suitable for complete peeling.
11421
11422 @item max-completely-peel-loop-nest-depth
11423 The maximum depth of a loop nest suitable for complete peeling.
11424
11425 @item max-unswitch-insns
11426 The maximum number of insns of an unswitched loop.
11427
11428 @item max-unswitch-level
11429 The maximum number of branches unswitched in a single loop.
11430
11431 @item lim-expensive
11432 The minimum cost of an expensive expression in the loop invariant motion.
11433
11434 @item iv-consider-all-candidates-bound
11435 Bound on number of candidates for induction variables, below which
11436 all candidates are considered for each use in induction variable
11437 optimizations. If there are more candidates than this,
11438 only the most relevant ones are considered to avoid quadratic time complexity.
11439
11440 @item iv-max-considered-uses
11441 The induction variable optimizations give up on loops that contain more
11442 induction variable uses.
11443
11444 @item iv-always-prune-cand-set-bound
11445 If the number of candidates in the set is smaller than this value,
11446 always try to remove unnecessary ivs from the set
11447 when adding a new one.
11448
11449 @item avg-loop-niter
11450 Average number of iterations of a loop.
11451
11452 @item dse-max-object-size
11453 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11454 Larger values may result in larger compilation times.
11455
11456 @item dse-max-alias-queries-per-store
11457 Maximum number of queries into the alias oracle per store.
11458 Larger values result in larger compilation times and may result in more
11459 removed dead stores.
11460
11461 @item scev-max-expr-size
11462 Bound on size of expressions used in the scalar evolutions analyzer.
11463 Large expressions slow the analyzer.
11464
11465 @item scev-max-expr-complexity
11466 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11467 Complex expressions slow the analyzer.
11468
11469 @item max-tree-if-conversion-phi-args
11470 Maximum number of arguments in a PHI supported by TREE if conversion
11471 unless the loop is marked with simd pragma.
11472
11473 @item vect-max-version-for-alignment-checks
11474 The maximum number of run-time checks that can be performed when
11475 doing loop versioning for alignment in the vectorizer.
11476
11477 @item vect-max-version-for-alias-checks
11478 The maximum number of run-time checks that can be performed when
11479 doing loop versioning for alias in the vectorizer.
11480
11481 @item vect-max-peeling-for-alignment
11482 The maximum number of loop peels to enhance access alignment
11483 for vectorizer. Value -1 means no limit.
11484
11485 @item max-iterations-to-track
11486 The maximum number of iterations of a loop the brute-force algorithm
11487 for analysis of the number of iterations of the loop tries to evaluate.
11488
11489 @item hot-bb-count-fraction
11490 The denominator n of fraction 1/n of the maximal execution count of a
11491 basic block in the entire program that a basic block needs to at least
11492 have in order to be considered hot. The default is 10000, which means
11493 that a basic block is considered hot if its execution count is greater
11494 than 1/10000 of the maximal execution count. 0 means that it is never
11495 considered hot. Used in non-LTO mode.
11496
11497 @item hot-bb-count-ws-permille
11498 The number of most executed permilles, ranging from 0 to 1000, of the
11499 profiled execution of the entire program to which the execution count
11500 of a basic block must be part of in order to be considered hot. The
11501 default is 990, which means that a basic block is considered hot if
11502 its execution count contributes to the upper 990 permilles, or 99.0%,
11503 of the profiled execution of the entire program. 0 means that it is
11504 never considered hot. Used in LTO mode.
11505
11506 @item hot-bb-frequency-fraction
11507 The denominator n of fraction 1/n of the execution frequency of the
11508 entry block of a function that a basic block of this function needs
11509 to at least have in order to be considered hot. The default is 1000,
11510 which means that a basic block is considered hot in a function if it
11511 is executed more frequently than 1/1000 of the frequency of the entry
11512 block of the function. 0 means that it is never considered hot.
11513
11514 @item unlikely-bb-count-fraction
11515 The denominator n of fraction 1/n of the number of profiled runs of
11516 the entire program below which the execution count of a basic block
11517 must be in order for the basic block to be considered unlikely executed.
11518 The default is 20, which means that a basic block is considered unlikely
11519 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11520 the program. 0 means that it is always considered unlikely executed.
11521
11522 @item max-predicted-iterations
11523 The maximum number of loop iterations we predict statically. This is useful
11524 in cases where a function contains a single loop with known bound and
11525 another loop with unknown bound.
11526 The known number of iterations is predicted correctly, while
11527 the unknown number of iterations average to roughly 10. This means that the
11528 loop without bounds appears artificially cold relative to the other one.
11529
11530 @item builtin-expect-probability
11531 Control the probability of the expression having the specified value. This
11532 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11533
11534 @item builtin-string-cmp-inline-length
11535 The maximum length of a constant string for a builtin string cmp call
11536 eligible for inlining.
11537
11538 @item align-threshold
11539
11540 Select fraction of the maximal frequency of executions of a basic block in
11541 a function to align the basic block.
11542
11543 @item align-loop-iterations
11544
11545 A loop expected to iterate at least the selected number of iterations is
11546 aligned.
11547
11548 @item tracer-dynamic-coverage
11549 @itemx tracer-dynamic-coverage-feedback
11550
11551 This value is used to limit superblock formation once the given percentage of
11552 executed instructions is covered. This limits unnecessary code size
11553 expansion.
11554
11555 The @option{tracer-dynamic-coverage-feedback} parameter
11556 is used only when profile
11557 feedback is available. The real profiles (as opposed to statically estimated
11558 ones) are much less balanced allowing the threshold to be larger value.
11559
11560 @item tracer-max-code-growth
11561 Stop tail duplication once code growth has reached given percentage. This is
11562 a rather artificial limit, as most of the duplicates are eliminated later in
11563 cross jumping, so it may be set to much higher values than is the desired code
11564 growth.
11565
11566 @item tracer-min-branch-ratio
11567
11568 Stop reverse growth when the reverse probability of best edge is less than this
11569 threshold (in percent).
11570
11571 @item tracer-min-branch-probability
11572 @itemx tracer-min-branch-probability-feedback
11573
11574 Stop forward growth if the best edge has probability lower than this
11575 threshold.
11576
11577 Similarly to @option{tracer-dynamic-coverage} two parameters are
11578 provided. @option{tracer-min-branch-probability-feedback} is used for
11579 compilation with profile feedback and @option{tracer-min-branch-probability}
11580 compilation without. The value for compilation with profile feedback
11581 needs to be more conservative (higher) in order to make tracer
11582 effective.
11583
11584 @item stack-clash-protection-guard-size
11585 Specify the size of the operating system provided stack guard as
11586 2 raised to @var{num} bytes. Higher values may reduce the
11587 number of explicit probes, but a value larger than the operating system
11588 provided guard will leave code vulnerable to stack clash style attacks.
11589
11590 @item stack-clash-protection-probe-interval
11591 Stack clash protection involves probing stack space as it is allocated. This
11592 param controls the maximum distance between probes into the stack as 2 raised
11593 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11594 larger than the operating system provided guard will leave code vulnerable to
11595 stack clash style attacks.
11596
11597 @item max-cse-path-length
11598
11599 The maximum number of basic blocks on path that CSE considers.
11600
11601 @item max-cse-insns
11602 The maximum number of instructions CSE processes before flushing.
11603
11604 @item ggc-min-expand
11605
11606 GCC uses a garbage collector to manage its own memory allocation. This
11607 parameter specifies the minimum percentage by which the garbage
11608 collector's heap should be allowed to expand between collections.
11609 Tuning this may improve compilation speed; it has no effect on code
11610 generation.
11611
11612 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11613 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11614 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11615 GCC is not able to calculate RAM on a particular platform, the lower
11616 bound of 30% is used. Setting this parameter and
11617 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11618 every opportunity. This is extremely slow, but can be useful for
11619 debugging.
11620
11621 @item ggc-min-heapsize
11622
11623 Minimum size of the garbage collector's heap before it begins bothering
11624 to collect garbage. The first collection occurs after the heap expands
11625 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11626 tuning this may improve compilation speed, and has no effect on code
11627 generation.
11628
11629 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11630 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11631 with a lower bound of 4096 (four megabytes) and an upper bound of
11632 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11633 particular platform, the lower bound is used. Setting this parameter
11634 very large effectively disables garbage collection. Setting this
11635 parameter and @option{ggc-min-expand} to zero causes a full collection
11636 to occur at every opportunity.
11637
11638 @item max-reload-search-insns
11639 The maximum number of instruction reload should look backward for equivalent
11640 register. Increasing values mean more aggressive optimization, making the
11641 compilation time increase with probably slightly better performance.
11642
11643 @item max-cselib-memory-locations
11644 The maximum number of memory locations cselib should take into account.
11645 Increasing values mean more aggressive optimization, making the compilation time
11646 increase with probably slightly better performance.
11647
11648 @item max-sched-ready-insns
11649 The maximum number of instructions ready to be issued the scheduler should
11650 consider at any given time during the first scheduling pass. Increasing
11651 values mean more thorough searches, making the compilation time increase
11652 with probably little benefit.
11653
11654 @item max-sched-region-blocks
11655 The maximum number of blocks in a region to be considered for
11656 interblock scheduling.
11657
11658 @item max-pipeline-region-blocks
11659 The maximum number of blocks in a region to be considered for
11660 pipelining in the selective scheduler.
11661
11662 @item max-sched-region-insns
11663 The maximum number of insns in a region to be considered for
11664 interblock scheduling.
11665
11666 @item max-pipeline-region-insns
11667 The maximum number of insns in a region to be considered for
11668 pipelining in the selective scheduler.
11669
11670 @item min-spec-prob
11671 The minimum probability (in percents) of reaching a source block
11672 for interblock speculative scheduling.
11673
11674 @item max-sched-extend-regions-iters
11675 The maximum number of iterations through CFG to extend regions.
11676 A value of 0 disables region extensions.
11677
11678 @item max-sched-insn-conflict-delay
11679 The maximum conflict delay for an insn to be considered for speculative motion.
11680
11681 @item sched-spec-prob-cutoff
11682 The minimal probability of speculation success (in percents), so that
11683 speculative insns are scheduled.
11684
11685 @item sched-state-edge-prob-cutoff
11686 The minimum probability an edge must have for the scheduler to save its
11687 state across it.
11688
11689 @item sched-mem-true-dep-cost
11690 Minimal distance (in CPU cycles) between store and load targeting same
11691 memory locations.
11692
11693 @item selsched-max-lookahead
11694 The maximum size of the lookahead window of selective scheduling. It is a
11695 depth of search for available instructions.
11696
11697 @item selsched-max-sched-times
11698 The maximum number of times that an instruction is scheduled during
11699 selective scheduling. This is the limit on the number of iterations
11700 through which the instruction may be pipelined.
11701
11702 @item selsched-insns-to-rename
11703 The maximum number of best instructions in the ready list that are considered
11704 for renaming in the selective scheduler.
11705
11706 @item sms-min-sc
11707 The minimum value of stage count that swing modulo scheduler
11708 generates.
11709
11710 @item max-last-value-rtl
11711 The maximum size measured as number of RTLs that can be recorded in an expression
11712 in combiner for a pseudo register as last known value of that register.
11713
11714 @item max-combine-insns
11715 The maximum number of instructions the RTL combiner tries to combine.
11716
11717 @item integer-share-limit
11718 Small integer constants can use a shared data structure, reducing the
11719 compiler's memory usage and increasing its speed. This sets the maximum
11720 value of a shared integer constant.
11721
11722 @item ssp-buffer-size
11723 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11724 protection when @option{-fstack-protection} is used.
11725
11726 @item min-size-for-stack-sharing
11727 The minimum size of variables taking part in stack slot sharing when not
11728 optimizing.
11729
11730 @item max-jump-thread-duplication-stmts
11731 Maximum number of statements allowed in a block that needs to be
11732 duplicated when threading jumps.
11733
11734 @item max-fields-for-field-sensitive
11735 Maximum number of fields in a structure treated in
11736 a field sensitive manner during pointer analysis.
11737
11738 @item prefetch-latency
11739 Estimate on average number of instructions that are executed before
11740 prefetch finishes. The distance prefetched ahead is proportional
11741 to this constant. Increasing this number may also lead to less
11742 streams being prefetched (see @option{simultaneous-prefetches}).
11743
11744 @item simultaneous-prefetches
11745 Maximum number of prefetches that can run at the same time.
11746
11747 @item l1-cache-line-size
11748 The size of cache line in L1 data cache, in bytes.
11749
11750 @item l1-cache-size
11751 The size of L1 data cache, in kilobytes.
11752
11753 @item l2-cache-size
11754 The size of L2 data cache, in kilobytes.
11755
11756 @item prefetch-dynamic-strides
11757 Whether the loop array prefetch pass should issue software prefetch hints
11758 for strides that are non-constant. In some cases this may be
11759 beneficial, though the fact the stride is non-constant may make it
11760 hard to predict when there is clear benefit to issuing these hints.
11761
11762 Set to 1 if the prefetch hints should be issued for non-constant
11763 strides. Set to 0 if prefetch hints should be issued only for strides that
11764 are known to be constant and below @option{prefetch-minimum-stride}.
11765
11766 @item prefetch-minimum-stride
11767 Minimum constant stride, in bytes, to start using prefetch hints for. If
11768 the stride is less than this threshold, prefetch hints will not be issued.
11769
11770 This setting is useful for processors that have hardware prefetchers, in
11771 which case there may be conflicts between the hardware prefetchers and
11772 the software prefetchers. If the hardware prefetchers have a maximum
11773 stride they can handle, it should be used here to improve the use of
11774 software prefetchers.
11775
11776 A value of -1 means we don't have a threshold and therefore
11777 prefetch hints can be issued for any constant stride.
11778
11779 This setting is only useful for strides that are known and constant.
11780
11781 @item loop-interchange-max-num-stmts
11782 The maximum number of stmts in a loop to be interchanged.
11783
11784 @item loop-interchange-stride-ratio
11785 The minimum ratio between stride of two loops for interchange to be profitable.
11786
11787 @item min-insn-to-prefetch-ratio
11788 The minimum ratio between the number of instructions and the
11789 number of prefetches to enable prefetching in a loop.
11790
11791 @item prefetch-min-insn-to-mem-ratio
11792 The minimum ratio between the number of instructions and the
11793 number of memory references to enable prefetching in a loop.
11794
11795 @item use-canonical-types
11796 Whether the compiler should use the ``canonical'' type system.
11797 Should always be 1, which uses a more efficient internal
11798 mechanism for comparing types in C++ and Objective-C++. However, if
11799 bugs in the canonical type system are causing compilation failures,
11800 set this value to 0 to disable canonical types.
11801
11802 @item switch-conversion-max-branch-ratio
11803 Switch initialization conversion refuses to create arrays that are
11804 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11805 branches in the switch.
11806
11807 @item max-partial-antic-length
11808 Maximum length of the partial antic set computed during the tree
11809 partial redundancy elimination optimization (@option{-ftree-pre}) when
11810 optimizing at @option{-O3} and above. For some sorts of source code
11811 the enhanced partial redundancy elimination optimization can run away,
11812 consuming all of the memory available on the host machine. This
11813 parameter sets a limit on the length of the sets that are computed,
11814 which prevents the runaway behavior. Setting a value of 0 for
11815 this parameter allows an unlimited set length.
11816
11817 @item rpo-vn-max-loop-depth
11818 Maximum loop depth that is value-numbered optimistically.
11819 When the limit hits the innermost
11820 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11821 loop nest are value-numbered optimistically and the remaining ones not.
11822
11823 @item sccvn-max-alias-queries-per-access
11824 Maximum number of alias-oracle queries we perform when looking for
11825 redundancies for loads and stores. If this limit is hit the search
11826 is aborted and the load or store is not considered redundant. The
11827 number of queries is algorithmically limited to the number of
11828 stores on all paths from the load to the function entry.
11829
11830 @item ira-max-loops-num
11831 IRA uses regional register allocation by default. If a function
11832 contains more loops than the number given by this parameter, only at most
11833 the given number of the most frequently-executed loops form regions
11834 for regional register allocation.
11835
11836 @item ira-max-conflict-table-size
11837 Although IRA uses a sophisticated algorithm to compress the conflict
11838 table, the table can still require excessive amounts of memory for
11839 huge functions. If the conflict table for a function could be more
11840 than the size in MB given by this parameter, the register allocator
11841 instead uses a faster, simpler, and lower-quality
11842 algorithm that does not require building a pseudo-register conflict table.
11843
11844 @item ira-loop-reserved-regs
11845 IRA can be used to evaluate more accurate register pressure in loops
11846 for decisions to move loop invariants (see @option{-O3}). The number
11847 of available registers reserved for some other purposes is given
11848 by this parameter. Default of the parameter
11849 is the best found from numerous experiments.
11850
11851 @item lra-inheritance-ebb-probability-cutoff
11852 LRA tries to reuse values reloaded in registers in subsequent insns.
11853 This optimization is called inheritance. EBB is used as a region to
11854 do this optimization. The parameter defines a minimal fall-through
11855 edge probability in percentage used to add BB to inheritance EBB in
11856 LRA. The default value was chosen
11857 from numerous runs of SPEC2000 on x86-64.
11858
11859 @item loop-invariant-max-bbs-in-loop
11860 Loop invariant motion can be very expensive, both in compilation time and
11861 in amount of needed compile-time memory, with very large loops. Loops
11862 with more basic blocks than this parameter won't have loop invariant
11863 motion optimization performed on them.
11864
11865 @item loop-max-datarefs-for-datadeps
11866 Building data dependencies is expensive for very large loops. This
11867 parameter limits the number of data references in loops that are
11868 considered for data dependence analysis. These large loops are no
11869 handled by the optimizations using loop data dependencies.
11870
11871 @item max-vartrack-size
11872 Sets a maximum number of hash table slots to use during variable
11873 tracking dataflow analysis of any function. If this limit is exceeded
11874 with variable tracking at assignments enabled, analysis for that
11875 function is retried without it, after removing all debug insns from
11876 the function. If the limit is exceeded even without debug insns, var
11877 tracking analysis is completely disabled for the function. Setting
11878 the parameter to zero makes it unlimited.
11879
11880 @item max-vartrack-expr-depth
11881 Sets a maximum number of recursion levels when attempting to map
11882 variable names or debug temporaries to value expressions. This trades
11883 compilation time for more complete debug information. If this is set too
11884 low, value expressions that are available and could be represented in
11885 debug information may end up not being used; setting this higher may
11886 enable the compiler to find more complex debug expressions, but compile
11887 time and memory use may grow.
11888
11889 @item max-debug-marker-count
11890 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11891 markers) to avoid complexity explosion at inlining or expanding to RTL.
11892 If a function has more such gimple stmts than the set limit, such stmts
11893 will be dropped from the inlined copy of a function, and from its RTL
11894 expansion.
11895
11896 @item min-nondebug-insn-uid
11897 Use uids starting at this parameter for nondebug insns. The range below
11898 the parameter is reserved exclusively for debug insns created by
11899 @option{-fvar-tracking-assignments}, but debug insns may get
11900 (non-overlapping) uids above it if the reserved range is exhausted.
11901
11902 @item ipa-sra-ptr-growth-factor
11903 IPA-SRA replaces a pointer to an aggregate with one or more new
11904 parameters only when their cumulative size is less or equal to
11905 @option{ipa-sra-ptr-growth-factor} times the size of the original
11906 pointer parameter.
11907
11908 @item ipa-sra-max-replacements
11909 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11910 consequence, it is also the maximum number of replacements of a formal
11911 parameter.
11912
11913 @item sra-max-scalarization-size-Ospeed
11914 @itemx sra-max-scalarization-size-Osize
11915 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11916 replace scalar parts of aggregates with uses of independent scalar
11917 variables. These parameters control the maximum size, in storage units,
11918 of aggregate which is considered for replacement when compiling for
11919 speed
11920 (@option{sra-max-scalarization-size-Ospeed}) or size
11921 (@option{sra-max-scalarization-size-Osize}) respectively.
11922
11923 @item tm-max-aggregate-size
11924 When making copies of thread-local variables in a transaction, this
11925 parameter specifies the size in bytes after which variables are
11926 saved with the logging functions as opposed to save/restore code
11927 sequence pairs. This option only applies when using
11928 @option{-fgnu-tm}.
11929
11930 @item graphite-max-nb-scop-params
11931 To avoid exponential effects in the Graphite loop transforms, the
11932 number of parameters in a Static Control Part (SCoP) is bounded.
11933 A value of zero can be used to lift
11934 the bound. A variable whose value is unknown at compilation time and
11935 defined outside a SCoP is a parameter of the SCoP.
11936
11937 @item loop-block-tile-size
11938 Loop blocking or strip mining transforms, enabled with
11939 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11940 loop in the loop nest by a given number of iterations. The strip
11941 length can be changed using the @option{loop-block-tile-size}
11942 parameter.
11943
11944 @item ipa-cp-value-list-size
11945 IPA-CP attempts to track all possible values and types passed to a function's
11946 parameter in order to propagate them and perform devirtualization.
11947 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11948 stores per one formal parameter of a function.
11949
11950 @item ipa-cp-eval-threshold
11951 IPA-CP calculates its own score of cloning profitability heuristics
11952 and performs those cloning opportunities with scores that exceed
11953 @option{ipa-cp-eval-threshold}.
11954
11955 @item ipa-cp-recursion-penalty
11956 Percentage penalty the recursive functions will receive when they
11957 are evaluated for cloning.
11958
11959 @item ipa-cp-single-call-penalty
11960 Percentage penalty functions containing a single call to another
11961 function will receive when they are evaluated for cloning.
11962
11963 @item ipa-max-agg-items
11964 IPA-CP is also capable to propagate a number of scalar values passed
11965 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11966 number of such values per one parameter.
11967
11968 @item ipa-cp-loop-hint-bonus
11969 When IPA-CP determines that a cloning candidate would make the number
11970 of iterations of a loop known, it adds a bonus of
11971 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11972 the candidate.
11973
11974 @item ipa-max-aa-steps
11975 During its analysis of function bodies, IPA-CP employs alias analysis
11976 in order to track values pointed to by function parameters. In order
11977 not spend too much time analyzing huge functions, it gives up and
11978 consider all memory clobbered after examining
11979 @option{ipa-max-aa-steps} statements modifying memory.
11980
11981 @item ipa-max-switch-predicate-bounds
11982 Maximal number of boundary endpoints of case ranges of switch statement.
11983 For switch exceeding this limit, IPA-CP will not construct cloning cost
11984 predicate, which is used to estimate cloning benefit, for default case
11985 of the switch statement.
11986
11987 @item lto-partitions
11988 Specify desired number of partitions produced during WHOPR compilation.
11989 The number of partitions should exceed the number of CPUs used for compilation.
11990
11991 @item lto-min-partition
11992 Size of minimal partition for WHOPR (in estimated instructions).
11993 This prevents expenses of splitting very small programs into too many
11994 partitions.
11995
11996 @item lto-max-partition
11997 Size of max partition for WHOPR (in estimated instructions).
11998 to provide an upper bound for individual size of partition.
11999 Meant to be used only with balanced partitioning.
12000
12001 @item lto-max-streaming-parallelism
12002 Maximal number of parallel processes used for LTO streaming.
12003
12004 @item cxx-max-namespaces-for-diagnostic-help
12005 The maximum number of namespaces to consult for suggestions when C++
12006 name lookup fails for an identifier.
12007
12008 @item sink-frequency-threshold
12009 The maximum relative execution frequency (in percents) of the target block
12010 relative to a statement's original block to allow statement sinking of a
12011 statement. Larger numbers result in more aggressive statement sinking.
12012 A small positive adjustment is applied for
12013 statements with memory operands as those are even more profitable so sink.
12014
12015 @item max-stores-to-sink
12016 The maximum number of conditional store pairs that can be sunk. Set to 0
12017 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12018 (@option{-ftree-loop-if-convert}) is disabled.
12019
12020 @item allow-store-data-races
12021 Allow optimizers to introduce new data races on stores.
12022 Set to 1 to allow, otherwise to 0.
12023
12024 @item case-values-threshold
12025 The smallest number of different values for which it is best to use a
12026 jump-table instead of a tree of conditional branches. If the value is
12027 0, use the default for the machine.
12028
12029 @item jump-table-max-growth-ratio-for-size
12030 The maximum code size growth ratio when expanding
12031 into a jump table (in percent). The parameter is used when
12032 optimizing for size.
12033
12034 @item jump-table-max-growth-ratio-for-speed
12035 The maximum code size growth ratio when expanding
12036 into a jump table (in percent). The parameter is used when
12037 optimizing for speed.
12038
12039 @item tree-reassoc-width
12040 Set the maximum number of instructions executed in parallel in
12041 reassociated tree. This parameter overrides target dependent
12042 heuristics used by default if has non zero value.
12043
12044 @item sched-pressure-algorithm
12045 Choose between the two available implementations of
12046 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12047 and is the more likely to prevent instructions from being reordered.
12048 Algorithm 2 was designed to be a compromise between the relatively
12049 conservative approach taken by algorithm 1 and the rather aggressive
12050 approach taken by the default scheduler. It relies more heavily on
12051 having a regular register file and accurate register pressure classes.
12052 See @file{haifa-sched.c} in the GCC sources for more details.
12053
12054 The default choice depends on the target.
12055
12056 @item max-slsr-cand-scan
12057 Set the maximum number of existing candidates that are considered when
12058 seeking a basis for a new straight-line strength reduction candidate.
12059
12060 @item asan-globals
12061 Enable buffer overflow detection for global objects. This kind
12062 of protection is enabled by default if you are using
12063 @option{-fsanitize=address} option.
12064 To disable global objects protection use @option{--param asan-globals=0}.
12065
12066 @item asan-stack
12067 Enable buffer overflow detection for stack objects. This kind of
12068 protection is enabled by default when using @option{-fsanitize=address}.
12069 To disable stack protection use @option{--param asan-stack=0} option.
12070
12071 @item asan-instrument-reads
12072 Enable buffer overflow detection for memory reads. This kind of
12073 protection is enabled by default when using @option{-fsanitize=address}.
12074 To disable memory reads protection use
12075 @option{--param asan-instrument-reads=0}.
12076
12077 @item asan-instrument-writes
12078 Enable buffer overflow detection for memory writes. This kind of
12079 protection is enabled by default when using @option{-fsanitize=address}.
12080 To disable memory writes protection use
12081 @option{--param asan-instrument-writes=0} option.
12082
12083 @item asan-memintrin
12084 Enable detection for built-in functions. This kind of protection
12085 is enabled by default when using @option{-fsanitize=address}.
12086 To disable built-in functions protection use
12087 @option{--param asan-memintrin=0}.
12088
12089 @item asan-use-after-return
12090 Enable detection of use-after-return. This kind of protection
12091 is enabled by default when using the @option{-fsanitize=address} option.
12092 To disable it use @option{--param asan-use-after-return=0}.
12093
12094 Note: By default the check is disabled at run time. To enable it,
12095 add @code{detect_stack_use_after_return=1} to the environment variable
12096 @env{ASAN_OPTIONS}.
12097
12098 @item asan-instrumentation-with-call-threshold
12099 If number of memory accesses in function being instrumented
12100 is greater or equal to this number, use callbacks instead of inline checks.
12101 E.g. to disable inline code use
12102 @option{--param asan-instrumentation-with-call-threshold=0}.
12103
12104 @item use-after-scope-direct-emission-threshold
12105 If the size of a local variable in bytes is smaller or equal to this
12106 number, directly poison (or unpoison) shadow memory instead of using
12107 run-time callbacks.
12108
12109 @item max-fsm-thread-path-insns
12110 Maximum number of instructions to copy when duplicating blocks on a
12111 finite state automaton jump thread path.
12112
12113 @item max-fsm-thread-length
12114 Maximum number of basic blocks on a finite state automaton jump thread
12115 path.
12116
12117 @item max-fsm-thread-paths
12118 Maximum number of new jump thread paths to create for a finite state
12119 automaton.
12120
12121 @item parloops-chunk-size
12122 Chunk size of omp schedule for loops parallelized by parloops.
12123
12124 @item parloops-schedule
12125 Schedule type of omp schedule for loops parallelized by parloops (static,
12126 dynamic, guided, auto, runtime).
12127
12128 @item parloops-min-per-thread
12129 The minimum number of iterations per thread of an innermost parallelized
12130 loop for which the parallelized variant is preferred over the single threaded
12131 one. Note that for a parallelized loop nest the
12132 minimum number of iterations of the outermost loop per thread is two.
12133
12134 @item max-ssa-name-query-depth
12135 Maximum depth of recursion when querying properties of SSA names in things
12136 like fold routines. One level of recursion corresponds to following a
12137 use-def chain.
12138
12139 @item hsa-gen-debug-stores
12140 Enable emission of special debug stores within HSA kernels which are
12141 then read and reported by libgomp plugin. Generation of these stores
12142 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12143 enable it.
12144
12145 @item max-speculative-devirt-maydefs
12146 The maximum number of may-defs we analyze when looking for a must-def
12147 specifying the dynamic type of an object that invokes a virtual call
12148 we may be able to devirtualize speculatively.
12149
12150 @item max-vrp-switch-assertions
12151 The maximum number of assertions to add along the default edge of a switch
12152 statement during VRP.
12153
12154 @item unroll-jam-min-percent
12155 The minimum percentage of memory references that must be optimized
12156 away for the unroll-and-jam transformation to be considered profitable.
12157
12158 @item unroll-jam-max-unroll
12159 The maximum number of times the outer loop should be unrolled by
12160 the unroll-and-jam transformation.
12161
12162 @item max-rtl-if-conversion-unpredictable-cost
12163 Maximum permissible cost for the sequence that would be generated
12164 by the RTL if-conversion pass for a branch that is considered unpredictable.
12165
12166 @item max-variable-expansions-in-unroller
12167 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12168 of times that an individual variable will be expanded during loop unrolling.
12169
12170 @item tracer-min-branch-probability-feedback
12171 Stop forward growth if the probability of best edge is less than
12172 this threshold (in percent). Used when profile feedback is available.
12173
12174 @item partial-inlining-entry-probability
12175 Maximum probability of the entry BB of split region
12176 (in percent relative to entry BB of the function)
12177 to make partial inlining happen.
12178
12179 @item max-tracked-strlens
12180 Maximum number of strings for which strlen optimization pass will
12181 track string lengths.
12182
12183 @item gcse-after-reload-partial-fraction
12184 The threshold ratio for performing partial redundancy
12185 elimination after reload.
12186
12187 @item gcse-after-reload-critical-fraction
12188 The threshold ratio of critical edges execution count that
12189 permit performing redundancy elimination after reload.
12190
12191 @item max-loop-header-insns
12192 The maximum number of insns in loop header duplicated
12193 by the copy loop headers pass.
12194
12195 @item vect-epilogues-nomask
12196 Enable loop epilogue vectorization using smaller vector size.
12197
12198 @item slp-max-insns-in-bb
12199 Maximum number of instructions in basic block to be
12200 considered for SLP vectorization.
12201
12202 @item avoid-fma-max-bits
12203 Maximum number of bits for which we avoid creating FMAs.
12204
12205 @item sms-loop-average-count-threshold
12206 A threshold on the average loop count considered by the swing modulo scheduler.
12207
12208 @item sms-dfa-history
12209 The number of cycles the swing modulo scheduler considers when checking
12210 conflicts using DFA.
12211
12212 @item max-inline-insns-recursive-auto
12213 The maximum number of instructions non-inline function
12214 can grow to via recursive inlining.
12215
12216 @item graphite-allow-codegen-errors
12217 Whether codegen errors should be ICEs when @option{-fchecking}.
12218
12219 @item sms-max-ii-factor
12220 A factor for tuning the upper bound that swing modulo scheduler
12221 uses for scheduling a loop.
12222
12223 @item lra-max-considered-reload-pseudos
12224 The max number of reload pseudos which are considered during
12225 spilling a non-reload pseudo.
12226
12227 @item max-pow-sqrt-depth
12228 Maximum depth of sqrt chains to use when synthesizing exponentiation
12229 by a real constant.
12230
12231 @item max-dse-active-local-stores
12232 Maximum number of active local stores in RTL dead store elimination.
12233
12234 @item asan-instrument-allocas
12235 Enable asan allocas/VLAs protection.
12236
12237 @item max-iterations-computation-cost
12238 Bound on the cost of an expression to compute the number of iterations.
12239
12240 @item max-isl-operations
12241 Maximum number of isl operations, 0 means unlimited.
12242
12243 @item graphite-max-arrays-per-scop
12244 Maximum number of arrays per scop.
12245
12246 @item max-vartrack-reverse-op-size
12247 Max. size of loc list for which reverse ops should be added.
12248
12249 @item tracer-dynamic-coverage-feedback
12250 The percentage of function, weighted by execution frequency,
12251 that must be covered by trace formation.
12252 Used when profile feedback is available.
12253
12254 @item max-inline-recursive-depth-auto
12255 The maximum depth of recursive inlining for non-inline functions.
12256
12257 @item fsm-scale-path-stmts
12258 Scale factor to apply to the number of statements in a threading path
12259 when comparing to the number of (scaled) blocks.
12260
12261 @item fsm-maximum-phi-arguments
12262 Maximum number of arguments a PHI may have before the FSM threader
12263 will not try to thread through its block.
12264
12265 @item uninit-control-dep-attempts
12266 Maximum number of nested calls to search for control dependencies
12267 during uninitialized variable analysis.
12268
12269 @item max-once-peeled-insns
12270 The maximum number of insns of a peeled loop that rolls only once.
12271
12272 @item sra-max-scalarization-size-Osize
12273 Maximum size, in storage units, of an aggregate
12274 which should be considered for scalarization when compiling for size.
12275
12276 @item fsm-scale-path-blocks
12277 Scale factor to apply to the number of blocks in a threading path
12278 when comparing to the number of (scaled) statements.
12279
12280 @item sched-autopref-queue-depth
12281 Hardware autoprefetcher scheduler model control flag.
12282 Number of lookahead cycles the model looks into; at '
12283 ' only enable instruction sorting heuristic.
12284
12285 @item loop-versioning-max-inner-insns
12286 The maximum number of instructions that an inner loop can have
12287 before the loop versioning pass considers it too big to copy.
12288
12289 @item loop-versioning-max-outer-insns
12290 The maximum number of instructions that an outer loop can have
12291 before the loop versioning pass considers it too big to copy,
12292 discounting any instructions in inner loops that directly benefit
12293 from versioning.
12294
12295 @item ssa-name-def-chain-limit
12296 The maximum number of SSA_NAME assignments to follow in determining
12297 a property of a variable such as its value. This limits the number
12298 of iterations or recursive calls GCC performs when optimizing certain
12299 statements or when determining their validity prior to issuing
12300 diagnostics.
12301
12302 @end table
12303 @end table
12304
12305 @node Instrumentation Options
12306 @section Program Instrumentation Options
12307 @cindex instrumentation options
12308 @cindex program instrumentation options
12309 @cindex run-time error checking options
12310 @cindex profiling options
12311 @cindex options, program instrumentation
12312 @cindex options, run-time error checking
12313 @cindex options, profiling
12314
12315 GCC supports a number of command-line options that control adding
12316 run-time instrumentation to the code it normally generates.
12317 For example, one purpose of instrumentation is collect profiling
12318 statistics for use in finding program hot spots, code coverage
12319 analysis, or profile-guided optimizations.
12320 Another class of program instrumentation is adding run-time checking
12321 to detect programming errors like invalid pointer
12322 dereferences or out-of-bounds array accesses, as well as deliberately
12323 hostile attacks such as stack smashing or C++ vtable hijacking.
12324 There is also a general hook which can be used to implement other
12325 forms of tracing or function-level instrumentation for debug or
12326 program analysis purposes.
12327
12328 @table @gcctabopt
12329 @cindex @command{prof}
12330 @cindex @command{gprof}
12331 @item -p
12332 @itemx -pg
12333 @opindex p
12334 @opindex pg
12335 Generate extra code to write profile information suitable for the
12336 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12337 (for @option{-pg}). You must use this option when compiling
12338 the source files you want data about, and you must also use it when
12339 linking.
12340
12341 You can use the function attribute @code{no_instrument_function} to
12342 suppress profiling of individual functions when compiling with these options.
12343 @xref{Common Function Attributes}.
12344
12345 @item -fprofile-arcs
12346 @opindex fprofile-arcs
12347 Add code so that program flow @dfn{arcs} are instrumented. During
12348 execution the program records how many times each branch and call is
12349 executed and how many times it is taken or returns. On targets that support
12350 constructors with priority support, profiling properly handles constructors,
12351 destructors and C++ constructors (and destructors) of classes which are used
12352 as a type of a global variable.
12353
12354 When the compiled
12355 program exits it saves this data to a file called
12356 @file{@var{auxname}.gcda} for each source file. The data may be used for
12357 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12358 test coverage analysis (@option{-ftest-coverage}). Each object file's
12359 @var{auxname} is generated from the name of the output file, if
12360 explicitly specified and it is not the final executable, otherwise it is
12361 the basename of the source file. In both cases any suffix is removed
12362 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12363 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12364 @xref{Cross-profiling}.
12365
12366 @cindex @command{gcov}
12367 @item --coverage
12368 @opindex coverage
12369
12370 This option is used to compile and link code instrumented for coverage
12371 analysis. The option is a synonym for @option{-fprofile-arcs}
12372 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12373 linking). See the documentation for those options for more details.
12374
12375 @itemize
12376
12377 @item
12378 Compile the source files with @option{-fprofile-arcs} plus optimization
12379 and code generation options. For test coverage analysis, use the
12380 additional @option{-ftest-coverage} option. You do not need to profile
12381 every source file in a program.
12382
12383 @item
12384 Compile the source files additionally with @option{-fprofile-abs-path}
12385 to create absolute path names in the @file{.gcno} files. This allows
12386 @command{gcov} to find the correct sources in projects where compilations
12387 occur with different working directories.
12388
12389 @item
12390 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12391 (the latter implies the former).
12392
12393 @item
12394 Run the program on a representative workload to generate the arc profile
12395 information. This may be repeated any number of times. You can run
12396 concurrent instances of your program, and provided that the file system
12397 supports locking, the data files will be correctly updated. Unless
12398 a strict ISO C dialect option is in effect, @code{fork} calls are
12399 detected and correctly handled without double counting.
12400
12401 @item
12402 For profile-directed optimizations, compile the source files again with
12403 the same optimization and code generation options plus
12404 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12405 Control Optimization}).
12406
12407 @item
12408 For test coverage analysis, use @command{gcov} to produce human readable
12409 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12410 @command{gcov} documentation for further information.
12411
12412 @end itemize
12413
12414 With @option{-fprofile-arcs}, for each function of your program GCC
12415 creates a program flow graph, then finds a spanning tree for the graph.
12416 Only arcs that are not on the spanning tree have to be instrumented: the
12417 compiler adds code to count the number of times that these arcs are
12418 executed. When an arc is the only exit or only entrance to a block, the
12419 instrumentation code can be added to the block; otherwise, a new basic
12420 block must be created to hold the instrumentation code.
12421
12422 @need 2000
12423 @item -ftest-coverage
12424 @opindex ftest-coverage
12425 Produce a notes file that the @command{gcov} code-coverage utility
12426 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12427 show program coverage. Each source file's note file is called
12428 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12429 above for a description of @var{auxname} and instructions on how to
12430 generate test coverage data. Coverage data matches the source files
12431 more closely if you do not optimize.
12432
12433 @item -fprofile-abs-path
12434 @opindex fprofile-abs-path
12435 Automatically convert relative source file names to absolute path names
12436 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12437 sources in projects where compilations occur with different working
12438 directories.
12439
12440 @item -fprofile-dir=@var{path}
12441 @opindex fprofile-dir
12442
12443 Set the directory to search for the profile data files in to @var{path}.
12444 This option affects only the profile data generated by
12445 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12446 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12447 and its related options. Both absolute and relative paths can be used.
12448 By default, GCC uses the current directory as @var{path}, thus the
12449 profile data file appears in the same directory as the object file.
12450 In order to prevent the file name clashing, if the object file name is
12451 not an absolute path, we mangle the absolute path of the
12452 @file{@var{sourcename}.gcda} file and use it as the file name of a
12453 @file{.gcda} file. See similar option @option{-fprofile-note}.
12454
12455 When an executable is run in a massive parallel environment, it is recommended
12456 to save profile to different folders. That can be done with variables
12457 in @var{path} that are exported during run-time:
12458
12459 @table @gcctabopt
12460
12461 @item %p
12462 process ID.
12463
12464 @item %q@{VAR@}
12465 value of environment variable @var{VAR}
12466
12467 @end table
12468
12469 @item -fprofile-generate
12470 @itemx -fprofile-generate=@var{path}
12471 @opindex fprofile-generate
12472
12473 Enable options usually used for instrumenting application to produce
12474 profile useful for later recompilation with profile feedback based
12475 optimization. You must use @option{-fprofile-generate} both when
12476 compiling and when linking your program.
12477
12478 The following options are enabled:
12479 @option{-fprofile-arcs}, @option{-fprofile-values},
12480 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12481
12482 If @var{path} is specified, GCC looks at the @var{path} to find
12483 the profile feedback data files. See @option{-fprofile-dir}.
12484
12485 To optimize the program based on the collected profile information, use
12486 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12487
12488 @item -fprofile-note=@var{path}
12489 @opindex fprofile-note
12490
12491 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12492 location. If you combine the option with multiple source files,
12493 the @file{.gcno} file will be overwritten.
12494
12495 @item -fprofile-update=@var{method}
12496 @opindex fprofile-update
12497
12498 Alter the update method for an application instrumented for profile
12499 feedback based optimization. The @var{method} argument should be one of
12500 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12501 The first one is useful for single-threaded applications,
12502 while the second one prevents profile corruption by emitting thread-safe code.
12503
12504 @strong{Warning:} When an application does not properly join all threads
12505 (or creates an detached thread), a profile file can be still corrupted.
12506
12507 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12508 when supported by a target, or to @samp{single} otherwise. The GCC driver
12509 automatically selects @samp{prefer-atomic} when @option{-pthread}
12510 is present in the command line.
12511
12512 @item -fprofile-filter-files=@var{regex}
12513 @opindex fprofile-filter-files
12514
12515 Instrument only functions from files where names match
12516 any regular expression (separated by a semi-colon).
12517
12518 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12519 only @file{main.c} and all C files starting with 'module'.
12520
12521 @item -fprofile-exclude-files=@var{regex}
12522 @opindex fprofile-exclude-files
12523
12524 Instrument only functions from files where names do not match
12525 all the regular expressions (separated by a semi-colon).
12526
12527 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12528 of all files that are located in @file{/usr/} folder.
12529
12530 @item -fsanitize=address
12531 @opindex fsanitize=address
12532 Enable AddressSanitizer, a fast memory error detector.
12533 Memory access instructions are instrumented to detect
12534 out-of-bounds and use-after-free bugs.
12535 The option enables @option{-fsanitize-address-use-after-scope}.
12536 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12537 more details. The run-time behavior can be influenced using the
12538 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12539 the available options are shown at startup of the instrumented program. See
12540 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12541 for a list of supported options.
12542 The option cannot be combined with @option{-fsanitize=thread}.
12543
12544 @item -fsanitize=kernel-address
12545 @opindex fsanitize=kernel-address
12546 Enable AddressSanitizer for Linux kernel.
12547 See @uref{https://github.com/google/kasan/wiki} for more details.
12548
12549 @item -fsanitize=pointer-compare
12550 @opindex fsanitize=pointer-compare
12551 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12552 The option must be combined with either @option{-fsanitize=kernel-address} or
12553 @option{-fsanitize=address}
12554 The option cannot be combined with @option{-fsanitize=thread}.
12555 Note: By default the check is disabled at run time. To enable it,
12556 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12557 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12558 invalid operation only when both pointers are non-null.
12559
12560 @item -fsanitize=pointer-subtract
12561 @opindex fsanitize=pointer-subtract
12562 Instrument subtraction with pointer operands.
12563 The option must be combined with either @option{-fsanitize=kernel-address} or
12564 @option{-fsanitize=address}
12565 The option cannot be combined with @option{-fsanitize=thread}.
12566 Note: By default the check is disabled at run time. To enable it,
12567 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12568 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12569 invalid operation only when both pointers are non-null.
12570
12571 @item -fsanitize=thread
12572 @opindex fsanitize=thread
12573 Enable ThreadSanitizer, a fast data race detector.
12574 Memory access instructions are instrumented to detect
12575 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12576 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12577 environment variable; see
12578 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12579 supported options.
12580 The option cannot be combined with @option{-fsanitize=address},
12581 @option{-fsanitize=leak}.
12582
12583 Note that sanitized atomic builtins cannot throw exceptions when
12584 operating on invalid memory addresses with non-call exceptions
12585 (@option{-fnon-call-exceptions}).
12586
12587 @item -fsanitize=leak
12588 @opindex fsanitize=leak
12589 Enable LeakSanitizer, a memory leak detector.
12590 This option only matters for linking of executables and
12591 the executable is linked against a library that overrides @code{malloc}
12592 and other allocator functions. See
12593 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12594 details. The run-time behavior can be influenced using the
12595 @env{LSAN_OPTIONS} environment variable.
12596 The option cannot be combined with @option{-fsanitize=thread}.
12597
12598 @item -fsanitize=undefined
12599 @opindex fsanitize=undefined
12600 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12601 Various computations are instrumented to detect undefined behavior
12602 at runtime. Current suboptions are:
12603
12604 @table @gcctabopt
12605
12606 @item -fsanitize=shift
12607 @opindex fsanitize=shift
12608 This option enables checking that the result of a shift operation is
12609 not undefined. Note that what exactly is considered undefined differs
12610 slightly between C and C++, as well as between ISO C90 and C99, etc.
12611 This option has two suboptions, @option{-fsanitize=shift-base} and
12612 @option{-fsanitize=shift-exponent}.
12613
12614 @item -fsanitize=shift-exponent
12615 @opindex fsanitize=shift-exponent
12616 This option enables checking that the second argument of a shift operation
12617 is not negative and is smaller than the precision of the promoted first
12618 argument.
12619
12620 @item -fsanitize=shift-base
12621 @opindex fsanitize=shift-base
12622 If the second argument of a shift operation is within range, check that the
12623 result of a shift operation is not undefined. Note that what exactly is
12624 considered undefined differs slightly between C and C++, as well as between
12625 ISO C90 and C99, etc.
12626
12627 @item -fsanitize=integer-divide-by-zero
12628 @opindex fsanitize=integer-divide-by-zero
12629 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12630
12631 @item -fsanitize=unreachable
12632 @opindex fsanitize=unreachable
12633 With this option, the compiler turns the @code{__builtin_unreachable}
12634 call into a diagnostics message call instead. When reaching the
12635 @code{__builtin_unreachable} call, the behavior is undefined.
12636
12637 @item -fsanitize=vla-bound
12638 @opindex fsanitize=vla-bound
12639 This option instructs the compiler to check that the size of a variable
12640 length array is positive.
12641
12642 @item -fsanitize=null
12643 @opindex fsanitize=null
12644 This option enables pointer checking. Particularly, the application
12645 built with this option turned on will issue an error message when it
12646 tries to dereference a NULL pointer, or if a reference (possibly an
12647 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12648 on an object pointed by a NULL pointer.
12649
12650 @item -fsanitize=return
12651 @opindex fsanitize=return
12652 This option enables return statement checking. Programs
12653 built with this option turned on will issue an error message
12654 when the end of a non-void function is reached without actually
12655 returning a value. This option works in C++ only.
12656
12657 @item -fsanitize=signed-integer-overflow
12658 @opindex fsanitize=signed-integer-overflow
12659 This option enables signed integer overflow checking. We check that
12660 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12661 does not overflow in the signed arithmetics. Note, integer promotion
12662 rules must be taken into account. That is, the following is not an
12663 overflow:
12664 @smallexample
12665 signed char a = SCHAR_MAX;
12666 a++;
12667 @end smallexample
12668
12669 @item -fsanitize=bounds
12670 @opindex fsanitize=bounds
12671 This option enables instrumentation of array bounds. Various out of bounds
12672 accesses are detected. Flexible array members, flexible array member-like
12673 arrays, and initializers of variables with static storage are not instrumented.
12674
12675 @item -fsanitize=bounds-strict
12676 @opindex fsanitize=bounds-strict
12677 This option enables strict instrumentation of array bounds. Most out of bounds
12678 accesses are detected, including flexible array members and flexible array
12679 member-like arrays. Initializers of variables with static storage are not
12680 instrumented.
12681
12682 @item -fsanitize=alignment
12683 @opindex fsanitize=alignment
12684
12685 This option enables checking of alignment of pointers when they are
12686 dereferenced, or when a reference is bound to insufficiently aligned target,
12687 or when a method or constructor is invoked on insufficiently aligned object.
12688
12689 @item -fsanitize=object-size
12690 @opindex fsanitize=object-size
12691 This option enables instrumentation of memory references using the
12692 @code{__builtin_object_size} function. Various out of bounds pointer
12693 accesses are detected.
12694
12695 @item -fsanitize=float-divide-by-zero
12696 @opindex fsanitize=float-divide-by-zero
12697 Detect floating-point division by zero. Unlike other similar options,
12698 @option{-fsanitize=float-divide-by-zero} is not enabled by
12699 @option{-fsanitize=undefined}, since floating-point division by zero can
12700 be a legitimate way of obtaining infinities and NaNs.
12701
12702 @item -fsanitize=float-cast-overflow
12703 @opindex fsanitize=float-cast-overflow
12704 This option enables floating-point type to integer conversion checking.
12705 We check that the result of the conversion does not overflow.
12706 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12707 not enabled by @option{-fsanitize=undefined}.
12708 This option does not work well with @code{FE_INVALID} exceptions enabled.
12709
12710 @item -fsanitize=nonnull-attribute
12711 @opindex fsanitize=nonnull-attribute
12712
12713 This option enables instrumentation of calls, checking whether null values
12714 are not passed to arguments marked as requiring a non-null value by the
12715 @code{nonnull} function attribute.
12716
12717 @item -fsanitize=returns-nonnull-attribute
12718 @opindex fsanitize=returns-nonnull-attribute
12719
12720 This option enables instrumentation of return statements in functions
12721 marked with @code{returns_nonnull} function attribute, to detect returning
12722 of null values from such functions.
12723
12724 @item -fsanitize=bool
12725 @opindex fsanitize=bool
12726
12727 This option enables instrumentation of loads from bool. If a value other
12728 than 0/1 is loaded, a run-time error is issued.
12729
12730 @item -fsanitize=enum
12731 @opindex fsanitize=enum
12732
12733 This option enables instrumentation of loads from an enum type. If
12734 a value outside the range of values for the enum type is loaded,
12735 a run-time error is issued.
12736
12737 @item -fsanitize=vptr
12738 @opindex fsanitize=vptr
12739
12740 This option enables instrumentation of C++ member function calls, member
12741 accesses and some conversions between pointers to base and derived classes,
12742 to verify the referenced object has the correct dynamic type.
12743
12744 @item -fsanitize=pointer-overflow
12745 @opindex fsanitize=pointer-overflow
12746
12747 This option enables instrumentation of pointer arithmetics. If the pointer
12748 arithmetics overflows, a run-time error is issued.
12749
12750 @item -fsanitize=builtin
12751 @opindex fsanitize=builtin
12752
12753 This option enables instrumentation of arguments to selected builtin
12754 functions. If an invalid value is passed to such arguments, a run-time
12755 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12756 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12757 by this option.
12758
12759 @end table
12760
12761 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12762 @option{-fsanitize=undefined} gives a diagnostic message.
12763 This currently works only for the C family of languages.
12764
12765 @item -fno-sanitize=all
12766 @opindex fno-sanitize=all
12767
12768 This option disables all previously enabled sanitizers.
12769 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12770 together.
12771
12772 @item -fasan-shadow-offset=@var{number}
12773 @opindex fasan-shadow-offset
12774 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12775 It is useful for experimenting with different shadow memory layouts in
12776 Kernel AddressSanitizer.
12777
12778 @item -fsanitize-sections=@var{s1},@var{s2},...
12779 @opindex fsanitize-sections
12780 Sanitize global variables in selected user-defined sections. @var{si} may
12781 contain wildcards.
12782
12783 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12784 @opindex fsanitize-recover
12785 @opindex fno-sanitize-recover
12786 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12787 mentioned in comma-separated list of @var{opts}. Enabling this option
12788 for a sanitizer component causes it to attempt to continue
12789 running the program as if no error happened. This means multiple
12790 runtime errors can be reported in a single program run, and the exit
12791 code of the program may indicate success even when errors
12792 have been reported. The @option{-fno-sanitize-recover=} option
12793 can be used to alter
12794 this behavior: only the first detected error is reported
12795 and program then exits with a non-zero exit code.
12796
12797 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12798 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12799 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12800 @option{-fsanitize=bounds-strict},
12801 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12802 For these sanitizers error recovery is turned on by default,
12803 except @option{-fsanitize=address}, for which this feature is experimental.
12804 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12805 accepted, the former enables recovery for all sanitizers that support it,
12806 the latter disables recovery for all sanitizers that support it.
12807
12808 Even if a recovery mode is turned on the compiler side, it needs to be also
12809 enabled on the runtime library side, otherwise the failures are still fatal.
12810 The runtime library defaults to @code{halt_on_error=0} for
12811 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12812 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12813 setting the @code{halt_on_error} flag in the corresponding environment variable.
12814
12815 Syntax without an explicit @var{opts} parameter is deprecated. It is
12816 equivalent to specifying an @var{opts} list of:
12817
12818 @smallexample
12819 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12820 @end smallexample
12821
12822 @item -fsanitize-address-use-after-scope
12823 @opindex fsanitize-address-use-after-scope
12824 Enable sanitization of local variables to detect use-after-scope bugs.
12825 The option sets @option{-fstack-reuse} to @samp{none}.
12826
12827 @item -fsanitize-undefined-trap-on-error
12828 @opindex fsanitize-undefined-trap-on-error
12829 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12830 report undefined behavior using @code{__builtin_trap} rather than
12831 a @code{libubsan} library routine. The advantage of this is that the
12832 @code{libubsan} library is not needed and is not linked in, so this
12833 is usable even in freestanding environments.
12834
12835 @item -fsanitize-coverage=trace-pc
12836 @opindex fsanitize-coverage=trace-pc
12837 Enable coverage-guided fuzzing code instrumentation.
12838 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12839
12840 @item -fsanitize-coverage=trace-cmp
12841 @opindex fsanitize-coverage=trace-cmp
12842 Enable dataflow guided fuzzing code instrumentation.
12843 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12844 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12845 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12846 variable or @code{__sanitizer_cov_trace_const_cmp1},
12847 @code{__sanitizer_cov_trace_const_cmp2},
12848 @code{__sanitizer_cov_trace_const_cmp4} or
12849 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12850 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12851 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12852 @code{__sanitizer_cov_trace_switch} for switch statements.
12853
12854 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12855 @opindex fcf-protection
12856 Enable code instrumentation of control-flow transfers to increase
12857 program security by checking that target addresses of control-flow
12858 transfer instructions (such as indirect function call, function return,
12859 indirect jump) are valid. This prevents diverting the flow of control
12860 to an unexpected target. This is intended to protect against such
12861 threats as Return-oriented Programming (ROP), and similarly
12862 call/jmp-oriented programming (COP/JOP).
12863
12864 The value @code{branch} tells the compiler to implement checking of
12865 validity of control-flow transfer at the point of indirect branch
12866 instructions, i.e.@: call/jmp instructions. The value @code{return}
12867 implements checking of validity at the point of returning from a
12868 function. The value @code{full} is an alias for specifying both
12869 @code{branch} and @code{return}. The value @code{none} turns off
12870 instrumentation.
12871
12872 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12873 used. The first bit of @code{__CET__} is set to 1 for the value
12874 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12875 the @code{return}.
12876
12877 You can also use the @code{nocf_check} attribute to identify
12878 which functions and calls should be skipped from instrumentation
12879 (@pxref{Function Attributes}).
12880
12881 Currently the x86 GNU/Linux target provides an implementation based
12882 on Intel Control-flow Enforcement Technology (CET).
12883
12884 @item -fstack-protector
12885 @opindex fstack-protector
12886 Emit extra code to check for buffer overflows, such as stack smashing
12887 attacks. This is done by adding a guard variable to functions with
12888 vulnerable objects. This includes functions that call @code{alloca}, and
12889 functions with buffers larger than 8 bytes. The guards are initialized
12890 when a function is entered and then checked when the function exits.
12891 If a guard check fails, an error message is printed and the program exits.
12892
12893 @item -fstack-protector-all
12894 @opindex fstack-protector-all
12895 Like @option{-fstack-protector} except that all functions are protected.
12896
12897 @item -fstack-protector-strong
12898 @opindex fstack-protector-strong
12899 Like @option{-fstack-protector} but includes additional functions to
12900 be protected --- those that have local array definitions, or have
12901 references to local frame addresses.
12902
12903 @item -fstack-protector-explicit
12904 @opindex fstack-protector-explicit
12905 Like @option{-fstack-protector} but only protects those functions which
12906 have the @code{stack_protect} attribute.
12907
12908 @item -fstack-check
12909 @opindex fstack-check
12910 Generate code to verify that you do not go beyond the boundary of the
12911 stack. You should specify this flag if you are running in an
12912 environment with multiple threads, but you only rarely need to specify it in
12913 a single-threaded environment since stack overflow is automatically
12914 detected on nearly all systems if there is only one stack.
12915
12916 Note that this switch does not actually cause checking to be done; the
12917 operating system or the language runtime must do that. The switch causes
12918 generation of code to ensure that they see the stack being extended.
12919
12920 You can additionally specify a string parameter: @samp{no} means no
12921 checking, @samp{generic} means force the use of old-style checking,
12922 @samp{specific} means use the best checking method and is equivalent
12923 to bare @option{-fstack-check}.
12924
12925 Old-style checking is a generic mechanism that requires no specific
12926 target support in the compiler but comes with the following drawbacks:
12927
12928 @enumerate
12929 @item
12930 Modified allocation strategy for large objects: they are always
12931 allocated dynamically if their size exceeds a fixed threshold. Note this
12932 may change the semantics of some code.
12933
12934 @item
12935 Fixed limit on the size of the static frame of functions: when it is
12936 topped by a particular function, stack checking is not reliable and
12937 a warning is issued by the compiler.
12938
12939 @item
12940 Inefficiency: because of both the modified allocation strategy and the
12941 generic implementation, code performance is hampered.
12942 @end enumerate
12943
12944 Note that old-style stack checking is also the fallback method for
12945 @samp{specific} if no target support has been added in the compiler.
12946
12947 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12948 and stack overflows. @samp{specific} is an excellent choice when compiling
12949 Ada code. It is not generally sufficient to protect against stack-clash
12950 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12951
12952 @item -fstack-clash-protection
12953 @opindex fstack-clash-protection
12954 Generate code to prevent stack clash style attacks. When this option is
12955 enabled, the compiler will only allocate one page of stack space at a time
12956 and each page is accessed immediately after allocation. Thus, it prevents
12957 allocations from jumping over any stack guard page provided by the
12958 operating system.
12959
12960 Most targets do not fully support stack clash protection. However, on
12961 those targets @option{-fstack-clash-protection} will protect dynamic stack
12962 allocations. @option{-fstack-clash-protection} may also provide limited
12963 protection for static stack allocations if the target supports
12964 @option{-fstack-check=specific}.
12965
12966 @item -fstack-limit-register=@var{reg}
12967 @itemx -fstack-limit-symbol=@var{sym}
12968 @itemx -fno-stack-limit
12969 @opindex fstack-limit-register
12970 @opindex fstack-limit-symbol
12971 @opindex fno-stack-limit
12972 Generate code to ensure that the stack does not grow beyond a certain value,
12973 either the value of a register or the address of a symbol. If a larger
12974 stack is required, a signal is raised at run time. For most targets,
12975 the signal is raised before the stack overruns the boundary, so
12976 it is possible to catch the signal without taking special precautions.
12977
12978 For instance, if the stack starts at absolute address @samp{0x80000000}
12979 and grows downwards, you can use the flags
12980 @option{-fstack-limit-symbol=__stack_limit} and
12981 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12982 of 128KB@. Note that this may only work with the GNU linker.
12983
12984 You can locally override stack limit checking by using the
12985 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12986
12987 @item -fsplit-stack
12988 @opindex fsplit-stack
12989 Generate code to automatically split the stack before it overflows.
12990 The resulting program has a discontiguous stack which can only
12991 overflow if the program is unable to allocate any more memory. This
12992 is most useful when running threaded programs, as it is no longer
12993 necessary to calculate a good stack size to use for each thread. This
12994 is currently only implemented for the x86 targets running
12995 GNU/Linux.
12996
12997 When code compiled with @option{-fsplit-stack} calls code compiled
12998 without @option{-fsplit-stack}, there may not be much stack space
12999 available for the latter code to run. If compiling all code,
13000 including library code, with @option{-fsplit-stack} is not an option,
13001 then the linker can fix up these calls so that the code compiled
13002 without @option{-fsplit-stack} always has a large stack. Support for
13003 this is implemented in the gold linker in GNU binutils release 2.21
13004 and later.
13005
13006 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13007 @opindex fvtable-verify
13008 This option is only available when compiling C++ code.
13009 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13010 feature that verifies at run time, for every virtual call, that
13011 the vtable pointer through which the call is made is valid for the type of
13012 the object, and has not been corrupted or overwritten. If an invalid vtable
13013 pointer is detected at run time, an error is reported and execution of the
13014 program is immediately halted.
13015
13016 This option causes run-time data structures to be built at program startup,
13017 which are used for verifying the vtable pointers.
13018 The options @samp{std} and @samp{preinit}
13019 control the timing of when these data structures are built. In both cases the
13020 data structures are built before execution reaches @code{main}. Using
13021 @option{-fvtable-verify=std} causes the data structures to be built after
13022 shared libraries have been loaded and initialized.
13023 @option{-fvtable-verify=preinit} causes them to be built before shared
13024 libraries have been loaded and initialized.
13025
13026 If this option appears multiple times in the command line with different
13027 values specified, @samp{none} takes highest priority over both @samp{std} and
13028 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13029
13030 @item -fvtv-debug
13031 @opindex fvtv-debug
13032 When used in conjunction with @option{-fvtable-verify=std} or
13033 @option{-fvtable-verify=preinit}, causes debug versions of the
13034 runtime functions for the vtable verification feature to be called.
13035 This flag also causes the compiler to log information about which
13036 vtable pointers it finds for each class.
13037 This information is written to a file named @file{vtv_set_ptr_data.log}
13038 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13039 if that is defined or the current working directory otherwise.
13040
13041 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13042 file, be sure to delete any existing one.
13043
13044 @item -fvtv-counts
13045 @opindex fvtv-counts
13046 This is a debugging flag. When used in conjunction with
13047 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13048 causes the compiler to keep track of the total number of virtual calls
13049 it encounters and the number of verifications it inserts. It also
13050 counts the number of calls to certain run-time library functions
13051 that it inserts and logs this information for each compilation unit.
13052 The compiler writes this information to a file named
13053 @file{vtv_count_data.log} in the directory named by the environment
13054 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13055 directory otherwise. It also counts the size of the vtable pointer sets
13056 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13057 in the same directory.
13058
13059 Note: This feature @emph{appends} data to the log files. To get fresh log
13060 files, be sure to delete any existing ones.
13061
13062 @item -finstrument-functions
13063 @opindex finstrument-functions
13064 Generate instrumentation calls for entry and exit to functions. Just
13065 after function entry and just before function exit, the following
13066 profiling functions are called with the address of the current
13067 function and its call site. (On some platforms,
13068 @code{__builtin_return_address} does not work beyond the current
13069 function, so the call site information may not be available to the
13070 profiling functions otherwise.)
13071
13072 @smallexample
13073 void __cyg_profile_func_enter (void *this_fn,
13074 void *call_site);
13075 void __cyg_profile_func_exit (void *this_fn,
13076 void *call_site);
13077 @end smallexample
13078
13079 The first argument is the address of the start of the current function,
13080 which may be looked up exactly in the symbol table.
13081
13082 This instrumentation is also done for functions expanded inline in other
13083 functions. The profiling calls indicate where, conceptually, the
13084 inline function is entered and exited. This means that addressable
13085 versions of such functions must be available. If all your uses of a
13086 function are expanded inline, this may mean an additional expansion of
13087 code size. If you use @code{extern inline} in your C code, an
13088 addressable version of such functions must be provided. (This is
13089 normally the case anyway, but if you get lucky and the optimizer always
13090 expands the functions inline, you might have gotten away without
13091 providing static copies.)
13092
13093 A function may be given the attribute @code{no_instrument_function}, in
13094 which case this instrumentation is not done. This can be used, for
13095 example, for the profiling functions listed above, high-priority
13096 interrupt routines, and any functions from which the profiling functions
13097 cannot safely be called (perhaps signal handlers, if the profiling
13098 routines generate output or allocate memory).
13099 @xref{Common Function Attributes}.
13100
13101 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13102 @opindex finstrument-functions-exclude-file-list
13103
13104 Set the list of functions that are excluded from instrumentation (see
13105 the description of @option{-finstrument-functions}). If the file that
13106 contains a function definition matches with one of @var{file}, then
13107 that function is not instrumented. The match is done on substrings:
13108 if the @var{file} parameter is a substring of the file name, it is
13109 considered to be a match.
13110
13111 For example:
13112
13113 @smallexample
13114 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13115 @end smallexample
13116
13117 @noindent
13118 excludes any inline function defined in files whose pathnames
13119 contain @file{/bits/stl} or @file{include/sys}.
13120
13121 If, for some reason, you want to include letter @samp{,} in one of
13122 @var{sym}, write @samp{\,}. For example,
13123 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13124 (note the single quote surrounding the option).
13125
13126 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13127 @opindex finstrument-functions-exclude-function-list
13128
13129 This is similar to @option{-finstrument-functions-exclude-file-list},
13130 but this option sets the list of function names to be excluded from
13131 instrumentation. The function name to be matched is its user-visible
13132 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13133 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13134 match is done on substrings: if the @var{sym} parameter is a substring
13135 of the function name, it is considered to be a match. For C99 and C++
13136 extended identifiers, the function name must be given in UTF-8, not
13137 using universal character names.
13138
13139 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13140 @opindex fpatchable-function-entry
13141 Generate @var{N} NOPs right at the beginning
13142 of each function, with the function entry point before the @var{M}th NOP.
13143 If @var{M} is omitted, it defaults to @code{0} so the
13144 function entry points to the address just at the first NOP.
13145 The NOP instructions reserve extra space which can be used to patch in
13146 any desired instrumentation at run time, provided that the code segment
13147 is writable. The amount of space is controllable indirectly via
13148 the number of NOPs; the NOP instruction used corresponds to the instruction
13149 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13150 is target-specific and may also depend on the architecture variant and/or
13151 other compilation options.
13152
13153 For run-time identification, the starting addresses of these areas,
13154 which correspond to their respective function entries minus @var{M},
13155 are additionally collected in the @code{__patchable_function_entries}
13156 section of the resulting binary.
13157
13158 Note that the value of @code{__attribute__ ((patchable_function_entry
13159 (N,M)))} takes precedence over command-line option
13160 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13161 the area size or to remove it completely on a single function.
13162 If @code{N=0}, no pad location is recorded.
13163
13164 The NOP instructions are inserted at---and maybe before, depending on
13165 @var{M}---the function entry address, even before the prologue.
13166
13167 @end table
13168
13169
13170 @node Preprocessor Options
13171 @section Options Controlling the Preprocessor
13172 @cindex preprocessor options
13173 @cindex options, preprocessor
13174
13175 These options control the C preprocessor, which is run on each C source
13176 file before actual compilation.
13177
13178 If you use the @option{-E} option, nothing is done except preprocessing.
13179 Some of these options make sense only together with @option{-E} because
13180 they cause the preprocessor output to be unsuitable for actual
13181 compilation.
13182
13183 In addition to the options listed here, there are a number of options
13184 to control search paths for include files documented in
13185 @ref{Directory Options}.
13186 Options to control preprocessor diagnostics are listed in
13187 @ref{Warning Options}.
13188
13189 @table @gcctabopt
13190 @include cppopts.texi
13191
13192 @item -Wp,@var{option}
13193 @opindex Wp
13194 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13195 and pass @var{option} directly through to the preprocessor. If
13196 @var{option} contains commas, it is split into multiple options at the
13197 commas. However, many options are modified, translated or interpreted
13198 by the compiler driver before being passed to the preprocessor, and
13199 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13200 interface is undocumented and subject to change, so whenever possible
13201 you should avoid using @option{-Wp} and let the driver handle the
13202 options instead.
13203
13204 @item -Xpreprocessor @var{option}
13205 @opindex Xpreprocessor
13206 Pass @var{option} as an option to the preprocessor. You can use this to
13207 supply system-specific preprocessor options that GCC does not
13208 recognize.
13209
13210 If you want to pass an option that takes an argument, you must use
13211 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13212
13213 @item -no-integrated-cpp
13214 @opindex no-integrated-cpp
13215 Perform preprocessing as a separate pass before compilation.
13216 By default, GCC performs preprocessing as an integrated part of
13217 input tokenization and parsing.
13218 If this option is provided, the appropriate language front end
13219 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13220 and Objective-C, respectively) is instead invoked twice,
13221 once for preprocessing only and once for actual compilation
13222 of the preprocessed input.
13223 This option may be useful in conjunction with the @option{-B} or
13224 @option{-wrapper} options to specify an alternate preprocessor or
13225 perform additional processing of the program source between
13226 normal preprocessing and compilation.
13227
13228 @end table
13229
13230 @node Assembler Options
13231 @section Passing Options to the Assembler
13232
13233 @c prevent bad page break with this line
13234 You can pass options to the assembler.
13235
13236 @table @gcctabopt
13237 @item -Wa,@var{option}
13238 @opindex Wa
13239 Pass @var{option} as an option to the assembler. If @var{option}
13240 contains commas, it is split into multiple options at the commas.
13241
13242 @item -Xassembler @var{option}
13243 @opindex Xassembler
13244 Pass @var{option} as an option to the assembler. You can use this to
13245 supply system-specific assembler options that GCC does not
13246 recognize.
13247
13248 If you want to pass an option that takes an argument, you must use
13249 @option{-Xassembler} twice, once for the option and once for the argument.
13250
13251 @end table
13252
13253 @node Link Options
13254 @section Options for Linking
13255 @cindex link options
13256 @cindex options, linking
13257
13258 These options come into play when the compiler links object files into
13259 an executable output file. They are meaningless if the compiler is
13260 not doing a link step.
13261
13262 @table @gcctabopt
13263 @cindex file names
13264 @item @var{object-file-name}
13265 A file name that does not end in a special recognized suffix is
13266 considered to name an object file or library. (Object files are
13267 distinguished from libraries by the linker according to the file
13268 contents.) If linking is done, these object files are used as input
13269 to the linker.
13270
13271 @item -c
13272 @itemx -S
13273 @itemx -E
13274 @opindex c
13275 @opindex S
13276 @opindex E
13277 If any of these options is used, then the linker is not run, and
13278 object file names should not be used as arguments. @xref{Overall
13279 Options}.
13280
13281 @item -flinker-output=@var{type}
13282 @opindex flinker-output
13283 This option controls code generation of the link-time optimizer. By
13284 default the linker output is automatically determined by the linker
13285 plugin. For debugging the compiler and if incremental linking with a
13286 non-LTO object file is desired, it may be useful to control the type
13287 manually.
13288
13289 If @var{type} is @samp{exec}, code generation produces a static
13290 binary. In this case @option{-fpic} and @option{-fpie} are both
13291 disabled.
13292
13293 If @var{type} is @samp{dyn}, code generation produces a shared
13294 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13295 but not enabled automatically. This allows to build shared libraries
13296 without position-independent code on architectures where this is
13297 possible, i.e.@: on x86.
13298
13299 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13300 executable. This results in similar optimizations as @samp{exec}
13301 except that @option{-fpie} is not disabled if specified at compilation
13302 time.
13303
13304 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13305 done. The sections containing intermediate code for link-time optimization are
13306 merged, pre-optimized, and output to the resulting object file. In addition, if
13307 @option{-ffat-lto-objects} is specified, binary code is produced for future
13308 non-LTO linking. The object file produced by incremental linking is smaller
13309 than a static library produced from the same object files. At link time the
13310 result of incremental linking also loads faster than a static
13311 library assuming that the majority of objects in the library are used.
13312
13313 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13314 code generation is forced, a final binary is produced, and the intermediate
13315 code for later link-time optimization is stripped. When multiple object files
13316 are linked together the resulting code is better optimized than with
13317 link-time optimizations disabled (for example, cross-module inlining
13318 happens), but most of benefits of whole program optimizations are lost.
13319
13320 During the incremental link (by @option{-r}) the linker plugin defaults to
13321 @option{rel}. With current interfaces to GNU Binutils it is however not
13322 possible to incrementally link LTO objects and non-LTO objects into a single
13323 mixed object file. If any of object files in incremental link cannot
13324 be used for link-time optimization, the linker plugin issues a warning and
13325 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13326 recommended to link such objects into static library instead. Alternatively it
13327 is possible to use H.J. Lu's binutils with support for mixed objects.
13328
13329 @item -fuse-ld=bfd
13330 @opindex fuse-ld=bfd
13331 Use the @command{bfd} linker instead of the default linker.
13332
13333 @item -fuse-ld=gold
13334 @opindex fuse-ld=gold
13335 Use the @command{gold} linker instead of the default linker.
13336
13337 @item -fuse-ld=lld
13338 @opindex fuse-ld=lld
13339 Use the LLVM @command{lld} linker instead of the default linker.
13340
13341 @cindex Libraries
13342 @item -l@var{library}
13343 @itemx -l @var{library}
13344 @opindex l
13345 Search the library named @var{library} when linking. (The second
13346 alternative with the library as a separate argument is only for
13347 POSIX compliance and is not recommended.)
13348
13349 The @option{-l} option is passed directly to the linker by GCC. Refer
13350 to your linker documentation for exact details. The general
13351 description below applies to the GNU linker.
13352
13353 The linker searches a standard list of directories for the library.
13354 The directories searched include several standard system directories
13355 plus any that you specify with @option{-L}.
13356
13357 Static libraries are archives of object files, and have file names
13358 like @file{lib@var{library}.a}. Some targets also support shared
13359 libraries, which typically have names like @file{lib@var{library}.so}.
13360 If both static and shared libraries are found, the linker gives
13361 preference to linking with the shared library unless the
13362 @option{-static} option is used.
13363
13364 It makes a difference where in the command you write this option; the
13365 linker searches and processes libraries and object files in the order they
13366 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13367 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13368 to functions in @samp{z}, those functions may not be loaded.
13369
13370 @item -lobjc
13371 @opindex lobjc
13372 You need this special case of the @option{-l} option in order to
13373 link an Objective-C or Objective-C++ program.
13374
13375 @item -nostartfiles
13376 @opindex nostartfiles
13377 Do not use the standard system startup files when linking.
13378 The standard system libraries are used normally, unless @option{-nostdlib},
13379 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13380
13381 @item -nodefaultlibs
13382 @opindex nodefaultlibs
13383 Do not use the standard system libraries when linking.
13384 Only the libraries you specify are passed to the linker, and options
13385 specifying linkage of the system libraries, such as @option{-static-libgcc}
13386 or @option{-shared-libgcc}, are ignored.
13387 The standard startup files are used normally, unless @option{-nostartfiles}
13388 is used.
13389
13390 The compiler may generate calls to @code{memcmp},
13391 @code{memset}, @code{memcpy} and @code{memmove}.
13392 These entries are usually resolved by entries in
13393 libc. These entry points should be supplied through some other
13394 mechanism when this option is specified.
13395
13396 @item -nolibc
13397 @opindex nolibc
13398 Do not use the C library or system libraries tightly coupled with it when
13399 linking. Still link with the startup files, @file{libgcc} or toolchain
13400 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13401 or @file{libstdc++} unless options preventing their inclusion are used as
13402 well. This typically removes @option{-lc} from the link command line, as well
13403 as system libraries that normally go with it and become meaningless when
13404 absence of a C library is assumed, for example @option{-lpthread} or
13405 @option{-lm} in some configurations. This is intended for bare-board
13406 targets when there is indeed no C library available.
13407
13408 @item -nostdlib
13409 @opindex nostdlib
13410 Do not use the standard system startup files or libraries when linking.
13411 No startup files and only the libraries you specify are passed to
13412 the linker, and options specifying linkage of the system libraries, such as
13413 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13414
13415 The compiler may generate calls to @code{memcmp}, @code{memset},
13416 @code{memcpy} and @code{memmove}.
13417 These entries are usually resolved by entries in
13418 libc. These entry points should be supplied through some other
13419 mechanism when this option is specified.
13420
13421 @cindex @option{-lgcc}, use with @option{-nostdlib}
13422 @cindex @option{-nostdlib} and unresolved references
13423 @cindex unresolved references and @option{-nostdlib}
13424 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13425 @cindex @option{-nodefaultlibs} and unresolved references
13426 @cindex unresolved references and @option{-nodefaultlibs}
13427 One of the standard libraries bypassed by @option{-nostdlib} and
13428 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13429 which GCC uses to overcome shortcomings of particular machines, or special
13430 needs for some languages.
13431 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13432 Collection (GCC) Internals},
13433 for more discussion of @file{libgcc.a}.)
13434 In most cases, you need @file{libgcc.a} even when you want to avoid
13435 other standard libraries. In other words, when you specify @option{-nostdlib}
13436 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13437 This ensures that you have no unresolved references to internal GCC
13438 library subroutines.
13439 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13440 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13441 GNU Compiler Collection (GCC) Internals}.)
13442
13443 @item -e @var{entry}
13444 @itemx --entry=@var{entry}
13445 @opindex e
13446 @opindex entry
13447
13448 Specify that the program entry point is @var{entry}. The argument is
13449 interpreted by the linker; the GNU linker accepts either a symbol name
13450 or an address.
13451
13452 @item -pie
13453 @opindex pie
13454 Produce a dynamically linked position independent executable on targets
13455 that support it. For predictable results, you must also specify the same
13456 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13457 or model suboptions) when you specify this linker option.
13458
13459 @item -no-pie
13460 @opindex no-pie
13461 Don't produce a dynamically linked position independent executable.
13462
13463 @item -static-pie
13464 @opindex static-pie
13465 Produce a static position independent executable on targets that support
13466 it. A static position independent executable is similar to a static
13467 executable, but can be loaded at any address without a dynamic linker.
13468 For predictable results, you must also specify the same set of options
13469 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13470 suboptions) when you specify this linker option.
13471
13472 @item -pthread
13473 @opindex pthread
13474 Link with the POSIX threads library. This option is supported on
13475 GNU/Linux targets, most other Unix derivatives, and also on
13476 x86 Cygwin and MinGW targets. On some targets this option also sets
13477 flags for the preprocessor, so it should be used consistently for both
13478 compilation and linking.
13479
13480 @item -r
13481 @opindex r
13482 Produce a relocatable object as output. This is also known as partial
13483 linking.
13484
13485 @item -rdynamic
13486 @opindex rdynamic
13487 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13488 that support it. This instructs the linker to add all symbols, not
13489 only used ones, to the dynamic symbol table. This option is needed
13490 for some uses of @code{dlopen} or to allow obtaining backtraces
13491 from within a program.
13492
13493 @item -s
13494 @opindex s
13495 Remove all symbol table and relocation information from the executable.
13496
13497 @item -static
13498 @opindex static
13499 On systems that support dynamic linking, this overrides @option{-pie}
13500 and prevents linking with the shared libraries. On other systems, this
13501 option has no effect.
13502
13503 @item -shared
13504 @opindex shared
13505 Produce a shared object which can then be linked with other objects to
13506 form an executable. Not all systems support this option. For predictable
13507 results, you must also specify the same set of options used for compilation
13508 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13509 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13510 needs to build supplementary stub code for constructors to work. On
13511 multi-libbed systems, @samp{gcc -shared} must select the correct support
13512 libraries to link against. Failing to supply the correct flags may lead
13513 to subtle defects. Supplying them in cases where they are not necessary
13514 is innocuous.}
13515
13516 @item -shared-libgcc
13517 @itemx -static-libgcc
13518 @opindex shared-libgcc
13519 @opindex static-libgcc
13520 On systems that provide @file{libgcc} as a shared library, these options
13521 force the use of either the shared or static version, respectively.
13522 If no shared version of @file{libgcc} was built when the compiler was
13523 configured, these options have no effect.
13524
13525 There are several situations in which an application should use the
13526 shared @file{libgcc} instead of the static version. The most common
13527 of these is when the application wishes to throw and catch exceptions
13528 across different shared libraries. In that case, each of the libraries
13529 as well as the application itself should use the shared @file{libgcc}.
13530
13531 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13532 whenever you build a shared library or a main executable, because C++
13533 programs typically use exceptions, so this is the right thing to do.
13534
13535 If, instead, you use the GCC driver to create shared libraries, you may
13536 find that they are not always linked with the shared @file{libgcc}.
13537 If GCC finds, at its configuration time, that you have a non-GNU linker
13538 or a GNU linker that does not support option @option{--eh-frame-hdr},
13539 it links the shared version of @file{libgcc} into shared libraries
13540 by default. Otherwise, it takes advantage of the linker and optimizes
13541 away the linking with the shared version of @file{libgcc}, linking with
13542 the static version of libgcc by default. This allows exceptions to
13543 propagate through such shared libraries, without incurring relocation
13544 costs at library load time.
13545
13546 However, if a library or main executable is supposed to throw or catch
13547 exceptions, you must link it using the G++ driver, or using the option
13548 @option{-shared-libgcc}, such that it is linked with the shared
13549 @file{libgcc}.
13550
13551 @item -static-libasan
13552 @opindex static-libasan
13553 When the @option{-fsanitize=address} option is used to link a program,
13554 the GCC driver automatically links against @option{libasan}. If
13555 @file{libasan} is available as a shared library, and the @option{-static}
13556 option is not used, then this links against the shared version of
13557 @file{libasan}. The @option{-static-libasan} option directs the GCC
13558 driver to link @file{libasan} statically, without necessarily linking
13559 other libraries statically.
13560
13561 @item -static-libtsan
13562 @opindex static-libtsan
13563 When the @option{-fsanitize=thread} option is used to link a program,
13564 the GCC driver automatically links against @option{libtsan}. If
13565 @file{libtsan} is available as a shared library, and the @option{-static}
13566 option is not used, then this links against the shared version of
13567 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13568 driver to link @file{libtsan} statically, without necessarily linking
13569 other libraries statically.
13570
13571 @item -static-liblsan
13572 @opindex static-liblsan
13573 When the @option{-fsanitize=leak} option is used to link a program,
13574 the GCC driver automatically links against @option{liblsan}. If
13575 @file{liblsan} is available as a shared library, and the @option{-static}
13576 option is not used, then this links against the shared version of
13577 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13578 driver to link @file{liblsan} statically, without necessarily linking
13579 other libraries statically.
13580
13581 @item -static-libubsan
13582 @opindex static-libubsan
13583 When the @option{-fsanitize=undefined} option is used to link a program,
13584 the GCC driver automatically links against @option{libubsan}. If
13585 @file{libubsan} is available as a shared library, and the @option{-static}
13586 option is not used, then this links against the shared version of
13587 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13588 driver to link @file{libubsan} statically, without necessarily linking
13589 other libraries statically.
13590
13591 @item -static-libstdc++
13592 @opindex static-libstdc++
13593 When the @command{g++} program is used to link a C++ program, it
13594 normally automatically links against @option{libstdc++}. If
13595 @file{libstdc++} is available as a shared library, and the
13596 @option{-static} option is not used, then this links against the
13597 shared version of @file{libstdc++}. That is normally fine. However, it
13598 is sometimes useful to freeze the version of @file{libstdc++} used by
13599 the program without going all the way to a fully static link. The
13600 @option{-static-libstdc++} option directs the @command{g++} driver to
13601 link @file{libstdc++} statically, without necessarily linking other
13602 libraries statically.
13603
13604 @item -symbolic
13605 @opindex symbolic
13606 Bind references to global symbols when building a shared object. Warn
13607 about any unresolved references (unless overridden by the link editor
13608 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13609 this option.
13610
13611 @item -T @var{script}
13612 @opindex T
13613 @cindex linker script
13614 Use @var{script} as the linker script. This option is supported by most
13615 systems using the GNU linker. On some targets, such as bare-board
13616 targets without an operating system, the @option{-T} option may be required
13617 when linking to avoid references to undefined symbols.
13618
13619 @item -Xlinker @var{option}
13620 @opindex Xlinker
13621 Pass @var{option} as an option to the linker. You can use this to
13622 supply system-specific linker options that GCC does not recognize.
13623
13624 If you want to pass an option that takes a separate argument, you must use
13625 @option{-Xlinker} twice, once for the option and once for the argument.
13626 For example, to pass @option{-assert definitions}, you must write
13627 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13628 @option{-Xlinker "-assert definitions"}, because this passes the entire
13629 string as a single argument, which is not what the linker expects.
13630
13631 When using the GNU linker, it is usually more convenient to pass
13632 arguments to linker options using the @option{@var{option}=@var{value}}
13633 syntax than as separate arguments. For example, you can specify
13634 @option{-Xlinker -Map=output.map} rather than
13635 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13636 this syntax for command-line options.
13637
13638 @item -Wl,@var{option}
13639 @opindex Wl
13640 Pass @var{option} as an option to the linker. If @var{option} contains
13641 commas, it is split into multiple options at the commas. You can use this
13642 syntax to pass an argument to the option.
13643 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13644 linker. When using the GNU linker, you can also get the same effect with
13645 @option{-Wl,-Map=output.map}.
13646
13647 @item -u @var{symbol}
13648 @opindex u
13649 Pretend the symbol @var{symbol} is undefined, to force linking of
13650 library modules to define it. You can use @option{-u} multiple times with
13651 different symbols to force loading of additional library modules.
13652
13653 @item -z @var{keyword}
13654 @opindex z
13655 @option{-z} is passed directly on to the linker along with the keyword
13656 @var{keyword}. See the section in the documentation of your linker for
13657 permitted values and their meanings.
13658 @end table
13659
13660 @node Directory Options
13661 @section Options for Directory Search
13662 @cindex directory options
13663 @cindex options, directory search
13664 @cindex search path
13665
13666 These options specify directories to search for header files, for
13667 libraries and for parts of the compiler:
13668
13669 @table @gcctabopt
13670 @include cppdiropts.texi
13671
13672 @item -iplugindir=@var{dir}
13673 @opindex iplugindir=
13674 Set the directory to search for plugins that are passed
13675 by @option{-fplugin=@var{name}} instead of
13676 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13677 to be used by the user, but only passed by the driver.
13678
13679 @item -L@var{dir}
13680 @opindex L
13681 Add directory @var{dir} to the list of directories to be searched
13682 for @option{-l}.
13683
13684 @item -B@var{prefix}
13685 @opindex B
13686 This option specifies where to find the executables, libraries,
13687 include files, and data files of the compiler itself.
13688
13689 The compiler driver program runs one or more of the subprograms
13690 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13691 @var{prefix} as a prefix for each program it tries to run, both with and
13692 without @samp{@var{machine}/@var{version}/} for the corresponding target
13693 machine and compiler version.
13694
13695 For each subprogram to be run, the compiler driver first tries the
13696 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13697 is not specified, the driver tries two standard prefixes,
13698 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13699 those results in a file name that is found, the unmodified program
13700 name is searched for using the directories specified in your
13701 @env{PATH} environment variable.
13702
13703 The compiler checks to see if the path provided by @option{-B}
13704 refers to a directory, and if necessary it adds a directory
13705 separator character at the end of the path.
13706
13707 @option{-B} prefixes that effectively specify directory names also apply
13708 to libraries in the linker, because the compiler translates these
13709 options into @option{-L} options for the linker. They also apply to
13710 include files in the preprocessor, because the compiler translates these
13711 options into @option{-isystem} options for the preprocessor. In this case,
13712 the compiler appends @samp{include} to the prefix.
13713
13714 The runtime support file @file{libgcc.a} can also be searched for using
13715 the @option{-B} prefix, if needed. If it is not found there, the two
13716 standard prefixes above are tried, and that is all. The file is left
13717 out of the link if it is not found by those means.
13718
13719 Another way to specify a prefix much like the @option{-B} prefix is to use
13720 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13721 Variables}.
13722
13723 As a special kludge, if the path provided by @option{-B} is
13724 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13725 9, then it is replaced by @file{[dir/]include}. This is to help
13726 with boot-strapping the compiler.
13727
13728 @item -no-canonical-prefixes
13729 @opindex no-canonical-prefixes
13730 Do not expand any symbolic links, resolve references to @samp{/../}
13731 or @samp{/./}, or make the path absolute when generating a relative
13732 prefix.
13733
13734 @item --sysroot=@var{dir}
13735 @opindex sysroot
13736 Use @var{dir} as the logical root directory for headers and libraries.
13737 For example, if the compiler normally searches for headers in
13738 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13739 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13740
13741 If you use both this option and the @option{-isysroot} option, then
13742 the @option{--sysroot} option applies to libraries, but the
13743 @option{-isysroot} option applies to header files.
13744
13745 The GNU linker (beginning with version 2.16) has the necessary support
13746 for this option. If your linker does not support this option, the
13747 header file aspect of @option{--sysroot} still works, but the
13748 library aspect does not.
13749
13750 @item --no-sysroot-suffix
13751 @opindex no-sysroot-suffix
13752 For some targets, a suffix is added to the root directory specified
13753 with @option{--sysroot}, depending on the other options used, so that
13754 headers may for example be found in
13755 @file{@var{dir}/@var{suffix}/usr/include} instead of
13756 @file{@var{dir}/usr/include}. This option disables the addition of
13757 such a suffix.
13758
13759 @end table
13760
13761 @node Code Gen Options
13762 @section Options for Code Generation Conventions
13763 @cindex code generation conventions
13764 @cindex options, code generation
13765 @cindex run-time options
13766
13767 These machine-independent options control the interface conventions
13768 used in code generation.
13769
13770 Most of them have both positive and negative forms; the negative form
13771 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13772 one of the forms is listed---the one that is not the default. You
13773 can figure out the other form by either removing @samp{no-} or adding
13774 it.
13775
13776 @table @gcctabopt
13777 @item -fstack-reuse=@var{reuse-level}
13778 @opindex fstack_reuse
13779 This option controls stack space reuse for user declared local/auto variables
13780 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13781 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13782 local variables and temporaries, @samp{named_vars} enables the reuse only for
13783 user defined local variables with names, and @samp{none} disables stack reuse
13784 completely. The default value is @samp{all}. The option is needed when the
13785 program extends the lifetime of a scoped local variable or a compiler generated
13786 temporary beyond the end point defined by the language. When a lifetime of
13787 a variable ends, and if the variable lives in memory, the optimizing compiler
13788 has the freedom to reuse its stack space with other temporaries or scoped
13789 local variables whose live range does not overlap with it. Legacy code extending
13790 local lifetime is likely to break with the stack reuse optimization.
13791
13792 For example,
13793
13794 @smallexample
13795 int *p;
13796 @{
13797 int local1;
13798
13799 p = &local1;
13800 local1 = 10;
13801 ....
13802 @}
13803 @{
13804 int local2;
13805 local2 = 20;
13806 ...
13807 @}
13808
13809 if (*p == 10) // out of scope use of local1
13810 @{
13811
13812 @}
13813 @end smallexample
13814
13815 Another example:
13816 @smallexample
13817
13818 struct A
13819 @{
13820 A(int k) : i(k), j(k) @{ @}
13821 int i;
13822 int j;
13823 @};
13824
13825 A *ap;
13826
13827 void foo(const A& ar)
13828 @{
13829 ap = &ar;
13830 @}
13831
13832 void bar()
13833 @{
13834 foo(A(10)); // temp object's lifetime ends when foo returns
13835
13836 @{
13837 A a(20);
13838 ....
13839 @}
13840 ap->i+= 10; // ap references out of scope temp whose space
13841 // is reused with a. What is the value of ap->i?
13842 @}
13843
13844 @end smallexample
13845
13846 The lifetime of a compiler generated temporary is well defined by the C++
13847 standard. When a lifetime of a temporary ends, and if the temporary lives
13848 in memory, the optimizing compiler has the freedom to reuse its stack
13849 space with other temporaries or scoped local variables whose live range
13850 does not overlap with it. However some of the legacy code relies on
13851 the behavior of older compilers in which temporaries' stack space is
13852 not reused, the aggressive stack reuse can lead to runtime errors. This
13853 option is used to control the temporary stack reuse optimization.
13854
13855 @item -ftrapv
13856 @opindex ftrapv
13857 This option generates traps for signed overflow on addition, subtraction,
13858 multiplication operations.
13859 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13860 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13861 @option{-fwrapv} being effective. Note that only active options override, so
13862 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13863 results in @option{-ftrapv} being effective.
13864
13865 @item -fwrapv
13866 @opindex fwrapv
13867 This option instructs the compiler to assume that signed arithmetic
13868 overflow of addition, subtraction and multiplication wraps around
13869 using twos-complement representation. This flag enables some optimizations
13870 and disables others.
13871 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13872 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13873 @option{-fwrapv} being effective. Note that only active options override, so
13874 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13875 results in @option{-ftrapv} being effective.
13876
13877 @item -fwrapv-pointer
13878 @opindex fwrapv-pointer
13879 This option instructs the compiler to assume that pointer arithmetic
13880 overflow on addition and subtraction wraps around using twos-complement
13881 representation. This flag disables some optimizations which assume
13882 pointer overflow is invalid.
13883
13884 @item -fstrict-overflow
13885 @opindex fstrict-overflow
13886 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13887 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13888
13889 @item -fexceptions
13890 @opindex fexceptions
13891 Enable exception handling. Generates extra code needed to propagate
13892 exceptions. For some targets, this implies GCC generates frame
13893 unwind information for all functions, which can produce significant data
13894 size overhead, although it does not affect execution. If you do not
13895 specify this option, GCC enables it by default for languages like
13896 C++ that normally require exception handling, and disables it for
13897 languages like C that do not normally require it. However, you may need
13898 to enable this option when compiling C code that needs to interoperate
13899 properly with exception handlers written in C++. You may also wish to
13900 disable this option if you are compiling older C++ programs that don't
13901 use exception handling.
13902
13903 @item -fnon-call-exceptions
13904 @opindex fnon-call-exceptions
13905 Generate code that allows trapping instructions to throw exceptions.
13906 Note that this requires platform-specific runtime support that does
13907 not exist everywhere. Moreover, it only allows @emph{trapping}
13908 instructions to throw exceptions, i.e.@: memory references or floating-point
13909 instructions. It does not allow exceptions to be thrown from
13910 arbitrary signal handlers such as @code{SIGALRM}.
13911
13912 @item -fdelete-dead-exceptions
13913 @opindex fdelete-dead-exceptions
13914 Consider that instructions that may throw exceptions but don't otherwise
13915 contribute to the execution of the program can be optimized away.
13916 This option is enabled by default for the Ada front end, as permitted by
13917 the Ada language specification.
13918 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13919
13920 @item -funwind-tables
13921 @opindex funwind-tables
13922 Similar to @option{-fexceptions}, except that it just generates any needed
13923 static data, but does not affect the generated code in any other way.
13924 You normally do not need to enable this option; instead, a language processor
13925 that needs this handling enables it on your behalf.
13926
13927 @item -fasynchronous-unwind-tables
13928 @opindex fasynchronous-unwind-tables
13929 Generate unwind table in DWARF format, if supported by target machine. The
13930 table is exact at each instruction boundary, so it can be used for stack
13931 unwinding from asynchronous events (such as debugger or garbage collector).
13932
13933 @item -fno-gnu-unique
13934 @opindex fno-gnu-unique
13935 @opindex fgnu-unique
13936 On systems with recent GNU assembler and C library, the C++ compiler
13937 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13938 of template static data members and static local variables in inline
13939 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13940 is necessary to avoid problems with a library used by two different
13941 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13942 therefore disagreeing with the other one about the binding of the
13943 symbol. But this causes @code{dlclose} to be ignored for affected
13944 DSOs; if your program relies on reinitialization of a DSO via
13945 @code{dlclose} and @code{dlopen}, you can use
13946 @option{-fno-gnu-unique}.
13947
13948 @item -fpcc-struct-return
13949 @opindex fpcc-struct-return
13950 Return ``short'' @code{struct} and @code{union} values in memory like
13951 longer ones, rather than in registers. This convention is less
13952 efficient, but it has the advantage of allowing intercallability between
13953 GCC-compiled files and files compiled with other compilers, particularly
13954 the Portable C Compiler (pcc).
13955
13956 The precise convention for returning structures in memory depends
13957 on the target configuration macros.
13958
13959 Short structures and unions are those whose size and alignment match
13960 that of some integer type.
13961
13962 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13963 switch is not binary compatible with code compiled with the
13964 @option{-freg-struct-return} switch.
13965 Use it to conform to a non-default application binary interface.
13966
13967 @item -freg-struct-return
13968 @opindex freg-struct-return
13969 Return @code{struct} and @code{union} values in registers when possible.
13970 This is more efficient for small structures than
13971 @option{-fpcc-struct-return}.
13972
13973 If you specify neither @option{-fpcc-struct-return} nor
13974 @option{-freg-struct-return}, GCC defaults to whichever convention is
13975 standard for the target. If there is no standard convention, GCC
13976 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13977 the principal compiler. In those cases, we can choose the standard, and
13978 we chose the more efficient register return alternative.
13979
13980 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13981 switch is not binary compatible with code compiled with the
13982 @option{-fpcc-struct-return} switch.
13983 Use it to conform to a non-default application binary interface.
13984
13985 @item -fshort-enums
13986 @opindex fshort-enums
13987 Allocate to an @code{enum} type only as many bytes as it needs for the
13988 declared range of possible values. Specifically, the @code{enum} type
13989 is equivalent to the smallest integer type that has enough room.
13990
13991 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13992 code that is not binary compatible with code generated without that switch.
13993 Use it to conform to a non-default application binary interface.
13994
13995 @item -fshort-wchar
13996 @opindex fshort-wchar
13997 Override the underlying type for @code{wchar_t} to be @code{short
13998 unsigned int} instead of the default for the target. This option is
13999 useful for building programs to run under WINE@.
14000
14001 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14002 code that is not binary compatible with code generated without that switch.
14003 Use it to conform to a non-default application binary interface.
14004
14005 @item -fno-common
14006 @opindex fno-common
14007 @opindex fcommon
14008 @cindex tentative definitions
14009 In C code, this option controls the placement of global variables
14010 defined without an initializer, known as @dfn{tentative definitions}
14011 in the C standard. Tentative definitions are distinct from declarations
14012 of a variable with the @code{extern} keyword, which do not allocate storage.
14013
14014 Unix C compilers have traditionally allocated storage for
14015 uninitialized global variables in a common block. This allows the
14016 linker to resolve all tentative definitions of the same variable
14017 in different compilation units to the same object, or to a non-tentative
14018 definition.
14019 This is the behavior specified by @option{-fcommon}, and is the default for
14020 GCC on most targets.
14021 On the other hand, this behavior is not required by ISO
14022 C, and on some targets may carry a speed or code size penalty on
14023 variable references.
14024
14025 The @option{-fno-common} option specifies that the compiler should instead
14026 place uninitialized global variables in the BSS section of the object file.
14027 This inhibits the merging of tentative definitions by the linker so
14028 you get a multiple-definition error if the same
14029 variable is defined in more than one compilation unit.
14030 Compiling with @option{-fno-common} is useful on targets for which
14031 it provides better performance, or if you wish to verify that the
14032 program will work on other systems that always treat uninitialized
14033 variable definitions this way.
14034
14035 @item -fno-ident
14036 @opindex fno-ident
14037 @opindex fident
14038 Ignore the @code{#ident} directive.
14039
14040 @item -finhibit-size-directive
14041 @opindex finhibit-size-directive
14042 Don't output a @code{.size} assembler directive, or anything else that
14043 would cause trouble if the function is split in the middle, and the
14044 two halves are placed at locations far apart in memory. This option is
14045 used when compiling @file{crtstuff.c}; you should not need to use it
14046 for anything else.
14047
14048 @item -fverbose-asm
14049 @opindex fverbose-asm
14050 Put extra commentary information in the generated assembly code to
14051 make it more readable. This option is generally only of use to those
14052 who actually need to read the generated assembly code (perhaps while
14053 debugging the compiler itself).
14054
14055 @option{-fno-verbose-asm}, the default, causes the
14056 extra information to be omitted and is useful when comparing two assembler
14057 files.
14058
14059 The added comments include:
14060
14061 @itemize @bullet
14062
14063 @item
14064 information on the compiler version and command-line options,
14065
14066 @item
14067 the source code lines associated with the assembly instructions,
14068 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14069
14070 @item
14071 hints on which high-level expressions correspond to
14072 the various assembly instruction operands.
14073
14074 @end itemize
14075
14076 For example, given this C source file:
14077
14078 @smallexample
14079 int test (int n)
14080 @{
14081 int i;
14082 int total = 0;
14083
14084 for (i = 0; i < n; i++)
14085 total += i * i;
14086
14087 return total;
14088 @}
14089 @end smallexample
14090
14091 compiling to (x86_64) assembly via @option{-S} and emitting the result
14092 direct to stdout via @option{-o} @option{-}
14093
14094 @smallexample
14095 gcc -S test.c -fverbose-asm -Os -o -
14096 @end smallexample
14097
14098 gives output similar to this:
14099
14100 @smallexample
14101 .file "test.c"
14102 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14103 [...snip...]
14104 # options passed:
14105 [...snip...]
14106
14107 .text
14108 .globl test
14109 .type test, @@function
14110 test:
14111 .LFB0:
14112 .cfi_startproc
14113 # test.c:4: int total = 0;
14114 xorl %eax, %eax # <retval>
14115 # test.c:6: for (i = 0; i < n; i++)
14116 xorl %edx, %edx # i
14117 .L2:
14118 # test.c:6: for (i = 0; i < n; i++)
14119 cmpl %edi, %edx # n, i
14120 jge .L5 #,
14121 # test.c:7: total += i * i;
14122 movl %edx, %ecx # i, tmp92
14123 imull %edx, %ecx # i, tmp92
14124 # test.c:6: for (i = 0; i < n; i++)
14125 incl %edx # i
14126 # test.c:7: total += i * i;
14127 addl %ecx, %eax # tmp92, <retval>
14128 jmp .L2 #
14129 .L5:
14130 # test.c:10: @}
14131 ret
14132 .cfi_endproc
14133 .LFE0:
14134 .size test, .-test
14135 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14136 .section .note.GNU-stack,"",@@progbits
14137 @end smallexample
14138
14139 The comments are intended for humans rather than machines and hence the
14140 precise format of the comments is subject to change.
14141
14142 @item -frecord-gcc-switches
14143 @opindex frecord-gcc-switches
14144 This switch causes the command line used to invoke the
14145 compiler to be recorded into the object file that is being created.
14146 This switch is only implemented on some targets and the exact format
14147 of the recording is target and binary file format dependent, but it
14148 usually takes the form of a section containing ASCII text. This
14149 switch is related to the @option{-fverbose-asm} switch, but that
14150 switch only records information in the assembler output file as
14151 comments, so it never reaches the object file.
14152 See also @option{-grecord-gcc-switches} for another
14153 way of storing compiler options into the object file.
14154
14155 @item -fpic
14156 @opindex fpic
14157 @cindex global offset table
14158 @cindex PIC
14159 Generate position-independent code (PIC) suitable for use in a shared
14160 library, if supported for the target machine. Such code accesses all
14161 constant addresses through a global offset table (GOT)@. The dynamic
14162 loader resolves the GOT entries when the program starts (the dynamic
14163 loader is not part of GCC; it is part of the operating system). If
14164 the GOT size for the linked executable exceeds a machine-specific
14165 maximum size, you get an error message from the linker indicating that
14166 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14167 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14168 on the m68k and RS/6000. The x86 has no such limit.)
14169
14170 Position-independent code requires special support, and therefore works
14171 only on certain machines. For the x86, GCC supports PIC for System V
14172 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14173 position-independent.
14174
14175 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14176 are defined to 1.
14177
14178 @item -fPIC
14179 @opindex fPIC
14180 If supported for the target machine, emit position-independent code,
14181 suitable for dynamic linking and avoiding any limit on the size of the
14182 global offset table. This option makes a difference on AArch64, m68k,
14183 PowerPC and SPARC@.
14184
14185 Position-independent code requires special support, and therefore works
14186 only on certain machines.
14187
14188 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14189 are defined to 2.
14190
14191 @item -fpie
14192 @itemx -fPIE
14193 @opindex fpie
14194 @opindex fPIE
14195 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14196 generated position-independent code can be only linked into executables.
14197 Usually these options are used to compile code that will be linked using
14198 the @option{-pie} GCC option.
14199
14200 @option{-fpie} and @option{-fPIE} both define the macros
14201 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14202 for @option{-fpie} and 2 for @option{-fPIE}.
14203
14204 @item -fno-plt
14205 @opindex fno-plt
14206 @opindex fplt
14207 Do not use the PLT for external function calls in position-independent code.
14208 Instead, load the callee address at call sites from the GOT and branch to it.
14209 This leads to more efficient code by eliminating PLT stubs and exposing
14210 GOT loads to optimizations. On architectures such as 32-bit x86 where
14211 PLT stubs expect the GOT pointer in a specific register, this gives more
14212 register allocation freedom to the compiler.
14213 Lazy binding requires use of the PLT;
14214 with @option{-fno-plt} all external symbols are resolved at load time.
14215
14216 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14217 through the PLT for specific external functions.
14218
14219 In position-dependent code, a few targets also convert calls to
14220 functions that are marked to not use the PLT to use the GOT instead.
14221
14222 @item -fno-jump-tables
14223 @opindex fno-jump-tables
14224 @opindex fjump-tables
14225 Do not use jump tables for switch statements even where it would be
14226 more efficient than other code generation strategies. This option is
14227 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14228 building code that forms part of a dynamic linker and cannot
14229 reference the address of a jump table. On some targets, jump tables
14230 do not require a GOT and this option is not needed.
14231
14232 @item -ffixed-@var{reg}
14233 @opindex ffixed
14234 Treat the register named @var{reg} as a fixed register; generated code
14235 should never refer to it (except perhaps as a stack pointer, frame
14236 pointer or in some other fixed role).
14237
14238 @var{reg} must be the name of a register. The register names accepted
14239 are machine-specific and are defined in the @code{REGISTER_NAMES}
14240 macro in the machine description macro file.
14241
14242 This flag does not have a negative form, because it specifies a
14243 three-way choice.
14244
14245 @item -fcall-used-@var{reg}
14246 @opindex fcall-used
14247 Treat the register named @var{reg} as an allocable register that is
14248 clobbered by function calls. It may be allocated for temporaries or
14249 variables that do not live across a call. Functions compiled this way
14250 do not save and restore the register @var{reg}.
14251
14252 It is an error to use this flag with the frame pointer or stack pointer.
14253 Use of this flag for other registers that have fixed pervasive roles in
14254 the machine's execution model produces disastrous results.
14255
14256 This flag does not have a negative form, because it specifies a
14257 three-way choice.
14258
14259 @item -fcall-saved-@var{reg}
14260 @opindex fcall-saved
14261 Treat the register named @var{reg} as an allocable register saved by
14262 functions. It may be allocated even for temporaries or variables that
14263 live across a call. Functions compiled this way save and restore
14264 the register @var{reg} if they use it.
14265
14266 It is an error to use this flag with the frame pointer or stack pointer.
14267 Use of this flag for other registers that have fixed pervasive roles in
14268 the machine's execution model produces disastrous results.
14269
14270 A different sort of disaster results from the use of this flag for
14271 a register in which function values may be returned.
14272
14273 This flag does not have a negative form, because it specifies a
14274 three-way choice.
14275
14276 @item -fpack-struct[=@var{n}]
14277 @opindex fpack-struct
14278 Without a value specified, pack all structure members together without
14279 holes. When a value is specified (which must be a small power of two), pack
14280 structure members according to this value, representing the maximum
14281 alignment (that is, objects with default alignment requirements larger than
14282 this are output potentially unaligned at the next fitting location.
14283
14284 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14285 code that is not binary compatible with code generated without that switch.
14286 Additionally, it makes the code suboptimal.
14287 Use it to conform to a non-default application binary interface.
14288
14289 @item -fleading-underscore
14290 @opindex fleading-underscore
14291 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14292 change the way C symbols are represented in the object file. One use
14293 is to help link with legacy assembly code.
14294
14295 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14296 generate code that is not binary compatible with code generated without that
14297 switch. Use it to conform to a non-default application binary interface.
14298 Not all targets provide complete support for this switch.
14299
14300 @item -ftls-model=@var{model}
14301 @opindex ftls-model
14302 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14303 The @var{model} argument should be one of @samp{global-dynamic},
14304 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14305 Note that the choice is subject to optimization: the compiler may use
14306 a more efficient model for symbols not visible outside of the translation
14307 unit, or if @option{-fpic} is not given on the command line.
14308
14309 The default without @option{-fpic} is @samp{initial-exec}; with
14310 @option{-fpic} the default is @samp{global-dynamic}.
14311
14312 @item -ftrampolines
14313 @opindex ftrampolines
14314 For targets that normally need trampolines for nested functions, always
14315 generate them instead of using descriptors. Otherwise, for targets that
14316 do not need them, like for example HP-PA or IA-64, do nothing.
14317
14318 A trampoline is a small piece of code that is created at run time on the
14319 stack when the address of a nested function is taken, and is used to call
14320 the nested function indirectly. Therefore, it requires the stack to be
14321 made executable in order for the program to work properly.
14322
14323 @option{-fno-trampolines} is enabled by default on a language by language
14324 basis to let the compiler avoid generating them, if it computes that this
14325 is safe, and replace them with descriptors. Descriptors are made up of data
14326 only, but the generated code must be prepared to deal with them. As of this
14327 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14328
14329 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14330 @option{-fno-trampolines} are not binary compatible if nested functions are
14331 present. This option must therefore be used on a program-wide basis and be
14332 manipulated with extreme care.
14333
14334 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14335 @opindex fvisibility
14336 Set the default ELF image symbol visibility to the specified option---all
14337 symbols are marked with this unless overridden within the code.
14338 Using this feature can very substantially improve linking and
14339 load times of shared object libraries, produce more optimized
14340 code, provide near-perfect API export and prevent symbol clashes.
14341 It is @strong{strongly} recommended that you use this in any shared objects
14342 you distribute.
14343
14344 Despite the nomenclature, @samp{default} always means public; i.e.,
14345 available to be linked against from outside the shared object.
14346 @samp{protected} and @samp{internal} are pretty useless in real-world
14347 usage so the only other commonly used option is @samp{hidden}.
14348 The default if @option{-fvisibility} isn't specified is
14349 @samp{default}, i.e., make every symbol public.
14350
14351 A good explanation of the benefits offered by ensuring ELF
14352 symbols have the correct visibility is given by ``How To Write
14353 Shared Libraries'' by Ulrich Drepper (which can be found at
14354 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14355 solution made possible by this option to marking things hidden when
14356 the default is public is to make the default hidden and mark things
14357 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14358 and @code{__attribute__ ((visibility("default")))} instead of
14359 @code{__declspec(dllexport)} you get almost identical semantics with
14360 identical syntax. This is a great boon to those working with
14361 cross-platform projects.
14362
14363 For those adding visibility support to existing code, you may find
14364 @code{#pragma GCC visibility} of use. This works by you enclosing
14365 the declarations you wish to set visibility for with (for example)
14366 @code{#pragma GCC visibility push(hidden)} and
14367 @code{#pragma GCC visibility pop}.
14368 Bear in mind that symbol visibility should be viewed @strong{as
14369 part of the API interface contract} and thus all new code should
14370 always specify visibility when it is not the default; i.e., declarations
14371 only for use within the local DSO should @strong{always} be marked explicitly
14372 as hidden as so to avoid PLT indirection overheads---making this
14373 abundantly clear also aids readability and self-documentation of the code.
14374 Note that due to ISO C++ specification requirements, @code{operator new} and
14375 @code{operator delete} must always be of default visibility.
14376
14377 Be aware that headers from outside your project, in particular system
14378 headers and headers from any other library you use, may not be
14379 expecting to be compiled with visibility other than the default. You
14380 may need to explicitly say @code{#pragma GCC visibility push(default)}
14381 before including any such headers.
14382
14383 @code{extern} declarations are not affected by @option{-fvisibility}, so
14384 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14385 no modifications. However, this means that calls to @code{extern}
14386 functions with no explicit visibility use the PLT, so it is more
14387 effective to use @code{__attribute ((visibility))} and/or
14388 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14389 declarations should be treated as hidden.
14390
14391 Note that @option{-fvisibility} does affect C++ vague linkage
14392 entities. This means that, for instance, an exception class that is
14393 be thrown between DSOs must be explicitly marked with default
14394 visibility so that the @samp{type_info} nodes are unified between
14395 the DSOs.
14396
14397 An overview of these techniques, their benefits and how to use them
14398 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14399
14400 @item -fstrict-volatile-bitfields
14401 @opindex fstrict-volatile-bitfields
14402 This option should be used if accesses to volatile bit-fields (or other
14403 structure fields, although the compiler usually honors those types
14404 anyway) should use a single access of the width of the
14405 field's type, aligned to a natural alignment if possible. For
14406 example, targets with memory-mapped peripheral registers might require
14407 all such accesses to be 16 bits wide; with this flag you can
14408 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14409 is 16 bits on these targets) to force GCC to use 16-bit accesses
14410 instead of, perhaps, a more efficient 32-bit access.
14411
14412 If this option is disabled, the compiler uses the most efficient
14413 instruction. In the previous example, that might be a 32-bit load
14414 instruction, even though that accesses bytes that do not contain
14415 any portion of the bit-field, or memory-mapped registers unrelated to
14416 the one being updated.
14417
14418 In some cases, such as when the @code{packed} attribute is applied to a
14419 structure field, it may not be possible to access the field with a single
14420 read or write that is correctly aligned for the target machine. In this
14421 case GCC falls back to generating multiple accesses rather than code that
14422 will fault or truncate the result at run time.
14423
14424 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14425 not allowed to touch non bit-field members. It is therefore recommended
14426 to define all bits of the field's type as bit-field members.
14427
14428 The default value of this option is determined by the application binary
14429 interface for the target processor.
14430
14431 @item -fsync-libcalls
14432 @opindex fsync-libcalls
14433 This option controls whether any out-of-line instance of the @code{__sync}
14434 family of functions may be used to implement the C++11 @code{__atomic}
14435 family of functions.
14436
14437 The default value of this option is enabled, thus the only useful form
14438 of the option is @option{-fno-sync-libcalls}. This option is used in
14439 the implementation of the @file{libatomic} runtime library.
14440
14441 @end table
14442
14443 @node Developer Options
14444 @section GCC Developer Options
14445 @cindex developer options
14446 @cindex debugging GCC
14447 @cindex debug dump options
14448 @cindex dump options
14449 @cindex compilation statistics
14450
14451 This section describes command-line options that are primarily of
14452 interest to GCC developers, including options to support compiler
14453 testing and investigation of compiler bugs and compile-time
14454 performance problems. This includes options that produce debug dumps
14455 at various points in the compilation; that print statistics such as
14456 memory use and execution time; and that print information about GCC's
14457 configuration, such as where it searches for libraries. You should
14458 rarely need to use any of these options for ordinary compilation and
14459 linking tasks.
14460
14461 Many developer options that cause GCC to dump output to a file take an
14462 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14463 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14464 error.
14465
14466 If @samp{=@var{filename}} is omitted, a default dump file name is
14467 constructed by concatenating the base dump file name, a pass number,
14468 phase letter, and pass name. The base dump file name is the name of
14469 output file produced by the compiler if explicitly specified and not
14470 an executable; otherwise it is the source file name.
14471 The pass number is determined by the order passes are registered with
14472 the compiler's pass manager.
14473 This is generally the same as the order of execution, but passes
14474 registered by plugins, target-specific passes, or passes that are
14475 otherwise registered late are numbered higher than the pass named
14476 @samp{final}, even if they are executed earlier. The phase letter is
14477 one of @samp{i} (inter-procedural analysis), @samp{l}
14478 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14479 The files are created in the directory of the output file.
14480
14481 @table @gcctabopt
14482
14483 @item -d@var{letters}
14484 @itemx -fdump-rtl-@var{pass}
14485 @itemx -fdump-rtl-@var{pass}=@var{filename}
14486 @opindex d
14487 @opindex fdump-rtl-@var{pass}
14488 Says to make debugging dumps during compilation at times specified by
14489 @var{letters}. This is used for debugging the RTL-based passes of the
14490 compiler.
14491
14492 Some @option{-d@var{letters}} switches have different meaning when
14493 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14494 for information about preprocessor-specific dump options.
14495
14496 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14497 @option{-d} option @var{letters}. Here are the possible
14498 letters for use in @var{pass} and @var{letters}, and their meanings:
14499
14500 @table @gcctabopt
14501
14502 @item -fdump-rtl-alignments
14503 @opindex fdump-rtl-alignments
14504 Dump after branch alignments have been computed.
14505
14506 @item -fdump-rtl-asmcons
14507 @opindex fdump-rtl-asmcons
14508 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14509
14510 @item -fdump-rtl-auto_inc_dec
14511 @opindex fdump-rtl-auto_inc_dec
14512 Dump after auto-inc-dec discovery. This pass is only run on
14513 architectures that have auto inc or auto dec instructions.
14514
14515 @item -fdump-rtl-barriers
14516 @opindex fdump-rtl-barriers
14517 Dump after cleaning up the barrier instructions.
14518
14519 @item -fdump-rtl-bbpart
14520 @opindex fdump-rtl-bbpart
14521 Dump after partitioning hot and cold basic blocks.
14522
14523 @item -fdump-rtl-bbro
14524 @opindex fdump-rtl-bbro
14525 Dump after block reordering.
14526
14527 @item -fdump-rtl-btl1
14528 @itemx -fdump-rtl-btl2
14529 @opindex fdump-rtl-btl2
14530 @opindex fdump-rtl-btl2
14531 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14532 after the two branch
14533 target load optimization passes.
14534
14535 @item -fdump-rtl-bypass
14536 @opindex fdump-rtl-bypass
14537 Dump after jump bypassing and control flow optimizations.
14538
14539 @item -fdump-rtl-combine
14540 @opindex fdump-rtl-combine
14541 Dump after the RTL instruction combination pass.
14542
14543 @item -fdump-rtl-compgotos
14544 @opindex fdump-rtl-compgotos
14545 Dump after duplicating the computed gotos.
14546
14547 @item -fdump-rtl-ce1
14548 @itemx -fdump-rtl-ce2
14549 @itemx -fdump-rtl-ce3
14550 @opindex fdump-rtl-ce1
14551 @opindex fdump-rtl-ce2
14552 @opindex fdump-rtl-ce3
14553 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14554 @option{-fdump-rtl-ce3} enable dumping after the three
14555 if conversion passes.
14556
14557 @item -fdump-rtl-cprop_hardreg
14558 @opindex fdump-rtl-cprop_hardreg
14559 Dump after hard register copy propagation.
14560
14561 @item -fdump-rtl-csa
14562 @opindex fdump-rtl-csa
14563 Dump after combining stack adjustments.
14564
14565 @item -fdump-rtl-cse1
14566 @itemx -fdump-rtl-cse2
14567 @opindex fdump-rtl-cse1
14568 @opindex fdump-rtl-cse2
14569 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14570 the two common subexpression elimination passes.
14571
14572 @item -fdump-rtl-dce
14573 @opindex fdump-rtl-dce
14574 Dump after the standalone dead code elimination passes.
14575
14576 @item -fdump-rtl-dbr
14577 @opindex fdump-rtl-dbr
14578 Dump after delayed branch scheduling.
14579
14580 @item -fdump-rtl-dce1
14581 @itemx -fdump-rtl-dce2
14582 @opindex fdump-rtl-dce1
14583 @opindex fdump-rtl-dce2
14584 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14585 the two dead store elimination passes.
14586
14587 @item -fdump-rtl-eh
14588 @opindex fdump-rtl-eh
14589 Dump after finalization of EH handling code.
14590
14591 @item -fdump-rtl-eh_ranges
14592 @opindex fdump-rtl-eh_ranges
14593 Dump after conversion of EH handling range regions.
14594
14595 @item -fdump-rtl-expand
14596 @opindex fdump-rtl-expand
14597 Dump after RTL generation.
14598
14599 @item -fdump-rtl-fwprop1
14600 @itemx -fdump-rtl-fwprop2
14601 @opindex fdump-rtl-fwprop1
14602 @opindex fdump-rtl-fwprop2
14603 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14604 dumping after the two forward propagation passes.
14605
14606 @item -fdump-rtl-gcse1
14607 @itemx -fdump-rtl-gcse2
14608 @opindex fdump-rtl-gcse1
14609 @opindex fdump-rtl-gcse2
14610 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14611 after global common subexpression elimination.
14612
14613 @item -fdump-rtl-init-regs
14614 @opindex fdump-rtl-init-regs
14615 Dump after the initialization of the registers.
14616
14617 @item -fdump-rtl-initvals
14618 @opindex fdump-rtl-initvals
14619 Dump after the computation of the initial value sets.
14620
14621 @item -fdump-rtl-into_cfglayout
14622 @opindex fdump-rtl-into_cfglayout
14623 Dump after converting to cfglayout mode.
14624
14625 @item -fdump-rtl-ira
14626 @opindex fdump-rtl-ira
14627 Dump after iterated register allocation.
14628
14629 @item -fdump-rtl-jump
14630 @opindex fdump-rtl-jump
14631 Dump after the second jump optimization.
14632
14633 @item -fdump-rtl-loop2
14634 @opindex fdump-rtl-loop2
14635 @option{-fdump-rtl-loop2} enables dumping after the rtl
14636 loop optimization passes.
14637
14638 @item -fdump-rtl-mach
14639 @opindex fdump-rtl-mach
14640 Dump after performing the machine dependent reorganization pass, if that
14641 pass exists.
14642
14643 @item -fdump-rtl-mode_sw
14644 @opindex fdump-rtl-mode_sw
14645 Dump after removing redundant mode switches.
14646
14647 @item -fdump-rtl-rnreg
14648 @opindex fdump-rtl-rnreg
14649 Dump after register renumbering.
14650
14651 @item -fdump-rtl-outof_cfglayout
14652 @opindex fdump-rtl-outof_cfglayout
14653 Dump after converting from cfglayout mode.
14654
14655 @item -fdump-rtl-peephole2
14656 @opindex fdump-rtl-peephole2
14657 Dump after the peephole pass.
14658
14659 @item -fdump-rtl-postreload
14660 @opindex fdump-rtl-postreload
14661 Dump after post-reload optimizations.
14662
14663 @item -fdump-rtl-pro_and_epilogue
14664 @opindex fdump-rtl-pro_and_epilogue
14665 Dump after generating the function prologues and epilogues.
14666
14667 @item -fdump-rtl-sched1
14668 @itemx -fdump-rtl-sched2
14669 @opindex fdump-rtl-sched1
14670 @opindex fdump-rtl-sched2
14671 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14672 after the basic block scheduling passes.
14673
14674 @item -fdump-rtl-ree
14675 @opindex fdump-rtl-ree
14676 Dump after sign/zero extension elimination.
14677
14678 @item -fdump-rtl-seqabstr
14679 @opindex fdump-rtl-seqabstr
14680 Dump after common sequence discovery.
14681
14682 @item -fdump-rtl-shorten
14683 @opindex fdump-rtl-shorten
14684 Dump after shortening branches.
14685
14686 @item -fdump-rtl-sibling
14687 @opindex fdump-rtl-sibling
14688 Dump after sibling call optimizations.
14689
14690 @item -fdump-rtl-split1
14691 @itemx -fdump-rtl-split2
14692 @itemx -fdump-rtl-split3
14693 @itemx -fdump-rtl-split4
14694 @itemx -fdump-rtl-split5
14695 @opindex fdump-rtl-split1
14696 @opindex fdump-rtl-split2
14697 @opindex fdump-rtl-split3
14698 @opindex fdump-rtl-split4
14699 @opindex fdump-rtl-split5
14700 These options enable dumping after five rounds of
14701 instruction splitting.
14702
14703 @item -fdump-rtl-sms
14704 @opindex fdump-rtl-sms
14705 Dump after modulo scheduling. This pass is only run on some
14706 architectures.
14707
14708 @item -fdump-rtl-stack
14709 @opindex fdump-rtl-stack
14710 Dump after conversion from GCC's ``flat register file'' registers to the
14711 x87's stack-like registers. This pass is only run on x86 variants.
14712
14713 @item -fdump-rtl-subreg1
14714 @itemx -fdump-rtl-subreg2
14715 @opindex fdump-rtl-subreg1
14716 @opindex fdump-rtl-subreg2
14717 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14718 the two subreg expansion passes.
14719
14720 @item -fdump-rtl-unshare
14721 @opindex fdump-rtl-unshare
14722 Dump after all rtl has been unshared.
14723
14724 @item -fdump-rtl-vartrack
14725 @opindex fdump-rtl-vartrack
14726 Dump after variable tracking.
14727
14728 @item -fdump-rtl-vregs
14729 @opindex fdump-rtl-vregs
14730 Dump after converting virtual registers to hard registers.
14731
14732 @item -fdump-rtl-web
14733 @opindex fdump-rtl-web
14734 Dump after live range splitting.
14735
14736 @item -fdump-rtl-regclass
14737 @itemx -fdump-rtl-subregs_of_mode_init
14738 @itemx -fdump-rtl-subregs_of_mode_finish
14739 @itemx -fdump-rtl-dfinit
14740 @itemx -fdump-rtl-dfinish
14741 @opindex fdump-rtl-regclass
14742 @opindex fdump-rtl-subregs_of_mode_init
14743 @opindex fdump-rtl-subregs_of_mode_finish
14744 @opindex fdump-rtl-dfinit
14745 @opindex fdump-rtl-dfinish
14746 These dumps are defined but always produce empty files.
14747
14748 @item -da
14749 @itemx -fdump-rtl-all
14750 @opindex da
14751 @opindex fdump-rtl-all
14752 Produce all the dumps listed above.
14753
14754 @item -dA
14755 @opindex dA
14756 Annotate the assembler output with miscellaneous debugging information.
14757
14758 @item -dD
14759 @opindex dD
14760 Dump all macro definitions, at the end of preprocessing, in addition to
14761 normal output.
14762
14763 @item -dH
14764 @opindex dH
14765 Produce a core dump whenever an error occurs.
14766
14767 @item -dp
14768 @opindex dp
14769 Annotate the assembler output with a comment indicating which
14770 pattern and alternative is used. The length and cost of each instruction are
14771 also printed.
14772
14773 @item -dP
14774 @opindex dP
14775 Dump the RTL in the assembler output as a comment before each instruction.
14776 Also turns on @option{-dp} annotation.
14777
14778 @item -dx
14779 @opindex dx
14780 Just generate RTL for a function instead of compiling it. Usually used
14781 with @option{-fdump-rtl-expand}.
14782 @end table
14783
14784 @item -fdump-debug
14785 @opindex fdump-debug
14786 Dump debugging information generated during the debug
14787 generation phase.
14788
14789 @item -fdump-earlydebug
14790 @opindex fdump-earlydebug
14791 Dump debugging information generated during the early debug
14792 generation phase.
14793
14794 @item -fdump-noaddr
14795 @opindex fdump-noaddr
14796 When doing debugging dumps, suppress address output. This makes it more
14797 feasible to use diff on debugging dumps for compiler invocations with
14798 different compiler binaries and/or different
14799 text / bss / data / heap / stack / dso start locations.
14800
14801 @item -freport-bug
14802 @opindex freport-bug
14803 Collect and dump debug information into a temporary file if an
14804 internal compiler error (ICE) occurs.
14805
14806 @item -fdump-unnumbered
14807 @opindex fdump-unnumbered
14808 When doing debugging dumps, suppress instruction numbers and address output.
14809 This makes it more feasible to use diff on debugging dumps for compiler
14810 invocations with different options, in particular with and without
14811 @option{-g}.
14812
14813 @item -fdump-unnumbered-links
14814 @opindex fdump-unnumbered-links
14815 When doing debugging dumps (see @option{-d} option above), suppress
14816 instruction numbers for the links to the previous and next instructions
14817 in a sequence.
14818
14819 @item -fdump-ipa-@var{switch}
14820 @itemx -fdump-ipa-@var{switch}-@var{options}
14821 @opindex fdump-ipa
14822 Control the dumping at various stages of inter-procedural analysis
14823 language tree to a file. The file name is generated by appending a
14824 switch specific suffix to the source file name, and the file is created
14825 in the same directory as the output file. The following dumps are
14826 possible:
14827
14828 @table @samp
14829 @item all
14830 Enables all inter-procedural analysis dumps.
14831
14832 @item cgraph
14833 Dumps information about call-graph optimization, unused function removal,
14834 and inlining decisions.
14835
14836 @item inline
14837 Dump after function inlining.
14838
14839 @end table
14840
14841 Additionally, the options @option{-optimized}, @option{-missed},
14842 @option{-note}, and @option{-all} can be provided, with the same meaning
14843 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14844
14845 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14846 information on callsites that were inlined, along with callsites
14847 that were not inlined.
14848
14849 By default, the dump will contain messages about successful
14850 optimizations (equivalent to @option{-optimized}) together with
14851 low-level details about the analysis.
14852
14853 @item -fdump-lang-all
14854 @itemx -fdump-lang-@var{switch}
14855 @itemx -fdump-lang-@var{switch}-@var{options}
14856 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14857 @opindex fdump-lang-all
14858 @opindex fdump-lang
14859 Control the dumping of language-specific information. The @var{options}
14860 and @var{filename} portions behave as described in the
14861 @option{-fdump-tree} option. The following @var{switch} values are
14862 accepted:
14863
14864 @table @samp
14865 @item all
14866
14867 Enable all language-specific dumps.
14868
14869 @item class
14870 Dump class hierarchy information. Virtual table information is emitted
14871 unless '@option{slim}' is specified. This option is applicable to C++ only.
14872
14873 @item raw
14874 Dump the raw internal tree data. This option is applicable to C++ only.
14875
14876 @end table
14877
14878 @item -fdump-passes
14879 @opindex fdump-passes
14880 Print on @file{stderr} the list of optimization passes that are turned
14881 on and off by the current command-line options.
14882
14883 @item -fdump-statistics-@var{option}
14884 @opindex fdump-statistics
14885 Enable and control dumping of pass statistics in a separate file. The
14886 file name is generated by appending a suffix ending in
14887 @samp{.statistics} to the source file name, and the file is created in
14888 the same directory as the output file. If the @samp{-@var{option}}
14889 form is used, @samp{-stats} causes counters to be summed over the
14890 whole compilation unit while @samp{-details} dumps every event as
14891 the passes generate them. The default with no option is to sum
14892 counters for each function compiled.
14893
14894 @item -fdump-tree-all
14895 @itemx -fdump-tree-@var{switch}
14896 @itemx -fdump-tree-@var{switch}-@var{options}
14897 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14898 @opindex fdump-tree-all
14899 @opindex fdump-tree
14900 Control the dumping at various stages of processing the intermediate
14901 language tree to a file. If the @samp{-@var{options}}
14902 form is used, @var{options} is a list of @samp{-} separated options
14903 which control the details of the dump. Not all options are applicable
14904 to all dumps; those that are not meaningful are ignored. The
14905 following options are available
14906
14907 @table @samp
14908 @item address
14909 Print the address of each node. Usually this is not meaningful as it
14910 changes according to the environment and source file. Its primary use
14911 is for tying up a dump file with a debug environment.
14912 @item asmname
14913 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14914 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14915 use working backward from mangled names in the assembly file.
14916 @item slim
14917 When dumping front-end intermediate representations, inhibit dumping
14918 of members of a scope or body of a function merely because that scope
14919 has been reached. Only dump such items when they are directly reachable
14920 by some other path.
14921
14922 When dumping pretty-printed trees, this option inhibits dumping the
14923 bodies of control structures.
14924
14925 When dumping RTL, print the RTL in slim (condensed) form instead of
14926 the default LISP-like representation.
14927 @item raw
14928 Print a raw representation of the tree. By default, trees are
14929 pretty-printed into a C-like representation.
14930 @item details
14931 Enable more detailed dumps (not honored by every dump option). Also
14932 include information from the optimization passes.
14933 @item stats
14934 Enable dumping various statistics about the pass (not honored by every dump
14935 option).
14936 @item blocks
14937 Enable showing basic block boundaries (disabled in raw dumps).
14938 @item graph
14939 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14940 dump a representation of the control flow graph suitable for viewing with
14941 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14942 the file is pretty-printed as a subgraph, so that GraphViz can render them
14943 all in a single plot.
14944
14945 This option currently only works for RTL dumps, and the RTL is always
14946 dumped in slim form.
14947 @item vops
14948 Enable showing virtual operands for every statement.
14949 @item lineno
14950 Enable showing line numbers for statements.
14951 @item uid
14952 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14953 @item verbose
14954 Enable showing the tree dump for each statement.
14955 @item eh
14956 Enable showing the EH region number holding each statement.
14957 @item scev
14958 Enable showing scalar evolution analysis details.
14959 @item optimized
14960 Enable showing optimization information (only available in certain
14961 passes).
14962 @item missed
14963 Enable showing missed optimization information (only available in certain
14964 passes).
14965 @item note
14966 Enable other detailed optimization information (only available in
14967 certain passes).
14968 @item all
14969 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14970 and @option{lineno}.
14971 @item optall
14972 Turn on all optimization options, i.e., @option{optimized},
14973 @option{missed}, and @option{note}.
14974 @end table
14975
14976 To determine what tree dumps are available or find the dump for a pass
14977 of interest follow the steps below.
14978
14979 @enumerate
14980 @item
14981 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14982 look for a code that corresponds to the pass you are interested in.
14983 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14984 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14985 The number at the end distinguishes distinct invocations of the same pass.
14986 @item
14987 To enable the creation of the dump file, append the pass code to
14988 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14989 to enable the dump from the Early Value Range Propagation pass, invoke
14990 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14991 specify the name of the dump file. If you don't specify one, GCC
14992 creates as described below.
14993 @item
14994 Find the pass dump in a file whose name is composed of three components
14995 separated by a period: the name of the source file GCC was invoked to
14996 compile, a numeric suffix indicating the pass number followed by the
14997 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14998 and finally the pass code. For example, the Early VRP pass dump might
14999 be in a file named @file{myfile.c.038t.evrp} in the current working
15000 directory. Note that the numeric codes are not stable and may change
15001 from one version of GCC to another.
15002 @end enumerate
15003
15004 @item -fopt-info
15005 @itemx -fopt-info-@var{options}
15006 @itemx -fopt-info-@var{options}=@var{filename}
15007 @opindex fopt-info
15008 Controls optimization dumps from various optimization passes. If the
15009 @samp{-@var{options}} form is used, @var{options} is a list of
15010 @samp{-} separated option keywords to select the dump details and
15011 optimizations.
15012
15013 The @var{options} can be divided into three groups:
15014 @enumerate
15015 @item
15016 options describing what kinds of messages should be emitted,
15017 @item
15018 options describing the verbosity of the dump, and
15019 @item
15020 options describing which optimizations should be included.
15021 @end enumerate
15022 The options from each group can be freely mixed as they are
15023 non-overlapping. However, in case of any conflicts,
15024 the later options override the earlier options on the command
15025 line.
15026
15027 The following options control which kinds of messages should be emitted:
15028
15029 @table @samp
15030 @item optimized
15031 Print information when an optimization is successfully applied. It is
15032 up to a pass to decide which information is relevant. For example, the
15033 vectorizer passes print the source location of loops which are
15034 successfully vectorized.
15035 @item missed
15036 Print information about missed optimizations. Individual passes
15037 control which information to include in the output.
15038 @item note
15039 Print verbose information about optimizations, such as certain
15040 transformations, more detailed messages about decisions etc.
15041 @item all
15042 Print detailed optimization information. This includes
15043 @samp{optimized}, @samp{missed}, and @samp{note}.
15044 @end table
15045
15046 The following option controls the dump verbosity:
15047
15048 @table @samp
15049 @item internals
15050 By default, only ``high-level'' messages are emitted. This option enables
15051 additional, more detailed, messages, which are likely to only be of interest
15052 to GCC developers.
15053 @end table
15054
15055 One or more of the following option keywords can be used to describe a
15056 group of optimizations:
15057
15058 @table @samp
15059 @item ipa
15060 Enable dumps from all interprocedural optimizations.
15061 @item loop
15062 Enable dumps from all loop optimizations.
15063 @item inline
15064 Enable dumps from all inlining optimizations.
15065 @item omp
15066 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15067 @item vec
15068 Enable dumps from all vectorization optimizations.
15069 @item optall
15070 Enable dumps from all optimizations. This is a superset of
15071 the optimization groups listed above.
15072 @end table
15073
15074 If @var{options} is
15075 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15076 about successful optimizations from all the passes, omitting messages
15077 that are treated as ``internals''.
15078
15079 If the @var{filename} is provided, then the dumps from all the
15080 applicable optimizations are concatenated into the @var{filename}.
15081 Otherwise the dump is output onto @file{stderr}. Though multiple
15082 @option{-fopt-info} options are accepted, only one of them can include
15083 a @var{filename}. If other filenames are provided then all but the
15084 first such option are ignored.
15085
15086 Note that the output @var{filename} is overwritten
15087 in case of multiple translation units. If a combined output from
15088 multiple translation units is desired, @file{stderr} should be used
15089 instead.
15090
15091 In the following example, the optimization info is output to
15092 @file{stderr}:
15093
15094 @smallexample
15095 gcc -O3 -fopt-info
15096 @end smallexample
15097
15098 This example:
15099 @smallexample
15100 gcc -O3 -fopt-info-missed=missed.all
15101 @end smallexample
15102
15103 @noindent
15104 outputs missed optimization report from all the passes into
15105 @file{missed.all}, and this one:
15106
15107 @smallexample
15108 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15109 @end smallexample
15110
15111 @noindent
15112 prints information about missed optimization opportunities from
15113 vectorization passes on @file{stderr}.
15114 Note that @option{-fopt-info-vec-missed} is equivalent to
15115 @option{-fopt-info-missed-vec}. The order of the optimization group
15116 names and message types listed after @option{-fopt-info} does not matter.
15117
15118 As another example,
15119 @smallexample
15120 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15121 @end smallexample
15122
15123 @noindent
15124 outputs information about missed optimizations as well as
15125 optimized locations from all the inlining passes into
15126 @file{inline.txt}.
15127
15128 Finally, consider:
15129
15130 @smallexample
15131 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15132 @end smallexample
15133
15134 @noindent
15135 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15136 in conflict since only one output file is allowed. In this case, only
15137 the first option takes effect and the subsequent options are
15138 ignored. Thus only @file{vec.miss} is produced which contains
15139 dumps from the vectorizer about missed opportunities.
15140
15141 @item -fsave-optimization-record
15142 @opindex fsave-optimization-record
15143 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15144 were performed, for those optimizations that support @option{-fopt-info}.
15145
15146 This option is experimental and the format of the data within the
15147 compressed JSON file is subject to change.
15148
15149 It is roughly equivalent to a machine-readable version of
15150 @option{-fopt-info-all}, as a collection of messages with source file,
15151 line number and column number, with the following additional data for
15152 each message:
15153
15154 @itemize @bullet
15155
15156 @item
15157 the execution count of the code being optimized, along with metadata about
15158 whether this was from actual profile data, or just an estimate, allowing
15159 consumers to prioritize messages by code hotness,
15160
15161 @item
15162 the function name of the code being optimized, where applicable,
15163
15164 @item
15165 the ``inlining chain'' for the code being optimized, so that when
15166 a function is inlined into several different places (which might
15167 themselves be inlined), the reader can distinguish between the copies,
15168
15169 @item
15170 objects identifying those parts of the message that refer to expressions,
15171 statements or symbol-table nodes, which of these categories they are, and,
15172 when available, their source code location,
15173
15174 @item
15175 the GCC pass that emitted the message, and
15176
15177 @item
15178 the location in GCC's own code from which the message was emitted
15179
15180 @end itemize
15181
15182 Additionally, some messages are logically nested within other
15183 messages, reflecting implementation details of the optimization
15184 passes.
15185
15186 @item -fsched-verbose=@var{n}
15187 @opindex fsched-verbose
15188 On targets that use instruction scheduling, this option controls the
15189 amount of debugging output the scheduler prints to the dump files.
15190
15191 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15192 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15193 For @var{n} greater than one, it also output basic block probabilities,
15194 detailed ready list information and unit/insn info. For @var{n} greater
15195 than two, it includes RTL at abort point, control-flow and regions info.
15196 And for @var{n} over four, @option{-fsched-verbose} also includes
15197 dependence info.
15198
15199
15200
15201 @item -fenable-@var{kind}-@var{pass}
15202 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15203 @opindex fdisable-
15204 @opindex fenable-
15205
15206 This is a set of options that are used to explicitly disable/enable
15207 optimization passes. These options are intended for use for debugging GCC.
15208 Compiler users should use regular options for enabling/disabling
15209 passes instead.
15210
15211 @table @gcctabopt
15212
15213 @item -fdisable-ipa-@var{pass}
15214 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15215 statically invoked in the compiler multiple times, the pass name should be
15216 appended with a sequential number starting from 1.
15217
15218 @item -fdisable-rtl-@var{pass}
15219 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15220 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15221 statically invoked in the compiler multiple times, the pass name should be
15222 appended with a sequential number starting from 1. @var{range-list} is a
15223 comma-separated list of function ranges or assembler names. Each range is a number
15224 pair separated by a colon. The range is inclusive in both ends. If the range
15225 is trivial, the number pair can be simplified as a single number. If the
15226 function's call graph node's @var{uid} falls within one of the specified ranges,
15227 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15228 function header of a dump file, and the pass names can be dumped by using
15229 option @option{-fdump-passes}.
15230
15231 @item -fdisable-tree-@var{pass}
15232 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15233 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15234 option arguments.
15235
15236 @item -fenable-ipa-@var{pass}
15237 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15238 statically invoked in the compiler multiple times, the pass name should be
15239 appended with a sequential number starting from 1.
15240
15241 @item -fenable-rtl-@var{pass}
15242 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15243 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15244 description and examples.
15245
15246 @item -fenable-tree-@var{pass}
15247 @itemx -fenable-tree-@var{pass}=@var{range-list}
15248 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15249 of option arguments.
15250
15251 @end table
15252
15253 Here are some examples showing uses of these options.
15254
15255 @smallexample
15256
15257 # disable ccp1 for all functions
15258 -fdisable-tree-ccp1
15259 # disable complete unroll for function whose cgraph node uid is 1
15260 -fenable-tree-cunroll=1
15261 # disable gcse2 for functions at the following ranges [1,1],
15262 # [300,400], and [400,1000]
15263 # disable gcse2 for functions foo and foo2
15264 -fdisable-rtl-gcse2=foo,foo2
15265 # disable early inlining
15266 -fdisable-tree-einline
15267 # disable ipa inlining
15268 -fdisable-ipa-inline
15269 # enable tree full unroll
15270 -fenable-tree-unroll
15271
15272 @end smallexample
15273
15274 @item -fchecking
15275 @itemx -fchecking=@var{n}
15276 @opindex fchecking
15277 @opindex fno-checking
15278 Enable internal consistency checking. The default depends on
15279 the compiler configuration. @option{-fchecking=2} enables further
15280 internal consistency checking that might affect code generation.
15281
15282 @item -frandom-seed=@var{string}
15283 @opindex frandom-seed
15284 This option provides a seed that GCC uses in place of
15285 random numbers in generating certain symbol names
15286 that have to be different in every compiled file. It is also used to
15287 place unique stamps in coverage data files and the object files that
15288 produce them. You can use the @option{-frandom-seed} option to produce
15289 reproducibly identical object files.
15290
15291 The @var{string} can either be a number (decimal, octal or hex) or an
15292 arbitrary string (in which case it's converted to a number by
15293 computing CRC32).
15294
15295 The @var{string} should be different for every file you compile.
15296
15297 @item -save-temps
15298 @itemx -save-temps=cwd
15299 @opindex save-temps
15300 Store the usual ``temporary'' intermediate files permanently; place them
15301 in the current directory and name them based on the source file. Thus,
15302 compiling @file{foo.c} with @option{-c -save-temps} produces files
15303 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15304 preprocessed @file{foo.i} output file even though the compiler now
15305 normally uses an integrated preprocessor.
15306
15307 When used in combination with the @option{-x} command-line option,
15308 @option{-save-temps} is sensible enough to avoid over writing an
15309 input source file with the same extension as an intermediate file.
15310 The corresponding intermediate file may be obtained by renaming the
15311 source file before using @option{-save-temps}.
15312
15313 If you invoke GCC in parallel, compiling several different source
15314 files that share a common base name in different subdirectories or the
15315 same source file compiled for multiple output destinations, it is
15316 likely that the different parallel compilers will interfere with each
15317 other, and overwrite the temporary files. For instance:
15318
15319 @smallexample
15320 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15321 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15322 @end smallexample
15323
15324 may result in @file{foo.i} and @file{foo.o} being written to
15325 simultaneously by both compilers.
15326
15327 @item -save-temps=obj
15328 @opindex save-temps=obj
15329 Store the usual ``temporary'' intermediate files permanently. If the
15330 @option{-o} option is used, the temporary files are based on the
15331 object file. If the @option{-o} option is not used, the
15332 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15333
15334 For example:
15335
15336 @smallexample
15337 gcc -save-temps=obj -c foo.c
15338 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15339 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15340 @end smallexample
15341
15342 @noindent
15343 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15344 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15345 @file{dir2/yfoobar.o}.
15346
15347 @item -time@r{[}=@var{file}@r{]}
15348 @opindex time
15349 Report the CPU time taken by each subprocess in the compilation
15350 sequence. For C source files, this is the compiler proper and assembler
15351 (plus the linker if linking is done).
15352
15353 Without the specification of an output file, the output looks like this:
15354
15355 @smallexample
15356 # cc1 0.12 0.01
15357 # as 0.00 0.01
15358 @end smallexample
15359
15360 The first number on each line is the ``user time'', that is time spent
15361 executing the program itself. The second number is ``system time'',
15362 time spent executing operating system routines on behalf of the program.
15363 Both numbers are in seconds.
15364
15365 With the specification of an output file, the output is appended to the
15366 named file, and it looks like this:
15367
15368 @smallexample
15369 0.12 0.01 cc1 @var{options}
15370 0.00 0.01 as @var{options}
15371 @end smallexample
15372
15373 The ``user time'' and the ``system time'' are moved before the program
15374 name, and the options passed to the program are displayed, so that one
15375 can later tell what file was being compiled, and with which options.
15376
15377 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15378 @opindex fdump-final-insns
15379 Dump the final internal representation (RTL) to @var{file}. If the
15380 optional argument is omitted (or if @var{file} is @code{.}), the name
15381 of the dump file is determined by appending @code{.gkd} to the
15382 compilation output file name.
15383
15384 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15385 @opindex fcompare-debug
15386 @opindex fno-compare-debug
15387 If no error occurs during compilation, run the compiler a second time,
15388 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15389 passed to the second compilation. Dump the final internal
15390 representation in both compilations, and print an error if they differ.
15391
15392 If the equal sign is omitted, the default @option{-gtoggle} is used.
15393
15394 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15395 and nonzero, implicitly enables @option{-fcompare-debug}. If
15396 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15397 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15398 is used.
15399
15400 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15401 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15402 of the final representation and the second compilation, preventing even
15403 @env{GCC_COMPARE_DEBUG} from taking effect.
15404
15405 To verify full coverage during @option{-fcompare-debug} testing, set
15406 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15407 which GCC rejects as an invalid option in any actual compilation
15408 (rather than preprocessing, assembly or linking). To get just a
15409 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15410 not overridden} will do.
15411
15412 @item -fcompare-debug-second
15413 @opindex fcompare-debug-second
15414 This option is implicitly passed to the compiler for the second
15415 compilation requested by @option{-fcompare-debug}, along with options to
15416 silence warnings, and omitting other options that would cause the compiler
15417 to produce output to files or to standard output as a side effect. Dump
15418 files and preserved temporary files are renamed so as to contain the
15419 @code{.gk} additional extension during the second compilation, to avoid
15420 overwriting those generated by the first.
15421
15422 When this option is passed to the compiler driver, it causes the
15423 @emph{first} compilation to be skipped, which makes it useful for little
15424 other than debugging the compiler proper.
15425
15426 @item -gtoggle
15427 @opindex gtoggle
15428 Turn off generation of debug info, if leaving out this option
15429 generates it, or turn it on at level 2 otherwise. The position of this
15430 argument in the command line does not matter; it takes effect after all
15431 other options are processed, and it does so only once, no matter how
15432 many times it is given. This is mainly intended to be used with
15433 @option{-fcompare-debug}.
15434
15435 @item -fvar-tracking-assignments-toggle
15436 @opindex fvar-tracking-assignments-toggle
15437 @opindex fno-var-tracking-assignments-toggle
15438 Toggle @option{-fvar-tracking-assignments}, in the same way that
15439 @option{-gtoggle} toggles @option{-g}.
15440
15441 @item -Q
15442 @opindex Q
15443 Makes the compiler print out each function name as it is compiled, and
15444 print some statistics about each pass when it finishes.
15445
15446 @item -ftime-report
15447 @opindex ftime-report
15448 Makes the compiler print some statistics about the time consumed by each
15449 pass when it finishes.
15450
15451 @item -ftime-report-details
15452 @opindex ftime-report-details
15453 Record the time consumed by infrastructure parts separately for each pass.
15454
15455 @item -fira-verbose=@var{n}
15456 @opindex fira-verbose
15457 Control the verbosity of the dump file for the integrated register allocator.
15458 The default value is 5. If the value @var{n} is greater or equal to 10,
15459 the dump output is sent to stderr using the same format as @var{n} minus 10.
15460
15461 @item -flto-report
15462 @opindex flto-report
15463 Prints a report with internal details on the workings of the link-time
15464 optimizer. The contents of this report vary from version to version.
15465 It is meant to be useful to GCC developers when processing object
15466 files in LTO mode (via @option{-flto}).
15467
15468 Disabled by default.
15469
15470 @item -flto-report-wpa
15471 @opindex flto-report-wpa
15472 Like @option{-flto-report}, but only print for the WPA phase of link-time
15473 optimization.
15474
15475 @item -fmem-report
15476 @opindex fmem-report
15477 Makes the compiler print some statistics about permanent memory
15478 allocation when it finishes.
15479
15480 @item -fmem-report-wpa
15481 @opindex fmem-report-wpa
15482 Makes the compiler print some statistics about permanent memory
15483 allocation for the WPA phase only.
15484
15485 @item -fpre-ipa-mem-report
15486 @opindex fpre-ipa-mem-report
15487 @item -fpost-ipa-mem-report
15488 @opindex fpost-ipa-mem-report
15489 Makes the compiler print some statistics about permanent memory
15490 allocation before or after interprocedural optimization.
15491
15492 @item -fprofile-report
15493 @opindex fprofile-report
15494 Makes the compiler print some statistics about consistency of the
15495 (estimated) profile and effect of individual passes.
15496
15497 @item -fstack-usage
15498 @opindex fstack-usage
15499 Makes the compiler output stack usage information for the program, on a
15500 per-function basis. The filename for the dump is made by appending
15501 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15502 the output file, if explicitly specified and it is not an executable,
15503 otherwise it is the basename of the source file. An entry is made up
15504 of three fields:
15505
15506 @itemize
15507 @item
15508 The name of the function.
15509 @item
15510 A number of bytes.
15511 @item
15512 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15513 @end itemize
15514
15515 The qualifier @code{static} means that the function manipulates the stack
15516 statically: a fixed number of bytes are allocated for the frame on function
15517 entry and released on function exit; no stack adjustments are otherwise made
15518 in the function. The second field is this fixed number of bytes.
15519
15520 The qualifier @code{dynamic} means that the function manipulates the stack
15521 dynamically: in addition to the static allocation described above, stack
15522 adjustments are made in the body of the function, for example to push/pop
15523 arguments around function calls. If the qualifier @code{bounded} is also
15524 present, the amount of these adjustments is bounded at compile time and
15525 the second field is an upper bound of the total amount of stack used by
15526 the function. If it is not present, the amount of these adjustments is
15527 not bounded at compile time and the second field only represents the
15528 bounded part.
15529
15530 @item -fstats
15531 @opindex fstats
15532 Emit statistics about front-end processing at the end of the compilation.
15533 This option is supported only by the C++ front end, and
15534 the information is generally only useful to the G++ development team.
15535
15536 @item -fdbg-cnt-list
15537 @opindex fdbg-cnt-list
15538 Print the name and the counter upper bound for all debug counters.
15539
15540
15541 @item -fdbg-cnt=@var{counter-value-list}
15542 @opindex fdbg-cnt
15543 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15544 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15545 tuples which sets the lower and the upper bound of each debug
15546 counter @var{name}. The @var{lower_bound} is optional and is zero
15547 initialized if not set.
15548 All debug counters have the initial upper bound of @code{UINT_MAX};
15549 thus @code{dbg_cnt} returns true always unless the upper bound
15550 is set by this option.
15551 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15552 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15553 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15554
15555 @item -print-file-name=@var{library}
15556 @opindex print-file-name
15557 Print the full absolute name of the library file @var{library} that
15558 would be used when linking---and don't do anything else. With this
15559 option, GCC does not compile or link anything; it just prints the
15560 file name.
15561
15562 @item -print-multi-directory
15563 @opindex print-multi-directory
15564 Print the directory name corresponding to the multilib selected by any
15565 other switches present in the command line. This directory is supposed
15566 to exist in @env{GCC_EXEC_PREFIX}.
15567
15568 @item -print-multi-lib
15569 @opindex print-multi-lib
15570 Print the mapping from multilib directory names to compiler switches
15571 that enable them. The directory name is separated from the switches by
15572 @samp{;}, and each switch starts with an @samp{@@} instead of the
15573 @samp{-}, without spaces between multiple switches. This is supposed to
15574 ease shell processing.
15575
15576 @item -print-multi-os-directory
15577 @opindex print-multi-os-directory
15578 Print the path to OS libraries for the selected
15579 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15580 present in the @file{lib} subdirectory and no multilibs are used, this is
15581 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15582 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15583 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15584 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15585
15586 @item -print-multiarch
15587 @opindex print-multiarch
15588 Print the path to OS libraries for the selected multiarch,
15589 relative to some @file{lib} subdirectory.
15590
15591 @item -print-prog-name=@var{program}
15592 @opindex print-prog-name
15593 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15594
15595 @item -print-libgcc-file-name
15596 @opindex print-libgcc-file-name
15597 Same as @option{-print-file-name=libgcc.a}.
15598
15599 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15600 but you do want to link with @file{libgcc.a}. You can do:
15601
15602 @smallexample
15603 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15604 @end smallexample
15605
15606 @item -print-search-dirs
15607 @opindex print-search-dirs
15608 Print the name of the configured installation directory and a list of
15609 program and library directories @command{gcc} searches---and don't do anything else.
15610
15611 This is useful when @command{gcc} prints the error message
15612 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15613 To resolve this you either need to put @file{cpp0} and the other compiler
15614 components where @command{gcc} expects to find them, or you can set the environment
15615 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15616 Don't forget the trailing @samp{/}.
15617 @xref{Environment Variables}.
15618
15619 @item -print-sysroot
15620 @opindex print-sysroot
15621 Print the target sysroot directory that is used during
15622 compilation. This is the target sysroot specified either at configure
15623 time or using the @option{--sysroot} option, possibly with an extra
15624 suffix that depends on compilation options. If no target sysroot is
15625 specified, the option prints nothing.
15626
15627 @item -print-sysroot-headers-suffix
15628 @opindex print-sysroot-headers-suffix
15629 Print the suffix added to the target sysroot when searching for
15630 headers, or give an error if the compiler is not configured with such
15631 a suffix---and don't do anything else.
15632
15633 @item -dumpmachine
15634 @opindex dumpmachine
15635 Print the compiler's target machine (for example,
15636 @samp{i686-pc-linux-gnu})---and don't do anything else.
15637
15638 @item -dumpversion
15639 @opindex dumpversion
15640 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15641 anything else. This is the compiler version used in filesystem paths and
15642 specs. Depending on how the compiler has been configured it can be just
15643 a single number (major version), two numbers separated by a dot (major and
15644 minor version) or three numbers separated by dots (major, minor and patchlevel
15645 version).
15646
15647 @item -dumpfullversion
15648 @opindex dumpfullversion
15649 Print the full compiler version---and don't do anything else. The output is
15650 always three numbers separated by dots, major, minor and patchlevel version.
15651
15652 @item -dumpspecs
15653 @opindex dumpspecs
15654 Print the compiler's built-in specs---and don't do anything else. (This
15655 is used when GCC itself is being built.) @xref{Spec Files}.
15656 @end table
15657
15658 @node Submodel Options
15659 @section Machine-Dependent Options
15660 @cindex submodel options
15661 @cindex specifying hardware config
15662 @cindex hardware models and configurations, specifying
15663 @cindex target-dependent options
15664 @cindex machine-dependent options
15665
15666 Each target machine supported by GCC can have its own options---for
15667 example, to allow you to compile for a particular processor variant or
15668 ABI, or to control optimizations specific to that machine. By
15669 convention, the names of machine-specific options start with
15670 @samp{-m}.
15671
15672 Some configurations of the compiler also support additional target-specific
15673 options, usually for compatibility with other compilers on the same
15674 platform.
15675
15676 @c This list is ordered alphanumerically by subsection name.
15677 @c It should be the same order and spelling as these options are listed
15678 @c in Machine Dependent Options
15679
15680 @menu
15681 * AArch64 Options::
15682 * Adapteva Epiphany Options::
15683 * AMD GCN Options::
15684 * ARC Options::
15685 * ARM Options::
15686 * AVR Options::
15687 * Blackfin Options::
15688 * C6X Options::
15689 * CRIS Options::
15690 * CR16 Options::
15691 * C-SKY Options::
15692 * Darwin Options::
15693 * DEC Alpha Options::
15694 * eBPF Options::
15695 * FR30 Options::
15696 * FT32 Options::
15697 * FRV Options::
15698 * GNU/Linux Options::
15699 * H8/300 Options::
15700 * HPPA Options::
15701 * IA-64 Options::
15702 * LM32 Options::
15703 * M32C Options::
15704 * M32R/D Options::
15705 * M680x0 Options::
15706 * MCore Options::
15707 * MeP Options::
15708 * MicroBlaze Options::
15709 * MIPS Options::
15710 * MMIX Options::
15711 * MN10300 Options::
15712 * Moxie Options::
15713 * MSP430 Options::
15714 * NDS32 Options::
15715 * Nios II Options::
15716 * Nvidia PTX Options::
15717 * OpenRISC Options::
15718 * PDP-11 Options::
15719 * picoChip Options::
15720 * PowerPC Options::
15721 * PRU Options::
15722 * RISC-V Options::
15723 * RL78 Options::
15724 * RS/6000 and PowerPC Options::
15725 * RX Options::
15726 * S/390 and zSeries Options::
15727 * Score Options::
15728 * SH Options::
15729 * Solaris 2 Options::
15730 * SPARC Options::
15731 * System V Options::
15732 * TILE-Gx Options::
15733 * TILEPro Options::
15734 * V850 Options::
15735 * VAX Options::
15736 * Visium Options::
15737 * VMS Options::
15738 * VxWorks Options::
15739 * x86 Options::
15740 * x86 Windows Options::
15741 * Xstormy16 Options::
15742 * Xtensa Options::
15743 * zSeries Options::
15744 @end menu
15745
15746 @node AArch64 Options
15747 @subsection AArch64 Options
15748 @cindex AArch64 Options
15749
15750 These options are defined for AArch64 implementations:
15751
15752 @table @gcctabopt
15753
15754 @item -mabi=@var{name}
15755 @opindex mabi
15756 Generate code for the specified data model. Permissible values
15757 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15758 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15759 but long int and pointers are 64 bits.
15760
15761 The default depends on the specific target configuration. Note that
15762 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15763 entire program with the same ABI, and link with a compatible set of libraries.
15764
15765 @item -mbig-endian
15766 @opindex mbig-endian
15767 Generate big-endian code. This is the default when GCC is configured for an
15768 @samp{aarch64_be-*-*} target.
15769
15770 @item -mgeneral-regs-only
15771 @opindex mgeneral-regs-only
15772 Generate code which uses only the general-purpose registers. This will prevent
15773 the compiler from using floating-point and Advanced SIMD registers but will not
15774 impose any restrictions on the assembler.
15775
15776 @item -mlittle-endian
15777 @opindex mlittle-endian
15778 Generate little-endian code. This is the default when GCC is configured for an
15779 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15780
15781 @item -mcmodel=tiny
15782 @opindex mcmodel=tiny
15783 Generate code for the tiny code model. The program and its statically defined
15784 symbols must be within 1MB of each other. Programs can be statically or
15785 dynamically linked.
15786
15787 @item -mcmodel=small
15788 @opindex mcmodel=small
15789 Generate code for the small code model. The program and its statically defined
15790 symbols must be within 4GB of each other. Programs can be statically or
15791 dynamically linked. This is the default code model.
15792
15793 @item -mcmodel=large
15794 @opindex mcmodel=large
15795 Generate code for the large code model. This makes no assumptions about
15796 addresses and sizes of sections. Programs can be statically linked only.
15797
15798 @item -mstrict-align
15799 @itemx -mno-strict-align
15800 @opindex mstrict-align
15801 @opindex mno-strict-align
15802 Avoid or allow generating memory accesses that may not be aligned on a natural
15803 object boundary as described in the architecture specification.
15804
15805 @item -momit-leaf-frame-pointer
15806 @itemx -mno-omit-leaf-frame-pointer
15807 @opindex momit-leaf-frame-pointer
15808 @opindex mno-omit-leaf-frame-pointer
15809 Omit or keep the frame pointer in leaf functions. The former behavior is the
15810 default.
15811
15812 @item -mstack-protector-guard=@var{guard}
15813 @itemx -mstack-protector-guard-reg=@var{reg}
15814 @itemx -mstack-protector-guard-offset=@var{offset}
15815 @opindex mstack-protector-guard
15816 @opindex mstack-protector-guard-reg
15817 @opindex mstack-protector-guard-offset
15818 Generate stack protection code using canary at @var{guard}. Supported
15819 locations are @samp{global} for a global canary or @samp{sysreg} for a
15820 canary in an appropriate system register.
15821
15822 With the latter choice the options
15823 @option{-mstack-protector-guard-reg=@var{reg}} and
15824 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15825 which system register to use as base register for reading the canary,
15826 and from what offset from that base register. There is no default
15827 register or offset as this is entirely for use within the Linux
15828 kernel.
15829
15830 @item -mstack-protector-guard=@var{guard}
15831 @itemx -mstack-protector-guard-reg=@var{reg}
15832 @itemx -mstack-protector-guard-offset=@var{offset}
15833 @opindex mstack-protector-guard
15834 @opindex mstack-protector-guard-reg
15835 @opindex mstack-protector-guard-offset
15836 Generate stack protection code using canary at @var{guard}. Supported
15837 locations are @samp{global} for a global canary or @samp{sysreg} for a
15838 canary in an appropriate system register.
15839
15840 With the latter choice the options
15841 @option{-mstack-protector-guard-reg=@var{reg}} and
15842 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15843 which system register to use as base register for reading the canary,
15844 and from what offset from that base register. There is no default
15845 register or offset as this is entirely for use within the Linux
15846 kernel.
15847
15848 @item -mtls-dialect=desc
15849 @opindex mtls-dialect=desc
15850 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15851 of TLS variables. This is the default.
15852
15853 @item -mtls-dialect=traditional
15854 @opindex mtls-dialect=traditional
15855 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15856 of TLS variables.
15857
15858 @item -mtls-size=@var{size}
15859 @opindex mtls-size
15860 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15861 This option requires binutils 2.26 or newer.
15862
15863 @item -mfix-cortex-a53-835769
15864 @itemx -mno-fix-cortex-a53-835769
15865 @opindex mfix-cortex-a53-835769
15866 @opindex mno-fix-cortex-a53-835769
15867 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15868 This involves inserting a NOP instruction between memory instructions and
15869 64-bit integer multiply-accumulate instructions.
15870
15871 @item -mfix-cortex-a53-843419
15872 @itemx -mno-fix-cortex-a53-843419
15873 @opindex mfix-cortex-a53-843419
15874 @opindex mno-fix-cortex-a53-843419
15875 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15876 This erratum workaround is made at link time and this will only pass the
15877 corresponding flag to the linker.
15878
15879 @item -mlow-precision-recip-sqrt
15880 @itemx -mno-low-precision-recip-sqrt
15881 @opindex mlow-precision-recip-sqrt
15882 @opindex mno-low-precision-recip-sqrt
15883 Enable or disable the reciprocal square root approximation.
15884 This option only has an effect if @option{-ffast-math} or
15885 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15886 precision of reciprocal square root results to about 16 bits for
15887 single precision and to 32 bits for double precision.
15888
15889 @item -mlow-precision-sqrt
15890 @itemx -mno-low-precision-sqrt
15891 @opindex mlow-precision-sqrt
15892 @opindex mno-low-precision-sqrt
15893 Enable or disable the square root approximation.
15894 This option only has an effect if @option{-ffast-math} or
15895 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15896 precision of square root results to about 16 bits for
15897 single precision and to 32 bits for double precision.
15898 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15899
15900 @item -mlow-precision-div
15901 @itemx -mno-low-precision-div
15902 @opindex mlow-precision-div
15903 @opindex mno-low-precision-div
15904 Enable or disable the division approximation.
15905 This option only has an effect if @option{-ffast-math} or
15906 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15907 precision of division results to about 16 bits for
15908 single precision and to 32 bits for double precision.
15909
15910 @item -mtrack-speculation
15911 @itemx -mno-track-speculation
15912 Enable or disable generation of additional code to track speculative
15913 execution through conditional branches. The tracking state can then
15914 be used by the compiler when expanding calls to
15915 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15916 sequence to be generated.
15917
15918 @item -moutline-atomics
15919 @itemx -mno-outline-atomics
15920 Enable or disable calls to out-of-line helpers to implement atomic operations.
15921 These helpers will, at runtime, determine if the LSE instructions from
15922 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
15923 instructions that are present in the base ARMv8.0 ISA.
15924
15925 This option is only applicable when compiling for the base ARMv8.0
15926 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
15927 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
15928 used directly. The same applies when using @option{-mcpu=} when the
15929 selected cpu supports the @samp{lse} feature.
15930
15931 @item -march=@var{name}
15932 @opindex march
15933 Specify the name of the target architecture and, optionally, one or
15934 more feature modifiers. This option has the form
15935 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15936
15937 The permissible values for @var{arch} are @samp{armv8-a},
15938 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15939 @samp{armv8.5-a} or @var{native}.
15940
15941 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15942 support for the ARMv8.5-A architecture extensions.
15943
15944 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15945 support for the ARMv8.4-A architecture extensions.
15946
15947 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15948 support for the ARMv8.3-A architecture extensions.
15949
15950 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15951 support for the ARMv8.2-A architecture extensions.
15952
15953 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15954 support for the ARMv8.1-A architecture extension. In particular, it
15955 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15956
15957 The value @samp{native} is available on native AArch64 GNU/Linux and
15958 causes the compiler to pick the architecture of the host system. This
15959 option has no effect if the compiler is unable to recognize the
15960 architecture of the host system,
15961
15962 The permissible values for @var{feature} are listed in the sub-section
15963 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15964 Feature Modifiers}. Where conflicting feature modifiers are
15965 specified, the right-most feature is used.
15966
15967 GCC uses @var{name} to determine what kind of instructions it can emit
15968 when generating assembly code. If @option{-march} is specified
15969 without either of @option{-mtune} or @option{-mcpu} also being
15970 specified, the code is tuned to perform well across a range of target
15971 processors implementing the target architecture.
15972
15973 @item -mtune=@var{name}
15974 @opindex mtune
15975 Specify the name of the target processor for which GCC should tune the
15976 performance of the code. Permissible values for this option are:
15977 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15978 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15979 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
15980 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
15981 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15982 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15983 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15984 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15985 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15986 @samp{thunderxt83}, @samp{thunderx2t99},
15987 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15988 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15989 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15990 @samp{native}.
15991
15992 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15993 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15994 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15995 should tune for a big.LITTLE system.
15996
15997 Additionally on native AArch64 GNU/Linux systems the value
15998 @samp{native} tunes performance to the host system. This option has no effect
15999 if the compiler is unable to recognize the processor of the host system.
16000
16001 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16002 are specified, the code is tuned to perform well across a range
16003 of target processors.
16004
16005 This option cannot be suffixed by feature modifiers.
16006
16007 @item -mcpu=@var{name}
16008 @opindex mcpu
16009 Specify the name of the target processor, optionally suffixed by one
16010 or more feature modifiers. This option has the form
16011 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16012 the permissible values for @var{cpu} are the same as those available
16013 for @option{-mtune}. The permissible values for @var{feature} are
16014 documented in the sub-section on
16015 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16016 Feature Modifiers}. Where conflicting feature modifiers are
16017 specified, the right-most feature is used.
16018
16019 GCC uses @var{name} to determine what kind of instructions it can emit when
16020 generating assembly code (as if by @option{-march}) and to determine
16021 the target processor for which to tune for performance (as if
16022 by @option{-mtune}). Where this option is used in conjunction
16023 with @option{-march} or @option{-mtune}, those options take precedence
16024 over the appropriate part of this option.
16025
16026 @item -moverride=@var{string}
16027 @opindex moverride
16028 Override tuning decisions made by the back-end in response to a
16029 @option{-mtune=} switch. The syntax, semantics, and accepted values
16030 for @var{string} in this option are not guaranteed to be consistent
16031 across releases.
16032
16033 This option is only intended to be useful when developing GCC.
16034
16035 @item -mverbose-cost-dump
16036 @opindex mverbose-cost-dump
16037 Enable verbose cost model dumping in the debug dump files. This option is
16038 provided for use in debugging the compiler.
16039
16040 @item -mpc-relative-literal-loads
16041 @itemx -mno-pc-relative-literal-loads
16042 @opindex mpc-relative-literal-loads
16043 @opindex mno-pc-relative-literal-loads
16044 Enable or disable PC-relative literal loads. With this option literal pools are
16045 accessed using a single instruction and emitted after each function. This
16046 limits the maximum size of functions to 1MB. This is enabled by default for
16047 @option{-mcmodel=tiny}.
16048
16049 @item -msign-return-address=@var{scope}
16050 @opindex msign-return-address
16051 Select the function scope on which return address signing will be applied.
16052 Permissible values are @samp{none}, which disables return address signing,
16053 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16054 functions, and @samp{all}, which enables pointer signing for all functions. The
16055 default value is @samp{none}. This option has been deprecated by
16056 -mbranch-protection.
16057
16058 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16059 @opindex mbranch-protection
16060 Select the branch protection features to use.
16061 @samp{none} is the default and turns off all types of branch protection.
16062 @samp{standard} turns on all types of branch protection features. If a feature
16063 has additional tuning options, then @samp{standard} sets it to its standard
16064 level.
16065 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16066 level: signing functions that save the return address to memory (non-leaf
16067 functions will practically always do this) using the a-key. The optional
16068 argument @samp{leaf} can be used to extend the signing to include leaf
16069 functions. The optional argument @samp{b-key} can be used to sign the functions
16070 with the B-key instead of the A-key.
16071 @samp{bti} turns on branch target identification mechanism.
16072
16073 @item -msve-vector-bits=@var{bits}
16074 @opindex msve-vector-bits
16075 Specify the number of bits in an SVE vector register. This option only has
16076 an effect when SVE is enabled.
16077
16078 GCC supports two forms of SVE code generation: ``vector-length
16079 agnostic'' output that works with any size of vector register and
16080 ``vector-length specific'' output that allows GCC to make assumptions
16081 about the vector length when it is useful for optimization reasons.
16082 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16083 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16084 Specifying @samp{scalable} selects vector-length agnostic
16085 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16086 agnostic output. All other values generate vector-length specific code.
16087 The behavior of these values may change in future releases and no value except
16088 @samp{scalable} should be relied on for producing code that is portable across
16089 different hardware SVE vector lengths.
16090
16091 The default is @samp{-msve-vector-bits=scalable}, which produces
16092 vector-length agnostic code.
16093 @end table
16094
16095 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16096 @anchor{aarch64-feature-modifiers}
16097 @cindex @option{-march} feature modifiers
16098 @cindex @option{-mcpu} feature modifiers
16099 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16100 the following and their inverses @option{no@var{feature}}:
16101
16102 @table @samp
16103 @item crc
16104 Enable CRC extension. This is on by default for
16105 @option{-march=armv8.1-a}.
16106 @item crypto
16107 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16108 instructions.
16109 @item fp
16110 Enable floating-point instructions. This is on by default for all possible
16111 values for options @option{-march} and @option{-mcpu}.
16112 @item simd
16113 Enable Advanced SIMD instructions. This also enables floating-point
16114 instructions. This is on by default for all possible values for options
16115 @option{-march} and @option{-mcpu}.
16116 @item sve
16117 Enable Scalable Vector Extension instructions. This also enables Advanced
16118 SIMD and floating-point instructions.
16119 @item lse
16120 Enable Large System Extension instructions. This is on by default for
16121 @option{-march=armv8.1-a}.
16122 @item rdma
16123 Enable Round Double Multiply Accumulate instructions. This is on by default
16124 for @option{-march=armv8.1-a}.
16125 @item fp16
16126 Enable FP16 extension. This also enables floating-point instructions.
16127 @item fp16fml
16128 Enable FP16 fmla extension. This also enables FP16 extensions and
16129 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.
16130
16131 @item rcpc
16132 Enable the RcPc extension. This does not change code generation from GCC,
16133 but is passed on to the assembler, enabling inline asm statements to use
16134 instructions from the RcPc extension.
16135 @item dotprod
16136 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16137 @item aes
16138 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16139 SIMD instructions.
16140 @item sha2
16141 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16142 @item sha3
16143 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16144 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16145 @item sm4
16146 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16147 Use of this option with architectures prior to Armv8.2-A is not supported.
16148 @item profile
16149 Enable the Statistical Profiling extension. This option is only to enable the
16150 extension at the assembler level and does not affect code generation.
16151 @item rng
16152 Enable the Armv8.5-a Random Number instructions. This option is only to
16153 enable the extension at the assembler level and does not affect code
16154 generation.
16155 @item memtag
16156 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16157 enable the extension at the assembler level and does not affect code
16158 generation.
16159 @item sb
16160 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16161 enable the extension at the assembler level and does not affect code
16162 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16163 @item ssbs
16164 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16165 is only to enable the extension at the assembler level and does not affect code
16166 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16167 @item predres
16168 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16169 This option is only to enable the extension at the assembler level and does
16170 not affect code generation. This option is enabled by default for
16171 @item sve2
16172 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16173 instructions.
16174 @item sve2-bitperm
16175 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16176 @item sve2-sm4
16177 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16178 @item sve2-aes
16179 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16180 @item sve2-sha3
16181 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16182 @option{-march=armv8.5-a}.
16183 @item tme
16184 Enable the Transactional Memory Extension.
16185
16186 @end table
16187
16188 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16189 which implies @option{fp}.
16190 Conversely, @option{nofp} implies @option{nosimd}, which implies
16191 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16192
16193 @node Adapteva Epiphany Options
16194 @subsection Adapteva Epiphany Options
16195
16196 These @samp{-m} options are defined for Adapteva Epiphany:
16197
16198 @table @gcctabopt
16199 @item -mhalf-reg-file
16200 @opindex mhalf-reg-file
16201 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16202 That allows code to run on hardware variants that lack these registers.
16203
16204 @item -mprefer-short-insn-regs
16205 @opindex mprefer-short-insn-regs
16206 Preferentially allocate registers that allow short instruction generation.
16207 This can result in increased instruction count, so this may either reduce or
16208 increase overall code size.
16209
16210 @item -mbranch-cost=@var{num}
16211 @opindex mbranch-cost
16212 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16213 This cost is only a heuristic and is not guaranteed to produce
16214 consistent results across releases.
16215
16216 @item -mcmove
16217 @opindex mcmove
16218 Enable the generation of conditional moves.
16219
16220 @item -mnops=@var{num}
16221 @opindex mnops
16222 Emit @var{num} NOPs before every other generated instruction.
16223
16224 @item -mno-soft-cmpsf
16225 @opindex mno-soft-cmpsf
16226 @opindex msoft-cmpsf
16227 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16228 and test the flags. This is faster than a software comparison, but can
16229 get incorrect results in the presence of NaNs, or when two different small
16230 numbers are compared such that their difference is calculated as zero.
16231 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16232 software comparisons.
16233
16234 @item -mstack-offset=@var{num}
16235 @opindex mstack-offset
16236 Set the offset between the top of the stack and the stack pointer.
16237 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16238 can be used by leaf functions without stack allocation.
16239 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16240 Note also that this option changes the ABI; compiling a program with a
16241 different stack offset than the libraries have been compiled with
16242 generally does not work.
16243 This option can be useful if you want to evaluate if a different stack
16244 offset would give you better code, but to actually use a different stack
16245 offset to build working programs, it is recommended to configure the
16246 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16247
16248 @item -mno-round-nearest
16249 @opindex mno-round-nearest
16250 @opindex mround-nearest
16251 Make the scheduler assume that the rounding mode has been set to
16252 truncating. The default is @option{-mround-nearest}.
16253
16254 @item -mlong-calls
16255 @opindex mlong-calls
16256 If not otherwise specified by an attribute, assume all calls might be beyond
16257 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16258 function address into a register before performing a (otherwise direct) call.
16259 This is the default.
16260
16261 @item -mshort-calls
16262 @opindex short-calls
16263 If not otherwise specified by an attribute, assume all direct calls are
16264 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16265 for direct calls. The default is @option{-mlong-calls}.
16266
16267 @item -msmall16
16268 @opindex msmall16
16269 Assume addresses can be loaded as 16-bit unsigned values. This does not
16270 apply to function addresses for which @option{-mlong-calls} semantics
16271 are in effect.
16272
16273 @item -mfp-mode=@var{mode}
16274 @opindex mfp-mode
16275 Set the prevailing mode of the floating-point unit.
16276 This determines the floating-point mode that is provided and expected
16277 at function call and return time. Making this mode match the mode you
16278 predominantly need at function start can make your programs smaller and
16279 faster by avoiding unnecessary mode switches.
16280
16281 @var{mode} can be set to one the following values:
16282
16283 @table @samp
16284 @item caller
16285 Any mode at function entry is valid, and retained or restored when
16286 the function returns, and when it calls other functions.
16287 This mode is useful for compiling libraries or other compilation units
16288 you might want to incorporate into different programs with different
16289 prevailing FPU modes, and the convenience of being able to use a single
16290 object file outweighs the size and speed overhead for any extra
16291 mode switching that might be needed, compared with what would be needed
16292 with a more specific choice of prevailing FPU mode.
16293
16294 @item truncate
16295 This is the mode used for floating-point calculations with
16296 truncating (i.e.@: round towards zero) rounding mode. That includes
16297 conversion from floating point to integer.
16298
16299 @item round-nearest
16300 This is the mode used for floating-point calculations with
16301 round-to-nearest-or-even rounding mode.
16302
16303 @item int
16304 This is the mode used to perform integer calculations in the FPU, e.g.@:
16305 integer multiply, or integer multiply-and-accumulate.
16306 @end table
16307
16308 The default is @option{-mfp-mode=caller}
16309
16310 @item -mno-split-lohi
16311 @itemx -mno-postinc
16312 @itemx -mno-postmodify
16313 @opindex mno-split-lohi
16314 @opindex msplit-lohi
16315 @opindex mno-postinc
16316 @opindex mpostinc
16317 @opindex mno-postmodify
16318 @opindex mpostmodify
16319 Code generation tweaks that disable, respectively, splitting of 32-bit
16320 loads, generation of post-increment addresses, and generation of
16321 post-modify addresses. The defaults are @option{msplit-lohi},
16322 @option{-mpost-inc}, and @option{-mpost-modify}.
16323
16324 @item -mnovect-double
16325 @opindex mno-vect-double
16326 @opindex mvect-double
16327 Change the preferred SIMD mode to SImode. The default is
16328 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16329
16330 @item -max-vect-align=@var{num}
16331 @opindex max-vect-align
16332 The maximum alignment for SIMD vector mode types.
16333 @var{num} may be 4 or 8. The default is 8.
16334 Note that this is an ABI change, even though many library function
16335 interfaces are unaffected if they don't use SIMD vector modes
16336 in places that affect size and/or alignment of relevant types.
16337
16338 @item -msplit-vecmove-early
16339 @opindex msplit-vecmove-early
16340 Split vector moves into single word moves before reload. In theory this
16341 can give better register allocation, but so far the reverse seems to be
16342 generally the case.
16343
16344 @item -m1reg-@var{reg}
16345 @opindex m1reg-
16346 Specify a register to hold the constant @minus{}1, which makes loading small negative
16347 constants and certain bitmasks faster.
16348 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16349 which specify use of that register as a fixed register,
16350 and @samp{none}, which means that no register is used for this
16351 purpose. The default is @option{-m1reg-none}.
16352
16353 @end table
16354
16355 @node AMD GCN Options
16356 @subsection AMD GCN Options
16357 @cindex AMD GCN Options
16358
16359 These options are defined specifically for the AMD GCN port.
16360
16361 @table @gcctabopt
16362
16363 @item -march=@var{gpu}
16364 @opindex march
16365 @itemx -mtune=@var{gpu}
16366 @opindex mtune
16367 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16368 are
16369
16370 @table @samp
16371 @opindex fiji
16372 @item fiji
16373 Compile for GCN3 Fiji devices (gfx803).
16374
16375 @item gfx900
16376 Compile for GCN5 Vega 10 devices (gfx900).
16377
16378 @item gfx906
16379 Compile for GCN5 Vega 20 devices (gfx906).
16380
16381 @end table
16382
16383 @item -mstack-size=@var{bytes}
16384 @opindex mstack-size
16385 Specify how many @var{bytes} of stack space will be requested for each GPU
16386 thread (wave-front). Beware that there may be many threads and limited memory
16387 available. The size of the stack allocation may also have an impact on
16388 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16389 1MB otherwise.
16390
16391 @end table
16392
16393 @node ARC Options
16394 @subsection ARC Options
16395 @cindex ARC options
16396
16397 The following options control the architecture variant for which code
16398 is being compiled:
16399
16400 @c architecture variants
16401 @table @gcctabopt
16402
16403 @item -mbarrel-shifter
16404 @opindex mbarrel-shifter
16405 Generate instructions supported by barrel shifter. This is the default
16406 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16407
16408 @item -mjli-always
16409 @opindex mjli-alawys
16410 Force to call a function using jli_s instruction. This option is
16411 valid only for ARCv2 architecture.
16412
16413 @item -mcpu=@var{cpu}
16414 @opindex mcpu
16415 Set architecture type, register usage, and instruction scheduling
16416 parameters for @var{cpu}. There are also shortcut alias options
16417 available for backward compatibility and convenience. Supported
16418 values for @var{cpu} are
16419
16420 @table @samp
16421 @opindex mA6
16422 @opindex mARC600
16423 @item arc600
16424 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16425
16426 @item arc601
16427 @opindex mARC601
16428 Compile for ARC601. Alias: @option{-mARC601}.
16429
16430 @item arc700
16431 @opindex mA7
16432 @opindex mARC700
16433 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16434 This is the default when configured with @option{--with-cpu=arc700}@.
16435
16436 @item arcem
16437 Compile for ARC EM.
16438
16439 @item archs
16440 Compile for ARC HS.
16441
16442 @item em
16443 Compile for ARC EM CPU with no hardware extensions.
16444
16445 @item em4
16446 Compile for ARC EM4 CPU.
16447
16448 @item em4_dmips
16449 Compile for ARC EM4 DMIPS CPU.
16450
16451 @item em4_fpus
16452 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16453 extension.
16454
16455 @item em4_fpuda
16456 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16457 double assist instructions.
16458
16459 @item hs
16460 Compile for ARC HS CPU with no hardware extensions except the atomic
16461 instructions.
16462
16463 @item hs34
16464 Compile for ARC HS34 CPU.
16465
16466 @item hs38
16467 Compile for ARC HS38 CPU.
16468
16469 @item hs38_linux
16470 Compile for ARC HS38 CPU with all hardware extensions on.
16471
16472 @item arc600_norm
16473 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16474
16475 @item arc600_mul32x16
16476 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16477 instructions enabled.
16478
16479 @item arc600_mul64
16480 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16481 instructions enabled.
16482
16483 @item arc601_norm
16484 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16485
16486 @item arc601_mul32x16
16487 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16488 instructions enabled.
16489
16490 @item arc601_mul64
16491 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16492 instructions enabled.
16493
16494 @item nps400
16495 Compile for ARC 700 on NPS400 chip.
16496
16497 @item em_mini
16498 Compile for ARC EM minimalist configuration featuring reduced register
16499 set.
16500
16501 @end table
16502
16503 @item -mdpfp
16504 @opindex mdpfp
16505 @itemx -mdpfp-compact
16506 @opindex mdpfp-compact
16507 Generate double-precision FPX instructions, tuned for the compact
16508 implementation.
16509
16510 @item -mdpfp-fast
16511 @opindex mdpfp-fast
16512 Generate double-precision FPX instructions, tuned for the fast
16513 implementation.
16514
16515 @item -mno-dpfp-lrsr
16516 @opindex mno-dpfp-lrsr
16517 Disable @code{lr} and @code{sr} instructions from using FPX extension
16518 aux registers.
16519
16520 @item -mea
16521 @opindex mea
16522 Generate extended arithmetic instructions. Currently only
16523 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16524 supported. This is always enabled for @option{-mcpu=ARC700}.
16525
16526 @item -mno-mpy
16527 @opindex mno-mpy
16528 @opindex mmpy
16529 Do not generate @code{mpy}-family instructions for ARC700. This option is
16530 deprecated.
16531
16532 @item -mmul32x16
16533 @opindex mmul32x16
16534 Generate 32x16-bit multiply and multiply-accumulate instructions.
16535
16536 @item -mmul64
16537 @opindex mmul64
16538 Generate @code{mul64} and @code{mulu64} instructions.
16539 Only valid for @option{-mcpu=ARC600}.
16540
16541 @item -mnorm
16542 @opindex mnorm
16543 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16544 is in effect.
16545
16546 @item -mspfp
16547 @opindex mspfp
16548 @itemx -mspfp-compact
16549 @opindex mspfp-compact
16550 Generate single-precision FPX instructions, tuned for the compact
16551 implementation.
16552
16553 @item -mspfp-fast
16554 @opindex mspfp-fast
16555 Generate single-precision FPX instructions, tuned for the fast
16556 implementation.
16557
16558 @item -msimd
16559 @opindex msimd
16560 Enable generation of ARC SIMD instructions via target-specific
16561 builtins. Only valid for @option{-mcpu=ARC700}.
16562
16563 @item -msoft-float
16564 @opindex msoft-float
16565 This option ignored; it is provided for compatibility purposes only.
16566 Software floating-point code is emitted by default, and this default
16567 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16568 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16569 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16570
16571 @item -mswap
16572 @opindex mswap
16573 Generate @code{swap} instructions.
16574
16575 @item -matomic
16576 @opindex matomic
16577 This enables use of the locked load/store conditional extension to implement
16578 atomic memory built-in functions. Not available for ARC 6xx or ARC
16579 EM cores.
16580
16581 @item -mdiv-rem
16582 @opindex mdiv-rem
16583 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16584
16585 @item -mcode-density
16586 @opindex mcode-density
16587 Enable code density instructions for ARC EM.
16588 This option is on by default for ARC HS.
16589
16590 @item -mll64
16591 @opindex mll64
16592 Enable double load/store operations for ARC HS cores.
16593
16594 @item -mtp-regno=@var{regno}
16595 @opindex mtp-regno
16596 Specify thread pointer register number.
16597
16598 @item -mmpy-option=@var{multo}
16599 @opindex mmpy-option
16600 Compile ARCv2 code with a multiplier design option. You can specify
16601 the option using either a string or numeric value for @var{multo}.
16602 @samp{wlh1} is the default value. The recognized values are:
16603
16604 @table @samp
16605 @item 0
16606 @itemx none
16607 No multiplier available.
16608
16609 @item 1
16610 @itemx w
16611 16x16 multiplier, fully pipelined.
16612 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16613
16614 @item 2
16615 @itemx wlh1
16616 32x32 multiplier, fully
16617 pipelined (1 stage). The following instructions are additionally
16618 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16619
16620 @item 3
16621 @itemx wlh2
16622 32x32 multiplier, fully pipelined
16623 (2 stages). The following instructions are additionally enabled: @code{mpy},
16624 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16625
16626 @item 4
16627 @itemx wlh3
16628 Two 16x16 multipliers, blocking,
16629 sequential. The following instructions are additionally enabled: @code{mpy},
16630 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16631
16632 @item 5
16633 @itemx wlh4
16634 One 16x16 multiplier, blocking,
16635 sequential. The following instructions are additionally enabled: @code{mpy},
16636 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16637
16638 @item 6
16639 @itemx wlh5
16640 One 32x4 multiplier, blocking,
16641 sequential. The following instructions are additionally enabled: @code{mpy},
16642 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16643
16644 @item 7
16645 @itemx plus_dmpy
16646 ARC HS SIMD support.
16647
16648 @item 8
16649 @itemx plus_macd
16650 ARC HS SIMD support.
16651
16652 @item 9
16653 @itemx plus_qmacw
16654 ARC HS SIMD support.
16655
16656 @end table
16657
16658 This option is only available for ARCv2 cores@.
16659
16660 @item -mfpu=@var{fpu}
16661 @opindex mfpu
16662 Enables support for specific floating-point hardware extensions for ARCv2
16663 cores. Supported values for @var{fpu} are:
16664
16665 @table @samp
16666
16667 @item fpus
16668 Enables support for single-precision floating-point hardware
16669 extensions@.
16670
16671 @item fpud
16672 Enables support for double-precision floating-point hardware
16673 extensions. The single-precision floating-point extension is also
16674 enabled. Not available for ARC EM@.
16675
16676 @item fpuda
16677 Enables support for double-precision floating-point hardware
16678 extensions using double-precision assist instructions. The single-precision
16679 floating-point extension is also enabled. This option is
16680 only available for ARC EM@.
16681
16682 @item fpuda_div
16683 Enables support for double-precision floating-point hardware
16684 extensions using double-precision assist instructions.
16685 The single-precision floating-point, square-root, and divide
16686 extensions are also enabled. This option is
16687 only available for ARC EM@.
16688
16689 @item fpuda_fma
16690 Enables support for double-precision floating-point hardware
16691 extensions using double-precision assist instructions.
16692 The single-precision floating-point and fused multiply and add
16693 hardware extensions are also enabled. This option is
16694 only available for ARC EM@.
16695
16696 @item fpuda_all
16697 Enables support for double-precision floating-point hardware
16698 extensions using double-precision assist instructions.
16699 All single-precision floating-point hardware extensions are also
16700 enabled. This option is only available for ARC EM@.
16701
16702 @item fpus_div
16703 Enables support for single-precision floating-point, square-root and divide
16704 hardware extensions@.
16705
16706 @item fpud_div
16707 Enables support for double-precision floating-point, square-root and divide
16708 hardware extensions. This option
16709 includes option @samp{fpus_div}. Not available for ARC EM@.
16710
16711 @item fpus_fma
16712 Enables support for single-precision floating-point and
16713 fused multiply and add hardware extensions@.
16714
16715 @item fpud_fma
16716 Enables support for double-precision floating-point and
16717 fused multiply and add hardware extensions. This option
16718 includes option @samp{fpus_fma}. Not available for ARC EM@.
16719
16720 @item fpus_all
16721 Enables support for all single-precision floating-point hardware
16722 extensions@.
16723
16724 @item fpud_all
16725 Enables support for all single- and double-precision floating-point
16726 hardware extensions. Not available for ARC EM@.
16727
16728 @end table
16729
16730 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16731 @opindex mirq-ctrl-saved
16732 Specifies general-purposes registers that the processor automatically
16733 saves/restores on interrupt entry and exit. @var{register-range} is
16734 specified as two registers separated by a dash. The register range
16735 always starts with @code{r0}, the upper limit is @code{fp} register.
16736 @var{blink} and @var{lp_count} are optional. This option is only
16737 valid for ARC EM and ARC HS cores.
16738
16739 @item -mrgf-banked-regs=@var{number}
16740 @opindex mrgf-banked-regs
16741 Specifies the number of registers replicated in second register bank
16742 on entry to fast interrupt. Fast interrupts are interrupts with the
16743 highest priority level P0. These interrupts save only PC and STATUS32
16744 registers to avoid memory transactions during interrupt entry and exit
16745 sequences. Use this option when you are using fast interrupts in an
16746 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16747
16748 @item -mlpc-width=@var{width}
16749 @opindex mlpc-width
16750 Specify the width of the @code{lp_count} register. Valid values for
16751 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16752 fixed to 32 bits. If the width is less than 32, the compiler does not
16753 attempt to transform loops in your program to use the zero-delay loop
16754 mechanism unless it is known that the @code{lp_count} register can
16755 hold the required loop-counter value. Depending on the width
16756 specified, the compiler and run-time library might continue to use the
16757 loop mechanism for various needs. This option defines macro
16758 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16759
16760 @item -mrf16
16761 @opindex mrf16
16762 This option instructs the compiler to generate code for a 16-entry
16763 register file. This option defines the @code{__ARC_RF16__}
16764 preprocessor macro.
16765
16766 @item -mbranch-index
16767 @opindex mbranch-index
16768 Enable use of @code{bi} or @code{bih} instructions to implement jump
16769 tables.
16770
16771 @end table
16772
16773 The following options are passed through to the assembler, and also
16774 define preprocessor macro symbols.
16775
16776 @c Flags used by the assembler, but for which we define preprocessor
16777 @c macro symbols as well.
16778 @table @gcctabopt
16779 @item -mdsp-packa
16780 @opindex mdsp-packa
16781 Passed down to the assembler to enable the DSP Pack A extensions.
16782 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16783 deprecated.
16784
16785 @item -mdvbf
16786 @opindex mdvbf
16787 Passed down to the assembler to enable the dual Viterbi butterfly
16788 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16789 option is deprecated.
16790
16791 @c ARC700 4.10 extension instruction
16792 @item -mlock
16793 @opindex mlock
16794 Passed down to the assembler to enable the locked load/store
16795 conditional extension. Also sets the preprocessor symbol
16796 @code{__Xlock}.
16797
16798 @item -mmac-d16
16799 @opindex mmac-d16
16800 Passed down to the assembler. Also sets the preprocessor symbol
16801 @code{__Xxmac_d16}. This option is deprecated.
16802
16803 @item -mmac-24
16804 @opindex mmac-24
16805 Passed down to the assembler. Also sets the preprocessor symbol
16806 @code{__Xxmac_24}. This option is deprecated.
16807
16808 @c ARC700 4.10 extension instruction
16809 @item -mrtsc
16810 @opindex mrtsc
16811 Passed down to the assembler to enable the 64-bit time-stamp counter
16812 extension instruction. Also sets the preprocessor symbol
16813 @code{__Xrtsc}. This option is deprecated.
16814
16815 @c ARC700 4.10 extension instruction
16816 @item -mswape
16817 @opindex mswape
16818 Passed down to the assembler to enable the swap byte ordering
16819 extension instruction. Also sets the preprocessor symbol
16820 @code{__Xswape}.
16821
16822 @item -mtelephony
16823 @opindex mtelephony
16824 Passed down to the assembler to enable dual- and single-operand
16825 instructions for telephony. Also sets the preprocessor symbol
16826 @code{__Xtelephony}. This option is deprecated.
16827
16828 @item -mxy
16829 @opindex mxy
16830 Passed down to the assembler to enable the XY memory extension. Also
16831 sets the preprocessor symbol @code{__Xxy}.
16832
16833 @end table
16834
16835 The following options control how the assembly code is annotated:
16836
16837 @c Assembly annotation options
16838 @table @gcctabopt
16839 @item -misize
16840 @opindex misize
16841 Annotate assembler instructions with estimated addresses.
16842
16843 @item -mannotate-align
16844 @opindex mannotate-align
16845 Explain what alignment considerations lead to the decision to make an
16846 instruction short or long.
16847
16848 @end table
16849
16850 The following options are passed through to the linker:
16851
16852 @c options passed through to the linker
16853 @table @gcctabopt
16854 @item -marclinux
16855 @opindex marclinux
16856 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16857 This option is enabled by default in tool chains built for
16858 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16859 when profiling is not requested.
16860
16861 @item -marclinux_prof
16862 @opindex marclinux_prof
16863 Passed through to the linker, to specify use of the
16864 @code{arclinux_prof} emulation. This option is enabled by default in
16865 tool chains built for @w{@code{arc-linux-uclibc}} and
16866 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16867
16868 @end table
16869
16870 The following options control the semantics of generated code:
16871
16872 @c semantically relevant code generation options
16873 @table @gcctabopt
16874 @item -mlong-calls
16875 @opindex mlong-calls
16876 Generate calls as register indirect calls, thus providing access
16877 to the full 32-bit address range.
16878
16879 @item -mmedium-calls
16880 @opindex mmedium-calls
16881 Don't use less than 25-bit addressing range for calls, which is the
16882 offset available for an unconditional branch-and-link
16883 instruction. Conditional execution of function calls is suppressed, to
16884 allow use of the 25-bit range, rather than the 21-bit range with
16885 conditional branch-and-link. This is the default for tool chains built
16886 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16887
16888 @item -G @var{num}
16889 @opindex G
16890 Put definitions of externally-visible data in a small data section if
16891 that data is no bigger than @var{num} bytes. The default value of
16892 @var{num} is 4 for any ARC configuration, or 8 when we have double
16893 load/store operations.
16894
16895 @item -mno-sdata
16896 @opindex mno-sdata
16897 @opindex msdata
16898 Do not generate sdata references. This is the default for tool chains
16899 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16900 targets.
16901
16902 @item -mvolatile-cache
16903 @opindex mvolatile-cache
16904 Use ordinarily cached memory accesses for volatile references. This is the
16905 default.
16906
16907 @item -mno-volatile-cache
16908 @opindex mno-volatile-cache
16909 @opindex mvolatile-cache
16910 Enable cache bypass for volatile references.
16911
16912 @end table
16913
16914 The following options fine tune code generation:
16915 @c code generation tuning options
16916 @table @gcctabopt
16917 @item -malign-call
16918 @opindex malign-call
16919 Do alignment optimizations for call instructions.
16920
16921 @item -mauto-modify-reg
16922 @opindex mauto-modify-reg
16923 Enable the use of pre/post modify with register displacement.
16924
16925 @item -mbbit-peephole
16926 @opindex mbbit-peephole
16927 Enable bbit peephole2.
16928
16929 @item -mno-brcc
16930 @opindex mno-brcc
16931 This option disables a target-specific pass in @file{arc_reorg} to
16932 generate compare-and-branch (@code{br@var{cc}}) instructions.
16933 It has no effect on
16934 generation of these instructions driven by the combiner pass.
16935
16936 @item -mcase-vector-pcrel
16937 @opindex mcase-vector-pcrel
16938 Use PC-relative switch case tables to enable case table shortening.
16939 This is the default for @option{-Os}.
16940
16941 @item -mcompact-casesi
16942 @opindex mcompact-casesi
16943 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16944 and only available for ARCv1 cores. This option is deprecated.
16945
16946 @item -mno-cond-exec
16947 @opindex mno-cond-exec
16948 Disable the ARCompact-specific pass to generate conditional
16949 execution instructions.
16950
16951 Due to delay slot scheduling and interactions between operand numbers,
16952 literal sizes, instruction lengths, and the support for conditional execution,
16953 the target-independent pass to generate conditional execution is often lacking,
16954 so the ARC port has kept a special pass around that tries to find more
16955 conditional execution generation opportunities after register allocation,
16956 branch shortening, and delay slot scheduling have been done. This pass
16957 generally, but not always, improves performance and code size, at the cost of
16958 extra compilation time, which is why there is an option to switch it off.
16959 If you have a problem with call instructions exceeding their allowable
16960 offset range because they are conditionalized, you should consider using
16961 @option{-mmedium-calls} instead.
16962
16963 @item -mearly-cbranchsi
16964 @opindex mearly-cbranchsi
16965 Enable pre-reload use of the @code{cbranchsi} pattern.
16966
16967 @item -mexpand-adddi
16968 @opindex mexpand-adddi
16969 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16970 @code{add.f}, @code{adc} etc. This option is deprecated.
16971
16972 @item -mindexed-loads
16973 @opindex mindexed-loads
16974 Enable the use of indexed loads. This can be problematic because some
16975 optimizers then assume that indexed stores exist, which is not
16976 the case.
16977
16978 @item -mlra
16979 @opindex mlra
16980 Enable Local Register Allocation. This is still experimental for ARC,
16981 so by default the compiler uses standard reload
16982 (i.e.@: @option{-mno-lra}).
16983
16984 @item -mlra-priority-none
16985 @opindex mlra-priority-none
16986 Don't indicate any priority for target registers.
16987
16988 @item -mlra-priority-compact
16989 @opindex mlra-priority-compact
16990 Indicate target register priority for r0..r3 / r12..r15.
16991
16992 @item -mlra-priority-noncompact
16993 @opindex mlra-priority-noncompact
16994 Reduce target register priority for r0..r3 / r12..r15.
16995
16996 @item -mmillicode
16997 @opindex mmillicode
16998 When optimizing for size (using @option{-Os}), prologues and epilogues
16999 that have to save or restore a large number of registers are often
17000 shortened by using call to a special function in libgcc; this is
17001 referred to as a @emph{millicode} call. As these calls can pose
17002 performance issues, and/or cause linking issues when linking in a
17003 nonstandard way, this option is provided to turn on or off millicode
17004 call generation.
17005
17006 @item -mcode-density-frame
17007 @opindex mcode-density-frame
17008 This option enable the compiler to emit @code{enter} and @code{leave}
17009 instructions. These instructions are only valid for CPUs with
17010 code-density feature.
17011
17012 @item -mmixed-code
17013 @opindex mmixed-code
17014 Tweak register allocation to help 16-bit instruction generation.
17015 This generally has the effect of decreasing the average instruction size
17016 while increasing the instruction count.
17017
17018 @item -mq-class
17019 @opindex mq-class
17020 Enable @samp{q} instruction alternatives.
17021 This is the default for @option{-Os}.
17022
17023 @item -mRcq
17024 @opindex mRcq
17025 Enable @samp{Rcq} constraint handling.
17026 Most short code generation depends on this.
17027 This is the default.
17028
17029 @item -mRcw
17030 @opindex mRcw
17031 Enable @samp{Rcw} constraint handling.
17032 Most ccfsm condexec mostly depends on this.
17033 This is the default.
17034
17035 @item -msize-level=@var{level}
17036 @opindex msize-level
17037 Fine-tune size optimization with regards to instruction lengths and alignment.
17038 The recognized values for @var{level} are:
17039 @table @samp
17040 @item 0
17041 No size optimization. This level is deprecated and treated like @samp{1}.
17042
17043 @item 1
17044 Short instructions are used opportunistically.
17045
17046 @item 2
17047 In addition, alignment of loops and of code after barriers are dropped.
17048
17049 @item 3
17050 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17051
17052 @end table
17053
17054 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17055 the behavior when this is not set is equivalent to level @samp{1}.
17056
17057 @item -mtune=@var{cpu}
17058 @opindex mtune
17059 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17060 by @option{-mcpu=}.
17061
17062 Supported values for @var{cpu} are
17063
17064 @table @samp
17065 @item ARC600
17066 Tune for ARC600 CPU.
17067
17068 @item ARC601
17069 Tune for ARC601 CPU.
17070
17071 @item ARC700
17072 Tune for ARC700 CPU with standard multiplier block.
17073
17074 @item ARC700-xmac
17075 Tune for ARC700 CPU with XMAC block.
17076
17077 @item ARC725D
17078 Tune for ARC725D CPU.
17079
17080 @item ARC750D
17081 Tune for ARC750D CPU.
17082
17083 @end table
17084
17085 @item -mmultcost=@var{num}
17086 @opindex mmultcost
17087 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17088 normal instruction.
17089
17090 @item -munalign-prob-threshold=@var{probability}
17091 @opindex munalign-prob-threshold
17092 Set probability threshold for unaligning branches.
17093 When tuning for @samp{ARC700} and optimizing for speed, branches without
17094 filled delay slot are preferably emitted unaligned and long, unless
17095 profiling indicates that the probability for the branch to be taken
17096 is below @var{probability}. @xref{Cross-profiling}.
17097 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17098
17099 @end table
17100
17101 The following options are maintained for backward compatibility, but
17102 are now deprecated and will be removed in a future release:
17103
17104 @c Deprecated options
17105 @table @gcctabopt
17106
17107 @item -margonaut
17108 @opindex margonaut
17109 Obsolete FPX.
17110
17111 @item -mbig-endian
17112 @opindex mbig-endian
17113 @itemx -EB
17114 @opindex EB
17115 Compile code for big-endian targets. Use of these options is now
17116 deprecated. Big-endian code is supported by configuring GCC to build
17117 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17118 for which big endian is the default.
17119
17120 @item -mlittle-endian
17121 @opindex mlittle-endian
17122 @itemx -EL
17123 @opindex EL
17124 Compile code for little-endian targets. Use of these options is now
17125 deprecated. Little-endian code is supported by configuring GCC to build
17126 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17127 for which little endian is the default.
17128
17129 @item -mbarrel_shifter
17130 @opindex mbarrel_shifter
17131 Replaced by @option{-mbarrel-shifter}.
17132
17133 @item -mdpfp_compact
17134 @opindex mdpfp_compact
17135 Replaced by @option{-mdpfp-compact}.
17136
17137 @item -mdpfp_fast
17138 @opindex mdpfp_fast
17139 Replaced by @option{-mdpfp-fast}.
17140
17141 @item -mdsp_packa
17142 @opindex mdsp_packa
17143 Replaced by @option{-mdsp-packa}.
17144
17145 @item -mEA
17146 @opindex mEA
17147 Replaced by @option{-mea}.
17148
17149 @item -mmac_24
17150 @opindex mmac_24
17151 Replaced by @option{-mmac-24}.
17152
17153 @item -mmac_d16
17154 @opindex mmac_d16
17155 Replaced by @option{-mmac-d16}.
17156
17157 @item -mspfp_compact
17158 @opindex mspfp_compact
17159 Replaced by @option{-mspfp-compact}.
17160
17161 @item -mspfp_fast
17162 @opindex mspfp_fast
17163 Replaced by @option{-mspfp-fast}.
17164
17165 @item -mtune=@var{cpu}
17166 @opindex mtune
17167 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17168 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17169 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17170
17171 @item -multcost=@var{num}
17172 @opindex multcost
17173 Replaced by @option{-mmultcost}.
17174
17175 @end table
17176
17177 @node ARM Options
17178 @subsection ARM Options
17179 @cindex ARM options
17180
17181 These @samp{-m} options are defined for the ARM port:
17182
17183 @table @gcctabopt
17184 @item -mabi=@var{name}
17185 @opindex mabi
17186 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17187 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17188
17189 @item -mapcs-frame
17190 @opindex mapcs-frame
17191 Generate a stack frame that is compliant with the ARM Procedure Call
17192 Standard for all functions, even if this is not strictly necessary for
17193 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17194 with this option causes the stack frames not to be generated for
17195 leaf functions. The default is @option{-mno-apcs-frame}.
17196 This option is deprecated.
17197
17198 @item -mapcs
17199 @opindex mapcs
17200 This is a synonym for @option{-mapcs-frame} and is deprecated.
17201
17202 @ignore
17203 @c not currently implemented
17204 @item -mapcs-stack-check
17205 @opindex mapcs-stack-check
17206 Generate code to check the amount of stack space available upon entry to
17207 every function (that actually uses some stack space). If there is
17208 insufficient space available then either the function
17209 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17210 called, depending upon the amount of stack space required. The runtime
17211 system is required to provide these functions. The default is
17212 @option{-mno-apcs-stack-check}, since this produces smaller code.
17213
17214 @c not currently implemented
17215 @item -mapcs-reentrant
17216 @opindex mapcs-reentrant
17217 Generate reentrant, position-independent code. The default is
17218 @option{-mno-apcs-reentrant}.
17219 @end ignore
17220
17221 @item -mthumb-interwork
17222 @opindex mthumb-interwork
17223 Generate code that supports calling between the ARM and Thumb
17224 instruction sets. Without this option, on pre-v5 architectures, the
17225 two instruction sets cannot be reliably used inside one program. The
17226 default is @option{-mno-thumb-interwork}, since slightly larger code
17227 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17228 configurations this option is meaningless.
17229
17230 @item -mno-sched-prolog
17231 @opindex mno-sched-prolog
17232 @opindex msched-prolog
17233 Prevent the reordering of instructions in the function prologue, or the
17234 merging of those instruction with the instructions in the function's
17235 body. This means that all functions start with a recognizable set
17236 of instructions (or in fact one of a choice from a small set of
17237 different function prologues), and this information can be used to
17238 locate the start of functions inside an executable piece of code. The
17239 default is @option{-msched-prolog}.
17240
17241 @item -mfloat-abi=@var{name}
17242 @opindex mfloat-abi
17243 Specifies which floating-point ABI to use. Permissible values
17244 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17245
17246 Specifying @samp{soft} causes GCC to generate output containing
17247 library calls for floating-point operations.
17248 @samp{softfp} allows the generation of code using hardware floating-point
17249 instructions, but still uses the soft-float calling conventions.
17250 @samp{hard} allows generation of floating-point instructions
17251 and uses FPU-specific calling conventions.
17252
17253 The default depends on the specific target configuration. Note that
17254 the hard-float and soft-float ABIs are not link-compatible; you must
17255 compile your entire program with the same ABI, and link with a
17256 compatible set of libraries.
17257
17258 @item -mgeneral-regs-only
17259 @opindex mgeneral-regs-only
17260 Generate code which uses only the general-purpose registers. This will prevent
17261 the compiler from using floating-point and Advanced SIMD registers but will not
17262 impose any restrictions on the assembler.
17263
17264 @item -mlittle-endian
17265 @opindex mlittle-endian
17266 Generate code for a processor running in little-endian mode. This is
17267 the default for all standard configurations.
17268
17269 @item -mbig-endian
17270 @opindex mbig-endian
17271 Generate code for a processor running in big-endian mode; the default is
17272 to compile code for a little-endian processor.
17273
17274 @item -mbe8
17275 @itemx -mbe32
17276 @opindex mbe8
17277 When linking a big-endian image select between BE8 and BE32 formats.
17278 The option has no effect for little-endian images and is ignored. The
17279 default is dependent on the selected target architecture. For ARMv6
17280 and later architectures the default is BE8, for older architectures
17281 the default is BE32. BE32 format has been deprecated by ARM.
17282
17283 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17284 @opindex march
17285 This specifies the name of the target ARM architecture. GCC uses this
17286 name to determine what kind of instructions it can emit when generating
17287 assembly code. This option can be used in conjunction with or instead
17288 of the @option{-mcpu=} option.
17289
17290 Permissible names are:
17291 @samp{armv4t},
17292 @samp{armv5t}, @samp{armv5te},
17293 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17294 @samp{armv6z}, @samp{armv6zk},
17295 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17296 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17297 @samp{armv8.4-a},
17298 @samp{armv8.5-a},
17299 @samp{armv7-r},
17300 @samp{armv8-r},
17301 @samp{armv6-m}, @samp{armv6s-m},
17302 @samp{armv7-m}, @samp{armv7e-m},
17303 @samp{armv8-m.base}, @samp{armv8-m.main},
17304 @samp{iwmmxt} and @samp{iwmmxt2}.
17305
17306 Additionally, the following architectures, which lack support for the
17307 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17308
17309 Many of the architectures support extensions. These can be added by
17310 appending @samp{+@var{extension}} to the architecture name. Extension
17311 options are processed in order and capabilities accumulate. An extension
17312 will also enable any necessary base extensions
17313 upon which it depends. For example, the @samp{+crypto} extension
17314 will always enable the @samp{+simd} extension. The exception to the
17315 additive construction is for extensions that are prefixed with
17316 @samp{+no@dots{}}: these extensions disable the specified option and
17317 any other extensions that may depend on the presence of that
17318 extension.
17319
17320 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17321 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17322 entirely disabled by the @samp{+nofp} option that follows it.
17323
17324 Most extension names are generically named, but have an effect that is
17325 dependent upon the architecture to which it is applied. For example,
17326 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17327 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17328 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17329 variant for @samp{armv8-a}.
17330
17331 The table below lists the supported extensions for each architecture.
17332 Architectures not mentioned do not support any extensions.
17333
17334 @table @samp
17335 @item armv5te
17336 @itemx armv6
17337 @itemx armv6j
17338 @itemx armv6k
17339 @itemx armv6kz
17340 @itemx armv6t2
17341 @itemx armv6z
17342 @itemx armv6zk
17343 @table @samp
17344 @item +fp
17345 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17346 used as an alias for this extension.
17347
17348 @item +nofp
17349 Disable the floating-point instructions.
17350 @end table
17351
17352 @item armv7
17353 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17354 @table @samp
17355 @item +fp
17356 The VFPv3 floating-point instructions, with 16 double-precision
17357 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17358 for this extension. Note that floating-point is not supported by the
17359 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17360 ARMv7-R architectures.
17361
17362 @item +nofp
17363 Disable the floating-point instructions.
17364 @end table
17365
17366 @item armv7-a
17367 @table @samp
17368 @item +mp
17369 The multiprocessing extension.
17370
17371 @item +sec
17372 The security extension.
17373
17374 @item +fp
17375 The VFPv3 floating-point instructions, with 16 double-precision
17376 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17377 for this extension.
17378
17379 @item +simd
17380 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17381 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17382 for this extension.
17383
17384 @item +vfpv3
17385 The VFPv3 floating-point instructions, with 32 double-precision
17386 registers.
17387
17388 @item +vfpv3-d16-fp16
17389 The VFPv3 floating-point instructions, with 16 double-precision
17390 registers and the half-precision floating-point conversion operations.
17391
17392 @item +vfpv3-fp16
17393 The VFPv3 floating-point instructions, with 32 double-precision
17394 registers and the half-precision floating-point conversion operations.
17395
17396 @item +vfpv4-d16
17397 The VFPv4 floating-point instructions, with 16 double-precision
17398 registers.
17399
17400 @item +vfpv4
17401 The VFPv4 floating-point instructions, with 32 double-precision
17402 registers.
17403
17404 @item +neon-fp16
17405 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17406 the half-precision floating-point conversion operations.
17407
17408 @item +neon-vfpv4
17409 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17410
17411 @item +nosimd
17412 Disable the Advanced SIMD instructions (does not disable floating point).
17413
17414 @item +nofp
17415 Disable the floating-point and Advanced SIMD instructions.
17416 @end table
17417
17418 @item armv7ve
17419 The extended version of the ARMv7-A architecture with support for
17420 virtualization.
17421 @table @samp
17422 @item +fp
17423 The VFPv4 floating-point instructions, with 16 double-precision registers.
17424 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17425
17426 @item +simd
17427 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17428 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17429
17430 @item +vfpv3-d16
17431 The VFPv3 floating-point instructions, with 16 double-precision
17432 registers.
17433
17434 @item +vfpv3
17435 The VFPv3 floating-point instructions, with 32 double-precision
17436 registers.
17437
17438 @item +vfpv3-d16-fp16
17439 The VFPv3 floating-point instructions, with 16 double-precision
17440 registers and the half-precision floating-point conversion operations.
17441
17442 @item +vfpv3-fp16
17443 The VFPv3 floating-point instructions, with 32 double-precision
17444 registers and the half-precision floating-point conversion operations.
17445
17446 @item +vfpv4-d16
17447 The VFPv4 floating-point instructions, with 16 double-precision
17448 registers.
17449
17450 @item +vfpv4
17451 The VFPv4 floating-point instructions, with 32 double-precision
17452 registers.
17453
17454 @item +neon
17455 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17456 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17457
17458 @item +neon-fp16
17459 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17460 the half-precision floating-point conversion operations.
17461
17462 @item +nosimd
17463 Disable the Advanced SIMD instructions (does not disable floating point).
17464
17465 @item +nofp
17466 Disable the floating-point and Advanced SIMD instructions.
17467 @end table
17468
17469 @item armv8-a
17470 @table @samp
17471 @item +crc
17472 The Cyclic Redundancy Check (CRC) instructions.
17473 @item +simd
17474 The ARMv8-A Advanced SIMD and floating-point instructions.
17475 @item +crypto
17476 The cryptographic instructions.
17477 @item +nocrypto
17478 Disable the cryptographic instructions.
17479 @item +nofp
17480 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17481 @item +sb
17482 Speculation Barrier Instruction.
17483 @item +predres
17484 Execution and Data Prediction Restriction Instructions.
17485 @end table
17486
17487 @item armv8.1-a
17488 @table @samp
17489 @item +simd
17490 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17491
17492 @item +crypto
17493 The cryptographic instructions. This also enables the Advanced SIMD and
17494 floating-point instructions.
17495
17496 @item +nocrypto
17497 Disable the cryptographic instructions.
17498
17499 @item +nofp
17500 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17501
17502 @item +sb
17503 Speculation Barrier Instruction.
17504
17505 @item +predres
17506 Execution and Data Prediction Restriction Instructions.
17507 @end table
17508
17509 @item armv8.2-a
17510 @itemx armv8.3-a
17511 @table @samp
17512 @item +fp16
17513 The half-precision floating-point data processing instructions.
17514 This also enables the Advanced SIMD and floating-point instructions.
17515
17516 @item +fp16fml
17517 The half-precision floating-point fmla extension. This also enables
17518 the half-precision floating-point extension and Advanced SIMD and
17519 floating-point instructions.
17520
17521 @item +simd
17522 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17523
17524 @item +crypto
17525 The cryptographic instructions. This also enables the Advanced SIMD and
17526 floating-point instructions.
17527
17528 @item +dotprod
17529 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17530
17531 @item +nocrypto
17532 Disable the cryptographic extension.
17533
17534 @item +nofp
17535 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17536
17537 @item +sb
17538 Speculation Barrier Instruction.
17539
17540 @item +predres
17541 Execution and Data Prediction Restriction Instructions.
17542 @end table
17543
17544 @item armv8.4-a
17545 @table @samp
17546 @item +fp16
17547 The half-precision floating-point data processing instructions.
17548 This also enables the Advanced SIMD and floating-point instructions as well
17549 as the Dot Product extension and the half-precision floating-point fmla
17550 extension.
17551
17552 @item +simd
17553 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17554 Dot Product extension.
17555
17556 @item +crypto
17557 The cryptographic instructions. This also enables the Advanced SIMD and
17558 floating-point instructions as well as the Dot Product extension.
17559
17560 @item +nocrypto
17561 Disable the cryptographic extension.
17562
17563 @item +nofp
17564 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17565
17566 @item +sb
17567 Speculation Barrier Instruction.
17568
17569 @item +predres
17570 Execution and Data Prediction Restriction Instructions.
17571 @end table
17572
17573 @item armv8.5-a
17574 @table @samp
17575 @item +fp16
17576 The half-precision floating-point data processing instructions.
17577 This also enables the Advanced SIMD and floating-point instructions as well
17578 as the Dot Product extension and the half-precision floating-point fmla
17579 extension.
17580
17581 @item +simd
17582 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17583 Dot Product extension.
17584
17585 @item +crypto
17586 The cryptographic instructions. This also enables the Advanced SIMD and
17587 floating-point instructions as well as the Dot Product extension.
17588
17589 @item +nocrypto
17590 Disable the cryptographic extension.
17591
17592 @item +nofp
17593 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17594 @end table
17595
17596 @item armv7-r
17597 @table @samp
17598 @item +fp.sp
17599 The single-precision VFPv3 floating-point instructions. The extension
17600 @samp{+vfpv3xd} can be used as an alias for this extension.
17601
17602 @item +fp
17603 The VFPv3 floating-point instructions with 16 double-precision registers.
17604 The extension +vfpv3-d16 can be used as an alias for this extension.
17605
17606 @item +vfpv3xd-d16-fp16
17607 The single-precision VFPv3 floating-point instructions with 16 double-precision
17608 registers and the half-precision floating-point conversion operations.
17609
17610 @item +vfpv3-d16-fp16
17611 The VFPv3 floating-point instructions with 16 double-precision
17612 registers and the half-precision floating-point conversion operations.
17613
17614 @item +nofp
17615 Disable the floating-point extension.
17616
17617 @item +idiv
17618 The ARM-state integer division instructions.
17619
17620 @item +noidiv
17621 Disable the ARM-state integer division extension.
17622 @end table
17623
17624 @item armv7e-m
17625 @table @samp
17626 @item +fp
17627 The single-precision VFPv4 floating-point instructions.
17628
17629 @item +fpv5
17630 The single-precision FPv5 floating-point instructions.
17631
17632 @item +fp.dp
17633 The single- and double-precision FPv5 floating-point instructions.
17634
17635 @item +nofp
17636 Disable the floating-point extensions.
17637 @end table
17638
17639 @item armv8-m.main
17640 @table @samp
17641 @item +dsp
17642 The DSP instructions.
17643
17644 @item +nodsp
17645 Disable the DSP extension.
17646
17647 @item +fp
17648 The single-precision floating-point instructions.
17649
17650 @item +fp.dp
17651 The single- and double-precision floating-point instructions.
17652
17653 @item +nofp
17654 Disable the floating-point extension.
17655 @end table
17656
17657 @item armv8-r
17658 @table @samp
17659 @item +crc
17660 The Cyclic Redundancy Check (CRC) instructions.
17661 @item +fp.sp
17662 The single-precision FPv5 floating-point instructions.
17663 @item +simd
17664 The ARMv8-A Advanced SIMD and floating-point instructions.
17665 @item +crypto
17666 The cryptographic instructions.
17667 @item +nocrypto
17668 Disable the cryptographic instructions.
17669 @item +nofp
17670 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17671 @end table
17672
17673 @end table
17674
17675 @option{-march=native} causes the compiler to auto-detect the architecture
17676 of the build computer. At present, this feature is only supported on
17677 GNU/Linux, and not all architectures are recognized. If the auto-detect
17678 is unsuccessful the option has no effect.
17679
17680 @item -mtune=@var{name}
17681 @opindex mtune
17682 This option specifies the name of the target ARM processor for
17683 which GCC should tune the performance of the code.
17684 For some ARM implementations better performance can be obtained by using
17685 this option.
17686 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17687 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17688 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17689 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17690 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17691 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17692 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17693 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17694 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17695 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17696 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17697 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17698 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17699 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17700 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17701 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17702 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17703 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17704 @samp{cortex-m35p},
17705 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17706 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17707 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17708 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17709 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17710
17711 Additionally, this option can specify that GCC should tune the performance
17712 of the code for a big.LITTLE system. Permissible names are:
17713 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17714 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17715 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17716 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17717
17718 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17719 performance for a blend of processors within architecture @var{arch}.
17720 The aim is to generate code that run well on the current most popular
17721 processors, balancing between optimizations that benefit some CPUs in the
17722 range, and avoiding performance pitfalls of other CPUs. The effects of
17723 this option may change in future GCC versions as CPU models come and go.
17724
17725 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17726 the extension options do not affect the tuning of the generated code.
17727
17728 @option{-mtune=native} causes the compiler to auto-detect the CPU
17729 of the build computer. At present, this feature is only supported on
17730 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17731 unsuccessful the option has no effect.
17732
17733 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17734 @opindex mcpu
17735 This specifies the name of the target ARM processor. GCC uses this name
17736 to derive the name of the target ARM architecture (as if specified
17737 by @option{-march}) and the ARM processor type for which to tune for
17738 performance (as if specified by @option{-mtune}). Where this option
17739 is used in conjunction with @option{-march} or @option{-mtune},
17740 those options take precedence over the appropriate part of this option.
17741
17742 Many of the supported CPUs implement optional architectural
17743 extensions. Where this is so the architectural extensions are
17744 normally enabled by default. If implementations that lack the
17745 extension exist, then the extension syntax can be used to disable
17746 those extensions that have been omitted. For floating-point and
17747 Advanced SIMD (Neon) instructions, the settings of the options
17748 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17749 floating-point and Advanced SIMD instructions will only be used if
17750 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17751 @option{-mfpu} other than @samp{auto} will override the available
17752 floating-point and SIMD extension instructions.
17753
17754 For example, @samp{cortex-a9} can be found in three major
17755 configurations: integer only, with just a floating-point unit or with
17756 floating-point and Advanced SIMD. The default is to enable all the
17757 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17758 be used to disable just the SIMD or both the SIMD and floating-point
17759 instructions respectively.
17760
17761 Permissible names for this option are the same as those for
17762 @option{-mtune}.
17763
17764 The following extension options are common to the listed CPUs:
17765
17766 @table @samp
17767 @item +nodsp
17768 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17769
17770 @item +nofp
17771 Disables the floating-point instructions on @samp{arm9e},
17772 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17773 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17774 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17775 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17776 Disables the floating-point and SIMD instructions on
17777 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17778 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17779 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17780 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17781 @samp{cortex-a53} and @samp{cortex-a55}.
17782
17783 @item +nofp.dp
17784 Disables the double-precision component of the floating-point instructions
17785 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17786 @samp{cortex-m7}.
17787
17788 @item +nosimd
17789 Disables the SIMD (but not floating-point) instructions on
17790 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17791 and @samp{cortex-a9}.
17792
17793 @item +crypto
17794 Enables the cryptographic instructions on @samp{cortex-a32},
17795 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17796 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17797 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17798 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17799 @samp{cortex-a75.cortex-a55}.
17800 @end table
17801
17802 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17803 VFPv3 with 16 double-precision registers. It supports the following
17804 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17805 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17806 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17807 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17808 the extensions to @option{-march=armv7-a}.
17809
17810 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17811 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17812 See @option{-mtune} for more information.
17813
17814 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17815 of the build computer. At present, this feature is only supported on
17816 GNU/Linux, and not all architectures are recognized. If the auto-detect
17817 is unsuccessful the option has no effect.
17818
17819 @item -mfpu=@var{name}
17820 @opindex mfpu
17821 This specifies what floating-point hardware (or hardware emulation) is
17822 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17823 @samp{vfpv3},
17824 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17825 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17826 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17827 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17828 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17829 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17830 is an alias for @samp{vfpv2}.
17831
17832 The setting @samp{auto} is the default and is special. It causes the
17833 compiler to select the floating-point and Advanced SIMD instructions
17834 based on the settings of @option{-mcpu} and @option{-march}.
17835
17836 If the selected floating-point hardware includes the NEON extension
17837 (e.g.@: @option{-mfpu=neon}), note that floating-point
17838 operations are not generated by GCC's auto-vectorization pass unless
17839 @option{-funsafe-math-optimizations} is also specified. This is
17840 because NEON hardware does not fully implement the IEEE 754 standard for
17841 floating-point arithmetic (in particular denormal values are treated as
17842 zero), so the use of NEON instructions may lead to a loss of precision.
17843
17844 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}).
17845
17846 @item -mfp16-format=@var{name}
17847 @opindex mfp16-format
17848 Specify the format of the @code{__fp16} half-precision floating-point type.
17849 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17850 the default is @samp{none}, in which case the @code{__fp16} type is not
17851 defined. @xref{Half-Precision}, for more information.
17852
17853 @item -mstructure-size-boundary=@var{n}
17854 @opindex mstructure-size-boundary
17855 The sizes of all structures and unions are rounded up to a multiple
17856 of the number of bits set by this option. Permissible values are 8, 32
17857 and 64. The default value varies for different toolchains. For the COFF
17858 targeted toolchain the default value is 8. A value of 64 is only allowed
17859 if the underlying ABI supports it.
17860
17861 Specifying a larger number can produce faster, more efficient code, but
17862 can also increase the size of the program. Different values are potentially
17863 incompatible. Code compiled with one value cannot necessarily expect to
17864 work with code or libraries compiled with another value, if they exchange
17865 information using structures or unions.
17866
17867 This option is deprecated.
17868
17869 @item -mabort-on-noreturn
17870 @opindex mabort-on-noreturn
17871 Generate a call to the function @code{abort} at the end of a
17872 @code{noreturn} function. It is executed if the function tries to
17873 return.
17874
17875 @item -mlong-calls
17876 @itemx -mno-long-calls
17877 @opindex mlong-calls
17878 @opindex mno-long-calls
17879 Tells the compiler to perform function calls by first loading the
17880 address of the function into a register and then performing a subroutine
17881 call on this register. This switch is needed if the target function
17882 lies outside of the 64-megabyte addressing range of the offset-based
17883 version of subroutine call instruction.
17884
17885 Even if this switch is enabled, not all function calls are turned
17886 into long calls. The heuristic is that static functions, functions
17887 that have the @code{short_call} attribute, functions that are inside
17888 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17889 definitions have already been compiled within the current compilation
17890 unit are not turned into long calls. The exceptions to this rule are
17891 that weak function definitions, functions with the @code{long_call}
17892 attribute or the @code{section} attribute, and functions that are within
17893 the scope of a @code{#pragma long_calls} directive are always
17894 turned into long calls.
17895
17896 This feature is not enabled by default. Specifying
17897 @option{-mno-long-calls} restores the default behavior, as does
17898 placing the function calls within the scope of a @code{#pragma
17899 long_calls_off} directive. Note these switches have no effect on how
17900 the compiler generates code to handle function calls via function
17901 pointers.
17902
17903 @item -msingle-pic-base
17904 @opindex msingle-pic-base
17905 Treat the register used for PIC addressing as read-only, rather than
17906 loading it in the prologue for each function. The runtime system is
17907 responsible for initializing this register with an appropriate value
17908 before execution begins.
17909
17910 @item -mpic-register=@var{reg}
17911 @opindex mpic-register
17912 Specify the register to be used for PIC addressing.
17913 For standard PIC base case, the default is any suitable register
17914 determined by compiler. For single PIC base case, the default is
17915 @samp{R9} if target is EABI based or stack-checking is enabled,
17916 otherwise the default is @samp{R10}.
17917
17918 @item -mpic-data-is-text-relative
17919 @opindex mpic-data-is-text-relative
17920 Assume that the displacement between the text and data segments is fixed
17921 at static link time. This permits using PC-relative addressing
17922 operations to access data known to be in the data segment. For
17923 non-VxWorks RTP targets, this option is enabled by default. When
17924 disabled on such targets, it will enable @option{-msingle-pic-base} by
17925 default.
17926
17927 @item -mpoke-function-name
17928 @opindex mpoke-function-name
17929 Write the name of each function into the text section, directly
17930 preceding the function prologue. The generated code is similar to this:
17931
17932 @smallexample
17933 t0
17934 .ascii "arm_poke_function_name", 0
17935 .align
17936 t1
17937 .word 0xff000000 + (t1 - t0)
17938 arm_poke_function_name
17939 mov ip, sp
17940 stmfd sp!, @{fp, ip, lr, pc@}
17941 sub fp, ip, #4
17942 @end smallexample
17943
17944 When performing a stack backtrace, code can inspect the value of
17945 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17946 location @code{pc - 12} and the top 8 bits are set, then we know that
17947 there is a function name embedded immediately preceding this location
17948 and has length @code{((pc[-3]) & 0xff000000)}.
17949
17950 @item -mthumb
17951 @itemx -marm
17952 @opindex marm
17953 @opindex mthumb
17954
17955 Select between generating code that executes in ARM and Thumb
17956 states. The default for most configurations is to generate code
17957 that executes in ARM state, but the default can be changed by
17958 configuring GCC with the @option{--with-mode=}@var{state}
17959 configure option.
17960
17961 You can also override the ARM and Thumb mode for each function
17962 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17963 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17964
17965 @item -mflip-thumb
17966 @opindex mflip-thumb
17967 Switch ARM/Thumb modes on alternating functions.
17968 This option is provided for regression testing of mixed Thumb/ARM code
17969 generation, and is not intended for ordinary use in compiling code.
17970
17971 @item -mtpcs-frame
17972 @opindex mtpcs-frame
17973 Generate a stack frame that is compliant with the Thumb Procedure Call
17974 Standard for all non-leaf functions. (A leaf function is one that does
17975 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17976
17977 @item -mtpcs-leaf-frame
17978 @opindex mtpcs-leaf-frame
17979 Generate a stack frame that is compliant with the Thumb Procedure Call
17980 Standard for all leaf functions. (A leaf function is one that does
17981 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17982
17983 @item -mcallee-super-interworking
17984 @opindex mcallee-super-interworking
17985 Gives all externally visible functions in the file being compiled an ARM
17986 instruction set header which switches to Thumb mode before executing the
17987 rest of the function. This allows these functions to be called from
17988 non-interworking code. This option is not valid in AAPCS configurations
17989 because interworking is enabled by default.
17990
17991 @item -mcaller-super-interworking
17992 @opindex mcaller-super-interworking
17993 Allows calls via function pointers (including virtual functions) to
17994 execute correctly regardless of whether the target code has been
17995 compiled for interworking or not. There is a small overhead in the cost
17996 of executing a function pointer if this option is enabled. This option
17997 is not valid in AAPCS configurations because interworking is enabled
17998 by default.
17999
18000 @item -mtp=@var{name}
18001 @opindex mtp
18002 Specify the access model for the thread local storage pointer. The valid
18003 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
18004 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
18005 (supported in the arm6k architecture), and @samp{auto}, which uses the
18006 best available method for the selected processor. The default setting is
18007 @samp{auto}.
18008
18009 @item -mtls-dialect=@var{dialect}
18010 @opindex mtls-dialect
18011 Specify the dialect to use for accessing thread local storage. Two
18012 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
18013 @samp{gnu} dialect selects the original GNU scheme for supporting
18014 local and global dynamic TLS models. The @samp{gnu2} dialect
18015 selects the GNU descriptor scheme, which provides better performance
18016 for shared libraries. The GNU descriptor scheme is compatible with
18017 the original scheme, but does require new assembler, linker and
18018 library support. Initial and local exec TLS models are unaffected by
18019 this option and always use the original scheme.
18020
18021 @item -mword-relocations
18022 @opindex mword-relocations
18023 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18024 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18025 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18026 is specified. This option conflicts with @option{-mslow-flash-data}.
18027
18028 @item -mfix-cortex-m3-ldrd
18029 @opindex mfix-cortex-m3-ldrd
18030 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18031 with overlapping destination and base registers are used. This option avoids
18032 generating these instructions. This option is enabled by default when
18033 @option{-mcpu=cortex-m3} is specified.
18034
18035 @item -munaligned-access
18036 @itemx -mno-unaligned-access
18037 @opindex munaligned-access
18038 @opindex mno-unaligned-access
18039 Enables (or disables) reading and writing of 16- and 32- bit values
18040 from addresses that are not 16- or 32- bit aligned. By default
18041 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18042 ARMv8-M Baseline architectures, and enabled for all other
18043 architectures. If unaligned access is not enabled then words in packed
18044 data structures are accessed a byte at a time.
18045
18046 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18047 generated object file to either true or false, depending upon the
18048 setting of this option. If unaligned access is enabled then the
18049 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18050 defined.
18051
18052 @item -mneon-for-64bits
18053 @opindex mneon-for-64bits
18054 This option is deprecated and has no effect.
18055
18056 @item -mslow-flash-data
18057 @opindex mslow-flash-data
18058 Assume loading data from flash is slower than fetching instruction.
18059 Therefore literal load is minimized for better performance.
18060 This option is only supported when compiling for ARMv7 M-profile and
18061 off by default. It conflicts with @option{-mword-relocations}.
18062
18063 @item -masm-syntax-unified
18064 @opindex masm-syntax-unified
18065 Assume inline assembler is using unified asm syntax. The default is
18066 currently off which implies divided syntax. This option has no impact
18067 on Thumb2. However, this may change in future releases of GCC.
18068 Divided syntax should be considered deprecated.
18069
18070 @item -mrestrict-it
18071 @opindex mrestrict-it
18072 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18073 IT blocks can only contain a single 16-bit instruction from a select
18074 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18075
18076 @item -mprint-tune-info
18077 @opindex mprint-tune-info
18078 Print CPU tuning information as comment in assembler file. This is
18079 an option used only for regression testing of the compiler and not
18080 intended for ordinary use in compiling code. This option is disabled
18081 by default.
18082
18083 @item -mverbose-cost-dump
18084 @opindex mverbose-cost-dump
18085 Enable verbose cost model dumping in the debug dump files. This option is
18086 provided for use in debugging the compiler.
18087
18088 @item -mpure-code
18089 @opindex mpure-code
18090 Do not allow constant data to be placed in code sections.
18091 Additionally, when compiling for ELF object format give all text sections the
18092 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18093 is only available when generating non-pic code for M-profile targets with the
18094 MOVT instruction.
18095
18096 @item -mcmse
18097 @opindex mcmse
18098 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18099 Development Tools Engineering Specification", which can be found on
18100 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18101
18102 @item -mfdpic
18103 @itemx -mno-fdpic
18104 @opindex mfdpic
18105 @opindex mno-fdpic
18106 Select the FDPIC ABI, which uses 64-bit function descriptors to
18107 represent pointers to functions. When the compiler is configured for
18108 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18109 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18110 provided. On other targets, it only enables the FDPIC-specific code
18111 generation features, and the user should explicitly provide the
18112 PIC/PIE-related options as needed.
18113
18114 Note that static linking is not supported because it would still
18115 involve the dynamic linker when the program self-relocates. If such
18116 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18117
18118 The opposite @option{-mno-fdpic} option is useful (and required) to
18119 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18120 toolchain as the one used to build the userland programs.
18121
18122 @end table
18123
18124 @node AVR Options
18125 @subsection AVR Options
18126 @cindex AVR Options
18127
18128 These options are defined for AVR implementations:
18129
18130 @table @gcctabopt
18131 @item -mmcu=@var{mcu}
18132 @opindex mmcu
18133 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18134
18135 The default for this option is@tie{}@samp{avr2}.
18136
18137 GCC supports the following AVR devices and ISAs:
18138
18139 @include avr-mmcu.texi
18140
18141 @item -mabsdata
18142 @opindex mabsdata
18143
18144 Assume that all data in static storage can be accessed by LDS / STS
18145 instructions. This option has only an effect on reduced Tiny devices like
18146 ATtiny40. See also the @code{absdata}
18147 @ref{AVR Variable Attributes,variable attribute}.
18148
18149 @item -maccumulate-args
18150 @opindex maccumulate-args
18151 Accumulate outgoing function arguments and acquire/release the needed
18152 stack space for outgoing function arguments once in function
18153 prologue/epilogue. Without this option, outgoing arguments are pushed
18154 before calling a function and popped afterwards.
18155
18156 Popping the arguments after the function call can be expensive on
18157 AVR so that accumulating the stack space might lead to smaller
18158 executables because arguments need not be removed from the
18159 stack after such a function call.
18160
18161 This option can lead to reduced code size for functions that perform
18162 several calls to functions that get their arguments on the stack like
18163 calls to printf-like functions.
18164
18165 @item -mbranch-cost=@var{cost}
18166 @opindex mbranch-cost
18167 Set the branch costs for conditional branch instructions to
18168 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18169 integers. The default branch cost is 0.
18170
18171 @item -mcall-prologues
18172 @opindex mcall-prologues
18173 Functions prologues/epilogues are expanded as calls to appropriate
18174 subroutines. Code size is smaller.
18175
18176 @item -mgas-isr-prologues
18177 @opindex mgas-isr-prologues
18178 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18179 instruction supported by GNU Binutils.
18180 If this option is on, the feature can still be disabled for individual
18181 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18182 function attribute. This feature is activated per default
18183 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18184 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18185
18186 @item -mint8
18187 @opindex mint8
18188 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18189 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18190 and @code{long long} is 4 bytes. Please note that this option does not
18191 conform to the C standards, but it results in smaller code
18192 size.
18193
18194 @item -mmain-is-OS_task
18195 @opindex mmain-is-OS_task
18196 Do not save registers in @code{main}. The effect is the same like
18197 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18198 to @code{main}. It is activated per default if optimization is on.
18199
18200 @item -mn-flash=@var{num}
18201 @opindex mn-flash
18202 Assume that the flash memory has a size of
18203 @var{num} times 64@tie{}KiB.
18204
18205 @item -mno-interrupts
18206 @opindex mno-interrupts
18207 Generated code is not compatible with hardware interrupts.
18208 Code size is smaller.
18209
18210 @item -mrelax
18211 @opindex mrelax
18212 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18213 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18214 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18215 the assembler's command line and the @option{--relax} option to the
18216 linker's command line.
18217
18218 Jump relaxing is performed by the linker because jump offsets are not
18219 known before code is located. Therefore, the assembler code generated by the
18220 compiler is the same, but the instructions in the executable may
18221 differ from instructions in the assembler code.
18222
18223 Relaxing must be turned on if linker stubs are needed, see the
18224 section on @code{EIND} and linker stubs below.
18225
18226 @item -mrmw
18227 @opindex mrmw
18228 Assume that the device supports the Read-Modify-Write
18229 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18230
18231 @item -mshort-calls
18232 @opindex mshort-calls
18233
18234 Assume that @code{RJMP} and @code{RCALL} can target the whole
18235 program memory.
18236
18237 This option is used internally for multilib selection. It is
18238 not an optimization option, and you don't need to set it by hand.
18239
18240 @item -msp8
18241 @opindex msp8
18242 Treat the stack pointer register as an 8-bit register,
18243 i.e.@: assume the high byte of the stack pointer is zero.
18244 In general, you don't need to set this option by hand.
18245
18246 This option is used internally by the compiler to select and
18247 build multilibs for architectures @code{avr2} and @code{avr25}.
18248 These architectures mix devices with and without @code{SPH}.
18249 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18250 the compiler driver adds or removes this option from the compiler
18251 proper's command line, because the compiler then knows if the device
18252 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18253 register or not.
18254
18255 @item -mstrict-X
18256 @opindex mstrict-X
18257 Use address register @code{X} in a way proposed by the hardware. This means
18258 that @code{X} is only used in indirect, post-increment or
18259 pre-decrement addressing.
18260
18261 Without this option, the @code{X} register may be used in the same way
18262 as @code{Y} or @code{Z} which then is emulated by additional
18263 instructions.
18264 For example, loading a value with @code{X+const} addressing with a
18265 small non-negative @code{const < 64} to a register @var{Rn} is
18266 performed as
18267
18268 @example
18269 adiw r26, const ; X += const
18270 ld @var{Rn}, X ; @var{Rn} = *X
18271 sbiw r26, const ; X -= const
18272 @end example
18273
18274 @item -mtiny-stack
18275 @opindex mtiny-stack
18276 Only change the lower 8@tie{}bits of the stack pointer.
18277
18278 @item -mfract-convert-truncate
18279 @opindex mfract-convert-truncate
18280 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18281
18282 @item -nodevicelib
18283 @opindex nodevicelib
18284 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18285
18286 @item -Waddr-space-convert
18287 @opindex Waddr-space-convert
18288 @opindex Wno-addr-space-convert
18289 Warn about conversions between address spaces in the case where the
18290 resulting address space is not contained in the incoming address space.
18291
18292 @item -Wmisspelled-isr
18293 @opindex Wmisspelled-isr
18294 @opindex Wno-misspelled-isr
18295 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18296 Enabled by default.
18297 @end table
18298
18299 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18300 @cindex @code{EIND}
18301 Pointers in the implementation are 16@tie{}bits wide.
18302 The address of a function or label is represented as word address so
18303 that indirect jumps and calls can target any code address in the
18304 range of 64@tie{}Ki words.
18305
18306 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18307 bytes of program memory space, there is a special function register called
18308 @code{EIND} that serves as most significant part of the target address
18309 when @code{EICALL} or @code{EIJMP} instructions are used.
18310
18311 Indirect jumps and calls on these devices are handled as follows by
18312 the compiler and are subject to some limitations:
18313
18314 @itemize @bullet
18315
18316 @item
18317 The compiler never sets @code{EIND}.
18318
18319 @item
18320 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18321 instructions or might read @code{EIND} directly in order to emulate an
18322 indirect call/jump by means of a @code{RET} instruction.
18323
18324 @item
18325 The compiler assumes that @code{EIND} never changes during the startup
18326 code or during the application. In particular, @code{EIND} is not
18327 saved/restored in function or interrupt service routine
18328 prologue/epilogue.
18329
18330 @item
18331 For indirect calls to functions and computed goto, the linker
18332 generates @emph{stubs}. Stubs are jump pads sometimes also called
18333 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18334 The stub contains a direct jump to the desired address.
18335
18336 @item
18337 Linker relaxation must be turned on so that the linker generates
18338 the stubs correctly in all situations. See the compiler option
18339 @option{-mrelax} and the linker option @option{--relax}.
18340 There are corner cases where the linker is supposed to generate stubs
18341 but aborts without relaxation and without a helpful error message.
18342
18343 @item
18344 The default linker script is arranged for code with @code{EIND = 0}.
18345 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18346 linker script has to be used in order to place the sections whose
18347 name start with @code{.trampolines} into the segment where @code{EIND}
18348 points to.
18349
18350 @item
18351 The startup code from libgcc never sets @code{EIND}.
18352 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18353 For the impact of AVR-LibC on @code{EIND}, see the
18354 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18355
18356 @item
18357 It is legitimate for user-specific startup code to set up @code{EIND}
18358 early, for example by means of initialization code located in
18359 section @code{.init3}. Such code runs prior to general startup code
18360 that initializes RAM and calls constructors, but after the bit
18361 of startup code from AVR-LibC that sets @code{EIND} to the segment
18362 where the vector table is located.
18363 @example
18364 #include <avr/io.h>
18365
18366 static void
18367 __attribute__((section(".init3"),naked,used,no_instrument_function))
18368 init3_set_eind (void)
18369 @{
18370 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18371 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18372 @}
18373 @end example
18374
18375 @noindent
18376 The @code{__trampolines_start} symbol is defined in the linker script.
18377
18378 @item
18379 Stubs are generated automatically by the linker if
18380 the following two conditions are met:
18381 @itemize @minus
18382
18383 @item The address of a label is taken by means of the @code{gs} modifier
18384 (short for @emph{generate stubs}) like so:
18385 @example
18386 LDI r24, lo8(gs(@var{func}))
18387 LDI r25, hi8(gs(@var{func}))
18388 @end example
18389 @item The final location of that label is in a code segment
18390 @emph{outside} the segment where the stubs are located.
18391 @end itemize
18392
18393 @item
18394 The compiler emits such @code{gs} modifiers for code labels in the
18395 following situations:
18396 @itemize @minus
18397 @item Taking address of a function or code label.
18398 @item Computed goto.
18399 @item If prologue-save function is used, see @option{-mcall-prologues}
18400 command-line option.
18401 @item Switch/case dispatch tables. If you do not want such dispatch
18402 tables you can specify the @option{-fno-jump-tables} command-line option.
18403 @item C and C++ constructors/destructors called during startup/shutdown.
18404 @item If the tools hit a @code{gs()} modifier explained above.
18405 @end itemize
18406
18407 @item
18408 Jumping to non-symbolic addresses like so is @emph{not} supported:
18409
18410 @example
18411 int main (void)
18412 @{
18413 /* Call function at word address 0x2 */
18414 return ((int(*)(void)) 0x2)();
18415 @}
18416 @end example
18417
18418 Instead, a stub has to be set up, i.e.@: the function has to be called
18419 through a symbol (@code{func_4} in the example):
18420
18421 @example
18422 int main (void)
18423 @{
18424 extern int func_4 (void);
18425
18426 /* Call function at byte address 0x4 */
18427 return func_4();
18428 @}
18429 @end example
18430
18431 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18432 Alternatively, @code{func_4} can be defined in the linker script.
18433 @end itemize
18434
18435 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18436 @cindex @code{RAMPD}
18437 @cindex @code{RAMPX}
18438 @cindex @code{RAMPY}
18439 @cindex @code{RAMPZ}
18440 Some AVR devices support memories larger than the 64@tie{}KiB range
18441 that can be accessed with 16-bit pointers. To access memory locations
18442 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18443 register is used as high part of the address:
18444 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18445 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18446 register, respectively, to get a wide address. Similarly,
18447 @code{RAMPD} is used together with direct addressing.
18448
18449 @itemize
18450 @item
18451 The startup code initializes the @code{RAMP} special function
18452 registers with zero.
18453
18454 @item
18455 If a @ref{AVR Named Address Spaces,named address space} other than
18456 generic or @code{__flash} is used, then @code{RAMPZ} is set
18457 as needed before the operation.
18458
18459 @item
18460 If the device supports RAM larger than 64@tie{}KiB and the compiler
18461 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18462 is reset to zero after the operation.
18463
18464 @item
18465 If the device comes with a specific @code{RAMP} register, the ISR
18466 prologue/epilogue saves/restores that SFR and initializes it with
18467 zero in case the ISR code might (implicitly) use it.
18468
18469 @item
18470 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18471 If you use inline assembler to read from locations outside the
18472 16-bit address range and change one of the @code{RAMP} registers,
18473 you must reset it to zero after the access.
18474
18475 @end itemize
18476
18477 @subsubsection AVR Built-in Macros
18478
18479 GCC defines several built-in macros so that the user code can test
18480 for the presence or absence of features. Almost any of the following
18481 built-in macros are deduced from device capabilities and thus
18482 triggered by the @option{-mmcu=} command-line option.
18483
18484 For even more AVR-specific built-in macros see
18485 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18486
18487 @table @code
18488
18489 @item __AVR_ARCH__
18490 Build-in macro that resolves to a decimal number that identifies the
18491 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18492 Possible values are:
18493
18494 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18495 @code{4}, @code{5}, @code{51}, @code{6}
18496
18497 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18498 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18499
18500 respectively and
18501
18502 @code{100},
18503 @code{102}, @code{103}, @code{104},
18504 @code{105}, @code{106}, @code{107}
18505
18506 for @var{mcu}=@code{avrtiny},
18507 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18508 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18509 If @var{mcu} specifies a device, this built-in macro is set
18510 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18511 defined to @code{4}.
18512
18513 @item __AVR_@var{Device}__
18514 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18515 the device's name. For example, @option{-mmcu=atmega8} defines the
18516 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18517 @code{__AVR_ATtiny261A__}, etc.
18518
18519 The built-in macros' names follow
18520 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18521 the device name as from the AVR user manual. The difference between
18522 @var{Device} in the built-in macro and @var{device} in
18523 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18524
18525 If @var{device} is not a device but only a core architecture like
18526 @samp{avr51}, this macro is not defined.
18527
18528 @item __AVR_DEVICE_NAME__
18529 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18530 the device's name. For example, with @option{-mmcu=atmega8} the macro
18531 is defined to @code{atmega8}.
18532
18533 If @var{device} is not a device but only a core architecture like
18534 @samp{avr51}, this macro is not defined.
18535
18536 @item __AVR_XMEGA__
18537 The device / architecture belongs to the XMEGA family of devices.
18538
18539 @item __AVR_HAVE_ELPM__
18540 The device has the @code{ELPM} instruction.
18541
18542 @item __AVR_HAVE_ELPMX__
18543 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18544 R@var{n},Z+} instructions.
18545
18546 @item __AVR_HAVE_MOVW__
18547 The device has the @code{MOVW} instruction to perform 16-bit
18548 register-register moves.
18549
18550 @item __AVR_HAVE_LPMX__
18551 The device has the @code{LPM R@var{n},Z} and
18552 @code{LPM R@var{n},Z+} instructions.
18553
18554 @item __AVR_HAVE_MUL__
18555 The device has a hardware multiplier.
18556
18557 @item __AVR_HAVE_JMP_CALL__
18558 The device has the @code{JMP} and @code{CALL} instructions.
18559 This is the case for devices with more than 8@tie{}KiB of program
18560 memory.
18561
18562 @item __AVR_HAVE_EIJMP_EICALL__
18563 @itemx __AVR_3_BYTE_PC__
18564 The device has the @code{EIJMP} and @code{EICALL} instructions.
18565 This is the case for devices with more than 128@tie{}KiB of program memory.
18566 This also means that the program counter
18567 (PC) is 3@tie{}bytes wide.
18568
18569 @item __AVR_2_BYTE_PC__
18570 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18571 with up to 128@tie{}KiB of program memory.
18572
18573 @item __AVR_HAVE_8BIT_SP__
18574 @itemx __AVR_HAVE_16BIT_SP__
18575 The stack pointer (SP) register is treated as 8-bit respectively
18576 16-bit register by the compiler.
18577 The definition of these macros is affected by @option{-mtiny-stack}.
18578
18579 @item __AVR_HAVE_SPH__
18580 @itemx __AVR_SP8__
18581 The device has the SPH (high part of stack pointer) special function
18582 register or has an 8-bit stack pointer, respectively.
18583 The definition of these macros is affected by @option{-mmcu=} and
18584 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18585 by @option{-msp8}.
18586
18587 @item __AVR_HAVE_RAMPD__
18588 @itemx __AVR_HAVE_RAMPX__
18589 @itemx __AVR_HAVE_RAMPY__
18590 @itemx __AVR_HAVE_RAMPZ__
18591 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18592 @code{RAMPZ} special function register, respectively.
18593
18594 @item __NO_INTERRUPTS__
18595 This macro reflects the @option{-mno-interrupts} command-line option.
18596
18597 @item __AVR_ERRATA_SKIP__
18598 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18599 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18600 instructions because of a hardware erratum. Skip instructions are
18601 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18602 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18603 set.
18604
18605 @item __AVR_ISA_RMW__
18606 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18607
18608 @item __AVR_SFR_OFFSET__=@var{offset}
18609 Instructions that can address I/O special function registers directly
18610 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18611 address as if addressed by an instruction to access RAM like @code{LD}
18612 or @code{STS}. This offset depends on the device architecture and has
18613 to be subtracted from the RAM address in order to get the
18614 respective I/O@tie{}address.
18615
18616 @item __AVR_SHORT_CALLS__
18617 The @option{-mshort-calls} command line option is set.
18618
18619 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18620 Some devices support reading from flash memory by means of @code{LD*}
18621 instructions. The flash memory is seen in the data address space
18622 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18623 is not defined, this feature is not available. If defined,
18624 the address space is linear and there is no need to put
18625 @code{.rodata} into RAM. This is handled by the default linker
18626 description file, and is currently available for
18627 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18628 there is no need to use address spaces like @code{__flash} or
18629 features like attribute @code{progmem} and @code{pgm_read_*}.
18630
18631 @item __WITH_AVRLIBC__
18632 The compiler is configured to be used together with AVR-Libc.
18633 See the @option{--with-avrlibc} configure option.
18634
18635 @end table
18636
18637 @node Blackfin Options
18638 @subsection Blackfin Options
18639 @cindex Blackfin Options
18640
18641 @table @gcctabopt
18642 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18643 @opindex mcpu=
18644 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18645 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18646 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18647 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18648 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18649 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18650 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18651 @samp{bf561}, @samp{bf592}.
18652
18653 The optional @var{sirevision} specifies the silicon revision of the target
18654 Blackfin processor. Any workarounds available for the targeted silicon revision
18655 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18656 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18657 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18658 hexadecimal digits representing the major and minor numbers in the silicon
18659 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18660 is not defined. If @var{sirevision} is @samp{any}, the
18661 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18662 If this optional @var{sirevision} is not used, GCC assumes the latest known
18663 silicon revision of the targeted Blackfin processor.
18664
18665 GCC defines a preprocessor macro for the specified @var{cpu}.
18666 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18667 provided by libgloss to be linked in if @option{-msim} is not given.
18668
18669 Without this option, @samp{bf532} is used as the processor by default.
18670
18671 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18672 only the preprocessor macro is defined.
18673
18674 @item -msim
18675 @opindex msim
18676 Specifies that the program will be run on the simulator. This causes
18677 the simulator BSP provided by libgloss to be linked in. This option
18678 has effect only for @samp{bfin-elf} toolchain.
18679 Certain other options, such as @option{-mid-shared-library} and
18680 @option{-mfdpic}, imply @option{-msim}.
18681
18682 @item -momit-leaf-frame-pointer
18683 @opindex momit-leaf-frame-pointer
18684 Don't keep the frame pointer in a register for leaf functions. This
18685 avoids the instructions to save, set up and restore frame pointers and
18686 makes an extra register available in leaf functions.
18687
18688 @item -mspecld-anomaly
18689 @opindex mspecld-anomaly
18690 When enabled, the compiler ensures that the generated code does not
18691 contain speculative loads after jump instructions. If this option is used,
18692 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18693
18694 @item -mno-specld-anomaly
18695 @opindex mno-specld-anomaly
18696 @opindex mspecld-anomaly
18697 Don't generate extra code to prevent speculative loads from occurring.
18698
18699 @item -mcsync-anomaly
18700 @opindex mcsync-anomaly
18701 When enabled, the compiler ensures that the generated code does not
18702 contain CSYNC or SSYNC instructions too soon after conditional branches.
18703 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18704
18705 @item -mno-csync-anomaly
18706 @opindex mno-csync-anomaly
18707 @opindex mcsync-anomaly
18708 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18709 occurring too soon after a conditional branch.
18710
18711 @item -mlow64k
18712 @opindex mlow64k
18713 When enabled, the compiler is free to take advantage of the knowledge that
18714 the entire program fits into the low 64k of memory.
18715
18716 @item -mno-low64k
18717 @opindex mno-low64k
18718 Assume that the program is arbitrarily large. This is the default.
18719
18720 @item -mstack-check-l1
18721 @opindex mstack-check-l1
18722 Do stack checking using information placed into L1 scratchpad memory by the
18723 uClinux kernel.
18724
18725 @item -mid-shared-library
18726 @opindex mid-shared-library
18727 Generate code that supports shared libraries via the library ID method.
18728 This allows for execute in place and shared libraries in an environment
18729 without virtual memory management. This option implies @option{-fPIC}.
18730 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18731
18732 @item -mno-id-shared-library
18733 @opindex mno-id-shared-library
18734 @opindex mid-shared-library
18735 Generate code that doesn't assume ID-based shared libraries are being used.
18736 This is the default.
18737
18738 @item -mleaf-id-shared-library
18739 @opindex mleaf-id-shared-library
18740 Generate code that supports shared libraries via the library ID method,
18741 but assumes that this library or executable won't link against any other
18742 ID shared libraries. That allows the compiler to use faster code for jumps
18743 and calls.
18744
18745 @item -mno-leaf-id-shared-library
18746 @opindex mno-leaf-id-shared-library
18747 @opindex mleaf-id-shared-library
18748 Do not assume that the code being compiled won't link against any ID shared
18749 libraries. Slower code is generated for jump and call insns.
18750
18751 @item -mshared-library-id=n
18752 @opindex mshared-library-id
18753 Specifies the identification number of the ID-based shared library being
18754 compiled. Specifying a value of 0 generates more compact code; specifying
18755 other values forces the allocation of that number to the current
18756 library but is no more space- or time-efficient than omitting this option.
18757
18758 @item -msep-data
18759 @opindex msep-data
18760 Generate code that allows the data segment to be located in a different
18761 area of memory from the text segment. This allows for execute in place in
18762 an environment without virtual memory management by eliminating relocations
18763 against the text section.
18764
18765 @item -mno-sep-data
18766 @opindex mno-sep-data
18767 @opindex msep-data
18768 Generate code that assumes that the data segment follows the text segment.
18769 This is the default.
18770
18771 @item -mlong-calls
18772 @itemx -mno-long-calls
18773 @opindex mlong-calls
18774 @opindex mno-long-calls
18775 Tells the compiler to perform function calls by first loading the
18776 address of the function into a register and then performing a subroutine
18777 call on this register. This switch is needed if the target function
18778 lies outside of the 24-bit addressing range of the offset-based
18779 version of subroutine call instruction.
18780
18781 This feature is not enabled by default. Specifying
18782 @option{-mno-long-calls} restores the default behavior. Note these
18783 switches have no effect on how the compiler generates code to handle
18784 function calls via function pointers.
18785
18786 @item -mfast-fp
18787 @opindex mfast-fp
18788 Link with the fast floating-point library. This library relaxes some of
18789 the IEEE floating-point standard's rules for checking inputs against
18790 Not-a-Number (NAN), in the interest of performance.
18791
18792 @item -minline-plt
18793 @opindex minline-plt
18794 Enable inlining of PLT entries in function calls to functions that are
18795 not known to bind locally. It has no effect without @option{-mfdpic}.
18796
18797 @item -mmulticore
18798 @opindex mmulticore
18799 Build a standalone application for multicore Blackfin processors.
18800 This option causes proper start files and link scripts supporting
18801 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18802 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18803
18804 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18805 selects the one-application-per-core programming model. Without
18806 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18807 programming model is used. In this model, the main function of Core B
18808 should be named as @code{coreb_main}.
18809
18810 If this option is not used, the single-core application programming
18811 model is used.
18812
18813 @item -mcorea
18814 @opindex mcorea
18815 Build a standalone application for Core A of BF561 when using
18816 the one-application-per-core programming model. Proper start files
18817 and link scripts are used to support Core A, and the macro
18818 @code{__BFIN_COREA} is defined.
18819 This option can only be used in conjunction with @option{-mmulticore}.
18820
18821 @item -mcoreb
18822 @opindex mcoreb
18823 Build a standalone application for Core B of BF561 when using
18824 the one-application-per-core programming model. Proper start files
18825 and link scripts are used to support Core B, and the macro
18826 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18827 should be used instead of @code{main}.
18828 This option can only be used in conjunction with @option{-mmulticore}.
18829
18830 @item -msdram
18831 @opindex msdram
18832 Build a standalone application for SDRAM. Proper start files and
18833 link scripts are used to put the application into SDRAM, and the macro
18834 @code{__BFIN_SDRAM} is defined.
18835 The loader should initialize SDRAM before loading the application.
18836
18837 @item -micplb
18838 @opindex micplb
18839 Assume that ICPLBs are enabled at run time. This has an effect on certain
18840 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18841 are enabled; for standalone applications the default is off.
18842 @end table
18843
18844 @node C6X Options
18845 @subsection C6X Options
18846 @cindex C6X Options
18847
18848 @table @gcctabopt
18849 @item -march=@var{name}
18850 @opindex march
18851 This specifies the name of the target architecture. GCC uses this
18852 name to determine what kind of instructions it can emit when generating
18853 assembly code. Permissible names are: @samp{c62x},
18854 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18855
18856 @item -mbig-endian
18857 @opindex mbig-endian
18858 Generate code for a big-endian target.
18859
18860 @item -mlittle-endian
18861 @opindex mlittle-endian
18862 Generate code for a little-endian target. This is the default.
18863
18864 @item -msim
18865 @opindex msim
18866 Choose startup files and linker script suitable for the simulator.
18867
18868 @item -msdata=default
18869 @opindex msdata=default
18870 Put small global and static data in the @code{.neardata} section,
18871 which is pointed to by register @code{B14}. Put small uninitialized
18872 global and static data in the @code{.bss} section, which is adjacent
18873 to the @code{.neardata} section. Put small read-only data into the
18874 @code{.rodata} section. The corresponding sections used for large
18875 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18876
18877 @item -msdata=all
18878 @opindex msdata=all
18879 Put all data, not just small objects, into the sections reserved for
18880 small data, and use addressing relative to the @code{B14} register to
18881 access them.
18882
18883 @item -msdata=none
18884 @opindex msdata=none
18885 Make no use of the sections reserved for small data, and use absolute
18886 addresses to access all data. Put all initialized global and static
18887 data in the @code{.fardata} section, and all uninitialized data in the
18888 @code{.far} section. Put all constant data into the @code{.const}
18889 section.
18890 @end table
18891
18892 @node CRIS Options
18893 @subsection CRIS Options
18894 @cindex CRIS Options
18895
18896 These options are defined specifically for the CRIS ports.
18897
18898 @table @gcctabopt
18899 @item -march=@var{architecture-type}
18900 @itemx -mcpu=@var{architecture-type}
18901 @opindex march
18902 @opindex mcpu
18903 Generate code for the specified architecture. The choices for
18904 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18905 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18906 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18907 @samp{v10}.
18908
18909 @item -mtune=@var{architecture-type}
18910 @opindex mtune
18911 Tune to @var{architecture-type} everything applicable about the generated
18912 code, except for the ABI and the set of available instructions. The
18913 choices for @var{architecture-type} are the same as for
18914 @option{-march=@var{architecture-type}}.
18915
18916 @item -mmax-stack-frame=@var{n}
18917 @opindex mmax-stack-frame
18918 Warn when the stack frame of a function exceeds @var{n} bytes.
18919
18920 @item -metrax4
18921 @itemx -metrax100
18922 @opindex metrax4
18923 @opindex metrax100
18924 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18925 @option{-march=v3} and @option{-march=v8} respectively.
18926
18927 @item -mmul-bug-workaround
18928 @itemx -mno-mul-bug-workaround
18929 @opindex mmul-bug-workaround
18930 @opindex mno-mul-bug-workaround
18931 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18932 models where it applies. This option is active by default.
18933
18934 @item -mpdebug
18935 @opindex mpdebug
18936 Enable CRIS-specific verbose debug-related information in the assembly
18937 code. This option also has the effect of turning off the @samp{#NO_APP}
18938 formatted-code indicator to the assembler at the beginning of the
18939 assembly file.
18940
18941 @item -mcc-init
18942 @opindex mcc-init
18943 Do not use condition-code results from previous instruction; always emit
18944 compare and test instructions before use of condition codes.
18945
18946 @item -mno-side-effects
18947 @opindex mno-side-effects
18948 @opindex mside-effects
18949 Do not emit instructions with side effects in addressing modes other than
18950 post-increment.
18951
18952 @item -mstack-align
18953 @itemx -mno-stack-align
18954 @itemx -mdata-align
18955 @itemx -mno-data-align
18956 @itemx -mconst-align
18957 @itemx -mno-const-align
18958 @opindex mstack-align
18959 @opindex mno-stack-align
18960 @opindex mdata-align
18961 @opindex mno-data-align
18962 @opindex mconst-align
18963 @opindex mno-const-align
18964 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18965 stack frame, individual data and constants to be aligned for the maximum
18966 single data access size for the chosen CPU model. The default is to
18967 arrange for 32-bit alignment. ABI details such as structure layout are
18968 not affected by these options.
18969
18970 @item -m32-bit
18971 @itemx -m16-bit
18972 @itemx -m8-bit
18973 @opindex m32-bit
18974 @opindex m16-bit
18975 @opindex m8-bit
18976 Similar to the stack- data- and const-align options above, these options
18977 arrange for stack frame, writable data and constants to all be 32-bit,
18978 16-bit or 8-bit aligned. The default is 32-bit alignment.
18979
18980 @item -mno-prologue-epilogue
18981 @itemx -mprologue-epilogue
18982 @opindex mno-prologue-epilogue
18983 @opindex mprologue-epilogue
18984 With @option{-mno-prologue-epilogue}, the normal function prologue and
18985 epilogue which set up the stack frame are omitted and no return
18986 instructions or return sequences are generated in the code. Use this
18987 option only together with visual inspection of the compiled code: no
18988 warnings or errors are generated when call-saved registers must be saved,
18989 or storage for local variables needs to be allocated.
18990
18991 @item -mno-gotplt
18992 @itemx -mgotplt
18993 @opindex mno-gotplt
18994 @opindex mgotplt
18995 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18996 instruction sequences that load addresses for functions from the PLT part
18997 of the GOT rather than (traditional on other architectures) calls to the
18998 PLT@. The default is @option{-mgotplt}.
18999
19000 @item -melf
19001 @opindex melf
19002 Legacy no-op option only recognized with the cris-axis-elf and
19003 cris-axis-linux-gnu targets.
19004
19005 @item -mlinux
19006 @opindex mlinux
19007 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
19008
19009 @item -sim
19010 @opindex sim
19011 This option, recognized for the cris-axis-elf, arranges
19012 to link with input-output functions from a simulator library. Code,
19013 initialized data and zero-initialized data are allocated consecutively.
19014
19015 @item -sim2
19016 @opindex sim2
19017 Like @option{-sim}, but pass linker options to locate initialized data at
19018 0x40000000 and zero-initialized data at 0x80000000.
19019 @end table
19020
19021 @node CR16 Options
19022 @subsection CR16 Options
19023 @cindex CR16 Options
19024
19025 These options are defined specifically for the CR16 ports.
19026
19027 @table @gcctabopt
19028
19029 @item -mmac
19030 @opindex mmac
19031 Enable the use of multiply-accumulate instructions. Disabled by default.
19032
19033 @item -mcr16cplus
19034 @itemx -mcr16c
19035 @opindex mcr16cplus
19036 @opindex mcr16c
19037 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19038 is default.
19039
19040 @item -msim
19041 @opindex msim
19042 Links the library libsim.a which is in compatible with simulator. Applicable
19043 to ELF compiler only.
19044
19045 @item -mint32
19046 @opindex mint32
19047 Choose integer type as 32-bit wide.
19048
19049 @item -mbit-ops
19050 @opindex mbit-ops
19051 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
19052
19053 @item -mdata-model=@var{model}
19054 @opindex mdata-model
19055 Choose a data model. The choices for @var{model} are @samp{near},
19056 @samp{far} or @samp{medium}. @samp{medium} is default.
19057 However, @samp{far} is not valid with @option{-mcr16c}, as the
19058 CR16C architecture does not support the far data model.
19059 @end table
19060
19061 @node C-SKY Options
19062 @subsection C-SKY Options
19063 @cindex C-SKY Options
19064
19065 GCC supports these options when compiling for C-SKY V2 processors.
19066
19067 @table @gcctabopt
19068
19069 @item -march=@var{arch}
19070 @opindex march=
19071 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19072 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19073 The default is @samp{ck810}.
19074
19075 @item -mcpu=@var{cpu}
19076 @opindex mcpu=
19077 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19078 @samp{ck801}, @samp{ck801t},
19079 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19080 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19081 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19082 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19083 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19084 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19085 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19086 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19087 @samp{ck803eftr1}, @samp{ck803efhtr1},
19088 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19089 @samp{ck803sef}, @samp{ck803seft},
19090 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19091 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19092 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19093 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19094
19095 @item -mbig-endian
19096 @opindex mbig-endian
19097 @itemx -EB
19098 @opindex EB
19099 @itemx -mlittle-endian
19100 @opindex mlittle-endian
19101 @itemx -EL
19102 @opindex EL
19103
19104 Select big- or little-endian code. The default is little-endian.
19105
19106 @item -mhard-float
19107 @opindex mhard-float
19108 @itemx -msoft-float
19109 @opindex msoft-float
19110
19111 Select hardware or software floating-point implementations.
19112 The default is soft float.
19113
19114 @item -mdouble-float
19115 @itemx -mno-double-float
19116 @opindex mdouble-float
19117 When @option{-mhard-float} is in effect, enable generation of
19118 double-precision float instructions. This is the default except
19119 when compiling for CK803.
19120
19121 @item -mfdivdu
19122 @itemx -mno-fdivdu
19123 @opindex mfdivdu
19124 When @option{-mhard-float} is in effect, enable generation of
19125 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19126 This is the default except when compiling for CK803.
19127
19128 @item -mfpu=@var{fpu}
19129 @opindex mfpu=
19130 Select the floating-point processor. This option can only be used with
19131 @option{-mhard-float}.
19132 Values for @var{fpu} are
19133 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19134 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19135 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19136
19137 @item -melrw
19138 @itemx -mno-elrw
19139 @opindex melrw
19140 Enable the extended @code{lrw} instruction. This option defaults to on
19141 for CK801 and off otherwise.
19142
19143 @item -mistack
19144 @itemx -mno-istack
19145 @opindex mistack
19146 Enable interrupt stack instructions; the default is off.
19147
19148 The @option{-mistack} option is required to handle the
19149 @code{interrupt} and @code{isr} function attributes
19150 (@pxref{C-SKY Function Attributes}).
19151
19152 @item -mmp
19153 @opindex mmp
19154 Enable multiprocessor instructions; the default is off.
19155
19156 @item -mcp
19157 @opindex mcp
19158 Enable coprocessor instructions; the default is off.
19159
19160 @item -mcache
19161 @opindex mcache
19162 Enable coprocessor instructions; the default is off.
19163
19164 @item -msecurity
19165 @opindex msecurity
19166 Enable C-SKY security instructions; the default is off.
19167
19168 @item -mtrust
19169 @opindex mtrust
19170 Enable C-SKY trust instructions; the default is off.
19171
19172 @item -mdsp
19173 @opindex mdsp
19174 @itemx -medsp
19175 @opindex medsp
19176 @itemx -mvdsp
19177 @opindex mvdsp
19178 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19179 All of these options default to off.
19180
19181 @item -mdiv
19182 @itemx -mno-div
19183 @opindex mdiv
19184 Generate divide instructions. Default is off.
19185
19186 @item -msmart
19187 @itemx -mno-smart
19188 @opindex msmart
19189 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19190 use of 16-bit instructions. This option is ignored for CK801 where this
19191 is the required behavior, and it defaults to on for CK802.
19192 For other targets, the default is off.
19193
19194 @item -mhigh-registers
19195 @itemx -mno-high-registers
19196 @opindex mhigh-registers
19197 Generate code using the high registers numbered 16-31. This option
19198 is not supported on CK801, CK802, or CK803, and is enabled by default
19199 for other processors.
19200
19201 @item -manchor
19202 @itemx -mno-anchor
19203 @opindex manchor
19204 Generate code using global anchor symbol addresses.
19205
19206 @item -mpushpop
19207 @itemx -mno-pushpop
19208 @opindex mpushpop
19209 Generate code using @code{push} and @code{pop} instructions. This option
19210 defaults to on.
19211
19212 @item -mmultiple-stld
19213 @itemx -mstm
19214 @itemx -mno-multiple-stld
19215 @itemx -mno-stm
19216 @opindex mmultiple-stld
19217 Generate code using @code{stm} and @code{ldm} instructions. This option
19218 isn't supported on CK801 but is enabled by default on other processors.
19219
19220 @item -mconstpool
19221 @itemx -mno-constpool
19222 @opindex mconstpool
19223 Create constant pools in the compiler instead of deferring it to the
19224 assembler. This option is the default and required for correct code
19225 generation on CK801 and CK802, and is optional on other processors.
19226
19227 @item -mstack-size
19228 @item -mno-stack-size
19229 @opindex mstack-size
19230 Emit @code{.stack_size} directives for each function in the assembly
19231 output. This option defaults to off.
19232
19233 @item -mccrt
19234 @itemx -mno-ccrt
19235 @opindex mccrt
19236 Generate code for the C-SKY compiler runtime instead of libgcc. This
19237 option defaults to off.
19238
19239 @item -mbranch-cost=@var{n}
19240 @opindex mbranch-cost=
19241 Set the branch costs to roughly @code{n} instructions. The default is 1.
19242
19243 @item -msched-prolog
19244 @itemx -mno-sched-prolog
19245 @opindex msched-prolog
19246 Permit scheduling of function prologue and epilogue sequences. Using
19247 this option can result in code that is not compliant with the C-SKY V2 ABI
19248 prologue requirements and that cannot be debugged or backtraced.
19249 It is disabled by default.
19250
19251 @end table
19252
19253 @node Darwin Options
19254 @subsection Darwin Options
19255 @cindex Darwin options
19256
19257 These options are defined for all architectures running the Darwin operating
19258 system.
19259
19260 FSF GCC on Darwin does not create ``fat'' object files; it creates
19261 an object file for the single architecture that GCC was built to
19262 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19263 @option{-arch} options are used; it does so by running the compiler or
19264 linker multiple times and joining the results together with
19265 @file{lipo}.
19266
19267 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19268 @samp{i686}) is determined by the flags that specify the ISA
19269 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19270 @option{-force_cpusubtype_ALL} option can be used to override this.
19271
19272 The Darwin tools vary in their behavior when presented with an ISA
19273 mismatch. The assembler, @file{as}, only permits instructions to
19274 be used that are valid for the subtype of the file it is generating,
19275 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19276 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19277 and prints an error if asked to create a shared library with a less
19278 restrictive subtype than its input files (for instance, trying to put
19279 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19280 for executables, @command{ld}, quietly gives the executable the most
19281 restrictive subtype of any of its input files.
19282
19283 @table @gcctabopt
19284 @item -F@var{dir}
19285 @opindex F
19286 Add the framework directory @var{dir} to the head of the list of
19287 directories to be searched for header files. These directories are
19288 interleaved with those specified by @option{-I} options and are
19289 scanned in a left-to-right order.
19290
19291 A framework directory is a directory with frameworks in it. A
19292 framework is a directory with a @file{Headers} and/or
19293 @file{PrivateHeaders} directory contained directly in it that ends
19294 in @file{.framework}. The name of a framework is the name of this
19295 directory excluding the @file{.framework}. Headers associated with
19296 the framework are found in one of those two directories, with
19297 @file{Headers} being searched first. A subframework is a framework
19298 directory that is in a framework's @file{Frameworks} directory.
19299 Includes of subframework headers can only appear in a header of a
19300 framework that contains the subframework, or in a sibling subframework
19301 header. Two subframeworks are siblings if they occur in the same
19302 framework. A subframework should not have the same name as a
19303 framework; a warning is issued if this is violated. Currently a
19304 subframework cannot have subframeworks; in the future, the mechanism
19305 may be extended to support this. The standard frameworks can be found
19306 in @file{/System/Library/Frameworks} and
19307 @file{/Library/Frameworks}. An example include looks like
19308 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19309 the name of the framework and @file{header.h} is found in the
19310 @file{PrivateHeaders} or @file{Headers} directory.
19311
19312 @item -iframework@var{dir}
19313 @opindex iframework
19314 Like @option{-F} except the directory is a treated as a system
19315 directory. The main difference between this @option{-iframework} and
19316 @option{-F} is that with @option{-iframework} the compiler does not
19317 warn about constructs contained within header files found via
19318 @var{dir}. This option is valid only for the C family of languages.
19319
19320 @item -gused
19321 @opindex gused
19322 Emit debugging information for symbols that are used. For stabs
19323 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19324 This is by default ON@.
19325
19326 @item -gfull
19327 @opindex gfull
19328 Emit debugging information for all symbols and types.
19329
19330 @item -mmacosx-version-min=@var{version}
19331 The earliest version of MacOS X that this executable will run on
19332 is @var{version}. Typical values of @var{version} include @code{10.1},
19333 @code{10.2}, and @code{10.3.9}.
19334
19335 If the compiler was built to use the system's headers by default,
19336 then the default for this option is the system version on which the
19337 compiler is running, otherwise the default is to make choices that
19338 are compatible with as many systems and code bases as possible.
19339
19340 @item -mkernel
19341 @opindex mkernel
19342 Enable kernel development mode. The @option{-mkernel} option sets
19343 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19344 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19345 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19346 applicable. This mode also sets @option{-mno-altivec},
19347 @option{-msoft-float}, @option{-fno-builtin} and
19348 @option{-mlong-branch} for PowerPC targets.
19349
19350 @item -mone-byte-bool
19351 @opindex mone-byte-bool
19352 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19353 By default @code{sizeof(bool)} is @code{4} when compiling for
19354 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19355 option has no effect on x86.
19356
19357 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19358 to generate code that is not binary compatible with code generated
19359 without that switch. Using this switch may require recompiling all
19360 other modules in a program, including system libraries. Use this
19361 switch to conform to a non-default data model.
19362
19363 @item -mfix-and-continue
19364 @itemx -ffix-and-continue
19365 @itemx -findirect-data
19366 @opindex mfix-and-continue
19367 @opindex ffix-and-continue
19368 @opindex findirect-data
19369 Generate code suitable for fast turnaround development, such as to
19370 allow GDB to dynamically load @file{.o} files into already-running
19371 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19372 are provided for backwards compatibility.
19373
19374 @item -all_load
19375 @opindex all_load
19376 Loads all members of static archive libraries.
19377 See man ld(1) for more information.
19378
19379 @item -arch_errors_fatal
19380 @opindex arch_errors_fatal
19381 Cause the errors having to do with files that have the wrong architecture
19382 to be fatal.
19383
19384 @item -bind_at_load
19385 @opindex bind_at_load
19386 Causes the output file to be marked such that the dynamic linker will
19387 bind all undefined references when the file is loaded or launched.
19388
19389 @item -bundle
19390 @opindex bundle
19391 Produce a Mach-o bundle format file.
19392 See man ld(1) for more information.
19393
19394 @item -bundle_loader @var{executable}
19395 @opindex bundle_loader
19396 This option specifies the @var{executable} that will load the build
19397 output file being linked. See man ld(1) for more information.
19398
19399 @item -dynamiclib
19400 @opindex dynamiclib
19401 When passed this option, GCC produces a dynamic library instead of
19402 an executable when linking, using the Darwin @file{libtool} command.
19403
19404 @item -force_cpusubtype_ALL
19405 @opindex force_cpusubtype_ALL
19406 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19407 one controlled by the @option{-mcpu} or @option{-march} option.
19408
19409 @item -allowable_client @var{client_name}
19410 @itemx -client_name
19411 @itemx -compatibility_version
19412 @itemx -current_version
19413 @itemx -dead_strip
19414 @itemx -dependency-file
19415 @itemx -dylib_file
19416 @itemx -dylinker_install_name
19417 @itemx -dynamic
19418 @itemx -exported_symbols_list
19419 @itemx -filelist
19420 @need 800
19421 @itemx -flat_namespace
19422 @itemx -force_flat_namespace
19423 @itemx -headerpad_max_install_names
19424 @itemx -image_base
19425 @itemx -init
19426 @itemx -install_name
19427 @itemx -keep_private_externs
19428 @itemx -multi_module
19429 @itemx -multiply_defined
19430 @itemx -multiply_defined_unused
19431 @need 800
19432 @itemx -noall_load
19433 @itemx -no_dead_strip_inits_and_terms
19434 @itemx -nofixprebinding
19435 @itemx -nomultidefs
19436 @itemx -noprebind
19437 @itemx -noseglinkedit
19438 @itemx -pagezero_size
19439 @itemx -prebind
19440 @itemx -prebind_all_twolevel_modules
19441 @itemx -private_bundle
19442 @need 800
19443 @itemx -read_only_relocs
19444 @itemx -sectalign
19445 @itemx -sectobjectsymbols
19446 @itemx -whyload
19447 @itemx -seg1addr
19448 @itemx -sectcreate
19449 @itemx -sectobjectsymbols
19450 @itemx -sectorder
19451 @itemx -segaddr
19452 @itemx -segs_read_only_addr
19453 @need 800
19454 @itemx -segs_read_write_addr
19455 @itemx -seg_addr_table
19456 @itemx -seg_addr_table_filename
19457 @itemx -seglinkedit
19458 @itemx -segprot
19459 @itemx -segs_read_only_addr
19460 @itemx -segs_read_write_addr
19461 @itemx -single_module
19462 @itemx -static
19463 @itemx -sub_library
19464 @need 800
19465 @itemx -sub_umbrella
19466 @itemx -twolevel_namespace
19467 @itemx -umbrella
19468 @itemx -undefined
19469 @itemx -unexported_symbols_list
19470 @itemx -weak_reference_mismatches
19471 @itemx -whatsloaded
19472 @opindex allowable_client
19473 @opindex client_name
19474 @opindex compatibility_version
19475 @opindex current_version
19476 @opindex dead_strip
19477 @opindex dependency-file
19478 @opindex dylib_file
19479 @opindex dylinker_install_name
19480 @opindex dynamic
19481 @opindex exported_symbols_list
19482 @opindex filelist
19483 @opindex flat_namespace
19484 @opindex force_flat_namespace
19485 @opindex headerpad_max_install_names
19486 @opindex image_base
19487 @opindex init
19488 @opindex install_name
19489 @opindex keep_private_externs
19490 @opindex multi_module
19491 @opindex multiply_defined
19492 @opindex multiply_defined_unused
19493 @opindex noall_load
19494 @opindex no_dead_strip_inits_and_terms
19495 @opindex nofixprebinding
19496 @opindex nomultidefs
19497 @opindex noprebind
19498 @opindex noseglinkedit
19499 @opindex pagezero_size
19500 @opindex prebind
19501 @opindex prebind_all_twolevel_modules
19502 @opindex private_bundle
19503 @opindex read_only_relocs
19504 @opindex sectalign
19505 @opindex sectobjectsymbols
19506 @opindex whyload
19507 @opindex seg1addr
19508 @opindex sectcreate
19509 @opindex sectobjectsymbols
19510 @opindex sectorder
19511 @opindex segaddr
19512 @opindex segs_read_only_addr
19513 @opindex segs_read_write_addr
19514 @opindex seg_addr_table
19515 @opindex seg_addr_table_filename
19516 @opindex seglinkedit
19517 @opindex segprot
19518 @opindex segs_read_only_addr
19519 @opindex segs_read_write_addr
19520 @opindex single_module
19521 @opindex static
19522 @opindex sub_library
19523 @opindex sub_umbrella
19524 @opindex twolevel_namespace
19525 @opindex umbrella
19526 @opindex undefined
19527 @opindex unexported_symbols_list
19528 @opindex weak_reference_mismatches
19529 @opindex whatsloaded
19530 These options are passed to the Darwin linker. The Darwin linker man page
19531 describes them in detail.
19532 @end table
19533
19534 @node DEC Alpha Options
19535 @subsection DEC Alpha Options
19536
19537 These @samp{-m} options are defined for the DEC Alpha implementations:
19538
19539 @table @gcctabopt
19540 @item -mno-soft-float
19541 @itemx -msoft-float
19542 @opindex mno-soft-float
19543 @opindex msoft-float
19544 Use (do not use) the hardware floating-point instructions for
19545 floating-point operations. When @option{-msoft-float} is specified,
19546 functions in @file{libgcc.a} are used to perform floating-point
19547 operations. Unless they are replaced by routines that emulate the
19548 floating-point operations, or compiled in such a way as to call such
19549 emulations routines, these routines issue floating-point
19550 operations. If you are compiling for an Alpha without floating-point
19551 operations, you must ensure that the library is built so as not to call
19552 them.
19553
19554 Note that Alpha implementations without floating-point operations are
19555 required to have floating-point registers.
19556
19557 @item -mfp-reg
19558 @itemx -mno-fp-regs
19559 @opindex mfp-reg
19560 @opindex mno-fp-regs
19561 Generate code that uses (does not use) the floating-point register set.
19562 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19563 register set is not used, floating-point operands are passed in integer
19564 registers as if they were integers and floating-point results are passed
19565 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19566 so any function with a floating-point argument or return value called by code
19567 compiled with @option{-mno-fp-regs} must also be compiled with that
19568 option.
19569
19570 A typical use of this option is building a kernel that does not use,
19571 and hence need not save and restore, any floating-point registers.
19572
19573 @item -mieee
19574 @opindex mieee
19575 The Alpha architecture implements floating-point hardware optimized for
19576 maximum performance. It is mostly compliant with the IEEE floating-point
19577 standard. However, for full compliance, software assistance is
19578 required. This option generates code fully IEEE-compliant code
19579 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19580 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19581 defined during compilation. The resulting code is less efficient but is
19582 able to correctly support denormalized numbers and exceptional IEEE
19583 values such as not-a-number and plus/minus infinity. Other Alpha
19584 compilers call this option @option{-ieee_with_no_inexact}.
19585
19586 @item -mieee-with-inexact
19587 @opindex mieee-with-inexact
19588 This is like @option{-mieee} except the generated code also maintains
19589 the IEEE @var{inexact-flag}. Turning on this option causes the
19590 generated code to implement fully-compliant IEEE math. In addition to
19591 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19592 macro. On some Alpha implementations the resulting code may execute
19593 significantly slower than the code generated by default. Since there is
19594 very little code that depends on the @var{inexact-flag}, you should
19595 normally not specify this option. Other Alpha compilers call this
19596 option @option{-ieee_with_inexact}.
19597
19598 @item -mfp-trap-mode=@var{trap-mode}
19599 @opindex mfp-trap-mode
19600 This option controls what floating-point related traps are enabled.
19601 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19602 The trap mode can be set to one of four values:
19603
19604 @table @samp
19605 @item n
19606 This is the default (normal) setting. The only traps that are enabled
19607 are the ones that cannot be disabled in software (e.g., division by zero
19608 trap).
19609
19610 @item u
19611 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19612 as well.
19613
19614 @item su
19615 Like @samp{u}, but the instructions are marked to be safe for software
19616 completion (see Alpha architecture manual for details).
19617
19618 @item sui
19619 Like @samp{su}, but inexact traps are enabled as well.
19620 @end table
19621
19622 @item -mfp-rounding-mode=@var{rounding-mode}
19623 @opindex mfp-rounding-mode
19624 Selects the IEEE rounding mode. Other Alpha compilers call this option
19625 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19626 of:
19627
19628 @table @samp
19629 @item n
19630 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19631 the nearest machine number or towards the even machine number in case
19632 of a tie.
19633
19634 @item m
19635 Round towards minus infinity.
19636
19637 @item c
19638 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19639
19640 @item d
19641 Dynamic rounding mode. A field in the floating-point control register
19642 (@var{fpcr}, see Alpha architecture reference manual) controls the
19643 rounding mode in effect. The C library initializes this register for
19644 rounding towards plus infinity. Thus, unless your program modifies the
19645 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19646 @end table
19647
19648 @item -mtrap-precision=@var{trap-precision}
19649 @opindex mtrap-precision
19650 In the Alpha architecture, floating-point traps are imprecise. This
19651 means without software assistance it is impossible to recover from a
19652 floating trap and program execution normally needs to be terminated.
19653 GCC can generate code that can assist operating system trap handlers
19654 in determining the exact location that caused a floating-point trap.
19655 Depending on the requirements of an application, different levels of
19656 precisions can be selected:
19657
19658 @table @samp
19659 @item p
19660 Program precision. This option is the default and means a trap handler
19661 can only identify which program caused a floating-point exception.
19662
19663 @item f
19664 Function precision. The trap handler can determine the function that
19665 caused a floating-point exception.
19666
19667 @item i
19668 Instruction precision. The trap handler can determine the exact
19669 instruction that caused a floating-point exception.
19670 @end table
19671
19672 Other Alpha compilers provide the equivalent options called
19673 @option{-scope_safe} and @option{-resumption_safe}.
19674
19675 @item -mieee-conformant
19676 @opindex mieee-conformant
19677 This option marks the generated code as IEEE conformant. You must not
19678 use this option unless you also specify @option{-mtrap-precision=i} and either
19679 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19680 is to emit the line @samp{.eflag 48} in the function prologue of the
19681 generated assembly file.
19682
19683 @item -mbuild-constants
19684 @opindex mbuild-constants
19685 Normally GCC examines a 32- or 64-bit integer constant to
19686 see if it can construct it from smaller constants in two or three
19687 instructions. If it cannot, it outputs the constant as a literal and
19688 generates code to load it from the data segment at run time.
19689
19690 Use this option to require GCC to construct @emph{all} integer constants
19691 using code, even if it takes more instructions (the maximum is six).
19692
19693 You typically use this option to build a shared library dynamic
19694 loader. Itself a shared library, it must relocate itself in memory
19695 before it can find the variables and constants in its own data segment.
19696
19697 @item -mbwx
19698 @itemx -mno-bwx
19699 @itemx -mcix
19700 @itemx -mno-cix
19701 @itemx -mfix
19702 @itemx -mno-fix
19703 @itemx -mmax
19704 @itemx -mno-max
19705 @opindex mbwx
19706 @opindex mno-bwx
19707 @opindex mcix
19708 @opindex mno-cix
19709 @opindex mfix
19710 @opindex mno-fix
19711 @opindex mmax
19712 @opindex mno-max
19713 Indicate whether GCC should generate code to use the optional BWX,
19714 CIX, FIX and MAX instruction sets. The default is to use the instruction
19715 sets supported by the CPU type specified via @option{-mcpu=} option or that
19716 of the CPU on which GCC was built if none is specified.
19717
19718 @item -mfloat-vax
19719 @itemx -mfloat-ieee
19720 @opindex mfloat-vax
19721 @opindex mfloat-ieee
19722 Generate code that uses (does not use) VAX F and G floating-point
19723 arithmetic instead of IEEE single and double precision.
19724
19725 @item -mexplicit-relocs
19726 @itemx -mno-explicit-relocs
19727 @opindex mexplicit-relocs
19728 @opindex mno-explicit-relocs
19729 Older Alpha assemblers provided no way to generate symbol relocations
19730 except via assembler macros. Use of these macros does not allow
19731 optimal instruction scheduling. GNU binutils as of version 2.12
19732 supports a new syntax that allows the compiler to explicitly mark
19733 which relocations should apply to which instructions. This option
19734 is mostly useful for debugging, as GCC detects the capabilities of
19735 the assembler when it is built and sets the default accordingly.
19736
19737 @item -msmall-data
19738 @itemx -mlarge-data
19739 @opindex msmall-data
19740 @opindex mlarge-data
19741 When @option{-mexplicit-relocs} is in effect, static data is
19742 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19743 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19744 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19745 16-bit relocations off of the @code{$gp} register. This limits the
19746 size of the small data area to 64KB, but allows the variables to be
19747 directly accessed via a single instruction.
19748
19749 The default is @option{-mlarge-data}. With this option the data area
19750 is limited to just below 2GB@. Programs that require more than 2GB of
19751 data must use @code{malloc} or @code{mmap} to allocate the data in the
19752 heap instead of in the program's data segment.
19753
19754 When generating code for shared libraries, @option{-fpic} implies
19755 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19756
19757 @item -msmall-text
19758 @itemx -mlarge-text
19759 @opindex msmall-text
19760 @opindex mlarge-text
19761 When @option{-msmall-text} is used, the compiler assumes that the
19762 code of the entire program (or shared library) fits in 4MB, and is
19763 thus reachable with a branch instruction. When @option{-msmall-data}
19764 is used, the compiler can assume that all local symbols share the
19765 same @code{$gp} value, and thus reduce the number of instructions
19766 required for a function call from 4 to 1.
19767
19768 The default is @option{-mlarge-text}.
19769
19770 @item -mcpu=@var{cpu_type}
19771 @opindex mcpu
19772 Set the instruction set and instruction scheduling parameters for
19773 machine type @var{cpu_type}. You can specify either the @samp{EV}
19774 style name or the corresponding chip number. GCC supports scheduling
19775 parameters for the EV4, EV5 and EV6 family of processors and
19776 chooses the default values for the instruction set from the processor
19777 you specify. If you do not specify a processor type, GCC defaults
19778 to the processor on which the compiler was built.
19779
19780 Supported values for @var{cpu_type} are
19781
19782 @table @samp
19783 @item ev4
19784 @itemx ev45
19785 @itemx 21064
19786 Schedules as an EV4 and has no instruction set extensions.
19787
19788 @item ev5
19789 @itemx 21164
19790 Schedules as an EV5 and has no instruction set extensions.
19791
19792 @item ev56
19793 @itemx 21164a
19794 Schedules as an EV5 and supports the BWX extension.
19795
19796 @item pca56
19797 @itemx 21164pc
19798 @itemx 21164PC
19799 Schedules as an EV5 and supports the BWX and MAX extensions.
19800
19801 @item ev6
19802 @itemx 21264
19803 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19804
19805 @item ev67
19806 @itemx 21264a
19807 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19808 @end table
19809
19810 Native toolchains also support the value @samp{native},
19811 which selects the best architecture option for the host processor.
19812 @option{-mcpu=native} has no effect if GCC does not recognize
19813 the processor.
19814
19815 @item -mtune=@var{cpu_type}
19816 @opindex mtune
19817 Set only the instruction scheduling parameters for machine type
19818 @var{cpu_type}. The instruction set is not changed.
19819
19820 Native toolchains also support the value @samp{native},
19821 which selects the best architecture option for the host processor.
19822 @option{-mtune=native} has no effect if GCC does not recognize
19823 the processor.
19824
19825 @item -mmemory-latency=@var{time}
19826 @opindex mmemory-latency
19827 Sets the latency the scheduler should assume for typical memory
19828 references as seen by the application. This number is highly
19829 dependent on the memory access patterns used by the application
19830 and the size of the external cache on the machine.
19831
19832 Valid options for @var{time} are
19833
19834 @table @samp
19835 @item @var{number}
19836 A decimal number representing clock cycles.
19837
19838 @item L1
19839 @itemx L2
19840 @itemx L3
19841 @itemx main
19842 The compiler contains estimates of the number of clock cycles for
19843 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19844 (also called Dcache, Scache, and Bcache), as well as to main memory.
19845 Note that L3 is only valid for EV5.
19846
19847 @end table
19848 @end table
19849
19850 @node eBPF Options
19851 @subsection eBPF Options
19852 @cindex eBPF Options
19853
19854 @table @gcctabopt
19855 @item -mframe-limit=@var{bytes}
19856 This specifies the hard limit for frame sizes, in bytes. Currently,
19857 the value that can be specified should be less than or equal to
19858 @samp{32767}. Defaults to whatever limit is imposed by the version of
19859 the Linux kernel targeted.
19860
19861 @item -mkernel=@var{version}
19862 @opindex mkernel
19863 This specifies the minimum version of the kernel that will run the
19864 compiled program. GCC uses this version to determine which
19865 instructions to use, what kernel helpers to allow, etc. Currently,
19866 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19867 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19868 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19869 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19870 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19871 @samp{5.2}, @samp{latest} and @samp{native}.
19872
19873 @item -mbig-endian
19874 @opindex mbig-endian
19875 Generate code for a big-endian target.
19876
19877 @item -mlittle-endian
19878 @opindex mlittle-endian
19879 Generate code for a little-endian target. This is the default.
19880 @end table
19881
19882 @node FR30 Options
19883 @subsection FR30 Options
19884 @cindex FR30 Options
19885
19886 These options are defined specifically for the FR30 port.
19887
19888 @table @gcctabopt
19889
19890 @item -msmall-model
19891 @opindex msmall-model
19892 Use the small address space model. This can produce smaller code, but
19893 it does assume that all symbolic values and addresses fit into a
19894 20-bit range.
19895
19896 @item -mno-lsim
19897 @opindex mno-lsim
19898 Assume that runtime support has been provided and so there is no need
19899 to include the simulator library (@file{libsim.a}) on the linker
19900 command line.
19901
19902 @end table
19903
19904 @node FT32 Options
19905 @subsection FT32 Options
19906 @cindex FT32 Options
19907
19908 These options are defined specifically for the FT32 port.
19909
19910 @table @gcctabopt
19911
19912 @item -msim
19913 @opindex msim
19914 Specifies that the program will be run on the simulator. This causes
19915 an alternate runtime startup and library to be linked.
19916 You must not use this option when generating programs that will run on
19917 real hardware; you must provide your own runtime library for whatever
19918 I/O functions are needed.
19919
19920 @item -mlra
19921 @opindex mlra
19922 Enable Local Register Allocation. This is still experimental for FT32,
19923 so by default the compiler uses standard reload.
19924
19925 @item -mnodiv
19926 @opindex mnodiv
19927 Do not use div and mod instructions.
19928
19929 @item -mft32b
19930 @opindex mft32b
19931 Enable use of the extended instructions of the FT32B processor.
19932
19933 @item -mcompress
19934 @opindex mcompress
19935 Compress all code using the Ft32B code compression scheme.
19936
19937 @item -mnopm
19938 @opindex mnopm
19939 Do not generate code that reads program memory.
19940
19941 @end table
19942
19943 @node FRV Options
19944 @subsection FRV Options
19945 @cindex FRV Options
19946
19947 @table @gcctabopt
19948 @item -mgpr-32
19949 @opindex mgpr-32
19950
19951 Only use the first 32 general-purpose registers.
19952
19953 @item -mgpr-64
19954 @opindex mgpr-64
19955
19956 Use all 64 general-purpose registers.
19957
19958 @item -mfpr-32
19959 @opindex mfpr-32
19960
19961 Use only the first 32 floating-point registers.
19962
19963 @item -mfpr-64
19964 @opindex mfpr-64
19965
19966 Use all 64 floating-point registers.
19967
19968 @item -mhard-float
19969 @opindex mhard-float
19970
19971 Use hardware instructions for floating-point operations.
19972
19973 @item -msoft-float
19974 @opindex msoft-float
19975
19976 Use library routines for floating-point operations.
19977
19978 @item -malloc-cc
19979 @opindex malloc-cc
19980
19981 Dynamically allocate condition code registers.
19982
19983 @item -mfixed-cc
19984 @opindex mfixed-cc
19985
19986 Do not try to dynamically allocate condition code registers, only
19987 use @code{icc0} and @code{fcc0}.
19988
19989 @item -mdword
19990 @opindex mdword
19991
19992 Change ABI to use double word insns.
19993
19994 @item -mno-dword
19995 @opindex mno-dword
19996 @opindex mdword
19997
19998 Do not use double word instructions.
19999
20000 @item -mdouble
20001 @opindex mdouble
20002
20003 Use floating-point double instructions.
20004
20005 @item -mno-double
20006 @opindex mno-double
20007
20008 Do not use floating-point double instructions.
20009
20010 @item -mmedia
20011 @opindex mmedia
20012
20013 Use media instructions.
20014
20015 @item -mno-media
20016 @opindex mno-media
20017
20018 Do not use media instructions.
20019
20020 @item -mmuladd
20021 @opindex mmuladd
20022
20023 Use multiply and add/subtract instructions.
20024
20025 @item -mno-muladd
20026 @opindex mno-muladd
20027
20028 Do not use multiply and add/subtract instructions.
20029
20030 @item -mfdpic
20031 @opindex mfdpic
20032
20033 Select the FDPIC ABI, which uses function descriptors to represent
20034 pointers to functions. Without any PIC/PIE-related options, it
20035 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
20036 assumes GOT entries and small data are within a 12-bit range from the
20037 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
20038 are computed with 32 bits.
20039 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20040
20041 @item -minline-plt
20042 @opindex minline-plt
20043
20044 Enable inlining of PLT entries in function calls to functions that are
20045 not known to bind locally. It has no effect without @option{-mfdpic}.
20046 It's enabled by default if optimizing for speed and compiling for
20047 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
20048 optimization option such as @option{-O3} or above is present in the
20049 command line.
20050
20051 @item -mTLS
20052 @opindex mTLS
20053
20054 Assume a large TLS segment when generating thread-local code.
20055
20056 @item -mtls
20057 @opindex mtls
20058
20059 Do not assume a large TLS segment when generating thread-local code.
20060
20061 @item -mgprel-ro
20062 @opindex mgprel-ro
20063
20064 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20065 that is known to be in read-only sections. It's enabled by default,
20066 except for @option{-fpic} or @option{-fpie}: even though it may help
20067 make the global offset table smaller, it trades 1 instruction for 4.
20068 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20069 one of which may be shared by multiple symbols, and it avoids the need
20070 for a GOT entry for the referenced symbol, so it's more likely to be a
20071 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
20072
20073 @item -multilib-library-pic
20074 @opindex multilib-library-pic
20075
20076 Link with the (library, not FD) pic libraries. It's implied by
20077 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20078 @option{-fpic} without @option{-mfdpic}. You should never have to use
20079 it explicitly.
20080
20081 @item -mlinked-fp
20082 @opindex mlinked-fp
20083
20084 Follow the EABI requirement of always creating a frame pointer whenever
20085 a stack frame is allocated. This option is enabled by default and can
20086 be disabled with @option{-mno-linked-fp}.
20087
20088 @item -mlong-calls
20089 @opindex mlong-calls
20090
20091 Use indirect addressing to call functions outside the current
20092 compilation unit. This allows the functions to be placed anywhere
20093 within the 32-bit address space.
20094
20095 @item -malign-labels
20096 @opindex malign-labels
20097
20098 Try to align labels to an 8-byte boundary by inserting NOPs into the
20099 previous packet. This option only has an effect when VLIW packing
20100 is enabled. It doesn't create new packets; it merely adds NOPs to
20101 existing ones.
20102
20103 @item -mlibrary-pic
20104 @opindex mlibrary-pic
20105
20106 Generate position-independent EABI code.
20107
20108 @item -macc-4
20109 @opindex macc-4
20110
20111 Use only the first four media accumulator registers.
20112
20113 @item -macc-8
20114 @opindex macc-8
20115
20116 Use all eight media accumulator registers.
20117
20118 @item -mpack
20119 @opindex mpack
20120
20121 Pack VLIW instructions.
20122
20123 @item -mno-pack
20124 @opindex mno-pack
20125
20126 Do not pack VLIW instructions.
20127
20128 @item -mno-eflags
20129 @opindex mno-eflags
20130
20131 Do not mark ABI switches in e_flags.
20132
20133 @item -mcond-move
20134 @opindex mcond-move
20135
20136 Enable the use of conditional-move instructions (default).
20137
20138 This switch is mainly for debugging the compiler and will likely be removed
20139 in a future version.
20140
20141 @item -mno-cond-move
20142 @opindex mno-cond-move
20143
20144 Disable the use of conditional-move instructions.
20145
20146 This switch is mainly for debugging the compiler and will likely be removed
20147 in a future version.
20148
20149 @item -mscc
20150 @opindex mscc
20151
20152 Enable the use of conditional set instructions (default).
20153
20154 This switch is mainly for debugging the compiler and will likely be removed
20155 in a future version.
20156
20157 @item -mno-scc
20158 @opindex mno-scc
20159
20160 Disable the use of conditional set instructions.
20161
20162 This switch is mainly for debugging the compiler and will likely be removed
20163 in a future version.
20164
20165 @item -mcond-exec
20166 @opindex mcond-exec
20167
20168 Enable the use of conditional execution (default).
20169
20170 This switch is mainly for debugging the compiler and will likely be removed
20171 in a future version.
20172
20173 @item -mno-cond-exec
20174 @opindex mno-cond-exec
20175
20176 Disable the use of conditional execution.
20177
20178 This switch is mainly for debugging the compiler and will likely be removed
20179 in a future version.
20180
20181 @item -mvliw-branch
20182 @opindex mvliw-branch
20183
20184 Run a pass to pack branches into VLIW instructions (default).
20185
20186 This switch is mainly for debugging the compiler and will likely be removed
20187 in a future version.
20188
20189 @item -mno-vliw-branch
20190 @opindex mno-vliw-branch
20191
20192 Do not run a pass to pack branches into VLIW instructions.
20193
20194 This switch is mainly for debugging the compiler and will likely be removed
20195 in a future version.
20196
20197 @item -mmulti-cond-exec
20198 @opindex mmulti-cond-exec
20199
20200 Enable optimization of @code{&&} and @code{||} in conditional execution
20201 (default).
20202
20203 This switch is mainly for debugging the compiler and will likely be removed
20204 in a future version.
20205
20206 @item -mno-multi-cond-exec
20207 @opindex mno-multi-cond-exec
20208
20209 Disable optimization of @code{&&} and @code{||} in conditional execution.
20210
20211 This switch is mainly for debugging the compiler and will likely be removed
20212 in a future version.
20213
20214 @item -mnested-cond-exec
20215 @opindex mnested-cond-exec
20216
20217 Enable nested conditional execution optimizations (default).
20218
20219 This switch is mainly for debugging the compiler and will likely be removed
20220 in a future version.
20221
20222 @item -mno-nested-cond-exec
20223 @opindex mno-nested-cond-exec
20224
20225 Disable nested conditional execution optimizations.
20226
20227 This switch is mainly for debugging the compiler and will likely be removed
20228 in a future version.
20229
20230 @item -moptimize-membar
20231 @opindex moptimize-membar
20232
20233 This switch removes redundant @code{membar} instructions from the
20234 compiler-generated code. It is enabled by default.
20235
20236 @item -mno-optimize-membar
20237 @opindex mno-optimize-membar
20238 @opindex moptimize-membar
20239
20240 This switch disables the automatic removal of redundant @code{membar}
20241 instructions from the generated code.
20242
20243 @item -mtomcat-stats
20244 @opindex mtomcat-stats
20245
20246 Cause gas to print out tomcat statistics.
20247
20248 @item -mcpu=@var{cpu}
20249 @opindex mcpu
20250
20251 Select the processor type for which to generate code. Possible values are
20252 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20253 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20254
20255 @end table
20256
20257 @node GNU/Linux Options
20258 @subsection GNU/Linux Options
20259
20260 These @samp{-m} options are defined for GNU/Linux targets:
20261
20262 @table @gcctabopt
20263 @item -mglibc
20264 @opindex mglibc
20265 Use the GNU C library. This is the default except
20266 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20267 @samp{*-*-linux-*android*} targets.
20268
20269 @item -muclibc
20270 @opindex muclibc
20271 Use uClibc C library. This is the default on
20272 @samp{*-*-linux-*uclibc*} targets.
20273
20274 @item -mmusl
20275 @opindex mmusl
20276 Use the musl C library. This is the default on
20277 @samp{*-*-linux-*musl*} targets.
20278
20279 @item -mbionic
20280 @opindex mbionic
20281 Use Bionic C library. This is the default on
20282 @samp{*-*-linux-*android*} targets.
20283
20284 @item -mandroid
20285 @opindex mandroid
20286 Compile code compatible with Android platform. This is the default on
20287 @samp{*-*-linux-*android*} targets.
20288
20289 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20290 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20291 this option makes the GCC driver pass Android-specific options to the linker.
20292 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20293 to be defined.
20294
20295 @item -tno-android-cc
20296 @opindex tno-android-cc
20297 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20298 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20299 @option{-fno-rtti} by default.
20300
20301 @item -tno-android-ld
20302 @opindex tno-android-ld
20303 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20304 linking options to the linker.
20305
20306 @end table
20307
20308 @node H8/300 Options
20309 @subsection H8/300 Options
20310
20311 These @samp{-m} options are defined for the H8/300 implementations:
20312
20313 @table @gcctabopt
20314 @item -mrelax
20315 @opindex mrelax
20316 Shorten some address references at link time, when possible; uses the
20317 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20318 ld, Using ld}, for a fuller description.
20319
20320 @item -mh
20321 @opindex mh
20322 Generate code for the H8/300H@.
20323
20324 @item -ms
20325 @opindex ms
20326 Generate code for the H8S@.
20327
20328 @item -mn
20329 @opindex mn
20330 Generate code for the H8S and H8/300H in the normal mode. This switch
20331 must be used either with @option{-mh} or @option{-ms}.
20332
20333 @item -ms2600
20334 @opindex ms2600
20335 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20336
20337 @item -mexr
20338 @opindex mexr
20339 Extended registers are stored on stack before execution of function
20340 with monitor attribute. Default option is @option{-mexr}.
20341 This option is valid only for H8S targets.
20342
20343 @item -mno-exr
20344 @opindex mno-exr
20345 @opindex mexr
20346 Extended registers are not stored on stack before execution of function
20347 with monitor attribute. Default option is @option{-mno-exr}.
20348 This option is valid only for H8S targets.
20349
20350 @item -mint32
20351 @opindex mint32
20352 Make @code{int} data 32 bits by default.
20353
20354 @item -malign-300
20355 @opindex malign-300
20356 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20357 The default for the H8/300H and H8S is to align longs and floats on
20358 4-byte boundaries.
20359 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20360 This option has no effect on the H8/300.
20361 @end table
20362
20363 @node HPPA Options
20364 @subsection HPPA Options
20365 @cindex HPPA Options
20366
20367 These @samp{-m} options are defined for the HPPA family of computers:
20368
20369 @table @gcctabopt
20370 @item -march=@var{architecture-type}
20371 @opindex march
20372 Generate code for the specified architecture. The choices for
20373 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20374 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20375 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20376 architecture option for your machine. Code compiled for lower numbered
20377 architectures runs on higher numbered architectures, but not the
20378 other way around.
20379
20380 @item -mpa-risc-1-0
20381 @itemx -mpa-risc-1-1
20382 @itemx -mpa-risc-2-0
20383 @opindex mpa-risc-1-0
20384 @opindex mpa-risc-1-1
20385 @opindex mpa-risc-2-0
20386 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20387
20388 @item -mcaller-copies
20389 @opindex mcaller-copies
20390 The caller copies function arguments passed by hidden reference. This
20391 option should be used with care as it is not compatible with the default
20392 32-bit runtime. However, only aggregates larger than eight bytes are
20393 passed by hidden reference and the option provides better compatibility
20394 with OpenMP.
20395
20396 @item -mjump-in-delay
20397 @opindex mjump-in-delay
20398 This option is ignored and provided for compatibility purposes only.
20399
20400 @item -mdisable-fpregs
20401 @opindex mdisable-fpregs
20402 Prevent floating-point registers from being used in any manner. This is
20403 necessary for compiling kernels that perform lazy context switching of
20404 floating-point registers. If you use this option and attempt to perform
20405 floating-point operations, the compiler aborts.
20406
20407 @item -mdisable-indexing
20408 @opindex mdisable-indexing
20409 Prevent the compiler from using indexing address modes. This avoids some
20410 rather obscure problems when compiling MIG generated code under MACH@.
20411
20412 @item -mno-space-regs
20413 @opindex mno-space-regs
20414 @opindex mspace-regs
20415 Generate code that assumes the target has no space registers. This allows
20416 GCC to generate faster indirect calls and use unscaled index address modes.
20417
20418 Such code is suitable for level 0 PA systems and kernels.
20419
20420 @item -mfast-indirect-calls
20421 @opindex mfast-indirect-calls
20422 Generate code that assumes calls never cross space boundaries. This
20423 allows GCC to emit code that performs faster indirect calls.
20424
20425 This option does not work in the presence of shared libraries or nested
20426 functions.
20427
20428 @item -mfixed-range=@var{register-range}
20429 @opindex mfixed-range
20430 Generate code treating the given register range as fixed registers.
20431 A fixed register is one that the register allocator cannot use. This is
20432 useful when compiling kernel code. A register range is specified as
20433 two registers separated by a dash. Multiple register ranges can be
20434 specified separated by a comma.
20435
20436 @item -mlong-load-store
20437 @opindex mlong-load-store
20438 Generate 3-instruction load and store sequences as sometimes required by
20439 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20440 the HP compilers.
20441
20442 @item -mportable-runtime
20443 @opindex mportable-runtime
20444 Use the portable calling conventions proposed by HP for ELF systems.
20445
20446 @item -mgas
20447 @opindex mgas
20448 Enable the use of assembler directives only GAS understands.
20449
20450 @item -mschedule=@var{cpu-type}
20451 @opindex mschedule
20452 Schedule code according to the constraints for the machine type
20453 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20454 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20455 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20456 proper scheduling option for your machine. The default scheduling is
20457 @samp{8000}.
20458
20459 @item -mlinker-opt
20460 @opindex mlinker-opt
20461 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20462 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20463 linkers in which they give bogus error messages when linking some programs.
20464
20465 @item -msoft-float
20466 @opindex msoft-float
20467 Generate output containing library calls for floating point.
20468 @strong{Warning:} the requisite libraries are not available for all HPPA
20469 targets. Normally the facilities of the machine's usual C compiler are
20470 used, but this cannot be done directly in cross-compilation. You must make
20471 your own arrangements to provide suitable library functions for
20472 cross-compilation.
20473
20474 @option{-msoft-float} changes the calling convention in the output file;
20475 therefore, it is only useful if you compile @emph{all} of a program with
20476 this option. In particular, you need to compile @file{libgcc.a}, the
20477 library that comes with GCC, with @option{-msoft-float} in order for
20478 this to work.
20479
20480 @item -msio
20481 @opindex msio
20482 Generate the predefine, @code{_SIO}, for server IO@. The default is
20483 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20484 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20485 options are available under HP-UX and HI-UX@.
20486
20487 @item -mgnu-ld
20488 @opindex mgnu-ld
20489 Use options specific to GNU @command{ld}.
20490 This passes @option{-shared} to @command{ld} when
20491 building a shared library. It is the default when GCC is configured,
20492 explicitly or implicitly, with the GNU linker. This option does not
20493 affect which @command{ld} is called; it only changes what parameters
20494 are passed to that @command{ld}.
20495 The @command{ld} that is called is determined by the
20496 @option{--with-ld} configure option, GCC's program search path, and
20497 finally by the user's @env{PATH}. The linker used by GCC can be printed
20498 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20499 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20500
20501 @item -mhp-ld
20502 @opindex mhp-ld
20503 Use options specific to HP @command{ld}.
20504 This passes @option{-b} to @command{ld} when building
20505 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20506 links. It is the default when GCC is configured, explicitly or
20507 implicitly, with the HP linker. This option does not affect
20508 which @command{ld} is called; it only changes what parameters are passed to that
20509 @command{ld}.
20510 The @command{ld} that is called is determined by the @option{--with-ld}
20511 configure option, GCC's program search path, and finally by the user's
20512 @env{PATH}. The linker used by GCC can be printed using @samp{which
20513 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20514 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20515
20516 @item -mlong-calls
20517 @opindex mno-long-calls
20518 @opindex mlong-calls
20519 Generate code that uses long call sequences. This ensures that a call
20520 is always able to reach linker generated stubs. The default is to generate
20521 long calls only when the distance from the call site to the beginning
20522 of the function or translation unit, as the case may be, exceeds a
20523 predefined limit set by the branch type being used. The limits for
20524 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20525 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20526 240,000 bytes.
20527
20528 Distances are measured from the beginning of functions when using the
20529 @option{-ffunction-sections} option, or when using the @option{-mgas}
20530 and @option{-mno-portable-runtime} options together under HP-UX with
20531 the SOM linker.
20532
20533 It is normally not desirable to use this option as it degrades
20534 performance. However, it may be useful in large applications,
20535 particularly when partial linking is used to build the application.
20536
20537 The types of long calls used depends on the capabilities of the
20538 assembler and linker, and the type of code being generated. The
20539 impact on systems that support long absolute calls, and long pic
20540 symbol-difference or pc-relative calls should be relatively small.
20541 However, an indirect call is used on 32-bit ELF systems in pic code
20542 and it is quite long.
20543
20544 @item -munix=@var{unix-std}
20545 @opindex march
20546 Generate compiler predefines and select a startfile for the specified
20547 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20548 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20549 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20550 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20551 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20552 and later.
20553
20554 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20555 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20556 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20557 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20558 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20559 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20560
20561 It is @emph{important} to note that this option changes the interfaces
20562 for various library routines. It also affects the operational behavior
20563 of the C library. Thus, @emph{extreme} care is needed in using this
20564 option.
20565
20566 Library code that is intended to operate with more than one UNIX
20567 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20568 as appropriate. Most GNU software doesn't provide this capability.
20569
20570 @item -nolibdld
20571 @opindex nolibdld
20572 Suppress the generation of link options to search libdld.sl when the
20573 @option{-static} option is specified on HP-UX 10 and later.
20574
20575 @item -static
20576 @opindex static
20577 The HP-UX implementation of setlocale in libc has a dependency on
20578 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20579 when the @option{-static} option is specified, special link options
20580 are needed to resolve this dependency.
20581
20582 On HP-UX 10 and later, the GCC driver adds the necessary options to
20583 link with libdld.sl when the @option{-static} option is specified.
20584 This causes the resulting binary to be dynamic. On the 64-bit port,
20585 the linkers generate dynamic binaries by default in any case. The
20586 @option{-nolibdld} option can be used to prevent the GCC driver from
20587 adding these link options.
20588
20589 @item -threads
20590 @opindex threads
20591 Add support for multithreading with the @dfn{dce thread} library
20592 under HP-UX@. This option sets flags for both the preprocessor and
20593 linker.
20594 @end table
20595
20596 @node IA-64 Options
20597 @subsection IA-64 Options
20598 @cindex IA-64 Options
20599
20600 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20601
20602 @table @gcctabopt
20603 @item -mbig-endian
20604 @opindex mbig-endian
20605 Generate code for a big-endian target. This is the default for HP-UX@.
20606
20607 @item -mlittle-endian
20608 @opindex mlittle-endian
20609 Generate code for a little-endian target. This is the default for AIX5
20610 and GNU/Linux.
20611
20612 @item -mgnu-as
20613 @itemx -mno-gnu-as
20614 @opindex mgnu-as
20615 @opindex mno-gnu-as
20616 Generate (or don't) code for the GNU assembler. This is the default.
20617 @c Also, this is the default if the configure option @option{--with-gnu-as}
20618 @c is used.
20619
20620 @item -mgnu-ld
20621 @itemx -mno-gnu-ld
20622 @opindex mgnu-ld
20623 @opindex mno-gnu-ld
20624 Generate (or don't) code for the GNU linker. This is the default.
20625 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20626 @c is used.
20627
20628 @item -mno-pic
20629 @opindex mno-pic
20630 Generate code that does not use a global pointer register. The result
20631 is not position independent code, and violates the IA-64 ABI@.
20632
20633 @item -mvolatile-asm-stop
20634 @itemx -mno-volatile-asm-stop
20635 @opindex mvolatile-asm-stop
20636 @opindex mno-volatile-asm-stop
20637 Generate (or don't) a stop bit immediately before and after volatile asm
20638 statements.
20639
20640 @item -mregister-names
20641 @itemx -mno-register-names
20642 @opindex mregister-names
20643 @opindex mno-register-names
20644 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20645 the stacked registers. This may make assembler output more readable.
20646
20647 @item -mno-sdata
20648 @itemx -msdata
20649 @opindex mno-sdata
20650 @opindex msdata
20651 Disable (or enable) optimizations that use the small data section. This may
20652 be useful for working around optimizer bugs.
20653
20654 @item -mconstant-gp
20655 @opindex mconstant-gp
20656 Generate code that uses a single constant global pointer value. This is
20657 useful when compiling kernel code.
20658
20659 @item -mauto-pic
20660 @opindex mauto-pic
20661 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20662 This is useful when compiling firmware code.
20663
20664 @item -minline-float-divide-min-latency
20665 @opindex minline-float-divide-min-latency
20666 Generate code for inline divides of floating-point values
20667 using the minimum latency algorithm.
20668
20669 @item -minline-float-divide-max-throughput
20670 @opindex minline-float-divide-max-throughput
20671 Generate code for inline divides of floating-point values
20672 using the maximum throughput algorithm.
20673
20674 @item -mno-inline-float-divide
20675 @opindex mno-inline-float-divide
20676 Do not generate inline code for divides of floating-point values.
20677
20678 @item -minline-int-divide-min-latency
20679 @opindex minline-int-divide-min-latency
20680 Generate code for inline divides of integer values
20681 using the minimum latency algorithm.
20682
20683 @item -minline-int-divide-max-throughput
20684 @opindex minline-int-divide-max-throughput
20685 Generate code for inline divides of integer values
20686 using the maximum throughput algorithm.
20687
20688 @item -mno-inline-int-divide
20689 @opindex mno-inline-int-divide
20690 @opindex minline-int-divide
20691 Do not generate inline code for divides of integer values.
20692
20693 @item -minline-sqrt-min-latency
20694 @opindex minline-sqrt-min-latency
20695 Generate code for inline square roots
20696 using the minimum latency algorithm.
20697
20698 @item -minline-sqrt-max-throughput
20699 @opindex minline-sqrt-max-throughput
20700 Generate code for inline square roots
20701 using the maximum throughput algorithm.
20702
20703 @item -mno-inline-sqrt
20704 @opindex mno-inline-sqrt
20705 Do not generate inline code for @code{sqrt}.
20706
20707 @item -mfused-madd
20708 @itemx -mno-fused-madd
20709 @opindex mfused-madd
20710 @opindex mno-fused-madd
20711 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20712 instructions. The default is to use these instructions.
20713
20714 @item -mno-dwarf2-asm
20715 @itemx -mdwarf2-asm
20716 @opindex mno-dwarf2-asm
20717 @opindex mdwarf2-asm
20718 Don't (or do) generate assembler code for the DWARF line number debugging
20719 info. This may be useful when not using the GNU assembler.
20720
20721 @item -mearly-stop-bits
20722 @itemx -mno-early-stop-bits
20723 @opindex mearly-stop-bits
20724 @opindex mno-early-stop-bits
20725 Allow stop bits to be placed earlier than immediately preceding the
20726 instruction that triggered the stop bit. This can improve instruction
20727 scheduling, but does not always do so.
20728
20729 @item -mfixed-range=@var{register-range}
20730 @opindex mfixed-range
20731 Generate code treating the given register range as fixed registers.
20732 A fixed register is one that the register allocator cannot use. This is
20733 useful when compiling kernel code. A register range is specified as
20734 two registers separated by a dash. Multiple register ranges can be
20735 specified separated by a comma.
20736
20737 @item -mtls-size=@var{tls-size}
20738 @opindex mtls-size
20739 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20740 64.
20741
20742 @item -mtune=@var{cpu-type}
20743 @opindex mtune
20744 Tune the instruction scheduling for a particular CPU, Valid values are
20745 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20746 and @samp{mckinley}.
20747
20748 @item -milp32
20749 @itemx -mlp64
20750 @opindex milp32
20751 @opindex mlp64
20752 Generate code for a 32-bit or 64-bit environment.
20753 The 32-bit environment sets int, long and pointer to 32 bits.
20754 The 64-bit environment sets int to 32 bits and long and pointer
20755 to 64 bits. These are HP-UX specific flags.
20756
20757 @item -mno-sched-br-data-spec
20758 @itemx -msched-br-data-spec
20759 @opindex mno-sched-br-data-spec
20760 @opindex msched-br-data-spec
20761 (Dis/En)able data speculative scheduling before reload.
20762 This results in generation of @code{ld.a} instructions and
20763 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20764 The default setting is disabled.
20765
20766 @item -msched-ar-data-spec
20767 @itemx -mno-sched-ar-data-spec
20768 @opindex msched-ar-data-spec
20769 @opindex mno-sched-ar-data-spec
20770 (En/Dis)able data speculative scheduling after reload.
20771 This results in generation of @code{ld.a} instructions and
20772 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20773 The default setting is enabled.
20774
20775 @item -mno-sched-control-spec
20776 @itemx -msched-control-spec
20777 @opindex mno-sched-control-spec
20778 @opindex msched-control-spec
20779 (Dis/En)able control speculative scheduling. This feature is
20780 available only during region scheduling (i.e.@: before reload).
20781 This results in generation of the @code{ld.s} instructions and
20782 the corresponding check instructions @code{chk.s}.
20783 The default setting is disabled.
20784
20785 @item -msched-br-in-data-spec
20786 @itemx -mno-sched-br-in-data-spec
20787 @opindex msched-br-in-data-spec
20788 @opindex mno-sched-br-in-data-spec
20789 (En/Dis)able speculative scheduling of the instructions that
20790 are dependent on the data speculative loads before reload.
20791 This is effective only with @option{-msched-br-data-spec} enabled.
20792 The default setting is enabled.
20793
20794 @item -msched-ar-in-data-spec
20795 @itemx -mno-sched-ar-in-data-spec
20796 @opindex msched-ar-in-data-spec
20797 @opindex mno-sched-ar-in-data-spec
20798 (En/Dis)able speculative scheduling of the instructions that
20799 are dependent on the data speculative loads after reload.
20800 This is effective only with @option{-msched-ar-data-spec} enabled.
20801 The default setting is enabled.
20802
20803 @item -msched-in-control-spec
20804 @itemx -mno-sched-in-control-spec
20805 @opindex msched-in-control-spec
20806 @opindex mno-sched-in-control-spec
20807 (En/Dis)able speculative scheduling of the instructions that
20808 are dependent on the control speculative loads.
20809 This is effective only with @option{-msched-control-spec} enabled.
20810 The default setting is enabled.
20811
20812 @item -mno-sched-prefer-non-data-spec-insns
20813 @itemx -msched-prefer-non-data-spec-insns
20814 @opindex mno-sched-prefer-non-data-spec-insns
20815 @opindex msched-prefer-non-data-spec-insns
20816 If enabled, data-speculative instructions are chosen for schedule
20817 only if there are no other choices at the moment. This makes
20818 the use of the data speculation much more conservative.
20819 The default setting is disabled.
20820
20821 @item -mno-sched-prefer-non-control-spec-insns
20822 @itemx -msched-prefer-non-control-spec-insns
20823 @opindex mno-sched-prefer-non-control-spec-insns
20824 @opindex msched-prefer-non-control-spec-insns
20825 If enabled, control-speculative instructions are chosen for schedule
20826 only if there are no other choices at the moment. This makes
20827 the use of the control speculation much more conservative.
20828 The default setting is disabled.
20829
20830 @item -mno-sched-count-spec-in-critical-path
20831 @itemx -msched-count-spec-in-critical-path
20832 @opindex mno-sched-count-spec-in-critical-path
20833 @opindex msched-count-spec-in-critical-path
20834 If enabled, speculative dependencies are considered during
20835 computation of the instructions priorities. This makes the use of the
20836 speculation a bit more conservative.
20837 The default setting is disabled.
20838
20839 @item -msched-spec-ldc
20840 @opindex msched-spec-ldc
20841 Use a simple data speculation check. This option is on by default.
20842
20843 @item -msched-control-spec-ldc
20844 @opindex msched-spec-ldc
20845 Use a simple check for control speculation. This option is on by default.
20846
20847 @item -msched-stop-bits-after-every-cycle
20848 @opindex msched-stop-bits-after-every-cycle
20849 Place a stop bit after every cycle when scheduling. This option is on
20850 by default.
20851
20852 @item -msched-fp-mem-deps-zero-cost
20853 @opindex msched-fp-mem-deps-zero-cost
20854 Assume that floating-point stores and loads are not likely to cause a conflict
20855 when placed into the same instruction group. This option is disabled by
20856 default.
20857
20858 @item -msel-sched-dont-check-control-spec
20859 @opindex msel-sched-dont-check-control-spec
20860 Generate checks for control speculation in selective scheduling.
20861 This flag is disabled by default.
20862
20863 @item -msched-max-memory-insns=@var{max-insns}
20864 @opindex msched-max-memory-insns
20865 Limit on the number of memory insns per instruction group, giving lower
20866 priority to subsequent memory insns attempting to schedule in the same
20867 instruction group. Frequently useful to prevent cache bank conflicts.
20868 The default value is 1.
20869
20870 @item -msched-max-memory-insns-hard-limit
20871 @opindex msched-max-memory-insns-hard-limit
20872 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20873 disallowing more than that number in an instruction group.
20874 Otherwise, the limit is ``soft'', meaning that non-memory operations
20875 are preferred when the limit is reached, but memory operations may still
20876 be scheduled.
20877
20878 @end table
20879
20880 @node LM32 Options
20881 @subsection LM32 Options
20882 @cindex LM32 options
20883
20884 These @option{-m} options are defined for the LatticeMico32 architecture:
20885
20886 @table @gcctabopt
20887 @item -mbarrel-shift-enabled
20888 @opindex mbarrel-shift-enabled
20889 Enable barrel-shift instructions.
20890
20891 @item -mdivide-enabled
20892 @opindex mdivide-enabled
20893 Enable divide and modulus instructions.
20894
20895 @item -mmultiply-enabled
20896 @opindex multiply-enabled
20897 Enable multiply instructions.
20898
20899 @item -msign-extend-enabled
20900 @opindex msign-extend-enabled
20901 Enable sign extend instructions.
20902
20903 @item -muser-enabled
20904 @opindex muser-enabled
20905 Enable user-defined instructions.
20906
20907 @end table
20908
20909 @node M32C Options
20910 @subsection M32C Options
20911 @cindex M32C options
20912
20913 @table @gcctabopt
20914 @item -mcpu=@var{name}
20915 @opindex mcpu=
20916 Select the CPU for which code is generated. @var{name} may be one of
20917 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20918 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20919 the M32C/80 series.
20920
20921 @item -msim
20922 @opindex msim
20923 Specifies that the program will be run on the simulator. This causes
20924 an alternate runtime library to be linked in which supports, for
20925 example, file I/O@. You must not use this option when generating
20926 programs that will run on real hardware; you must provide your own
20927 runtime library for whatever I/O functions are needed.
20928
20929 @item -memregs=@var{number}
20930 @opindex memregs=
20931 Specifies the number of memory-based pseudo-registers GCC uses
20932 during code generation. These pseudo-registers are used like real
20933 registers, so there is a tradeoff between GCC's ability to fit the
20934 code into available registers, and the performance penalty of using
20935 memory instead of registers. Note that all modules in a program must
20936 be compiled with the same value for this option. Because of that, you
20937 must not use this option with GCC's default runtime libraries.
20938
20939 @end table
20940
20941 @node M32R/D Options
20942 @subsection M32R/D Options
20943 @cindex M32R/D options
20944
20945 These @option{-m} options are defined for Renesas M32R/D architectures:
20946
20947 @table @gcctabopt
20948 @item -m32r2
20949 @opindex m32r2
20950 Generate code for the M32R/2@.
20951
20952 @item -m32rx
20953 @opindex m32rx
20954 Generate code for the M32R/X@.
20955
20956 @item -m32r
20957 @opindex m32r
20958 Generate code for the M32R@. This is the default.
20959
20960 @item -mmodel=small
20961 @opindex mmodel=small
20962 Assume all objects live in the lower 16MB of memory (so that their addresses
20963 can be loaded with the @code{ld24} instruction), and assume all subroutines
20964 are reachable with the @code{bl} instruction.
20965 This is the default.
20966
20967 The addressability of a particular object can be set with the
20968 @code{model} attribute.
20969
20970 @item -mmodel=medium
20971 @opindex mmodel=medium
20972 Assume objects may be anywhere in the 32-bit address space (the compiler
20973 generates @code{seth/add3} instructions to load their addresses), and
20974 assume all subroutines are reachable with the @code{bl} instruction.
20975
20976 @item -mmodel=large
20977 @opindex mmodel=large
20978 Assume objects may be anywhere in the 32-bit address space (the compiler
20979 generates @code{seth/add3} instructions to load their addresses), and
20980 assume subroutines may not be reachable with the @code{bl} instruction
20981 (the compiler generates the much slower @code{seth/add3/jl}
20982 instruction sequence).
20983
20984 @item -msdata=none
20985 @opindex msdata=none
20986 Disable use of the small data area. Variables are put into
20987 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20988 @code{section} attribute has been specified).
20989 This is the default.
20990
20991 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20992 Objects may be explicitly put in the small data area with the
20993 @code{section} attribute using one of these sections.
20994
20995 @item -msdata=sdata
20996 @opindex msdata=sdata
20997 Put small global and static data in the small data area, but do not
20998 generate special code to reference them.
20999
21000 @item -msdata=use
21001 @opindex msdata=use
21002 Put small global and static data in the small data area, and generate
21003 special instructions to reference them.
21004
21005 @item -G @var{num}
21006 @opindex G
21007 @cindex smaller data references
21008 Put global and static objects less than or equal to @var{num} bytes
21009 into the small data or BSS sections instead of the normal data or BSS
21010 sections. The default value of @var{num} is 8.
21011 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
21012 for this option to have any effect.
21013
21014 All modules should be compiled with the same @option{-G @var{num}} value.
21015 Compiling with different values of @var{num} may or may not work; if it
21016 doesn't the linker gives an error message---incorrect code is not
21017 generated.
21018
21019 @item -mdebug
21020 @opindex mdebug
21021 Makes the M32R-specific code in the compiler display some statistics
21022 that might help in debugging programs.
21023
21024 @item -malign-loops
21025 @opindex malign-loops
21026 Align all loops to a 32-byte boundary.
21027
21028 @item -mno-align-loops
21029 @opindex mno-align-loops
21030 Do not enforce a 32-byte alignment for loops. This is the default.
21031
21032 @item -missue-rate=@var{number}
21033 @opindex missue-rate=@var{number}
21034 Issue @var{number} instructions per cycle. @var{number} can only be 1
21035 or 2.
21036
21037 @item -mbranch-cost=@var{number}
21038 @opindex mbranch-cost=@var{number}
21039 @var{number} can only be 1 or 2. If it is 1 then branches are
21040 preferred over conditional code, if it is 2, then the opposite applies.
21041
21042 @item -mflush-trap=@var{number}
21043 @opindex mflush-trap=@var{number}
21044 Specifies the trap number to use to flush the cache. The default is
21045 12. Valid numbers are between 0 and 15 inclusive.
21046
21047 @item -mno-flush-trap
21048 @opindex mno-flush-trap
21049 Specifies that the cache cannot be flushed by using a trap.
21050
21051 @item -mflush-func=@var{name}
21052 @opindex mflush-func=@var{name}
21053 Specifies the name of the operating system function to call to flush
21054 the cache. The default is @samp{_flush_cache}, but a function call
21055 is only used if a trap is not available.
21056
21057 @item -mno-flush-func
21058 @opindex mno-flush-func
21059 Indicates that there is no OS function for flushing the cache.
21060
21061 @end table
21062
21063 @node M680x0 Options
21064 @subsection M680x0 Options
21065 @cindex M680x0 options
21066
21067 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21068 The default settings depend on which architecture was selected when
21069 the compiler was configured; the defaults for the most common choices
21070 are given below.
21071
21072 @table @gcctabopt
21073 @item -march=@var{arch}
21074 @opindex march
21075 Generate code for a specific M680x0 or ColdFire instruction set
21076 architecture. Permissible values of @var{arch} for M680x0
21077 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21078 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
21079 architectures are selected according to Freescale's ISA classification
21080 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21081 @samp{isab} and @samp{isac}.
21082
21083 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21084 code for a ColdFire target. The @var{arch} in this macro is one of the
21085 @option{-march} arguments given above.
21086
21087 When used together, @option{-march} and @option{-mtune} select code
21088 that runs on a family of similar processors but that is optimized
21089 for a particular microarchitecture.
21090
21091 @item -mcpu=@var{cpu}
21092 @opindex mcpu
21093 Generate code for a specific M680x0 or ColdFire processor.
21094 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21095 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21096 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21097 below, which also classifies the CPUs into families:
21098
21099 @multitable @columnfractions 0.20 0.80
21100 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21101 @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}
21102 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21103 @item @samp{5206e} @tab @samp{5206e}
21104 @item @samp{5208} @tab @samp{5207} @samp{5208}
21105 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21106 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21107 @item @samp{5216} @tab @samp{5214} @samp{5216}
21108 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21109 @item @samp{5225} @tab @samp{5224} @samp{5225}
21110 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21111 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21112 @item @samp{5249} @tab @samp{5249}
21113 @item @samp{5250} @tab @samp{5250}
21114 @item @samp{5271} @tab @samp{5270} @samp{5271}
21115 @item @samp{5272} @tab @samp{5272}
21116 @item @samp{5275} @tab @samp{5274} @samp{5275}
21117 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21118 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21119 @item @samp{5307} @tab @samp{5307}
21120 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21121 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21122 @item @samp{5407} @tab @samp{5407}
21123 @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}
21124 @end multitable
21125
21126 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21127 @var{arch} is compatible with @var{cpu}. Other combinations of
21128 @option{-mcpu} and @option{-march} are rejected.
21129
21130 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21131 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21132 where the value of @var{family} is given by the table above.
21133
21134 @item -mtune=@var{tune}
21135 @opindex mtune
21136 Tune the code for a particular microarchitecture within the
21137 constraints set by @option{-march} and @option{-mcpu}.
21138 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21139 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21140 and @samp{cpu32}. The ColdFire microarchitectures
21141 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21142
21143 You can also use @option{-mtune=68020-40} for code that needs
21144 to run relatively well on 68020, 68030 and 68040 targets.
21145 @option{-mtune=68020-60} is similar but includes 68060 targets
21146 as well. These two options select the same tuning decisions as
21147 @option{-m68020-40} and @option{-m68020-60} respectively.
21148
21149 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21150 when tuning for 680x0 architecture @var{arch}. It also defines
21151 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21152 option is used. If GCC is tuning for a range of architectures,
21153 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21154 it defines the macros for every architecture in the range.
21155
21156 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21157 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21158 of the arguments given above.
21159
21160 @item -m68000
21161 @itemx -mc68000
21162 @opindex m68000
21163 @opindex mc68000
21164 Generate output for a 68000. This is the default
21165 when the compiler is configured for 68000-based systems.
21166 It is equivalent to @option{-march=68000}.
21167
21168 Use this option for microcontrollers with a 68000 or EC000 core,
21169 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21170
21171 @item -m68010
21172 @opindex m68010
21173 Generate output for a 68010. This is the default
21174 when the compiler is configured for 68010-based systems.
21175 It is equivalent to @option{-march=68010}.
21176
21177 @item -m68020
21178 @itemx -mc68020
21179 @opindex m68020
21180 @opindex mc68020
21181 Generate output for a 68020. This is the default
21182 when the compiler is configured for 68020-based systems.
21183 It is equivalent to @option{-march=68020}.
21184
21185 @item -m68030
21186 @opindex m68030
21187 Generate output for a 68030. This is the default when the compiler is
21188 configured for 68030-based systems. It is equivalent to
21189 @option{-march=68030}.
21190
21191 @item -m68040
21192 @opindex m68040
21193 Generate output for a 68040. This is the default when the compiler is
21194 configured for 68040-based systems. It is equivalent to
21195 @option{-march=68040}.
21196
21197 This option inhibits the use of 68881/68882 instructions that have to be
21198 emulated by software on the 68040. Use this option if your 68040 does not
21199 have code to emulate those instructions.
21200
21201 @item -m68060
21202 @opindex m68060
21203 Generate output for a 68060. This is the default when the compiler is
21204 configured for 68060-based systems. It is equivalent to
21205 @option{-march=68060}.
21206
21207 This option inhibits the use of 68020 and 68881/68882 instructions that
21208 have to be emulated by software on the 68060. Use this option if your 68060
21209 does not have code to emulate those instructions.
21210
21211 @item -mcpu32
21212 @opindex mcpu32
21213 Generate output for a CPU32. This is the default
21214 when the compiler is configured for CPU32-based systems.
21215 It is equivalent to @option{-march=cpu32}.
21216
21217 Use this option for microcontrollers with a
21218 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21219 68336, 68340, 68341, 68349 and 68360.
21220
21221 @item -m5200
21222 @opindex m5200
21223 Generate output for a 520X ColdFire CPU@. This is the default
21224 when the compiler is configured for 520X-based systems.
21225 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21226 in favor of that option.
21227
21228 Use this option for microcontroller with a 5200 core, including
21229 the MCF5202, MCF5203, MCF5204 and MCF5206.
21230
21231 @item -m5206e
21232 @opindex m5206e
21233 Generate output for a 5206e ColdFire CPU@. The option is now
21234 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21235
21236 @item -m528x
21237 @opindex m528x
21238 Generate output for a member of the ColdFire 528X family.
21239 The option is now deprecated in favor of the equivalent
21240 @option{-mcpu=528x}.
21241
21242 @item -m5307
21243 @opindex m5307
21244 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21245 in favor of the equivalent @option{-mcpu=5307}.
21246
21247 @item -m5407
21248 @opindex m5407
21249 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21250 in favor of the equivalent @option{-mcpu=5407}.
21251
21252 @item -mcfv4e
21253 @opindex mcfv4e
21254 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21255 This includes use of hardware floating-point instructions.
21256 The option is equivalent to @option{-mcpu=547x}, and is now
21257 deprecated in favor of that option.
21258
21259 @item -m68020-40
21260 @opindex m68020-40
21261 Generate output for a 68040, without using any of the new instructions.
21262 This results in code that can run relatively efficiently on either a
21263 68020/68881 or a 68030 or a 68040. The generated code does use the
21264 68881 instructions that are emulated on the 68040.
21265
21266 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21267
21268 @item -m68020-60
21269 @opindex m68020-60
21270 Generate output for a 68060, without using any of the new instructions.
21271 This results in code that can run relatively efficiently on either a
21272 68020/68881 or a 68030 or a 68040. The generated code does use the
21273 68881 instructions that are emulated on the 68060.
21274
21275 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21276
21277 @item -mhard-float
21278 @itemx -m68881
21279 @opindex mhard-float
21280 @opindex m68881
21281 Generate floating-point instructions. This is the default for 68020
21282 and above, and for ColdFire devices that have an FPU@. It defines the
21283 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21284 on ColdFire targets.
21285
21286 @item -msoft-float
21287 @opindex msoft-float
21288 Do not generate floating-point instructions; use library calls instead.
21289 This is the default for 68000, 68010, and 68832 targets. It is also
21290 the default for ColdFire devices that have no FPU.
21291
21292 @item -mdiv
21293 @itemx -mno-div
21294 @opindex mdiv
21295 @opindex mno-div
21296 Generate (do not generate) ColdFire hardware divide and remainder
21297 instructions. If @option{-march} is used without @option{-mcpu},
21298 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21299 architectures. Otherwise, the default is taken from the target CPU
21300 (either the default CPU, or the one specified by @option{-mcpu}). For
21301 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21302 @option{-mcpu=5206e}.
21303
21304 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21305
21306 @item -mshort
21307 @opindex mshort
21308 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21309 Additionally, parameters passed on the stack are also aligned to a
21310 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21311
21312 @item -mno-short
21313 @opindex mno-short
21314 Do not consider type @code{int} to be 16 bits wide. This is the default.
21315
21316 @item -mnobitfield
21317 @itemx -mno-bitfield
21318 @opindex mnobitfield
21319 @opindex mno-bitfield
21320 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21321 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21322
21323 @item -mbitfield
21324 @opindex mbitfield
21325 Do use the bit-field instructions. The @option{-m68020} option implies
21326 @option{-mbitfield}. This is the default if you use a configuration
21327 designed for a 68020.
21328
21329 @item -mrtd
21330 @opindex mrtd
21331 Use a different function-calling convention, in which functions
21332 that take a fixed number of arguments return with the @code{rtd}
21333 instruction, which pops their arguments while returning. This
21334 saves one instruction in the caller since there is no need to pop
21335 the arguments there.
21336
21337 This calling convention is incompatible with the one normally
21338 used on Unix, so you cannot use it if you need to call libraries
21339 compiled with the Unix compiler.
21340
21341 Also, you must provide function prototypes for all functions that
21342 take variable numbers of arguments (including @code{printf});
21343 otherwise incorrect code is generated for calls to those
21344 functions.
21345
21346 In addition, seriously incorrect code results if you call a
21347 function with too many arguments. (Normally, extra arguments are
21348 harmlessly ignored.)
21349
21350 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21351 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21352
21353 The default is @option{-mno-rtd}.
21354
21355 @item -malign-int
21356 @itemx -mno-align-int
21357 @opindex malign-int
21358 @opindex mno-align-int
21359 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21360 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21361 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21362 Aligning variables on 32-bit boundaries produces code that runs somewhat
21363 faster on processors with 32-bit busses at the expense of more memory.
21364
21365 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21366 aligns structures containing the above types differently than
21367 most published application binary interface specifications for the m68k.
21368
21369 @item -mpcrel
21370 @opindex mpcrel
21371 Use the pc-relative addressing mode of the 68000 directly, instead of
21372 using a global offset table. At present, this option implies @option{-fpic},
21373 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21374 not presently supported with @option{-mpcrel}, though this could be supported for
21375 68020 and higher processors.
21376
21377 @item -mno-strict-align
21378 @itemx -mstrict-align
21379 @opindex mno-strict-align
21380 @opindex mstrict-align
21381 Do not (do) assume that unaligned memory references are handled by
21382 the system.
21383
21384 @item -msep-data
21385 Generate code that allows the data segment to be located in a different
21386 area of memory from the text segment. This allows for execute-in-place in
21387 an environment without virtual memory management. This option implies
21388 @option{-fPIC}.
21389
21390 @item -mno-sep-data
21391 Generate code that assumes that the data segment follows the text segment.
21392 This is the default.
21393
21394 @item -mid-shared-library
21395 Generate code that supports shared libraries via the library ID method.
21396 This allows for execute-in-place and shared libraries in an environment
21397 without virtual memory management. This option implies @option{-fPIC}.
21398
21399 @item -mno-id-shared-library
21400 Generate code that doesn't assume ID-based shared libraries are being used.
21401 This is the default.
21402
21403 @item -mshared-library-id=n
21404 Specifies the identification number of the ID-based shared library being
21405 compiled. Specifying a value of 0 generates more compact code; specifying
21406 other values forces the allocation of that number to the current
21407 library, but is no more space- or time-efficient than omitting this option.
21408
21409 @item -mxgot
21410 @itemx -mno-xgot
21411 @opindex mxgot
21412 @opindex mno-xgot
21413 When generating position-independent code for ColdFire, generate code
21414 that works if the GOT has more than 8192 entries. This code is
21415 larger and slower than code generated without this option. On M680x0
21416 processors, this option is not needed; @option{-fPIC} suffices.
21417
21418 GCC normally uses a single instruction to load values from the GOT@.
21419 While this is relatively efficient, it only works if the GOT
21420 is smaller than about 64k. Anything larger causes the linker
21421 to report an error such as:
21422
21423 @cindex relocation truncated to fit (ColdFire)
21424 @smallexample
21425 relocation truncated to fit: R_68K_GOT16O foobar
21426 @end smallexample
21427
21428 If this happens, you should recompile your code with @option{-mxgot}.
21429 It should then work with very large GOTs. However, code generated with
21430 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21431 the value of a global symbol.
21432
21433 Note that some linkers, including newer versions of the GNU linker,
21434 can create multiple GOTs and sort GOT entries. If you have such a linker,
21435 you should only need to use @option{-mxgot} when compiling a single
21436 object file that accesses more than 8192 GOT entries. Very few do.
21437
21438 These options have no effect unless GCC is generating
21439 position-independent code.
21440
21441 @item -mlong-jump-table-offsets
21442 @opindex mlong-jump-table-offsets
21443 Use 32-bit offsets in @code{switch} tables. The default is to use
21444 16-bit offsets.
21445
21446 @end table
21447
21448 @node MCore Options
21449 @subsection MCore Options
21450 @cindex MCore options
21451
21452 These are the @samp{-m} options defined for the Motorola M*Core
21453 processors.
21454
21455 @table @gcctabopt
21456
21457 @item -mhardlit
21458 @itemx -mno-hardlit
21459 @opindex mhardlit
21460 @opindex mno-hardlit
21461 Inline constants into the code stream if it can be done in two
21462 instructions or less.
21463
21464 @item -mdiv
21465 @itemx -mno-div
21466 @opindex mdiv
21467 @opindex mno-div
21468 Use the divide instruction. (Enabled by default).
21469
21470 @item -mrelax-immediate
21471 @itemx -mno-relax-immediate
21472 @opindex mrelax-immediate
21473 @opindex mno-relax-immediate
21474 Allow arbitrary-sized immediates in bit operations.
21475
21476 @item -mwide-bitfields
21477 @itemx -mno-wide-bitfields
21478 @opindex mwide-bitfields
21479 @opindex mno-wide-bitfields
21480 Always treat bit-fields as @code{int}-sized.
21481
21482 @item -m4byte-functions
21483 @itemx -mno-4byte-functions
21484 @opindex m4byte-functions
21485 @opindex mno-4byte-functions
21486 Force all functions to be aligned to a 4-byte boundary.
21487
21488 @item -mcallgraph-data
21489 @itemx -mno-callgraph-data
21490 @opindex mcallgraph-data
21491 @opindex mno-callgraph-data
21492 Emit callgraph information.
21493
21494 @item -mslow-bytes
21495 @itemx -mno-slow-bytes
21496 @opindex mslow-bytes
21497 @opindex mno-slow-bytes
21498 Prefer word access when reading byte quantities.
21499
21500 @item -mlittle-endian
21501 @itemx -mbig-endian
21502 @opindex mlittle-endian
21503 @opindex mbig-endian
21504 Generate code for a little-endian target.
21505
21506 @item -m210
21507 @itemx -m340
21508 @opindex m210
21509 @opindex m340
21510 Generate code for the 210 processor.
21511
21512 @item -mno-lsim
21513 @opindex mno-lsim
21514 Assume that runtime support has been provided and so omit the
21515 simulator library (@file{libsim.a)} from the linker command line.
21516
21517 @item -mstack-increment=@var{size}
21518 @opindex mstack-increment
21519 Set the maximum amount for a single stack increment operation. Large
21520 values can increase the speed of programs that contain functions
21521 that need a large amount of stack space, but they can also trigger a
21522 segmentation fault if the stack is extended too much. The default
21523 value is 0x1000.
21524
21525 @end table
21526
21527 @node MeP Options
21528 @subsection MeP Options
21529 @cindex MeP options
21530
21531 @table @gcctabopt
21532
21533 @item -mabsdiff
21534 @opindex mabsdiff
21535 Enables the @code{abs} instruction, which is the absolute difference
21536 between two registers.
21537
21538 @item -mall-opts
21539 @opindex mall-opts
21540 Enables all the optional instructions---average, multiply, divide, bit
21541 operations, leading zero, absolute difference, min/max, clip, and
21542 saturation.
21543
21544
21545 @item -maverage
21546 @opindex maverage
21547 Enables the @code{ave} instruction, which computes the average of two
21548 registers.
21549
21550 @item -mbased=@var{n}
21551 @opindex mbased=
21552 Variables of size @var{n} bytes or smaller are placed in the
21553 @code{.based} section by default. Based variables use the @code{$tp}
21554 register as a base register, and there is a 128-byte limit to the
21555 @code{.based} section.
21556
21557 @item -mbitops
21558 @opindex mbitops
21559 Enables the bit operation instructions---bit test (@code{btstm}), set
21560 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21561 test-and-set (@code{tas}).
21562
21563 @item -mc=@var{name}
21564 @opindex mc=
21565 Selects which section constant data is placed in. @var{name} may
21566 be @samp{tiny}, @samp{near}, or @samp{far}.
21567
21568 @item -mclip
21569 @opindex mclip
21570 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21571 useful unless you also provide @option{-mminmax}.
21572
21573 @item -mconfig=@var{name}
21574 @opindex mconfig=
21575 Selects one of the built-in core configurations. Each MeP chip has
21576 one or more modules in it; each module has a core CPU and a variety of
21577 coprocessors, optional instructions, and peripherals. The
21578 @code{MeP-Integrator} tool, not part of GCC, provides these
21579 configurations through this option; using this option is the same as
21580 using all the corresponding command-line options. The default
21581 configuration is @samp{default}.
21582
21583 @item -mcop
21584 @opindex mcop
21585 Enables the coprocessor instructions. By default, this is a 32-bit
21586 coprocessor. Note that the coprocessor is normally enabled via the
21587 @option{-mconfig=} option.
21588
21589 @item -mcop32
21590 @opindex mcop32
21591 Enables the 32-bit coprocessor's instructions.
21592
21593 @item -mcop64
21594 @opindex mcop64
21595 Enables the 64-bit coprocessor's instructions.
21596
21597 @item -mivc2
21598 @opindex mivc2
21599 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21600
21601 @item -mdc
21602 @opindex mdc
21603 Causes constant variables to be placed in the @code{.near} section.
21604
21605 @item -mdiv
21606 @opindex mdiv
21607 Enables the @code{div} and @code{divu} instructions.
21608
21609 @item -meb
21610 @opindex meb
21611 Generate big-endian code.
21612
21613 @item -mel
21614 @opindex mel
21615 Generate little-endian code.
21616
21617 @item -mio-volatile
21618 @opindex mio-volatile
21619 Tells the compiler that any variable marked with the @code{io}
21620 attribute is to be considered volatile.
21621
21622 @item -ml
21623 @opindex ml
21624 Causes variables to be assigned to the @code{.far} section by default.
21625
21626 @item -mleadz
21627 @opindex mleadz
21628 Enables the @code{leadz} (leading zero) instruction.
21629
21630 @item -mm
21631 @opindex mm
21632 Causes variables to be assigned to the @code{.near} section by default.
21633
21634 @item -mminmax
21635 @opindex mminmax
21636 Enables the @code{min} and @code{max} instructions.
21637
21638 @item -mmult
21639 @opindex mmult
21640 Enables the multiplication and multiply-accumulate instructions.
21641
21642 @item -mno-opts
21643 @opindex mno-opts
21644 Disables all the optional instructions enabled by @option{-mall-opts}.
21645
21646 @item -mrepeat
21647 @opindex mrepeat
21648 Enables the @code{repeat} and @code{erepeat} instructions, used for
21649 low-overhead looping.
21650
21651 @item -ms
21652 @opindex ms
21653 Causes all variables to default to the @code{.tiny} section. Note
21654 that there is a 65536-byte limit to this section. Accesses to these
21655 variables use the @code{%gp} base register.
21656
21657 @item -msatur
21658 @opindex msatur
21659 Enables the saturation instructions. Note that the compiler does not
21660 currently generate these itself, but this option is included for
21661 compatibility with other tools, like @code{as}.
21662
21663 @item -msdram
21664 @opindex msdram
21665 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21666
21667 @item -msim
21668 @opindex msim
21669 Link the simulator run-time libraries.
21670
21671 @item -msimnovec
21672 @opindex msimnovec
21673 Link the simulator runtime libraries, excluding built-in support
21674 for reset and exception vectors and tables.
21675
21676 @item -mtf
21677 @opindex mtf
21678 Causes all functions to default to the @code{.far} section. Without
21679 this option, functions default to the @code{.near} section.
21680
21681 @item -mtiny=@var{n}
21682 @opindex mtiny=
21683 Variables that are @var{n} bytes or smaller are allocated to the
21684 @code{.tiny} section. These variables use the @code{$gp} base
21685 register. The default for this option is 4, but note that there's a
21686 65536-byte limit to the @code{.tiny} section.
21687
21688 @end table
21689
21690 @node MicroBlaze Options
21691 @subsection MicroBlaze Options
21692 @cindex MicroBlaze Options
21693
21694 @table @gcctabopt
21695
21696 @item -msoft-float
21697 @opindex msoft-float
21698 Use software emulation for floating point (default).
21699
21700 @item -mhard-float
21701 @opindex mhard-float
21702 Use hardware floating-point instructions.
21703
21704 @item -mmemcpy
21705 @opindex mmemcpy
21706 Do not optimize block moves, use @code{memcpy}.
21707
21708 @item -mno-clearbss
21709 @opindex mno-clearbss
21710 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21711
21712 @item -mcpu=@var{cpu-type}
21713 @opindex mcpu=
21714 Use features of, and schedule code for, the given CPU.
21715 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21716 where @var{X} is a major version, @var{YY} is the minor version, and
21717 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21718 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21719
21720 @item -mxl-soft-mul
21721 @opindex mxl-soft-mul
21722 Use software multiply emulation (default).
21723
21724 @item -mxl-soft-div
21725 @opindex mxl-soft-div
21726 Use software emulation for divides (default).
21727
21728 @item -mxl-barrel-shift
21729 @opindex mxl-barrel-shift
21730 Use the hardware barrel shifter.
21731
21732 @item -mxl-pattern-compare
21733 @opindex mxl-pattern-compare
21734 Use pattern compare instructions.
21735
21736 @item -msmall-divides
21737 @opindex msmall-divides
21738 Use table lookup optimization for small signed integer divisions.
21739
21740 @item -mxl-stack-check
21741 @opindex mxl-stack-check
21742 This option is deprecated. Use @option{-fstack-check} instead.
21743
21744 @item -mxl-gp-opt
21745 @opindex mxl-gp-opt
21746 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21747
21748 @item -mxl-multiply-high
21749 @opindex mxl-multiply-high
21750 Use multiply high instructions for high part of 32x32 multiply.
21751
21752 @item -mxl-float-convert
21753 @opindex mxl-float-convert
21754 Use hardware floating-point conversion instructions.
21755
21756 @item -mxl-float-sqrt
21757 @opindex mxl-float-sqrt
21758 Use hardware floating-point square root instruction.
21759
21760 @item -mbig-endian
21761 @opindex mbig-endian
21762 Generate code for a big-endian target.
21763
21764 @item -mlittle-endian
21765 @opindex mlittle-endian
21766 Generate code for a little-endian target.
21767
21768 @item -mxl-reorder
21769 @opindex mxl-reorder
21770 Use reorder instructions (swap and byte reversed load/store).
21771
21772 @item -mxl-mode-@var{app-model}
21773 Select application model @var{app-model}. Valid models are
21774 @table @samp
21775 @item executable
21776 normal executable (default), uses startup code @file{crt0.o}.
21777
21778 @item -mpic-data-is-text-relative
21779 @opindex mpic-data-is-text-relative
21780 Assume that the displacement between the text and data segments is fixed
21781 at static link time. This allows data to be referenced by offset from start of
21782 text address instead of GOT since PC-relative addressing is not supported.
21783
21784 @item xmdstub
21785 for use with Xilinx Microprocessor Debugger (XMD) based
21786 software intrusive debug agent called xmdstub. This uses startup file
21787 @file{crt1.o} and sets the start address of the program to 0x800.
21788
21789 @item bootstrap
21790 for applications that are loaded using a bootloader.
21791 This model uses startup file @file{crt2.o} which does not contain a processor
21792 reset vector handler. This is suitable for transferring control on a
21793 processor reset to the bootloader rather than the application.
21794
21795 @item novectors
21796 for applications that do not require any of the
21797 MicroBlaze vectors. This option may be useful for applications running
21798 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21799 @end table
21800
21801 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21802 @option{-mxl-mode-@var{app-model}}.
21803
21804 @end table
21805
21806 @node MIPS Options
21807 @subsection MIPS Options
21808 @cindex MIPS options
21809
21810 @table @gcctabopt
21811
21812 @item -EB
21813 @opindex EB
21814 Generate big-endian code.
21815
21816 @item -EL
21817 @opindex EL
21818 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21819 configurations.
21820
21821 @item -march=@var{arch}
21822 @opindex march
21823 Generate code that runs on @var{arch}, which can be the name of a
21824 generic MIPS ISA, or the name of a particular processor.
21825 The ISA names are:
21826 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21827 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21828 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21829 @samp{mips64r5} and @samp{mips64r6}.
21830 The processor names are:
21831 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21832 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21833 @samp{5kc}, @samp{5kf},
21834 @samp{20kc},
21835 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21836 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21837 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21838 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21839 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21840 @samp{i6400}, @samp{i6500},
21841 @samp{interaptiv},
21842 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21843 @samp{gs464e}, @samp{gs264e},
21844 @samp{m4k},
21845 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21846 @samp{m5100}, @samp{m5101},
21847 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21848 @samp{orion},
21849 @samp{p5600}, @samp{p6600},
21850 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21851 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21852 @samp{r6000}, @samp{r8000},
21853 @samp{rm7000}, @samp{rm9000},
21854 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21855 @samp{sb1},
21856 @samp{sr71000},
21857 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21858 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21859 @samp{xlr} and @samp{xlp}.
21860 The special value @samp{from-abi} selects the
21861 most compatible architecture for the selected ABI (that is,
21862 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21863
21864 The native Linux/GNU toolchain also supports the value @samp{native},
21865 which selects the best architecture option for the host processor.
21866 @option{-march=native} has no effect if GCC does not recognize
21867 the processor.
21868
21869 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21870 (for example, @option{-march=r2k}). Prefixes are optional, and
21871 @samp{vr} may be written @samp{r}.
21872
21873 Names of the form @samp{@var{n}f2_1} refer to processors with
21874 FPUs clocked at half the rate of the core, names of the form
21875 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21876 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21877 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21878 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21879 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21880 accepted as synonyms for @samp{@var{n}f1_1}.
21881
21882 GCC defines two macros based on the value of this option. The first
21883 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21884 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21885 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21886 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21887 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21888
21889 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21890 above. In other words, it has the full prefix and does not
21891 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21892 the macro names the resolved architecture (either @code{"mips1"} or
21893 @code{"mips3"}). It names the default architecture when no
21894 @option{-march} option is given.
21895
21896 @item -mtune=@var{arch}
21897 @opindex mtune
21898 Optimize for @var{arch}. Among other things, this option controls
21899 the way instructions are scheduled, and the perceived cost of arithmetic
21900 operations. The list of @var{arch} values is the same as for
21901 @option{-march}.
21902
21903 When this option is not used, GCC optimizes for the processor
21904 specified by @option{-march}. By using @option{-march} and
21905 @option{-mtune} together, it is possible to generate code that
21906 runs on a family of processors, but optimize the code for one
21907 particular member of that family.
21908
21909 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21910 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21911 @option{-march} ones described above.
21912
21913 @item -mips1
21914 @opindex mips1
21915 Equivalent to @option{-march=mips1}.
21916
21917 @item -mips2
21918 @opindex mips2
21919 Equivalent to @option{-march=mips2}.
21920
21921 @item -mips3
21922 @opindex mips3
21923 Equivalent to @option{-march=mips3}.
21924
21925 @item -mips4
21926 @opindex mips4
21927 Equivalent to @option{-march=mips4}.
21928
21929 @item -mips32
21930 @opindex mips32
21931 Equivalent to @option{-march=mips32}.
21932
21933 @item -mips32r3
21934 @opindex mips32r3
21935 Equivalent to @option{-march=mips32r3}.
21936
21937 @item -mips32r5
21938 @opindex mips32r5
21939 Equivalent to @option{-march=mips32r5}.
21940
21941 @item -mips32r6
21942 @opindex mips32r6
21943 Equivalent to @option{-march=mips32r6}.
21944
21945 @item -mips64
21946 @opindex mips64
21947 Equivalent to @option{-march=mips64}.
21948
21949 @item -mips64r2
21950 @opindex mips64r2
21951 Equivalent to @option{-march=mips64r2}.
21952
21953 @item -mips64r3
21954 @opindex mips64r3
21955 Equivalent to @option{-march=mips64r3}.
21956
21957 @item -mips64r5
21958 @opindex mips64r5
21959 Equivalent to @option{-march=mips64r5}.
21960
21961 @item -mips64r6
21962 @opindex mips64r6
21963 Equivalent to @option{-march=mips64r6}.
21964
21965 @item -mips16
21966 @itemx -mno-mips16
21967 @opindex mips16
21968 @opindex mno-mips16
21969 Generate (do not generate) MIPS16 code. If GCC is targeting a
21970 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21971
21972 MIPS16 code generation can also be controlled on a per-function basis
21973 by means of @code{mips16} and @code{nomips16} attributes.
21974 @xref{Function Attributes}, for more information.
21975
21976 @item -mflip-mips16
21977 @opindex mflip-mips16
21978 Generate MIPS16 code on alternating functions. This option is provided
21979 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21980 not intended for ordinary use in compiling user code.
21981
21982 @item -minterlink-compressed
21983 @itemx -mno-interlink-compressed
21984 @opindex minterlink-compressed
21985 @opindex mno-interlink-compressed
21986 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21987 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21988
21989 For example, code using the standard ISA encoding cannot jump directly
21990 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21991 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21992 knows that the target of the jump is not compressed.
21993
21994 @item -minterlink-mips16
21995 @itemx -mno-interlink-mips16
21996 @opindex minterlink-mips16
21997 @opindex mno-interlink-mips16
21998 Aliases of @option{-minterlink-compressed} and
21999 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
22000 and are retained for backwards compatibility.
22001
22002 @item -mabi=32
22003 @itemx -mabi=o64
22004 @itemx -mabi=n32
22005 @itemx -mabi=64
22006 @itemx -mabi=eabi
22007 @opindex mabi=32
22008 @opindex mabi=o64
22009 @opindex mabi=n32
22010 @opindex mabi=64
22011 @opindex mabi=eabi
22012 Generate code for the given ABI@.
22013
22014 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22015 generates 64-bit code when you select a 64-bit architecture, but you
22016 can use @option{-mgp32} to get 32-bit code instead.
22017
22018 For information about the O64 ABI, see
22019 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
22020
22021 GCC supports a variant of the o32 ABI in which floating-point registers
22022 are 64 rather than 32 bits wide. You can select this combination with
22023 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
22024 and @code{mfhc1} instructions and is therefore only supported for
22025 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22026
22027 The register assignments for arguments and return values remain the
22028 same, but each scalar value is passed in a single 64-bit register
22029 rather than a pair of 32-bit registers. For example, scalar
22030 floating-point values are returned in @samp{$f0} only, not a
22031 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
22032 remains the same in that the even-numbered double-precision registers
22033 are saved.
22034
22035 Two additional variants of the o32 ABI are supported to enable
22036 a transition from 32-bit to 64-bit registers. These are FPXX
22037 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
22038 The FPXX extension mandates that all code must execute correctly
22039 when run using 32-bit or 64-bit registers. The code can be interlinked
22040 with either FP32 or FP64, but not both.
22041 The FP64A extension is similar to the FP64 extension but forbids the
22042 use of odd-numbered single-precision registers. This can be used
22043 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
22044 processors and allows both FP32 and FP64A code to interlink and
22045 run in the same process without changing FPU modes.
22046
22047 @item -mabicalls
22048 @itemx -mno-abicalls
22049 @opindex mabicalls
22050 @opindex mno-abicalls
22051 Generate (do not generate) code that is suitable for SVR4-style
22052 dynamic objects. @option{-mabicalls} is the default for SVR4-based
22053 systems.
22054
22055 @item -mshared
22056 @itemx -mno-shared
22057 Generate (do not generate) code that is fully position-independent,
22058 and that can therefore be linked into shared libraries. This option
22059 only affects @option{-mabicalls}.
22060
22061 All @option{-mabicalls} code has traditionally been position-independent,
22062 regardless of options like @option{-fPIC} and @option{-fpic}. However,
22063 as an extension, the GNU toolchain allows executables to use absolute
22064 accesses for locally-binding symbols. It can also use shorter GP
22065 initialization sequences and generate direct calls to locally-defined
22066 functions. This mode is selected by @option{-mno-shared}.
22067
22068 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22069 objects that can only be linked by the GNU linker. However, the option
22070 does not affect the ABI of the final executable; it only affects the ABI
22071 of relocatable objects. Using @option{-mno-shared} generally makes
22072 executables both smaller and quicker.
22073
22074 @option{-mshared} is the default.
22075
22076 @item -mplt
22077 @itemx -mno-plt
22078 @opindex mplt
22079 @opindex mno-plt
22080 Assume (do not assume) that the static and dynamic linkers
22081 support PLTs and copy relocations. This option only affects
22082 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
22083 has no effect without @option{-msym32}.
22084
22085 You can make @option{-mplt} the default by configuring
22086 GCC with @option{--with-mips-plt}. The default is
22087 @option{-mno-plt} otherwise.
22088
22089 @item -mxgot
22090 @itemx -mno-xgot
22091 @opindex mxgot
22092 @opindex mno-xgot
22093 Lift (do not lift) the usual restrictions on the size of the global
22094 offset table.
22095
22096 GCC normally uses a single instruction to load values from the GOT@.
22097 While this is relatively efficient, it only works if the GOT
22098 is smaller than about 64k. Anything larger causes the linker
22099 to report an error such as:
22100
22101 @cindex relocation truncated to fit (MIPS)
22102 @smallexample
22103 relocation truncated to fit: R_MIPS_GOT16 foobar
22104 @end smallexample
22105
22106 If this happens, you should recompile your code with @option{-mxgot}.
22107 This works with very large GOTs, although the code is also
22108 less efficient, since it takes three instructions to fetch the
22109 value of a global symbol.
22110
22111 Note that some linkers can create multiple GOTs. If you have such a
22112 linker, you should only need to use @option{-mxgot} when a single object
22113 file accesses more than 64k's worth of GOT entries. Very few do.
22114
22115 These options have no effect unless GCC is generating position
22116 independent code.
22117
22118 @item -mgp32
22119 @opindex mgp32
22120 Assume that general-purpose registers are 32 bits wide.
22121
22122 @item -mgp64
22123 @opindex mgp64
22124 Assume that general-purpose registers are 64 bits wide.
22125
22126 @item -mfp32
22127 @opindex mfp32
22128 Assume that floating-point registers are 32 bits wide.
22129
22130 @item -mfp64
22131 @opindex mfp64
22132 Assume that floating-point registers are 64 bits wide.
22133
22134 @item -mfpxx
22135 @opindex mfpxx
22136 Do not assume the width of floating-point registers.
22137
22138 @item -mhard-float
22139 @opindex mhard-float
22140 Use floating-point coprocessor instructions.
22141
22142 @item -msoft-float
22143 @opindex msoft-float
22144 Do not use floating-point coprocessor instructions. Implement
22145 floating-point calculations using library calls instead.
22146
22147 @item -mno-float
22148 @opindex mno-float
22149 Equivalent to @option{-msoft-float}, but additionally asserts that the
22150 program being compiled does not perform any floating-point operations.
22151 This option is presently supported only by some bare-metal MIPS
22152 configurations, where it may select a special set of libraries
22153 that lack all floating-point support (including, for example, the
22154 floating-point @code{printf} formats).
22155 If code compiled with @option{-mno-float} accidentally contains
22156 floating-point operations, it is likely to suffer a link-time
22157 or run-time failure.
22158
22159 @item -msingle-float
22160 @opindex msingle-float
22161 Assume that the floating-point coprocessor only supports single-precision
22162 operations.
22163
22164 @item -mdouble-float
22165 @opindex mdouble-float
22166 Assume that the floating-point coprocessor supports double-precision
22167 operations. This is the default.
22168
22169 @item -modd-spreg
22170 @itemx -mno-odd-spreg
22171 @opindex modd-spreg
22172 @opindex mno-odd-spreg
22173 Enable the use of odd-numbered single-precision floating-point registers
22174 for the o32 ABI. This is the default for processors that are known to
22175 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22176 is set by default.
22177
22178 @item -mabs=2008
22179 @itemx -mabs=legacy
22180 @opindex mabs=2008
22181 @opindex mabs=legacy
22182 These options control the treatment of the special not-a-number (NaN)
22183 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22184 @code{neg.@i{fmt}} machine instructions.
22185
22186 By default or when @option{-mabs=legacy} is used the legacy
22187 treatment is selected. In this case these instructions are considered
22188 arithmetic and avoided where correct operation is required and the
22189 input operand might be a NaN. A longer sequence of instructions that
22190 manipulate the sign bit of floating-point datum manually is used
22191 instead unless the @option{-ffinite-math-only} option has also been
22192 specified.
22193
22194 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22195 this case these instructions are considered non-arithmetic and therefore
22196 operating correctly in all cases, including in particular where the
22197 input operand is a NaN. These instructions are therefore always used
22198 for the respective operations.
22199
22200 @item -mnan=2008
22201 @itemx -mnan=legacy
22202 @opindex mnan=2008
22203 @opindex mnan=legacy
22204 These options control the encoding of the special not-a-number (NaN)
22205 IEEE 754 floating-point data.
22206
22207 The @option{-mnan=legacy} option selects the legacy encoding. In this
22208 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22209 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22210 by the first bit of their trailing significand field being 1.
22211
22212 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22213 this case qNaNs are denoted by the first bit of their trailing
22214 significand field being 1, whereas sNaNs are denoted by the first bit of
22215 their trailing significand field being 0.
22216
22217 The default is @option{-mnan=legacy} unless GCC has been configured with
22218 @option{--with-nan=2008}.
22219
22220 @item -mllsc
22221 @itemx -mno-llsc
22222 @opindex mllsc
22223 @opindex mno-llsc
22224 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22225 implement atomic memory built-in functions. When neither option is
22226 specified, GCC uses the instructions if the target architecture
22227 supports them.
22228
22229 @option{-mllsc} is useful if the runtime environment can emulate the
22230 instructions and @option{-mno-llsc} can be useful when compiling for
22231 nonstandard ISAs. You can make either option the default by
22232 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22233 respectively. @option{--with-llsc} is the default for some
22234 configurations; see the installation documentation for details.
22235
22236 @item -mdsp
22237 @itemx -mno-dsp
22238 @opindex mdsp
22239 @opindex mno-dsp
22240 Use (do not use) revision 1 of the MIPS DSP ASE@.
22241 @xref{MIPS DSP Built-in Functions}. This option defines the
22242 preprocessor macro @code{__mips_dsp}. It also defines
22243 @code{__mips_dsp_rev} to 1.
22244
22245 @item -mdspr2
22246 @itemx -mno-dspr2
22247 @opindex mdspr2
22248 @opindex mno-dspr2
22249 Use (do not use) revision 2 of the MIPS DSP ASE@.
22250 @xref{MIPS DSP Built-in Functions}. This option defines the
22251 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22252 It also defines @code{__mips_dsp_rev} to 2.
22253
22254 @item -msmartmips
22255 @itemx -mno-smartmips
22256 @opindex msmartmips
22257 @opindex mno-smartmips
22258 Use (do not use) the MIPS SmartMIPS ASE.
22259
22260 @item -mpaired-single
22261 @itemx -mno-paired-single
22262 @opindex mpaired-single
22263 @opindex mno-paired-single
22264 Use (do not use) paired-single floating-point instructions.
22265 @xref{MIPS Paired-Single Support}. This option requires
22266 hardware floating-point support to be enabled.
22267
22268 @item -mdmx
22269 @itemx -mno-mdmx
22270 @opindex mdmx
22271 @opindex mno-mdmx
22272 Use (do not use) MIPS Digital Media Extension instructions.
22273 This option can only be used when generating 64-bit code and requires
22274 hardware floating-point support to be enabled.
22275
22276 @item -mips3d
22277 @itemx -mno-mips3d
22278 @opindex mips3d
22279 @opindex mno-mips3d
22280 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22281 The option @option{-mips3d} implies @option{-mpaired-single}.
22282
22283 @item -mmicromips
22284 @itemx -mno-micromips
22285 @opindex mmicromips
22286 @opindex mno-mmicromips
22287 Generate (do not generate) microMIPS code.
22288
22289 MicroMIPS code generation can also be controlled on a per-function basis
22290 by means of @code{micromips} and @code{nomicromips} attributes.
22291 @xref{Function Attributes}, for more information.
22292
22293 @item -mmt
22294 @itemx -mno-mt
22295 @opindex mmt
22296 @opindex mno-mt
22297 Use (do not use) MT Multithreading instructions.
22298
22299 @item -mmcu
22300 @itemx -mno-mcu
22301 @opindex mmcu
22302 @opindex mno-mcu
22303 Use (do not use) the MIPS MCU ASE instructions.
22304
22305 @item -meva
22306 @itemx -mno-eva
22307 @opindex meva
22308 @opindex mno-eva
22309 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22310
22311 @item -mvirt
22312 @itemx -mno-virt
22313 @opindex mvirt
22314 @opindex mno-virt
22315 Use (do not use) the MIPS Virtualization (VZ) instructions.
22316
22317 @item -mxpa
22318 @itemx -mno-xpa
22319 @opindex mxpa
22320 @opindex mno-xpa
22321 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22322
22323 @item -mcrc
22324 @itemx -mno-crc
22325 @opindex mcrc
22326 @opindex mno-crc
22327 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22328
22329 @item -mginv
22330 @itemx -mno-ginv
22331 @opindex mginv
22332 @opindex mno-ginv
22333 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22334
22335 @item -mloongson-mmi
22336 @itemx -mno-loongson-mmi
22337 @opindex mloongson-mmi
22338 @opindex mno-loongson-mmi
22339 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22340
22341 @item -mloongson-ext
22342 @itemx -mno-loongson-ext
22343 @opindex mloongson-ext
22344 @opindex mno-loongson-ext
22345 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22346
22347 @item -mloongson-ext2
22348 @itemx -mno-loongson-ext2
22349 @opindex mloongson-ext2
22350 @opindex mno-loongson-ext2
22351 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22352
22353 @item -mlong64
22354 @opindex mlong64
22355 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22356 an explanation of the default and the way that the pointer size is
22357 determined.
22358
22359 @item -mlong32
22360 @opindex mlong32
22361 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22362
22363 The default size of @code{int}s, @code{long}s and pointers depends on
22364 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22365 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22366 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22367 or the same size as integer registers, whichever is smaller.
22368
22369 @item -msym32
22370 @itemx -mno-sym32
22371 @opindex msym32
22372 @opindex mno-sym32
22373 Assume (do not assume) that all symbols have 32-bit values, regardless
22374 of the selected ABI@. This option is useful in combination with
22375 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22376 to generate shorter and faster references to symbolic addresses.
22377
22378 @item -G @var{num}
22379 @opindex G
22380 Put definitions of externally-visible data in a small data section
22381 if that data is no bigger than @var{num} bytes. GCC can then generate
22382 more efficient accesses to the data; see @option{-mgpopt} for details.
22383
22384 The default @option{-G} option depends on the configuration.
22385
22386 @item -mlocal-sdata
22387 @itemx -mno-local-sdata
22388 @opindex mlocal-sdata
22389 @opindex mno-local-sdata
22390 Extend (do not extend) the @option{-G} behavior to local data too,
22391 such as to static variables in C@. @option{-mlocal-sdata} is the
22392 default for all configurations.
22393
22394 If the linker complains that an application is using too much small data,
22395 you might want to try rebuilding the less performance-critical parts with
22396 @option{-mno-local-sdata}. You might also want to build large
22397 libraries with @option{-mno-local-sdata}, so that the libraries leave
22398 more room for the main program.
22399
22400 @item -mextern-sdata
22401 @itemx -mno-extern-sdata
22402 @opindex mextern-sdata
22403 @opindex mno-extern-sdata
22404 Assume (do not assume) that externally-defined data is in
22405 a small data section if the size of that data is within the @option{-G} limit.
22406 @option{-mextern-sdata} is the default for all configurations.
22407
22408 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22409 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22410 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22411 is placed in a small data section. If @var{Var} is defined by another
22412 module, you must either compile that module with a high-enough
22413 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22414 definition. If @var{Var} is common, you must link the application
22415 with a high-enough @option{-G} setting.
22416
22417 The easiest way of satisfying these restrictions is to compile
22418 and link every module with the same @option{-G} option. However,
22419 you may wish to build a library that supports several different
22420 small data limits. You can do this by compiling the library with
22421 the highest supported @option{-G} setting and additionally using
22422 @option{-mno-extern-sdata} to stop the library from making assumptions
22423 about externally-defined data.
22424
22425 @item -mgpopt
22426 @itemx -mno-gpopt
22427 @opindex mgpopt
22428 @opindex mno-gpopt
22429 Use (do not use) GP-relative accesses for symbols that are known to be
22430 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22431 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22432 configurations.
22433
22434 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22435 might not hold the value of @code{_gp}. For example, if the code is
22436 part of a library that might be used in a boot monitor, programs that
22437 call boot monitor routines pass an unknown value in @code{$gp}.
22438 (In such situations, the boot monitor itself is usually compiled
22439 with @option{-G0}.)
22440
22441 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22442 @option{-mno-extern-sdata}.
22443
22444 @item -membedded-data
22445 @itemx -mno-embedded-data
22446 @opindex membedded-data
22447 @opindex mno-embedded-data
22448 Allocate variables to the read-only data section first if possible, then
22449 next in the small data section if possible, otherwise in data. This gives
22450 slightly slower code than the default, but reduces the amount of RAM required
22451 when executing, and thus may be preferred for some embedded systems.
22452
22453 @item -muninit-const-in-rodata
22454 @itemx -mno-uninit-const-in-rodata
22455 @opindex muninit-const-in-rodata
22456 @opindex mno-uninit-const-in-rodata
22457 Put uninitialized @code{const} variables in the read-only data section.
22458 This option is only meaningful in conjunction with @option{-membedded-data}.
22459
22460 @item -mcode-readable=@var{setting}
22461 @opindex mcode-readable
22462 Specify whether GCC may generate code that reads from executable sections.
22463 There are three possible settings:
22464
22465 @table @gcctabopt
22466 @item -mcode-readable=yes
22467 Instructions may freely access executable sections. This is the
22468 default setting.
22469
22470 @item -mcode-readable=pcrel
22471 MIPS16 PC-relative load instructions can access executable sections,
22472 but other instructions must not do so. This option is useful on 4KSc
22473 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22474 It is also useful on processors that can be configured to have a dual
22475 instruction/data SRAM interface and that, like the M4K, automatically
22476 redirect PC-relative loads to the instruction RAM.
22477
22478 @item -mcode-readable=no
22479 Instructions must not access executable sections. This option can be
22480 useful on targets that are configured to have a dual instruction/data
22481 SRAM interface but that (unlike the M4K) do not automatically redirect
22482 PC-relative loads to the instruction RAM.
22483 @end table
22484
22485 @item -msplit-addresses
22486 @itemx -mno-split-addresses
22487 @opindex msplit-addresses
22488 @opindex mno-split-addresses
22489 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22490 relocation operators. This option has been superseded by
22491 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22492
22493 @item -mexplicit-relocs
22494 @itemx -mno-explicit-relocs
22495 @opindex mexplicit-relocs
22496 @opindex mno-explicit-relocs
22497 Use (do not use) assembler relocation operators when dealing with symbolic
22498 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22499 is to use assembler macros instead.
22500
22501 @option{-mexplicit-relocs} is the default if GCC was configured
22502 to use an assembler that supports relocation operators.
22503
22504 @item -mcheck-zero-division
22505 @itemx -mno-check-zero-division
22506 @opindex mcheck-zero-division
22507 @opindex mno-check-zero-division
22508 Trap (do not trap) on integer division by zero.
22509
22510 The default is @option{-mcheck-zero-division}.
22511
22512 @item -mdivide-traps
22513 @itemx -mdivide-breaks
22514 @opindex mdivide-traps
22515 @opindex mdivide-breaks
22516 MIPS systems check for division by zero by generating either a
22517 conditional trap or a break instruction. Using traps results in
22518 smaller code, but is only supported on MIPS II and later. Also, some
22519 versions of the Linux kernel have a bug that prevents trap from
22520 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22521 allow conditional traps on architectures that support them and
22522 @option{-mdivide-breaks} to force the use of breaks.
22523
22524 The default is usually @option{-mdivide-traps}, but this can be
22525 overridden at configure time using @option{--with-divide=breaks}.
22526 Divide-by-zero checks can be completely disabled using
22527 @option{-mno-check-zero-division}.
22528
22529 @item -mload-store-pairs
22530 @itemx -mno-load-store-pairs
22531 @opindex mload-store-pairs
22532 @opindex mno-load-store-pairs
22533 Enable (disable) an optimization that pairs consecutive load or store
22534 instructions to enable load/store bonding. This option is enabled by
22535 default but only takes effect when the selected architecture is known
22536 to support bonding.
22537
22538 @item -mmemcpy
22539 @itemx -mno-memcpy
22540 @opindex mmemcpy
22541 @opindex mno-memcpy
22542 Force (do not force) the use of @code{memcpy} for non-trivial block
22543 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22544 most constant-sized copies.
22545
22546 @item -mlong-calls
22547 @itemx -mno-long-calls
22548 @opindex mlong-calls
22549 @opindex mno-long-calls
22550 Disable (do not disable) use of the @code{jal} instruction. Calling
22551 functions using @code{jal} is more efficient but requires the caller
22552 and callee to be in the same 256 megabyte segment.
22553
22554 This option has no effect on abicalls code. The default is
22555 @option{-mno-long-calls}.
22556
22557 @item -mmad
22558 @itemx -mno-mad
22559 @opindex mmad
22560 @opindex mno-mad
22561 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22562 instructions, as provided by the R4650 ISA@.
22563
22564 @item -mimadd
22565 @itemx -mno-imadd
22566 @opindex mimadd
22567 @opindex mno-imadd
22568 Enable (disable) use of the @code{madd} and @code{msub} integer
22569 instructions. The default is @option{-mimadd} on architectures
22570 that support @code{madd} and @code{msub} except for the 74k
22571 architecture where it was found to generate slower code.
22572
22573 @item -mfused-madd
22574 @itemx -mno-fused-madd
22575 @opindex mfused-madd
22576 @opindex mno-fused-madd
22577 Enable (disable) use of the floating-point multiply-accumulate
22578 instructions, when they are available. The default is
22579 @option{-mfused-madd}.
22580
22581 On the R8000 CPU when multiply-accumulate instructions are used,
22582 the intermediate product is calculated to infinite precision
22583 and is not subject to the FCSR Flush to Zero bit. This may be
22584 undesirable in some circumstances. On other processors the result
22585 is numerically identical to the equivalent computation using
22586 separate multiply, add, subtract and negate instructions.
22587
22588 @item -nocpp
22589 @opindex nocpp
22590 Tell the MIPS assembler to not run its preprocessor over user
22591 assembler files (with a @samp{.s} suffix) when assembling them.
22592
22593 @item -mfix-24k
22594 @itemx -mno-fix-24k
22595 @opindex mfix-24k
22596 @opindex mno-fix-24k
22597 Work around the 24K E48 (lost data on stores during refill) errata.
22598 The workarounds are implemented by the assembler rather than by GCC@.
22599
22600 @item -mfix-r4000
22601 @itemx -mno-fix-r4000
22602 @opindex mfix-r4000
22603 @opindex mno-fix-r4000
22604 Work around certain R4000 CPU errata:
22605 @itemize @minus
22606 @item
22607 A double-word or a variable shift may give an incorrect result if executed
22608 immediately after starting an integer division.
22609 @item
22610 A double-word or a variable shift may give an incorrect result if executed
22611 while an integer multiplication is in progress.
22612 @item
22613 An integer division may give an incorrect result if started in a delay slot
22614 of a taken branch or a jump.
22615 @end itemize
22616
22617 @item -mfix-r4400
22618 @itemx -mno-fix-r4400
22619 @opindex mfix-r4400
22620 @opindex mno-fix-r4400
22621 Work around certain R4400 CPU errata:
22622 @itemize @minus
22623 @item
22624 A double-word or a variable shift may give an incorrect result if executed
22625 immediately after starting an integer division.
22626 @end itemize
22627
22628 @item -mfix-r10000
22629 @itemx -mno-fix-r10000
22630 @opindex mfix-r10000
22631 @opindex mno-fix-r10000
22632 Work around certain R10000 errata:
22633 @itemize @minus
22634 @item
22635 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22636 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22637 @end itemize
22638
22639 This option can only be used if the target architecture supports
22640 branch-likely instructions. @option{-mfix-r10000} is the default when
22641 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22642 otherwise.
22643
22644 @item -mfix-r5900
22645 @itemx -mno-fix-r5900
22646 @opindex mfix-r5900
22647 Do not attempt to schedule the preceding instruction into the delay slot
22648 of a branch instruction placed at the end of a short loop of six
22649 instructions or fewer and always schedule a @code{nop} instruction there
22650 instead. The short loop bug under certain conditions causes loops to
22651 execute only once or twice, due to a hardware bug in the R5900 chip. The
22652 workaround is implemented by the assembler rather than by GCC@.
22653
22654 @item -mfix-rm7000
22655 @itemx -mno-fix-rm7000
22656 @opindex mfix-rm7000
22657 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22658 workarounds are implemented by the assembler rather than by GCC@.
22659
22660 @item -mfix-vr4120
22661 @itemx -mno-fix-vr4120
22662 @opindex mfix-vr4120
22663 Work around certain VR4120 errata:
22664 @itemize @minus
22665 @item
22666 @code{dmultu} does not always produce the correct result.
22667 @item
22668 @code{div} and @code{ddiv} do not always produce the correct result if one
22669 of the operands is negative.
22670 @end itemize
22671 The workarounds for the division errata rely on special functions in
22672 @file{libgcc.a}. At present, these functions are only provided by
22673 the @code{mips64vr*-elf} configurations.
22674
22675 Other VR4120 errata require a NOP to be inserted between certain pairs of
22676 instructions. These errata are handled by the assembler, not by GCC itself.
22677
22678 @item -mfix-vr4130
22679 @opindex mfix-vr4130
22680 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22681 workarounds are implemented by the assembler rather than by GCC,
22682 although GCC avoids using @code{mflo} and @code{mfhi} if the
22683 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22684 instructions are available instead.
22685
22686 @item -mfix-sb1
22687 @itemx -mno-fix-sb1
22688 @opindex mfix-sb1
22689 Work around certain SB-1 CPU core errata.
22690 (This flag currently works around the SB-1 revision 2
22691 ``F1'' and ``F2'' floating-point errata.)
22692
22693 @item -mr10k-cache-barrier=@var{setting}
22694 @opindex mr10k-cache-barrier
22695 Specify whether GCC should insert cache barriers to avoid the
22696 side effects of speculation on R10K processors.
22697
22698 In common with many processors, the R10K tries to predict the outcome
22699 of a conditional branch and speculatively executes instructions from
22700 the ``taken'' branch. It later aborts these instructions if the
22701 predicted outcome is wrong. However, on the R10K, even aborted
22702 instructions can have side effects.
22703
22704 This problem only affects kernel stores and, depending on the system,
22705 kernel loads. As an example, a speculatively-executed store may load
22706 the target memory into cache and mark the cache line as dirty, even if
22707 the store itself is later aborted. If a DMA operation writes to the
22708 same area of memory before the ``dirty'' line is flushed, the cached
22709 data overwrites the DMA-ed data. See the R10K processor manual
22710 for a full description, including other potential problems.
22711
22712 One workaround is to insert cache barrier instructions before every memory
22713 access that might be speculatively executed and that might have side
22714 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22715 controls GCC's implementation of this workaround. It assumes that
22716 aborted accesses to any byte in the following regions does not have
22717 side effects:
22718
22719 @enumerate
22720 @item
22721 the memory occupied by the current function's stack frame;
22722
22723 @item
22724 the memory occupied by an incoming stack argument;
22725
22726 @item
22727 the memory occupied by an object with a link-time-constant address.
22728 @end enumerate
22729
22730 It is the kernel's responsibility to ensure that speculative
22731 accesses to these regions are indeed safe.
22732
22733 If the input program contains a function declaration such as:
22734
22735 @smallexample
22736 void foo (void);
22737 @end smallexample
22738
22739 then the implementation of @code{foo} must allow @code{j foo} and
22740 @code{jal foo} to be executed speculatively. GCC honors this
22741 restriction for functions it compiles itself. It expects non-GCC
22742 functions (such as hand-written assembly code) to do the same.
22743
22744 The option has three forms:
22745
22746 @table @gcctabopt
22747 @item -mr10k-cache-barrier=load-store
22748 Insert a cache barrier before a load or store that might be
22749 speculatively executed and that might have side effects even
22750 if aborted.
22751
22752 @item -mr10k-cache-barrier=store
22753 Insert a cache barrier before a store that might be speculatively
22754 executed and that might have side effects even if aborted.
22755
22756 @item -mr10k-cache-barrier=none
22757 Disable the insertion of cache barriers. This is the default setting.
22758 @end table
22759
22760 @item -mflush-func=@var{func}
22761 @itemx -mno-flush-func
22762 @opindex mflush-func
22763 Specifies the function to call to flush the I and D caches, or to not
22764 call any such function. If called, the function must take the same
22765 arguments as the common @code{_flush_func}, that is, the address of the
22766 memory range for which the cache is being flushed, the size of the
22767 memory range, and the number 3 (to flush both caches). The default
22768 depends on the target GCC was configured for, but commonly is either
22769 @code{_flush_func} or @code{__cpu_flush}.
22770
22771 @item mbranch-cost=@var{num}
22772 @opindex mbranch-cost
22773 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22774 This cost is only a heuristic and is not guaranteed to produce
22775 consistent results across releases. A zero cost redundantly selects
22776 the default, which is based on the @option{-mtune} setting.
22777
22778 @item -mbranch-likely
22779 @itemx -mno-branch-likely
22780 @opindex mbranch-likely
22781 @opindex mno-branch-likely
22782 Enable or disable use of Branch Likely instructions, regardless of the
22783 default for the selected architecture. By default, Branch Likely
22784 instructions may be generated if they are supported by the selected
22785 architecture. An exception is for the MIPS32 and MIPS64 architectures
22786 and processors that implement those architectures; for those, Branch
22787 Likely instructions are not be generated by default because the MIPS32
22788 and MIPS64 architectures specifically deprecate their use.
22789
22790 @item -mcompact-branches=never
22791 @itemx -mcompact-branches=optimal
22792 @itemx -mcompact-branches=always
22793 @opindex mcompact-branches=never
22794 @opindex mcompact-branches=optimal
22795 @opindex mcompact-branches=always
22796 These options control which form of branches will be generated. The
22797 default is @option{-mcompact-branches=optimal}.
22798
22799 The @option{-mcompact-branches=never} option ensures that compact branch
22800 instructions will never be generated.
22801
22802 The @option{-mcompact-branches=always} option ensures that a compact
22803 branch instruction will be generated if available. If a compact branch
22804 instruction is not available, a delay slot form of the branch will be
22805 used instead.
22806
22807 This option is supported from MIPS Release 6 onwards.
22808
22809 The @option{-mcompact-branches=optimal} option will cause a delay slot
22810 branch to be used if one is available in the current ISA and the delay
22811 slot is successfully filled. If the delay slot is not filled, a compact
22812 branch will be chosen if one is available.
22813
22814 @item -mfp-exceptions
22815 @itemx -mno-fp-exceptions
22816 @opindex mfp-exceptions
22817 Specifies whether FP exceptions are enabled. This affects how
22818 FP instructions are scheduled for some processors.
22819 The default is that FP exceptions are
22820 enabled.
22821
22822 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22823 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22824 FP pipe.
22825
22826 @item -mvr4130-align
22827 @itemx -mno-vr4130-align
22828 @opindex mvr4130-align
22829 The VR4130 pipeline is two-way superscalar, but can only issue two
22830 instructions together if the first one is 8-byte aligned. When this
22831 option is enabled, GCC aligns pairs of instructions that it
22832 thinks should execute in parallel.
22833
22834 This option only has an effect when optimizing for the VR4130.
22835 It normally makes code faster, but at the expense of making it bigger.
22836 It is enabled by default at optimization level @option{-O3}.
22837
22838 @item -msynci
22839 @itemx -mno-synci
22840 @opindex msynci
22841 Enable (disable) generation of @code{synci} instructions on
22842 architectures that support it. The @code{synci} instructions (if
22843 enabled) are generated when @code{__builtin___clear_cache} is
22844 compiled.
22845
22846 This option defaults to @option{-mno-synci}, but the default can be
22847 overridden by configuring GCC with @option{--with-synci}.
22848
22849 When compiling code for single processor systems, it is generally safe
22850 to use @code{synci}. However, on many multi-core (SMP) systems, it
22851 does not invalidate the instruction caches on all cores and may lead
22852 to undefined behavior.
22853
22854 @item -mrelax-pic-calls
22855 @itemx -mno-relax-pic-calls
22856 @opindex mrelax-pic-calls
22857 Try to turn PIC calls that are normally dispatched via register
22858 @code{$25} into direct calls. This is only possible if the linker can
22859 resolve the destination at link time and if the destination is within
22860 range for a direct call.
22861
22862 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22863 an assembler and a linker that support the @code{.reloc} assembly
22864 directive and @option{-mexplicit-relocs} is in effect. With
22865 @option{-mno-explicit-relocs}, this optimization can be performed by the
22866 assembler and the linker alone without help from the compiler.
22867
22868 @item -mmcount-ra-address
22869 @itemx -mno-mcount-ra-address
22870 @opindex mmcount-ra-address
22871 @opindex mno-mcount-ra-address
22872 Emit (do not emit) code that allows @code{_mcount} to modify the
22873 calling function's return address. When enabled, this option extends
22874 the usual @code{_mcount} interface with a new @var{ra-address}
22875 parameter, which has type @code{intptr_t *} and is passed in register
22876 @code{$12}. @code{_mcount} can then modify the return address by
22877 doing both of the following:
22878 @itemize
22879 @item
22880 Returning the new address in register @code{$31}.
22881 @item
22882 Storing the new address in @code{*@var{ra-address}},
22883 if @var{ra-address} is nonnull.
22884 @end itemize
22885
22886 The default is @option{-mno-mcount-ra-address}.
22887
22888 @item -mframe-header-opt
22889 @itemx -mno-frame-header-opt
22890 @opindex mframe-header-opt
22891 Enable (disable) frame header optimization in the o32 ABI. When using the
22892 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22893 function to write out register arguments. When enabled, this optimization
22894 will suppress the allocation of the frame header if it can be determined that
22895 it is unused.
22896
22897 This optimization is off by default at all optimization levels.
22898
22899 @item -mlxc1-sxc1
22900 @itemx -mno-lxc1-sxc1
22901 @opindex mlxc1-sxc1
22902 When applicable, enable (disable) the generation of @code{lwxc1},
22903 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22904
22905 @item -mmadd4
22906 @itemx -mno-madd4
22907 @opindex mmadd4
22908 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22909 @code{madd.d} and related instructions. Enabled by default.
22910
22911 @end table
22912
22913 @node MMIX Options
22914 @subsection MMIX Options
22915 @cindex MMIX Options
22916
22917 These options are defined for the MMIX:
22918
22919 @table @gcctabopt
22920 @item -mlibfuncs
22921 @itemx -mno-libfuncs
22922 @opindex mlibfuncs
22923 @opindex mno-libfuncs
22924 Specify that intrinsic library functions are being compiled, passing all
22925 values in registers, no matter the size.
22926
22927 @item -mepsilon
22928 @itemx -mno-epsilon
22929 @opindex mepsilon
22930 @opindex mno-epsilon
22931 Generate floating-point comparison instructions that compare with respect
22932 to the @code{rE} epsilon register.
22933
22934 @item -mabi=mmixware
22935 @itemx -mabi=gnu
22936 @opindex mabi=mmixware
22937 @opindex mabi=gnu
22938 Generate code that passes function parameters and return values that (in
22939 the called function) are seen as registers @code{$0} and up, as opposed to
22940 the GNU ABI which uses global registers @code{$231} and up.
22941
22942 @item -mzero-extend
22943 @itemx -mno-zero-extend
22944 @opindex mzero-extend
22945 @opindex mno-zero-extend
22946 When reading data from memory in sizes shorter than 64 bits, use (do not
22947 use) zero-extending load instructions by default, rather than
22948 sign-extending ones.
22949
22950 @item -mknuthdiv
22951 @itemx -mno-knuthdiv
22952 @opindex mknuthdiv
22953 @opindex mno-knuthdiv
22954 Make the result of a division yielding a remainder have the same sign as
22955 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22956 remainder follows the sign of the dividend. Both methods are
22957 arithmetically valid, the latter being almost exclusively used.
22958
22959 @item -mtoplevel-symbols
22960 @itemx -mno-toplevel-symbols
22961 @opindex mtoplevel-symbols
22962 @opindex mno-toplevel-symbols
22963 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22964 code can be used with the @code{PREFIX} assembly directive.
22965
22966 @item -melf
22967 @opindex melf
22968 Generate an executable in the ELF format, rather than the default
22969 @samp{mmo} format used by the @command{mmix} simulator.
22970
22971 @item -mbranch-predict
22972 @itemx -mno-branch-predict
22973 @opindex mbranch-predict
22974 @opindex mno-branch-predict
22975 Use (do not use) the probable-branch instructions, when static branch
22976 prediction indicates a probable branch.
22977
22978 @item -mbase-addresses
22979 @itemx -mno-base-addresses
22980 @opindex mbase-addresses
22981 @opindex mno-base-addresses
22982 Generate (do not generate) code that uses @emph{base addresses}. Using a
22983 base address automatically generates a request (handled by the assembler
22984 and the linker) for a constant to be set up in a global register. The
22985 register is used for one or more base address requests within the range 0
22986 to 255 from the value held in the register. The generally leads to short
22987 and fast code, but the number of different data items that can be
22988 addressed is limited. This means that a program that uses lots of static
22989 data may require @option{-mno-base-addresses}.
22990
22991 @item -msingle-exit
22992 @itemx -mno-single-exit
22993 @opindex msingle-exit
22994 @opindex mno-single-exit
22995 Force (do not force) generated code to have a single exit point in each
22996 function.
22997 @end table
22998
22999 @node MN10300 Options
23000 @subsection MN10300 Options
23001 @cindex MN10300 options
23002
23003 These @option{-m} options are defined for Matsushita MN10300 architectures:
23004
23005 @table @gcctabopt
23006 @item -mmult-bug
23007 @opindex mmult-bug
23008 Generate code to avoid bugs in the multiply instructions for the MN10300
23009 processors. This is the default.
23010
23011 @item -mno-mult-bug
23012 @opindex mno-mult-bug
23013 Do not generate code to avoid bugs in the multiply instructions for the
23014 MN10300 processors.
23015
23016 @item -mam33
23017 @opindex mam33
23018 Generate code using features specific to the AM33 processor.
23019
23020 @item -mno-am33
23021 @opindex mno-am33
23022 Do not generate code using features specific to the AM33 processor. This
23023 is the default.
23024
23025 @item -mam33-2
23026 @opindex mam33-2
23027 Generate code using features specific to the AM33/2.0 processor.
23028
23029 @item -mam34
23030 @opindex mam34
23031 Generate code using features specific to the AM34 processor.
23032
23033 @item -mtune=@var{cpu-type}
23034 @opindex mtune
23035 Use the timing characteristics of the indicated CPU type when
23036 scheduling instructions. This does not change the targeted processor
23037 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
23038 @samp{am33-2} or @samp{am34}.
23039
23040 @item -mreturn-pointer-on-d0
23041 @opindex mreturn-pointer-on-d0
23042 When generating a function that returns a pointer, return the pointer
23043 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
23044 only in @code{a0}, and attempts to call such functions without a prototype
23045 result in errors. Note that this option is on by default; use
23046 @option{-mno-return-pointer-on-d0} to disable it.
23047
23048 @item -mno-crt0
23049 @opindex mno-crt0
23050 Do not link in the C run-time initialization object file.
23051
23052 @item -mrelax
23053 @opindex mrelax
23054 Indicate to the linker that it should perform a relaxation optimization pass
23055 to shorten branches, calls and absolute memory addresses. This option only
23056 has an effect when used on the command line for the final link step.
23057
23058 This option makes symbolic debugging impossible.
23059
23060 @item -mliw
23061 @opindex mliw
23062 Allow the compiler to generate @emph{Long Instruction Word}
23063 instructions if the target is the @samp{AM33} or later. This is the
23064 default. This option defines the preprocessor macro @code{__LIW__}.
23065
23066 @item -mno-liw
23067 @opindex mno-liw
23068 Do not allow the compiler to generate @emph{Long Instruction Word}
23069 instructions. This option defines the preprocessor macro
23070 @code{__NO_LIW__}.
23071
23072 @item -msetlb
23073 @opindex msetlb
23074 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23075 instructions if the target is the @samp{AM33} or later. This is the
23076 default. This option defines the preprocessor macro @code{__SETLB__}.
23077
23078 @item -mno-setlb
23079 @opindex mno-setlb
23080 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23081 instructions. This option defines the preprocessor macro
23082 @code{__NO_SETLB__}.
23083
23084 @end table
23085
23086 @node Moxie Options
23087 @subsection Moxie Options
23088 @cindex Moxie Options
23089
23090 @table @gcctabopt
23091
23092 @item -meb
23093 @opindex meb
23094 Generate big-endian code. This is the default for @samp{moxie-*-*}
23095 configurations.
23096
23097 @item -mel
23098 @opindex mel
23099 Generate little-endian code.
23100
23101 @item -mmul.x
23102 @opindex mmul.x
23103 Generate mul.x and umul.x instructions. This is the default for
23104 @samp{moxiebox-*-*} configurations.
23105
23106 @item -mno-crt0
23107 @opindex mno-crt0
23108 Do not link in the C run-time initialization object file.
23109
23110 @end table
23111
23112 @node MSP430 Options
23113 @subsection MSP430 Options
23114 @cindex MSP430 Options
23115
23116 These options are defined for the MSP430:
23117
23118 @table @gcctabopt
23119
23120 @item -masm-hex
23121 @opindex masm-hex
23122 Force assembly output to always use hex constants. Normally such
23123 constants are signed decimals, but this option is available for
23124 testsuite and/or aesthetic purposes.
23125
23126 @item -mmcu=
23127 @opindex mmcu=
23128 Select the MCU to target. This is used to create a C preprocessor
23129 symbol based upon the MCU name, converted to upper case and pre- and
23130 post-fixed with @samp{__}. This in turn is used by the
23131 @file{msp430.h} header file to select an MCU-specific supplementary
23132 header file.
23133
23134 The option also sets the ISA to use. If the MCU name is one that is
23135 known to only support the 430 ISA then that is selected, otherwise the
23136 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23137 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23138 name selects the 430X ISA.
23139
23140 In addition an MCU-specific linker script is added to the linker
23141 command line. The script's name is the name of the MCU with
23142 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23143 command line defines the C preprocessor symbol @code{__XXX__} and
23144 cause the linker to search for a script called @file{xxx.ld}.
23145
23146 The ISA and hardware multiply supported for the different MCUs is hard-coded
23147 into GCC. However, an external @samp{devices.csv} file can be used to
23148 extend device support beyond those that have been hard-coded.
23149
23150 GCC searches for the @samp{devices.csv} file on the paths specified
23151 with the @code{-I} and @code{-L} options.
23152
23153 @item -mwarn-mcu
23154 @itemx -mno-warn-mcu
23155 @opindex mwarn-mcu
23156 @opindex mno-warn-mcu
23157 This option enables or disables warnings about conflicts between the
23158 MCU name specified by the @option{-mmcu} option and the ISA set by the
23159 @option{-mcpu} option and/or the hardware multiply support set by the
23160 @option{-mhwmult} option. It also toggles warnings about unrecognized
23161 MCU names. This option is on by default.
23162
23163 @item -mcpu=
23164 @opindex mcpu=
23165 Specifies the ISA to use. Accepted values are @samp{msp430},
23166 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23167 @option{-mmcu=} option should be used to select the ISA.
23168
23169 @item -msim
23170 @opindex msim
23171 Link to the simulator runtime libraries and linker script. Overrides
23172 any scripts that would be selected by the @option{-mmcu=} option.
23173
23174 @item -mlarge
23175 @opindex mlarge
23176 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23177
23178 @item -msmall
23179 @opindex msmall
23180 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23181
23182 @item -mrelax
23183 @opindex mrelax
23184 This option is passed to the assembler and linker, and allows the
23185 linker to perform certain optimizations that cannot be done until
23186 the final link.
23187
23188 @item mhwmult=
23189 @opindex mhwmult=
23190 Describes the type of hardware multiply supported by the target.
23191 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23192 for the original 16-bit-only multiply supported by early MCUs.
23193 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23194 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23195 A value of @samp{auto} can also be given. This tells GCC to deduce
23196 the hardware multiply support based upon the MCU name provided by the
23197 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23198 the MCU name is not recognized then no hardware multiply support is
23199 assumed. @code{auto} is the default setting.
23200
23201 Hardware multiplies are normally performed by calling a library
23202 routine. This saves space in the generated code. When compiling at
23203 @option{-O3} or higher however the hardware multiplier is invoked
23204 inline. This makes for bigger, but faster code.
23205
23206 The hardware multiply routines disable interrupts whilst running and
23207 restore the previous interrupt state when they finish. This makes
23208 them safe to use inside interrupt handlers as well as in normal code.
23209
23210 @item -minrt
23211 @opindex minrt
23212 Enable the use of a minimum runtime environment - no static
23213 initializers or constructors. This is intended for memory-constrained
23214 devices. The compiler includes special symbols in some objects
23215 that tell the linker and runtime which code fragments are required.
23216
23217 @item -mcode-region=
23218 @itemx -mdata-region=
23219 @opindex mcode-region
23220 @opindex mdata-region
23221 These options tell the compiler where to place functions and data that
23222 do not have one of the @code{lower}, @code{upper}, @code{either} or
23223 @code{section} attributes. Possible values are @code{lower},
23224 @code{upper}, @code{either} or @code{any}. The first three behave
23225 like the corresponding attribute. The fourth possible value -
23226 @code{any} - is the default. It leaves placement entirely up to the
23227 linker script and how it assigns the standard sections
23228 (@code{.text}, @code{.data}, etc) to the memory regions.
23229
23230 @item -msilicon-errata=
23231 @opindex msilicon-errata
23232 This option passes on a request to assembler to enable the fixes for
23233 the named silicon errata.
23234
23235 @item -msilicon-errata-warn=
23236 @opindex msilicon-errata-warn
23237 This option passes on a request to the assembler to enable warning
23238 messages when a silicon errata might need to be applied.
23239
23240 @item -mwarn-devices-csv
23241 @itemx -mno-warn-devices-csv
23242 @opindex mwarn-devices-csv
23243 @opindex mno-warn-devices-csv
23244 Warn if @samp{devices.csv} is not found or there are problem parsing it
23245 (default: on).
23246
23247 @end table
23248
23249 @node NDS32 Options
23250 @subsection NDS32 Options
23251 @cindex NDS32 Options
23252
23253 These options are defined for NDS32 implementations:
23254
23255 @table @gcctabopt
23256
23257 @item -mbig-endian
23258 @opindex mbig-endian
23259 Generate code in big-endian mode.
23260
23261 @item -mlittle-endian
23262 @opindex mlittle-endian
23263 Generate code in little-endian mode.
23264
23265 @item -mreduced-regs
23266 @opindex mreduced-regs
23267 Use reduced-set registers for register allocation.
23268
23269 @item -mfull-regs
23270 @opindex mfull-regs
23271 Use full-set registers for register allocation.
23272
23273 @item -mcmov
23274 @opindex mcmov
23275 Generate conditional move instructions.
23276
23277 @item -mno-cmov
23278 @opindex mno-cmov
23279 Do not generate conditional move instructions.
23280
23281 @item -mext-perf
23282 @opindex mext-perf
23283 Generate performance extension instructions.
23284
23285 @item -mno-ext-perf
23286 @opindex mno-ext-perf
23287 Do not generate performance extension instructions.
23288
23289 @item -mext-perf2
23290 @opindex mext-perf2
23291 Generate performance extension 2 instructions.
23292
23293 @item -mno-ext-perf2
23294 @opindex mno-ext-perf2
23295 Do not generate performance extension 2 instructions.
23296
23297 @item -mext-string
23298 @opindex mext-string
23299 Generate string extension instructions.
23300
23301 @item -mno-ext-string
23302 @opindex mno-ext-string
23303 Do not generate string extension instructions.
23304
23305 @item -mv3push
23306 @opindex mv3push
23307 Generate v3 push25/pop25 instructions.
23308
23309 @item -mno-v3push
23310 @opindex mno-v3push
23311 Do not generate v3 push25/pop25 instructions.
23312
23313 @item -m16-bit
23314 @opindex m16-bit
23315 Generate 16-bit instructions.
23316
23317 @item -mno-16-bit
23318 @opindex mno-16-bit
23319 Do not generate 16-bit instructions.
23320
23321 @item -misr-vector-size=@var{num}
23322 @opindex misr-vector-size
23323 Specify the size of each interrupt vector, which must be 4 or 16.
23324
23325 @item -mcache-block-size=@var{num}
23326 @opindex mcache-block-size
23327 Specify the size of each cache block,
23328 which must be a power of 2 between 4 and 512.
23329
23330 @item -march=@var{arch}
23331 @opindex march
23332 Specify the name of the target architecture.
23333
23334 @item -mcmodel=@var{code-model}
23335 @opindex mcmodel
23336 Set the code model to one of
23337 @table @asis
23338 @item @samp{small}
23339 All the data and read-only data segments must be within 512KB addressing space.
23340 The text segment must be within 16MB addressing space.
23341 @item @samp{medium}
23342 The data segment must be within 512KB while the read-only data segment can be
23343 within 4GB addressing space. The text segment should be still within 16MB
23344 addressing space.
23345 @item @samp{large}
23346 All the text and data segments can be within 4GB addressing space.
23347 @end table
23348
23349 @item -mctor-dtor
23350 @opindex mctor-dtor
23351 Enable constructor/destructor feature.
23352
23353 @item -mrelax
23354 @opindex mrelax
23355 Guide linker to relax instructions.
23356
23357 @end table
23358
23359 @node Nios II Options
23360 @subsection Nios II Options
23361 @cindex Nios II options
23362 @cindex Altera Nios II options
23363
23364 These are the options defined for the Altera Nios II processor.
23365
23366 @table @gcctabopt
23367
23368 @item -G @var{num}
23369 @opindex G
23370 @cindex smaller data references
23371 Put global and static objects less than or equal to @var{num} bytes
23372 into the small data or BSS sections instead of the normal data or BSS
23373 sections. The default value of @var{num} is 8.
23374
23375 @item -mgpopt=@var{option}
23376 @itemx -mgpopt
23377 @itemx -mno-gpopt
23378 @opindex mgpopt
23379 @opindex mno-gpopt
23380 Generate (do not generate) GP-relative accesses. The following
23381 @var{option} names are recognized:
23382
23383 @table @samp
23384
23385 @item none
23386 Do not generate GP-relative accesses.
23387
23388 @item local
23389 Generate GP-relative accesses for small data objects that are not
23390 external, weak, or uninitialized common symbols.
23391 Also use GP-relative addressing for objects that
23392 have been explicitly placed in a small data section via a @code{section}
23393 attribute.
23394
23395 @item global
23396 As for @samp{local}, but also generate GP-relative accesses for
23397 small data objects that are external, weak, or common. If you use this option,
23398 you must ensure that all parts of your program (including libraries) are
23399 compiled with the same @option{-G} setting.
23400
23401 @item data
23402 Generate GP-relative accesses for all data objects in the program. If you
23403 use this option, the entire data and BSS segments
23404 of your program must fit in 64K of memory and you must use an appropriate
23405 linker script to allocate them within the addressable range of the
23406 global pointer.
23407
23408 @item all
23409 Generate GP-relative addresses for function pointers as well as data
23410 pointers. If you use this option, the entire text, data, and BSS segments
23411 of your program must fit in 64K of memory and you must use an appropriate
23412 linker script to allocate them within the addressable range of the
23413 global pointer.
23414
23415 @end table
23416
23417 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23418 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23419
23420 The default is @option{-mgpopt} except when @option{-fpic} or
23421 @option{-fPIC} is specified to generate position-independent code.
23422 Note that the Nios II ABI does not permit GP-relative accesses from
23423 shared libraries.
23424
23425 You may need to specify @option{-mno-gpopt} explicitly when building
23426 programs that include large amounts of small data, including large
23427 GOT data sections. In this case, the 16-bit offset for GP-relative
23428 addressing may not be large enough to allow access to the entire
23429 small data section.
23430
23431 @item -mgprel-sec=@var{regexp}
23432 @opindex mgprel-sec
23433 This option specifies additional section names that can be accessed via
23434 GP-relative addressing. It is most useful in conjunction with
23435 @code{section} attributes on variable declarations
23436 (@pxref{Common Variable Attributes}) and a custom linker script.
23437 The @var{regexp} is a POSIX Extended Regular Expression.
23438
23439 This option does not affect the behavior of the @option{-G} option, and
23440 the specified sections are in addition to the standard @code{.sdata}
23441 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23442
23443 @item -mr0rel-sec=@var{regexp}
23444 @opindex mr0rel-sec
23445 This option specifies names of sections that can be accessed via a
23446 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23447 of the 32-bit address space. It is most useful in conjunction with
23448 @code{section} attributes on variable declarations
23449 (@pxref{Common Variable Attributes}) and a custom linker script.
23450 The @var{regexp} is a POSIX Extended Regular Expression.
23451
23452 In contrast to the use of GP-relative addressing for small data,
23453 zero-based addressing is never generated by default and there are no
23454 conventional section names used in standard linker scripts for sections
23455 in the low or high areas of memory.
23456
23457 @item -mel
23458 @itemx -meb
23459 @opindex mel
23460 @opindex meb
23461 Generate little-endian (default) or big-endian (experimental) code,
23462 respectively.
23463
23464 @item -march=@var{arch}
23465 @opindex march
23466 This specifies the name of the target Nios II architecture. GCC uses this
23467 name to determine what kind of instructions it can emit when generating
23468 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23469
23470 The preprocessor macro @code{__nios2_arch__} is available to programs,
23471 with value 1 or 2, indicating the targeted ISA level.
23472
23473 @item -mbypass-cache
23474 @itemx -mno-bypass-cache
23475 @opindex mno-bypass-cache
23476 @opindex mbypass-cache
23477 Force all load and store instructions to always bypass cache by
23478 using I/O variants of the instructions. The default is not to
23479 bypass the cache.
23480
23481 @item -mno-cache-volatile
23482 @itemx -mcache-volatile
23483 @opindex mcache-volatile
23484 @opindex mno-cache-volatile
23485 Volatile memory access bypass the cache using the I/O variants of
23486 the load and store instructions. The default is not to bypass the cache.
23487
23488 @item -mno-fast-sw-div
23489 @itemx -mfast-sw-div
23490 @opindex mno-fast-sw-div
23491 @opindex mfast-sw-div
23492 Do not use table-based fast divide for small numbers. The default
23493 is to use the fast divide at @option{-O3} and above.
23494
23495 @item -mno-hw-mul
23496 @itemx -mhw-mul
23497 @itemx -mno-hw-mulx
23498 @itemx -mhw-mulx
23499 @itemx -mno-hw-div
23500 @itemx -mhw-div
23501 @opindex mno-hw-mul
23502 @opindex mhw-mul
23503 @opindex mno-hw-mulx
23504 @opindex mhw-mulx
23505 @opindex mno-hw-div
23506 @opindex mhw-div
23507 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23508 instructions by the compiler. The default is to emit @code{mul}
23509 and not emit @code{div} and @code{mulx}.
23510
23511 @item -mbmx
23512 @itemx -mno-bmx
23513 @itemx -mcdx
23514 @itemx -mno-cdx
23515 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23516 CDX (code density) instructions. Enabling these instructions also
23517 requires @option{-march=r2}. Since these instructions are optional
23518 extensions to the R2 architecture, the default is not to emit them.
23519
23520 @item -mcustom-@var{insn}=@var{N}
23521 @itemx -mno-custom-@var{insn}
23522 @opindex mcustom-@var{insn}
23523 @opindex mno-custom-@var{insn}
23524 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23525 custom instruction with encoding @var{N} when generating code that uses
23526 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23527 instruction 253 for single-precision floating-point add operations instead
23528 of the default behavior of using a library call.
23529
23530 The following values of @var{insn} are supported. Except as otherwise
23531 noted, floating-point operations are expected to be implemented with
23532 normal IEEE 754 semantics and correspond directly to the C operators or the
23533 equivalent GCC built-in functions (@pxref{Other Builtins}).
23534
23535 Single-precision floating point:
23536 @table @asis
23537
23538 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23539 Binary arithmetic operations.
23540
23541 @item @samp{fnegs}
23542 Unary negation.
23543
23544 @item @samp{fabss}
23545 Unary absolute value.
23546
23547 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23548 Comparison operations.
23549
23550 @item @samp{fmins}, @samp{fmaxs}
23551 Floating-point minimum and maximum. These instructions are only
23552 generated if @option{-ffinite-math-only} is specified.
23553
23554 @item @samp{fsqrts}
23555 Unary square root operation.
23556
23557 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23558 Floating-point trigonometric and exponential functions. These instructions
23559 are only generated if @option{-funsafe-math-optimizations} is also specified.
23560
23561 @end table
23562
23563 Double-precision floating point:
23564 @table @asis
23565
23566 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23567 Binary arithmetic operations.
23568
23569 @item @samp{fnegd}
23570 Unary negation.
23571
23572 @item @samp{fabsd}
23573 Unary absolute value.
23574
23575 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23576 Comparison operations.
23577
23578 @item @samp{fmind}, @samp{fmaxd}
23579 Double-precision minimum and maximum. These instructions are only
23580 generated if @option{-ffinite-math-only} is specified.
23581
23582 @item @samp{fsqrtd}
23583 Unary square root operation.
23584
23585 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23586 Double-precision trigonometric and exponential functions. These instructions
23587 are only generated if @option{-funsafe-math-optimizations} is also specified.
23588
23589 @end table
23590
23591 Conversions:
23592 @table @asis
23593 @item @samp{fextsd}
23594 Conversion from single precision to double precision.
23595
23596 @item @samp{ftruncds}
23597 Conversion from double precision to single precision.
23598
23599 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23600 Conversion from floating point to signed or unsigned integer types, with
23601 truncation towards zero.
23602
23603 @item @samp{round}
23604 Conversion from single-precision floating point to signed integer,
23605 rounding to the nearest integer and ties away from zero.
23606 This corresponds to the @code{__builtin_lroundf} function when
23607 @option{-fno-math-errno} is used.
23608
23609 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23610 Conversion from signed or unsigned integer types to floating-point types.
23611
23612 @end table
23613
23614 In addition, all of the following transfer instructions for internal
23615 registers X and Y must be provided to use any of the double-precision
23616 floating-point instructions. Custom instructions taking two
23617 double-precision source operands expect the first operand in the
23618 64-bit register X. The other operand (or only operand of a unary
23619 operation) is given to the custom arithmetic instruction with the
23620 least significant half in source register @var{src1} and the most
23621 significant half in @var{src2}. A custom instruction that returns a
23622 double-precision result returns the most significant 32 bits in the
23623 destination register and the other half in 32-bit register Y.
23624 GCC automatically generates the necessary code sequences to write
23625 register X and/or read register Y when double-precision floating-point
23626 instructions are used.
23627
23628 @table @asis
23629
23630 @item @samp{fwrx}
23631 Write @var{src1} into the least significant half of X and @var{src2} into
23632 the most significant half of X.
23633
23634 @item @samp{fwry}
23635 Write @var{src1} into Y.
23636
23637 @item @samp{frdxhi}, @samp{frdxlo}
23638 Read the most or least (respectively) significant half of X and store it in
23639 @var{dest}.
23640
23641 @item @samp{frdy}
23642 Read the value of Y and store it into @var{dest}.
23643 @end table
23644
23645 Note that you can gain more local control over generation of Nios II custom
23646 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23647 and @code{target("no-custom-@var{insn}")} function attributes
23648 (@pxref{Function Attributes})
23649 or pragmas (@pxref{Function Specific Option Pragmas}).
23650
23651 @item -mcustom-fpu-cfg=@var{name}
23652 @opindex mcustom-fpu-cfg
23653
23654 This option enables a predefined, named set of custom instruction encodings
23655 (see @option{-mcustom-@var{insn}} above).
23656 Currently, the following sets are defined:
23657
23658 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23659 @gccoptlist{-mcustom-fmuls=252 @gol
23660 -mcustom-fadds=253 @gol
23661 -mcustom-fsubs=254 @gol
23662 -fsingle-precision-constant}
23663
23664 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23665 @gccoptlist{-mcustom-fmuls=252 @gol
23666 -mcustom-fadds=253 @gol
23667 -mcustom-fsubs=254 @gol
23668 -mcustom-fdivs=255 @gol
23669 -fsingle-precision-constant}
23670
23671 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23672 @gccoptlist{-mcustom-floatus=243 @gol
23673 -mcustom-fixsi=244 @gol
23674 -mcustom-floatis=245 @gol
23675 -mcustom-fcmpgts=246 @gol
23676 -mcustom-fcmples=249 @gol
23677 -mcustom-fcmpeqs=250 @gol
23678 -mcustom-fcmpnes=251 @gol
23679 -mcustom-fmuls=252 @gol
23680 -mcustom-fadds=253 @gol
23681 -mcustom-fsubs=254 @gol
23682 -mcustom-fdivs=255 @gol
23683 -fsingle-precision-constant}
23684
23685 Custom instruction assignments given by individual
23686 @option{-mcustom-@var{insn}=} options override those given by
23687 @option{-mcustom-fpu-cfg=}, regardless of the
23688 order of the options on the command line.
23689
23690 Note that you can gain more local control over selection of a FPU
23691 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23692 function attribute (@pxref{Function Attributes})
23693 or pragma (@pxref{Function Specific Option Pragmas}).
23694
23695 @end table
23696
23697 These additional @samp{-m} options are available for the Altera Nios II
23698 ELF (bare-metal) target:
23699
23700 @table @gcctabopt
23701
23702 @item -mhal
23703 @opindex mhal
23704 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23705 startup and termination code, and is typically used in conjunction with
23706 @option{-msys-crt0=} to specify the location of the alternate startup code
23707 provided by the HAL BSP.
23708
23709 @item -msmallc
23710 @opindex msmallc
23711 Link with a limited version of the C library, @option{-lsmallc}, rather than
23712 Newlib.
23713
23714 @item -msys-crt0=@var{startfile}
23715 @opindex msys-crt0
23716 @var{startfile} is the file name of the startfile (crt0) to use
23717 when linking. This option is only useful in conjunction with @option{-mhal}.
23718
23719 @item -msys-lib=@var{systemlib}
23720 @opindex msys-lib
23721 @var{systemlib} is the library name of the library that provides
23722 low-level system calls required by the C library,
23723 e.g.@: @code{read} and @code{write}.
23724 This option is typically used to link with a library provided by a HAL BSP.
23725
23726 @end table
23727
23728 @node Nvidia PTX Options
23729 @subsection Nvidia PTX Options
23730 @cindex Nvidia PTX options
23731 @cindex nvptx options
23732
23733 These options are defined for Nvidia PTX:
23734
23735 @table @gcctabopt
23736
23737 @item -m32
23738 @itemx -m64
23739 @opindex m32
23740 @opindex m64
23741 Generate code for 32-bit or 64-bit ABI.
23742
23743 @item -misa=@var{ISA-string}
23744 @opindex march
23745 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23746 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23747 @samp{sm_35}. The default ISA is sm_30.
23748
23749 @item -mmainkernel
23750 @opindex mmainkernel
23751 Link in code for a __main kernel. This is for stand-alone instead of
23752 offloading execution.
23753
23754 @item -moptimize
23755 @opindex moptimize
23756 Apply partitioned execution optimizations. This is the default when any
23757 level of optimization is selected.
23758
23759 @item -msoft-stack
23760 @opindex msoft-stack
23761 Generate code that does not use @code{.local} memory
23762 directly for stack storage. Instead, a per-warp stack pointer is
23763 maintained explicitly. This enables variable-length stack allocation (with
23764 variable-length arrays or @code{alloca}), and when global memory is used for
23765 underlying storage, makes it possible to access automatic variables from other
23766 threads, or with atomic instructions. This code generation variant is used
23767 for OpenMP offloading, but the option is exposed on its own for the purpose
23768 of testing the compiler; to generate code suitable for linking into programs
23769 using OpenMP offloading, use option @option{-mgomp}.
23770
23771 @item -muniform-simt
23772 @opindex muniform-simt
23773 Switch to code generation variant that allows to execute all threads in each
23774 warp, while maintaining memory state and side effects as if only one thread
23775 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23776 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23777 current lane index equals the master lane index), and the register being
23778 assigned is copied via a shuffle instruction from the master lane. Outside of
23779 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23780 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23781 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23782 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23783 with current lane index to compute the master lane index.
23784
23785 @item -mgomp
23786 @opindex mgomp
23787 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23788 @option{-muniform-simt} options, and selects corresponding multilib variant.
23789
23790 @end table
23791
23792 @node OpenRISC Options
23793 @subsection OpenRISC Options
23794 @cindex OpenRISC Options
23795
23796 These options are defined for OpenRISC:
23797
23798 @table @gcctabopt
23799
23800 @item -mboard=@var{name}
23801 @opindex mboard
23802 Configure a board specific runtime. This will be passed to the linker for
23803 newlib board library linking. The default is @code{or1ksim}.
23804
23805 @item -mnewlib
23806 @opindex mnewlib
23807 This option is ignored; it is for compatibility purposes only. This used to
23808 select linker and preprocessor options for use with newlib.
23809
23810 @item -msoft-div
23811 @itemx -mhard-div
23812 @opindex msoft-div
23813 @opindex mhard-div
23814 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23815 This default is hardware divide.
23816
23817 @item -msoft-mul
23818 @itemx -mhard-mul
23819 @opindex msoft-mul
23820 @opindex mhard-mul
23821 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23822 This default is hardware multiply.
23823
23824 @item -msoft-float
23825 @itemx -mhard-float
23826 @opindex msoft-float
23827 @opindex mhard-float
23828 Select software or hardware for floating point operations.
23829 The default is software.
23830
23831 @item -mdouble-float
23832 @opindex mdouble-float
23833 When @option{-mhard-float} is selected, enables generation of double-precision
23834 floating point instructions. By default functions from @file{libgcc} are used
23835 to perform double-precision floating point operations.
23836
23837 @item -munordered-float
23838 @opindex munordered-float
23839 When @option{-mhard-float} is selected, enables generation of unordered
23840 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23841 functions from @file{libgcc} are used to perform unordered floating point
23842 compare and set flag operations.
23843
23844 @item -mcmov
23845 @opindex mcmov
23846 Enable generation of conditional move (@code{l.cmov}) instructions. By
23847 default the equivalent will be generated using using set and branch.
23848
23849 @item -mror
23850 @opindex mror
23851 Enable generation of rotate right (@code{l.ror}) instructions. By default
23852 functions from @file{libgcc} are used to perform rotate right operations.
23853
23854 @item -mrori
23855 @opindex mrori
23856 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23857 By default functions from @file{libgcc} are used to perform rotate right with
23858 immediate operations.
23859
23860 @item -msext
23861 @opindex msext
23862 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23863 memory loads are used to perform sign extension.
23864
23865 @item -msfimm
23866 @opindex msfimm
23867 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23868 instructions. By default extra instructions will be generated to store the
23869 immediate to a register first.
23870
23871 @item -mshftimm
23872 @opindex mshftimm
23873 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23874 @code{l.slli}) instructions. By default extra instructions will be generated
23875 to store the immediate to a register first.
23876
23877
23878 @end table
23879
23880 @node PDP-11 Options
23881 @subsection PDP-11 Options
23882 @cindex PDP-11 Options
23883
23884 These options are defined for the PDP-11:
23885
23886 @table @gcctabopt
23887 @item -mfpu
23888 @opindex mfpu
23889 Use hardware FPP floating point. This is the default. (FIS floating
23890 point on the PDP-11/40 is not supported.) Implies -m45.
23891
23892 @item -msoft-float
23893 @opindex msoft-float
23894 Do not use hardware floating point.
23895
23896 @item -mac0
23897 @opindex mac0
23898 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23899
23900 @item -mno-ac0
23901 @opindex mno-ac0
23902 Return floating-point results in memory. This is the default.
23903
23904 @item -m40
23905 @opindex m40
23906 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23907
23908 @item -m45
23909 @opindex m45
23910 Generate code for a PDP-11/45. This is the default.
23911
23912 @item -m10
23913 @opindex m10
23914 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23915
23916 @item -mint16
23917 @itemx -mno-int32
23918 @opindex mint16
23919 @opindex mno-int32
23920 Use 16-bit @code{int}. This is the default.
23921
23922 @item -mint32
23923 @itemx -mno-int16
23924 @opindex mint32
23925 @opindex mno-int16
23926 Use 32-bit @code{int}.
23927
23928 @item -msplit
23929 @opindex msplit
23930 Target has split instruction and data space. Implies -m45.
23931
23932 @item -munix-asm
23933 @opindex munix-asm
23934 Use Unix assembler syntax.
23935
23936 @item -mdec-asm
23937 @opindex mdec-asm
23938 Use DEC assembler syntax.
23939
23940 @item -mgnu-asm
23941 @opindex mgnu-asm
23942 Use GNU assembler syntax. This is the default.
23943
23944 @item -mlra
23945 @opindex mlra
23946 Use the new LRA register allocator. By default, the old ``reload''
23947 allocator is used.
23948 @end table
23949
23950 @node picoChip Options
23951 @subsection picoChip Options
23952 @cindex picoChip options
23953
23954 These @samp{-m} options are defined for picoChip implementations:
23955
23956 @table @gcctabopt
23957
23958 @item -mae=@var{ae_type}
23959 @opindex mcpu
23960 Set the instruction set, register set, and instruction scheduling
23961 parameters for array element type @var{ae_type}. Supported values
23962 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23963
23964 @option{-mae=ANY} selects a completely generic AE type. Code
23965 generated with this option runs on any of the other AE types. The
23966 code is not as efficient as it would be if compiled for a specific
23967 AE type, and some types of operation (e.g., multiplication) do not
23968 work properly on all types of AE.
23969
23970 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23971 for compiled code, and is the default.
23972
23973 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23974 option may suffer from poor performance of byte (char) manipulation,
23975 since the DSP AE does not provide hardware support for byte load/stores.
23976
23977 @item -msymbol-as-address
23978 Enable the compiler to directly use a symbol name as an address in a
23979 load/store instruction, without first loading it into a
23980 register. Typically, the use of this option generates larger
23981 programs, which run faster than when the option isn't used. However, the
23982 results vary from program to program, so it is left as a user option,
23983 rather than being permanently enabled.
23984
23985 @item -mno-inefficient-warnings
23986 Disables warnings about the generation of inefficient code. These
23987 warnings can be generated, for example, when compiling code that
23988 performs byte-level memory operations on the MAC AE type. The MAC AE has
23989 no hardware support for byte-level memory operations, so all byte
23990 load/stores must be synthesized from word load/store operations. This is
23991 inefficient and a warning is generated to indicate
23992 that you should rewrite the code to avoid byte operations, or to target
23993 an AE type that has the necessary hardware support. This option disables
23994 these warnings.
23995
23996 @end table
23997
23998 @node PowerPC Options
23999 @subsection PowerPC Options
24000 @cindex PowerPC options
24001
24002 These are listed under @xref{RS/6000 and PowerPC Options}.
24003
24004 @node PRU Options
24005 @subsection PRU Options
24006 @cindex PRU Options
24007
24008 These command-line options are defined for PRU target:
24009
24010 @table @gcctabopt
24011 @item -minrt
24012 @opindex minrt
24013 Link with a minimum runtime environment, with no support for static
24014 initializers and constructors. Using this option can significantly reduce
24015 the size of the final ELF binary. Beware that the compiler could still
24016 generate code with static initializers and constructors. It is up to the
24017 programmer to ensure that the source program will not use those features.
24018
24019 @item -mmcu=@var{mcu}
24020 @opindex mmcu
24021 Specify the PRU MCU variant to use. Check Newlib for the exact list of
24022 supported MCUs.
24023
24024 @item -mno-relax
24025 @opindex mno-relax
24026 Make GCC pass the @option{--no-relax} command-line option to the linker
24027 instead of the @option{--relax} option.
24028
24029 @item -mloop
24030 @opindex mloop
24031 Allow (or do not allow) GCC to use the LOOP instruction.
24032
24033 @item -mabi=@var{variant}
24034 @opindex mabi
24035 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
24036 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
24037 more naturally with certain GCC assumptions. These are the differences:
24038
24039 @table @samp
24040 @item Function Pointer Size
24041 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
24042 supports only 32-bit data and code pointers.
24043
24044 @item Optional Return Value Pointer
24045 Function return values larger than 64 bits are passed by using a hidden
24046 pointer as the first argument of the function. TI ABI, though, mandates that
24047 the pointer can be NULL in case the caller is not using the returned value.
24048 GNU always passes and expects a valid return value pointer.
24049
24050 @end table
24051
24052 The current @option{-mabi=ti} implementation simply raises a compile error
24053 when any of the above code constructs is detected. As a consequence
24054 the standard C library cannot be built and it is omitted when linking with
24055 @option{-mabi=ti}.
24056
24057 Relaxation is a GNU feature and for safety reasons is disabled when using
24058 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
24059 instructions, so the GNU linker cannot adjust them when shortening adjacent
24060 LDI32 pseudo instructions.
24061
24062 @end table
24063
24064 @node RISC-V Options
24065 @subsection RISC-V Options
24066 @cindex RISC-V Options
24067
24068 These command-line options are defined for RISC-V targets:
24069
24070 @table @gcctabopt
24071 @item -mbranch-cost=@var{n}
24072 @opindex mbranch-cost
24073 Set the cost of branches to roughly @var{n} instructions.
24074
24075 @item -mplt
24076 @itemx -mno-plt
24077 @opindex plt
24078 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24079 non-PIC. The default is @option{-mplt}.
24080
24081 @item -mabi=@var{ABI-string}
24082 @opindex mabi
24083 Specify integer and floating-point calling convention. @var{ABI-string}
24084 contains two parts: the size of integer types and the registers used for
24085 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24086 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24087 32-bit), and that floating-point values up to 64 bits wide are passed in F
24088 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24089 allows the compiler to generate code that uses the F and D extensions but only
24090 allows floating-point values up to 32 bits long to be passed in registers; or
24091 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24092 passed in registers.
24093
24094 The default for this argument is system dependent, users who want a specific
24095 calling convention should specify one explicitly. The valid calling
24096 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24097 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24098 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24099 invalid because the ABI requires 64-bit values be passed in F registers, but F
24100 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24101 only be used with the @samp{rv32e} architecture. This ABI is not well
24102 specified at present, and is subject to change.
24103
24104 @item -mfdiv
24105 @itemx -mno-fdiv
24106 @opindex mfdiv
24107 Do or don't use hardware floating-point divide and square root instructions.
24108 This requires the F or D extensions for floating-point registers. The default
24109 is to use them if the specified architecture has these instructions.
24110
24111 @item -mdiv
24112 @itemx -mno-div
24113 @opindex mdiv
24114 Do or don't use hardware instructions for integer division. This requires the
24115 M extension. The default is to use them if the specified architecture has
24116 these instructions.
24117
24118 @item -march=@var{ISA-string}
24119 @opindex march
24120 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24121 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24122 @samp{rv32imaf}.
24123
24124 @item -mtune=@var{processor-string}
24125 @opindex mtune
24126 Optimize the output for the given processor, specified by microarchitecture
24127 name. Permissible values for this option are: @samp{rocket},
24128 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24129 and @samp{size}.
24130
24131 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24132
24133 The @samp{size} choice is not intended for use by end-users. This is used
24134 when @option{-Os} is specified. It overrides the instruction cost info
24135 provided by @option{-mtune=}, but does not override the pipeline info. This
24136 helps reduce code size while still giving good performance.
24137
24138 @item -mpreferred-stack-boundary=@var{num}
24139 @opindex mpreferred-stack-boundary
24140 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24141 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24142 the default is 4 (16 bytes or 128-bits).
24143
24144 @strong{Warning:} If you use this switch, then you must build all modules with
24145 the same value, including any libraries. This includes the system libraries
24146 and startup modules.
24147
24148 @item -msmall-data-limit=@var{n}
24149 @opindex msmall-data-limit
24150 Put global and static data smaller than @var{n} bytes into a special section
24151 (on some targets).
24152
24153 @item -msave-restore
24154 @itemx -mno-save-restore
24155 @opindex msave-restore
24156 Do or don't use smaller but slower prologue and epilogue code that uses
24157 library function calls. The default is to use fast inline prologues and
24158 epilogues.
24159
24160 @item -mstrict-align
24161 @itemx -mno-strict-align
24162 @opindex mstrict-align
24163 Do not or do generate unaligned memory accesses. The default is set depending
24164 on whether the processor we are optimizing for supports fast unaligned access
24165 or not.
24166
24167 @item -mcmodel=medlow
24168 @opindex mcmodel=medlow
24169 Generate code for the medium-low code model. The program and its statically
24170 defined symbols must lie within a single 2 GiB address range and must lie
24171 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24172 statically or dynamically linked. This is the default code model.
24173
24174 @item -mcmodel=medany
24175 @opindex mcmodel=medany
24176 Generate code for the medium-any code model. The program and its statically
24177 defined symbols must be within any single 2 GiB address range. Programs can be
24178 statically or dynamically linked.
24179
24180 @item -mexplicit-relocs
24181 @itemx -mno-exlicit-relocs
24182 Use or do not use assembler relocation operators when dealing with symbolic
24183 addresses. The alternative is to use assembler macros instead, which may
24184 limit optimization.
24185
24186 @item -mrelax
24187 @itemx -mno-relax
24188 Take advantage of linker relaxations to reduce the number of instructions
24189 required to materialize symbol addresses. The default is to take advantage of
24190 linker relaxations.
24191
24192 @item -memit-attribute
24193 @itemx -mno-emit-attribute
24194 Emit (do not emit) RISC-V attribute to record extra information into ELF
24195 objects. This feature requires at least binutils 2.32.
24196
24197 @item -malign-data=@var{type}
24198 @opindex malign-data
24199 Control how GCC aligns variables and constants of array, structure, or union
24200 types. Supported values for @var{type} are @samp{xlen} which uses x register
24201 width as the alignment value, and @samp{natural} which uses natural alignment.
24202 @samp{xlen} is the default.
24203 @end table
24204
24205 @node RL78 Options
24206 @subsection RL78 Options
24207 @cindex RL78 Options
24208
24209 @table @gcctabopt
24210
24211 @item -msim
24212 @opindex msim
24213 Links in additional target libraries to support operation within a
24214 simulator.
24215
24216 @item -mmul=none
24217 @itemx -mmul=g10
24218 @itemx -mmul=g13
24219 @itemx -mmul=g14
24220 @itemx -mmul=rl78
24221 @opindex mmul
24222 Specifies the type of hardware multiplication and division support to
24223 be used. The simplest is @code{none}, which uses software for both
24224 multiplication and division. This is the default. The @code{g13}
24225 value is for the hardware multiply/divide peripheral found on the
24226 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24227 the multiplication and division instructions supported by the RL78/G14
24228 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24229 the value @code{mg10} is an alias for @code{none}.
24230
24231 In addition a C preprocessor macro is defined, based upon the setting
24232 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24233 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24234
24235 @item -mcpu=g10
24236 @itemx -mcpu=g13
24237 @itemx -mcpu=g14
24238 @itemx -mcpu=rl78
24239 @opindex mcpu
24240 Specifies the RL78 core to target. The default is the G14 core, also
24241 known as an S3 core or just RL78. The G13 or S2 core does not have
24242 multiply or divide instructions, instead it uses a hardware peripheral
24243 for these operations. The G10 or S1 core does not have register
24244 banks, so it uses a different calling convention.
24245
24246 If this option is set it also selects the type of hardware multiply
24247 support to use, unless this is overridden by an explicit
24248 @option{-mmul=none} option on the command line. Thus specifying
24249 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24250 peripheral and specifying @option{-mcpu=g10} disables the use of
24251 hardware multiplications altogether.
24252
24253 Note, although the RL78/G14 core is the default target, specifying
24254 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24255 change the behavior of the toolchain since it also enables G14
24256 hardware multiply support. If these options are not specified on the
24257 command line then software multiplication routines will be used even
24258 though the code targets the RL78 core. This is for backwards
24259 compatibility with older toolchains which did not have hardware
24260 multiply and divide support.
24261
24262 In addition a C preprocessor macro is defined, based upon the setting
24263 of this option. Possible values are: @code{__RL78_G10__},
24264 @code{__RL78_G13__} or @code{__RL78_G14__}.
24265
24266 @item -mg10
24267 @itemx -mg13
24268 @itemx -mg14
24269 @itemx -mrl78
24270 @opindex mg10
24271 @opindex mg13
24272 @opindex mg14
24273 @opindex mrl78
24274 These are aliases for the corresponding @option{-mcpu=} option. They
24275 are provided for backwards compatibility.
24276
24277 @item -mallregs
24278 @opindex mallregs
24279 Allow the compiler to use all of the available registers. By default
24280 registers @code{r24..r31} are reserved for use in interrupt handlers.
24281 With this option enabled these registers can be used in ordinary
24282 functions as well.
24283
24284 @item -m64bit-doubles
24285 @itemx -m32bit-doubles
24286 @opindex m64bit-doubles
24287 @opindex m32bit-doubles
24288 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24289 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24290 @option{-m32bit-doubles}.
24291
24292 @item -msave-mduc-in-interrupts
24293 @itemx -mno-save-mduc-in-interrupts
24294 @opindex msave-mduc-in-interrupts
24295 @opindex mno-save-mduc-in-interrupts
24296 Specifies that interrupt handler functions should preserve the
24297 MDUC registers. This is only necessary if normal code might use
24298 the MDUC registers, for example because it performs multiplication
24299 and division operations. The default is to ignore the MDUC registers
24300 as this makes the interrupt handlers faster. The target option -mg13
24301 needs to be passed for this to work as this feature is only available
24302 on the G13 target (S2 core). The MDUC registers will only be saved
24303 if the interrupt handler performs a multiplication or division
24304 operation or it calls another function.
24305
24306 @end table
24307
24308 @node RS/6000 and PowerPC Options
24309 @subsection IBM RS/6000 and PowerPC Options
24310 @cindex RS/6000 and PowerPC Options
24311 @cindex IBM RS/6000 and PowerPC Options
24312
24313 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24314 @table @gcctabopt
24315 @item -mpowerpc-gpopt
24316 @itemx -mno-powerpc-gpopt
24317 @itemx -mpowerpc-gfxopt
24318 @itemx -mno-powerpc-gfxopt
24319 @need 800
24320 @itemx -mpowerpc64
24321 @itemx -mno-powerpc64
24322 @itemx -mmfcrf
24323 @itemx -mno-mfcrf
24324 @itemx -mpopcntb
24325 @itemx -mno-popcntb
24326 @itemx -mpopcntd
24327 @itemx -mno-popcntd
24328 @itemx -mfprnd
24329 @itemx -mno-fprnd
24330 @need 800
24331 @itemx -mcmpb
24332 @itemx -mno-cmpb
24333 @itemx -mhard-dfp
24334 @itemx -mno-hard-dfp
24335 @opindex mpowerpc-gpopt
24336 @opindex mno-powerpc-gpopt
24337 @opindex mpowerpc-gfxopt
24338 @opindex mno-powerpc-gfxopt
24339 @opindex mpowerpc64
24340 @opindex mno-powerpc64
24341 @opindex mmfcrf
24342 @opindex mno-mfcrf
24343 @opindex mpopcntb
24344 @opindex mno-popcntb
24345 @opindex mpopcntd
24346 @opindex mno-popcntd
24347 @opindex mfprnd
24348 @opindex mno-fprnd
24349 @opindex mcmpb
24350 @opindex mno-cmpb
24351 @opindex mhard-dfp
24352 @opindex mno-hard-dfp
24353 You use these options to specify which instructions are available on the
24354 processor you are using. The default value of these options is
24355 determined when configuring GCC@. Specifying the
24356 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24357 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24358 rather than the options listed above.
24359
24360 Specifying @option{-mpowerpc-gpopt} allows
24361 GCC to use the optional PowerPC architecture instructions in the
24362 General Purpose group, including floating-point square root. Specifying
24363 @option{-mpowerpc-gfxopt} allows GCC to
24364 use the optional PowerPC architecture instructions in the Graphics
24365 group, including floating-point select.
24366
24367 The @option{-mmfcrf} option allows GCC to generate the move from
24368 condition register field instruction implemented on the POWER4
24369 processor and other processors that support the PowerPC V2.01
24370 architecture.
24371 The @option{-mpopcntb} option allows GCC to generate the popcount and
24372 double-precision FP reciprocal estimate instruction implemented on the
24373 POWER5 processor and other processors that support the PowerPC V2.02
24374 architecture.
24375 The @option{-mpopcntd} option allows GCC to generate the popcount
24376 instruction implemented on the POWER7 processor and other processors
24377 that support the PowerPC V2.06 architecture.
24378 The @option{-mfprnd} option allows GCC to generate the FP round to
24379 integer instructions implemented on the POWER5+ processor and other
24380 processors that support the PowerPC V2.03 architecture.
24381 The @option{-mcmpb} option allows GCC to generate the compare bytes
24382 instruction implemented on the POWER6 processor and other processors
24383 that support the PowerPC V2.05 architecture.
24384 The @option{-mhard-dfp} option allows GCC to generate the decimal
24385 floating-point instructions implemented on some POWER processors.
24386
24387 The @option{-mpowerpc64} option allows GCC to generate the additional
24388 64-bit instructions that are found in the full PowerPC64 architecture
24389 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24390 @option{-mno-powerpc64}.
24391
24392 @item -mcpu=@var{cpu_type}
24393 @opindex mcpu
24394 Set architecture type, register usage, and
24395 instruction scheduling parameters for machine type @var{cpu_type}.
24396 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24397 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24398 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24399 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24400 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24401 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24402 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24403 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24404 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24405 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24406 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24407 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24408
24409 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24410 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24411 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24412 architecture machine types, with an appropriate, generic processor
24413 model assumed for scheduling purposes.
24414
24415 Specifying @samp{native} as cpu type detects and selects the
24416 architecture option that corresponds to the host processor of the
24417 system performing the compilation.
24418 @option{-mcpu=native} has no effect if GCC does not recognize the
24419 processor.
24420
24421 The other options specify a specific processor. Code generated under
24422 those options runs best on that processor, and may not run at all on
24423 others.
24424
24425 The @option{-mcpu} options automatically enable or disable the
24426 following options:
24427
24428 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24429 -mpopcntb -mpopcntd -mpowerpc64 @gol
24430 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24431 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24432 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24433 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24434
24435 The particular options set for any particular CPU varies between
24436 compiler versions, depending on what setting seems to produce optimal
24437 code for that CPU; it doesn't necessarily reflect the actual hardware's
24438 capabilities. If you wish to set an individual option to a particular
24439 value, you may specify it after the @option{-mcpu} option, like
24440 @option{-mcpu=970 -mno-altivec}.
24441
24442 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24443 not enabled or disabled by the @option{-mcpu} option at present because
24444 AIX does not have full support for these options. You may still
24445 enable or disable them individually if you're sure it'll work in your
24446 environment.
24447
24448 @item -mtune=@var{cpu_type}
24449 @opindex mtune
24450 Set the instruction scheduling parameters for machine type
24451 @var{cpu_type}, but do not set the architecture type or register usage,
24452 as @option{-mcpu=@var{cpu_type}} does. The same
24453 values for @var{cpu_type} are used for @option{-mtune} as for
24454 @option{-mcpu}. If both are specified, the code generated uses the
24455 architecture and registers set by @option{-mcpu}, but the
24456 scheduling parameters set by @option{-mtune}.
24457
24458 @item -mcmodel=small
24459 @opindex mcmodel=small
24460 Generate PowerPC64 code for the small model: The TOC is limited to
24461 64k.
24462
24463 @item -mcmodel=medium
24464 @opindex mcmodel=medium
24465 Generate PowerPC64 code for the medium model: The TOC and other static
24466 data may be up to a total of 4G in size. This is the default for 64-bit
24467 Linux.
24468
24469 @item -mcmodel=large
24470 @opindex mcmodel=large
24471 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24472 in size. Other data and code is only limited by the 64-bit address
24473 space.
24474
24475 @item -maltivec
24476 @itemx -mno-altivec
24477 @opindex maltivec
24478 @opindex mno-altivec
24479 Generate code that uses (does not use) AltiVec instructions, and also
24480 enable the use of built-in functions that allow more direct access to
24481 the AltiVec instruction set. You may also need to set
24482 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24483 enhancements.
24484
24485 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24486 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24487 match array element order corresponding to the endianness of the
24488 target. That is, element zero identifies the leftmost element in a
24489 vector register when targeting a big-endian platform, and identifies
24490 the rightmost element in a vector register when targeting a
24491 little-endian platform.
24492
24493 @item -mvrsave
24494 @itemx -mno-vrsave
24495 @opindex mvrsave
24496 @opindex mno-vrsave
24497 Generate VRSAVE instructions when generating AltiVec code.
24498
24499 @item -msecure-plt
24500 @opindex msecure-plt
24501 Generate code that allows @command{ld} and @command{ld.so}
24502 to build executables and shared
24503 libraries with non-executable @code{.plt} and @code{.got} sections.
24504 This is a PowerPC
24505 32-bit SYSV ABI option.
24506
24507 @item -mbss-plt
24508 @opindex mbss-plt
24509 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24510 fills in, and
24511 requires @code{.plt} and @code{.got}
24512 sections that are both writable and executable.
24513 This is a PowerPC 32-bit SYSV ABI option.
24514
24515 @item -misel
24516 @itemx -mno-isel
24517 @opindex misel
24518 @opindex mno-isel
24519 This switch enables or disables the generation of ISEL instructions.
24520
24521 @item -mvsx
24522 @itemx -mno-vsx
24523 @opindex mvsx
24524 @opindex mno-vsx
24525 Generate code that uses (does not use) vector/scalar (VSX)
24526 instructions, and also enable the use of built-in functions that allow
24527 more direct access to the VSX instruction set.
24528
24529 @item -mcrypto
24530 @itemx -mno-crypto
24531 @opindex mcrypto
24532 @opindex mno-crypto
24533 Enable the use (disable) of the built-in functions that allow direct
24534 access to the cryptographic instructions that were added in version
24535 2.07 of the PowerPC ISA.
24536
24537 @item -mhtm
24538 @itemx -mno-htm
24539 @opindex mhtm
24540 @opindex mno-htm
24541 Enable (disable) the use of the built-in functions that allow direct
24542 access to the Hardware Transactional Memory (HTM) instructions that
24543 were added in version 2.07 of the PowerPC ISA.
24544
24545 @item -mpower8-fusion
24546 @itemx -mno-power8-fusion
24547 @opindex mpower8-fusion
24548 @opindex mno-power8-fusion
24549 Generate code that keeps (does not keeps) some integer operations
24550 adjacent so that the instructions can be fused together on power8 and
24551 later processors.
24552
24553 @item -mpower8-vector
24554 @itemx -mno-power8-vector
24555 @opindex mpower8-vector
24556 @opindex mno-power8-vector
24557 Generate code that uses (does not use) the vector and scalar
24558 instructions that were added in version 2.07 of the PowerPC ISA. Also
24559 enable the use of built-in functions that allow more direct access to
24560 the vector instructions.
24561
24562 @item -mquad-memory
24563 @itemx -mno-quad-memory
24564 @opindex mquad-memory
24565 @opindex mno-quad-memory
24566 Generate code that uses (does not use) the non-atomic quad word memory
24567 instructions. The @option{-mquad-memory} option requires use of
24568 64-bit mode.
24569
24570 @item -mquad-memory-atomic
24571 @itemx -mno-quad-memory-atomic
24572 @opindex mquad-memory-atomic
24573 @opindex mno-quad-memory-atomic
24574 Generate code that uses (does not use) the atomic quad word memory
24575 instructions. The @option{-mquad-memory-atomic} option requires use of
24576 64-bit mode.
24577
24578 @item -mfloat128
24579 @itemx -mno-float128
24580 @opindex mfloat128
24581 @opindex mno-float128
24582 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24583 and use either software emulation for IEEE 128-bit floating point or
24584 hardware instructions.
24585
24586 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24587 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24588 use the IEEE 128-bit floating point support. The IEEE 128-bit
24589 floating point support only works on PowerPC Linux systems.
24590
24591 The default for @option{-mfloat128} is enabled on PowerPC Linux
24592 systems using the VSX instruction set, and disabled on other systems.
24593
24594 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24595 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24596 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24597 floating point instructions. Otherwise, if you do not specify to
24598 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24599 system, IEEE 128-bit floating point will be done with software
24600 emulation.
24601
24602 @item -mfloat128-hardware
24603 @itemx -mno-float128-hardware
24604 @opindex mfloat128-hardware
24605 @opindex mno-float128-hardware
24606 Enable/disable using ISA 3.0 hardware instructions to support the
24607 @var{__float128} data type.
24608
24609 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24610 Linux systems using the ISA 3.0 instruction set, and disabled on other
24611 systems.
24612
24613 @item -m32
24614 @itemx -m64
24615 @opindex m32
24616 @opindex m64
24617 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24618 targets (including GNU/Linux). The 32-bit environment sets int, long
24619 and pointer to 32 bits and generates code that runs on any PowerPC
24620 variant. The 64-bit environment sets int to 32 bits and long and
24621 pointer to 64 bits, and generates code for PowerPC64, as for
24622 @option{-mpowerpc64}.
24623
24624 @item -mfull-toc
24625 @itemx -mno-fp-in-toc
24626 @itemx -mno-sum-in-toc
24627 @itemx -mminimal-toc
24628 @opindex mfull-toc
24629 @opindex mno-fp-in-toc
24630 @opindex mno-sum-in-toc
24631 @opindex mminimal-toc
24632 Modify generation of the TOC (Table Of Contents), which is created for
24633 every executable file. The @option{-mfull-toc} option is selected by
24634 default. In that case, GCC allocates at least one TOC entry for
24635 each unique non-automatic variable reference in your program. GCC
24636 also places floating-point constants in the TOC@. However, only
24637 16,384 entries are available in the TOC@.
24638
24639 If you receive a linker error message that saying you have overflowed
24640 the available TOC space, you can reduce the amount of TOC space used
24641 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24642 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24643 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24644 generate code to calculate the sum of an address and a constant at
24645 run time instead of putting that sum into the TOC@. You may specify one
24646 or both of these options. Each causes GCC to produce very slightly
24647 slower and larger code at the expense of conserving TOC space.
24648
24649 If you still run out of space in the TOC even when you specify both of
24650 these options, specify @option{-mminimal-toc} instead. This option causes
24651 GCC to make only one TOC entry for every file. When you specify this
24652 option, GCC produces code that is slower and larger but which
24653 uses extremely little TOC space. You may wish to use this option
24654 only on files that contain less frequently-executed code.
24655
24656 @item -maix64
24657 @itemx -maix32
24658 @opindex maix64
24659 @opindex maix32
24660 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24661 @code{long} type, and the infrastructure needed to support them.
24662 Specifying @option{-maix64} implies @option{-mpowerpc64},
24663 while @option{-maix32} disables the 64-bit ABI and
24664 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24665
24666 @item -mxl-compat
24667 @itemx -mno-xl-compat
24668 @opindex mxl-compat
24669 @opindex mno-xl-compat
24670 Produce code that conforms more closely to IBM XL compiler semantics
24671 when using AIX-compatible ABI@. Pass floating-point arguments to
24672 prototyped functions beyond the register save area (RSA) on the stack
24673 in addition to argument FPRs. Do not assume that most significant
24674 double in 128-bit long double value is properly rounded when comparing
24675 values and converting to double. Use XL symbol names for long double
24676 support routines.
24677
24678 The AIX calling convention was extended but not initially documented to
24679 handle an obscure K&R C case of calling a function that takes the
24680 address of its arguments with fewer arguments than declared. IBM XL
24681 compilers access floating-point arguments that do not fit in the
24682 RSA from the stack when a subroutine is compiled without
24683 optimization. Because always storing floating-point arguments on the
24684 stack is inefficient and rarely needed, this option is not enabled by
24685 default and only is necessary when calling subroutines compiled by IBM
24686 XL compilers without optimization.
24687
24688 @item -mpe
24689 @opindex mpe
24690 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24691 application written to use message passing with special startup code to
24692 enable the application to run. The system must have PE installed in the
24693 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24694 must be overridden with the @option{-specs=} option to specify the
24695 appropriate directory location. The Parallel Environment does not
24696 support threads, so the @option{-mpe} option and the @option{-pthread}
24697 option are incompatible.
24698
24699 @item -malign-natural
24700 @itemx -malign-power
24701 @opindex malign-natural
24702 @opindex malign-power
24703 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24704 @option{-malign-natural} overrides the ABI-defined alignment of larger
24705 types, such as floating-point doubles, on their natural size-based boundary.
24706 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24707 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24708
24709 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24710 is not supported.
24711
24712 @item -msoft-float
24713 @itemx -mhard-float
24714 @opindex msoft-float
24715 @opindex mhard-float
24716 Generate code that does not use (uses) the floating-point register set.
24717 Software floating-point emulation is provided if you use the
24718 @option{-msoft-float} option, and pass the option to GCC when linking.
24719
24720 @item -mmultiple
24721 @itemx -mno-multiple
24722 @opindex mmultiple
24723 @opindex mno-multiple
24724 Generate code that uses (does not use) the load multiple word
24725 instructions and the store multiple word instructions. These
24726 instructions are generated by default on POWER systems, and not
24727 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24728 PowerPC systems, since those instructions do not work when the
24729 processor is in little-endian mode. The exceptions are PPC740 and
24730 PPC750 which permit these instructions in little-endian mode.
24731
24732 @item -mupdate
24733 @itemx -mno-update
24734 @opindex mupdate
24735 @opindex mno-update
24736 Generate code that uses (does not use) the load or store instructions
24737 that update the base register to the address of the calculated memory
24738 location. These instructions are generated by default. If you use
24739 @option{-mno-update}, there is a small window between the time that the
24740 stack pointer is updated and the address of the previous frame is
24741 stored, which means code that walks the stack frame across interrupts or
24742 signals may get corrupted data.
24743
24744 @item -mavoid-indexed-addresses
24745 @itemx -mno-avoid-indexed-addresses
24746 @opindex mavoid-indexed-addresses
24747 @opindex mno-avoid-indexed-addresses
24748 Generate code that tries to avoid (not avoid) the use of indexed load
24749 or store instructions. These instructions can incur a performance
24750 penalty on Power6 processors in certain situations, such as when
24751 stepping through large arrays that cross a 16M boundary. This option
24752 is enabled by default when targeting Power6 and disabled otherwise.
24753
24754 @item -mfused-madd
24755 @itemx -mno-fused-madd
24756 @opindex mfused-madd
24757 @opindex mno-fused-madd
24758 Generate code that uses (does not use) the floating-point multiply and
24759 accumulate instructions. These instructions are generated by default
24760 if hardware floating point is used. The machine-dependent
24761 @option{-mfused-madd} option is now mapped to the machine-independent
24762 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24763 mapped to @option{-ffp-contract=off}.
24764
24765 @item -mmulhw
24766 @itemx -mno-mulhw
24767 @opindex mmulhw
24768 @opindex mno-mulhw
24769 Generate code that uses (does not use) the half-word multiply and
24770 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24771 These instructions are generated by default when targeting those
24772 processors.
24773
24774 @item -mdlmzb
24775 @itemx -mno-dlmzb
24776 @opindex mdlmzb
24777 @opindex mno-dlmzb
24778 Generate code that uses (does not use) the string-search @samp{dlmzb}
24779 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24780 generated by default when targeting those processors.
24781
24782 @item -mno-bit-align
24783 @itemx -mbit-align
24784 @opindex mno-bit-align
24785 @opindex mbit-align
24786 On System V.4 and embedded PowerPC systems do not (do) force structures
24787 and unions that contain bit-fields to be aligned to the base type of the
24788 bit-field.
24789
24790 For example, by default a structure containing nothing but 8
24791 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24792 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24793 the structure is aligned to a 1-byte boundary and is 1 byte in
24794 size.
24795
24796 @item -mno-strict-align
24797 @itemx -mstrict-align
24798 @opindex mno-strict-align
24799 @opindex mstrict-align
24800 On System V.4 and embedded PowerPC systems do not (do) assume that
24801 unaligned memory references are handled by the system.
24802
24803 @item -mrelocatable
24804 @itemx -mno-relocatable
24805 @opindex mrelocatable
24806 @opindex mno-relocatable
24807 Generate code that allows (does not allow) a static executable to be
24808 relocated to a different address at run time. A simple embedded
24809 PowerPC system loader should relocate the entire contents of
24810 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24811 a table of 32-bit addresses generated by this option. For this to
24812 work, all objects linked together must be compiled with
24813 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24814 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24815
24816 @item -mrelocatable-lib
24817 @itemx -mno-relocatable-lib
24818 @opindex mrelocatable-lib
24819 @opindex mno-relocatable-lib
24820 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24821 @code{.fixup} section to allow static executables to be relocated at
24822 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24823 alignment of @option{-mrelocatable}. Objects compiled with
24824 @option{-mrelocatable-lib} may be linked with objects compiled with
24825 any combination of the @option{-mrelocatable} options.
24826
24827 @item -mno-toc
24828 @itemx -mtoc
24829 @opindex mno-toc
24830 @opindex mtoc
24831 On System V.4 and embedded PowerPC systems do not (do) assume that
24832 register 2 contains a pointer to a global area pointing to the addresses
24833 used in the program.
24834
24835 @item -mlittle
24836 @itemx -mlittle-endian
24837 @opindex mlittle
24838 @opindex mlittle-endian
24839 On System V.4 and embedded PowerPC systems compile code for the
24840 processor in little-endian mode. The @option{-mlittle-endian} option is
24841 the same as @option{-mlittle}.
24842
24843 @item -mbig
24844 @itemx -mbig-endian
24845 @opindex mbig
24846 @opindex mbig-endian
24847 On System V.4 and embedded PowerPC systems compile code for the
24848 processor in big-endian mode. The @option{-mbig-endian} option is
24849 the same as @option{-mbig}.
24850
24851 @item -mdynamic-no-pic
24852 @opindex mdynamic-no-pic
24853 On Darwin and Mac OS X systems, compile code so that it is not
24854 relocatable, but that its external references are relocatable. The
24855 resulting code is suitable for applications, but not shared
24856 libraries.
24857
24858 @item -msingle-pic-base
24859 @opindex msingle-pic-base
24860 Treat the register used for PIC addressing as read-only, rather than
24861 loading it in the prologue for each function. The runtime system is
24862 responsible for initializing this register with an appropriate value
24863 before execution begins.
24864
24865 @item -mprioritize-restricted-insns=@var{priority}
24866 @opindex mprioritize-restricted-insns
24867 This option controls the priority that is assigned to
24868 dispatch-slot restricted instructions during the second scheduling
24869 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24870 or @samp{2} to assign no, highest, or second-highest (respectively)
24871 priority to dispatch-slot restricted
24872 instructions.
24873
24874 @item -msched-costly-dep=@var{dependence_type}
24875 @opindex msched-costly-dep
24876 This option controls which dependences are considered costly
24877 by the target during instruction scheduling. The argument
24878 @var{dependence_type} takes one of the following values:
24879
24880 @table @asis
24881 @item @samp{no}
24882 No dependence is costly.
24883
24884 @item @samp{all}
24885 All dependences are costly.
24886
24887 @item @samp{true_store_to_load}
24888 A true dependence from store to load is costly.
24889
24890 @item @samp{store_to_load}
24891 Any dependence from store to load is costly.
24892
24893 @item @var{number}
24894 Any dependence for which the latency is greater than or equal to
24895 @var{number} is costly.
24896 @end table
24897
24898 @item -minsert-sched-nops=@var{scheme}
24899 @opindex minsert-sched-nops
24900 This option controls which NOP insertion scheme is used during
24901 the second scheduling pass. The argument @var{scheme} takes one of the
24902 following values:
24903
24904 @table @asis
24905 @item @samp{no}
24906 Don't insert NOPs.
24907
24908 @item @samp{pad}
24909 Pad with NOPs any dispatch group that has vacant issue slots,
24910 according to the scheduler's grouping.
24911
24912 @item @samp{regroup_exact}
24913 Insert NOPs to force costly dependent insns into
24914 separate groups. Insert exactly as many NOPs as needed to force an insn
24915 to a new group, according to the estimated processor grouping.
24916
24917 @item @var{number}
24918 Insert NOPs to force costly dependent insns into
24919 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24920 @end table
24921
24922 @item -mcall-sysv
24923 @opindex mcall-sysv
24924 On System V.4 and embedded PowerPC systems compile code using calling
24925 conventions that adhere to the March 1995 draft of the System V
24926 Application Binary Interface, PowerPC processor supplement. This is the
24927 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24928
24929 @item -mcall-sysv-eabi
24930 @itemx -mcall-eabi
24931 @opindex mcall-sysv-eabi
24932 @opindex mcall-eabi
24933 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24934
24935 @item -mcall-sysv-noeabi
24936 @opindex mcall-sysv-noeabi
24937 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24938
24939 @item -mcall-aixdesc
24940 @opindex m
24941 On System V.4 and embedded PowerPC systems compile code for the AIX
24942 operating system.
24943
24944 @item -mcall-linux
24945 @opindex mcall-linux
24946 On System V.4 and embedded PowerPC systems compile code for the
24947 Linux-based GNU system.
24948
24949 @item -mcall-freebsd
24950 @opindex mcall-freebsd
24951 On System V.4 and embedded PowerPC systems compile code for the
24952 FreeBSD operating system.
24953
24954 @item -mcall-netbsd
24955 @opindex mcall-netbsd
24956 On System V.4 and embedded PowerPC systems compile code for the
24957 NetBSD operating system.
24958
24959 @item -mcall-openbsd
24960 @opindex mcall-netbsd
24961 On System V.4 and embedded PowerPC systems compile code for the
24962 OpenBSD operating system.
24963
24964 @item -mtraceback=@var{traceback_type}
24965 @opindex mtraceback
24966 Select the type of traceback table. Valid values for @var{traceback_type}
24967 are @samp{full}, @samp{part}, and @samp{no}.
24968
24969 @item -maix-struct-return
24970 @opindex maix-struct-return
24971 Return all structures in memory (as specified by the AIX ABI)@.
24972
24973 @item -msvr4-struct-return
24974 @opindex msvr4-struct-return
24975 Return structures smaller than 8 bytes in registers (as specified by the
24976 SVR4 ABI)@.
24977
24978 @item -mabi=@var{abi-type}
24979 @opindex mabi
24980 Extend the current ABI with a particular extension, or remove such extension.
24981 Valid values are @samp{altivec}, @samp{no-altivec},
24982 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24983 @samp{elfv1}, @samp{elfv2}@.
24984
24985 @item -mabi=ibmlongdouble
24986 @opindex mabi=ibmlongdouble
24987 Change the current ABI to use IBM extended-precision long double.
24988 This is not likely to work if your system defaults to using IEEE
24989 extended-precision long double. If you change the long double type
24990 from IEEE extended-precision, the compiler will issue a warning unless
24991 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24992 to be enabled.
24993
24994 @item -mabi=ieeelongdouble
24995 @opindex mabi=ieeelongdouble
24996 Change the current ABI to use IEEE extended-precision long double.
24997 This is not likely to work if your system defaults to using IBM
24998 extended-precision long double. If you change the long double type
24999 from IBM extended-precision, the compiler will issue a warning unless
25000 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
25001 to be enabled.
25002
25003 @item -mabi=elfv1
25004 @opindex mabi=elfv1
25005 Change the current ABI to use the ELFv1 ABI.
25006 This is the default ABI for big-endian PowerPC 64-bit Linux.
25007 Overriding the default ABI requires special system support and is
25008 likely to fail in spectacular ways.
25009
25010 @item -mabi=elfv2
25011 @opindex mabi=elfv2
25012 Change the current ABI to use the ELFv2 ABI.
25013 This is the default ABI for little-endian PowerPC 64-bit Linux.
25014 Overriding the default ABI requires special system support and is
25015 likely to fail in spectacular ways.
25016
25017 @item -mgnu-attribute
25018 @itemx -mno-gnu-attribute
25019 @opindex mgnu-attribute
25020 @opindex mno-gnu-attribute
25021 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25022 .gnu.attributes section that specify ABI variations in function
25023 parameters or return values.
25024
25025 @item -mprototype
25026 @itemx -mno-prototype
25027 @opindex mprototype
25028 @opindex mno-prototype
25029 On System V.4 and embedded PowerPC systems assume that all calls to
25030 variable argument functions are properly prototyped. Otherwise, the
25031 compiler must insert an instruction before every non-prototyped call to
25032 set or clear bit 6 of the condition code register (@code{CR}) to
25033 indicate whether floating-point values are passed in the floating-point
25034 registers in case the function takes variable arguments. With
25035 @option{-mprototype}, only calls to prototyped variable argument functions
25036 set or clear the bit.
25037
25038 @item -msim
25039 @opindex msim
25040 On embedded PowerPC systems, assume that the startup module is called
25041 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25042 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25043 configurations.
25044
25045 @item -mmvme
25046 @opindex mmvme
25047 On embedded PowerPC systems, assume that the startup module is called
25048 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25049 @file{libc.a}.
25050
25051 @item -mads
25052 @opindex mads
25053 On embedded PowerPC systems, assume that the startup module is called
25054 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25055 @file{libc.a}.
25056
25057 @item -myellowknife
25058 @opindex myellowknife
25059 On embedded PowerPC systems, assume that the startup module is called
25060 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25061 @file{libc.a}.
25062
25063 @item -mvxworks
25064 @opindex mvxworks
25065 On System V.4 and embedded PowerPC systems, specify that you are
25066 compiling for a VxWorks system.
25067
25068 @item -memb
25069 @opindex memb
25070 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25071 header to indicate that @samp{eabi} extended relocations are used.
25072
25073 @item -meabi
25074 @itemx -mno-eabi
25075 @opindex meabi
25076 @opindex mno-eabi
25077 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25078 Embedded Applications Binary Interface (EABI), which is a set of
25079 modifications to the System V.4 specifications. Selecting @option{-meabi}
25080 means that the stack is aligned to an 8-byte boundary, a function
25081 @code{__eabi} is called from @code{main} to set up the EABI
25082 environment, and the @option{-msdata} option can use both @code{r2} and
25083 @code{r13} to point to two separate small data areas. Selecting
25084 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25085 no EABI initialization function is called from @code{main}, and the
25086 @option{-msdata} option only uses @code{r13} to point to a single
25087 small data area. The @option{-meabi} option is on by default if you
25088 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25089
25090 @item -msdata=eabi
25091 @opindex msdata=eabi
25092 On System V.4 and embedded PowerPC systems, put small initialized
25093 @code{const} global and static data in the @code{.sdata2} section, which
25094 is pointed to by register @code{r2}. Put small initialized
25095 non-@code{const} global and static data in the @code{.sdata} section,
25096 which is pointed to by register @code{r13}. Put small uninitialized
25097 global and static data in the @code{.sbss} section, which is adjacent to
25098 the @code{.sdata} section. The @option{-msdata=eabi} option is
25099 incompatible with the @option{-mrelocatable} option. The
25100 @option{-msdata=eabi} option also sets the @option{-memb} option.
25101
25102 @item -msdata=sysv
25103 @opindex msdata=sysv
25104 On System V.4 and embedded PowerPC systems, put small global and static
25105 data in the @code{.sdata} section, which is pointed to by register
25106 @code{r13}. Put small uninitialized global and static data in the
25107 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25108 The @option{-msdata=sysv} option is incompatible with the
25109 @option{-mrelocatable} option.
25110
25111 @item -msdata=default
25112 @itemx -msdata
25113 @opindex msdata=default
25114 @opindex msdata
25115 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25116 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25117 same as @option{-msdata=sysv}.
25118
25119 @item -msdata=data
25120 @opindex msdata=data
25121 On System V.4 and embedded PowerPC systems, put small global
25122 data in the @code{.sdata} section. Put small uninitialized global
25123 data in the @code{.sbss} section. Do not use register @code{r13}
25124 to address small data however. This is the default behavior unless
25125 other @option{-msdata} options are used.
25126
25127 @item -msdata=none
25128 @itemx -mno-sdata
25129 @opindex msdata=none
25130 @opindex mno-sdata
25131 On embedded PowerPC systems, put all initialized global and static data
25132 in the @code{.data} section, and all uninitialized data in the
25133 @code{.bss} section.
25134
25135 @item -mreadonly-in-sdata
25136 @opindex mreadonly-in-sdata
25137 @opindex mno-readonly-in-sdata
25138 Put read-only objects in the @code{.sdata} section as well. This is the
25139 default.
25140
25141 @item -mblock-move-inline-limit=@var{num}
25142 @opindex mblock-move-inline-limit
25143 Inline all block moves (such as calls to @code{memcpy} or structure
25144 copies) less than or equal to @var{num} bytes. The minimum value for
25145 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25146 targets. The default value is target-specific.
25147
25148 @item -mblock-compare-inline-limit=@var{num}
25149 @opindex mblock-compare-inline-limit
25150 Generate non-looping inline code for all block compares (such as calls
25151 to @code{memcmp} or structure compares) less than or equal to @var{num}
25152 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25153 block compare is disabled. The default value is target-specific.
25154
25155 @item -mblock-compare-inline-loop-limit=@var{num}
25156 @opindex mblock-compare-inline-loop-limit
25157 Generate an inline expansion using loop code for all block compares that
25158 are less than or equal to @var{num} bytes, but greater than the limit
25159 for non-loop inline block compare expansion. If the block length is not
25160 constant, at most @var{num} bytes will be compared before @code{memcmp}
25161 is called to compare the remainder of the block. The default value is
25162 target-specific.
25163
25164 @item -mstring-compare-inline-limit=@var{num}
25165 @opindex mstring-compare-inline-limit
25166 Compare at most @var{num} string bytes with inline code.
25167 If the difference or end of string is not found at the
25168 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25169 take care of the rest of the comparison. The default is 64 bytes.
25170
25171 @item -G @var{num}
25172 @opindex G
25173 @cindex smaller data references (PowerPC)
25174 @cindex .sdata/.sdata2 references (PowerPC)
25175 On embedded PowerPC systems, put global and static items less than or
25176 equal to @var{num} bytes into the small data or BSS sections instead of
25177 the normal data or BSS section. By default, @var{num} is 8. The
25178 @option{-G @var{num}} switch is also passed to the linker.
25179 All modules should be compiled with the same @option{-G @var{num}} value.
25180
25181 @item -mregnames
25182 @itemx -mno-regnames
25183 @opindex mregnames
25184 @opindex mno-regnames
25185 On System V.4 and embedded PowerPC systems do (do not) emit register
25186 names in the assembly language output using symbolic forms.
25187
25188 @item -mlongcall
25189 @itemx -mno-longcall
25190 @opindex mlongcall
25191 @opindex mno-longcall
25192 By default assume that all calls are far away so that a longer and more
25193 expensive calling sequence is required. This is required for calls
25194 farther than 32 megabytes (33,554,432 bytes) from the current location.
25195 A short call is generated if the compiler knows
25196 the call cannot be that far away. This setting can be overridden by
25197 the @code{shortcall} function attribute, or by @code{#pragma
25198 longcall(0)}.
25199
25200 Some linkers are capable of detecting out-of-range calls and generating
25201 glue code on the fly. On these systems, long calls are unnecessary and
25202 generate slower code. As of this writing, the AIX linker can do this,
25203 as can the GNU linker for PowerPC/64. It is planned to add this feature
25204 to the GNU linker for 32-bit PowerPC systems as well.
25205
25206 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25207 GCC can generate long calls using an inline PLT call sequence (see
25208 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25209 ELFv1 (big-endian) do not support inline PLT calls.
25210
25211 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25212 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25213 addresses represent the callee and the branch island. The
25214 Darwin/PPC linker prefers the first address and generates a @code{bl
25215 callee} if the PPC @code{bl} instruction reaches the callee directly;
25216 otherwise, the linker generates @code{bl L42} to call the branch
25217 island. The branch island is appended to the body of the
25218 calling function; it computes the full 32-bit address of the callee
25219 and jumps to it.
25220
25221 On Mach-O (Darwin) systems, this option directs the compiler emit to
25222 the glue for every direct call, and the Darwin linker decides whether
25223 to use or discard it.
25224
25225 In the future, GCC may ignore all longcall specifications
25226 when the linker is known to generate glue.
25227
25228 @item -mpltseq
25229 @itemx -mno-pltseq
25230 @opindex mpltseq
25231 @opindex mno-pltseq
25232 Implement (do not implement) -fno-plt and long calls using an inline
25233 PLT call sequence that supports lazy linking and long calls to
25234 functions in dlopen'd shared libraries. Inline PLT calls are only
25235 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25236 linkers, and are enabled by default if the support is detected when
25237 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25238 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25239 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25240 linked together.
25241
25242 @item -mtls-markers
25243 @itemx -mno-tls-markers
25244 @opindex mtls-markers
25245 @opindex mno-tls-markers
25246 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25247 specifying the function argument. The relocation allows the linker to
25248 reliably associate function call with argument setup instructions for
25249 TLS optimization, which in turn allows GCC to better schedule the
25250 sequence.
25251
25252 @item -mrecip
25253 @itemx -mno-recip
25254 @opindex mrecip
25255 This option enables use of the reciprocal estimate and
25256 reciprocal square root estimate instructions with additional
25257 Newton-Raphson steps to increase precision instead of doing a divide or
25258 square root and divide for floating-point arguments. You should use
25259 the @option{-ffast-math} option when using @option{-mrecip} (or at
25260 least @option{-funsafe-math-optimizations},
25261 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25262 @option{-fno-trapping-math}). Note that while the throughput of the
25263 sequence is generally higher than the throughput of the non-reciprocal
25264 instruction, the precision of the sequence can be decreased by up to 2
25265 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25266 roots.
25267
25268 @item -mrecip=@var{opt}
25269 @opindex mrecip=opt
25270 This option controls which reciprocal estimate instructions
25271 may be used. @var{opt} is a comma-separated list of options, which may
25272 be preceded by a @code{!} to invert the option:
25273
25274 @table @samp
25275
25276 @item all
25277 Enable all estimate instructions.
25278
25279 @item default
25280 Enable the default instructions, equivalent to @option{-mrecip}.
25281
25282 @item none
25283 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25284
25285 @item div
25286 Enable the reciprocal approximation instructions for both
25287 single and double precision.
25288
25289 @item divf
25290 Enable the single-precision reciprocal approximation instructions.
25291
25292 @item divd
25293 Enable the double-precision reciprocal approximation instructions.
25294
25295 @item rsqrt
25296 Enable the reciprocal square root approximation instructions for both
25297 single and double precision.
25298
25299 @item rsqrtf
25300 Enable the single-precision reciprocal square root approximation instructions.
25301
25302 @item rsqrtd
25303 Enable the double-precision reciprocal square root approximation instructions.
25304
25305 @end table
25306
25307 So, for example, @option{-mrecip=all,!rsqrtd} enables
25308 all of the reciprocal estimate instructions, except for the
25309 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25310 which handle the double-precision reciprocal square root calculations.
25311
25312 @item -mrecip-precision
25313 @itemx -mno-recip-precision
25314 @opindex mrecip-precision
25315 Assume (do not assume) that the reciprocal estimate instructions
25316 provide higher-precision estimates than is mandated by the PowerPC
25317 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25318 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25319 The double-precision square root estimate instructions are not generated by
25320 default on low-precision machines, since they do not provide an
25321 estimate that converges after three steps.
25322
25323 @item -mveclibabi=@var{type}
25324 @opindex mveclibabi
25325 Specifies the ABI type to use for vectorizing intrinsics using an
25326 external library. The only type supported at present is @samp{mass},
25327 which specifies to use IBM's Mathematical Acceleration Subsystem
25328 (MASS) libraries for vectorizing intrinsics using external libraries.
25329 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25330 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25331 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25332 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25333 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25334 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25335 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25336 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25337 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25338 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25339 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25340 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25341 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25342 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25343 for power7. Both @option{-ftree-vectorize} and
25344 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25345 libraries must be specified at link time.
25346
25347 @item -mfriz
25348 @itemx -mno-friz
25349 @opindex mfriz
25350 Generate (do not generate) the @code{friz} instruction when the
25351 @option{-funsafe-math-optimizations} option is used to optimize
25352 rounding of floating-point values to 64-bit integer and back to floating
25353 point. The @code{friz} instruction does not return the same value if
25354 the floating-point number is too large to fit in an integer.
25355
25356 @item -mpointers-to-nested-functions
25357 @itemx -mno-pointers-to-nested-functions
25358 @opindex mpointers-to-nested-functions
25359 Generate (do not generate) code to load up the static chain register
25360 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25361 systems where a function pointer points to a 3-word descriptor giving
25362 the function address, TOC value to be loaded in register @code{r2}, and
25363 static chain value to be loaded in register @code{r11}. The
25364 @option{-mpointers-to-nested-functions} is on by default. You cannot
25365 call through pointers to nested functions or pointers
25366 to functions compiled in other languages that use the static chain if
25367 you use @option{-mno-pointers-to-nested-functions}.
25368
25369 @item -msave-toc-indirect
25370 @itemx -mno-save-toc-indirect
25371 @opindex msave-toc-indirect
25372 Generate (do not generate) code to save the TOC value in the reserved
25373 stack location in the function prologue if the function calls through
25374 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25375 saved in the prologue, it is saved just before the call through the
25376 pointer. The @option{-mno-save-toc-indirect} option is the default.
25377
25378 @item -mcompat-align-parm
25379 @itemx -mno-compat-align-parm
25380 @opindex mcompat-align-parm
25381 Generate (do not generate) code to pass structure parameters with a
25382 maximum alignment of 64 bits, for compatibility with older versions
25383 of GCC.
25384
25385 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25386 structure parameter on a 128-bit boundary when that structure contained
25387 a member requiring 128-bit alignment. This is corrected in more
25388 recent versions of GCC. This option may be used to generate code
25389 that is compatible with functions compiled with older versions of
25390 GCC.
25391
25392 The @option{-mno-compat-align-parm} option is the default.
25393
25394 @item -mstack-protector-guard=@var{guard}
25395 @itemx -mstack-protector-guard-reg=@var{reg}
25396 @itemx -mstack-protector-guard-offset=@var{offset}
25397 @itemx -mstack-protector-guard-symbol=@var{symbol}
25398 @opindex mstack-protector-guard
25399 @opindex mstack-protector-guard-reg
25400 @opindex mstack-protector-guard-offset
25401 @opindex mstack-protector-guard-symbol
25402 Generate stack protection code using canary at @var{guard}. Supported
25403 locations are @samp{global} for global canary or @samp{tls} for per-thread
25404 canary in the TLS block (the default with GNU libc version 2.4 or later).
25405
25406 With the latter choice the options
25407 @option{-mstack-protector-guard-reg=@var{reg}} and
25408 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25409 which register to use as base register for reading the canary, and from what
25410 offset from that base register. The default for those is as specified in the
25411 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25412 the offset with a symbol reference to a canary in the TLS block.
25413
25414 @item -mpcrel
25415 @itemx -mno-pcrel
25416 @opindex mpcrel
25417 @opindex mno-pcrel
25418 Generate (do not generate) pc-relative addressing when the option
25419 @option{-mcpu=future} is used.
25420 @end table
25421
25422 @node RX Options
25423 @subsection RX Options
25424 @cindex RX Options
25425
25426 These command-line options are defined for RX targets:
25427
25428 @table @gcctabopt
25429 @item -m64bit-doubles
25430 @itemx -m32bit-doubles
25431 @opindex m64bit-doubles
25432 @opindex m32bit-doubles
25433 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25434 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25435 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25436 works on 32-bit values, which is why the default is
25437 @option{-m32bit-doubles}.
25438
25439 @item -fpu
25440 @itemx -nofpu
25441 @opindex fpu
25442 @opindex nofpu
25443 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25444 floating-point hardware. The default is enabled for the RX600
25445 series and disabled for the RX200 series.
25446
25447 Floating-point instructions are only generated for 32-bit floating-point
25448 values, however, so the FPU hardware is not used for doubles if the
25449 @option{-m64bit-doubles} option is used.
25450
25451 @emph{Note} If the @option{-fpu} option is enabled then
25452 @option{-funsafe-math-optimizations} is also enabled automatically.
25453 This is because the RX FPU instructions are themselves unsafe.
25454
25455 @item -mcpu=@var{name}
25456 @opindex mcpu
25457 Selects the type of RX CPU to be targeted. Currently three types are
25458 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25459 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25460
25461 The only difference between @samp{RX600} and @samp{RX610} is that the
25462 @samp{RX610} does not support the @code{MVTIPL} instruction.
25463
25464 The @samp{RX200} series does not have a hardware floating-point unit
25465 and so @option{-nofpu} is enabled by default when this type is
25466 selected.
25467
25468 @item -mbig-endian-data
25469 @itemx -mlittle-endian-data
25470 @opindex mbig-endian-data
25471 @opindex mlittle-endian-data
25472 Store data (but not code) in the big-endian format. The default is
25473 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25474 format.
25475
25476 @item -msmall-data-limit=@var{N}
25477 @opindex msmall-data-limit
25478 Specifies the maximum size in bytes of global and static variables
25479 which can be placed into the small data area. Using the small data
25480 area can lead to smaller and faster code, but the size of area is
25481 limited and it is up to the programmer to ensure that the area does
25482 not overflow. Also when the small data area is used one of the RX's
25483 registers (usually @code{r13}) is reserved for use pointing to this
25484 area, so it is no longer available for use by the compiler. This
25485 could result in slower and/or larger code if variables are pushed onto
25486 the stack instead of being held in this register.
25487
25488 Note, common variables (variables that have not been initialized) and
25489 constants are not placed into the small data area as they are assigned
25490 to other sections in the output executable.
25491
25492 The default value is zero, which disables this feature. Note, this
25493 feature is not enabled by default with higher optimization levels
25494 (@option{-O2} etc) because of the potentially detrimental effects of
25495 reserving a register. It is up to the programmer to experiment and
25496 discover whether this feature is of benefit to their program. See the
25497 description of the @option{-mpid} option for a description of how the
25498 actual register to hold the small data area pointer is chosen.
25499
25500 @item -msim
25501 @itemx -mno-sim
25502 @opindex msim
25503 @opindex mno-sim
25504 Use the simulator runtime. The default is to use the libgloss
25505 board-specific runtime.
25506
25507 @item -mas100-syntax
25508 @itemx -mno-as100-syntax
25509 @opindex mas100-syntax
25510 @opindex mno-as100-syntax
25511 When generating assembler output use a syntax that is compatible with
25512 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25513 assembler, but it has some restrictions so it is not generated by default.
25514
25515 @item -mmax-constant-size=@var{N}
25516 @opindex mmax-constant-size
25517 Specifies the maximum size, in bytes, of a constant that can be used as
25518 an operand in a RX instruction. Although the RX instruction set does
25519 allow constants of up to 4 bytes in length to be used in instructions,
25520 a longer value equates to a longer instruction. Thus in some
25521 circumstances it can be beneficial to restrict the size of constants
25522 that are used in instructions. Constants that are too big are instead
25523 placed into a constant pool and referenced via register indirection.
25524
25525 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25526 or 4 means that constants of any size are allowed.
25527
25528 @item -mrelax
25529 @opindex mrelax
25530 Enable linker relaxation. Linker relaxation is a process whereby the
25531 linker attempts to reduce the size of a program by finding shorter
25532 versions of various instructions. Disabled by default.
25533
25534 @item -mint-register=@var{N}
25535 @opindex mint-register
25536 Specify the number of registers to reserve for fast interrupt handler
25537 functions. The value @var{N} can be between 0 and 4. A value of 1
25538 means that register @code{r13} is reserved for the exclusive use
25539 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25540 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25541 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25542 A value of 0, the default, does not reserve any registers.
25543
25544 @item -msave-acc-in-interrupts
25545 @opindex msave-acc-in-interrupts
25546 Specifies that interrupt handler functions should preserve the
25547 accumulator register. This is only necessary if normal code might use
25548 the accumulator register, for example because it performs 64-bit
25549 multiplications. The default is to ignore the accumulator as this
25550 makes the interrupt handlers faster.
25551
25552 @item -mpid
25553 @itemx -mno-pid
25554 @opindex mpid
25555 @opindex mno-pid
25556 Enables the generation of position independent data. When enabled any
25557 access to constant data is done via an offset from a base address
25558 held in a register. This allows the location of constant data to be
25559 determined at run time without requiring the executable to be
25560 relocated, which is a benefit to embedded applications with tight
25561 memory constraints. Data that can be modified is not affected by this
25562 option.
25563
25564 Note, using this feature reserves a register, usually @code{r13}, for
25565 the constant data base address. This can result in slower and/or
25566 larger code, especially in complicated functions.
25567
25568 The actual register chosen to hold the constant data base address
25569 depends upon whether the @option{-msmall-data-limit} and/or the
25570 @option{-mint-register} command-line options are enabled. Starting
25571 with register @code{r13} and proceeding downwards, registers are
25572 allocated first to satisfy the requirements of @option{-mint-register},
25573 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25574 is possible for the small data area register to be @code{r8} if both
25575 @option{-mint-register=4} and @option{-mpid} are specified on the
25576 command line.
25577
25578 By default this feature is not enabled. The default can be restored
25579 via the @option{-mno-pid} command-line option.
25580
25581 @item -mno-warn-multiple-fast-interrupts
25582 @itemx -mwarn-multiple-fast-interrupts
25583 @opindex mno-warn-multiple-fast-interrupts
25584 @opindex mwarn-multiple-fast-interrupts
25585 Prevents GCC from issuing a warning message if it finds more than one
25586 fast interrupt handler when it is compiling a file. The default is to
25587 issue a warning for each extra fast interrupt handler found, as the RX
25588 only supports one such interrupt.
25589
25590 @item -mallow-string-insns
25591 @itemx -mno-allow-string-insns
25592 @opindex mallow-string-insns
25593 @opindex mno-allow-string-insns
25594 Enables or disables the use of the string manipulation instructions
25595 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25596 @code{SWHILE} and also the @code{RMPA} instruction. These
25597 instructions may prefetch data, which is not safe to do if accessing
25598 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25599 for more information).
25600
25601 The default is to allow these instructions, but it is not possible for
25602 GCC to reliably detect all circumstances where a string instruction
25603 might be used to access an I/O register, so their use cannot be
25604 disabled automatically. Instead it is reliant upon the programmer to
25605 use the @option{-mno-allow-string-insns} option if their program
25606 accesses I/O space.
25607
25608 When the instructions are enabled GCC defines the C preprocessor
25609 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25610 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25611
25612 @item -mjsr
25613 @itemx -mno-jsr
25614 @opindex mjsr
25615 @opindex mno-jsr
25616 Use only (or not only) @code{JSR} instructions to access functions.
25617 This option can be used when code size exceeds the range of @code{BSR}
25618 instructions. Note that @option{-mno-jsr} does not mean to not use
25619 @code{JSR} but instead means that any type of branch may be used.
25620 @end table
25621
25622 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25623 has special significance to the RX port when used with the
25624 @code{interrupt} function attribute. This attribute indicates a
25625 function intended to process fast interrupts. GCC ensures
25626 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25627 and/or @code{r13} and only provided that the normal use of the
25628 corresponding registers have been restricted via the
25629 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25630 options.
25631
25632 @node S/390 and zSeries Options
25633 @subsection S/390 and zSeries Options
25634 @cindex S/390 and zSeries Options
25635
25636 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25637
25638 @table @gcctabopt
25639 @item -mhard-float
25640 @itemx -msoft-float
25641 @opindex mhard-float
25642 @opindex msoft-float
25643 Use (do not use) the hardware floating-point instructions and registers
25644 for floating-point operations. When @option{-msoft-float} is specified,
25645 functions in @file{libgcc.a} are used to perform floating-point
25646 operations. When @option{-mhard-float} is specified, the compiler
25647 generates IEEE floating-point instructions. This is the default.
25648
25649 @item -mhard-dfp
25650 @itemx -mno-hard-dfp
25651 @opindex mhard-dfp
25652 @opindex mno-hard-dfp
25653 Use (do not use) the hardware decimal-floating-point instructions for
25654 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25655 specified, functions in @file{libgcc.a} are used to perform
25656 decimal-floating-point operations. When @option{-mhard-dfp} is
25657 specified, the compiler generates decimal-floating-point hardware
25658 instructions. This is the default for @option{-march=z9-ec} or higher.
25659
25660 @item -mlong-double-64
25661 @itemx -mlong-double-128
25662 @opindex mlong-double-64
25663 @opindex mlong-double-128
25664 These switches control the size of @code{long double} type. A size
25665 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25666 type. This is the default.
25667
25668 @item -mbackchain
25669 @itemx -mno-backchain
25670 @opindex mbackchain
25671 @opindex mno-backchain
25672 Store (do not store) the address of the caller's frame as backchain pointer
25673 into the callee's stack frame.
25674 A backchain may be needed to allow debugging using tools that do not understand
25675 DWARF call frame information.
25676 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25677 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25678 the backchain is placed into the topmost word of the 96/160 byte register
25679 save area.
25680
25681 In general, code compiled with @option{-mbackchain} is call-compatible with
25682 code compiled with @option{-mmo-backchain}; however, use of the backchain
25683 for debugging purposes usually requires that the whole binary is built with
25684 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25685 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25686 to build a linux kernel use @option{-msoft-float}.
25687
25688 The default is to not maintain the backchain.
25689
25690 @item -mpacked-stack
25691 @itemx -mno-packed-stack
25692 @opindex mpacked-stack
25693 @opindex mno-packed-stack
25694 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25695 specified, the compiler uses the all fields of the 96/160 byte register save
25696 area only for their default purpose; unused fields still take up stack space.
25697 When @option{-mpacked-stack} is specified, register save slots are densely
25698 packed at the top of the register save area; unused space is reused for other
25699 purposes, allowing for more efficient use of the available stack space.
25700 However, when @option{-mbackchain} is also in effect, the topmost word of
25701 the save area is always used to store the backchain, and the return address
25702 register is always saved two words below the backchain.
25703
25704 As long as the stack frame backchain is not used, code generated with
25705 @option{-mpacked-stack} is call-compatible with code generated with
25706 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25707 S/390 or zSeries generated code that uses the stack frame backchain at run
25708 time, not just for debugging purposes. Such code is not call-compatible
25709 with code compiled with @option{-mpacked-stack}. Also, note that the
25710 combination of @option{-mbackchain},
25711 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25712 to build a linux kernel use @option{-msoft-float}.
25713
25714 The default is to not use the packed stack layout.
25715
25716 @item -msmall-exec
25717 @itemx -mno-small-exec
25718 @opindex msmall-exec
25719 @opindex mno-small-exec
25720 Generate (or do not generate) code using the @code{bras} instruction
25721 to do subroutine calls.
25722 This only works reliably if the total executable size does not
25723 exceed 64k. The default is to use the @code{basr} instruction instead,
25724 which does not have this limitation.
25725
25726 @item -m64
25727 @itemx -m31
25728 @opindex m64
25729 @opindex m31
25730 When @option{-m31} is specified, generate code compliant to the
25731 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25732 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25733 particular to generate 64-bit instructions. For the @samp{s390}
25734 targets, the default is @option{-m31}, while the @samp{s390x}
25735 targets default to @option{-m64}.
25736
25737 @item -mzarch
25738 @itemx -mesa
25739 @opindex mzarch
25740 @opindex mesa
25741 When @option{-mzarch} is specified, generate code using the
25742 instructions available on z/Architecture.
25743 When @option{-mesa} is specified, generate code using the
25744 instructions available on ESA/390. Note that @option{-mesa} is
25745 not possible with @option{-m64}.
25746 When generating code compliant to the GNU/Linux for S/390 ABI,
25747 the default is @option{-mesa}. When generating code compliant
25748 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25749
25750 @item -mhtm
25751 @itemx -mno-htm
25752 @opindex mhtm
25753 @opindex mno-htm
25754 The @option{-mhtm} option enables a set of builtins making use of
25755 instructions available with the transactional execution facility
25756 introduced with the IBM zEnterprise EC12 machine generation
25757 @ref{S/390 System z Built-in Functions}.
25758 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25759
25760 @item -mvx
25761 @itemx -mno-vx
25762 @opindex mvx
25763 @opindex mno-vx
25764 When @option{-mvx} is specified, generate code using the instructions
25765 available with the vector extension facility introduced with the IBM
25766 z13 machine generation.
25767 This option changes the ABI for some vector type values with regard to
25768 alignment and calling conventions. In case vector type values are
25769 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25770 command will be added to mark the resulting binary with the ABI used.
25771 @option{-mvx} is enabled by default when using @option{-march=z13}.
25772
25773 @item -mzvector
25774 @itemx -mno-zvector
25775 @opindex mzvector
25776 @opindex mno-zvector
25777 The @option{-mzvector} option enables vector language extensions and
25778 builtins using instructions available with the vector extension
25779 facility introduced with the IBM z13 machine generation.
25780 This option adds support for @samp{vector} to be used as a keyword to
25781 define vector type variables and arguments. @samp{vector} is only
25782 available when GNU extensions are enabled. It will not be expanded
25783 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25784 In addition to the GCC low-level builtins @option{-mzvector} enables
25785 a set of builtins added for compatibility with AltiVec-style
25786 implementations like Power and Cell. In order to make use of these
25787 builtins the header file @file{vecintrin.h} needs to be included.
25788 @option{-mzvector} is disabled by default.
25789
25790 @item -mmvcle
25791 @itemx -mno-mvcle
25792 @opindex mmvcle
25793 @opindex mno-mvcle
25794 Generate (or do not generate) code using the @code{mvcle} instruction
25795 to perform block moves. When @option{-mno-mvcle} is specified,
25796 use a @code{mvc} loop instead. This is the default unless optimizing for
25797 size.
25798
25799 @item -mdebug
25800 @itemx -mno-debug
25801 @opindex mdebug
25802 @opindex mno-debug
25803 Print (or do not print) additional debug information when compiling.
25804 The default is to not print debug information.
25805
25806 @item -march=@var{cpu-type}
25807 @opindex march
25808 Generate code that runs on @var{cpu-type}, which is the name of a
25809 system representing a certain processor type. Possible values for
25810 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25811 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25812 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25813 @samp{z14}/@samp{arch12}, and @samp{native}.
25814
25815 The default is @option{-march=z900}.
25816
25817 Specifying @samp{native} as cpu type can be used to select the best
25818 architecture option for the host processor.
25819 @option{-march=native} has no effect if GCC does not recognize the
25820 processor.
25821
25822 @item -mtune=@var{cpu-type}
25823 @opindex mtune
25824 Tune to @var{cpu-type} everything applicable about the generated code,
25825 except for the ABI and the set of available instructions.
25826 The list of @var{cpu-type} values is the same as for @option{-march}.
25827 The default is the value used for @option{-march}.
25828
25829 @item -mtpf-trace
25830 @itemx -mno-tpf-trace
25831 @opindex mtpf-trace
25832 @opindex mno-tpf-trace
25833 Generate code that adds (does not add) in TPF OS specific branches to trace
25834 routines in the operating system. This option is off by default, even
25835 when compiling for the TPF OS@.
25836
25837 @item -mfused-madd
25838 @itemx -mno-fused-madd
25839 @opindex mfused-madd
25840 @opindex mno-fused-madd
25841 Generate code that uses (does not use) the floating-point multiply and
25842 accumulate instructions. These instructions are generated by default if
25843 hardware floating point is used.
25844
25845 @item -mwarn-framesize=@var{framesize}
25846 @opindex mwarn-framesize
25847 Emit a warning if the current function exceeds the given frame size. Because
25848 this is a compile-time check it doesn't need to be a real problem when the program
25849 runs. It is intended to identify functions that most probably cause
25850 a stack overflow. It is useful to be used in an environment with limited stack
25851 size e.g.@: the linux kernel.
25852
25853 @item -mwarn-dynamicstack
25854 @opindex mwarn-dynamicstack
25855 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25856 arrays. This is generally a bad idea with a limited stack size.
25857
25858 @item -mstack-guard=@var{stack-guard}
25859 @itemx -mstack-size=@var{stack-size}
25860 @opindex mstack-guard
25861 @opindex mstack-size
25862 If these options are provided the S/390 back end emits additional instructions in
25863 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25864 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25865 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25866 the frame size of the compiled function is chosen.
25867 These options are intended to be used to help debugging stack overflow problems.
25868 The additionally emitted code causes only little overhead and hence can also be
25869 used in production-like systems without greater performance degradation. The given
25870 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25871 @var{stack-guard} without exceeding 64k.
25872 In order to be efficient the extra code makes the assumption that the stack starts
25873 at an address aligned to the value given by @var{stack-size}.
25874 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25875
25876 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25877 @opindex mhotpatch
25878 If the hotpatch option is enabled, a ``hot-patching'' function
25879 prologue is generated for all functions in the compilation unit.
25880 The funtion label is prepended with the given number of two-byte
25881 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25882 the label, 2 * @var{post-halfwords} bytes are appended, using the
25883 largest NOP like instructions the architecture allows (maximum
25884 1000000).
25885
25886 If both arguments are zero, hotpatching is disabled.
25887
25888 This option can be overridden for individual functions with the
25889 @code{hotpatch} attribute.
25890 @end table
25891
25892 @node Score Options
25893 @subsection Score Options
25894 @cindex Score Options
25895
25896 These options are defined for Score implementations:
25897
25898 @table @gcctabopt
25899 @item -meb
25900 @opindex meb
25901 Compile code for big-endian mode. This is the default.
25902
25903 @item -mel
25904 @opindex mel
25905 Compile code for little-endian mode.
25906
25907 @item -mnhwloop
25908 @opindex mnhwloop
25909 Disable generation of @code{bcnz} instructions.
25910
25911 @item -muls
25912 @opindex muls
25913 Enable generation of unaligned load and store instructions.
25914
25915 @item -mmac
25916 @opindex mmac
25917 Enable the use of multiply-accumulate instructions. Disabled by default.
25918
25919 @item -mscore5
25920 @opindex mscore5
25921 Specify the SCORE5 as the target architecture.
25922
25923 @item -mscore5u
25924 @opindex mscore5u
25925 Specify the SCORE5U of the target architecture.
25926
25927 @item -mscore7
25928 @opindex mscore7
25929 Specify the SCORE7 as the target architecture. This is the default.
25930
25931 @item -mscore7d
25932 @opindex mscore7d
25933 Specify the SCORE7D as the target architecture.
25934 @end table
25935
25936 @node SH Options
25937 @subsection SH Options
25938
25939 These @samp{-m} options are defined for the SH implementations:
25940
25941 @table @gcctabopt
25942 @item -m1
25943 @opindex m1
25944 Generate code for the SH1.
25945
25946 @item -m2
25947 @opindex m2
25948 Generate code for the SH2.
25949
25950 @item -m2e
25951 Generate code for the SH2e.
25952
25953 @item -m2a-nofpu
25954 @opindex m2a-nofpu
25955 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25956 that the floating-point unit is not used.
25957
25958 @item -m2a-single-only
25959 @opindex m2a-single-only
25960 Generate code for the SH2a-FPU, in such a way that no double-precision
25961 floating-point operations are used.
25962
25963 @item -m2a-single
25964 @opindex m2a-single
25965 Generate code for the SH2a-FPU assuming the floating-point unit is in
25966 single-precision mode by default.
25967
25968 @item -m2a
25969 @opindex m2a
25970 Generate code for the SH2a-FPU assuming the floating-point unit is in
25971 double-precision mode by default.
25972
25973 @item -m3
25974 @opindex m3
25975 Generate code for the SH3.
25976
25977 @item -m3e
25978 @opindex m3e
25979 Generate code for the SH3e.
25980
25981 @item -m4-nofpu
25982 @opindex m4-nofpu
25983 Generate code for the SH4 without a floating-point unit.
25984
25985 @item -m4-single-only
25986 @opindex m4-single-only
25987 Generate code for the SH4 with a floating-point unit that only
25988 supports single-precision arithmetic.
25989
25990 @item -m4-single
25991 @opindex m4-single
25992 Generate code for the SH4 assuming the floating-point unit is in
25993 single-precision mode by default.
25994
25995 @item -m4
25996 @opindex m4
25997 Generate code for the SH4.
25998
25999 @item -m4-100
26000 @opindex m4-100
26001 Generate code for SH4-100.
26002
26003 @item -m4-100-nofpu
26004 @opindex m4-100-nofpu
26005 Generate code for SH4-100 in such a way that the
26006 floating-point unit is not used.
26007
26008 @item -m4-100-single
26009 @opindex m4-100-single
26010 Generate code for SH4-100 assuming the floating-point unit is in
26011 single-precision mode by default.
26012
26013 @item -m4-100-single-only
26014 @opindex m4-100-single-only
26015 Generate code for SH4-100 in such a way that no double-precision
26016 floating-point operations are used.
26017
26018 @item -m4-200
26019 @opindex m4-200
26020 Generate code for SH4-200.
26021
26022 @item -m4-200-nofpu
26023 @opindex m4-200-nofpu
26024 Generate code for SH4-200 without in such a way that the
26025 floating-point unit is not used.
26026
26027 @item -m4-200-single
26028 @opindex m4-200-single
26029 Generate code for SH4-200 assuming the floating-point unit is in
26030 single-precision mode by default.
26031
26032 @item -m4-200-single-only
26033 @opindex m4-200-single-only
26034 Generate code for SH4-200 in such a way that no double-precision
26035 floating-point operations are used.
26036
26037 @item -m4-300
26038 @opindex m4-300
26039 Generate code for SH4-300.
26040
26041 @item -m4-300-nofpu
26042 @opindex m4-300-nofpu
26043 Generate code for SH4-300 without in such a way that the
26044 floating-point unit is not used.
26045
26046 @item -m4-300-single
26047 @opindex m4-300-single
26048 Generate code for SH4-300 in such a way that no double-precision
26049 floating-point operations are used.
26050
26051 @item -m4-300-single-only
26052 @opindex m4-300-single-only
26053 Generate code for SH4-300 in such a way that no double-precision
26054 floating-point operations are used.
26055
26056 @item -m4-340
26057 @opindex m4-340
26058 Generate code for SH4-340 (no MMU, no FPU).
26059
26060 @item -m4-500
26061 @opindex m4-500
26062 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26063 assembler.
26064
26065 @item -m4a-nofpu
26066 @opindex m4a-nofpu
26067 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26068 floating-point unit is not used.
26069
26070 @item -m4a-single-only
26071 @opindex m4a-single-only
26072 Generate code for the SH4a, in such a way that no double-precision
26073 floating-point operations are used.
26074
26075 @item -m4a-single
26076 @opindex m4a-single
26077 Generate code for the SH4a assuming the floating-point unit is in
26078 single-precision mode by default.
26079
26080 @item -m4a
26081 @opindex m4a
26082 Generate code for the SH4a.
26083
26084 @item -m4al
26085 @opindex m4al
26086 Same as @option{-m4a-nofpu}, except that it implicitly passes
26087 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26088 instructions at the moment.
26089
26090 @item -mb
26091 @opindex mb
26092 Compile code for the processor in big-endian mode.
26093
26094 @item -ml
26095 @opindex ml
26096 Compile code for the processor in little-endian mode.
26097
26098 @item -mdalign
26099 @opindex mdalign
26100 Align doubles at 64-bit boundaries. Note that this changes the calling
26101 conventions, and thus some functions from the standard C library do
26102 not work unless you recompile it first with @option{-mdalign}.
26103
26104 @item -mrelax
26105 @opindex mrelax
26106 Shorten some address references at link time, when possible; uses the
26107 linker option @option{-relax}.
26108
26109 @item -mbigtable
26110 @opindex mbigtable
26111 Use 32-bit offsets in @code{switch} tables. The default is to use
26112 16-bit offsets.
26113
26114 @item -mbitops
26115 @opindex mbitops
26116 Enable the use of bit manipulation instructions on SH2A.
26117
26118 @item -mfmovd
26119 @opindex mfmovd
26120 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26121 alignment constraints.
26122
26123 @item -mrenesas
26124 @opindex mrenesas
26125 Comply with the calling conventions defined by Renesas.
26126
26127 @item -mno-renesas
26128 @opindex mno-renesas
26129 Comply with the calling conventions defined for GCC before the Renesas
26130 conventions were available. This option is the default for all
26131 targets of the SH toolchain.
26132
26133 @item -mnomacsave
26134 @opindex mnomacsave
26135 Mark the @code{MAC} register as call-clobbered, even if
26136 @option{-mrenesas} is given.
26137
26138 @item -mieee
26139 @itemx -mno-ieee
26140 @opindex mieee
26141 @opindex mno-ieee
26142 Control the IEEE compliance of floating-point comparisons, which affects the
26143 handling of cases where the result of a comparison is unordered. By default
26144 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26145 enabled @option{-mno-ieee} is implicitly set, which results in faster
26146 floating-point greater-equal and less-equal comparisons. The implicit settings
26147 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26148
26149 @item -minline-ic_invalidate
26150 @opindex minline-ic_invalidate
26151 Inline code to invalidate instruction cache entries after setting up
26152 nested function trampolines.
26153 This option has no effect if @option{-musermode} is in effect and the selected
26154 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26155 instruction.
26156 If the selected code generation option does not allow the use of the @code{icbi}
26157 instruction, and @option{-musermode} is not in effect, the inlined code
26158 manipulates the instruction cache address array directly with an associative
26159 write. This not only requires privileged mode at run time, but it also
26160 fails if the cache line had been mapped via the TLB and has become unmapped.
26161
26162 @item -misize
26163 @opindex misize
26164 Dump instruction size and location in the assembly code.
26165
26166 @item -mpadstruct
26167 @opindex mpadstruct
26168 This option is deprecated. It pads structures to multiple of 4 bytes,
26169 which is incompatible with the SH ABI@.
26170
26171 @item -matomic-model=@var{model}
26172 @opindex matomic-model=@var{model}
26173 Sets the model of atomic operations and additional parameters as a comma
26174 separated list. For details on the atomic built-in functions see
26175 @ref{__atomic Builtins}. The following models and parameters are supported:
26176
26177 @table @samp
26178
26179 @item none
26180 Disable compiler generated atomic sequences and emit library calls for atomic
26181 operations. This is the default if the target is not @code{sh*-*-linux*}.
26182
26183 @item soft-gusa
26184 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26185 built-in functions. The generated atomic sequences require additional support
26186 from the interrupt/exception handling code of the system and are only suitable
26187 for SH3* and SH4* single-core systems. This option is enabled by default when
26188 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26189 this option also partially utilizes the hardware atomic instructions
26190 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26191 @samp{strict} is specified.
26192
26193 @item soft-tcb
26194 Generate software atomic sequences that use a variable in the thread control
26195 block. This is a variation of the gUSA sequences which can also be used on
26196 SH1* and SH2* targets. The generated atomic sequences require additional
26197 support from the interrupt/exception handling code of the system and are only
26198 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26199 parameter has to be specified as well.
26200
26201 @item soft-imask
26202 Generate software atomic sequences that temporarily disable interrupts by
26203 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26204 in privileged mode and is only suitable for single-core systems. Additional
26205 support from the interrupt/exception handling code of the system is not
26206 required. This model is enabled by default when the target is
26207 @code{sh*-*-linux*} and SH1* or SH2*.
26208
26209 @item hard-llcs
26210 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26211 instructions only. This is only available on SH4A and is suitable for
26212 multi-core systems. Since the hardware instructions support only 32 bit atomic
26213 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26214 Code compiled with this option is also compatible with other software
26215 atomic model interrupt/exception handling systems if executed on an SH4A
26216 system. Additional support from the interrupt/exception handling code of the
26217 system is not required for this model.
26218
26219 @item gbr-offset=
26220 This parameter specifies the offset in bytes of the variable in the thread
26221 control block structure that should be used by the generated atomic sequences
26222 when the @samp{soft-tcb} model has been selected. For other models this
26223 parameter is ignored. The specified value must be an integer multiple of four
26224 and in the range 0-1020.
26225
26226 @item strict
26227 This parameter prevents mixed usage of multiple atomic models, even if they
26228 are compatible, and makes the compiler generate atomic sequences of the
26229 specified model only.
26230
26231 @end table
26232
26233 @item -mtas
26234 @opindex mtas
26235 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26236 Notice that depending on the particular hardware and software configuration
26237 this can degrade overall performance due to the operand cache line flushes
26238 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26239 processors the @code{tas.b} instruction must be used with caution since it
26240 can result in data corruption for certain cache configurations.
26241
26242 @item -mprefergot
26243 @opindex mprefergot
26244 When generating position-independent code, emit function calls using
26245 the Global Offset Table instead of the Procedure Linkage Table.
26246
26247 @item -musermode
26248 @itemx -mno-usermode
26249 @opindex musermode
26250 @opindex mno-usermode
26251 Don't allow (allow) the compiler generating privileged mode code. Specifying
26252 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26253 inlined code would not work in user mode. @option{-musermode} is the default
26254 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26255 @option{-musermode} has no effect, since there is no user mode.
26256
26257 @item -multcost=@var{number}
26258 @opindex multcost=@var{number}
26259 Set the cost to assume for a multiply insn.
26260
26261 @item -mdiv=@var{strategy}
26262 @opindex mdiv=@var{strategy}
26263 Set the division strategy to be used for integer division operations.
26264 @var{strategy} can be one of:
26265
26266 @table @samp
26267
26268 @item call-div1
26269 Calls a library function that uses the single-step division instruction
26270 @code{div1} to perform the operation. Division by zero calculates an
26271 unspecified result and does not trap. This is the default except for SH4,
26272 SH2A and SHcompact.
26273
26274 @item call-fp
26275 Calls a library function that performs the operation in double precision
26276 floating point. Division by zero causes a floating-point exception. This is
26277 the default for SHcompact with FPU. Specifying this for targets that do not
26278 have a double precision FPU defaults to @code{call-div1}.
26279
26280 @item call-table
26281 Calls a library function that uses a lookup table for small divisors and
26282 the @code{div1} instruction with case distinction for larger divisors. Division
26283 by zero calculates an unspecified result and does not trap. This is the default
26284 for SH4. Specifying this for targets that do not have dynamic shift
26285 instructions defaults to @code{call-div1}.
26286
26287 @end table
26288
26289 When a division strategy has not been specified the default strategy is
26290 selected based on the current target. For SH2A the default strategy is to
26291 use the @code{divs} and @code{divu} instructions instead of library function
26292 calls.
26293
26294 @item -maccumulate-outgoing-args
26295 @opindex maccumulate-outgoing-args
26296 Reserve space once for outgoing arguments in the function prologue rather
26297 than around each call. Generally beneficial for performance and size. Also
26298 needed for unwinding to avoid changing the stack frame around conditional code.
26299
26300 @item -mdivsi3_libfunc=@var{name}
26301 @opindex mdivsi3_libfunc=@var{name}
26302 Set the name of the library function used for 32-bit signed division to
26303 @var{name}.
26304 This only affects the name used in the @samp{call} division strategies, and
26305 the compiler still expects the same sets of input/output/clobbered registers as
26306 if this option were not present.
26307
26308 @item -mfixed-range=@var{register-range}
26309 @opindex mfixed-range
26310 Generate code treating the given register range as fixed registers.
26311 A fixed register is one that the register allocator cannot use. This is
26312 useful when compiling kernel code. A register range is specified as
26313 two registers separated by a dash. Multiple register ranges can be
26314 specified separated by a comma.
26315
26316 @item -mbranch-cost=@var{num}
26317 @opindex mbranch-cost=@var{num}
26318 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26319 make the compiler try to generate more branch-free code if possible.
26320 If not specified the value is selected depending on the processor type that
26321 is being compiled for.
26322
26323 @item -mzdcbranch
26324 @itemx -mno-zdcbranch
26325 @opindex mzdcbranch
26326 @opindex mno-zdcbranch
26327 Assume (do not assume) that zero displacement conditional branch instructions
26328 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26329 compiler prefers zero displacement branch code sequences. This is
26330 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26331 disabled by specifying @option{-mno-zdcbranch}.
26332
26333 @item -mcbranch-force-delay-slot
26334 @opindex mcbranch-force-delay-slot
26335 Force the usage of delay slots for conditional branches, which stuffs the delay
26336 slot with a @code{nop} if a suitable instruction cannot be found. By default
26337 this option is disabled. It can be enabled to work around hardware bugs as
26338 found in the original SH7055.
26339
26340 @item -mfused-madd
26341 @itemx -mno-fused-madd
26342 @opindex mfused-madd
26343 @opindex mno-fused-madd
26344 Generate code that uses (does not use) the floating-point multiply and
26345 accumulate instructions. These instructions are generated by default
26346 if hardware floating point is used. The machine-dependent
26347 @option{-mfused-madd} option is now mapped to the machine-independent
26348 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26349 mapped to @option{-ffp-contract=off}.
26350
26351 @item -mfsca
26352 @itemx -mno-fsca
26353 @opindex mfsca
26354 @opindex mno-fsca
26355 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26356 and cosine approximations. The option @option{-mfsca} must be used in
26357 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26358 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26359 approximations even if @option{-funsafe-math-optimizations} is in effect.
26360
26361 @item -mfsrra
26362 @itemx -mno-fsrra
26363 @opindex mfsrra
26364 @opindex mno-fsrra
26365 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26366 reciprocal square root approximations. The option @option{-mfsrra} must be used
26367 in combination with @option{-funsafe-math-optimizations} and
26368 @option{-ffinite-math-only}. It is enabled by default when generating code for
26369 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26370 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26371 in effect.
26372
26373 @item -mpretend-cmove
26374 @opindex mpretend-cmove
26375 Prefer zero-displacement conditional branches for conditional move instruction
26376 patterns. This can result in faster code on the SH4 processor.
26377
26378 @item -mfdpic
26379 @opindex fdpic
26380 Generate code using the FDPIC ABI.
26381
26382 @end table
26383
26384 @node Solaris 2 Options
26385 @subsection Solaris 2 Options
26386 @cindex Solaris 2 options
26387
26388 These @samp{-m} options are supported on Solaris 2:
26389
26390 @table @gcctabopt
26391 @item -mclear-hwcap
26392 @opindex mclear-hwcap
26393 @option{-mclear-hwcap} tells the compiler to remove the hardware
26394 capabilities generated by the Solaris assembler. This is only necessary
26395 when object files use ISA extensions not supported by the current
26396 machine, but check at runtime whether or not to use them.
26397
26398 @item -mimpure-text
26399 @opindex mimpure-text
26400 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26401 the compiler to not pass @option{-z text} to the linker when linking a
26402 shared object. Using this option, you can link position-dependent
26403 code into a shared object.
26404
26405 @option{-mimpure-text} suppresses the ``relocations remain against
26406 allocatable but non-writable sections'' linker error message.
26407 However, the necessary relocations trigger copy-on-write, and the
26408 shared object is not actually shared across processes. Instead of
26409 using @option{-mimpure-text}, you should compile all source code with
26410 @option{-fpic} or @option{-fPIC}.
26411
26412 @end table
26413
26414 These switches are supported in addition to the above on Solaris 2:
26415
26416 @table @gcctabopt
26417 @item -pthreads
26418 @opindex pthreads
26419 This is a synonym for @option{-pthread}.
26420 @end table
26421
26422 @node SPARC Options
26423 @subsection SPARC Options
26424 @cindex SPARC options
26425
26426 These @samp{-m} options are supported on the SPARC:
26427
26428 @table @gcctabopt
26429 @item -mno-app-regs
26430 @itemx -mapp-regs
26431 @opindex mno-app-regs
26432 @opindex mapp-regs
26433 Specify @option{-mapp-regs} to generate output using the global registers
26434 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26435 global register 1, each global register 2 through 4 is then treated as an
26436 allocable register that is clobbered by function calls. This is the default.
26437
26438 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26439 specify @option{-mno-app-regs}. You should compile libraries and system
26440 software with this option.
26441
26442 @item -mflat
26443 @itemx -mno-flat
26444 @opindex mflat
26445 @opindex mno-flat
26446 With @option{-mflat}, the compiler does not generate save/restore instructions
26447 and uses a ``flat'' or single register window model. This model is compatible
26448 with the regular register window model. The local registers and the input
26449 registers (0--5) are still treated as ``call-saved'' registers and are
26450 saved on the stack as needed.
26451
26452 With @option{-mno-flat} (the default), the compiler generates save/restore
26453 instructions (except for leaf functions). This is the normal operating mode.
26454
26455 @item -mfpu
26456 @itemx -mhard-float
26457 @opindex mfpu
26458 @opindex mhard-float
26459 Generate output containing floating-point instructions. This is the
26460 default.
26461
26462 @item -mno-fpu
26463 @itemx -msoft-float
26464 @opindex mno-fpu
26465 @opindex msoft-float
26466 Generate output containing library calls for floating point.
26467 @strong{Warning:} the requisite libraries are not available for all SPARC
26468 targets. Normally the facilities of the machine's usual C compiler are
26469 used, but this cannot be done directly in cross-compilation. You must make
26470 your own arrangements to provide suitable library functions for
26471 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26472 @samp{sparclite-*-*} do provide software floating-point support.
26473
26474 @option{-msoft-float} changes the calling convention in the output file;
26475 therefore, it is only useful if you compile @emph{all} of a program with
26476 this option. In particular, you need to compile @file{libgcc.a}, the
26477 library that comes with GCC, with @option{-msoft-float} in order for
26478 this to work.
26479
26480 @item -mhard-quad-float
26481 @opindex mhard-quad-float
26482 Generate output containing quad-word (long double) floating-point
26483 instructions.
26484
26485 @item -msoft-quad-float
26486 @opindex msoft-quad-float
26487 Generate output containing library calls for quad-word (long double)
26488 floating-point instructions. The functions called are those specified
26489 in the SPARC ABI@. This is the default.
26490
26491 As of this writing, there are no SPARC implementations that have hardware
26492 support for the quad-word floating-point instructions. They all invoke
26493 a trap handler for one of these instructions, and then the trap handler
26494 emulates the effect of the instruction. Because of the trap handler overhead,
26495 this is much slower than calling the ABI library routines. Thus the
26496 @option{-msoft-quad-float} option is the default.
26497
26498 @item -mno-unaligned-doubles
26499 @itemx -munaligned-doubles
26500 @opindex mno-unaligned-doubles
26501 @opindex munaligned-doubles
26502 Assume that doubles have 8-byte alignment. This is the default.
26503
26504 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26505 alignment only if they are contained in another type, or if they have an
26506 absolute address. Otherwise, it assumes they have 4-byte alignment.
26507 Specifying this option avoids some rare compatibility problems with code
26508 generated by other compilers. It is not the default because it results
26509 in a performance loss, especially for floating-point code.
26510
26511 @item -muser-mode
26512 @itemx -mno-user-mode
26513 @opindex muser-mode
26514 @opindex mno-user-mode
26515 Do not generate code that can only run in supervisor mode. This is relevant
26516 only for the @code{casa} instruction emitted for the LEON3 processor. This
26517 is the default.
26518
26519 @item -mfaster-structs
26520 @itemx -mno-faster-structs
26521 @opindex mfaster-structs
26522 @opindex mno-faster-structs
26523 With @option{-mfaster-structs}, the compiler assumes that structures
26524 should have 8-byte alignment. This enables the use of pairs of
26525 @code{ldd} and @code{std} instructions for copies in structure
26526 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26527 However, the use of this changed alignment directly violates the SPARC
26528 ABI@. Thus, it's intended only for use on targets where the developer
26529 acknowledges that their resulting code is not directly in line with
26530 the rules of the ABI@.
26531
26532 @item -mstd-struct-return
26533 @itemx -mno-std-struct-return
26534 @opindex mstd-struct-return
26535 @opindex mno-std-struct-return
26536 With @option{-mstd-struct-return}, the compiler generates checking code
26537 in functions returning structures or unions to detect size mismatches
26538 between the two sides of function calls, as per the 32-bit ABI@.
26539
26540 The default is @option{-mno-std-struct-return}. This option has no effect
26541 in 64-bit mode.
26542
26543 @item -mlra
26544 @itemx -mno-lra
26545 @opindex mlra
26546 @opindex mno-lra
26547 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26548 so @option{-mno-lra} needs to be passed to get old Reload.
26549
26550 @item -mcpu=@var{cpu_type}
26551 @opindex mcpu
26552 Set the instruction set, register set, and instruction scheduling parameters
26553 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26554 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26555 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26556 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26557 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26558 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26559
26560 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26561 which selects the best architecture option for the host processor.
26562 @option{-mcpu=native} has no effect if GCC does not recognize
26563 the processor.
26564
26565 Default instruction scheduling parameters are used for values that select
26566 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26567 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26568
26569 Here is a list of each supported architecture and their supported
26570 implementations.
26571
26572 @table @asis
26573 @item v7
26574 cypress, leon3v7
26575
26576 @item v8
26577 supersparc, hypersparc, leon, leon3
26578
26579 @item sparclite
26580 f930, f934, sparclite86x
26581
26582 @item sparclet
26583 tsc701
26584
26585 @item v9
26586 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26587 niagara7, m8
26588 @end table
26589
26590 By default (unless configured otherwise), GCC generates code for the V7
26591 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26592 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26593 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26594 SPARCStation 1, 2, IPX etc.
26595
26596 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26597 architecture. The only difference from V7 code is that the compiler emits
26598 the integer multiply and integer divide instructions which exist in SPARC-V8
26599 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26600 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26601 2000 series.
26602
26603 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26604 the SPARC architecture. This adds the integer multiply, integer divide step
26605 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26606 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26607 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26608 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26609 MB86934 chip, which is the more recent SPARClite with FPU@.
26610
26611 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26612 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26613 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26614 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26615 optimizes it for the TEMIC SPARClet chip.
26616
26617 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26618 architecture. This adds 64-bit integer and floating-point move instructions,
26619 3 additional floating-point condition code registers and conditional move
26620 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26621 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26622 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26623 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26624 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26625 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26626 additionally optimizes it for Sun UltraSPARC T2 chips. With
26627 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26628 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26629 additionally optimizes it for Sun UltraSPARC T4 chips. With
26630 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26631 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26632 additionally optimizes it for Oracle M8 chips.
26633
26634 @item -mtune=@var{cpu_type}
26635 @opindex mtune
26636 Set the instruction scheduling parameters for machine type
26637 @var{cpu_type}, but do not set the instruction set or register set that the
26638 option @option{-mcpu=@var{cpu_type}} does.
26639
26640 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26641 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26642 that select a particular CPU implementation. Those are
26643 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26644 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26645 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26646 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26647 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26648 and GNU/Linux toolchains, @samp{native} can also be used.
26649
26650 @item -mv8plus
26651 @itemx -mno-v8plus
26652 @opindex mv8plus
26653 @opindex mno-v8plus
26654 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26655 difference from the V8 ABI is that the global and out registers are
26656 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26657 mode for all SPARC-V9 processors.
26658
26659 @item -mvis
26660 @itemx -mno-vis
26661 @opindex mvis
26662 @opindex mno-vis
26663 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26664 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26665
26666 @item -mvis2
26667 @itemx -mno-vis2
26668 @opindex mvis2
26669 @opindex mno-vis2
26670 With @option{-mvis2}, GCC generates code that takes advantage of
26671 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26672 default is @option{-mvis2} when targeting a cpu that supports such
26673 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26674 also sets @option{-mvis}.
26675
26676 @item -mvis3
26677 @itemx -mno-vis3
26678 @opindex mvis3
26679 @opindex mno-vis3
26680 With @option{-mvis3}, GCC generates code that takes advantage of
26681 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26682 default is @option{-mvis3} when targeting a cpu that supports such
26683 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26684 also sets @option{-mvis2} and @option{-mvis}.
26685
26686 @item -mvis4
26687 @itemx -mno-vis4
26688 @opindex mvis4
26689 @opindex mno-vis4
26690 With @option{-mvis4}, GCC generates code that takes advantage of
26691 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26692 default is @option{-mvis4} when targeting a cpu that supports such
26693 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26694 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26695
26696 @item -mvis4b
26697 @itemx -mno-vis4b
26698 @opindex mvis4b
26699 @opindex mno-vis4b
26700 With @option{-mvis4b}, GCC generates code that takes advantage of
26701 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26702 the additional VIS instructions introduced in the Oracle SPARC
26703 Architecture 2017. The default is @option{-mvis4b} when targeting a
26704 cpu that supports such instructions, such as m8 and later. Setting
26705 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26706 @option{-mvis2} and @option{-mvis}.
26707
26708 @item -mcbcond
26709 @itemx -mno-cbcond
26710 @opindex mcbcond
26711 @opindex mno-cbcond
26712 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26713 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26714 when targeting a CPU that supports such instructions, such as Niagara-4 and
26715 later.
26716
26717 @item -mfmaf
26718 @itemx -mno-fmaf
26719 @opindex mfmaf
26720 @opindex mno-fmaf
26721 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26722 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26723 when targeting a CPU that supports such instructions, such as Niagara-3 and
26724 later.
26725
26726 @item -mfsmuld
26727 @itemx -mno-fsmuld
26728 @opindex mfsmuld
26729 @opindex mno-fsmuld
26730 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26731 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26732 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26733 or V9 with FPU except @option{-mcpu=leon}.
26734
26735 @item -mpopc
26736 @itemx -mno-popc
26737 @opindex mpopc
26738 @opindex mno-popc
26739 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26740 Population Count instruction. The default is @option{-mpopc}
26741 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26742 later.
26743
26744 @item -msubxc
26745 @itemx -mno-subxc
26746 @opindex msubxc
26747 @opindex mno-subxc
26748 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26749 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26750 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26751 later.
26752
26753 @item -mfix-at697f
26754 @opindex mfix-at697f
26755 Enable the documented workaround for the single erratum of the Atmel AT697F
26756 processor (which corresponds to erratum #13 of the AT697E processor).
26757
26758 @item -mfix-ut699
26759 @opindex mfix-ut699
26760 Enable the documented workarounds for the floating-point errata and the data
26761 cache nullify errata of the UT699 processor.
26762
26763 @item -mfix-ut700
26764 @opindex mfix-ut700
26765 Enable the documented workaround for the back-to-back store errata of
26766 the UT699E/UT700 processor.
26767
26768 @item -mfix-gr712rc
26769 @opindex mfix-gr712rc
26770 Enable the documented workaround for the back-to-back store errata of
26771 the GR712RC processor.
26772 @end table
26773
26774 These @samp{-m} options are supported in addition to the above
26775 on SPARC-V9 processors in 64-bit environments:
26776
26777 @table @gcctabopt
26778 @item -m32
26779 @itemx -m64
26780 @opindex m32
26781 @opindex m64
26782 Generate code for a 32-bit or 64-bit environment.
26783 The 32-bit environment sets int, long and pointer to 32 bits.
26784 The 64-bit environment sets int to 32 bits and long and pointer
26785 to 64 bits.
26786
26787 @item -mcmodel=@var{which}
26788 @opindex mcmodel
26789 Set the code model to one of
26790
26791 @table @samp
26792 @item medlow
26793 The Medium/Low code model: 64-bit addresses, programs
26794 must be linked in the low 32 bits of memory. Programs can be statically
26795 or dynamically linked.
26796
26797 @item medmid
26798 The Medium/Middle code model: 64-bit addresses, programs
26799 must be linked in the low 44 bits of memory, the text and data segments must
26800 be less than 2GB in size and the data segment must be located within 2GB of
26801 the text segment.
26802
26803 @item medany
26804 The Medium/Anywhere code model: 64-bit addresses, programs
26805 may be linked anywhere in memory, the text and data segments must be less
26806 than 2GB in size and the data segment must be located within 2GB of the
26807 text segment.
26808
26809 @item embmedany
26810 The Medium/Anywhere code model for embedded systems:
26811 64-bit addresses, the text and data segments must be less than 2GB in
26812 size, both starting anywhere in memory (determined at link time). The
26813 global register %g4 points to the base of the data segment. Programs
26814 are statically linked and PIC is not supported.
26815 @end table
26816
26817 @item -mmemory-model=@var{mem-model}
26818 @opindex mmemory-model
26819 Set the memory model in force on the processor to one of
26820
26821 @table @samp
26822 @item default
26823 The default memory model for the processor and operating system.
26824
26825 @item rmo
26826 Relaxed Memory Order
26827
26828 @item pso
26829 Partial Store Order
26830
26831 @item tso
26832 Total Store Order
26833
26834 @item sc
26835 Sequential Consistency
26836 @end table
26837
26838 These memory models are formally defined in Appendix D of the SPARC-V9
26839 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26840
26841 @item -mstack-bias
26842 @itemx -mno-stack-bias
26843 @opindex mstack-bias
26844 @opindex mno-stack-bias
26845 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26846 frame pointer if present, are offset by @minus{}2047 which must be added back
26847 when making stack frame references. This is the default in 64-bit mode.
26848 Otherwise, assume no such offset is present.
26849 @end table
26850
26851 @node System V Options
26852 @subsection Options for System V
26853
26854 These additional options are available on System V Release 4 for
26855 compatibility with other compilers on those systems:
26856
26857 @table @gcctabopt
26858 @item -G
26859 @opindex G
26860 Create a shared object.
26861 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26862
26863 @item -Qy
26864 @opindex Qy
26865 Identify the versions of each tool used by the compiler, in a
26866 @code{.ident} assembler directive in the output.
26867
26868 @item -Qn
26869 @opindex Qn
26870 Refrain from adding @code{.ident} directives to the output file (this is
26871 the default).
26872
26873 @item -YP,@var{dirs}
26874 @opindex YP
26875 Search the directories @var{dirs}, and no others, for libraries
26876 specified with @option{-l}.
26877
26878 @item -Ym,@var{dir}
26879 @opindex Ym
26880 Look in the directory @var{dir} to find the M4 preprocessor.
26881 The assembler uses this option.
26882 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26883 @c the generic assembler that comes with Solaris takes just -Ym.
26884 @end table
26885
26886 @node TILE-Gx Options
26887 @subsection TILE-Gx Options
26888 @cindex TILE-Gx options
26889
26890 These @samp{-m} options are supported on the TILE-Gx:
26891
26892 @table @gcctabopt
26893 @item -mcmodel=small
26894 @opindex mcmodel=small
26895 Generate code for the small model. The distance for direct calls is
26896 limited to 500M in either direction. PC-relative addresses are 32
26897 bits. Absolute addresses support the full address range.
26898
26899 @item -mcmodel=large
26900 @opindex mcmodel=large
26901 Generate code for the large model. There is no limitation on call
26902 distance, pc-relative addresses, or absolute addresses.
26903
26904 @item -mcpu=@var{name}
26905 @opindex mcpu
26906 Selects the type of CPU to be targeted. Currently the only supported
26907 type is @samp{tilegx}.
26908
26909 @item -m32
26910 @itemx -m64
26911 @opindex m32
26912 @opindex m64
26913 Generate code for a 32-bit or 64-bit environment. The 32-bit
26914 environment sets int, long, and pointer to 32 bits. The 64-bit
26915 environment sets int to 32 bits and long and pointer to 64 bits.
26916
26917 @item -mbig-endian
26918 @itemx -mlittle-endian
26919 @opindex mbig-endian
26920 @opindex mlittle-endian
26921 Generate code in big/little endian mode, respectively.
26922 @end table
26923
26924 @node TILEPro Options
26925 @subsection TILEPro Options
26926 @cindex TILEPro options
26927
26928 These @samp{-m} options are supported on the TILEPro:
26929
26930 @table @gcctabopt
26931 @item -mcpu=@var{name}
26932 @opindex mcpu
26933 Selects the type of CPU to be targeted. Currently the only supported
26934 type is @samp{tilepro}.
26935
26936 @item -m32
26937 @opindex m32
26938 Generate code for a 32-bit environment, which sets int, long, and
26939 pointer to 32 bits. This is the only supported behavior so the flag
26940 is essentially ignored.
26941 @end table
26942
26943 @node V850 Options
26944 @subsection V850 Options
26945 @cindex V850 Options
26946
26947 These @samp{-m} options are defined for V850 implementations:
26948
26949 @table @gcctabopt
26950 @item -mlong-calls
26951 @itemx -mno-long-calls
26952 @opindex mlong-calls
26953 @opindex mno-long-calls
26954 Treat all calls as being far away (near). If calls are assumed to be
26955 far away, the compiler always loads the function's address into a
26956 register, and calls indirect through the pointer.
26957
26958 @item -mno-ep
26959 @itemx -mep
26960 @opindex mno-ep
26961 @opindex mep
26962 Do not optimize (do optimize) basic blocks that use the same index
26963 pointer 4 or more times to copy pointer into the @code{ep} register, and
26964 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26965 option is on by default if you optimize.
26966
26967 @item -mno-prolog-function
26968 @itemx -mprolog-function
26969 @opindex mno-prolog-function
26970 @opindex mprolog-function
26971 Do not use (do use) external functions to save and restore registers
26972 at the prologue and epilogue of a function. The external functions
26973 are slower, but use less code space if more than one function saves
26974 the same number of registers. The @option{-mprolog-function} option
26975 is on by default if you optimize.
26976
26977 @item -mspace
26978 @opindex mspace
26979 Try to make the code as small as possible. At present, this just turns
26980 on the @option{-mep} and @option{-mprolog-function} options.
26981
26982 @item -mtda=@var{n}
26983 @opindex mtda
26984 Put static or global variables whose size is @var{n} bytes or less into
26985 the tiny data area that register @code{ep} points to. The tiny data
26986 area can hold up to 256 bytes in total (128 bytes for byte references).
26987
26988 @item -msda=@var{n}
26989 @opindex msda
26990 Put static or global variables whose size is @var{n} bytes or less into
26991 the small data area that register @code{gp} points to. The small data
26992 area can hold up to 64 kilobytes.
26993
26994 @item -mzda=@var{n}
26995 @opindex mzda
26996 Put static or global variables whose size is @var{n} bytes or less into
26997 the first 32 kilobytes of memory.
26998
26999 @item -mv850
27000 @opindex mv850
27001 Specify that the target processor is the V850.
27002
27003 @item -mv850e3v5
27004 @opindex mv850e3v5
27005 Specify that the target processor is the V850E3V5. The preprocessor
27006 constant @code{__v850e3v5__} is defined if this option is used.
27007
27008 @item -mv850e2v4
27009 @opindex mv850e2v4
27010 Specify that the target processor is the V850E3V5. This is an alias for
27011 the @option{-mv850e3v5} option.
27012
27013 @item -mv850e2v3
27014 @opindex mv850e2v3
27015 Specify that the target processor is the V850E2V3. The preprocessor
27016 constant @code{__v850e2v3__} is defined if this option is used.
27017
27018 @item -mv850e2
27019 @opindex mv850e2
27020 Specify that the target processor is the V850E2. The preprocessor
27021 constant @code{__v850e2__} is defined if this option is used.
27022
27023 @item -mv850e1
27024 @opindex mv850e1
27025 Specify that the target processor is the V850E1. The preprocessor
27026 constants @code{__v850e1__} and @code{__v850e__} are defined if
27027 this option is used.
27028
27029 @item -mv850es
27030 @opindex mv850es
27031 Specify that the target processor is the V850ES. This is an alias for
27032 the @option{-mv850e1} option.
27033
27034 @item -mv850e
27035 @opindex mv850e
27036 Specify that the target processor is the V850E@. The preprocessor
27037 constant @code{__v850e__} is defined if this option is used.
27038
27039 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27040 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27041 are defined then a default target processor is chosen and the
27042 relevant @samp{__v850*__} preprocessor constant is defined.
27043
27044 The preprocessor constants @code{__v850} and @code{__v851__} are always
27045 defined, regardless of which processor variant is the target.
27046
27047 @item -mdisable-callt
27048 @itemx -mno-disable-callt
27049 @opindex mdisable-callt
27050 @opindex mno-disable-callt
27051 This option suppresses generation of the @code{CALLT} instruction for the
27052 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27053 architecture.
27054
27055 This option is enabled by default when the RH850 ABI is
27056 in use (see @option{-mrh850-abi}), and disabled by default when the
27057 GCC ABI is in use. If @code{CALLT} instructions are being generated
27058 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27059
27060 @item -mrelax
27061 @itemx -mno-relax
27062 @opindex mrelax
27063 @opindex mno-relax
27064 Pass on (or do not pass on) the @option{-mrelax} command-line option
27065 to the assembler.
27066
27067 @item -mlong-jumps
27068 @itemx -mno-long-jumps
27069 @opindex mlong-jumps
27070 @opindex mno-long-jumps
27071 Disable (or re-enable) the generation of PC-relative jump instructions.
27072
27073 @item -msoft-float
27074 @itemx -mhard-float
27075 @opindex msoft-float
27076 @opindex mhard-float
27077 Disable (or re-enable) the generation of hardware floating point
27078 instructions. This option is only significant when the target
27079 architecture is @samp{V850E2V3} or higher. If hardware floating point
27080 instructions are being generated then the C preprocessor symbol
27081 @code{__FPU_OK__} is defined, otherwise the symbol
27082 @code{__NO_FPU__} is defined.
27083
27084 @item -mloop
27085 @opindex mloop
27086 Enables the use of the e3v5 LOOP instruction. The use of this
27087 instruction is not enabled by default when the e3v5 architecture is
27088 selected because its use is still experimental.
27089
27090 @item -mrh850-abi
27091 @itemx -mghs
27092 @opindex mrh850-abi
27093 @opindex mghs
27094 Enables support for the RH850 version of the V850 ABI. This is the
27095 default. With this version of the ABI the following rules apply:
27096
27097 @itemize
27098 @item
27099 Integer sized structures and unions are returned via a memory pointer
27100 rather than a register.
27101
27102 @item
27103 Large structures and unions (more than 8 bytes in size) are passed by
27104 value.
27105
27106 @item
27107 Functions are aligned to 16-bit boundaries.
27108
27109 @item
27110 The @option{-m8byte-align} command-line option is supported.
27111
27112 @item
27113 The @option{-mdisable-callt} command-line option is enabled by
27114 default. The @option{-mno-disable-callt} command-line option is not
27115 supported.
27116 @end itemize
27117
27118 When this version of the ABI is enabled the C preprocessor symbol
27119 @code{__V850_RH850_ABI__} is defined.
27120
27121 @item -mgcc-abi
27122 @opindex mgcc-abi
27123 Enables support for the old GCC version of the V850 ABI. With this
27124 version of the ABI the following rules apply:
27125
27126 @itemize
27127 @item
27128 Integer sized structures and unions are returned in register @code{r10}.
27129
27130 @item
27131 Large structures and unions (more than 8 bytes in size) are passed by
27132 reference.
27133
27134 @item
27135 Functions are aligned to 32-bit boundaries, unless optimizing for
27136 size.
27137
27138 @item
27139 The @option{-m8byte-align} command-line option is not supported.
27140
27141 @item
27142 The @option{-mdisable-callt} command-line option is supported but not
27143 enabled by default.
27144 @end itemize
27145
27146 When this version of the ABI is enabled the C preprocessor symbol
27147 @code{__V850_GCC_ABI__} is defined.
27148
27149 @item -m8byte-align
27150 @itemx -mno-8byte-align
27151 @opindex m8byte-align
27152 @opindex mno-8byte-align
27153 Enables support for @code{double} and @code{long long} types to be
27154 aligned on 8-byte boundaries. The default is to restrict the
27155 alignment of all objects to at most 4-bytes. When
27156 @option{-m8byte-align} is in effect the C preprocessor symbol
27157 @code{__V850_8BYTE_ALIGN__} is defined.
27158
27159 @item -mbig-switch
27160 @opindex mbig-switch
27161 Generate code suitable for big switch tables. Use this option only if
27162 the assembler/linker complain about out of range branches within a switch
27163 table.
27164
27165 @item -mapp-regs
27166 @opindex mapp-regs
27167 This option causes r2 and r5 to be used in the code generated by
27168 the compiler. This setting is the default.
27169
27170 @item -mno-app-regs
27171 @opindex mno-app-regs
27172 This option causes r2 and r5 to be treated as fixed registers.
27173
27174 @end table
27175
27176 @node VAX Options
27177 @subsection VAX Options
27178 @cindex VAX options
27179
27180 These @samp{-m} options are defined for the VAX:
27181
27182 @table @gcctabopt
27183 @item -munix
27184 @opindex munix
27185 Do not output certain jump instructions (@code{aobleq} and so on)
27186 that the Unix assembler for the VAX cannot handle across long
27187 ranges.
27188
27189 @item -mgnu
27190 @opindex mgnu
27191 Do output those jump instructions, on the assumption that the
27192 GNU assembler is being used.
27193
27194 @item -mg
27195 @opindex mg
27196 Output code for G-format floating-point numbers instead of D-format.
27197 @end table
27198
27199 @node Visium Options
27200 @subsection Visium Options
27201 @cindex Visium options
27202
27203 @table @gcctabopt
27204
27205 @item -mdebug
27206 @opindex mdebug
27207 A program which performs file I/O and is destined to run on an MCM target
27208 should be linked with this option. It causes the libraries libc.a and
27209 libdebug.a to be linked. The program should be run on the target under
27210 the control of the GDB remote debugging stub.
27211
27212 @item -msim
27213 @opindex msim
27214 A program which performs file I/O and is destined to run on the simulator
27215 should be linked with option. This causes libraries libc.a and libsim.a to
27216 be linked.
27217
27218 @item -mfpu
27219 @itemx -mhard-float
27220 @opindex mfpu
27221 @opindex mhard-float
27222 Generate code containing floating-point instructions. This is the
27223 default.
27224
27225 @item -mno-fpu
27226 @itemx -msoft-float
27227 @opindex mno-fpu
27228 @opindex msoft-float
27229 Generate code containing library calls for floating-point.
27230
27231 @option{-msoft-float} changes the calling convention in the output file;
27232 therefore, it is only useful if you compile @emph{all} of a program with
27233 this option. In particular, you need to compile @file{libgcc.a}, the
27234 library that comes with GCC, with @option{-msoft-float} in order for
27235 this to work.
27236
27237 @item -mcpu=@var{cpu_type}
27238 @opindex mcpu
27239 Set the instruction set, register set, and instruction scheduling parameters
27240 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27241 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27242
27243 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27244
27245 By default (unless configured otherwise), GCC generates code for the GR5
27246 variant of the Visium architecture.
27247
27248 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27249 architecture. The only difference from GR5 code is that the compiler will
27250 generate block move instructions.
27251
27252 @item -mtune=@var{cpu_type}
27253 @opindex mtune
27254 Set the instruction scheduling parameters for machine type @var{cpu_type},
27255 but do not set the instruction set or register set that the option
27256 @option{-mcpu=@var{cpu_type}} would.
27257
27258 @item -msv-mode
27259 @opindex msv-mode
27260 Generate code for the supervisor mode, where there are no restrictions on
27261 the access to general registers. This is the default.
27262
27263 @item -muser-mode
27264 @opindex muser-mode
27265 Generate code for the user mode, where the access to some general registers
27266 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27267 mode; on the GR6, only registers r29 to r31 are affected.
27268 @end table
27269
27270 @node VMS Options
27271 @subsection VMS Options
27272
27273 These @samp{-m} options are defined for the VMS implementations:
27274
27275 @table @gcctabopt
27276 @item -mvms-return-codes
27277 @opindex mvms-return-codes
27278 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27279 condition (e.g.@: error) codes.
27280
27281 @item -mdebug-main=@var{prefix}
27282 @opindex mdebug-main=@var{prefix}
27283 Flag the first routine whose name starts with @var{prefix} as the main
27284 routine for the debugger.
27285
27286 @item -mmalloc64
27287 @opindex mmalloc64
27288 Default to 64-bit memory allocation routines.
27289
27290 @item -mpointer-size=@var{size}
27291 @opindex mpointer-size=@var{size}
27292 Set the default size of pointers. Possible options for @var{size} are
27293 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27294 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27295 The later option disables @code{pragma pointer_size}.
27296 @end table
27297
27298 @node VxWorks Options
27299 @subsection VxWorks Options
27300 @cindex VxWorks Options
27301
27302 The options in this section are defined for all VxWorks targets.
27303 Options specific to the target hardware are listed with the other
27304 options for that target.
27305
27306 @table @gcctabopt
27307 @item -mrtp
27308 @opindex mrtp
27309 GCC can generate code for both VxWorks kernels and real time processes
27310 (RTPs). This option switches from the former to the latter. It also
27311 defines the preprocessor macro @code{__RTP__}.
27312
27313 @item -non-static
27314 @opindex non-static
27315 Link an RTP executable against shared libraries rather than static
27316 libraries. The options @option{-static} and @option{-shared} can
27317 also be used for RTPs (@pxref{Link Options}); @option{-static}
27318 is the default.
27319
27320 @item -Bstatic
27321 @itemx -Bdynamic
27322 @opindex Bstatic
27323 @opindex Bdynamic
27324 These options are passed down to the linker. They are defined for
27325 compatibility with Diab.
27326
27327 @item -Xbind-lazy
27328 @opindex Xbind-lazy
27329 Enable lazy binding of function calls. This option is equivalent to
27330 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27331
27332 @item -Xbind-now
27333 @opindex Xbind-now
27334 Disable lazy binding of function calls. This option is the default and
27335 is defined for compatibility with Diab.
27336 @end table
27337
27338 @node x86 Options
27339 @subsection x86 Options
27340 @cindex x86 Options
27341
27342 These @samp{-m} options are defined for the x86 family of computers.
27343
27344 @table @gcctabopt
27345
27346 @item -march=@var{cpu-type}
27347 @opindex march
27348 Generate instructions for the machine type @var{cpu-type}. In contrast to
27349 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27350 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27351 to generate code that may not run at all on processors other than the one
27352 indicated. Specifying @option{-march=@var{cpu-type}} implies
27353 @option{-mtune=@var{cpu-type}}.
27354
27355 The choices for @var{cpu-type} are:
27356
27357 @table @samp
27358 @item native
27359 This selects the CPU to generate code for at compilation time by determining
27360 the processor type of the compiling machine. Using @option{-march=native}
27361 enables all instruction subsets supported by the local machine (hence
27362 the result might not run on different machines). Using @option{-mtune=native}
27363 produces code optimized for the local machine under the constraints
27364 of the selected instruction set.
27365
27366 @item x86-64
27367 A generic CPU with 64-bit extensions.
27368
27369 @item i386
27370 Original Intel i386 CPU@.
27371
27372 @item i486
27373 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27374
27375 @item i586
27376 @itemx pentium
27377 Intel Pentium CPU with no MMX support.
27378
27379 @item lakemont
27380 Intel Lakemont MCU, based on Intel Pentium CPU.
27381
27382 @item pentium-mmx
27383 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27384
27385 @item pentiumpro
27386 Intel Pentium Pro CPU@.
27387
27388 @item i686
27389 When used with @option{-march}, the Pentium Pro
27390 instruction set is used, so the code runs on all i686 family chips.
27391 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27392
27393 @item pentium2
27394 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27395 support.
27396
27397 @item pentium3
27398 @itemx pentium3m
27399 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27400 set support.
27401
27402 @item pentium-m
27403 Intel Pentium M; low-power version of Intel Pentium III CPU
27404 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27405
27406 @item pentium4
27407 @itemx pentium4m
27408 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27409
27410 @item prescott
27411 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27412 set support.
27413
27414 @item nocona
27415 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27416 SSE2 and SSE3 instruction set support.
27417
27418 @item core2
27419 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27420 instruction set support.
27421
27422 @item nehalem
27423 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27424 SSE4.1, SSE4.2 and POPCNT instruction set support.
27425
27426 @item westmere
27427 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27428 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27429
27430 @item sandybridge
27431 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27432 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27433
27434 @item ivybridge
27435 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27436 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27437 instruction set support.
27438
27439 @item haswell
27440 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27441 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27442 BMI, BMI2 and F16C instruction set support.
27443
27444 @item broadwell
27445 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27446 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27447 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27448
27449 @item skylake
27450 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27451 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27452 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27453 XSAVES instruction set support.
27454
27455 @item bonnell
27456 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27457 instruction set support.
27458
27459 @item silvermont
27460 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27461 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27462
27463 @item goldmont
27464 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27465 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27466 instruction set support.
27467
27468 @item goldmont-plus
27469 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27470 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27471 PTWRITE, RDPID, SGX and UMIP instruction set support.
27472
27473 @item tremont
27474 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27475 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27476 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27477
27478 @item knl
27479 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27480 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27481 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27482 AVX512CD instruction set support.
27483
27484 @item knm
27485 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27486 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27487 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27488 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27489
27490 @item skylake-avx512
27491 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27492 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27493 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27494 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27495
27496 @item cannonlake
27497 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27498 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27499 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27500 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27501 AVX512IFMA, SHA and UMIP instruction set support.
27502
27503 @item icelake-client
27504 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27505 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27506 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27507 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27508 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27509 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27510
27511 @item icelake-server
27512 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27513 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27514 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27515 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27516 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27517 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27518 set support.
27519
27520 @item cascadelake
27521 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27522 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27523 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27524 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27525
27526 @item cooperlake
27527 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27528 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27529 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27530 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27531 set support.
27532
27533 @item tigerlake
27534 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27535 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27536 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27537 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27538 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27539 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27540 set support.
27541
27542 @item k6
27543 AMD K6 CPU with MMX instruction set support.
27544
27545 @item k6-2
27546 @itemx k6-3
27547 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27548
27549 @item athlon
27550 @itemx athlon-tbird
27551 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27552 support.
27553
27554 @item athlon-4
27555 @itemx athlon-xp
27556 @itemx athlon-mp
27557 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27558 instruction set support.
27559
27560 @item k8
27561 @itemx opteron
27562 @itemx athlon64
27563 @itemx athlon-fx
27564 Processors based on the AMD K8 core with x86-64 instruction set support,
27565 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27566 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27567 instruction set extensions.)
27568
27569 @item k8-sse3
27570 @itemx opteron-sse3
27571 @itemx athlon64-sse3
27572 Improved versions of AMD K8 cores with SSE3 instruction set support.
27573
27574 @item amdfam10
27575 @itemx barcelona
27576 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27577 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27578 instruction set extensions.)
27579
27580 @item bdver1
27581 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27582 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27583 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27584 @item bdver2
27585 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27586 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27587 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27588 extensions.)
27589 @item bdver3
27590 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27591 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27592 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27593 64-bit instruction set extensions.
27594 @item bdver4
27595 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27596 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27597 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27598 SSE4.2, ABM and 64-bit instruction set extensions.
27599
27600 @item znver1
27601 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27602 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27603 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27604 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27605 instruction set extensions.
27606 @item znver2
27607 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27608 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27609 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27610 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27611 instruction set extensions.)
27612
27613
27614 @item btver1
27615 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27616 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27617 instruction set extensions.)
27618
27619 @item btver2
27620 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27621 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27622 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27623
27624 @item winchip-c6
27625 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27626 set support.
27627
27628 @item winchip2
27629 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27630 instruction set support.
27631
27632 @item c3
27633 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27634 (No scheduling is implemented for this chip.)
27635
27636 @item c3-2
27637 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27638 (No scheduling is implemented for this chip.)
27639
27640 @item c7
27641 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27642 (No scheduling is implemented for this chip.)
27643
27644 @item samuel-2
27645 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27646 (No scheduling is implemented for this chip.)
27647
27648 @item nehemiah
27649 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27650 (No scheduling is implemented for this chip.)
27651
27652 @item esther
27653 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27654 (No scheduling is implemented for this chip.)
27655
27656 @item eden-x2
27657 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27658 (No scheduling is implemented for this chip.)
27659
27660 @item eden-x4
27661 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27662 AVX and AVX2 instruction set support.
27663 (No scheduling is implemented for this chip.)
27664
27665 @item nano
27666 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27667 instruction set support.
27668 (No scheduling is implemented for this chip.)
27669
27670 @item nano-1000
27671 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27672 instruction set support.
27673 (No scheduling is implemented for this chip.)
27674
27675 @item nano-2000
27676 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27677 instruction set support.
27678 (No scheduling is implemented for this chip.)
27679
27680 @item nano-3000
27681 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27682 instruction set support.
27683 (No scheduling is implemented for this chip.)
27684
27685 @item nano-x2
27686 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27687 instruction set support.
27688 (No scheduling is implemented for this chip.)
27689
27690 @item nano-x4
27691 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27692 instruction set support.
27693 (No scheduling is implemented for this chip.)
27694
27695 @item geode
27696 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27697 @end table
27698
27699 @item -mtune=@var{cpu-type}
27700 @opindex mtune
27701 Tune to @var{cpu-type} everything applicable about the generated code, except
27702 for the ABI and the set of available instructions.
27703 While picking a specific @var{cpu-type} schedules things appropriately
27704 for that particular chip, the compiler does not generate any code that
27705 cannot run on the default machine type unless you use a
27706 @option{-march=@var{cpu-type}} option.
27707 For example, if GCC is configured for i686-pc-linux-gnu
27708 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27709 but still runs on i686 machines.
27710
27711 The choices for @var{cpu-type} are the same as for @option{-march}.
27712 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27713
27714 @table @samp
27715 @item generic
27716 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27717 If you know the CPU on which your code will run, then you should use
27718 the corresponding @option{-mtune} or @option{-march} option instead of
27719 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27720 of your application will have, then you should use this option.
27721
27722 As new processors are deployed in the marketplace, the behavior of this
27723 option will change. Therefore, if you upgrade to a newer version of
27724 GCC, code generation controlled by this option will change to reflect
27725 the processors
27726 that are most common at the time that version of GCC is released.
27727
27728 There is no @option{-march=generic} option because @option{-march}
27729 indicates the instruction set the compiler can use, and there is no
27730 generic instruction set applicable to all processors. In contrast,
27731 @option{-mtune} indicates the processor (or, in this case, collection of
27732 processors) for which the code is optimized.
27733
27734 @item intel
27735 Produce code optimized for the most current Intel processors, which are
27736 Haswell and Silvermont for this version of GCC. If you know the CPU
27737 on which your code will run, then you should use the corresponding
27738 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27739 But, if you want your application performs better on both Haswell and
27740 Silvermont, then you should use this option.
27741
27742 As new Intel processors are deployed in the marketplace, the behavior of
27743 this option will change. Therefore, if you upgrade to a newer version of
27744 GCC, code generation controlled by this option will change to reflect
27745 the most current Intel processors at the time that version of GCC is
27746 released.
27747
27748 There is no @option{-march=intel} option because @option{-march} indicates
27749 the instruction set the compiler can use, and there is no common
27750 instruction set applicable to all processors. In contrast,
27751 @option{-mtune} indicates the processor (or, in this case, collection of
27752 processors) for which the code is optimized.
27753 @end table
27754
27755 @item -mcpu=@var{cpu-type}
27756 @opindex mcpu
27757 A deprecated synonym for @option{-mtune}.
27758
27759 @item -mfpmath=@var{unit}
27760 @opindex mfpmath
27761 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27762 for @var{unit} are:
27763
27764 @table @samp
27765 @item 387
27766 Use the standard 387 floating-point coprocessor present on the majority of chips and
27767 emulated otherwise. Code compiled with this option runs almost everywhere.
27768 The temporary results are computed in 80-bit precision instead of the precision
27769 specified by the type, resulting in slightly different results compared to most
27770 of other chips. See @option{-ffloat-store} for more detailed description.
27771
27772 This is the default choice for non-Darwin x86-32 targets.
27773
27774 @item sse
27775 Use scalar floating-point instructions present in the SSE instruction set.
27776 This instruction set is supported by Pentium III and newer chips,
27777 and in the AMD line
27778 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27779 instruction set supports only single-precision arithmetic, thus the double and
27780 extended-precision arithmetic are still done using 387. A later version, present
27781 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27782 arithmetic too.
27783
27784 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27785 or @option{-msse2} switches to enable SSE extensions and make this option
27786 effective. For the x86-64 compiler, these extensions are enabled by default.
27787
27788 The resulting code should be considerably faster in the majority of cases and avoid
27789 the numerical instability problems of 387 code, but may break some existing
27790 code that expects temporaries to be 80 bits.
27791
27792 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27793 and the default choice for x86-32 targets with the SSE2 instruction set
27794 when @option{-ffast-math} is enabled.
27795
27796 @item sse,387
27797 @itemx sse+387
27798 @itemx both
27799 Attempt to utilize both instruction sets at once. This effectively doubles the
27800 amount of available registers, and on chips with separate execution units for
27801 387 and SSE the execution resources too. Use this option with care, as it is
27802 still experimental, because the GCC register allocator does not model separate
27803 functional units well, resulting in unstable performance.
27804 @end table
27805
27806 @item -masm=@var{dialect}
27807 @opindex masm=@var{dialect}
27808 Output assembly instructions using selected @var{dialect}. Also affects
27809 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27810 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27811 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27812 not support @samp{intel}.
27813
27814 @item -mieee-fp
27815 @itemx -mno-ieee-fp
27816 @opindex mieee-fp
27817 @opindex mno-ieee-fp
27818 Control whether or not the compiler uses IEEE floating-point
27819 comparisons. These correctly handle the case where the result of a
27820 comparison is unordered.
27821
27822 @item -m80387
27823 @itemx -mhard-float
27824 @opindex 80387
27825 @opindex mhard-float
27826 Generate output containing 80387 instructions for floating point.
27827
27828 @item -mno-80387
27829 @itemx -msoft-float
27830 @opindex no-80387
27831 @opindex msoft-float
27832 Generate output containing library calls for floating point.
27833
27834 @strong{Warning:} the requisite libraries are not part of GCC@.
27835 Normally the facilities of the machine's usual C compiler are used, but
27836 this cannot be done directly in cross-compilation. You must make your
27837 own arrangements to provide suitable library functions for
27838 cross-compilation.
27839
27840 On machines where a function returns floating-point results in the 80387
27841 register stack, some floating-point opcodes may be emitted even if
27842 @option{-msoft-float} is used.
27843
27844 @item -mno-fp-ret-in-387
27845 @opindex mno-fp-ret-in-387
27846 @opindex mfp-ret-in-387
27847 Do not use the FPU registers for return values of functions.
27848
27849 The usual calling convention has functions return values of types
27850 @code{float} and @code{double} in an FPU register, even if there
27851 is no FPU@. The idea is that the operating system should emulate
27852 an FPU@.
27853
27854 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27855 in ordinary CPU registers instead.
27856
27857 @item -mno-fancy-math-387
27858 @opindex mno-fancy-math-387
27859 @opindex mfancy-math-387
27860 Some 387 emulators do not support the @code{sin}, @code{cos} and
27861 @code{sqrt} instructions for the 387. Specify this option to avoid
27862 generating those instructions.
27863 This option is overridden when @option{-march}
27864 indicates that the target CPU always has an FPU and so the
27865 instruction does not need emulation. These
27866 instructions are not generated unless you also use the
27867 @option{-funsafe-math-optimizations} switch.
27868
27869 @item -malign-double
27870 @itemx -mno-align-double
27871 @opindex malign-double
27872 @opindex mno-align-double
27873 Control whether GCC aligns @code{double}, @code{long double}, and
27874 @code{long long} variables on a two-word boundary or a one-word
27875 boundary. Aligning @code{double} variables on a two-word boundary
27876 produces code that runs somewhat faster on a Pentium at the
27877 expense of more memory.
27878
27879 On x86-64, @option{-malign-double} is enabled by default.
27880
27881 @strong{Warning:} if you use the @option{-malign-double} switch,
27882 structures containing the above types are aligned differently than
27883 the published application binary interface specifications for the x86-32
27884 and are not binary compatible with structures in code compiled
27885 without that switch.
27886
27887 @item -m96bit-long-double
27888 @itemx -m128bit-long-double
27889 @opindex m96bit-long-double
27890 @opindex m128bit-long-double
27891 These switches control the size of @code{long double} type. The x86-32
27892 application binary interface specifies the size to be 96 bits,
27893 so @option{-m96bit-long-double} is the default in 32-bit mode.
27894
27895 Modern architectures (Pentium and newer) prefer @code{long double}
27896 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27897 conforming to the ABI, this is not possible. So specifying
27898 @option{-m128bit-long-double} aligns @code{long double}
27899 to a 16-byte boundary by padding the @code{long double} with an additional
27900 32-bit zero.
27901
27902 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27903 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27904
27905 Notice that neither of these options enable any extra precision over the x87
27906 standard of 80 bits for a @code{long double}.
27907
27908 @strong{Warning:} if you override the default value for your target ABI, this
27909 changes the size of
27910 structures and arrays containing @code{long double} variables,
27911 as well as modifying the function calling convention for functions taking
27912 @code{long double}. Hence they are not binary-compatible
27913 with code compiled without that switch.
27914
27915 @item -mlong-double-64
27916 @itemx -mlong-double-80
27917 @itemx -mlong-double-128
27918 @opindex mlong-double-64
27919 @opindex mlong-double-80
27920 @opindex mlong-double-128
27921 These switches control the size of @code{long double} type. A size
27922 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27923 type. This is the default for 32-bit Bionic C library. A size
27924 of 128 bits makes the @code{long double} type equivalent to the
27925 @code{__float128} type. This is the default for 64-bit Bionic C library.
27926
27927 @strong{Warning:} if you override the default value for your target ABI, this
27928 changes the size of
27929 structures and arrays containing @code{long double} variables,
27930 as well as modifying the function calling convention for functions taking
27931 @code{long double}. Hence they are not binary-compatible
27932 with code compiled without that switch.
27933
27934 @item -malign-data=@var{type}
27935 @opindex malign-data
27936 Control how GCC aligns variables. Supported values for @var{type} are
27937 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27938 and earlier, @samp{abi} uses alignment value as specified by the
27939 psABI, and @samp{cacheline} uses increased alignment value to match
27940 the cache line size. @samp{compat} is the default.
27941
27942 @item -mlarge-data-threshold=@var{threshold}
27943 @opindex mlarge-data-threshold
27944 When @option{-mcmodel=medium} is specified, data objects larger than
27945 @var{threshold} are placed in the large data section. This value must be the
27946 same across all objects linked into the binary, and defaults to 65535.
27947
27948 @item -mrtd
27949 @opindex mrtd
27950 Use a different function-calling convention, in which functions that
27951 take a fixed number of arguments return with the @code{ret @var{num}}
27952 instruction, which pops their arguments while returning. This saves one
27953 instruction in the caller since there is no need to pop the arguments
27954 there.
27955
27956 You can specify that an individual function is called with this calling
27957 sequence with the function attribute @code{stdcall}. You can also
27958 override the @option{-mrtd} option by using the function attribute
27959 @code{cdecl}. @xref{Function Attributes}.
27960
27961 @strong{Warning:} this calling convention is incompatible with the one
27962 normally used on Unix, so you cannot use it if you need to call
27963 libraries compiled with the Unix compiler.
27964
27965 Also, you must provide function prototypes for all functions that
27966 take variable numbers of arguments (including @code{printf});
27967 otherwise incorrect code is generated for calls to those
27968 functions.
27969
27970 In addition, seriously incorrect code results if you call a
27971 function with too many arguments. (Normally, extra arguments are
27972 harmlessly ignored.)
27973
27974 @item -mregparm=@var{num}
27975 @opindex mregparm
27976 Control how many registers are used to pass integer arguments. By
27977 default, no registers are used to pass arguments, and at most 3
27978 registers can be used. You can control this behavior for a specific
27979 function by using the function attribute @code{regparm}.
27980 @xref{Function Attributes}.
27981
27982 @strong{Warning:} if you use this switch, and
27983 @var{num} is nonzero, then you must build all modules with the same
27984 value, including any libraries. This includes the system libraries and
27985 startup modules.
27986
27987 @item -msseregparm
27988 @opindex msseregparm
27989 Use SSE register passing conventions for float and double arguments
27990 and return values. You can control this behavior for a specific
27991 function by using the function attribute @code{sseregparm}.
27992 @xref{Function Attributes}.
27993
27994 @strong{Warning:} if you use this switch then you must build all
27995 modules with the same value, including any libraries. This includes
27996 the system libraries and startup modules.
27997
27998 @item -mvect8-ret-in-mem
27999 @opindex mvect8-ret-in-mem
28000 Return 8-byte vectors in memory instead of MMX registers. This is the
28001 default on VxWorks to match the ABI of the Sun Studio compilers until
28002 version 12. @emph{Only} use this option if you need to remain
28003 compatible with existing code produced by those previous compiler
28004 versions or older versions of GCC@.
28005
28006 @item -mpc32
28007 @itemx -mpc64
28008 @itemx -mpc80
28009 @opindex mpc32
28010 @opindex mpc64
28011 @opindex mpc80
28012
28013 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28014 is specified, the significands of results of floating-point operations are
28015 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28016 significands of results of floating-point operations to 53 bits (double
28017 precision) and @option{-mpc80} rounds the significands of results of
28018 floating-point operations to 64 bits (extended double precision), which is
28019 the default. When this option is used, floating-point operations in higher
28020 precisions are not available to the programmer without setting the FPU
28021 control word explicitly.
28022
28023 Setting the rounding of floating-point operations to less than the default
28024 80 bits can speed some programs by 2% or more. Note that some mathematical
28025 libraries assume that extended-precision (80-bit) floating-point operations
28026 are enabled by default; routines in such libraries could suffer significant
28027 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28028 when this option is used to set the precision to less than extended precision.
28029
28030 @item -mstackrealign
28031 @opindex mstackrealign
28032 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28033 option generates an alternate prologue and epilogue that realigns the
28034 run-time stack if necessary. This supports mixing legacy codes that keep
28035 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28036 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28037 applicable to individual functions.
28038
28039 @item -mpreferred-stack-boundary=@var{num}
28040 @opindex mpreferred-stack-boundary
28041 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28042 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28043 the default is 4 (16 bytes or 128 bits).
28044
28045 @strong{Warning:} When generating code for the x86-64 architecture with
28046 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28047 used to keep the stack boundary aligned to 8 byte boundary. Since
28048 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28049 intended to be used in controlled environment where stack space is
28050 important limitation. This option leads to wrong code when functions
28051 compiled with 16 byte stack alignment (such as functions from a standard
28052 library) are called with misaligned stack. In this case, SSE
28053 instructions may lead to misaligned memory access traps. In addition,
28054 variable arguments are handled incorrectly for 16 byte aligned
28055 objects (including x87 long double and __int128), leading to wrong
28056 results. You must build all modules with
28057 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28058 includes the system libraries and startup modules.
28059
28060 @item -mincoming-stack-boundary=@var{num}
28061 @opindex mincoming-stack-boundary
28062 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28063 boundary. If @option{-mincoming-stack-boundary} is not specified,
28064 the one specified by @option{-mpreferred-stack-boundary} is used.
28065
28066 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28067 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28068 suffer significant run time performance penalties. On Pentium III, the
28069 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28070 properly if it is not 16-byte aligned.
28071
28072 To ensure proper alignment of this values on the stack, the stack boundary
28073 must be as aligned as that required by any value stored on the stack.
28074 Further, every function must be generated such that it keeps the stack
28075 aligned. Thus calling a function compiled with a higher preferred
28076 stack boundary from a function compiled with a lower preferred stack
28077 boundary most likely misaligns the stack. It is recommended that
28078 libraries that use callbacks always use the default setting.
28079
28080 This extra alignment does consume extra stack space, and generally
28081 increases code size. Code that is sensitive to stack space usage, such
28082 as embedded systems and operating system kernels, may want to reduce the
28083 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28084
28085 @need 200
28086 @item -mmmx
28087 @opindex mmmx
28088 @need 200
28089 @itemx -msse
28090 @opindex msse
28091 @need 200
28092 @itemx -msse2
28093 @opindex msse2
28094 @need 200
28095 @itemx -msse3
28096 @opindex msse3
28097 @need 200
28098 @itemx -mssse3
28099 @opindex mssse3
28100 @need 200
28101 @itemx -msse4
28102 @opindex msse4
28103 @need 200
28104 @itemx -msse4a
28105 @opindex msse4a
28106 @need 200
28107 @itemx -msse4.1
28108 @opindex msse4.1
28109 @need 200
28110 @itemx -msse4.2
28111 @opindex msse4.2
28112 @need 200
28113 @itemx -mavx
28114 @opindex mavx
28115 @need 200
28116 @itemx -mavx2
28117 @opindex mavx2
28118 @need 200
28119 @itemx -mavx512f
28120 @opindex mavx512f
28121 @need 200
28122 @itemx -mavx512pf
28123 @opindex mavx512pf
28124 @need 200
28125 @itemx -mavx512er
28126 @opindex mavx512er
28127 @need 200
28128 @itemx -mavx512cd
28129 @opindex mavx512cd
28130 @need 200
28131 @itemx -mavx512vl
28132 @opindex mavx512vl
28133 @need 200
28134 @itemx -mavx512bw
28135 @opindex mavx512bw
28136 @need 200
28137 @itemx -mavx512dq
28138 @opindex mavx512dq
28139 @need 200
28140 @itemx -mavx512ifma
28141 @opindex mavx512ifma
28142 @need 200
28143 @itemx -mavx512vbmi
28144 @opindex mavx512vbmi
28145 @need 200
28146 @itemx -msha
28147 @opindex msha
28148 @need 200
28149 @itemx -maes
28150 @opindex maes
28151 @need 200
28152 @itemx -mpclmul
28153 @opindex mpclmul
28154 @need 200
28155 @itemx -mclflushopt
28156 @opindex mclflushopt
28157 @need 200
28158 @itemx -mclwb
28159 @opindex mclwb
28160 @need 200
28161 @itemx -mfsgsbase
28162 @opindex mfsgsbase
28163 @need 200
28164 @itemx -mptwrite
28165 @opindex mptwrite
28166 @need 200
28167 @itemx -mrdrnd
28168 @opindex mrdrnd
28169 @need 200
28170 @itemx -mf16c
28171 @opindex mf16c
28172 @need 200
28173 @itemx -mfma
28174 @opindex mfma
28175 @need 200
28176 @itemx -mpconfig
28177 @opindex mpconfig
28178 @need 200
28179 @itemx -mwbnoinvd
28180 @opindex mwbnoinvd
28181 @need 200
28182 @itemx -mfma4
28183 @opindex mfma4
28184 @need 200
28185 @itemx -mprfchw
28186 @opindex mprfchw
28187 @need 200
28188 @itemx -mrdpid
28189 @opindex mrdpid
28190 @need 200
28191 @itemx -mprefetchwt1
28192 @opindex mprefetchwt1
28193 @need 200
28194 @itemx -mrdseed
28195 @opindex mrdseed
28196 @need 200
28197 @itemx -msgx
28198 @opindex msgx
28199 @need 200
28200 @itemx -mxop
28201 @opindex mxop
28202 @need 200
28203 @itemx -mlwp
28204 @opindex mlwp
28205 @need 200
28206 @itemx -m3dnow
28207 @opindex m3dnow
28208 @need 200
28209 @itemx -m3dnowa
28210 @opindex m3dnowa
28211 @need 200
28212 @itemx -mpopcnt
28213 @opindex mpopcnt
28214 @need 200
28215 @itemx -mabm
28216 @opindex mabm
28217 @need 200
28218 @itemx -madx
28219 @opindex madx
28220 @need 200
28221 @itemx -mbmi
28222 @opindex mbmi
28223 @need 200
28224 @itemx -mbmi2
28225 @opindex mbmi2
28226 @need 200
28227 @itemx -mlzcnt
28228 @opindex mlzcnt
28229 @need 200
28230 @itemx -mfxsr
28231 @opindex mfxsr
28232 @need 200
28233 @itemx -mxsave
28234 @opindex mxsave
28235 @need 200
28236 @itemx -mxsaveopt
28237 @opindex mxsaveopt
28238 @need 200
28239 @itemx -mxsavec
28240 @opindex mxsavec
28241 @need 200
28242 @itemx -mxsaves
28243 @opindex mxsaves
28244 @need 200
28245 @itemx -mrtm
28246 @opindex mrtm
28247 @need 200
28248 @itemx -mhle
28249 @opindex mhle
28250 @need 200
28251 @itemx -mtbm
28252 @opindex mtbm
28253 @need 200
28254 @itemx -mmwaitx
28255 @opindex mmwaitx
28256 @need 200
28257 @itemx -mclzero
28258 @opindex mclzero
28259 @need 200
28260 @itemx -mpku
28261 @opindex mpku
28262 @need 200
28263 @itemx -mavx512vbmi2
28264 @opindex mavx512vbmi2
28265 @need 200
28266 @itemx -mavx512bf16
28267 @opindex mavx512bf16
28268 @need 200
28269 @itemx -mgfni
28270 @opindex mgfni
28271 @need 200
28272 @itemx -mvaes
28273 @opindex mvaes
28274 @need 200
28275 @itemx -mwaitpkg
28276 @opindex mwaitpkg
28277 @need 200
28278 @itemx -mvpclmulqdq
28279 @opindex mvpclmulqdq
28280 @need 200
28281 @itemx -mavx512bitalg
28282 @opindex mavx512bitalg
28283 @need 200
28284 @itemx -mmovdiri
28285 @opindex mmovdiri
28286 @need 200
28287 @itemx -mmovdir64b
28288 @opindex mmovdir64b
28289 @need 200
28290 @itemx -menqcmd
28291 @opindex menqcmd
28292 @need 200
28293 @itemx -mavx512vpopcntdq
28294 @opindex mavx512vpopcntdq
28295 @need 200
28296 @itemx -mavx512vp2intersect
28297 @opindex mavx512vp2intersect
28298 @need 200
28299 @itemx -mavx5124fmaps
28300 @opindex mavx5124fmaps
28301 @need 200
28302 @itemx -mavx512vnni
28303 @opindex mavx512vnni
28304 @need 200
28305 @itemx -mavx5124vnniw
28306 @opindex mavx5124vnniw
28307 @need 200
28308 @itemx -mcldemote
28309 @opindex mcldemote
28310 These switches enable the use of instructions in the MMX, SSE,
28311 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28312 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28313 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28314 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28315 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28316 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28317 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28318 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28319 extended instruction sets. Each has a corresponding @option{-mno-} option to
28320 disable use of these instructions.
28321
28322 These extensions are also available as built-in functions: see
28323 @ref{x86 Built-in Functions}, for details of the functions enabled and
28324 disabled by these switches.
28325
28326 To generate SSE/SSE2 instructions automatically from floating-point
28327 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28328
28329 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28330 generates new AVX instructions or AVX equivalence for all SSEx instructions
28331 when needed.
28332
28333 These options enable GCC to use these extended instructions in
28334 generated code, even without @option{-mfpmath=sse}. Applications that
28335 perform run-time CPU detection must compile separate files for each
28336 supported architecture, using the appropriate flags. In particular,
28337 the file containing the CPU detection code should be compiled without
28338 these options.
28339
28340 @item -mdump-tune-features
28341 @opindex mdump-tune-features
28342 This option instructs GCC to dump the names of the x86 performance
28343 tuning features and default settings. The names can be used in
28344 @option{-mtune-ctrl=@var{feature-list}}.
28345
28346 @item -mtune-ctrl=@var{feature-list}
28347 @opindex mtune-ctrl=@var{feature-list}
28348 This option is used to do fine grain control of x86 code generation features.
28349 @var{feature-list} is a comma separated list of @var{feature} names. See also
28350 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28351 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28352 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28353 developers. Using it may lead to code paths not covered by testing and can
28354 potentially result in compiler ICEs or runtime errors.
28355
28356 @item -mno-default
28357 @opindex mno-default
28358 This option instructs GCC to turn off all tunable features. See also
28359 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28360
28361 @item -mcld
28362 @opindex mcld
28363 This option instructs GCC to emit a @code{cld} instruction in the prologue
28364 of functions that use string instructions. String instructions depend on
28365 the DF flag to select between autoincrement or autodecrement mode. While the
28366 ABI specifies the DF flag to be cleared on function entry, some operating
28367 systems violate this specification by not clearing the DF flag in their
28368 exception dispatchers. The exception handler can be invoked with the DF flag
28369 set, which leads to wrong direction mode when string instructions are used.
28370 This option can be enabled by default on 32-bit x86 targets by configuring
28371 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28372 instructions can be suppressed with the @option{-mno-cld} compiler option
28373 in this case.
28374
28375 @item -mvzeroupper
28376 @opindex mvzeroupper
28377 This option instructs GCC to emit a @code{vzeroupper} instruction
28378 before a transfer of control flow out of the function to minimize
28379 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28380 intrinsics.
28381
28382 @item -mprefer-avx128
28383 @opindex mprefer-avx128
28384 This option instructs GCC to use 128-bit AVX instructions instead of
28385 256-bit AVX instructions in the auto-vectorizer.
28386
28387 @item -mprefer-vector-width=@var{opt}
28388 @opindex mprefer-vector-width
28389 This option instructs GCC to use @var{opt}-bit vector width in instructions
28390 instead of default on the selected platform.
28391
28392 @table @samp
28393 @item none
28394 No extra limitations applied to GCC other than defined by the selected platform.
28395
28396 @item 128
28397 Prefer 128-bit vector width for instructions.
28398
28399 @item 256
28400 Prefer 256-bit vector width for instructions.
28401
28402 @item 512
28403 Prefer 512-bit vector width for instructions.
28404 @end table
28405
28406 @item -mcx16
28407 @opindex mcx16
28408 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28409 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28410 objects. This is useful for atomic updates of data structures exceeding one
28411 machine word in size. The compiler uses this instruction to implement
28412 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28413 128-bit integers, a library call is always used.
28414
28415 @item -msahf
28416 @opindex msahf
28417 This option enables generation of @code{SAHF} instructions in 64-bit code.
28418 Early Intel Pentium 4 CPUs with Intel 64 support,
28419 prior to the introduction of Pentium 4 G1 step in December 2005,
28420 lacked the @code{LAHF} and @code{SAHF} instructions
28421 which are supported by AMD64.
28422 These are load and store instructions, respectively, for certain status flags.
28423 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28424 @code{drem}, and @code{remainder} built-in functions;
28425 see @ref{Other Builtins} for details.
28426
28427 @item -mmovbe
28428 @opindex mmovbe
28429 This option enables use of the @code{movbe} instruction to implement
28430 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28431
28432 @item -mshstk
28433 @opindex mshstk
28434 The @option{-mshstk} option enables shadow stack built-in functions
28435 from x86 Control-flow Enforcement Technology (CET).
28436
28437 @item -mcrc32
28438 @opindex mcrc32
28439 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28440 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28441 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28442
28443 @item -mrecip
28444 @opindex mrecip
28445 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28446 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28447 with an additional Newton-Raphson step
28448 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28449 (and their vectorized
28450 variants) for single-precision floating-point arguments. These instructions
28451 are generated only when @option{-funsafe-math-optimizations} is enabled
28452 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28453 Note that while the throughput of the sequence is higher than the throughput
28454 of the non-reciprocal instruction, the precision of the sequence can be
28455 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28456
28457 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28458 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28459 combination), and doesn't need @option{-mrecip}.
28460
28461 Also note that GCC emits the above sequence with additional Newton-Raphson step
28462 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28463 already with @option{-ffast-math} (or the above option combination), and
28464 doesn't need @option{-mrecip}.
28465
28466 @item -mrecip=@var{opt}
28467 @opindex mrecip=opt
28468 This option controls which reciprocal estimate instructions
28469 may be used. @var{opt} is a comma-separated list of options, which may
28470 be preceded by a @samp{!} to invert the option:
28471
28472 @table @samp
28473 @item all
28474 Enable all estimate instructions.
28475
28476 @item default
28477 Enable the default instructions, equivalent to @option{-mrecip}.
28478
28479 @item none
28480 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28481
28482 @item div
28483 Enable the approximation for scalar division.
28484
28485 @item vec-div
28486 Enable the approximation for vectorized division.
28487
28488 @item sqrt
28489 Enable the approximation for scalar square root.
28490
28491 @item vec-sqrt
28492 Enable the approximation for vectorized square root.
28493 @end table
28494
28495 So, for example, @option{-mrecip=all,!sqrt} enables
28496 all of the reciprocal approximations, except for square root.
28497
28498 @item -mveclibabi=@var{type}
28499 @opindex mveclibabi
28500 Specifies the ABI type to use for vectorizing intrinsics using an
28501 external library. Supported values for @var{type} are @samp{svml}
28502 for the Intel short
28503 vector math library and @samp{acml} for the AMD math core library.
28504 To use this option, both @option{-ftree-vectorize} and
28505 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28506 ABI-compatible library must be specified at link time.
28507
28508 GCC currently emits calls to @code{vmldExp2},
28509 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28510 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28511 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28512 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28513 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28514 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28515 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28516 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28517 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28518 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28519 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28520 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28521 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28522 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28523 when @option{-mveclibabi=acml} is used.
28524
28525 @item -mabi=@var{name}
28526 @opindex mabi
28527 Generate code for the specified calling convention. Permissible values
28528 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28529 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28530 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28531 You can control this behavior for specific functions by
28532 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28533 @xref{Function Attributes}.
28534
28535 @item -mforce-indirect-call
28536 @opindex mforce-indirect-call
28537 Force all calls to functions to be indirect. This is useful
28538 when using Intel Processor Trace where it generates more precise timing
28539 information for function calls.
28540
28541 @item -mmanual-endbr
28542 @opindex mmanual-endbr
28543 Insert ENDBR instruction at function entry only via the @code{cf_check}
28544 function attribute. This is useful when used with the option
28545 @option{-fcf-protection=branch} to control ENDBR insertion at the
28546 function entry.
28547
28548 @item -mcall-ms2sysv-xlogues
28549 @opindex mcall-ms2sysv-xlogues
28550 @opindex mno-call-ms2sysv-xlogues
28551 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28552 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28553 default, the code for saving and restoring these registers is emitted inline,
28554 resulting in fairly lengthy prologues and epilogues. Using
28555 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28556 use stubs in the static portion of libgcc to perform these saves and restores,
28557 thus reducing function size at the cost of a few extra instructions.
28558
28559 @item -mtls-dialect=@var{type}
28560 @opindex mtls-dialect
28561 Generate code to access thread-local storage using the @samp{gnu} or
28562 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28563 @samp{gnu2} is more efficient, but it may add compile- and run-time
28564 requirements that cannot be satisfied on all systems.
28565
28566 @item -mpush-args
28567 @itemx -mno-push-args
28568 @opindex mpush-args
28569 @opindex mno-push-args
28570 Use PUSH operations to store outgoing parameters. This method is shorter
28571 and usually equally fast as method using SUB/MOV operations and is enabled
28572 by default. In some cases disabling it may improve performance because of
28573 improved scheduling and reduced dependencies.
28574
28575 @item -maccumulate-outgoing-args
28576 @opindex maccumulate-outgoing-args
28577 If enabled, the maximum amount of space required for outgoing arguments is
28578 computed in the function prologue. This is faster on most modern CPUs
28579 because of reduced dependencies, improved scheduling and reduced stack usage
28580 when the preferred stack boundary is not equal to 2. The drawback is a notable
28581 increase in code size. This switch implies @option{-mno-push-args}.
28582
28583 @item -mthreads
28584 @opindex mthreads
28585 Support thread-safe exception handling on MinGW. Programs that rely
28586 on thread-safe exception handling must compile and link all code with the
28587 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28588 @option{-D_MT}; when linking, it links in a special thread helper library
28589 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28590
28591 @item -mms-bitfields
28592 @itemx -mno-ms-bitfields
28593 @opindex mms-bitfields
28594 @opindex mno-ms-bitfields
28595
28596 Enable/disable bit-field layout compatible with the native Microsoft
28597 Windows compiler.
28598
28599 If @code{packed} is used on a structure, or if bit-fields are used,
28600 it may be that the Microsoft ABI lays out the structure differently
28601 than the way GCC normally does. Particularly when moving packed
28602 data between functions compiled with GCC and the native Microsoft compiler
28603 (either via function call or as data in a file), it may be necessary to access
28604 either format.
28605
28606 This option is enabled by default for Microsoft Windows
28607 targets. This behavior can also be controlled locally by use of variable
28608 or type attributes. For more information, see @ref{x86 Variable Attributes}
28609 and @ref{x86 Type Attributes}.
28610
28611 The Microsoft structure layout algorithm is fairly simple with the exception
28612 of the bit-field packing.
28613 The padding and alignment of members of structures and whether a bit-field
28614 can straddle a storage-unit boundary are determine by these rules:
28615
28616 @enumerate
28617 @item Structure members are stored sequentially in the order in which they are
28618 declared: the first member has the lowest memory address and the last member
28619 the highest.
28620
28621 @item Every data object has an alignment requirement. The alignment requirement
28622 for all data except structures, unions, and arrays is either the size of the
28623 object or the current packing size (specified with either the
28624 @code{aligned} attribute or the @code{pack} pragma),
28625 whichever is less. For structures, unions, and arrays,
28626 the alignment requirement is the largest alignment requirement of its members.
28627 Every object is allocated an offset so that:
28628
28629 @smallexample
28630 offset % alignment_requirement == 0
28631 @end smallexample
28632
28633 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28634 unit if the integral types are the same size and if the next bit-field fits
28635 into the current allocation unit without crossing the boundary imposed by the
28636 common alignment requirements of the bit-fields.
28637 @end enumerate
28638
28639 MSVC interprets zero-length bit-fields in the following ways:
28640
28641 @enumerate
28642 @item If a zero-length bit-field is inserted between two bit-fields that
28643 are normally coalesced, the bit-fields are not coalesced.
28644
28645 For example:
28646
28647 @smallexample
28648 struct
28649 @{
28650 unsigned long bf_1 : 12;
28651 unsigned long : 0;
28652 unsigned long bf_2 : 12;
28653 @} t1;
28654 @end smallexample
28655
28656 @noindent
28657 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28658 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28659
28660 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28661 alignment of the zero-length bit-field is greater than the member that follows it,
28662 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28663
28664 For example:
28665
28666 @smallexample
28667 struct
28668 @{
28669 char foo : 4;
28670 short : 0;
28671 char bar;
28672 @} t2;
28673
28674 struct
28675 @{
28676 char foo : 4;
28677 short : 0;
28678 double bar;
28679 @} t3;
28680 @end smallexample
28681
28682 @noindent
28683 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28684 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28685 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28686 of the structure.
28687
28688 Taking this into account, it is important to note the following:
28689
28690 @enumerate
28691 @item If a zero-length bit-field follows a normal bit-field, the type of the
28692 zero-length bit-field may affect the alignment of the structure as whole. For
28693 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28694 normal bit-field, and is of type short.
28695
28696 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28697 still affect the alignment of the structure:
28698
28699 @smallexample
28700 struct
28701 @{
28702 char foo : 6;
28703 long : 0;
28704 @} t4;
28705 @end smallexample
28706
28707 @noindent
28708 Here, @code{t4} takes up 4 bytes.
28709 @end enumerate
28710
28711 @item Zero-length bit-fields following non-bit-field members are ignored:
28712
28713 @smallexample
28714 struct
28715 @{
28716 char foo;
28717 long : 0;
28718 char bar;
28719 @} t5;
28720 @end smallexample
28721
28722 @noindent
28723 Here, @code{t5} takes up 2 bytes.
28724 @end enumerate
28725
28726
28727 @item -mno-align-stringops
28728 @opindex mno-align-stringops
28729 @opindex malign-stringops
28730 Do not align the destination of inlined string operations. This switch reduces
28731 code size and improves performance in case the destination is already aligned,
28732 but GCC doesn't know about it.
28733
28734 @item -minline-all-stringops
28735 @opindex minline-all-stringops
28736 By default GCC inlines string operations only when the destination is
28737 known to be aligned to least a 4-byte boundary.
28738 This enables more inlining and increases code
28739 size, but may improve performance of code that depends on fast
28740 @code{memcpy} and @code{memset} for short lengths.
28741 The option enables inline expansion of @code{strlen} for all
28742 pointer alignments.
28743
28744 @item -minline-stringops-dynamically
28745 @opindex minline-stringops-dynamically
28746 For string operations of unknown size, use run-time checks with
28747 inline code for small blocks and a library call for large blocks.
28748
28749 @item -mstringop-strategy=@var{alg}
28750 @opindex mstringop-strategy=@var{alg}
28751 Override the internal decision heuristic for the particular algorithm to use
28752 for inlining string operations. The allowed values for @var{alg} are:
28753
28754 @table @samp
28755 @item rep_byte
28756 @itemx rep_4byte
28757 @itemx rep_8byte
28758 Expand using i386 @code{rep} prefix of the specified size.
28759
28760 @item byte_loop
28761 @itemx loop
28762 @itemx unrolled_loop
28763 Expand into an inline loop.
28764
28765 @item libcall
28766 Always use a library call.
28767 @end table
28768
28769 @item -mmemcpy-strategy=@var{strategy}
28770 @opindex mmemcpy-strategy=@var{strategy}
28771 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28772 should be inlined and what inline algorithm to use when the expected size
28773 of the copy operation is known. @var{strategy}
28774 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28775 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28776 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28777 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28778 in the list must be specified in increasing order. The minimal byte size for
28779 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28780 preceding range.
28781
28782 @item -mmemset-strategy=@var{strategy}
28783 @opindex mmemset-strategy=@var{strategy}
28784 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28785 @code{__builtin_memset} expansion.
28786
28787 @item -momit-leaf-frame-pointer
28788 @opindex momit-leaf-frame-pointer
28789 Don't keep the frame pointer in a register for leaf functions. This
28790 avoids the instructions to save, set up, and restore frame pointers and
28791 makes an extra register available in leaf functions. The option
28792 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28793 which might make debugging harder.
28794
28795 @item -mtls-direct-seg-refs
28796 @itemx -mno-tls-direct-seg-refs
28797 @opindex mtls-direct-seg-refs
28798 Controls whether TLS variables may be accessed with offsets from the
28799 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28800 or whether the thread base pointer must be added. Whether or not this
28801 is valid depends on the operating system, and whether it maps the
28802 segment to cover the entire TLS area.
28803
28804 For systems that use the GNU C Library, the default is on.
28805
28806 @item -msse2avx
28807 @itemx -mno-sse2avx
28808 @opindex msse2avx
28809 Specify that the assembler should encode SSE instructions with VEX
28810 prefix. The option @option{-mavx} turns this on by default.
28811
28812 @item -mfentry
28813 @itemx -mno-fentry
28814 @opindex mfentry
28815 If profiling is active (@option{-pg}), put the profiling
28816 counter call before the prologue.
28817 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28818 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28819
28820 @item -mrecord-mcount
28821 @itemx -mno-record-mcount
28822 @opindex mrecord-mcount
28823 If profiling is active (@option{-pg}), generate a __mcount_loc section
28824 that contains pointers to each profiling call. This is useful for
28825 automatically patching and out calls.
28826
28827 @item -mnop-mcount
28828 @itemx -mno-nop-mcount
28829 @opindex mnop-mcount
28830 If profiling is active (@option{-pg}), generate the calls to
28831 the profiling functions as NOPs. This is useful when they
28832 should be patched in later dynamically. This is likely only
28833 useful together with @option{-mrecord-mcount}.
28834
28835 @item -minstrument-return=@var{type}
28836 @opindex minstrument-return
28837 Instrument function exit in -pg -mfentry instrumented functions with
28838 call to specified function. This only instruments true returns ending
28839 with ret, but not sibling calls ending with jump. Valid types
28840 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28841 or @var{nop5} to generate a 5 byte nop.
28842
28843 @item -mrecord-return
28844 @itemx -mno-record-return
28845 @opindex mrecord-return
28846 Generate a __return_loc section pointing to all return instrumentation code.
28847
28848 @item -mfentry-name=@var{name}
28849 @opindex mfentry-name
28850 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28851
28852 @item -mfentry-section=@var{name}
28853 @opindex mfentry-section
28854 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28855
28856 @item -mskip-rax-setup
28857 @itemx -mno-skip-rax-setup
28858 @opindex mskip-rax-setup
28859 When generating code for the x86-64 architecture with SSE extensions
28860 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28861 register when there are no variable arguments passed in vector registers.
28862
28863 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28864 saving vector registers on stack when passing variable arguments, the
28865 impacts of this option are callees may waste some stack space,
28866 misbehave or jump to a random location. GCC 4.4 or newer don't have
28867 those issues, regardless the RAX register value.
28868
28869 @item -m8bit-idiv
28870 @itemx -mno-8bit-idiv
28871 @opindex m8bit-idiv
28872 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28873 much faster than 32-bit/64-bit integer divide. This option generates a
28874 run-time check. If both dividend and divisor are within range of 0
28875 to 255, 8-bit unsigned integer divide is used instead of
28876 32-bit/64-bit integer divide.
28877
28878 @item -mavx256-split-unaligned-load
28879 @itemx -mavx256-split-unaligned-store
28880 @opindex mavx256-split-unaligned-load
28881 @opindex mavx256-split-unaligned-store
28882 Split 32-byte AVX unaligned load and store.
28883
28884 @item -mstack-protector-guard=@var{guard}
28885 @itemx -mstack-protector-guard-reg=@var{reg}
28886 @itemx -mstack-protector-guard-offset=@var{offset}
28887 @opindex mstack-protector-guard
28888 @opindex mstack-protector-guard-reg
28889 @opindex mstack-protector-guard-offset
28890 Generate stack protection code using canary at @var{guard}. Supported
28891 locations are @samp{global} for global canary or @samp{tls} for per-thread
28892 canary in the TLS block (the default). This option has effect only when
28893 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28894
28895 With the latter choice the options
28896 @option{-mstack-protector-guard-reg=@var{reg}} and
28897 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28898 which segment register (@code{%fs} or @code{%gs}) to use as base register
28899 for reading the canary, and from what offset from that base register.
28900 The default for those is as specified in the relevant ABI.
28901
28902 @item -mgeneral-regs-only
28903 @opindex mgeneral-regs-only
28904 Generate code that uses only the general-purpose registers. This
28905 prevents the compiler from using floating-point, vector, mask and bound
28906 registers.
28907
28908 @item -mindirect-branch=@var{choice}
28909 @opindex mindirect-branch
28910 Convert indirect call and jump with @var{choice}. The default is
28911 @samp{keep}, which keeps indirect call and jump unmodified.
28912 @samp{thunk} converts indirect call and jump to call and return thunk.
28913 @samp{thunk-inline} converts indirect call and jump to inlined call
28914 and return thunk. @samp{thunk-extern} converts indirect call and jump
28915 to external call and return thunk provided in a separate object file.
28916 You can control this behavior for a specific function by using the
28917 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28918
28919 Note that @option{-mcmodel=large} is incompatible with
28920 @option{-mindirect-branch=thunk} and
28921 @option{-mindirect-branch=thunk-extern} since the thunk function may
28922 not be reachable in the large code model.
28923
28924 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28925 @option{-fcf-protection=branch} since the external thunk cannot be modified
28926 to disable control-flow check.
28927
28928 @item -mfunction-return=@var{choice}
28929 @opindex mfunction-return
28930 Convert function return with @var{choice}. The default is @samp{keep},
28931 which keeps function return unmodified. @samp{thunk} converts function
28932 return to call and return thunk. @samp{thunk-inline} converts function
28933 return to inlined call and return thunk. @samp{thunk-extern} converts
28934 function return to external call and return thunk provided in a separate
28935 object file. You can control this behavior for a specific function by
28936 using the function attribute @code{function_return}.
28937 @xref{Function Attributes}.
28938
28939 Note that @option{-mcmodel=large} is incompatible with
28940 @option{-mfunction-return=thunk} and
28941 @option{-mfunction-return=thunk-extern} since the thunk function may
28942 not be reachable in the large code model.
28943
28944
28945 @item -mindirect-branch-register
28946 @opindex mindirect-branch-register
28947 Force indirect call and jump via register.
28948
28949 @end table
28950
28951 These @samp{-m} switches are supported in addition to the above
28952 on x86-64 processors in 64-bit environments.
28953
28954 @table @gcctabopt
28955 @item -m32
28956 @itemx -m64
28957 @itemx -mx32
28958 @itemx -m16
28959 @itemx -miamcu
28960 @opindex m32
28961 @opindex m64
28962 @opindex mx32
28963 @opindex m16
28964 @opindex miamcu
28965 Generate code for a 16-bit, 32-bit or 64-bit environment.
28966 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28967 to 32 bits, and
28968 generates code that runs on any i386 system.
28969
28970 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28971 types to 64 bits, and generates code for the x86-64 architecture.
28972 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28973 and @option{-mdynamic-no-pic} options.
28974
28975 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28976 to 32 bits, and
28977 generates code for the x86-64 architecture.
28978
28979 The @option{-m16} option is the same as @option{-m32}, except for that
28980 it outputs the @code{.code16gcc} assembly directive at the beginning of
28981 the assembly output so that the binary can run in 16-bit mode.
28982
28983 The @option{-miamcu} option generates code which conforms to Intel MCU
28984 psABI. It requires the @option{-m32} option to be turned on.
28985
28986 @item -mno-red-zone
28987 @opindex mno-red-zone
28988 @opindex mred-zone
28989 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28990 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28991 stack pointer that is not modified by signal or interrupt handlers
28992 and therefore can be used for temporary data without adjusting the stack
28993 pointer. The flag @option{-mno-red-zone} disables this red zone.
28994
28995 @item -mcmodel=small
28996 @opindex mcmodel=small
28997 Generate code for the small code model: the program and its symbols must
28998 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28999 Programs can be statically or dynamically linked. This is the default
29000 code model.
29001
29002 @item -mcmodel=kernel
29003 @opindex mcmodel=kernel
29004 Generate code for the kernel code model. The kernel runs in the
29005 negative 2 GB of the address space.
29006 This model has to be used for Linux kernel code.
29007
29008 @item -mcmodel=medium
29009 @opindex mcmodel=medium
29010 Generate code for the medium model: the program is linked in the lower 2
29011 GB of the address space. Small symbols are also placed there. Symbols
29012 with sizes larger than @option{-mlarge-data-threshold} are put into
29013 large data or BSS sections and can be located above 2GB. Programs can
29014 be statically or dynamically linked.
29015
29016 @item -mcmodel=large
29017 @opindex mcmodel=large
29018 Generate code for the large model. This model makes no assumptions
29019 about addresses and sizes of sections.
29020
29021 @item -maddress-mode=long
29022 @opindex maddress-mode=long
29023 Generate code for long address mode. This is only supported for 64-bit
29024 and x32 environments. It is the default address mode for 64-bit
29025 environments.
29026
29027 @item -maddress-mode=short
29028 @opindex maddress-mode=short
29029 Generate code for short address mode. This is only supported for 32-bit
29030 and x32 environments. It is the default address mode for 32-bit and
29031 x32 environments.
29032 @end table
29033
29034 @node x86 Windows Options
29035 @subsection x86 Windows Options
29036 @cindex x86 Windows Options
29037 @cindex Windows Options for x86
29038
29039 These additional options are available for Microsoft Windows targets:
29040
29041 @table @gcctabopt
29042 @item -mconsole
29043 @opindex mconsole
29044 This option
29045 specifies that a console application is to be generated, by
29046 instructing the linker to set the PE header subsystem type
29047 required for console applications.
29048 This option is available for Cygwin and MinGW targets and is
29049 enabled by default on those targets.
29050
29051 @item -mdll
29052 @opindex mdll
29053 This option is available for Cygwin and MinGW targets. It
29054 specifies that a DLL---a dynamic link library---is to be
29055 generated, enabling the selection of the required runtime
29056 startup object and entry point.
29057
29058 @item -mnop-fun-dllimport
29059 @opindex mnop-fun-dllimport
29060 This option is available for Cygwin and MinGW targets. It
29061 specifies that the @code{dllimport} attribute should be ignored.
29062
29063 @item -mthread
29064 @opindex mthread
29065 This option is available for MinGW targets. It specifies
29066 that MinGW-specific thread support is to be used.
29067
29068 @item -municode
29069 @opindex municode
29070 This option is available for MinGW-w64 targets. It causes
29071 the @code{UNICODE} preprocessor macro to be predefined, and
29072 chooses Unicode-capable runtime startup code.
29073
29074 @item -mwin32
29075 @opindex mwin32
29076 This option is available for Cygwin and MinGW targets. It
29077 specifies that the typical Microsoft Windows predefined macros are to
29078 be set in the pre-processor, but does not influence the choice
29079 of runtime library/startup code.
29080
29081 @item -mwindows
29082 @opindex mwindows
29083 This option is available for Cygwin and MinGW targets. It
29084 specifies that a GUI application is to be generated by
29085 instructing the linker to set the PE header subsystem type
29086 appropriately.
29087
29088 @item -fno-set-stack-executable
29089 @opindex fno-set-stack-executable
29090 @opindex fset-stack-executable
29091 This option is available for MinGW targets. It specifies that
29092 the executable flag for the stack used by nested functions isn't
29093 set. This is necessary for binaries running in kernel mode of
29094 Microsoft Windows, as there the User32 API, which is used to set executable
29095 privileges, isn't available.
29096
29097 @item -fwritable-relocated-rdata
29098 @opindex fno-writable-relocated-rdata
29099 @opindex fwritable-relocated-rdata
29100 This option is available for MinGW and Cygwin targets. It specifies
29101 that relocated-data in read-only section is put into the @code{.data}
29102 section. This is a necessary for older runtimes not supporting
29103 modification of @code{.rdata} sections for pseudo-relocation.
29104
29105 @item -mpe-aligned-commons
29106 @opindex mpe-aligned-commons
29107 This option is available for Cygwin and MinGW targets. It
29108 specifies that the GNU extension to the PE file format that
29109 permits the correct alignment of COMMON variables should be
29110 used when generating code. It is enabled by default if
29111 GCC detects that the target assembler found during configuration
29112 supports the feature.
29113 @end table
29114
29115 See also under @ref{x86 Options} for standard options.
29116
29117 @node Xstormy16 Options
29118 @subsection Xstormy16 Options
29119 @cindex Xstormy16 Options
29120
29121 These options are defined for Xstormy16:
29122
29123 @table @gcctabopt
29124 @item -msim
29125 @opindex msim
29126 Choose startup files and linker script suitable for the simulator.
29127 @end table
29128
29129 @node Xtensa Options
29130 @subsection Xtensa Options
29131 @cindex Xtensa Options
29132
29133 These options are supported for Xtensa targets:
29134
29135 @table @gcctabopt
29136 @item -mconst16
29137 @itemx -mno-const16
29138 @opindex mconst16
29139 @opindex mno-const16
29140 Enable or disable use of @code{CONST16} instructions for loading
29141 constant values. The @code{CONST16} instruction is currently not a
29142 standard option from Tensilica. When enabled, @code{CONST16}
29143 instructions are always used in place of the standard @code{L32R}
29144 instructions. The use of @code{CONST16} is enabled by default only if
29145 the @code{L32R} instruction is not available.
29146
29147 @item -mfused-madd
29148 @itemx -mno-fused-madd
29149 @opindex mfused-madd
29150 @opindex mno-fused-madd
29151 Enable or disable use of fused multiply/add and multiply/subtract
29152 instructions in the floating-point option. This has no effect if the
29153 floating-point option is not also enabled. Disabling fused multiply/add
29154 and multiply/subtract instructions forces the compiler to use separate
29155 instructions for the multiply and add/subtract operations. This may be
29156 desirable in some cases where strict IEEE 754-compliant results are
29157 required: the fused multiply add/subtract instructions do not round the
29158 intermediate result, thereby producing results with @emph{more} bits of
29159 precision than specified by the IEEE standard. Disabling fused multiply
29160 add/subtract instructions also ensures that the program output is not
29161 sensitive to the compiler's ability to combine multiply and add/subtract
29162 operations.
29163
29164 @item -mserialize-volatile
29165 @itemx -mno-serialize-volatile
29166 @opindex mserialize-volatile
29167 @opindex mno-serialize-volatile
29168 When this option is enabled, GCC inserts @code{MEMW} instructions before
29169 @code{volatile} memory references to guarantee sequential consistency.
29170 The default is @option{-mserialize-volatile}. Use
29171 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29172
29173 @item -mforce-no-pic
29174 @opindex mforce-no-pic
29175 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29176 position-independent code (PIC), this option disables PIC for compiling
29177 kernel code.
29178
29179 @item -mtext-section-literals
29180 @itemx -mno-text-section-literals
29181 @opindex mtext-section-literals
29182 @opindex mno-text-section-literals
29183 These options control the treatment of literal pools. The default is
29184 @option{-mno-text-section-literals}, which places literals in a separate
29185 section in the output file. This allows the literal pool to be placed
29186 in a data RAM/ROM, and it also allows the linker to combine literal
29187 pools from separate object files to remove redundant literals and
29188 improve code size. With @option{-mtext-section-literals}, the literals
29189 are interspersed in the text section in order to keep them as close as
29190 possible to their references. This may be necessary for large assembly
29191 files. Literals for each function are placed right before that function.
29192
29193 @item -mauto-litpools
29194 @itemx -mno-auto-litpools
29195 @opindex mauto-litpools
29196 @opindex mno-auto-litpools
29197 These options control the treatment of literal pools. The default is
29198 @option{-mno-auto-litpools}, which places literals in a separate
29199 section in the output file unless @option{-mtext-section-literals} is
29200 used. With @option{-mauto-litpools} the literals are interspersed in
29201 the text section by the assembler. Compiler does not produce explicit
29202 @code{.literal} directives and loads literals into registers with
29203 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29204 do relaxation and place literals as necessary. This option allows
29205 assembler to create several literal pools per function and assemble
29206 very big functions, which may not be possible with
29207 @option{-mtext-section-literals}.
29208
29209 @item -mtarget-align
29210 @itemx -mno-target-align
29211 @opindex mtarget-align
29212 @opindex mno-target-align
29213 When this option is enabled, GCC instructs the assembler to
29214 automatically align instructions to reduce branch penalties at the
29215 expense of some code density. The assembler attempts to widen density
29216 instructions to align branch targets and the instructions following call
29217 instructions. If there are not enough preceding safe density
29218 instructions to align a target, no widening is performed. The
29219 default is @option{-mtarget-align}. These options do not affect the
29220 treatment of auto-aligned instructions like @code{LOOP}, which the
29221 assembler always aligns, either by widening density instructions or
29222 by inserting NOP instructions.
29223
29224 @item -mlongcalls
29225 @itemx -mno-longcalls
29226 @opindex mlongcalls
29227 @opindex mno-longcalls
29228 When this option is enabled, GCC instructs the assembler to translate
29229 direct calls to indirect calls unless it can determine that the target
29230 of a direct call is in the range allowed by the call instruction. This
29231 translation typically occurs for calls to functions in other source
29232 files. Specifically, the assembler translates a direct @code{CALL}
29233 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29234 The default is @option{-mno-longcalls}. This option should be used in
29235 programs where the call target can potentially be out of range. This
29236 option is implemented in the assembler, not the compiler, so the
29237 assembly code generated by GCC still shows direct call
29238 instructions---look at the disassembled object code to see the actual
29239 instructions. Note that the assembler uses an indirect call for
29240 every cross-file call, not just those that really are out of range.
29241 @end table
29242
29243 @node zSeries Options
29244 @subsection zSeries Options
29245 @cindex zSeries options
29246
29247 These are listed under @xref{S/390 and zSeries Options}.
29248
29249
29250 @c man end
29251
29252 @node Spec Files
29253 @section Specifying Subprocesses and the Switches to Pass to Them
29254 @cindex Spec Files
29255
29256 @command{gcc} is a driver program. It performs its job by invoking a
29257 sequence of other programs to do the work of compiling, assembling and
29258 linking. GCC interprets its command-line parameters and uses these to
29259 deduce which programs it should invoke, and which command-line options
29260 it ought to place on their command lines. This behavior is controlled
29261 by @dfn{spec strings}. In most cases there is one spec string for each
29262 program that GCC can invoke, but a few programs have multiple spec
29263 strings to control their behavior. The spec strings built into GCC can
29264 be overridden by using the @option{-specs=} command-line switch to specify
29265 a spec file.
29266
29267 @dfn{Spec files} are plain-text files that are used to construct spec
29268 strings. They consist of a sequence of directives separated by blank
29269 lines. The type of directive is determined by the first non-whitespace
29270 character on the line, which can be one of the following:
29271
29272 @table @code
29273 @item %@var{command}
29274 Issues a @var{command} to the spec file processor. The commands that can
29275 appear here are:
29276
29277 @table @code
29278 @item %include <@var{file}>
29279 @cindex @code{%include}
29280 Search for @var{file} and insert its text at the current point in the
29281 specs file.
29282
29283 @item %include_noerr <@var{file}>
29284 @cindex @code{%include_noerr}
29285 Just like @samp{%include}, but do not generate an error message if the include
29286 file cannot be found.
29287
29288 @item %rename @var{old_name} @var{new_name}
29289 @cindex @code{%rename}
29290 Rename the spec string @var{old_name} to @var{new_name}.
29291
29292 @end table
29293
29294 @item *[@var{spec_name}]:
29295 This tells the compiler to create, override or delete the named spec
29296 string. All lines after this directive up to the next directive or
29297 blank line are considered to be the text for the spec string. If this
29298 results in an empty string then the spec is deleted. (Or, if the
29299 spec did not exist, then nothing happens.) Otherwise, if the spec
29300 does not currently exist a new spec is created. If the spec does
29301 exist then its contents are overridden by the text of this
29302 directive, unless the first character of that text is the @samp{+}
29303 character, in which case the text is appended to the spec.
29304
29305 @item [@var{suffix}]:
29306 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29307 and up to the next directive or blank line are considered to make up the
29308 spec string for the indicated suffix. When the compiler encounters an
29309 input file with the named suffix, it processes the spec string in
29310 order to work out how to compile that file. For example:
29311
29312 @smallexample
29313 .ZZ:
29314 z-compile -input %i
29315 @end smallexample
29316
29317 This says that any input file whose name ends in @samp{.ZZ} should be
29318 passed to the program @samp{z-compile}, which should be invoked with the
29319 command-line switch @option{-input} and with the result of performing the
29320 @samp{%i} substitution. (See below.)
29321
29322 As an alternative to providing a spec string, the text following a
29323 suffix directive can be one of the following:
29324
29325 @table @code
29326 @item @@@var{language}
29327 This says that the suffix is an alias for a known @var{language}. This is
29328 similar to using the @option{-x} command-line switch to GCC to specify a
29329 language explicitly. For example:
29330
29331 @smallexample
29332 .ZZ:
29333 @@c++
29334 @end smallexample
29335
29336 Says that .ZZ files are, in fact, C++ source files.
29337
29338 @item #@var{name}
29339 This causes an error messages saying:
29340
29341 @smallexample
29342 @var{name} compiler not installed on this system.
29343 @end smallexample
29344 @end table
29345
29346 GCC already has an extensive list of suffixes built into it.
29347 This directive adds an entry to the end of the list of suffixes, but
29348 since the list is searched from the end backwards, it is effectively
29349 possible to override earlier entries using this technique.
29350
29351 @end table
29352
29353 GCC has the following spec strings built into it. Spec files can
29354 override these strings or create their own. Note that individual
29355 targets can also add their own spec strings to this list.
29356
29357 @smallexample
29358 asm Options to pass to the assembler
29359 asm_final Options to pass to the assembler post-processor
29360 cpp Options to pass to the C preprocessor
29361 cc1 Options to pass to the C compiler
29362 cc1plus Options to pass to the C++ compiler
29363 endfile Object files to include at the end of the link
29364 link Options to pass to the linker
29365 lib Libraries to include on the command line to the linker
29366 libgcc Decides which GCC support library to pass to the linker
29367 linker Sets the name of the linker
29368 predefines Defines to be passed to the C preprocessor
29369 signed_char Defines to pass to CPP to say whether @code{char} is signed
29370 by default
29371 startfile Object files to include at the start of the link
29372 @end smallexample
29373
29374 Here is a small example of a spec file:
29375
29376 @smallexample
29377 %rename lib old_lib
29378
29379 *lib:
29380 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29381 @end smallexample
29382
29383 This example renames the spec called @samp{lib} to @samp{old_lib} and
29384 then overrides the previous definition of @samp{lib} with a new one.
29385 The new definition adds in some extra command-line options before
29386 including the text of the old definition.
29387
29388 @dfn{Spec strings} are a list of command-line options to be passed to their
29389 corresponding program. In addition, the spec strings can contain
29390 @samp{%}-prefixed sequences to substitute variable text or to
29391 conditionally insert text into the command line. Using these constructs
29392 it is possible to generate quite complex command lines.
29393
29394 Here is a table of all defined @samp{%}-sequences for spec
29395 strings. Note that spaces are not generated automatically around the
29396 results of expanding these sequences. Therefore you can concatenate them
29397 together or combine them with constant text in a single argument.
29398
29399 @table @code
29400 @item %%
29401 Substitute one @samp{%} into the program name or argument.
29402
29403 @item %i
29404 Substitute the name of the input file being processed.
29405
29406 @item %b
29407 Substitute the basename of the input file being processed.
29408 This is the substring up to (and not including) the last period
29409 and not including the directory.
29410
29411 @item %B
29412 This is the same as @samp{%b}, but include the file suffix (text after
29413 the last period).
29414
29415 @item %d
29416 Marks the argument containing or following the @samp{%d} as a
29417 temporary file name, so that that file is deleted if GCC exits
29418 successfully. Unlike @samp{%g}, this contributes no text to the
29419 argument.
29420
29421 @item %g@var{suffix}
29422 Substitute a file name that has suffix @var{suffix} and is chosen
29423 once per compilation, and mark the argument in the same way as
29424 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29425 name is now chosen in a way that is hard to predict even when previously
29426 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29427 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29428 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29429 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29430 was simply substituted with a file name chosen once per compilation,
29431 without regard to any appended suffix (which was therefore treated
29432 just like ordinary text), making such attacks more likely to succeed.
29433
29434 @item %u@var{suffix}
29435 Like @samp{%g}, but generates a new temporary file name
29436 each time it appears instead of once per compilation.
29437
29438 @item %U@var{suffix}
29439 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29440 new one if there is no such last file name. In the absence of any
29441 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29442 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29443 involves the generation of two distinct file names, one
29444 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29445 simply substituted with a file name chosen for the previous @samp{%u},
29446 without regard to any appended suffix.
29447
29448 @item %j@var{suffix}
29449 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29450 writable, and if @option{-save-temps} is not used;
29451 otherwise, substitute the name
29452 of a temporary file, just like @samp{%u}. This temporary file is not
29453 meant for communication between processes, but rather as a junk
29454 disposal mechanism.
29455
29456 @item %|@var{suffix}
29457 @itemx %m@var{suffix}
29458 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29459 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29460 all. These are the two most common ways to instruct a program that it
29461 should read from standard input or write to standard output. If you
29462 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29463 construct: see for example @file{gcc/fortran/lang-specs.h}.
29464
29465 @item %.@var{SUFFIX}
29466 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29467 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29468 terminated by the next space or %.
29469
29470 @item %w
29471 Marks the argument containing or following the @samp{%w} as the
29472 designated output file of this compilation. This puts the argument
29473 into the sequence of arguments that @samp{%o} substitutes.
29474
29475 @item %o
29476 Substitutes the names of all the output files, with spaces
29477 automatically placed around them. You should write spaces
29478 around the @samp{%o} as well or the results are undefined.
29479 @samp{%o} is for use in the specs for running the linker.
29480 Input files whose names have no recognized suffix are not compiled
29481 at all, but they are included among the output files, so they are
29482 linked.
29483
29484 @item %O
29485 Substitutes the suffix for object files. Note that this is
29486 handled specially when it immediately follows @samp{%g, %u, or %U},
29487 because of the need for those to form complete file names. The
29488 handling is such that @samp{%O} is treated exactly as if it had already
29489 been substituted, except that @samp{%g, %u, and %U} do not currently
29490 support additional @var{suffix} characters following @samp{%O} as they do
29491 following, for example, @samp{.o}.
29492
29493 @item %p
29494 Substitutes the standard macro predefinitions for the
29495 current target machine. Use this when running @command{cpp}.
29496
29497 @item %P
29498 Like @samp{%p}, but puts @samp{__} before and after the name of each
29499 predefined macro, except for macros that start with @samp{__} or with
29500 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29501 C@.
29502
29503 @item %I
29504 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29505 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29506 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29507 and @option{-imultilib} as necessary.
29508
29509 @item %s
29510 Current argument is the name of a library or startup file of some sort.
29511 Search for that file in a standard list of directories and substitute
29512 the full name found. The current working directory is included in the
29513 list of directories scanned.
29514
29515 @item %T
29516 Current argument is the name of a linker script. Search for that file
29517 in the current list of directories to scan for libraries. If the file
29518 is located insert a @option{--script} option into the command line
29519 followed by the full path name found. If the file is not found then
29520 generate an error message. Note: the current working directory is not
29521 searched.
29522
29523 @item %e@var{str}
29524 Print @var{str} as an error message. @var{str} is terminated by a newline.
29525 Use this when inconsistent options are detected.
29526
29527 @item %(@var{name})
29528 Substitute the contents of spec string @var{name} at this point.
29529
29530 @item %x@{@var{option}@}
29531 Accumulate an option for @samp{%X}.
29532
29533 @item %X
29534 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29535 spec string.
29536
29537 @item %Y
29538 Output the accumulated assembler options specified by @option{-Wa}.
29539
29540 @item %Z
29541 Output the accumulated preprocessor options specified by @option{-Wp}.
29542
29543 @item %a
29544 Process the @code{asm} spec. This is used to compute the
29545 switches to be passed to the assembler.
29546
29547 @item %A
29548 Process the @code{asm_final} spec. This is a spec string for
29549 passing switches to an assembler post-processor, if such a program is
29550 needed.
29551
29552 @item %l
29553 Process the @code{link} spec. This is the spec for computing the
29554 command line passed to the linker. Typically it makes use of the
29555 @samp{%L %G %S %D and %E} sequences.
29556
29557 @item %D
29558 Dump out a @option{-L} option for each directory that GCC believes might
29559 contain startup files. If the target supports multilibs then the
29560 current multilib directory is prepended to each of these paths.
29561
29562 @item %L
29563 Process the @code{lib} spec. This is a spec string for deciding which
29564 libraries are included on the command line to the linker.
29565
29566 @item %G
29567 Process the @code{libgcc} spec. This is a spec string for deciding
29568 which GCC support library is included on the command line to the linker.
29569
29570 @item %S
29571 Process the @code{startfile} spec. This is a spec for deciding which
29572 object files are the first ones passed to the linker. Typically
29573 this might be a file named @file{crt0.o}.
29574
29575 @item %E
29576 Process the @code{endfile} spec. This is a spec string that specifies
29577 the last object files that are passed to the linker.
29578
29579 @item %C
29580 Process the @code{cpp} spec. This is used to construct the arguments
29581 to be passed to the C preprocessor.
29582
29583 @item %1
29584 Process the @code{cc1} spec. This is used to construct the options to be
29585 passed to the actual C compiler (@command{cc1}).
29586
29587 @item %2
29588 Process the @code{cc1plus} spec. This is used to construct the options to be
29589 passed to the actual C++ compiler (@command{cc1plus}).
29590
29591 @item %*
29592 Substitute the variable part of a matched option. See below.
29593 Note that each comma in the substituted string is replaced by
29594 a single space.
29595
29596 @item %<S
29597 Remove all occurrences of @code{-S} from the command line. Note---this
29598 command is position dependent. @samp{%} commands in the spec string
29599 before this one see @code{-S}, @samp{%} commands in the spec string
29600 after this one do not.
29601
29602 @item %:@var{function}(@var{args})
29603 Call the named function @var{function}, passing it @var{args}.
29604 @var{args} is first processed as a nested spec string, then split
29605 into an argument vector in the usual fashion. The function returns
29606 a string which is processed as if it had appeared literally as part
29607 of the current spec.
29608
29609 The following built-in spec functions are provided:
29610
29611 @table @code
29612 @item @code{getenv}
29613 The @code{getenv} spec function takes two arguments: an environment
29614 variable name and a string. If the environment variable is not
29615 defined, a fatal error is issued. Otherwise, the return value is the
29616 value of the environment variable concatenated with the string. For
29617 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29618
29619 @smallexample
29620 %:getenv(TOPDIR /include)
29621 @end smallexample
29622
29623 expands to @file{/path/to/top/include}.
29624
29625 @item @code{if-exists}
29626 The @code{if-exists} spec function takes one argument, an absolute
29627 pathname to a file. If the file exists, @code{if-exists} returns the
29628 pathname. Here is a small example of its usage:
29629
29630 @smallexample
29631 *startfile:
29632 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29633 @end smallexample
29634
29635 @item @code{if-exists-else}
29636 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29637 spec function, except that it takes two arguments. The first argument is
29638 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29639 returns the pathname. If it does not exist, it returns the second argument.
29640 This way, @code{if-exists-else} can be used to select one file or another,
29641 based on the existence of the first. Here is a small example of its usage:
29642
29643 @smallexample
29644 *startfile:
29645 crt0%O%s %:if-exists(crti%O%s) \
29646 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29647 @end smallexample
29648
29649 @item @code{replace-outfile}
29650 The @code{replace-outfile} spec function takes two arguments. It looks for the
29651 first argument in the outfiles array and replaces it with the second argument. Here
29652 is a small example of its usage:
29653
29654 @smallexample
29655 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29656 @end smallexample
29657
29658 @item @code{remove-outfile}
29659 The @code{remove-outfile} spec function takes one argument. It looks for the
29660 first argument in the outfiles array and removes it. Here is a small example
29661 its usage:
29662
29663 @smallexample
29664 %:remove-outfile(-lm)
29665 @end smallexample
29666
29667 @item @code{pass-through-libs}
29668 The @code{pass-through-libs} spec function takes any number of arguments. It
29669 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29670 assumes are the names of linker input library archive files) and returns a
29671 result containing all the found arguments each prepended by
29672 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29673 intended to be passed to the LTO linker plugin.
29674
29675 @smallexample
29676 %:pass-through-libs(%G %L %G)
29677 @end smallexample
29678
29679 @item @code{print-asm-header}
29680 The @code{print-asm-header} function takes no arguments and simply
29681 prints a banner like:
29682
29683 @smallexample
29684 Assembler options
29685 =================
29686
29687 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29688 @end smallexample
29689
29690 It is used to separate compiler options from assembler options
29691 in the @option{--target-help} output.
29692 @end table
29693
29694 @item %@{S@}
29695 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29696 If that switch is not specified, this substitutes nothing. Note that
29697 the leading dash is omitted when specifying this option, and it is
29698 automatically inserted if the substitution is performed. Thus the spec
29699 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29700 and outputs the command-line option @option{-foo}.
29701
29702 @item %W@{S@}
29703 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29704 deleted on failure.
29705
29706 @item %@{S*@}
29707 Substitutes all the switches specified to GCC whose names start
29708 with @code{-S}, but which also take an argument. This is used for
29709 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29710 GCC considers @option{-o foo} as being
29711 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29712 text, including the space. Thus two arguments are generated.
29713
29714 @item %@{S*&T*@}
29715 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29716 (the order of @code{S} and @code{T} in the spec is not significant).
29717 There can be any number of ampersand-separated variables; for each the
29718 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29719
29720 @item %@{S:X@}
29721 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29722
29723 @item %@{!S:X@}
29724 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29725
29726 @item %@{S*:X@}
29727 Substitutes @code{X} if one or more switches whose names start with
29728 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29729 once, no matter how many such switches appeared. However, if @code{%*}
29730 appears somewhere in @code{X}, then @code{X} is substituted once
29731 for each matching switch, with the @code{%*} replaced by the part of
29732 that switch matching the @code{*}.
29733
29734 If @code{%*} appears as the last part of a spec sequence then a space
29735 is added after the end of the last substitution. If there is more
29736 text in the sequence, however, then a space is not generated. This
29737 allows the @code{%*} substitution to be used as part of a larger
29738 string. For example, a spec string like this:
29739
29740 @smallexample
29741 %@{mcu=*:--script=%*/memory.ld@}
29742 @end smallexample
29743
29744 @noindent
29745 when matching an option like @option{-mcu=newchip} produces:
29746
29747 @smallexample
29748 --script=newchip/memory.ld
29749 @end smallexample
29750
29751 @item %@{.S:X@}
29752 Substitutes @code{X}, if processing a file with suffix @code{S}.
29753
29754 @item %@{!.S:X@}
29755 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29756
29757 @item %@{,S:X@}
29758 Substitutes @code{X}, if processing a file for language @code{S}.
29759
29760 @item %@{!,S:X@}
29761 Substitutes @code{X}, if not processing a file for language @code{S}.
29762
29763 @item %@{S|P:X@}
29764 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29765 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29766 @code{*} sequences as well, although they have a stronger binding than
29767 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29768 alternatives must be starred, and only the first matching alternative
29769 is substituted.
29770
29771 For example, a spec string like this:
29772
29773 @smallexample
29774 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29775 @end smallexample
29776
29777 @noindent
29778 outputs the following command-line options from the following input
29779 command-line options:
29780
29781 @smallexample
29782 fred.c -foo -baz
29783 jim.d -bar -boggle
29784 -d fred.c -foo -baz -boggle
29785 -d jim.d -bar -baz -boggle
29786 @end smallexample
29787
29788 @item %@{S:X; T:Y; :D@}
29789
29790 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29791 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29792 be as many clauses as you need. This may be combined with @code{.},
29793 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29794
29795
29796 @end table
29797
29798 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29799 or similar construct can use a backslash to ignore the special meaning
29800 of the character following it, thus allowing literal matching of a
29801 character that is otherwise specially treated. For example,
29802 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29803 @option{-std=iso9899:1999} option is given.
29804
29805 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29806 construct may contain other nested @samp{%} constructs or spaces, or
29807 even newlines. They are processed as usual, as described above.
29808 Trailing white space in @code{X} is ignored. White space may also
29809 appear anywhere on the left side of the colon in these constructs,
29810 except between @code{.} or @code{*} and the corresponding word.
29811
29812 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29813 handled specifically in these constructs. If another value of
29814 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29815 @option{-W} switch is found later in the command line, the earlier
29816 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29817 just one letter, which passes all matching options.
29818
29819 The character @samp{|} at the beginning of the predicate text is used to
29820 indicate that a command should be piped to the following command, but
29821 only if @option{-pipe} is specified.
29822
29823 It is built into GCC which switches take arguments and which do not.
29824 (You might think it would be useful to generalize this to allow each
29825 compiler's spec to say which switches take arguments. But this cannot
29826 be done in a consistent fashion. GCC cannot even decide which input
29827 files have been specified without knowing which switches take arguments,
29828 and it must know which input files to compile in order to tell which
29829 compilers to run).
29830
29831 GCC also knows implicitly that arguments starting in @option{-l} are to be
29832 treated as compiler output files, and passed to the linker in their
29833 proper position among the other output files.
29834
29835 @node Environment Variables
29836 @section Environment Variables Affecting GCC
29837 @cindex environment variables
29838
29839 @c man begin ENVIRONMENT
29840 This section describes several environment variables that affect how GCC
29841 operates. Some of them work by specifying directories or prefixes to use
29842 when searching for various kinds of files. Some are used to specify other
29843 aspects of the compilation environment.
29844
29845 Note that you can also specify places to search using options such as
29846 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29847 take precedence over places specified using environment variables, which
29848 in turn take precedence over those specified by the configuration of GCC@.
29849 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29850 GNU Compiler Collection (GCC) Internals}.
29851
29852 @table @env
29853 @item LANG
29854 @itemx LC_CTYPE
29855 @c @itemx LC_COLLATE
29856 @itemx LC_MESSAGES
29857 @c @itemx LC_MONETARY
29858 @c @itemx LC_NUMERIC
29859 @c @itemx LC_TIME
29860 @itemx LC_ALL
29861 @findex LANG
29862 @findex LC_CTYPE
29863 @c @findex LC_COLLATE
29864 @findex LC_MESSAGES
29865 @c @findex LC_MONETARY
29866 @c @findex LC_NUMERIC
29867 @c @findex LC_TIME
29868 @findex LC_ALL
29869 @cindex locale
29870 These environment variables control the way that GCC uses
29871 localization information which allows GCC to work with different
29872 national conventions. GCC inspects the locale categories
29873 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29874 so. These locale categories can be set to any value supported by your
29875 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29876 Kingdom encoded in UTF-8.
29877
29878 The @env{LC_CTYPE} environment variable specifies character
29879 classification. GCC uses it to determine the character boundaries in
29880 a string; this is needed for some multibyte encodings that contain quote
29881 and escape characters that are otherwise interpreted as a string
29882 end or escape.
29883
29884 The @env{LC_MESSAGES} environment variable specifies the language to
29885 use in diagnostic messages.
29886
29887 If the @env{LC_ALL} environment variable is set, it overrides the value
29888 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29889 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29890 environment variable. If none of these variables are set, GCC
29891 defaults to traditional C English behavior.
29892
29893 @item TMPDIR
29894 @findex TMPDIR
29895 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29896 files. GCC uses temporary files to hold the output of one stage of
29897 compilation which is to be used as input to the next stage: for example,
29898 the output of the preprocessor, which is the input to the compiler
29899 proper.
29900
29901 @item GCC_COMPARE_DEBUG
29902 @findex GCC_COMPARE_DEBUG
29903 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29904 @option{-fcompare-debug} to the compiler driver. See the documentation
29905 of this option for more details.
29906
29907 @item GCC_EXEC_PREFIX
29908 @findex GCC_EXEC_PREFIX
29909 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29910 names of the subprograms executed by the compiler. No slash is added
29911 when this prefix is combined with the name of a subprogram, but you can
29912 specify a prefix that ends with a slash if you wish.
29913
29914 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29915 an appropriate prefix to use based on the pathname it is invoked with.
29916
29917 If GCC cannot find the subprogram using the specified prefix, it
29918 tries looking in the usual places for the subprogram.
29919
29920 The default value of @env{GCC_EXEC_PREFIX} is
29921 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29922 the installed compiler. In many cases @var{prefix} is the value
29923 of @code{prefix} when you ran the @file{configure} script.
29924
29925 Other prefixes specified with @option{-B} take precedence over this prefix.
29926
29927 This prefix is also used for finding files such as @file{crt0.o} that are
29928 used for linking.
29929
29930 In addition, the prefix is used in an unusual way in finding the
29931 directories to search for header files. For each of the standard
29932 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29933 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29934 replacing that beginning with the specified prefix to produce an
29935 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29936 @file{foo/bar} just before it searches the standard directory
29937 @file{/usr/local/lib/bar}.
29938 If a standard directory begins with the configured
29939 @var{prefix} then the value of @var{prefix} is replaced by
29940 @env{GCC_EXEC_PREFIX} when looking for header files.
29941
29942 @item COMPILER_PATH
29943 @findex COMPILER_PATH
29944 The value of @env{COMPILER_PATH} is a colon-separated list of
29945 directories, much like @env{PATH}. GCC tries the directories thus
29946 specified when searching for subprograms, if it cannot find the
29947 subprograms using @env{GCC_EXEC_PREFIX}.
29948
29949 @item LIBRARY_PATH
29950 @findex LIBRARY_PATH
29951 The value of @env{LIBRARY_PATH} is a colon-separated list of
29952 directories, much like @env{PATH}. When configured as a native compiler,
29953 GCC tries the directories thus specified when searching for special
29954 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29955 using GCC also uses these directories when searching for ordinary
29956 libraries for the @option{-l} option (but directories specified with
29957 @option{-L} come first).
29958
29959 @item LANG
29960 @findex LANG
29961 @cindex locale definition
29962 This variable is used to pass locale information to the compiler. One way in
29963 which this information is used is to determine the character set to be used
29964 when character literals, string literals and comments are parsed in C and C++.
29965 When the compiler is configured to allow multibyte characters,
29966 the following values for @env{LANG} are recognized:
29967
29968 @table @samp
29969 @item C-JIS
29970 Recognize JIS characters.
29971 @item C-SJIS
29972 Recognize SJIS characters.
29973 @item C-EUCJP
29974 Recognize EUCJP characters.
29975 @end table
29976
29977 If @env{LANG} is not defined, or if it has some other value, then the
29978 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29979 recognize and translate multibyte characters.
29980 @end table
29981
29982 @noindent
29983 Some additional environment variables affect the behavior of the
29984 preprocessor.
29985
29986 @include cppenv.texi
29987
29988 @c man end
29989
29990 @node Precompiled Headers
29991 @section Using Precompiled Headers
29992 @cindex precompiled headers
29993 @cindex speed of compilation
29994
29995 Often large projects have many header files that are included in every
29996 source file. The time the compiler takes to process these header files
29997 over and over again can account for nearly all of the time required to
29998 build the project. To make builds faster, GCC allows you to
29999 @dfn{precompile} a header file.
30000
30001 To create a precompiled header file, simply compile it as you would any
30002 other file, if necessary using the @option{-x} option to make the driver
30003 treat it as a C or C++ header file. You may want to use a
30004 tool like @command{make} to keep the precompiled header up-to-date when
30005 the headers it contains change.
30006
30007 A precompiled header file is searched for when @code{#include} is
30008 seen in the compilation. As it searches for the included file
30009 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
30010 compiler looks for a precompiled header in each directory just before it
30011 looks for the include file in that directory. The name searched for is
30012 the name specified in the @code{#include} with @samp{.gch} appended. If
30013 the precompiled header file cannot be used, it is ignored.
30014
30015 For instance, if you have @code{#include "all.h"}, and you have
30016 @file{all.h.gch} in the same directory as @file{all.h}, then the
30017 precompiled header file is used if possible, and the original
30018 header is used otherwise.
30019
30020 Alternatively, you might decide to put the precompiled header file in a
30021 directory and use @option{-I} to ensure that directory is searched
30022 before (or instead of) the directory containing the original header.
30023 Then, if you want to check that the precompiled header file is always
30024 used, you can put a file of the same name as the original header in this
30025 directory containing an @code{#error} command.
30026
30027 This also works with @option{-include}. So yet another way to use
30028 precompiled headers, good for projects not designed with precompiled
30029 header files in mind, is to simply take most of the header files used by
30030 a project, include them from another header file, precompile that header
30031 file, and @option{-include} the precompiled header. If the header files
30032 have guards against multiple inclusion, they are skipped because
30033 they've already been included (in the precompiled header).
30034
30035 If you need to precompile the same header file for different
30036 languages, targets, or compiler options, you can instead make a
30037 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30038 header in the directory, perhaps using @option{-o}. It doesn't matter
30039 what you call the files in the directory; every precompiled header in
30040 the directory is considered. The first precompiled header
30041 encountered in the directory that is valid for this compilation is
30042 used; they're searched in no particular order.
30043
30044 There are many other possibilities, limited only by your imagination,
30045 good sense, and the constraints of your build system.
30046
30047 A precompiled header file can be used only when these conditions apply:
30048
30049 @itemize
30050 @item
30051 Only one precompiled header can be used in a particular compilation.
30052
30053 @item
30054 A precompiled header cannot be used once the first C token is seen. You
30055 can have preprocessor directives before a precompiled header; you cannot
30056 include a precompiled header from inside another header.
30057
30058 @item
30059 The precompiled header file must be produced for the same language as
30060 the current compilation. You cannot use a C precompiled header for a C++
30061 compilation.
30062
30063 @item
30064 The precompiled header file must have been produced by the same compiler
30065 binary as the current compilation is using.
30066
30067 @item
30068 Any macros defined before the precompiled header is included must
30069 either be defined in the same way as when the precompiled header was
30070 generated, or must not affect the precompiled header, which usually
30071 means that they don't appear in the precompiled header at all.
30072
30073 The @option{-D} option is one way to define a macro before a
30074 precompiled header is included; using a @code{#define} can also do it.
30075 There are also some options that define macros implicitly, like
30076 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30077 defined this way.
30078
30079 @item If debugging information is output when using the precompiled
30080 header, using @option{-g} or similar, the same kind of debugging information
30081 must have been output when building the precompiled header. However,
30082 a precompiled header built using @option{-g} can be used in a compilation
30083 when no debugging information is being output.
30084
30085 @item The same @option{-m} options must generally be used when building
30086 and using the precompiled header. @xref{Submodel Options},
30087 for any cases where this rule is relaxed.
30088
30089 @item Each of the following options must be the same when building and using
30090 the precompiled header:
30091
30092 @gccoptlist{-fexceptions}
30093
30094 @item
30095 Some other command-line options starting with @option{-f},
30096 @option{-p}, or @option{-O} must be defined in the same way as when
30097 the precompiled header was generated. At present, it's not clear
30098 which options are safe to change and which are not; the safest choice
30099 is to use exactly the same options when generating and using the
30100 precompiled header. The following are known to be safe:
30101
30102 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30103 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30104 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30105 -pedantic-errors}
30106
30107 @end itemize
30108
30109 For all of these except the last, the compiler automatically
30110 ignores the precompiled header if the conditions aren't met. If you
30111 find an option combination that doesn't work and doesn't cause the
30112 precompiled header to be ignored, please consider filing a bug report,
30113 see @ref{Bugs}.
30114
30115 If you do use differing options when generating and using the
30116 precompiled header, the actual behavior is a mixture of the
30117 behavior for the options. For instance, if you use @option{-g} to
30118 generate the precompiled header but not when using it, you may or may
30119 not get debugging information for routines in the precompiled header.