]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
or1k: Initial support for FPU
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2019 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string. Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers. Hexadecimal arguments must begin with
129 the @samp{0x} prefix. Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on. Such arguments are
135 designated by @var{byte-size} in the following text. Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
138
139 @c man end
140
141 @xref{Option Index}, for an index to GCC's options.
142
143 @menu
144 * Option Summary:: Brief list of all options, without explanations.
145 * Overall Options:: Controlling the kind of output:
146 an executable, object files, assembler files,
147 or preprocessed source.
148 * Invoking G++:: Compiling C++ programs.
149 * C Dialect Options:: Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152 and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154 be formatted.
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
166 and register usage.
167 * Developer Options:: Printing GCC configuration info, statistics, and
168 debugging dumps.
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
174 @end menu
175
176 @c man begin OPTIONS
177
178 @node Option Summary
179 @section Option Summary
180
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
183
184 @table @emph
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
193
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding @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 -frepo -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 -Wconversion-null -Wctor-dtor-privacy @gol
234 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
235 -Wliteral-suffix @gol
236 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
237 -Wnamespaces -Wnarrowing @gol
238 -Wpessimizing-move -Wredundant-move @gol
239 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
240 -Wnon-virtual-dtor -Wreorder -Wregister @gol
241 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
242 -Wno-non-template-friend -Wold-style-cast @gol
243 -Woverloaded-virtual -Wno-pmf-conversions @gol
244 -Wno-class-conversion -Wno-terminate @gol
245 -Wsign-promo -Wvirtual-inheritance}
246
247 @item Objective-C and Objective-C++ Language Options
248 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
249 Objective-C and Objective-C++ Dialects}.
250 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
251 -fgnu-runtime -fnext-runtime @gol
252 -fno-nil-receivers @gol
253 -fobjc-abi-version=@var{n} @gol
254 -fobjc-call-cxx-cdtors @gol
255 -fobjc-direct-dispatch @gol
256 -fobjc-exceptions @gol
257 -fobjc-gc @gol
258 -fobjc-nilcheck @gol
259 -fobjc-std=objc1 @gol
260 -fno-local-ivars @gol
261 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
262 -freplace-objc-classes @gol
263 -fzero-link @gol
264 -gen-decls @gol
265 -Wassign-intercept @gol
266 -Wno-protocol -Wselector @gol
267 -Wstrict-selector-match @gol
268 -Wundeclared-selector}
269
270 @item Diagnostic Message Formatting Options
271 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
272 @gccoptlist{-fmessage-length=@var{n} @gol
273 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
274 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
275 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
276 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
277 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
278 -fdiagnostics-minimum-margin-width=@var{width} @gol
279 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
280 -fdiagnostics-show-template-tree -fno-elide-type @gol
281 -fno-show-column}
282
283 @item Warning Options
284 @xref{Warning Options,,Options to Request or Suppress Warnings}.
285 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
286 -pedantic-errors @gol
287 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
288 -Waggregate-return -Waligned-new @gol
289 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
290 -Walloca -Walloca-larger-than=@var{byte-size} @gol
291 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
292 -Wno-attributes -Wattribute-alias=@var{n} @gol
293 -Wbool-compare -Wbool-operation @gol
294 -Wno-builtin-declaration-mismatch @gol
295 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
296 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
297 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
298 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
299 -Wclobbered -Wcomment -Wconditionally-supported @gol
300 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
301 -Wdelete-incomplete @gol
302 -Wno-attribute-warning @gol
303 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
304 -Wdisabled-optimization @gol
305 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
306 -Wno-div-by-zero -Wdouble-promotion @gol
307 -Wduplicated-branches -Wduplicated-cond @gol
308 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
309 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
310 -Wfloat-equal -Wformat -Wformat=2 @gol
311 -Wno-format-contains-nul -Wno-format-extra-args @gol
312 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
313 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
314 -Wformat-y2k -Wframe-address @gol
315 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
316 -Wjump-misses-init @gol
317 -Whsa -Wif-not-aligned @gol
318 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
319 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
320 -Wimplicit-function-declaration -Wimplicit-int @gol
321 -Winaccessible-base @gol
322 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
323 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
324 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
325 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
326 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
327 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
328 -Wmissing-field-initializers -Wmissing-format-attribute @gol
329 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
330 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
331 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
332 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
333 -Woverride-init-side-effects -Woverlength-strings @gol
334 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
335 -Wparentheses -Wno-pedantic-ms-format @gol
336 -Wplacement-new -Wplacement-new=@var{n} @gol
337 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
338 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
339 -Wrestrict -Wno-return-local-addr @gol
340 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
341 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
342 -Wshift-overflow -Wshift-overflow=@var{n} @gol
343 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
344 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
345 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
346 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
347 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
348 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
349 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
350 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
351 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
352 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
353 -Wswitch-unreachable -Wsync-nand @gol
354 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
355 -Wtype-limits -Wundef @gol
356 -Wuninitialized -Wunknown-pragmas @gol
357 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
358 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
359 -Wunused-parameter -Wno-unused-result @gol
360 -Wunused-value -Wunused-variable @gol
361 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
362 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
363 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
364 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
365 -Wwrite-strings @gol
366 -Wzero-as-null-pointer-constant}
367
368 @item C and Objective-C-only Warning Options
369 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
370 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
371 -Wold-style-declaration -Wold-style-definition @gol
372 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
373 -Wdeclaration-after-statement -Wpointer-sign}
374
375 @item Debugging Options
376 @xref{Debugging Options,,Options for Debugging Your Program}.
377 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
378 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
379 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
380 -gas-loc-support -gno-as-loc-support @gol
381 -gas-locview-support -gno-as-locview-support @gol
382 -gcolumn-info -gno-column-info @gol
383 -gstatement-frontiers -gno-statement-frontiers @gol
384 -gvariable-location-views -gno-variable-location-views @gol
385 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
386 -ginline-points -gno-inline-points @gol
387 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
388 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
389 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
390 -fno-eliminate-unused-debug-types @gol
391 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
392 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
393 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
394 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
395 -fvar-tracking -fvar-tracking-assignments}
396
397 @item Optimization Options
398 @xref{Optimize Options,,Options that Control Optimization}.
399 @gccoptlist{-faggressive-loop-optimizations @gol
400 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
401 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
402 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
403 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
405 -fauto-inc-dec -fbranch-probabilities @gol
406 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
407 -fbtr-bb-exclusive -fcaller-saves @gol
408 -fcombine-stack-adjustments -fconserve-stack @gol
409 -fcompare-elim -fcprop-registers -fcrossjumping @gol
410 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
411 -fcx-limited-range @gol
412 -fdata-sections -fdce -fdelayed-branch @gol
413 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
414 -fdevirtualize-at-ltrans -fdse @gol
415 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
416 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
417 -ffinite-loops @gol
418 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
419 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
420 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
421 -fif-conversion2 -findirect-inlining @gol
422 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
423 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
424 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
425 -fipa-reference -fipa-reference-addressable @gol
426 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
427 -flive-patching=@var{level} @gol
428 -fira-region=@var{region} -fira-hoist-pressure @gol
429 -fira-loop-pressure -fno-ira-share-save-slots @gol
430 -fno-ira-share-spill-slots @gol
431 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
432 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
433 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
434 -floop-block -floop-interchange -floop-strip-mine @gol
435 -floop-unroll-and-jam -floop-nest-optimize @gol
436 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
437 -flto-partition=@var{alg} -fmerge-all-constants @gol
438 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
439 -fmove-loop-invariants -fno-branch-count-reg @gol
440 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
441 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
442 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
443 -fno-sched-spec -fno-signed-zeros @gol
444 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
445 -fomit-frame-pointer -foptimize-sibling-calls @gol
446 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
447 -fprefetch-loop-arrays @gol
448 -fprofile-correction @gol
449 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
450 -fprofile-reorder-functions @gol
451 -freciprocal-math -free -frename-registers -freorder-blocks @gol
452 -freorder-blocks-algorithm=@var{algorithm} @gol
453 -freorder-blocks-and-partition -freorder-functions @gol
454 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
455 -frounding-math -fsave-optimization-record @gol
456 -fsched2-use-superblocks -fsched-pressure @gol
457 -fsched-spec-load -fsched-spec-load-dangerous @gol
458 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
459 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
460 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
461 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
462 -fschedule-fusion @gol
463 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
464 -fselective-scheduling -fselective-scheduling2 @gol
465 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
466 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
467 -fsignaling-nans @gol
468 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
469 -fsplit-paths @gol
470 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
471 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
472 -fthread-jumps -ftracer -ftree-bit-ccp @gol
473 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
474 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
475 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
476 -ftree-loop-if-convert -ftree-loop-im @gol
477 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
478 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
479 -ftree-loop-vectorize @gol
480 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
481 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
482 -ftree-switch-conversion -ftree-tail-merge @gol
483 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
484 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
485 -funsafe-math-optimizations -funswitch-loops @gol
486 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
487 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
488 --param @var{name}=@var{value}
489 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
490
491 @item Program Instrumentation Options
492 @xref{Instrumentation Options,,Program Instrumentation Options}.
493 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
494 -fprofile-abs-path @gol
495 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
496 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
497 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
498 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
499 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
500 -fsanitize-undefined-trap-on-error -fbounds-check @gol
501 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
502 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
503 -fstack-protector-explicit -fstack-check @gol
504 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
505 -fno-stack-limit -fsplit-stack @gol
506 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
507 -fvtv-counts -fvtv-debug @gol
508 -finstrument-functions @gol
509 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
510 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
511
512 @item Preprocessor Options
513 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
514 @gccoptlist{-A@var{question}=@var{answer} @gol
515 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
516 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
517 -dD -dI -dM -dN -dU @gol
518 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
519 -fexec-charset=@var{charset} -fextended-identifiers @gol
520 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
521 -fmax-include-depth=@var{depth} @gol
522 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
523 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
524 -fwide-exec-charset=@var{charset} -fworking-directory @gol
525 -H -imacros @var{file} -include @var{file} @gol
526 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
527 -no-integrated-cpp -P -pthread -remap @gol
528 -traditional -traditional-cpp -trigraphs @gol
529 -U@var{macro} -undef @gol
530 -Wp,@var{option} -Xpreprocessor @var{option}}
531
532 @item Assembler Options
533 @xref{Assembler Options,,Passing Options to the Assembler}.
534 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
535
536 @item Linker Options
537 @xref{Link Options,,Options for Linking}.
538 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
539 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
540 -e @var{entry} --entry=@var{entry} @gol
541 -pie -pthread -r -rdynamic @gol
542 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
543 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
544 -shared -shared-libgcc -symbolic @gol
545 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
546 -u @var{symbol} -z @var{keyword}}
547
548 @item Directory Options
549 @xref{Directory Options,,Options for Directory Search}.
550 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
551 -idirafter @var{dir} @gol
552 -imacros @var{file} -imultilib @var{dir} @gol
553 -iplugindir=@var{dir} -iprefix @var{file} @gol
554 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
555 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
556 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
557 -nostdinc -nostdinc++ --sysroot=@var{dir}}
558
559 @item Code Generation Options
560 @xref{Code Gen Options,,Options for Code Generation Conventions}.
561 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
562 -ffixed-@var{reg} -fexceptions @gol
563 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
564 -fasynchronous-unwind-tables @gol
565 -fno-gnu-unique @gol
566 -finhibit-size-directive -fno-common -fno-ident @gol
567 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
568 -fno-jump-tables @gol
569 -frecord-gcc-switches @gol
570 -freg-struct-return -fshort-enums -fshort-wchar @gol
571 -fverbose-asm -fpack-struct[=@var{n}] @gol
572 -fleading-underscore -ftls-model=@var{model} @gol
573 -fstack-reuse=@var{reuse_level} @gol
574 -ftrampolines -ftrapv -fwrapv @gol
575 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
576 -fstrict-volatile-bitfields -fsync-libcalls}
577
578 @item Developer Options
579 @xref{Developer Options,,GCC Developer Options}.
580 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
581 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
582 -fdbg-cnt=@var{counter-value-list} @gol
583 -fdisable-ipa-@var{pass_name} @gol
584 -fdisable-rtl-@var{pass_name} @gol
585 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
586 -fdisable-tree-@var{pass_name} @gol
587 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
588 -fdump-debug -fdump-earlydebug @gol
589 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
590 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
591 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
592 -fdump-lang-all @gol
593 -fdump-lang-@var{switch} @gol
594 -fdump-lang-@var{switch}-@var{options} @gol
595 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
596 -fdump-passes @gol
597 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
598 -fdump-statistics @gol
599 -fdump-tree-all @gol
600 -fdump-tree-@var{switch} @gol
601 -fdump-tree-@var{switch}-@var{options} @gol
602 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
603 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
604 -fenable-@var{kind}-@var{pass} @gol
605 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
606 -fira-verbose=@var{n} @gol
607 -flto-report -flto-report-wpa -fmem-report-wpa @gol
608 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
609 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
610 -fprofile-report @gol
611 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
612 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
613 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
614 -fvar-tracking-assignments-toggle -gtoggle @gol
615 -print-file-name=@var{library} -print-libgcc-file-name @gol
616 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
617 -print-prog-name=@var{program} -print-search-dirs -Q @gol
618 -print-sysroot -print-sysroot-headers-suffix @gol
619 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
620
621 @item Machine-Dependent Options
622 @xref{Submodel Options,,Machine-Dependent Options}.
623 @c This list is ordered alphanumerically by subsection name.
624 @c Try and put the significant identifier (CPU or system) first,
625 @c so users have a clue at guessing where the ones they want will be.
626
627 @emph{AArch64 Options}
628 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
629 -mgeneral-regs-only @gol
630 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
631 -mstrict-align -mno-strict-align @gol
632 -momit-leaf-frame-pointer @gol
633 -mtls-dialect=desc -mtls-dialect=traditional @gol
634 -mtls-size=@var{size} @gol
635 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
636 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
637 -mpc-relative-literal-loads @gol
638 -msign-return-address=@var{scope} @gol
639 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
640 +@var{b-key}]|@var{bti} @gol
641 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
642 -moverride=@var{string} -mverbose-cost-dump @gol
643 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
644 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation }
645
646 @emph{Adapteva Epiphany Options}
647 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
648 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
649 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
650 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
651 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
652 -msplit-vecmove-early -m1reg-@var{reg}}
653
654 @emph{AMD GCN Options}
655 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
656
657 @emph{ARC Options}
658 @gccoptlist{-mbarrel-shifter -mjli-always @gol
659 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
660 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
661 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
662 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
663 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
664 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
665 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
666 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
667 -mvolatile-cache -mtp-regno=@var{regno} @gol
668 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
669 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
670 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
671 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
672 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
673 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
674 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
675 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
676
677 @emph{ARM Options}
678 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
679 -mabi=@var{name} @gol
680 -mapcs-stack-check -mno-apcs-stack-check @gol
681 -mapcs-reentrant -mno-apcs-reentrant @gol
682 -mgeneral-regs-only @gol
683 -msched-prolog -mno-sched-prolog @gol
684 -mlittle-endian -mbig-endian @gol
685 -mbe8 -mbe32 @gol
686 -mfloat-abi=@var{name} @gol
687 -mfp16-format=@var{name}
688 -mthumb-interwork -mno-thumb-interwork @gol
689 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
690 -mtune=@var{name} -mprint-tune-info @gol
691 -mstructure-size-boundary=@var{n} @gol
692 -mabort-on-noreturn @gol
693 -mlong-calls -mno-long-calls @gol
694 -msingle-pic-base -mno-single-pic-base @gol
695 -mpic-register=@var{reg} @gol
696 -mnop-fun-dllimport @gol
697 -mpoke-function-name @gol
698 -mthumb -marm -mflip-thumb @gol
699 -mtpcs-frame -mtpcs-leaf-frame @gol
700 -mcaller-super-interworking -mcallee-super-interworking @gol
701 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
702 -mword-relocations @gol
703 -mfix-cortex-m3-ldrd @gol
704 -munaligned-access @gol
705 -mneon-for-64bits @gol
706 -mslow-flash-data @gol
707 -masm-syntax-unified @gol
708 -mrestrict-it @gol
709 -mverbose-cost-dump @gol
710 -mpure-code @gol
711 -mcmse}
712
713 @emph{AVR Options}
714 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
715 -mbranch-cost=@var{cost} @gol
716 -mcall-prologues -mgas-isr-prologues -mint8 @gol
717 -mn_flash=@var{size} -mno-interrupts @gol
718 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
719 -mfract-convert-truncate @gol
720 -mshort-calls -nodevicelib @gol
721 -Waddr-space-convert -Wmisspelled-isr}
722
723 @emph{Blackfin Options}
724 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
725 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
726 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
727 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
728 -mno-id-shared-library -mshared-library-id=@var{n} @gol
729 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
730 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
731 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
732 -micplb}
733
734 @emph{C6X Options}
735 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
736 -msim -msdata=@var{sdata-type}}
737
738 @emph{CRIS Options}
739 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
740 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
741 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
742 -mstack-align -mdata-align -mconst-align @gol
743 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
744 -melf -maout -melinux -mlinux -sim -sim2 @gol
745 -mmul-bug-workaround -mno-mul-bug-workaround}
746
747 @emph{CR16 Options}
748 @gccoptlist{-mmac @gol
749 -mcr16cplus -mcr16c @gol
750 -msim -mint32 -mbit-ops
751 -mdata-model=@var{model}}
752
753 @emph{C-SKY Options}
754 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
755 -mbig-endian -EB -mlittle-endian -EL @gol
756 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
757 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
758 -mdsp -medsp -mvdsp @gol
759 -mdiv -msmart -mhigh-registers -manchor @gol
760 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
761 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
762
763 @emph{Darwin Options}
764 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
765 -arch_only -bind_at_load -bundle -bundle_loader @gol
766 -client_name -compatibility_version -current_version @gol
767 -dead_strip @gol
768 -dependency-file -dylib_file -dylinker_install_name @gol
769 -dynamic -dynamiclib -exported_symbols_list @gol
770 -filelist -flat_namespace -force_cpusubtype_ALL @gol
771 -force_flat_namespace -headerpad_max_install_names @gol
772 -iframework @gol
773 -image_base -init -install_name -keep_private_externs @gol
774 -multi_module -multiply_defined -multiply_defined_unused @gol
775 -noall_load -no_dead_strip_inits_and_terms @gol
776 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
777 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
778 -private_bundle -read_only_relocs -sectalign @gol
779 -sectobjectsymbols -whyload -seg1addr @gol
780 -sectcreate -sectobjectsymbols -sectorder @gol
781 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
782 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
783 -segprot -segs_read_only_addr -segs_read_write_addr @gol
784 -single_module -static -sub_library -sub_umbrella @gol
785 -twolevel_namespace -umbrella -undefined @gol
786 -unexported_symbols_list -weak_reference_mismatches @gol
787 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
788 -mkernel -mone-byte-bool}
789
790 @emph{DEC Alpha Options}
791 @gccoptlist{-mno-fp-regs -msoft-float @gol
792 -mieee -mieee-with-inexact -mieee-conformant @gol
793 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
794 -mtrap-precision=@var{mode} -mbuild-constants @gol
795 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
796 -mbwx -mmax -mfix -mcix @gol
797 -mfloat-vax -mfloat-ieee @gol
798 -mexplicit-relocs -msmall-data -mlarge-data @gol
799 -msmall-text -mlarge-text @gol
800 -mmemory-latency=@var{time}}
801
802 @emph{FR30 Options}
803 @gccoptlist{-msmall-model -mno-lsim}
804
805 @emph{FT32 Options}
806 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
807
808 @emph{FRV Options}
809 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
810 -mhard-float -msoft-float @gol
811 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
812 -mdouble -mno-double @gol
813 -mmedia -mno-media -mmuladd -mno-muladd @gol
814 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
815 -mlinked-fp -mlong-calls -malign-labels @gol
816 -mlibrary-pic -macc-4 -macc-8 @gol
817 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
818 -moptimize-membar -mno-optimize-membar @gol
819 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
820 -mvliw-branch -mno-vliw-branch @gol
821 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
822 -mno-nested-cond-exec -mtomcat-stats @gol
823 -mTLS -mtls @gol
824 -mcpu=@var{cpu}}
825
826 @emph{GNU/Linux Options}
827 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
828 -tno-android-cc -tno-android-ld}
829
830 @emph{H8/300 Options}
831 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
832
833 @emph{HPPA Options}
834 @gccoptlist{-march=@var{architecture-type} @gol
835 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
836 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
837 -mfixed-range=@var{register-range} @gol
838 -mjump-in-delay -mlinker-opt -mlong-calls @gol
839 -mlong-load-store -mno-disable-fpregs @gol
840 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
841 -mno-jump-in-delay -mno-long-load-store @gol
842 -mno-portable-runtime -mno-soft-float @gol
843 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
844 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
845 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
846 -munix=@var{unix-std} -nolibdld -static -threads}
847
848 @emph{IA-64 Options}
849 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
850 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
851 -mconstant-gp -mauto-pic -mfused-madd @gol
852 -minline-float-divide-min-latency @gol
853 -minline-float-divide-max-throughput @gol
854 -mno-inline-float-divide @gol
855 -minline-int-divide-min-latency @gol
856 -minline-int-divide-max-throughput @gol
857 -mno-inline-int-divide @gol
858 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
859 -mno-inline-sqrt @gol
860 -mdwarf2-asm -mearly-stop-bits @gol
861 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
862 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
863 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
864 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
865 -msched-spec-ldc -msched-spec-control-ldc @gol
866 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
867 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
868 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
869 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
870
871 @emph{LM32 Options}
872 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
873 -msign-extend-enabled -muser-enabled}
874
875 @emph{M32R/D Options}
876 @gccoptlist{-m32r2 -m32rx -m32r @gol
877 -mdebug @gol
878 -malign-loops -mno-align-loops @gol
879 -missue-rate=@var{number} @gol
880 -mbranch-cost=@var{number} @gol
881 -mmodel=@var{code-size-model-type} @gol
882 -msdata=@var{sdata-type} @gol
883 -mno-flush-func -mflush-func=@var{name} @gol
884 -mno-flush-trap -mflush-trap=@var{number} @gol
885 -G @var{num}}
886
887 @emph{M32C Options}
888 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
889
890 @emph{M680x0 Options}
891 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
892 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
893 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
894 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
895 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
896 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
897 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
898 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
899 -mxgot -mno-xgot -mlong-jump-table-offsets}
900
901 @emph{MCore Options}
902 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
903 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
904 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
905 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
906 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
907
908 @emph{MeP Options}
909 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
910 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
911 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
912 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
913 -mtiny=@var{n}}
914
915 @emph{MicroBlaze Options}
916 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
917 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
918 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
919 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
920 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
921 -mpic-data-is-text-relative}
922
923 @emph{MIPS Options}
924 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
925 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
926 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
927 -mips16 -mno-mips16 -mflip-mips16 @gol
928 -minterlink-compressed -mno-interlink-compressed @gol
929 -minterlink-mips16 -mno-interlink-mips16 @gol
930 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
931 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
932 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
933 -mno-float -msingle-float -mdouble-float @gol
934 -modd-spreg -mno-odd-spreg @gol
935 -mabs=@var{mode} -mnan=@var{encoding} @gol
936 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
937 -mmcu -mmno-mcu @gol
938 -meva -mno-eva @gol
939 -mvirt -mno-virt @gol
940 -mxpa -mno-xpa @gol
941 -mcrc -mno-crc @gol
942 -mginv -mno-ginv @gol
943 -mmicromips -mno-micromips @gol
944 -mmsa -mno-msa @gol
945 -mloongson-mmi -mno-loongson-mmi @gol
946 -mloongson-ext -mno-loongson-ext @gol
947 -mloongson-ext2 -mno-loongson-ext2 @gol
948 -mfpu=@var{fpu-type} @gol
949 -msmartmips -mno-smartmips @gol
950 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
951 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
952 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
953 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
954 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
955 -membedded-data -mno-embedded-data @gol
956 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
957 -mcode-readable=@var{setting} @gol
958 -msplit-addresses -mno-split-addresses @gol
959 -mexplicit-relocs -mno-explicit-relocs @gol
960 -mcheck-zero-division -mno-check-zero-division @gol
961 -mdivide-traps -mdivide-breaks @gol
962 -mload-store-pairs -mno-load-store-pairs @gol
963 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
964 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
965 -mfix-24k -mno-fix-24k @gol
966 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
967 -mfix-r5900 -mno-fix-r5900 @gol
968 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
969 -mfix-vr4120 -mno-fix-vr4120 @gol
970 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
971 -mflush-func=@var{func} -mno-flush-func @gol
972 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
973 -mcompact-branches=@var{policy} @gol
974 -mfp-exceptions -mno-fp-exceptions @gol
975 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
976 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
977 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
978 -mframe-header-opt -mno-frame-header-opt}
979
980 @emph{MMIX Options}
981 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
982 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
983 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
984 -mno-base-addresses -msingle-exit -mno-single-exit}
985
986 @emph{MN10300 Options}
987 @gccoptlist{-mmult-bug -mno-mult-bug @gol
988 -mno-am33 -mam33 -mam33-2 -mam34 @gol
989 -mtune=@var{cpu-type} @gol
990 -mreturn-pointer-on-d0 @gol
991 -mno-crt0 -mrelax -mliw -msetlb}
992
993 @emph{Moxie Options}
994 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
995
996 @emph{MSP430 Options}
997 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
998 -mwarn-mcu @gol
999 -mcode-region= -mdata-region= @gol
1000 -msilicon-errata= -msilicon-errata-warn= @gol
1001 -mhwmult= -minrt}
1002
1003 @emph{NDS32 Options}
1004 @gccoptlist{-mbig-endian -mlittle-endian @gol
1005 -mreduced-regs -mfull-regs @gol
1006 -mcmov -mno-cmov @gol
1007 -mext-perf -mno-ext-perf @gol
1008 -mext-perf2 -mno-ext-perf2 @gol
1009 -mext-string -mno-ext-string @gol
1010 -mv3push -mno-v3push @gol
1011 -m16bit -mno-16bit @gol
1012 -misr-vector-size=@var{num} @gol
1013 -mcache-block-size=@var{num} @gol
1014 -march=@var{arch} @gol
1015 -mcmodel=@var{code-model} @gol
1016 -mctor-dtor -mrelax}
1017
1018 @emph{Nios II Options}
1019 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1020 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1021 -mel -meb @gol
1022 -mno-bypass-cache -mbypass-cache @gol
1023 -mno-cache-volatile -mcache-volatile @gol
1024 -mno-fast-sw-div -mfast-sw-div @gol
1025 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1026 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1027 -mcustom-fpu-cfg=@var{name} @gol
1028 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1029 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1030
1031 @emph{Nvidia PTX Options}
1032 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1033
1034 @emph{OpenRISC Options}
1035 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1036 -msoft-mul -msoft-div @gol
1037 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1038 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1039
1040 @emph{PDP-11 Options}
1041 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1042 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1043 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1044
1045 @emph{picoChip Options}
1046 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1047 -msymbol-as-address -mno-inefficient-warnings}
1048
1049 @emph{PowerPC Options}
1050 See RS/6000 and PowerPC Options.
1051
1052 @emph{PRU Options}
1053 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1054 -mabi=@var{variant} @gol}
1055
1056 @emph{RISC-V Options}
1057 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1058 -mplt -mno-plt @gol
1059 -mabi=@var{ABI-string} @gol
1060 -mfdiv -mno-fdiv @gol
1061 -mdiv -mno-div @gol
1062 -march=@var{ISA-string} @gol
1063 -mtune=@var{processor-string} @gol
1064 -mpreferred-stack-boundary=@var{num} @gol
1065 -msmall-data-limit=@var{N-bytes} @gol
1066 -msave-restore -mno-save-restore @gol
1067 -mstrict-align -mno-strict-align @gol
1068 -mcmodel=medlow -mcmodel=medany @gol
1069 -mexplicit-relocs -mno-explicit-relocs @gol
1070 -mrelax -mno-relax @gol
1071 -mriscv-attribute -mmo-riscv-attribute}
1072
1073 @emph{RL78 Options}
1074 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1075 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1076 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1077
1078 @emph{RS/6000 and PowerPC Options}
1079 @gccoptlist{-mcpu=@var{cpu-type} @gol
1080 -mtune=@var{cpu-type} @gol
1081 -mcmodel=@var{code-model} @gol
1082 -mpowerpc64 @gol
1083 -maltivec -mno-altivec @gol
1084 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1085 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1086 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1087 -mfprnd -mno-fprnd @gol
1088 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1089 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1090 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1091 -malign-power -malign-natural @gol
1092 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1093 -mupdate -mno-update @gol
1094 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1095 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1096 -mstrict-align -mno-strict-align -mrelocatable @gol
1097 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1098 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1099 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1100 -mprioritize-restricted-insns=@var{priority} @gol
1101 -msched-costly-dep=@var{dependence_type} @gol
1102 -minsert-sched-nops=@var{scheme} @gol
1103 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1104 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1105 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1106 -mtraceback=@var{traceback_type} @gol
1107 -maix-struct-return -msvr4-struct-return @gol
1108 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1109 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1110 -mblock-move-inline-limit=@var{num} @gol
1111 -mblock-compare-inline-limit=@var{num} @gol
1112 -mblock-compare-inline-loop-limit=@var{num} @gol
1113 -mstring-compare-inline-limit=@var{num} @gol
1114 -misel -mno-isel @gol
1115 -mvrsave -mno-vrsave @gol
1116 -mmulhw -mno-mulhw @gol
1117 -mdlmzb -mno-dlmzb @gol
1118 -mprototype -mno-prototype @gol
1119 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1120 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1121 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1122 -mno-recip-precision @gol
1123 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1124 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1125 -msave-toc-indirect -mno-save-toc-indirect @gol
1126 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1127 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1128 -mquad-memory -mno-quad-memory @gol
1129 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1130 -mcompat-align-parm -mno-compat-align-parm @gol
1131 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1132 -mgnu-attribute -mno-gnu-attribute @gol
1133 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1134 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1135
1136 @emph{RX Options}
1137 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1138 -mcpu=@gol
1139 -mbig-endian-data -mlittle-endian-data @gol
1140 -msmall-data @gol
1141 -msim -mno-sim@gol
1142 -mas100-syntax -mno-as100-syntax@gol
1143 -mrelax@gol
1144 -mmax-constant-size=@gol
1145 -mint-register=@gol
1146 -mpid@gol
1147 -mallow-string-insns -mno-allow-string-insns@gol
1148 -mjsr@gol
1149 -mno-warn-multiple-fast-interrupts@gol
1150 -msave-acc-in-interrupts}
1151
1152 @emph{S/390 and zSeries Options}
1153 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1154 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1155 -mlong-double-64 -mlong-double-128 @gol
1156 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1157 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1158 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1159 -mhtm -mvx -mzvector @gol
1160 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1161 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1162 -mhotpatch=@var{halfwords},@var{halfwords}}
1163
1164 @emph{Score Options}
1165 @gccoptlist{-meb -mel @gol
1166 -mnhwloop @gol
1167 -muls @gol
1168 -mmac @gol
1169 -mscore5 -mscore5u -mscore7 -mscore7d}
1170
1171 @emph{SH Options}
1172 @gccoptlist{-m1 -m2 -m2e @gol
1173 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1174 -m3 -m3e @gol
1175 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1176 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1177 -mb -ml -mdalign -mrelax @gol
1178 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1179 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1180 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1181 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1182 -maccumulate-outgoing-args @gol
1183 -matomic-model=@var{atomic-model} @gol
1184 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1185 -mcbranch-force-delay-slot @gol
1186 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1187 -mpretend-cmove -mtas}
1188
1189 @emph{Solaris 2 Options}
1190 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1191 -pthreads}
1192
1193 @emph{SPARC Options}
1194 @gccoptlist{-mcpu=@var{cpu-type} @gol
1195 -mtune=@var{cpu-type} @gol
1196 -mcmodel=@var{code-model} @gol
1197 -mmemory-model=@var{mem-model} @gol
1198 -m32 -m64 -mapp-regs -mno-app-regs @gol
1199 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1200 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1201 -mhard-quad-float -msoft-quad-float @gol
1202 -mstack-bias -mno-stack-bias @gol
1203 -mstd-struct-return -mno-std-struct-return @gol
1204 -munaligned-doubles -mno-unaligned-doubles @gol
1205 -muser-mode -mno-user-mode @gol
1206 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1207 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1208 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1209 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1210 -mpopc -mno-popc -msubxc -mno-subxc @gol
1211 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1212 -mlra -mno-lra}
1213
1214 @emph{SPU Options}
1215 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1216 -msafe-dma -munsafe-dma @gol
1217 -mbranch-hints @gol
1218 -msmall-mem -mlarge-mem -mstdmain @gol
1219 -mfixed-range=@var{register-range} @gol
1220 -mea32 -mea64 @gol
1221 -maddress-space-conversion -mno-address-space-conversion @gol
1222 -mcache-size=@var{cache-size} @gol
1223 -matomic-updates -mno-atomic-updates}
1224
1225 @emph{System V Options}
1226 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1227
1228 @emph{TILE-Gx Options}
1229 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1230 -mcmodel=@var{code-model}}
1231
1232 @emph{TILEPro Options}
1233 @gccoptlist{-mcpu=@var{cpu} -m32}
1234
1235 @emph{V850 Options}
1236 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1237 -mprolog-function -mno-prolog-function -mspace @gol
1238 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1239 -mapp-regs -mno-app-regs @gol
1240 -mdisable-callt -mno-disable-callt @gol
1241 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1242 -mv850e -mv850 -mv850e3v5 @gol
1243 -mloop @gol
1244 -mrelax @gol
1245 -mlong-jumps @gol
1246 -msoft-float @gol
1247 -mhard-float @gol
1248 -mgcc-abi @gol
1249 -mrh850-abi @gol
1250 -mbig-switch}
1251
1252 @emph{VAX Options}
1253 @gccoptlist{-mg -mgnu -munix}
1254
1255 @emph{Visium Options}
1256 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1257 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1258
1259 @emph{VMS Options}
1260 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1261 -mpointer-size=@var{size}}
1262
1263 @emph{VxWorks Options}
1264 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1265 -Xbind-lazy -Xbind-now}
1266
1267 @emph{x86 Options}
1268 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1269 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1270 -mfpmath=@var{unit} @gol
1271 -masm=@var{dialect} -mno-fancy-math-387 @gol
1272 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1273 -mno-wide-multiply -mrtd -malign-double @gol
1274 -mpreferred-stack-boundary=@var{num} @gol
1275 -mincoming-stack-boundary=@var{num} @gol
1276 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1277 -mrecip -mrecip=@var{opt} @gol
1278 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1279 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1280 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1281 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1282 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1283 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1284 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1285 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1286 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1287 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1288 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1289 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1290 -mrdseed -msgx -mavx512vp2intersect@gol
1291 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1292 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1293 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1294 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1295 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1296 -mregparm=@var{num} -msseregparm @gol
1297 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1298 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1299 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1300 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1301 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1302 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1303 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1304 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1305 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1306 -mstack-protector-guard-reg=@var{reg} @gol
1307 -mstack-protector-guard-offset=@var{offset} @gol
1308 -mstack-protector-guard-symbol=@var{symbol} @gol
1309 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1310 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1311 -mindirect-branch-register}
1312
1313 @emph{x86 Windows Options}
1314 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1315 -mnop-fun-dllimport -mthread @gol
1316 -municode -mwin32 -mwindows -fno-set-stack-executable}
1317
1318 @emph{Xstormy16 Options}
1319 @gccoptlist{-msim}
1320
1321 @emph{Xtensa Options}
1322 @gccoptlist{-mconst16 -mno-const16 @gol
1323 -mfused-madd -mno-fused-madd @gol
1324 -mforce-no-pic @gol
1325 -mserialize-volatile -mno-serialize-volatile @gol
1326 -mtext-section-literals -mno-text-section-literals @gol
1327 -mauto-litpools -mno-auto-litpools @gol
1328 -mtarget-align -mno-target-align @gol
1329 -mlongcalls -mno-longcalls}
1330
1331 @emph{zSeries Options}
1332 See S/390 and zSeries Options.
1333 @end table
1334
1335
1336 @node Overall Options
1337 @section Options Controlling the Kind of Output
1338
1339 Compilation can involve up to four stages: preprocessing, compilation
1340 proper, assembly and linking, always in that order. GCC is capable of
1341 preprocessing and compiling several files either into several
1342 assembler input files, or into one assembler input file; then each
1343 assembler input file produces an object file, and linking combines all
1344 the object files (those newly compiled, and those specified as input)
1345 into an executable file.
1346
1347 @cindex file name suffix
1348 For any given input file, the file name suffix determines what kind of
1349 compilation is done:
1350
1351 @table @gcctabopt
1352 @item @var{file}.c
1353 C source code that must be preprocessed.
1354
1355 @item @var{file}.i
1356 C source code that should not be preprocessed.
1357
1358 @item @var{file}.ii
1359 C++ source code that should not be preprocessed.
1360
1361 @item @var{file}.m
1362 Objective-C source code. Note that you must link with the @file{libobjc}
1363 library to make an Objective-C program work.
1364
1365 @item @var{file}.mi
1366 Objective-C source code that should not be preprocessed.
1367
1368 @item @var{file}.mm
1369 @itemx @var{file}.M
1370 Objective-C++ source code. Note that you must link with the @file{libobjc}
1371 library to make an Objective-C++ program work. Note that @samp{.M} refers
1372 to a literal capital M@.
1373
1374 @item @var{file}.mii
1375 Objective-C++ source code that should not be preprocessed.
1376
1377 @item @var{file}.h
1378 C, C++, Objective-C or Objective-C++ header file to be turned into a
1379 precompiled header (default), or C, C++ header file to be turned into an
1380 Ada spec (via the @option{-fdump-ada-spec} switch).
1381
1382 @item @var{file}.cc
1383 @itemx @var{file}.cp
1384 @itemx @var{file}.cxx
1385 @itemx @var{file}.cpp
1386 @itemx @var{file}.CPP
1387 @itemx @var{file}.c++
1388 @itemx @var{file}.C
1389 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1390 the last two letters must both be literally @samp{x}. Likewise,
1391 @samp{.C} refers to a literal capital C@.
1392
1393 @item @var{file}.mm
1394 @itemx @var{file}.M
1395 Objective-C++ source code that must be preprocessed.
1396
1397 @item @var{file}.mii
1398 Objective-C++ source code that should not be preprocessed.
1399
1400 @item @var{file}.hh
1401 @itemx @var{file}.H
1402 @itemx @var{file}.hp
1403 @itemx @var{file}.hxx
1404 @itemx @var{file}.hpp
1405 @itemx @var{file}.HPP
1406 @itemx @var{file}.h++
1407 @itemx @var{file}.tcc
1408 C++ header file to be turned into a precompiled header or Ada spec.
1409
1410 @item @var{file}.f
1411 @itemx @var{file}.for
1412 @itemx @var{file}.ftn
1413 Fixed form Fortran source code that should not be preprocessed.
1414
1415 @item @var{file}.F
1416 @itemx @var{file}.FOR
1417 @itemx @var{file}.fpp
1418 @itemx @var{file}.FPP
1419 @itemx @var{file}.FTN
1420 Fixed form Fortran source code that must be preprocessed (with the traditional
1421 preprocessor).
1422
1423 @item @var{file}.f90
1424 @itemx @var{file}.f95
1425 @itemx @var{file}.f03
1426 @itemx @var{file}.f08
1427 Free form Fortran source code that should not be preprocessed.
1428
1429 @item @var{file}.F90
1430 @itemx @var{file}.F95
1431 @itemx @var{file}.F03
1432 @itemx @var{file}.F08
1433 Free form Fortran source code that must be preprocessed (with the
1434 traditional preprocessor).
1435
1436 @item @var{file}.go
1437 Go source code.
1438
1439 @item @var{file}.brig
1440 BRIG files (binary representation of HSAIL).
1441
1442 @item @var{file}.d
1443 D source code.
1444
1445 @item @var{file}.di
1446 D interface file.
1447
1448 @item @var{file}.dd
1449 D documentation code (Ddoc).
1450
1451 @item @var{file}.ads
1452 Ada source code file that contains a library unit declaration (a
1453 declaration of a package, subprogram, or generic, or a generic
1454 instantiation), or a library unit renaming declaration (a package,
1455 generic, or subprogram renaming declaration). Such files are also
1456 called @dfn{specs}.
1457
1458 @item @var{file}.adb
1459 Ada source code file containing a library unit body (a subprogram or
1460 package body). Such files are also called @dfn{bodies}.
1461
1462 @c GCC also knows about some suffixes for languages not yet included:
1463 @c Ratfor:
1464 @c @var{file}.r
1465
1466 @item @var{file}.s
1467 Assembler code.
1468
1469 @item @var{file}.S
1470 @itemx @var{file}.sx
1471 Assembler code that must be preprocessed.
1472
1473 @item @var{other}
1474 An object file to be fed straight into linking.
1475 Any file name with no recognized suffix is treated this way.
1476 @end table
1477
1478 @opindex x
1479 You can specify the input language explicitly with the @option{-x} option:
1480
1481 @table @gcctabopt
1482 @item -x @var{language}
1483 Specify explicitly the @var{language} for the following input files
1484 (rather than letting the compiler choose a default based on the file
1485 name suffix). This option applies to all following input files until
1486 the next @option{-x} option. Possible values for @var{language} are:
1487 @smallexample
1488 c c-header cpp-output
1489 c++ c++-header c++-cpp-output
1490 objective-c objective-c-header objective-c-cpp-output
1491 objective-c++ objective-c++-header objective-c++-cpp-output
1492 assembler assembler-with-cpp
1493 ada
1494 d
1495 f77 f77-cpp-input f95 f95-cpp-input
1496 go
1497 brig
1498 @end smallexample
1499
1500 @item -x none
1501 Turn off any specification of a language, so that subsequent files are
1502 handled according to their file name suffixes (as they are if @option{-x}
1503 has not been used at all).
1504 @end table
1505
1506 If you only want some of the stages of compilation, you can use
1507 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1508 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1509 @command{gcc} is to stop. Note that some combinations (for example,
1510 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1511
1512 @table @gcctabopt
1513 @item -c
1514 @opindex c
1515 Compile or assemble the source files, but do not link. The linking
1516 stage simply is not done. The ultimate output is in the form of an
1517 object file for each source file.
1518
1519 By default, the object file name for a source file is made by replacing
1520 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1521
1522 Unrecognized input files, not requiring compilation or assembly, are
1523 ignored.
1524
1525 @item -S
1526 @opindex S
1527 Stop after the stage of compilation proper; do not assemble. The output
1528 is in the form of an assembler code file for each non-assembler input
1529 file specified.
1530
1531 By default, the assembler file name for a source file is made by
1532 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1533
1534 Input files that don't require compilation are ignored.
1535
1536 @item -E
1537 @opindex E
1538 Stop after the preprocessing stage; do not run the compiler proper. The
1539 output is in the form of preprocessed source code, which is sent to the
1540 standard output.
1541
1542 Input files that don't require preprocessing are ignored.
1543
1544 @cindex output file option
1545 @item -o @var{file}
1546 @opindex o
1547 Place output in file @var{file}. This applies to whatever
1548 sort of output is being produced, whether it be an executable file,
1549 an object file, an assembler file or preprocessed C code.
1550
1551 If @option{-o} is not specified, the default is to put an executable
1552 file in @file{a.out}, the object file for
1553 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1554 assembler file in @file{@var{source}.s}, a precompiled header file in
1555 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1556 standard output.
1557
1558 @item -v
1559 @opindex v
1560 Print (on standard error output) the commands executed to run the stages
1561 of compilation. Also print the version number of the compiler driver
1562 program and of the preprocessor and the compiler proper.
1563
1564 @item -###
1565 @opindex ###
1566 Like @option{-v} except the commands are not executed and arguments
1567 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1568 This is useful for shell scripts to capture the driver-generated command lines.
1569
1570 @item --help
1571 @opindex help
1572 Print (on the standard output) a description of the command-line options
1573 understood by @command{gcc}. If the @option{-v} option is also specified
1574 then @option{--help} is also passed on to the various processes
1575 invoked by @command{gcc}, so that they can display the command-line options
1576 they accept. If the @option{-Wextra} option has also been specified
1577 (prior to the @option{--help} option), then command-line options that
1578 have no documentation associated with them are also displayed.
1579
1580 @item --target-help
1581 @opindex target-help
1582 Print (on the standard output) a description of target-specific command-line
1583 options for each tool. For some targets extra target-specific
1584 information may also be printed.
1585
1586 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1587 Print (on the standard output) a description of the command-line
1588 options understood by the compiler that fit into all specified classes
1589 and qualifiers. These are the supported classes:
1590
1591 @table @asis
1592 @item @samp{optimizers}
1593 Display all of the optimization options supported by the
1594 compiler.
1595
1596 @item @samp{warnings}
1597 Display all of the options controlling warning messages
1598 produced by the compiler.
1599
1600 @item @samp{target}
1601 Display target-specific options. Unlike the
1602 @option{--target-help} option however, target-specific options of the
1603 linker and assembler are not displayed. This is because those
1604 tools do not currently support the extended @option{--help=} syntax.
1605
1606 @item @samp{params}
1607 Display the values recognized by the @option{--param}
1608 option.
1609
1610 @item @var{language}
1611 Display the options supported for @var{language}, where
1612 @var{language} is the name of one of the languages supported in this
1613 version of GCC@.
1614
1615 @item @samp{common}
1616 Display the options that are common to all languages.
1617 @end table
1618
1619 These are the supported qualifiers:
1620
1621 @table @asis
1622 @item @samp{undocumented}
1623 Display only those options that are undocumented.
1624
1625 @item @samp{joined}
1626 Display options taking an argument that appears after an equal
1627 sign in the same continuous piece of text, such as:
1628 @samp{--help=target}.
1629
1630 @item @samp{separate}
1631 Display options taking an argument that appears as a separate word
1632 following the original option, such as: @samp{-o output-file}.
1633 @end table
1634
1635 Thus for example to display all the undocumented target-specific
1636 switches supported by the compiler, use:
1637
1638 @smallexample
1639 --help=target,undocumented
1640 @end smallexample
1641
1642 The sense of a qualifier can be inverted by prefixing it with the
1643 @samp{^} character, so for example to display all binary warning
1644 options (i.e., ones that are either on or off and that do not take an
1645 argument) that have a description, use:
1646
1647 @smallexample
1648 --help=warnings,^joined,^undocumented
1649 @end smallexample
1650
1651 The argument to @option{--help=} should not consist solely of inverted
1652 qualifiers.
1653
1654 Combining several classes is possible, although this usually
1655 restricts the output so much that there is nothing to display. One
1656 case where it does work, however, is when one of the classes is
1657 @var{target}. For example, to display all the target-specific
1658 optimization options, use:
1659
1660 @smallexample
1661 --help=target,optimizers
1662 @end smallexample
1663
1664 The @option{--help=} option can be repeated on the command line. Each
1665 successive use displays its requested class of options, skipping
1666 those that have already been displayed. If @option{--help} is also
1667 specified anywhere on the command line then this takes precedence
1668 over any @option{--help=} option.
1669
1670 If the @option{-Q} option appears on the command line before the
1671 @option{--help=} option, then the descriptive text displayed by
1672 @option{--help=} is changed. Instead of describing the displayed
1673 options, an indication is given as to whether the option is enabled,
1674 disabled or set to a specific value (assuming that the compiler
1675 knows this at the point where the @option{--help=} option is used).
1676
1677 Here is a truncated example from the ARM port of @command{gcc}:
1678
1679 @smallexample
1680 % gcc -Q -mabi=2 --help=target -c
1681 The following options are target specific:
1682 -mabi= 2
1683 -mabort-on-noreturn [disabled]
1684 -mapcs [disabled]
1685 @end smallexample
1686
1687 The output is sensitive to the effects of previous command-line
1688 options, so for example it is possible to find out which optimizations
1689 are enabled at @option{-O2} by using:
1690
1691 @smallexample
1692 -Q -O2 --help=optimizers
1693 @end smallexample
1694
1695 Alternatively you can discover which binary optimizations are enabled
1696 by @option{-O3} by using:
1697
1698 @smallexample
1699 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1700 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1701 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1702 @end smallexample
1703
1704 @item --version
1705 @opindex version
1706 Display the version number and copyrights of the invoked GCC@.
1707
1708 @item -pass-exit-codes
1709 @opindex pass-exit-codes
1710 Normally the @command{gcc} program exits with the code of 1 if any
1711 phase of the compiler returns a non-success return code. If you specify
1712 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1713 the numerically highest error produced by any phase returning an error
1714 indication. The C, C++, and Fortran front ends return 4 if an internal
1715 compiler error is encountered.
1716
1717 @item -pipe
1718 @opindex pipe
1719 Use pipes rather than temporary files for communication between the
1720 various stages of compilation. This fails to work on some systems where
1721 the assembler is unable to read from a pipe; but the GNU assembler has
1722 no trouble.
1723
1724 @item -specs=@var{file}
1725 @opindex specs
1726 Process @var{file} after the compiler reads in the standard @file{specs}
1727 file, in order to override the defaults which the @command{gcc} driver
1728 program uses when determining what switches to pass to @command{cc1},
1729 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1730 @option{-specs=@var{file}} can be specified on the command line, and they
1731 are processed in order, from left to right. @xref{Spec Files}, for
1732 information about the format of the @var{file}.
1733
1734 @item -wrapper
1735 @opindex wrapper
1736 Invoke all subcommands under a wrapper program. The name of the
1737 wrapper program and its parameters are passed as a comma separated
1738 list.
1739
1740 @smallexample
1741 gcc -c t.c -wrapper gdb,--args
1742 @end smallexample
1743
1744 @noindent
1745 This invokes all subprograms of @command{gcc} under
1746 @samp{gdb --args}, thus the invocation of @command{cc1} is
1747 @samp{gdb --args cc1 @dots{}}.
1748
1749 @item -ffile-prefix-map=@var{old}=@var{new}
1750 @opindex ffile-prefix-map
1751 When compiling files residing in directory @file{@var{old}}, record
1752 any references to them in the result of the compilation as if the
1753 files resided in directory @file{@var{new}} instead. Specifying this
1754 option is equivalent to specifying all the individual
1755 @option{-f*-prefix-map} options. This can be used to make reproducible
1756 builds that are location independent. See also
1757 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1758
1759 @item -fplugin=@var{name}.so
1760 @opindex fplugin
1761 Load the plugin code in file @var{name}.so, assumed to be a
1762 shared object to be dlopen'd by the compiler. The base name of
1763 the shared object file is used to identify the plugin for the
1764 purposes of argument parsing (See
1765 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1766 Each plugin should define the callback functions specified in the
1767 Plugins API.
1768
1769 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1770 @opindex fplugin-arg
1771 Define an argument called @var{key} with a value of @var{value}
1772 for the plugin called @var{name}.
1773
1774 @item -fdump-ada-spec@r{[}-slim@r{]}
1775 @opindex fdump-ada-spec
1776 For C and C++ source and include files, generate corresponding Ada specs.
1777 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1778 GNAT User's Guide}, which provides detailed documentation on this feature.
1779
1780 @item -fada-spec-parent=@var{unit}
1781 @opindex fada-spec-parent
1782 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1783 Ada specs as child units of parent @var{unit}.
1784
1785 @item -fdump-go-spec=@var{file}
1786 @opindex fdump-go-spec
1787 For input files in any language, generate corresponding Go
1788 declarations in @var{file}. This generates Go @code{const},
1789 @code{type}, @code{var}, and @code{func} declarations which may be a
1790 useful way to start writing a Go interface to code written in some
1791 other language.
1792
1793 @include @value{srcdir}/../libiberty/at-file.texi
1794 @end table
1795
1796 @node Invoking G++
1797 @section Compiling C++ Programs
1798
1799 @cindex suffixes for C++ source
1800 @cindex C++ source file suffixes
1801 C++ source files conventionally use one of the suffixes @samp{.C},
1802 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1803 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1804 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1805 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1806 files with these names and compiles them as C++ programs even if you
1807 call the compiler the same way as for compiling C programs (usually
1808 with the name @command{gcc}).
1809
1810 @findex g++
1811 @findex c++
1812 However, the use of @command{gcc} does not add the C++ library.
1813 @command{g++} is a program that calls GCC and automatically specifies linking
1814 against the C++ library. It treats @samp{.c},
1815 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1816 files unless @option{-x} is used. This program is also useful when
1817 precompiling a C header file with a @samp{.h} extension for use in C++
1818 compilations. On many systems, @command{g++} is also installed with
1819 the name @command{c++}.
1820
1821 @cindex invoking @command{g++}
1822 When you compile C++ programs, you may specify many of the same
1823 command-line options that you use for compiling programs in any
1824 language; or command-line options meaningful for C and related
1825 languages; or options that are meaningful only for C++ programs.
1826 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1827 explanations of options for languages related to C@.
1828 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1829 explanations of options that are meaningful only for C++ programs.
1830
1831 @node C Dialect Options
1832 @section Options Controlling C Dialect
1833 @cindex dialect options
1834 @cindex language dialect options
1835 @cindex options, dialect
1836
1837 The following options control the dialect of C (or languages derived
1838 from C, such as C++, Objective-C and Objective-C++) that the compiler
1839 accepts:
1840
1841 @table @gcctabopt
1842 @cindex ANSI support
1843 @cindex ISO support
1844 @item -ansi
1845 @opindex ansi
1846 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1847 equivalent to @option{-std=c++98}.
1848
1849 This turns off certain features of GCC that are incompatible with ISO
1850 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1851 such as the @code{asm} and @code{typeof} keywords, and
1852 predefined macros such as @code{unix} and @code{vax} that identify the
1853 type of system you are using. It also enables the undesirable and
1854 rarely used ISO trigraph feature. For the C compiler,
1855 it disables recognition of C++ style @samp{//} comments as well as
1856 the @code{inline} keyword.
1857
1858 The alternate keywords @code{__asm__}, @code{__extension__},
1859 @code{__inline__} and @code{__typeof__} continue to work despite
1860 @option{-ansi}. You would not want to use them in an ISO C program, of
1861 course, but it is useful to put them in header files that might be included
1862 in compilations done with @option{-ansi}. Alternate predefined macros
1863 such as @code{__unix__} and @code{__vax__} are also available, with or
1864 without @option{-ansi}.
1865
1866 The @option{-ansi} option does not cause non-ISO programs to be
1867 rejected gratuitously. For that, @option{-Wpedantic} is required in
1868 addition to @option{-ansi}. @xref{Warning Options}.
1869
1870 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1871 option is used. Some header files may notice this macro and refrain
1872 from declaring certain functions or defining certain macros that the
1873 ISO standard doesn't call for; this is to avoid interfering with any
1874 programs that might use these names for other things.
1875
1876 Functions that are normally built in but do not have semantics
1877 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1878 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1879 built-in functions provided by GCC}, for details of the functions
1880 affected.
1881
1882 @item -std=
1883 @opindex std
1884 Determine the language standard. @xref{Standards,,Language Standards
1885 Supported by GCC}, for details of these standard versions. This option
1886 is currently only supported when compiling C or C++.
1887
1888 The compiler can accept several base standards, such as @samp{c90} or
1889 @samp{c++98}, and GNU dialects of those standards, such as
1890 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1891 compiler accepts all programs following that standard plus those
1892 using GNU extensions that do not contradict it. For example,
1893 @option{-std=c90} turns off certain features of GCC that are
1894 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1895 keywords, but not other GNU extensions that do not have a meaning in
1896 ISO C90, such as omitting the middle term of a @code{?:}
1897 expression. On the other hand, when a GNU dialect of a standard is
1898 specified, all features supported by the compiler are enabled, even when
1899 those features change the meaning of the base standard. As a result, some
1900 strict-conforming programs may be rejected. The particular standard
1901 is used by @option{-Wpedantic} to identify which features are GNU
1902 extensions given that version of the standard. For example
1903 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1904 comments, while @option{-std=gnu99 -Wpedantic} does not.
1905
1906 A value for this option must be provided; possible values are
1907
1908 @table @samp
1909 @item c90
1910 @itemx c89
1911 @itemx iso9899:1990
1912 Support all ISO C90 programs (certain GNU extensions that conflict
1913 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1914
1915 @item iso9899:199409
1916 ISO C90 as modified in amendment 1.
1917
1918 @item c99
1919 @itemx c9x
1920 @itemx iso9899:1999
1921 @itemx iso9899:199x
1922 ISO C99. This standard is substantially completely supported, modulo
1923 bugs and floating-point issues
1924 (mainly but not entirely relating to optional C99 features from
1925 Annexes F and G). See
1926 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1927 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1928
1929 @item c11
1930 @itemx c1x
1931 @itemx iso9899:2011
1932 ISO C11, the 2011 revision of the ISO C standard. This standard is
1933 substantially completely supported, modulo bugs, floating-point issues
1934 (mainly but not entirely relating to optional C11 features from
1935 Annexes F and G) and the optional Annexes K (Bounds-checking
1936 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1937
1938 @item c17
1939 @itemx c18
1940 @itemx iso9899:2017
1941 @itemx iso9899:2018
1942 ISO C17, the 2017 revision of the ISO C standard
1943 (published in 2018). This standard is
1944 same as C11 except for corrections of defects (all of which are also
1945 applied with @option{-std=c11}) and a new value of
1946 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1947
1948 @item c2x
1949 The next version of the ISO C standard, still under development. The
1950 support for this version is experimental and incomplete.
1951
1952 @item gnu90
1953 @itemx gnu89
1954 GNU dialect of ISO C90 (including some C99 features).
1955
1956 @item gnu99
1957 @itemx gnu9x
1958 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1959
1960 @item gnu11
1961 @itemx gnu1x
1962 GNU dialect of ISO C11.
1963 The name @samp{gnu1x} is deprecated.
1964
1965 @item gnu17
1966 @itemx gnu18
1967 GNU dialect of ISO C17. This is the default for C code.
1968
1969 @item gnu2x
1970 The next version of the ISO C standard, still under development, plus
1971 GNU extensions. The support for this version is experimental and
1972 incomplete.
1973
1974 @item c++98
1975 @itemx c++03
1976 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1977 additional defect reports. Same as @option{-ansi} for C++ code.
1978
1979 @item gnu++98
1980 @itemx gnu++03
1981 GNU dialect of @option{-std=c++98}.
1982
1983 @item c++11
1984 @itemx c++0x
1985 The 2011 ISO C++ standard plus amendments.
1986 The name @samp{c++0x} is deprecated.
1987
1988 @item gnu++11
1989 @itemx gnu++0x
1990 GNU dialect of @option{-std=c++11}.
1991 The name @samp{gnu++0x} is deprecated.
1992
1993 @item c++14
1994 @itemx c++1y
1995 The 2014 ISO C++ standard plus amendments.
1996 The name @samp{c++1y} is deprecated.
1997
1998 @item gnu++14
1999 @itemx gnu++1y
2000 GNU dialect of @option{-std=c++14}.
2001 This is the default for C++ code.
2002 The name @samp{gnu++1y} is deprecated.
2003
2004 @item c++17
2005 @itemx c++1z
2006 The 2017 ISO C++ standard plus amendments.
2007 The name @samp{c++1z} is deprecated.
2008
2009 @item gnu++17
2010 @itemx gnu++1z
2011 GNU dialect of @option{-std=c++17}.
2012 The name @samp{gnu++1z} is deprecated.
2013
2014 @item c++2a
2015 The next revision of the ISO C++ standard, tentatively planned for
2016 2020. Support is highly experimental, and will almost certainly
2017 change in incompatible ways in future releases.
2018
2019 @item gnu++2a
2020 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2021 and will almost certainly change in incompatible ways in future
2022 releases.
2023 @end table
2024
2025 @item -fgnu89-inline
2026 @opindex fgnu89-inline
2027 The option @option{-fgnu89-inline} tells GCC to use the traditional
2028 GNU semantics for @code{inline} functions when in C99 mode.
2029 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2030 Using this option is roughly equivalent to adding the
2031 @code{gnu_inline} function attribute to all inline functions
2032 (@pxref{Function Attributes}).
2033
2034 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2035 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2036 specifies the default behavior).
2037 This option is not supported in @option{-std=c90} or
2038 @option{-std=gnu90} mode.
2039
2040 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2041 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2042 in effect for @code{inline} functions. @xref{Common Predefined
2043 Macros,,,cpp,The C Preprocessor}.
2044
2045 @item -fpermitted-flt-eval-methods=@var{style}
2046 @opindex fpermitted-flt-eval-methods
2047 @opindex fpermitted-flt-eval-methods=c11
2048 @opindex fpermitted-flt-eval-methods=ts-18661-3
2049 ISO/IEC TS 18661-3 defines new permissible values for
2050 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2051 a semantic type that is an interchange or extended format should be
2052 evaluated to the precision and range of that type. These new values are
2053 a superset of those permitted under C99/C11, which does not specify the
2054 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2055 conforming to C11 may not have been written expecting the possibility of
2056 the new values.
2057
2058 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2059 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2060 or the extended set of values specified in ISO/IEC TS 18661-3.
2061
2062 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2063
2064 The default when in a standards compliant mode (@option{-std=c11} or similar)
2065 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2066 dialect (@option{-std=gnu11} or similar) is
2067 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2068
2069 @item -aux-info @var{filename}
2070 @opindex aux-info
2071 Output to the given filename prototyped declarations for all functions
2072 declared and/or defined in a translation unit, including those in header
2073 files. This option is silently ignored in any language other than C@.
2074
2075 Besides declarations, the file indicates, in comments, the origin of
2076 each declaration (source file and line), whether the declaration was
2077 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2078 @samp{O} for old, respectively, in the first character after the line
2079 number and the colon), and whether it came from a declaration or a
2080 definition (@samp{C} or @samp{F}, respectively, in the following
2081 character). In the case of function definitions, a K&R-style list of
2082 arguments followed by their declarations is also provided, inside
2083 comments, after the declaration.
2084
2085 @item -fallow-parameterless-variadic-functions
2086 @opindex fallow-parameterless-variadic-functions
2087 Accept variadic functions without named parameters.
2088
2089 Although it is possible to define such a function, this is not very
2090 useful as it is not possible to read the arguments. This is only
2091 supported for C as this construct is allowed by C++.
2092
2093 @item -fno-asm
2094 @opindex fno-asm
2095 @opindex fasm
2096 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2097 keyword, so that code can use these words as identifiers. You can use
2098 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2099 instead. @option{-ansi} implies @option{-fno-asm}.
2100
2101 In C++, this switch only affects the @code{typeof} keyword, since
2102 @code{asm} and @code{inline} are standard keywords. You may want to
2103 use the @option{-fno-gnu-keywords} flag instead, which has the same
2104 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2105 switch only affects the @code{asm} and @code{typeof} keywords, since
2106 @code{inline} is a standard keyword in ISO C99.
2107
2108 @item -fno-builtin
2109 @itemx -fno-builtin-@var{function}
2110 @opindex fno-builtin
2111 @opindex fbuiltin
2112 @cindex built-in functions
2113 Don't recognize built-in functions that do not begin with
2114 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2115 functions provided by GCC}, for details of the functions affected,
2116 including those which are not built-in functions when @option{-ansi} or
2117 @option{-std} options for strict ISO C conformance are used because they
2118 do not have an ISO standard meaning.
2119
2120 GCC normally generates special code to handle certain built-in functions
2121 more efficiently; for instance, calls to @code{alloca} may become single
2122 instructions which adjust the stack directly, and calls to @code{memcpy}
2123 may become inline copy loops. The resulting code is often both smaller
2124 and faster, but since the function calls no longer appear as such, you
2125 cannot set a breakpoint on those calls, nor can you change the behavior
2126 of the functions by linking with a different library. In addition,
2127 when a function is recognized as a built-in function, GCC may use
2128 information about that function to warn about problems with calls to
2129 that function, or to generate more efficient code, even if the
2130 resulting code still contains calls to that function. For example,
2131 warnings are given with @option{-Wformat} for bad calls to
2132 @code{printf} when @code{printf} is built in and @code{strlen} is
2133 known not to modify global memory.
2134
2135 With the @option{-fno-builtin-@var{function}} option
2136 only the built-in function @var{function} is
2137 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2138 function is named that is not built-in in this version of GCC, this
2139 option is ignored. There is no corresponding
2140 @option{-fbuiltin-@var{function}} option; if you wish to enable
2141 built-in functions selectively when using @option{-fno-builtin} or
2142 @option{-ffreestanding}, you may define macros such as:
2143
2144 @smallexample
2145 #define abs(n) __builtin_abs ((n))
2146 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2147 @end smallexample
2148
2149 @item -fgimple
2150 @opindex fgimple
2151
2152 Enable parsing of function definitions marked with @code{__GIMPLE}.
2153 This is an experimental feature that allows unit testing of GIMPLE
2154 passes.
2155
2156 @item -fhosted
2157 @opindex fhosted
2158 @cindex hosted environment
2159
2160 Assert that compilation targets a hosted environment. This implies
2161 @option{-fbuiltin}. A hosted environment is one in which the
2162 entire standard library is available, and in which @code{main} has a return
2163 type of @code{int}. Examples are nearly everything except a kernel.
2164 This is equivalent to @option{-fno-freestanding}.
2165
2166 @item -ffreestanding
2167 @opindex ffreestanding
2168 @cindex hosted environment
2169
2170 Assert that compilation targets a freestanding environment. This
2171 implies @option{-fno-builtin}. A freestanding environment
2172 is one in which the standard library may not exist, and program startup may
2173 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2174 This is equivalent to @option{-fno-hosted}.
2175
2176 @xref{Standards,,Language Standards Supported by GCC}, for details of
2177 freestanding and hosted environments.
2178
2179 @item -fopenacc
2180 @opindex fopenacc
2181 @cindex OpenACC accelerator programming
2182 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2183 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2184 compiler generates accelerated code according to the OpenACC Application
2185 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2186 implies @option{-pthread}, and thus is only supported on targets that
2187 have support for @option{-pthread}.
2188
2189 @item -fopenacc-dim=@var{geom}
2190 @opindex fopenacc-dim
2191 @cindex OpenACC accelerator programming
2192 Specify default compute dimensions for parallel offload regions that do
2193 not explicitly specify. The @var{geom} value is a triple of
2194 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2195 can be omitted, to use a target-specific default value.
2196
2197 @item -fopenmp
2198 @opindex fopenmp
2199 @cindex OpenMP parallel
2200 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2201 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2202 compiler generates parallel code according to the OpenMP Application
2203 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2204 implies @option{-pthread}, and thus is only supported on targets that
2205 have support for @option{-pthread}. @option{-fopenmp} implies
2206 @option{-fopenmp-simd}.
2207
2208 @item -fopenmp-simd
2209 @opindex fopenmp-simd
2210 @cindex OpenMP SIMD
2211 @cindex SIMD
2212 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2213 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2214 are ignored.
2215
2216 @item -fgnu-tm
2217 @opindex fgnu-tm
2218 When the option @option{-fgnu-tm} is specified, the compiler
2219 generates code for the Linux variant of Intel's current Transactional
2220 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2221 an experimental feature whose interface may change in future versions
2222 of GCC, as the official specification changes. Please note that not
2223 all architectures are supported for this feature.
2224
2225 For more information on GCC's support for transactional memory,
2226 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2227 Transactional Memory Library}.
2228
2229 Note that the transactional memory feature is not supported with
2230 non-call exceptions (@option{-fnon-call-exceptions}).
2231
2232 @item -fms-extensions
2233 @opindex fms-extensions
2234 Accept some non-standard constructs used in Microsoft header files.
2235
2236 In C++ code, this allows member names in structures to be similar
2237 to previous types declarations.
2238
2239 @smallexample
2240 typedef int UOW;
2241 struct ABC @{
2242 UOW UOW;
2243 @};
2244 @end smallexample
2245
2246 Some cases of unnamed fields in structures and unions are only
2247 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2248 fields within structs/unions}, for details.
2249
2250 Note that this option is off for all targets except for x86
2251 targets using ms-abi.
2252
2253 @item -fplan9-extensions
2254 @opindex fplan9-extensions
2255 Accept some non-standard constructs used in Plan 9 code.
2256
2257 This enables @option{-fms-extensions}, permits passing pointers to
2258 structures with anonymous fields to functions that expect pointers to
2259 elements of the type of the field, and permits referring to anonymous
2260 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2261 struct/union fields within structs/unions}, for details. This is only
2262 supported for C, not C++.
2263
2264 @item -fcond-mismatch
2265 @opindex fcond-mismatch
2266 Allow conditional expressions with mismatched types in the second and
2267 third arguments. The value of such an expression is void. This option
2268 is not supported for C++.
2269
2270 @item -flax-vector-conversions
2271 @opindex flax-vector-conversions
2272 Allow implicit conversions between vectors with differing numbers of
2273 elements and/or incompatible element types. This option should not be
2274 used for new code.
2275
2276 @item -funsigned-char
2277 @opindex funsigned-char
2278 Let the type @code{char} be unsigned, like @code{unsigned char}.
2279
2280 Each kind of machine has a default for what @code{char} should
2281 be. It is either like @code{unsigned char} by default or like
2282 @code{signed char} by default.
2283
2284 Ideally, a portable program should always use @code{signed char} or
2285 @code{unsigned char} when it depends on the signedness of an object.
2286 But many programs have been written to use plain @code{char} and
2287 expect it to be signed, or expect it to be unsigned, depending on the
2288 machines they were written for. This option, and its inverse, let you
2289 make such a program work with the opposite default.
2290
2291 The type @code{char} is always a distinct type from each of
2292 @code{signed char} or @code{unsigned char}, even though its behavior
2293 is always just like one of those two.
2294
2295 @item -fsigned-char
2296 @opindex fsigned-char
2297 Let the type @code{char} be signed, like @code{signed char}.
2298
2299 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2300 the negative form of @option{-funsigned-char}. Likewise, the option
2301 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2302
2303 @item -fsigned-bitfields
2304 @itemx -funsigned-bitfields
2305 @itemx -fno-signed-bitfields
2306 @itemx -fno-unsigned-bitfields
2307 @opindex fsigned-bitfields
2308 @opindex funsigned-bitfields
2309 @opindex fno-signed-bitfields
2310 @opindex fno-unsigned-bitfields
2311 These options control whether a bit-field is signed or unsigned, when the
2312 declaration does not use either @code{signed} or @code{unsigned}. By
2313 default, such a bit-field is signed, because this is consistent: the
2314 basic integer types such as @code{int} are signed types.
2315
2316 @item -fsso-struct=@var{endianness}
2317 @opindex fsso-struct
2318 Set the default scalar storage order of structures and unions to the
2319 specified endianness. The accepted values are @samp{big-endian},
2320 @samp{little-endian} and @samp{native} for the native endianness of
2321 the target (the default). This option is not supported for C++.
2322
2323 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2324 code that is not binary compatible with code generated without it if the
2325 specified endianness is not the native endianness of the target.
2326 @end table
2327
2328 @node C++ Dialect Options
2329 @section Options Controlling C++ Dialect
2330
2331 @cindex compiler options, C++
2332 @cindex C++ options, command-line
2333 @cindex options, C++
2334 This section describes the command-line options that are only meaningful
2335 for C++ programs. You can also use most of the GNU compiler options
2336 regardless of what language your program is in. For example, you
2337 might compile a file @file{firstClass.C} like this:
2338
2339 @smallexample
2340 g++ -g -fstrict-enums -O -c firstClass.C
2341 @end smallexample
2342
2343 @noindent
2344 In this example, only @option{-fstrict-enums} is an option meant
2345 only for C++ programs; you can use the other options with any
2346 language supported by GCC@.
2347
2348 Some options for compiling C programs, such as @option{-std}, are also
2349 relevant for C++ programs.
2350 @xref{C Dialect Options,,Options Controlling C Dialect}.
2351
2352 Here is a list of options that are @emph{only} for compiling C++ programs:
2353
2354 @table @gcctabopt
2355
2356 @item -fabi-version=@var{n}
2357 @opindex fabi-version
2358 Use version @var{n} of the C++ ABI@. The default is version 0.
2359
2360 Version 0 refers to the version conforming most closely to
2361 the C++ ABI specification. Therefore, the ABI obtained using version 0
2362 will change in different versions of G++ as ABI bugs are fixed.
2363
2364 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2365
2366 Version 2 is the version of the C++ ABI that first appeared in G++
2367 3.4, and was the default through G++ 4.9.
2368
2369 Version 3 corrects an error in mangling a constant address as a
2370 template argument.
2371
2372 Version 4, which first appeared in G++ 4.5, implements a standard
2373 mangling for vector types.
2374
2375 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2376 attribute const/volatile on function pointer types, decltype of a
2377 plain decl, and use of a function parameter in the declaration of
2378 another parameter.
2379
2380 Version 6, which first appeared in G++ 4.7, corrects the promotion
2381 behavior of C++11 scoped enums and the mangling of template argument
2382 packs, const/static_cast, prefix ++ and --, and a class scope function
2383 used as a template argument.
2384
2385 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2386 builtin type and corrects the mangling of lambdas in default argument
2387 scope.
2388
2389 Version 8, which first appeared in G++ 4.9, corrects the substitution
2390 behavior of function types with function-cv-qualifiers.
2391
2392 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2393 @code{nullptr_t}.
2394
2395 Version 10, which first appeared in G++ 6.1, adds mangling of
2396 attributes that affect type identity, such as ia32 calling convention
2397 attributes (e.g.@: @samp{stdcall}).
2398
2399 Version 11, which first appeared in G++ 7, corrects the mangling of
2400 sizeof... expressions and operator names. For multiple entities with
2401 the same name within a function, that are declared in different scopes,
2402 the mangling now changes starting with the twelfth occurrence. It also
2403 implies @option{-fnew-inheriting-ctors}.
2404
2405 Version 12, which first appeared in G++ 8, corrects the calling
2406 conventions for empty classes on the x86_64 target and for classes
2407 with only deleted copy/move constructors. It accidentally changes the
2408 calling convention for classes with a deleted copy constructor and a
2409 trivial move constructor.
2410
2411 Version 13, which first appeared in G++ 8.2, fixes the accidental
2412 change in version 12.
2413
2414 See also @option{-Wabi}.
2415
2416 @item -fabi-compat-version=@var{n}
2417 @opindex fabi-compat-version
2418 On targets that support strong aliases, G++
2419 works around mangling changes by creating an alias with the correct
2420 mangled name when defining a symbol with an incorrect mangled name.
2421 This switch specifies which ABI version to use for the alias.
2422
2423 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2424 compatibility). If another ABI version is explicitly selected, this
2425 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2426 use @option{-fabi-compat-version=2}.
2427
2428 If this option is not provided but @option{-Wabi=@var{n}} is, that
2429 version is used for compatibility aliases. If this option is provided
2430 along with @option{-Wabi} (without the version), the version from this
2431 option is used for the warning.
2432
2433 @item -fno-access-control
2434 @opindex fno-access-control
2435 @opindex faccess-control
2436 Turn off all access checking. This switch is mainly useful for working
2437 around bugs in the access control code.
2438
2439 @item -faligned-new
2440 @opindex faligned-new
2441 Enable support for C++17 @code{new} of types that require more
2442 alignment than @code{void* ::operator new(std::size_t)} provides. A
2443 numeric argument such as @code{-faligned-new=32} can be used to
2444 specify how much alignment (in bytes) is provided by that function,
2445 but few users will need to override the default of
2446 @code{alignof(std::max_align_t)}.
2447
2448 This flag is enabled by default for @option{-std=c++17}.
2449
2450 @item -fchar8_t
2451 @itemx -fno-char8_t
2452 @opindex fchar8_t
2453 @opindex fno-char8_t
2454 Enable support for @code{char8_t} as adopted for C++2a. This includes
2455 the addition of a new @code{char8_t} fundamental type, changes to the
2456 types of UTF-8 string and character literals, new signatures for
2457 user-defined literals, associated standard library updates, and new
2458 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2459
2460 This option enables functions to be overloaded for ordinary and UTF-8
2461 strings:
2462
2463 @smallexample
2464 int f(const char *); // #1
2465 int f(const char8_t *); // #2
2466 int v1 = f("text"); // Calls #1
2467 int v2 = f(u8"text"); // Calls #2
2468 @end smallexample
2469
2470 @noindent
2471 and introduces new signatures for user-defined literals:
2472
2473 @smallexample
2474 int operator""_udl1(char8_t);
2475 int v3 = u8'x'_udl1;
2476 int operator""_udl2(const char8_t*, std::size_t);
2477 int v4 = u8"text"_udl2;
2478 template<typename T, T...> int operator""_udl3();
2479 int v5 = u8"text"_udl3;
2480 @end smallexample
2481
2482 @noindent
2483 The change to the types of UTF-8 string and character literals introduces
2484 incompatibilities with ISO C++11 and later standards. For example, the
2485 following code is well-formed under ISO C++11, but is ill-formed when
2486 @option{-fchar8_t} is specified.
2487
2488 @smallexample
2489 char ca[] = u8"xx"; // error: char-array initialized from wide
2490 // string
2491 const char *cp = u8"xx";// error: invalid conversion from
2492 // `const char8_t*' to `const char*'
2493 int f(const char*);
2494 auto v = f(u8"xx"); // error: invalid conversion from
2495 // `const char8_t*' to `const char*'
2496 std::string s@{u8"xx"@}; // error: no matching function for call to
2497 // `std::basic_string<char>::basic_string()'
2498 using namespace std::literals;
2499 s = u8"xx"s; // error: conversion from
2500 // `basic_string<char8_t>' to non-scalar
2501 // type `basic_string<char>' requested
2502 @end smallexample
2503
2504 @item -fcheck-new
2505 @opindex fcheck-new
2506 Check that the pointer returned by @code{operator new} is non-null
2507 before attempting to modify the storage allocated. This check is
2508 normally unnecessary because the C++ standard specifies that
2509 @code{operator new} only returns @code{0} if it is declared
2510 @code{throw()}, in which case the compiler always checks the
2511 return value even without this option. In all other cases, when
2512 @code{operator new} has a non-empty exception specification, memory
2513 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2514 @samp{new (nothrow)}.
2515
2516 @item -fconcepts
2517 @opindex fconcepts
2518 Enable support for the C++ Extensions for Concepts Technical
2519 Specification, ISO 19217 (2015), which allows code like
2520
2521 @smallexample
2522 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2523 template <Addable T> T add (T a, T b) @{ return a + b; @}
2524 @end smallexample
2525
2526 @item -fconstexpr-depth=@var{n}
2527 @opindex fconstexpr-depth
2528 Set the maximum nested evaluation depth for C++11 constexpr functions
2529 to @var{n}. A limit is needed to detect endless recursion during
2530 constant expression evaluation. The minimum specified by the standard
2531 is 512.
2532
2533 @item -fconstexpr-cache-depth=@var{n}
2534 @opindex fconstexpr-cache-depth
2535 Set the maximum level of nested evaluation depth for C++11 constexpr
2536 functions that will be cached to @var{n}. This is a heuristic that
2537 trades off compilation speed (when the cache avoids repeated
2538 calculations) against memory consumption (when the cache grows very
2539 large from highly recursive evaluations). The default is 8. Very few
2540 users are likely to want to adjust it, but if your code does heavy
2541 constexpr calculations you might want to experiment to find which
2542 value works best for you.
2543
2544 @item -fconstexpr-loop-limit=@var{n}
2545 @opindex fconstexpr-loop-limit
2546 Set the maximum number of iterations for a loop in C++14 constexpr functions
2547 to @var{n}. A limit is needed to detect infinite loops during
2548 constant expression evaluation. The default is 262144 (1<<18).
2549
2550 @item -fconstexpr-ops-limit=@var{n}
2551 @opindex fconstexpr-ops-limit
2552 Set the maximum number of operations during a single constexpr evaluation.
2553 Even when number of iterations of a single loop is limited with the above limit,
2554 if there are several nested loops and each of them has many iterations but still
2555 smaller than the above limit, or if in a body of some loop or even outside
2556 of a loop too many expressions need to be evaluated, the resulting constexpr
2557 evaluation might take too long.
2558 The default is 33554432 (1<<25).
2559
2560 @item -fdeduce-init-list
2561 @opindex fdeduce-init-list
2562 Enable deduction of a template type parameter as
2563 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2564
2565 @smallexample
2566 template <class T> auto forward(T t) -> decltype (realfn (t))
2567 @{
2568 return realfn (t);
2569 @}
2570
2571 void f()
2572 @{
2573 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2574 @}
2575 @end smallexample
2576
2577 This deduction was implemented as a possible extension to the
2578 originally proposed semantics for the C++11 standard, but was not part
2579 of the final standard, so it is disabled by default. This option is
2580 deprecated, and may be removed in a future version of G++.
2581
2582 @item -fno-elide-constructors
2583 @opindex fno-elide-constructors
2584 @opindex felide-constructors
2585 The C++ standard allows an implementation to omit creating a temporary
2586 that is only used to initialize another object of the same type.
2587 Specifying this option disables that optimization, and forces G++ to
2588 call the copy constructor in all cases. This option also causes G++
2589 to call trivial member functions which otherwise would be expanded inline.
2590
2591 In C++17, the compiler is required to omit these temporaries, but this
2592 option still affects trivial member functions.
2593
2594 @item -fno-enforce-eh-specs
2595 @opindex fno-enforce-eh-specs
2596 @opindex fenforce-eh-specs
2597 Don't generate code to check for violation of exception specifications
2598 at run time. This option violates the C++ standard, but may be useful
2599 for reducing code size in production builds, much like defining
2600 @code{NDEBUG}. This does not give user code permission to throw
2601 exceptions in violation of the exception specifications; the compiler
2602 still optimizes based on the specifications, so throwing an
2603 unexpected exception results in undefined behavior at run time.
2604
2605 @item -fextern-tls-init
2606 @itemx -fno-extern-tls-init
2607 @opindex fextern-tls-init
2608 @opindex fno-extern-tls-init
2609 The C++11 and OpenMP standards allow @code{thread_local} and
2610 @code{threadprivate} variables to have dynamic (runtime)
2611 initialization. To support this, any use of such a variable goes
2612 through a wrapper function that performs any necessary initialization.
2613 When the use and definition of the variable are in the same
2614 translation unit, this overhead can be optimized away, but when the
2615 use is in a different translation unit there is significant overhead
2616 even if the variable doesn't actually need dynamic initialization. If
2617 the programmer can be sure that no use of the variable in a
2618 non-defining TU needs to trigger dynamic initialization (either
2619 because the variable is statically initialized, or a use of the
2620 variable in the defining TU will be executed before any uses in
2621 another TU), they can avoid this overhead with the
2622 @option{-fno-extern-tls-init} option.
2623
2624 On targets that support symbol aliases, the default is
2625 @option{-fextern-tls-init}. On targets that do not support symbol
2626 aliases, the default is @option{-fno-extern-tls-init}.
2627
2628 @item -fno-gnu-keywords
2629 @opindex fno-gnu-keywords
2630 @opindex fgnu-keywords
2631 Do not recognize @code{typeof} as a keyword, so that code can use this
2632 word as an identifier. You can use the keyword @code{__typeof__} instead.
2633 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2634 @option{-std=c++98}, @option{-std=c++11}, etc.
2635
2636 @item -fno-implicit-templates
2637 @opindex fno-implicit-templates
2638 @opindex fimplicit-templates
2639 Never emit code for non-inline templates that are instantiated
2640 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2641 If you use this option, you must take care to structure your code to
2642 include all the necessary explicit instantiations to avoid getting
2643 undefined symbols at link time.
2644 @xref{Template Instantiation}, for more information.
2645
2646 @item -fno-implicit-inline-templates
2647 @opindex fno-implicit-inline-templates
2648 @opindex fimplicit-inline-templates
2649 Don't emit code for implicit instantiations of inline templates, either.
2650 The default is to handle inlines differently so that compiles with and
2651 without optimization need the same set of explicit instantiations.
2652
2653 @item -fno-implement-inlines
2654 @opindex fno-implement-inlines
2655 @opindex fimplement-inlines
2656 To save space, do not emit out-of-line copies of inline functions
2657 controlled by @code{#pragma implementation}. This causes linker
2658 errors if these functions are not inlined everywhere they are called.
2659
2660 @item -fms-extensions
2661 @opindex fms-extensions
2662 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2663 int and getting a pointer to member function via non-standard syntax.
2664
2665 @item -fnew-inheriting-ctors
2666 @opindex fnew-inheriting-ctors
2667 Enable the P0136 adjustment to the semantics of C++11 constructor
2668 inheritance. This is part of C++17 but also considered to be a Defect
2669 Report against C++11 and C++14. This flag is enabled by default
2670 unless @option{-fabi-version=10} or lower is specified.
2671
2672 @item -fnew-ttp-matching
2673 @opindex fnew-ttp-matching
2674 Enable the P0522 resolution to Core issue 150, template template
2675 parameters and default arguments: this allows a template with default
2676 template arguments as an argument for a template template parameter
2677 with fewer template parameters. This flag is enabled by default for
2678 @option{-std=c++17}.
2679
2680 @item -fno-nonansi-builtins
2681 @opindex fno-nonansi-builtins
2682 @opindex fnonansi-builtins
2683 Disable built-in declarations of functions that are not mandated by
2684 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2685 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2686
2687 @item -fnothrow-opt
2688 @opindex fnothrow-opt
2689 Treat a @code{throw()} exception specification as if it were a
2690 @code{noexcept} specification to reduce or eliminate the text size
2691 overhead relative to a function with no exception specification. If
2692 the function has local variables of types with non-trivial
2693 destructors, the exception specification actually makes the
2694 function smaller because the EH cleanups for those variables can be
2695 optimized away. The semantic effect is that an exception thrown out of
2696 a function with such an exception specification results in a call
2697 to @code{terminate} rather than @code{unexpected}.
2698
2699 @item -fno-operator-names
2700 @opindex fno-operator-names
2701 @opindex foperator-names
2702 Do not treat the operator name keywords @code{and}, @code{bitand},
2703 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2704 synonyms as keywords.
2705
2706 @item -fno-optional-diags
2707 @opindex fno-optional-diags
2708 @opindex foptional-diags
2709 Disable diagnostics that the standard says a compiler does not need to
2710 issue. Currently, the only such diagnostic issued by G++ is the one for
2711 a name having multiple meanings within a class.
2712
2713 @item -fpermissive
2714 @opindex fpermissive
2715 Downgrade some diagnostics about nonconformant code from errors to
2716 warnings. Thus, using @option{-fpermissive} allows some
2717 nonconforming code to compile.
2718
2719 @item -fno-pretty-templates
2720 @opindex fno-pretty-templates
2721 @opindex fpretty-templates
2722 When an error message refers to a specialization of a function
2723 template, the compiler normally prints the signature of the
2724 template followed by the template arguments and any typedefs or
2725 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2726 rather than @code{void f(int)}) so that it's clear which template is
2727 involved. When an error message refers to a specialization of a class
2728 template, the compiler omits any template arguments that match
2729 the default template arguments for that template. If either of these
2730 behaviors make it harder to understand the error message rather than
2731 easier, you can use @option{-fno-pretty-templates} to disable them.
2732
2733 @item -frepo
2734 @opindex frepo
2735 Enable automatic template instantiation at link time. This option also
2736 implies @option{-fno-implicit-templates}. @xref{Template
2737 Instantiation}, for more information.
2738
2739 @item -fno-rtti
2740 @opindex fno-rtti
2741 @opindex frtti
2742 Disable generation of information about every class with virtual
2743 functions for use by the C++ run-time type identification features
2744 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2745 of the language, you can save some space by using this flag. Note that
2746 exception handling uses the same information, but G++ generates it as
2747 needed. The @code{dynamic_cast} operator can still be used for casts that
2748 do not require run-time type information, i.e.@: casts to @code{void *} or to
2749 unambiguous base classes.
2750
2751 Mixing code compiled with @option{-frtti} with that compiled with
2752 @option{-fno-rtti} may not work. For example, programs may
2753 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2754 for a class compiled with @option{-frtti}.
2755
2756 @item -fsized-deallocation
2757 @opindex fsized-deallocation
2758 Enable the built-in global declarations
2759 @smallexample
2760 void operator delete (void *, std::size_t) noexcept;
2761 void operator delete[] (void *, std::size_t) noexcept;
2762 @end smallexample
2763 as introduced in C++14. This is useful for user-defined replacement
2764 deallocation functions that, for example, use the size of the object
2765 to make deallocation faster. Enabled by default under
2766 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2767 warns about places that might want to add a definition.
2768
2769 @item -fstrict-enums
2770 @opindex fstrict-enums
2771 Allow the compiler to optimize using the assumption that a value of
2772 enumerated type can only be one of the values of the enumeration (as
2773 defined in the C++ standard; basically, a value that can be
2774 represented in the minimum number of bits needed to represent all the
2775 enumerators). This assumption may not be valid if the program uses a
2776 cast to convert an arbitrary integer value to the enumerated type.
2777
2778 @item -fstrong-eval-order
2779 @opindex fstrong-eval-order
2780 Evaluate member access, array subscripting, and shift expressions in
2781 left-to-right order, and evaluate assignment in right-to-left order,
2782 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2783 @option{-fstrong-eval-order=some} enables just the ordering of member
2784 access and shift expressions, and is the default without
2785 @option{-std=c++17}.
2786
2787 @item -ftemplate-backtrace-limit=@var{n}
2788 @opindex ftemplate-backtrace-limit
2789 Set the maximum number of template instantiation notes for a single
2790 warning or error to @var{n}. The default value is 10.
2791
2792 @item -ftemplate-depth=@var{n}
2793 @opindex ftemplate-depth
2794 Set the maximum instantiation depth for template classes to @var{n}.
2795 A limit on the template instantiation depth is needed to detect
2796 endless recursions during template class instantiation. ANSI/ISO C++
2797 conforming programs must not rely on a maximum depth greater than 17
2798 (changed to 1024 in C++11). The default value is 900, as the compiler
2799 can run out of stack space before hitting 1024 in some situations.
2800
2801 @item -fno-threadsafe-statics
2802 @opindex fno-threadsafe-statics
2803 @opindex fthreadsafe-statics
2804 Do not emit the extra code to use the routines specified in the C++
2805 ABI for thread-safe initialization of local statics. You can use this
2806 option to reduce code size slightly in code that doesn't need to be
2807 thread-safe.
2808
2809 @item -fuse-cxa-atexit
2810 @opindex fuse-cxa-atexit
2811 Register destructors for objects with static storage duration with the
2812 @code{__cxa_atexit} function rather than the @code{atexit} function.
2813 This option is required for fully standards-compliant handling of static
2814 destructors, but only works if your C library supports
2815 @code{__cxa_atexit}.
2816
2817 @item -fno-use-cxa-get-exception-ptr
2818 @opindex fno-use-cxa-get-exception-ptr
2819 @opindex fuse-cxa-get-exception-ptr
2820 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2821 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2822 if the runtime routine is not available.
2823
2824 @item -fvisibility-inlines-hidden
2825 @opindex fvisibility-inlines-hidden
2826 This switch declares that the user does not attempt to compare
2827 pointers to inline functions or methods where the addresses of the two functions
2828 are taken in different shared objects.
2829
2830 The effect of this is that GCC may, effectively, mark inline methods with
2831 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2832 appear in the export table of a DSO and do not require a PLT indirection
2833 when used within the DSO@. Enabling this option can have a dramatic effect
2834 on load and link times of a DSO as it massively reduces the size of the
2835 dynamic export table when the library makes heavy use of templates.
2836
2837 The behavior of this switch is not quite the same as marking the
2838 methods as hidden directly, because it does not affect static variables
2839 local to the function or cause the compiler to deduce that
2840 the function is defined in only one shared object.
2841
2842 You may mark a method as having a visibility explicitly to negate the
2843 effect of the switch for that method. For example, if you do want to
2844 compare pointers to a particular inline method, you might mark it as
2845 having default visibility. Marking the enclosing class with explicit
2846 visibility has no effect.
2847
2848 Explicitly instantiated inline methods are unaffected by this option
2849 as their linkage might otherwise cross a shared library boundary.
2850 @xref{Template Instantiation}.
2851
2852 @item -fvisibility-ms-compat
2853 @opindex fvisibility-ms-compat
2854 This flag attempts to use visibility settings to make GCC's C++
2855 linkage model compatible with that of Microsoft Visual Studio.
2856
2857 The flag makes these changes to GCC's linkage model:
2858
2859 @enumerate
2860 @item
2861 It sets the default visibility to @code{hidden}, like
2862 @option{-fvisibility=hidden}.
2863
2864 @item
2865 Types, but not their members, are not hidden by default.
2866
2867 @item
2868 The One Definition Rule is relaxed for types without explicit
2869 visibility specifications that are defined in more than one
2870 shared object: those declarations are permitted if they are
2871 permitted when this option is not used.
2872 @end enumerate
2873
2874 In new code it is better to use @option{-fvisibility=hidden} and
2875 export those classes that are intended to be externally visible.
2876 Unfortunately it is possible for code to rely, perhaps accidentally,
2877 on the Visual Studio behavior.
2878
2879 Among the consequences of these changes are that static data members
2880 of the same type with the same name but defined in different shared
2881 objects are different, so changing one does not change the other;
2882 and that pointers to function members defined in different shared
2883 objects may not compare equal. When this flag is given, it is a
2884 violation of the ODR to define types with the same name differently.
2885
2886 @item -fno-weak
2887 @opindex fno-weak
2888 @opindex fweak
2889 Do not use weak symbol support, even if it is provided by the linker.
2890 By default, G++ uses weak symbols if they are available. This
2891 option exists only for testing, and should not be used by end-users;
2892 it results in inferior code and has no benefits. This option may
2893 be removed in a future release of G++.
2894
2895 @item -nostdinc++
2896 @opindex nostdinc++
2897 Do not search for header files in the standard directories specific to
2898 C++, but do still search the other standard directories. (This option
2899 is used when building the C++ library.)
2900 @end table
2901
2902 In addition, these optimization, warning, and code generation options
2903 have meanings only for C++ programs:
2904
2905 @table @gcctabopt
2906 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2907 @opindex Wabi
2908 @opindex Wno-abi
2909 Warn when G++ it generates code that is probably not compatible with
2910 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2911 ABI with each major release, normally @option{-Wabi} will warn only if
2912 there is a check added later in a release series for an ABI issue
2913 discovered since the initial release. @option{-Wabi} will warn about
2914 more things if an older ABI version is selected (with
2915 @option{-fabi-version=@var{n}}).
2916
2917 @option{-Wabi} can also be used with an explicit version number to
2918 warn about compatibility with a particular @option{-fabi-version}
2919 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2920 @option{-fabi-version=2}.
2921
2922 If an explicit version number is provided and
2923 @option{-fabi-compat-version} is not specified, the version number
2924 from this option is used for compatibility aliases. If no explicit
2925 version number is provided with this option, but
2926 @option{-fabi-compat-version} is specified, that version number is
2927 used for ABI warnings.
2928
2929 Although an effort has been made to warn about
2930 all such cases, there are probably some cases that are not warned about,
2931 even though G++ is generating incompatible code. There may also be
2932 cases where warnings are emitted even though the code that is generated
2933 is compatible.
2934
2935 You should rewrite your code to avoid these warnings if you are
2936 concerned about the fact that code generated by G++ may not be binary
2937 compatible with code generated by other compilers.
2938
2939 Known incompatibilities in @option{-fabi-version=2} (which was the
2940 default from GCC 3.4 to 4.9) include:
2941
2942 @itemize @bullet
2943
2944 @item
2945 A template with a non-type template parameter of reference type was
2946 mangled incorrectly:
2947 @smallexample
2948 extern int N;
2949 template <int &> struct S @{@};
2950 void n (S<N>) @{2@}
2951 @end smallexample
2952
2953 This was fixed in @option{-fabi-version=3}.
2954
2955 @item
2956 SIMD vector types declared using @code{__attribute ((vector_size))} were
2957 mangled in a non-standard way that does not allow for overloading of
2958 functions taking vectors of different sizes.
2959
2960 The mangling was changed in @option{-fabi-version=4}.
2961
2962 @item
2963 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2964 qualifiers, and @code{decltype} of a plain declaration was folded away.
2965
2966 These mangling issues were fixed in @option{-fabi-version=5}.
2967
2968 @item
2969 Scoped enumerators passed as arguments to a variadic function are
2970 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2971 On most targets this does not actually affect the parameter passing
2972 ABI, as there is no way to pass an argument smaller than @code{int}.
2973
2974 Also, the ABI changed the mangling of template argument packs,
2975 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2976 a class scope function used as a template argument.
2977
2978 These issues were corrected in @option{-fabi-version=6}.
2979
2980 @item
2981 Lambdas in default argument scope were mangled incorrectly, and the
2982 ABI changed the mangling of @code{nullptr_t}.
2983
2984 These issues were corrected in @option{-fabi-version=7}.
2985
2986 @item
2987 When mangling a function type with function-cv-qualifiers, the
2988 un-qualified function type was incorrectly treated as a substitution
2989 candidate.
2990
2991 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2992
2993 @item
2994 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2995 unaligned accesses. Note that this did not affect the ABI of a
2996 function with a @code{nullptr_t} parameter, as parameters have a
2997 minimum alignment.
2998
2999 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
3000
3001 @item
3002 Target-specific attributes that affect the identity of a type, such as
3003 ia32 calling conventions on a function type (stdcall, regparm, etc.),
3004 did not affect the mangled name, leading to name collisions when
3005 function pointers were used as template arguments.
3006
3007 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
3008
3009 @end itemize
3010
3011 It also warns about psABI-related changes. The known psABI changes at this
3012 point include:
3013
3014 @itemize @bullet
3015
3016 @item
3017 For SysV/x86-64, unions with @code{long double} members are
3018 passed in memory as specified in psABI. For example:
3019
3020 @smallexample
3021 union U @{
3022 long double ld;
3023 int i;
3024 @};
3025 @end smallexample
3026
3027 @noindent
3028 @code{union U} is always passed in memory.
3029
3030 @end itemize
3031
3032 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3033 @opindex Wabi-tag
3034 @opindex Wabi-tag
3035 Warn when a type with an ABI tag is used in a context that does not
3036 have that ABI tag. See @ref{C++ Attributes} for more information
3037 about ABI tags.
3038
3039 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3040 @opindex Wctor-dtor-privacy
3041 @opindex Wno-ctor-dtor-privacy
3042 Warn when a class seems unusable because all the constructors or
3043 destructors in that class are private, and it has neither friends nor
3044 public static member functions. Also warn if there are no non-private
3045 methods, and there's at least one private member function that isn't
3046 a constructor or destructor.
3047
3048 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3049 @opindex Wdelete-non-virtual-dtor
3050 @opindex Wno-delete-non-virtual-dtor
3051 Warn when @code{delete} is used to destroy an instance of a class that
3052 has virtual functions and non-virtual destructor. It is unsafe to delete
3053 an instance of a derived class through a pointer to a base class if the
3054 base class does not have a virtual destructor. This warning is enabled
3055 by @option{-Wall}.
3056
3057 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3058 @opindex Wdeprecated-copy
3059 @opindex Wno-deprecated-copy
3060 Warn that the implicit declaration of a copy constructor or copy
3061 assignment operator is deprecated if the class has a user-provided
3062 copy constructor or copy assignment operator, in C++11 and up. This
3063 warning is enabled by @option{-Wextra}. With
3064 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3065 user-provided destructor.
3066
3067 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3068 @opindex Winit-list-lifetime
3069 @opindex Wno-init-list-lifetime
3070 Do not warn about uses of @code{std::initializer_list} that are likely
3071 to result in dangling pointers. Since the underlying array for an
3072 @code{initializer_list} is handled like a normal C++ temporary object,
3073 it is easy to inadvertently keep a pointer to the array past the end
3074 of the array's lifetime. For example:
3075
3076 @itemize @bullet
3077 @item
3078 If a function returns a temporary @code{initializer_list}, or a local
3079 @code{initializer_list} variable, the array's lifetime ends at the end
3080 of the return statement, so the value returned has a dangling pointer.
3081
3082 @item
3083 If a new-expression creates an @code{initializer_list}, the array only
3084 lives until the end of the enclosing full-expression, so the
3085 @code{initializer_list} in the heap has a dangling pointer.
3086
3087 @item
3088 When an @code{initializer_list} variable is assigned from a
3089 brace-enclosed initializer list, the temporary array created for the
3090 right side of the assignment only lives until the end of the
3091 full-expression, so at the next statement the @code{initializer_list}
3092 variable has a dangling pointer.
3093
3094 @smallexample
3095 // li's initial underlying array lives as long as li
3096 std::initializer_list<int> li = @{ 1,2,3 @};
3097 // assignment changes li to point to a temporary array
3098 li = @{ 4, 5 @};
3099 // now the temporary is gone and li has a dangling pointer
3100 int i = li.begin()[0] // undefined behavior
3101 @end smallexample
3102
3103 @item
3104 When a list constructor stores the @code{begin} pointer from the
3105 @code{initializer_list} argument, this doesn't extend the lifetime of
3106 the array, so if a class variable is constructed from a temporary
3107 @code{initializer_list}, the pointer is left dangling by the end of
3108 the variable declaration statement.
3109
3110 @end itemize
3111
3112 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3113 @opindex Wliteral-suffix
3114 @opindex Wno-literal-suffix
3115 Warn when a string or character literal is followed by a ud-suffix which does
3116 not begin with an underscore. As a conforming extension, GCC treats such
3117 suffixes as separate preprocessing tokens in order to maintain backwards
3118 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3119 For example:
3120
3121 @smallexample
3122 #define __STDC_FORMAT_MACROS
3123 #include <inttypes.h>
3124 #include <stdio.h>
3125
3126 int main() @{
3127 int64_t i64 = 123;
3128 printf("My int64: %" PRId64"\n", i64);
3129 @}
3130 @end smallexample
3131
3132 In this case, @code{PRId64} is treated as a separate preprocessing token.
3133
3134 Additionally, warn when a user-defined literal operator is declared with
3135 a literal suffix identifier that doesn't begin with an underscore. Literal
3136 suffix identifiers that don't begin with an underscore are reserved for
3137 future standardization.
3138
3139 This warning is enabled by default.
3140
3141 @item -Wlto-type-mismatch
3142 @opindex Wlto-type-mismatch
3143 @opindex Wno-lto-type-mismatch
3144
3145 During the link-time optimization warn about type mismatches in
3146 global declarations from different compilation units.
3147 Requires @option{-flto} to be enabled. Enabled by default.
3148
3149 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3150 @opindex Wnarrowing
3151 @opindex Wno-narrowing
3152 For C++11 and later standards, narrowing conversions are diagnosed by default,
3153 as required by the standard. A narrowing conversion from a constant produces
3154 an error, and a narrowing conversion from a non-constant produces a warning,
3155 but @option{-Wno-narrowing} suppresses the diagnostic.
3156 Note that this does not affect the meaning of well-formed code;
3157 narrowing conversions are still considered ill-formed in SFINAE contexts.
3158
3159 With @option{-Wnarrowing} in C++98, warn when a narrowing
3160 conversion prohibited by C++11 occurs within
3161 @samp{@{ @}}, e.g.
3162
3163 @smallexample
3164 int i = @{ 2.2 @}; // error: narrowing from double to int
3165 @end smallexample
3166
3167 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3168
3169 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3170 @opindex Wnoexcept
3171 @opindex Wno-noexcept
3172 Warn when a noexcept-expression evaluates to false because of a call
3173 to a function that does not have a non-throwing exception
3174 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3175 the compiler to never throw an exception.
3176
3177 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3178 @opindex Wnoexcept-type
3179 @opindex Wno-noexcept-type
3180 Warn if the C++17 feature making @code{noexcept} part of a function
3181 type changes the mangled name of a symbol relative to C++14. Enabled
3182 by @option{-Wabi} and @option{-Wc++17-compat}.
3183
3184 As an example:
3185
3186 @smallexample
3187 template <class T> void f(T t) @{ t(); @};
3188 void g() noexcept;
3189 void h() @{ f(g); @}
3190 @end smallexample
3191
3192 @noindent
3193 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3194 C++17 it calls @code{f<void(*)()noexcept>}.
3195
3196 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3197 @opindex Wclass-memaccess
3198 @opindex Wno-class-memaccess
3199 Warn when the destination of a call to a raw memory function such as
3200 @code{memset} or @code{memcpy} is an object of class type, and when writing
3201 into such an object might bypass the class non-trivial or deleted constructor
3202 or copy assignment, violate const-correctness or encapsulation, or corrupt
3203 virtual table pointers. Modifying the representation of such objects may
3204 violate invariants maintained by member functions of the class. For example,
3205 the call to @code{memset} below is undefined because it modifies a non-trivial
3206 class object and is, therefore, diagnosed. The safe way to either initialize
3207 or clear the storage of objects of such types is by using the appropriate
3208 constructor or assignment operator, if one is available.
3209 @smallexample
3210 std::string str = "abc";
3211 memset (&str, 0, sizeof str);
3212 @end smallexample
3213 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3214 Explicitly casting the pointer to the class object to @code{void *} or
3215 to a type that can be safely accessed by the raw memory function suppresses
3216 the warning.
3217
3218 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3219 @opindex Wnon-virtual-dtor
3220 @opindex Wno-non-virtual-dtor
3221 Warn when a class has virtual functions and an accessible non-virtual
3222 destructor itself or in an accessible polymorphic base class, in which
3223 case it is possible but unsafe to delete an instance of a derived
3224 class through a pointer to the class itself or base class. This
3225 warning is automatically enabled if @option{-Weffc++} is specified.
3226
3227 @item -Wregister @r{(C++ and Objective-C++ only)}
3228 @opindex Wregister
3229 @opindex Wno-register
3230 Warn on uses of the @code{register} storage class specifier, except
3231 when it is part of the GNU @ref{Explicit Register Variables} extension.
3232 The use of the @code{register} keyword as storage class specifier has
3233 been deprecated in C++11 and removed in C++17.
3234 Enabled by default with @option{-std=c++17}.
3235
3236 @item -Wreorder @r{(C++ and Objective-C++ only)}
3237 @opindex Wreorder
3238 @opindex Wno-reorder
3239 @cindex reordering, warning
3240 @cindex warning for reordering of member initializers
3241 Warn when the order of member initializers given in the code does not
3242 match the order in which they must be executed. For instance:
3243
3244 @smallexample
3245 struct A @{
3246 int i;
3247 int j;
3248 A(): j (0), i (1) @{ @}
3249 @};
3250 @end smallexample
3251
3252 @noindent
3253 The compiler rearranges the member initializers for @code{i}
3254 and @code{j} to match the declaration order of the members, emitting
3255 a warning to that effect. This warning is enabled by @option{-Wall}.
3256
3257 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3258 @opindex Wpessimizing-move
3259 @opindex Wno-pessimizing-move
3260 This warning warns when a call to @code{std::move} prevents copy
3261 elision. A typical scenario when copy elision can occur is when returning in
3262 a function with a class return type, when the expression being returned is the
3263 name of a non-volatile automatic object, and is not a function parameter, and
3264 has the same type as the function return type.
3265
3266 @smallexample
3267 struct T @{
3268 @dots{}
3269 @};
3270 T fn()
3271 @{
3272 T t;
3273 @dots{}
3274 return std::move (t);
3275 @}
3276 @end smallexample
3277
3278 But in this example, the @code{std::move} call prevents copy elision.
3279
3280 This warning is enabled by @option{-Wall}.
3281
3282 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3283 @opindex Wredundant-move
3284 @opindex Wno-redundant-move
3285 This warning warns about redundant calls to @code{std::move}; that is, when
3286 a move operation would have been performed even without the @code{std::move}
3287 call. This happens because the compiler is forced to treat the object as if
3288 it were an rvalue in certain situations such as returning a local variable,
3289 where copy elision isn't applicable. Consider:
3290
3291 @smallexample
3292 struct T @{
3293 @dots{}
3294 @};
3295 T fn(T t)
3296 @{
3297 @dots{}
3298 return std::move (t);
3299 @}
3300 @end smallexample
3301
3302 Here, the @code{std::move} call is redundant. Because G++ implements Core
3303 Issue 1579, another example is:
3304
3305 @smallexample
3306 struct T @{ // convertible to U
3307 @dots{}
3308 @};
3309 struct U @{
3310 @dots{}
3311 @};
3312 U fn()
3313 @{
3314 T t;
3315 @dots{}
3316 return std::move (t);
3317 @}
3318 @end smallexample
3319 In this example, copy elision isn't applicable because the type of the
3320 expression being returned and the function return type differ, yet G++
3321 treats the return value as if it were designated by an rvalue.
3322
3323 This warning is enabled by @option{-Wextra}.
3324
3325 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3326 @opindex fext-numeric-literals
3327 @opindex fno-ext-numeric-literals
3328 Accept imaginary, fixed-point, or machine-defined
3329 literal number suffixes as GNU extensions.
3330 When this option is turned off these suffixes are treated
3331 as C++11 user-defined literal numeric suffixes.
3332 This is on by default for all pre-C++11 dialects and all GNU dialects:
3333 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3334 @option{-std=gnu++14}.
3335 This option is off by default
3336 for ISO C++11 onwards (@option{-std=c++11}, ...).
3337 @end table
3338
3339 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3340
3341 @table @gcctabopt
3342 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3343 @opindex Weffc++
3344 @opindex Wno-effc++
3345 Warn about violations of the following style guidelines from Scott Meyers'
3346 @cite{Effective C++} series of books:
3347
3348 @itemize @bullet
3349 @item
3350 Define a copy constructor and an assignment operator for classes
3351 with dynamically-allocated memory.
3352
3353 @item
3354 Prefer initialization to assignment in constructors.
3355
3356 @item
3357 Have @code{operator=} return a reference to @code{*this}.
3358
3359 @item
3360 Don't try to return a reference when you must return an object.
3361
3362 @item
3363 Distinguish between prefix and postfix forms of increment and
3364 decrement operators.
3365
3366 @item
3367 Never overload @code{&&}, @code{||}, or @code{,}.
3368
3369 @end itemize
3370
3371 This option also enables @option{-Wnon-virtual-dtor}, which is also
3372 one of the effective C++ recommendations. However, the check is
3373 extended to warn about the lack of virtual destructor in accessible
3374 non-polymorphic bases classes too.
3375
3376 When selecting this option, be aware that the standard library
3377 headers do not obey all of these guidelines; use @samp{grep -v}
3378 to filter out those warnings.
3379
3380 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3381 @opindex Wstrict-null-sentinel
3382 @opindex Wno-strict-null-sentinel
3383 Warn about the use of an uncasted @code{NULL} as sentinel. When
3384 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3385 to @code{__null}. Although it is a null pointer constant rather than a
3386 null pointer, it is guaranteed to be of the same size as a pointer.
3387 But this use is not portable across different compilers.
3388
3389 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3390 @opindex Wno-non-template-friend
3391 @opindex Wnon-template-friend
3392 Disable warnings when non-template friend functions are declared
3393 within a template. In very old versions of GCC that predate implementation
3394 of the ISO standard, declarations such as
3395 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3396 could be interpreted as a particular specialization of a template
3397 function; the warning exists to diagnose compatibility problems,
3398 and is enabled by default.
3399
3400 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3401 @opindex Wold-style-cast
3402 @opindex Wno-old-style-cast
3403 Warn if an old-style (C-style) cast to a non-void type is used within
3404 a C++ program. The new-style casts (@code{dynamic_cast},
3405 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3406 less vulnerable to unintended effects and much easier to search for.
3407
3408 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3409 @opindex Woverloaded-virtual
3410 @opindex Wno-overloaded-virtual
3411 @cindex overloaded virtual function, warning
3412 @cindex warning for overloaded virtual function
3413 Warn when a function declaration hides virtual functions from a
3414 base class. For example, in:
3415
3416 @smallexample
3417 struct A @{
3418 virtual void f();
3419 @};
3420
3421 struct B: public A @{
3422 void f(int);
3423 @};
3424 @end smallexample
3425
3426 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3427 like:
3428
3429 @smallexample
3430 B* b;
3431 b->f();
3432 @end smallexample
3433
3434 @noindent
3435 fails to compile.
3436
3437 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3438 @opindex Wno-pmf-conversions
3439 @opindex Wpmf-conversions
3440 Disable the diagnostic for converting a bound pointer to member function
3441 to a plain pointer.
3442
3443 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3444 @opindex Wsign-promo
3445 @opindex Wno-sign-promo
3446 Warn when overload resolution chooses a promotion from unsigned or
3447 enumerated type to a signed type, over a conversion to an unsigned type of
3448 the same size. Previous versions of G++ tried to preserve
3449 unsignedness, but the standard mandates the current behavior.
3450
3451 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3452 @opindex Wtemplates
3453 @opindex Wno-templates
3454 Warn when a primary template declaration is encountered. Some coding
3455 rules disallow templates, and this may be used to enforce that rule.
3456 The warning is inactive inside a system header file, such as the STL, so
3457 one can still use the STL. One may also instantiate or specialize
3458 templates.
3459
3460 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3461 @opindex Wmultiple-inheritance
3462 @opindex Wno-multiple-inheritance
3463 Warn when a class is defined with multiple direct base classes. Some
3464 coding rules disallow multiple inheritance, and this may be used to
3465 enforce that rule. The warning is inactive inside a system header file,
3466 such as the STL, so one can still use the STL. One may also define
3467 classes that indirectly use multiple inheritance.
3468
3469 @item -Wvirtual-inheritance
3470 @opindex Wvirtual-inheritance
3471 @opindex Wno-virtual-inheritance
3472 Warn when a class is defined with a virtual direct base class. Some
3473 coding rules disallow multiple inheritance, and this may be used to
3474 enforce that rule. The warning is inactive inside a system header file,
3475 such as the STL, so one can still use the STL. One may also define
3476 classes that indirectly use virtual inheritance.
3477
3478 @item -Wnamespaces
3479 @opindex Wnamespaces
3480 @opindex Wno-namespaces
3481 Warn when a namespace definition is opened. Some coding rules disallow
3482 namespaces, and this may be used to enforce that rule. The warning is
3483 inactive inside a system header file, such as the STL, so one can still
3484 use the STL. One may also use using directives and qualified names.
3485
3486 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3487 @opindex Wterminate
3488 @opindex Wno-terminate
3489 Disable the warning about a throw-expression that will immediately
3490 result in a call to @code{terminate}.
3491
3492 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3493 @opindex Wno-class-conversion
3494 @opindex Wclass-conversion
3495 Disable the warning about the case when a conversion function converts an
3496 object to the same type, to a base class of that type, or to void; such
3497 a conversion function will never be called.
3498 @end table
3499
3500 @node Objective-C and Objective-C++ Dialect Options
3501 @section Options Controlling Objective-C and Objective-C++ Dialects
3502
3503 @cindex compiler options, Objective-C and Objective-C++
3504 @cindex Objective-C and Objective-C++ options, command-line
3505 @cindex options, Objective-C and Objective-C++
3506 (NOTE: This manual does not describe the Objective-C and Objective-C++
3507 languages themselves. @xref{Standards,,Language Standards
3508 Supported by GCC}, for references.)
3509
3510 This section describes the command-line options that are only meaningful
3511 for Objective-C and Objective-C++ programs. You can also use most of
3512 the language-independent GNU compiler options.
3513 For example, you might compile a file @file{some_class.m} like this:
3514
3515 @smallexample
3516 gcc -g -fgnu-runtime -O -c some_class.m
3517 @end smallexample
3518
3519 @noindent
3520 In this example, @option{-fgnu-runtime} is an option meant only for
3521 Objective-C and Objective-C++ programs; you can use the other options with
3522 any language supported by GCC@.
3523
3524 Note that since Objective-C is an extension of the C language, Objective-C
3525 compilations may also use options specific to the C front-end (e.g.,
3526 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3527 C++-specific options (e.g., @option{-Wabi}).
3528
3529 Here is a list of options that are @emph{only} for compiling Objective-C
3530 and Objective-C++ programs:
3531
3532 @table @gcctabopt
3533 @item -fconstant-string-class=@var{class-name}
3534 @opindex fconstant-string-class
3535 Use @var{class-name} as the name of the class to instantiate for each
3536 literal string specified with the syntax @code{@@"@dots{}"}. The default
3537 class name is @code{NXConstantString} if the GNU runtime is being used, and
3538 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3539 @option{-fconstant-cfstrings} option, if also present, overrides the
3540 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3541 to be laid out as constant CoreFoundation strings.
3542
3543 @item -fgnu-runtime
3544 @opindex fgnu-runtime
3545 Generate object code compatible with the standard GNU Objective-C
3546 runtime. This is the default for most types of systems.
3547
3548 @item -fnext-runtime
3549 @opindex fnext-runtime
3550 Generate output compatible with the NeXT runtime. This is the default
3551 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3552 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3553 used.
3554
3555 @item -fno-nil-receivers
3556 @opindex fno-nil-receivers
3557 @opindex fnil-receivers
3558 Assume that all Objective-C message dispatches (@code{[receiver
3559 message:arg]}) in this translation unit ensure that the receiver is
3560 not @code{nil}. This allows for more efficient entry points in the
3561 runtime to be used. This option is only available in conjunction with
3562 the NeXT runtime and ABI version 0 or 1.
3563
3564 @item -fobjc-abi-version=@var{n}
3565 @opindex fobjc-abi-version
3566 Use version @var{n} of the Objective-C ABI for the selected runtime.
3567 This option is currently supported only for the NeXT runtime. In that
3568 case, Version 0 is the traditional (32-bit) ABI without support for
3569 properties and other Objective-C 2.0 additions. Version 1 is the
3570 traditional (32-bit) ABI with support for properties and other
3571 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3572 nothing is specified, the default is Version 0 on 32-bit target
3573 machines, and Version 2 on 64-bit target machines.
3574
3575 @item -fobjc-call-cxx-cdtors
3576 @opindex fobjc-call-cxx-cdtors
3577 For each Objective-C class, check if any of its instance variables is a
3578 C++ object with a non-trivial default constructor. If so, synthesize a
3579 special @code{- (id) .cxx_construct} instance method which runs
3580 non-trivial default constructors on any such instance variables, in order,
3581 and then return @code{self}. Similarly, check if any instance variable
3582 is a C++ object with a non-trivial destructor, and if so, synthesize a
3583 special @code{- (void) .cxx_destruct} method which runs
3584 all such default destructors, in reverse order.
3585
3586 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3587 methods thusly generated only operate on instance variables
3588 declared in the current Objective-C class, and not those inherited
3589 from superclasses. It is the responsibility of the Objective-C
3590 runtime to invoke all such methods in an object's inheritance
3591 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3592 by the runtime immediately after a new object instance is allocated;
3593 the @code{- (void) .cxx_destruct} methods are invoked immediately
3594 before the runtime deallocates an object instance.
3595
3596 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3597 support for invoking the @code{- (id) .cxx_construct} and
3598 @code{- (void) .cxx_destruct} methods.
3599
3600 @item -fobjc-direct-dispatch
3601 @opindex fobjc-direct-dispatch
3602 Allow fast jumps to the message dispatcher. On Darwin this is
3603 accomplished via the comm page.
3604
3605 @item -fobjc-exceptions
3606 @opindex fobjc-exceptions
3607 Enable syntactic support for structured exception handling in
3608 Objective-C, similar to what is offered by C++. This option
3609 is required to use the Objective-C keywords @code{@@try},
3610 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3611 @code{@@synchronized}. This option is available with both the GNU
3612 runtime and the NeXT runtime (but not available in conjunction with
3613 the NeXT runtime on Mac OS X 10.2 and earlier).
3614
3615 @item -fobjc-gc
3616 @opindex fobjc-gc
3617 Enable garbage collection (GC) in Objective-C and Objective-C++
3618 programs. This option is only available with the NeXT runtime; the
3619 GNU runtime has a different garbage collection implementation that
3620 does not require special compiler flags.
3621
3622 @item -fobjc-nilcheck
3623 @opindex fobjc-nilcheck
3624 For the NeXT runtime with version 2 of the ABI, check for a nil
3625 receiver in method invocations before doing the actual method call.
3626 This is the default and can be disabled using
3627 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3628 checked for nil in this way no matter what this flag is set to.
3629 Currently this flag does nothing when the GNU runtime, or an older
3630 version of the NeXT runtime ABI, is used.
3631
3632 @item -fobjc-std=objc1
3633 @opindex fobjc-std
3634 Conform to the language syntax of Objective-C 1.0, the language
3635 recognized by GCC 4.0. This only affects the Objective-C additions to
3636 the C/C++ language; it does not affect conformance to C/C++ standards,
3637 which is controlled by the separate C/C++ dialect option flags. When
3638 this option is used with the Objective-C or Objective-C++ compiler,
3639 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3640 This is useful if you need to make sure that your Objective-C code can
3641 be compiled with older versions of GCC@.
3642
3643 @item -freplace-objc-classes
3644 @opindex freplace-objc-classes
3645 Emit a special marker instructing @command{ld(1)} not to statically link in
3646 the resulting object file, and allow @command{dyld(1)} to load it in at
3647 run time instead. This is used in conjunction with the Fix-and-Continue
3648 debugging mode, where the object file in question may be recompiled and
3649 dynamically reloaded in the course of program execution, without the need
3650 to restart the program itself. Currently, Fix-and-Continue functionality
3651 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3652 and later.
3653
3654 @item -fzero-link
3655 @opindex fzero-link
3656 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3657 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3658 compile time) with static class references that get initialized at load time,
3659 which improves run-time performance. Specifying the @option{-fzero-link} flag
3660 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3661 to be retained. This is useful in Zero-Link debugging mode, since it allows
3662 for individual class implementations to be modified during program execution.
3663 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3664 regardless of command-line options.
3665
3666 @item -fno-local-ivars
3667 @opindex fno-local-ivars
3668 @opindex flocal-ivars
3669 By default instance variables in Objective-C can be accessed as if
3670 they were local variables from within the methods of the class they're
3671 declared in. This can lead to shadowing between instance variables
3672 and other variables declared either locally inside a class method or
3673 globally with the same name. Specifying the @option{-fno-local-ivars}
3674 flag disables this behavior thus avoiding variable shadowing issues.
3675
3676 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3677 @opindex fivar-visibility
3678 Set the default instance variable visibility to the specified option
3679 so that instance variables declared outside the scope of any access
3680 modifier directives default to the specified visibility.
3681
3682 @item -gen-decls
3683 @opindex gen-decls
3684 Dump interface declarations for all classes seen in the source file to a
3685 file named @file{@var{sourcename}.decl}.
3686
3687 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3688 @opindex Wassign-intercept
3689 @opindex Wno-assign-intercept
3690 Warn whenever an Objective-C assignment is being intercepted by the
3691 garbage collector.
3692
3693 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3694 @opindex Wno-protocol
3695 @opindex Wprotocol
3696 If a class is declared to implement a protocol, a warning is issued for
3697 every method in the protocol that is not implemented by the class. The
3698 default behavior is to issue a warning for every method not explicitly
3699 implemented in the class, even if a method implementation is inherited
3700 from the superclass. If you use the @option{-Wno-protocol} option, then
3701 methods inherited from the superclass are considered to be implemented,
3702 and no warning is issued for them.
3703
3704 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3705 @opindex Wselector
3706 @opindex Wno-selector
3707 Warn if multiple methods of different types for the same selector are
3708 found during compilation. The check is performed on the list of methods
3709 in the final stage of compilation. Additionally, a check is performed
3710 for each selector appearing in a @code{@@selector(@dots{})}
3711 expression, and a corresponding method for that selector has been found
3712 during compilation. Because these checks scan the method table only at
3713 the end of compilation, these warnings are not produced if the final
3714 stage of compilation is not reached, for example because an error is
3715 found during compilation, or because the @option{-fsyntax-only} option is
3716 being used.
3717
3718 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3719 @opindex Wstrict-selector-match
3720 @opindex Wno-strict-selector-match
3721 Warn if multiple methods with differing argument and/or return types are
3722 found for a given selector when attempting to send a message using this
3723 selector to a receiver of type @code{id} or @code{Class}. When this flag
3724 is off (which is the default behavior), the compiler omits such warnings
3725 if any differences found are confined to types that share the same size
3726 and alignment.
3727
3728 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3729 @opindex Wundeclared-selector
3730 @opindex Wno-undeclared-selector
3731 Warn if a @code{@@selector(@dots{})} expression referring to an
3732 undeclared selector is found. A selector is considered undeclared if no
3733 method with that name has been declared before the
3734 @code{@@selector(@dots{})} expression, either explicitly in an
3735 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3736 an @code{@@implementation} section. This option always performs its
3737 checks as soon as a @code{@@selector(@dots{})} expression is found,
3738 while @option{-Wselector} only performs its checks in the final stage of
3739 compilation. This also enforces the coding style convention
3740 that methods and selectors must be declared before being used.
3741
3742 @item -print-objc-runtime-info
3743 @opindex print-objc-runtime-info
3744 Generate C header describing the largest structure that is passed by
3745 value, if any.
3746
3747 @end table
3748
3749 @node Diagnostic Message Formatting Options
3750 @section Options to Control Diagnostic Messages Formatting
3751 @cindex options to control diagnostics formatting
3752 @cindex diagnostic messages
3753 @cindex message formatting
3754
3755 Traditionally, diagnostic messages have been formatted irrespective of
3756 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3757 options described below
3758 to control the formatting algorithm for diagnostic messages,
3759 e.g.@: how many characters per line, how often source location
3760 information should be reported. Note that some language front ends may not
3761 honor these options.
3762
3763 @table @gcctabopt
3764 @item -fmessage-length=@var{n}
3765 @opindex fmessage-length
3766 Try to format error messages so that they fit on lines of about
3767 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3768 done; each error message appears on a single line. This is the
3769 default for all front ends.
3770
3771 Note - this option also affects the display of the @samp{#error} and
3772 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3773 function/type/variable attribute. It does not however affect the
3774 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3775
3776 @item -fdiagnostics-show-location=once
3777 @opindex fdiagnostics-show-location
3778 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3779 reporter to emit source location information @emph{once}; that is, in
3780 case the message is too long to fit on a single physical line and has to
3781 be wrapped, the source location won't be emitted (as prefix) again,
3782 over and over, in subsequent continuation lines. This is the default
3783 behavior.
3784
3785 @item -fdiagnostics-show-location=every-line
3786 Only meaningful in line-wrapping mode. Instructs the diagnostic
3787 messages reporter to emit the same source location information (as
3788 prefix) for physical lines that result from the process of breaking
3789 a message which is too long to fit on a single line.
3790
3791 @item -fdiagnostics-color[=@var{WHEN}]
3792 @itemx -fno-diagnostics-color
3793 @opindex fdiagnostics-color
3794 @cindex highlight, color
3795 @vindex GCC_COLORS @r{environment variable}
3796 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3797 or @samp{auto}. The default depends on how the compiler has been configured,
3798 it can be any of the above @var{WHEN} options or also @samp{never}
3799 if @env{GCC_COLORS} environment variable isn't present in the environment,
3800 and @samp{auto} otherwise.
3801 @samp{auto} means to use color only when the standard error is a terminal.
3802 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3803 aliases for @option{-fdiagnostics-color=always} and
3804 @option{-fdiagnostics-color=never}, respectively.
3805
3806 The colors are defined by the environment variable @env{GCC_COLORS}.
3807 Its value is a colon-separated list of capabilities and Select Graphic
3808 Rendition (SGR) substrings. SGR commands are interpreted by the
3809 terminal or terminal emulator. (See the section in the documentation
3810 of your text terminal for permitted values and their meanings as
3811 character attributes.) These substring values are integers in decimal
3812 representation and can be concatenated with semicolons.
3813 Common values to concatenate include
3814 @samp{1} for bold,
3815 @samp{4} for underline,
3816 @samp{5} for blink,
3817 @samp{7} for inverse,
3818 @samp{39} for default foreground color,
3819 @samp{30} to @samp{37} for foreground colors,
3820 @samp{90} to @samp{97} for 16-color mode foreground colors,
3821 @samp{38;5;0} to @samp{38;5;255}
3822 for 88-color and 256-color modes foreground colors,
3823 @samp{49} for default background color,
3824 @samp{40} to @samp{47} for background colors,
3825 @samp{100} to @samp{107} for 16-color mode background colors,
3826 and @samp{48;5;0} to @samp{48;5;255}
3827 for 88-color and 256-color modes background colors.
3828
3829 The default @env{GCC_COLORS} is
3830 @smallexample
3831 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3832 quote=01:fixit-insert=32:fixit-delete=31:\
3833 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3834 type-diff=01;32
3835 @end smallexample
3836 @noindent
3837 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3838 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3839 @samp{01} is bold, and @samp{31} is red.
3840 Setting @env{GCC_COLORS} to the empty string disables colors.
3841 Supported capabilities are as follows.
3842
3843 @table @code
3844 @item error=
3845 @vindex error GCC_COLORS @r{capability}
3846 SGR substring for error: markers.
3847
3848 @item warning=
3849 @vindex warning GCC_COLORS @r{capability}
3850 SGR substring for warning: markers.
3851
3852 @item note=
3853 @vindex note GCC_COLORS @r{capability}
3854 SGR substring for note: markers.
3855
3856 @item range1=
3857 @vindex range1 GCC_COLORS @r{capability}
3858 SGR substring for first additional range.
3859
3860 @item range2=
3861 @vindex range2 GCC_COLORS @r{capability}
3862 SGR substring for second additional range.
3863
3864 @item locus=
3865 @vindex locus GCC_COLORS @r{capability}
3866 SGR substring for location information, @samp{file:line} or
3867 @samp{file:line:column} etc.
3868
3869 @item quote=
3870 @vindex quote GCC_COLORS @r{capability}
3871 SGR substring for information printed within quotes.
3872
3873 @item fixit-insert=
3874 @vindex fixit-insert GCC_COLORS @r{capability}
3875 SGR substring for fix-it hints suggesting text to
3876 be inserted or replaced.
3877
3878 @item fixit-delete=
3879 @vindex fixit-delete GCC_COLORS @r{capability}
3880 SGR substring for fix-it hints suggesting text to
3881 be deleted.
3882
3883 @item diff-filename=
3884 @vindex diff-filename GCC_COLORS @r{capability}
3885 SGR substring for filename headers within generated patches.
3886
3887 @item diff-hunk=
3888 @vindex diff-hunk GCC_COLORS @r{capability}
3889 SGR substring for the starts of hunks within generated patches.
3890
3891 @item diff-delete=
3892 @vindex diff-delete GCC_COLORS @r{capability}
3893 SGR substring for deleted lines within generated patches.
3894
3895 @item diff-insert=
3896 @vindex diff-insert GCC_COLORS @r{capability}
3897 SGR substring for inserted lines within generated patches.
3898
3899 @item type-diff=
3900 @vindex type-diff GCC_COLORS @r{capability}
3901 SGR substring for highlighting mismatching types within template
3902 arguments in the C++ frontend.
3903 @end table
3904
3905 @item -fno-diagnostics-show-option
3906 @opindex fno-diagnostics-show-option
3907 @opindex fdiagnostics-show-option
3908 By default, each diagnostic emitted includes text indicating the
3909 command-line option that directly controls the diagnostic (if such an
3910 option is known to the diagnostic machinery). Specifying the
3911 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3912
3913 @item -fno-diagnostics-show-caret
3914 @opindex fno-diagnostics-show-caret
3915 @opindex fdiagnostics-show-caret
3916 By default, each diagnostic emitted includes the original source line
3917 and a caret @samp{^} indicating the column. This option suppresses this
3918 information. The source line is truncated to @var{n} characters, if
3919 the @option{-fmessage-length=n} option is given. When the output is done
3920 to the terminal, the width is limited to the width given by the
3921 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3922
3923 @item -fno-diagnostics-show-labels
3924 @opindex fno-diagnostics-show-labels
3925 @opindex fdiagnostics-show-labels
3926 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3927 diagnostics can label ranges of source code with pertinent information, such
3928 as the types of expressions:
3929
3930 @smallexample
3931 printf ("foo %s bar", long_i + long_j);
3932 ~^ ~~~~~~~~~~~~~~~
3933 | |
3934 char * long int
3935 @end smallexample
3936
3937 This option suppresses the printing of these labels (in the example above,
3938 the vertical bars and the ``char *'' and ``long int'' text).
3939
3940 @item -fno-diagnostics-show-line-numbers
3941 @opindex fno-diagnostics-show-line-numbers
3942 @opindex fdiagnostics-show-line-numbers
3943 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3944 a left margin is printed, showing line numbers. This option suppresses this
3945 left margin.
3946
3947 @item -fdiagnostics-minimum-margin-width=@var{width}
3948 @opindex fdiagnostics-minimum-margin-width
3949 This option controls the minimum width of the left margin printed by
3950 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3951
3952 @item -fdiagnostics-parseable-fixits
3953 @opindex fdiagnostics-parseable-fixits
3954 Emit fix-it hints in a machine-parseable format, suitable for consumption
3955 by IDEs. For each fix-it, a line will be printed after the relevant
3956 diagnostic, starting with the string ``fix-it:''. For example:
3957
3958 @smallexample
3959 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3960 @end smallexample
3961
3962 The location is expressed as a half-open range, expressed as a count of
3963 bytes, starting at byte 1 for the initial column. In the above example,
3964 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3965 given string:
3966
3967 @smallexample
3968 00000000011111111112222222222
3969 12345678901234567890123456789
3970 gtk_widget_showall (dlg);
3971 ^^^^^^^^^^^^^^^^^^
3972 gtk_widget_show_all
3973 @end smallexample
3974
3975 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3976 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3977 (e.g. vertical tab as ``\013'').
3978
3979 An empty replacement string indicates that the given range is to be removed.
3980 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3981 be inserted at the given position.
3982
3983 @item -fdiagnostics-generate-patch
3984 @opindex fdiagnostics-generate-patch
3985 Print fix-it hints to stderr in unified diff format, after any diagnostics
3986 are printed. For example:
3987
3988 @smallexample
3989 --- test.c
3990 +++ test.c
3991 @@ -42,5 +42,5 @@
3992
3993 void show_cb(GtkDialog *dlg)
3994 @{
3995 - gtk_widget_showall(dlg);
3996 + gtk_widget_show_all(dlg);
3997 @}
3998
3999 @end smallexample
4000
4001 The diff may or may not be colorized, following the same rules
4002 as for diagnostics (see @option{-fdiagnostics-color}).
4003
4004 @item -fdiagnostics-show-template-tree
4005 @opindex fdiagnostics-show-template-tree
4006
4007 In the C++ frontend, when printing diagnostics showing mismatching
4008 template types, such as:
4009
4010 @smallexample
4011 could not convert 'std::map<int, std::vector<double> >()'
4012 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4013 @end smallexample
4014
4015 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4016 tree-like structure showing the common and differing parts of the types,
4017 such as:
4018
4019 @smallexample
4020 map<
4021 [...],
4022 vector<
4023 [double != float]>>
4024 @end smallexample
4025
4026 The parts that differ are highlighted with color (``double'' and
4027 ``float'' in this case).
4028
4029 @item -fno-elide-type
4030 @opindex fno-elide-type
4031 @opindex felide-type
4032 By default when the C++ frontend prints diagnostics showing mismatching
4033 template types, common parts of the types are printed as ``[...]'' to
4034 simplify the error message. For example:
4035
4036 @smallexample
4037 could not convert 'std::map<int, std::vector<double> >()'
4038 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4039 @end smallexample
4040
4041 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4042 This flag also affects the output of the
4043 @option{-fdiagnostics-show-template-tree} flag.
4044
4045 @item -fno-show-column
4046 @opindex fno-show-column
4047 @opindex fshow-column
4048 Do not print column numbers in diagnostics. This may be necessary if
4049 diagnostics are being scanned by a program that does not understand the
4050 column numbers, such as @command{dejagnu}.
4051
4052 @item -fdiagnostics-format=@var{FORMAT}
4053 @opindex fdiagnostics-format
4054 Select a different format for printing diagnostics.
4055 @var{FORMAT} is @samp{text} or @samp{json}.
4056 The default is @samp{text}.
4057
4058 The @samp{json} format consists of a top-level JSON array containing JSON
4059 objects representing the diagnostics.
4060
4061 The JSON is emitted as one line, without formatting; the examples below
4062 have been formatted for clarity.
4063
4064 Diagnostics can have child diagnostics. For example, this error and note:
4065
4066 @smallexample
4067 misleading-indentation.c:15:3: warning: this 'if' clause does not
4068 guard... [-Wmisleading-indentation]
4069 15 | if (flag)
4070 | ^~
4071 misleading-indentation.c:17:5: note: ...this statement, but the latter
4072 is misleadingly indented as if it were guarded by the 'if'
4073 17 | y = 2;
4074 | ^
4075 @end smallexample
4076
4077 @noindent
4078 might be printed in JSON form (after formatting) like this:
4079
4080 @smallexample
4081 [
4082 @{
4083 "kind": "warning",
4084 "locations": [
4085 @{
4086 "caret": @{
4087 "column": 3,
4088 "file": "misleading-indentation.c",
4089 "line": 15
4090 @},
4091 "finish": @{
4092 "column": 4,
4093 "file": "misleading-indentation.c",
4094 "line": 15
4095 @}
4096 @}
4097 ],
4098 "message": "this \u2018if\u2019 clause does not guard...",
4099 "option": "-Wmisleading-indentation",
4100 "children": [
4101 @{
4102 "kind": "note",
4103 "locations": [
4104 @{
4105 "caret": @{
4106 "column": 5,
4107 "file": "misleading-indentation.c",
4108 "line": 17
4109 @}
4110 @}
4111 ],
4112 "message": "...this statement, but the latter is @dots{}"
4113 @}
4114 ]
4115 @},
4116 @dots{}
4117 ]
4118 @end smallexample
4119
4120 @noindent
4121 where the @code{note} is a child of the @code{warning}.
4122
4123 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4124 an @code{option} key describing the command-line option controlling the
4125 warning.
4126
4127 A diagnostic can contain zero or more locations. Each location has up
4128 to three positions within it: a @code{caret} position and optional
4129 @code{start} and @code{finish} positions. A location can also have
4130 an optional @code{label} string. For example, this error:
4131
4132 @smallexample
4133 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4134 'struct s'@} and 'T' @{aka 'struct t'@})
4135 64 | return callee_4a () + callee_4b ();
4136 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4137 | | |
4138 | | T @{aka struct t@}
4139 | S @{aka struct s@}
4140 @end smallexample
4141
4142 @noindent
4143 has three locations. Its primary location is at the ``+'' token at column
4144 23. It has two secondary locations, describing the left and right-hand sides
4145 of the expression, which have labels. It might be printed in JSON form as:
4146
4147 @smallexample
4148 @{
4149 "children": [],
4150 "kind": "error",
4151 "locations": [
4152 @{
4153 "caret": @{
4154 "column": 23, "file": "bad-binary-ops.c", "line": 64
4155 @}
4156 @},
4157 @{
4158 "caret": @{
4159 "column": 10, "file": "bad-binary-ops.c", "line": 64
4160 @},
4161 "finish": @{
4162 "column": 21, "file": "bad-binary-ops.c", "line": 64
4163 @},
4164 "label": "S @{aka struct s@}"
4165 @},
4166 @{
4167 "caret": @{
4168 "column": 25, "file": "bad-binary-ops.c", "line": 64
4169 @},
4170 "finish": @{
4171 "column": 36, "file": "bad-binary-ops.c", "line": 64
4172 @},
4173 "label": "T @{aka struct t@}"
4174 @}
4175 ],
4176 "message": "invalid operands to binary + @dots{}"
4177 @}
4178 @end smallexample
4179
4180 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4181 consisting of half-open intervals, similar to the output of
4182 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4183 with a replacement fix-it hint:
4184
4185 @smallexample
4186 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4187 mean 'color'?
4188 8 | return ptr->colour;
4189 | ^~~~~~
4190 | color
4191 @end smallexample
4192
4193 @noindent
4194 might be printed in JSON form as:
4195
4196 @smallexample
4197 @{
4198 "children": [],
4199 "fixits": [
4200 @{
4201 "next": @{
4202 "column": 21,
4203 "file": "demo.c",
4204 "line": 8
4205 @},
4206 "start": @{
4207 "column": 15,
4208 "file": "demo.c",
4209 "line": 8
4210 @},
4211 "string": "color"
4212 @}
4213 ],
4214 "kind": "error",
4215 "locations": [
4216 @{
4217 "caret": @{
4218 "column": 15,
4219 "file": "demo.c",
4220 "line": 8
4221 @},
4222 "finish": @{
4223 "column": 20,
4224 "file": "demo.c",
4225 "line": 8
4226 @}
4227 @}
4228 ],
4229 "message": "\u2018struct s\u2019 has no member named @dots{}"
4230 @}
4231 @end smallexample
4232
4233 @noindent
4234 where the fix-it hint suggests replacing the text from @code{start} up
4235 to but not including @code{next} with @code{string}'s value. Deletions
4236 are expressed via an empty value for @code{string}, insertions by
4237 having @code{start} equal @code{next}.
4238
4239 @end table
4240
4241 @node Warning Options
4242 @section Options to Request or Suppress Warnings
4243 @cindex options to control warnings
4244 @cindex warning messages
4245 @cindex messages, warning
4246 @cindex suppressing warnings
4247
4248 Warnings are diagnostic messages that report constructions that
4249 are not inherently erroneous but that are risky or suggest there
4250 may have been an error.
4251
4252 The following language-independent options do not enable specific
4253 warnings but control the kinds of diagnostics produced by GCC@.
4254
4255 @table @gcctabopt
4256 @cindex syntax checking
4257 @item -fsyntax-only
4258 @opindex fsyntax-only
4259 Check the code for syntax errors, but don't do anything beyond that.
4260
4261 @item -fmax-errors=@var{n}
4262 @opindex fmax-errors
4263 Limits the maximum number of error messages to @var{n}, at which point
4264 GCC bails out rather than attempting to continue processing the source
4265 code. If @var{n} is 0 (the default), there is no limit on the number
4266 of error messages produced. If @option{-Wfatal-errors} is also
4267 specified, then @option{-Wfatal-errors} takes precedence over this
4268 option.
4269
4270 @item -w
4271 @opindex w
4272 Inhibit all warning messages.
4273
4274 @item -Werror
4275 @opindex Werror
4276 @opindex Wno-error
4277 Make all warnings into errors.
4278
4279 @item -Werror=
4280 @opindex Werror=
4281 @opindex Wno-error=
4282 Make the specified warning into an error. The specifier for a warning
4283 is appended; for example @option{-Werror=switch} turns the warnings
4284 controlled by @option{-Wswitch} into errors. This switch takes a
4285 negative form, to be used to negate @option{-Werror} for specific
4286 warnings; for example @option{-Wno-error=switch} makes
4287 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4288 is in effect.
4289
4290 The warning message for each controllable warning includes the
4291 option that controls the warning. That option can then be used with
4292 @option{-Werror=} and @option{-Wno-error=} as described above.
4293 (Printing of the option in the warning message can be disabled using the
4294 @option{-fno-diagnostics-show-option} flag.)
4295
4296 Note that specifying @option{-Werror=}@var{foo} automatically implies
4297 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4298 imply anything.
4299
4300 @item -Wfatal-errors
4301 @opindex Wfatal-errors
4302 @opindex Wno-fatal-errors
4303 This option causes the compiler to abort compilation on the first error
4304 occurred rather than trying to keep going and printing further error
4305 messages.
4306
4307 @end table
4308
4309 You can request many specific warnings with options beginning with
4310 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4311 implicit declarations. Each of these specific warning options also
4312 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4313 example, @option{-Wno-implicit}. This manual lists only one of the
4314 two forms, whichever is not the default. For further
4315 language-specific options also refer to @ref{C++ Dialect Options} and
4316 @ref{Objective-C and Objective-C++ Dialect Options}.
4317
4318 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4319 options, such as @option{-Wunused}, which may turn on further options,
4320 such as @option{-Wunused-value}. The combined effect of positive and
4321 negative forms is that more specific options have priority over less
4322 specific ones, independently of their position in the command-line. For
4323 options of the same specificity, the last one takes effect. Options
4324 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4325 as if they appeared at the end of the command-line.
4326
4327 When an unrecognized warning option is requested (e.g.,
4328 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4329 that the option is not recognized. However, if the @option{-Wno-} form
4330 is used, the behavior is slightly different: no diagnostic is
4331 produced for @option{-Wno-unknown-warning} unless other diagnostics
4332 are being produced. This allows the use of new @option{-Wno-} options
4333 with old compilers, but if something goes wrong, the compiler
4334 warns that an unrecognized option is present.
4335
4336 @table @gcctabopt
4337 @item -Wpedantic
4338 @itemx -pedantic
4339 @opindex pedantic
4340 @opindex Wpedantic
4341 @opindex Wno-pedantic
4342 Issue all the warnings demanded by strict ISO C and ISO C++;
4343 reject all programs that use forbidden extensions, and some other
4344 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4345 version of the ISO C standard specified by any @option{-std} option used.
4346
4347 Valid ISO C and ISO C++ programs should compile properly with or without
4348 this option (though a rare few require @option{-ansi} or a
4349 @option{-std} option specifying the required version of ISO C)@. However,
4350 without this option, certain GNU extensions and traditional C and C++
4351 features are supported as well. With this option, they are rejected.
4352
4353 @option{-Wpedantic} does not cause warning messages for use of the
4354 alternate keywords whose names begin and end with @samp{__}. This alternate
4355 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4356 i.e. @samp{__intN__}.
4357 Pedantic warnings are also disabled in the expression that follows
4358 @code{__extension__}. However, only system header files should use
4359 these escape routes; application programs should avoid them.
4360 @xref{Alternate Keywords}.
4361
4362 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4363 C conformance. They soon find that it does not do quite what they want:
4364 it finds some non-ISO practices, but not all---only those for which
4365 ISO C @emph{requires} a diagnostic, and some others for which
4366 diagnostics have been added.
4367
4368 A feature to report any failure to conform to ISO C might be useful in
4369 some instances, but would require considerable additional work and would
4370 be quite different from @option{-Wpedantic}. We don't have plans to
4371 support such a feature in the near future.
4372
4373 Where the standard specified with @option{-std} represents a GNU
4374 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4375 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4376 extended dialect is based. Warnings from @option{-Wpedantic} are given
4377 where they are required by the base standard. (It does not make sense
4378 for such warnings to be given only for features not in the specified GNU
4379 C dialect, since by definition the GNU dialects of C include all
4380 features the compiler supports with the given option, and there would be
4381 nothing to warn about.)
4382
4383 @item -pedantic-errors
4384 @opindex pedantic-errors
4385 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4386 requires a diagnostic, in some cases where there is undefined behavior
4387 at compile-time and in some other cases that do not prevent compilation
4388 of programs that are valid according to the standard. This is not
4389 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4390 by this option and not enabled by the latter and vice versa.
4391
4392 @item -Wall
4393 @opindex Wall
4394 @opindex Wno-all
4395 This enables all the warnings about constructions that some users
4396 consider questionable, and that are easy to avoid (or modify to
4397 prevent the warning), even in conjunction with macros. This also
4398 enables some language-specific warnings described in @ref{C++ Dialect
4399 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4400
4401 @option{-Wall} turns on the following warning flags:
4402
4403 @gccoptlist{-Waddress @gol
4404 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4405 -Wbool-compare @gol
4406 -Wbool-operation @gol
4407 -Wc++11-compat -Wc++14-compat @gol
4408 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4409 -Wchar-subscripts @gol
4410 -Wcomment @gol
4411 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4412 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4413 -Wformat @gol
4414 -Wint-in-bool-context @gol
4415 -Wimplicit @r{(C and Objective-C only)} @gol
4416 -Wimplicit-int @r{(C and Objective-C only)} @gol
4417 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4418 -Winit-self @r{(only for C++)} @gol
4419 -Wlogical-not-parentheses @gol
4420 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4421 -Wmaybe-uninitialized @gol
4422 -Wmemset-elt-size @gol
4423 -Wmemset-transposed-args @gol
4424 -Wmisleading-indentation @r{(only for C/C++)} @gol
4425 -Wmissing-attributes @gol
4426 -Wmissing-braces @r{(only for C/ObjC)} @gol
4427 -Wmultistatement-macros @gol
4428 -Wnarrowing @r{(only for C++)} @gol
4429 -Wnonnull @gol
4430 -Wnonnull-compare @gol
4431 -Wopenmp-simd @gol
4432 -Wparentheses @gol
4433 -Wpessimizing-move @r{(only for C++)} @gol
4434 -Wpointer-sign @gol
4435 -Wreorder @gol
4436 -Wrestrict @gol
4437 -Wreturn-type @gol
4438 -Wsequence-point @gol
4439 -Wsign-compare @r{(only in C++)} @gol
4440 -Wsizeof-pointer-div @gol
4441 -Wsizeof-pointer-memaccess @gol
4442 -Wstrict-aliasing @gol
4443 -Wstrict-overflow=1 @gol
4444 -Wswitch @gol
4445 -Wtautological-compare @gol
4446 -Wtrigraphs @gol
4447 -Wuninitialized @gol
4448 -Wunknown-pragmas @gol
4449 -Wunused-function @gol
4450 -Wunused-label @gol
4451 -Wunused-value @gol
4452 -Wunused-variable @gol
4453 -Wvolatile-register-var}
4454
4455 Note that some warning flags are not implied by @option{-Wall}. Some of
4456 them warn about constructions that users generally do not consider
4457 questionable, but which occasionally you might wish to check for;
4458 others warn about constructions that are necessary or hard to avoid in
4459 some cases, and there is no simple way to modify the code to suppress
4460 the warning. Some of them are enabled by @option{-Wextra} but many of
4461 them must be enabled individually.
4462
4463 @item -Wextra
4464 @opindex W
4465 @opindex Wextra
4466 @opindex Wno-extra
4467 This enables some extra warning flags that are not enabled by
4468 @option{-Wall}. (This option used to be called @option{-W}. The older
4469 name is still supported, but the newer name is more descriptive.)
4470
4471 @gccoptlist{-Wclobbered @gol
4472 -Wcast-function-type @gol
4473 -Wdeprecated-copy @r{(C++ only)} @gol
4474 -Wempty-body @gol
4475 -Wignored-qualifiers @gol
4476 -Wimplicit-fallthrough=3 @gol
4477 -Wmissing-field-initializers @gol
4478 -Wmissing-parameter-type @r{(C only)} @gol
4479 -Wold-style-declaration @r{(C only)} @gol
4480 -Woverride-init @gol
4481 -Wsign-compare @r{(C only)} @gol
4482 -Wredundant-move @r{(only for C++)} @gol
4483 -Wtype-limits @gol
4484 -Wuninitialized @gol
4485 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4486 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4487 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4488
4489
4490 The option @option{-Wextra} also prints warning messages for the
4491 following cases:
4492
4493 @itemize @bullet
4494
4495 @item
4496 A pointer is compared against integer zero with @code{<}, @code{<=},
4497 @code{>}, or @code{>=}.
4498
4499 @item
4500 (C++ only) An enumerator and a non-enumerator both appear in a
4501 conditional expression.
4502
4503 @item
4504 (C++ only) Ambiguous virtual bases.
4505
4506 @item
4507 (C++ only) Subscripting an array that has been declared @code{register}.
4508
4509 @item
4510 (C++ only) Taking the address of a variable that has been declared
4511 @code{register}.
4512
4513 @item
4514 (C++ only) A base class is not initialized in the copy constructor
4515 of a derived class.
4516
4517 @end itemize
4518
4519 @item -Wchar-subscripts
4520 @opindex Wchar-subscripts
4521 @opindex Wno-char-subscripts
4522 Warn if an array subscript has type @code{char}. This is a common cause
4523 of error, as programmers often forget that this type is signed on some
4524 machines.
4525 This warning is enabled by @option{-Wall}.
4526
4527 @item -Wno-coverage-mismatch
4528 @opindex Wno-coverage-mismatch
4529 @opindex Wcoverage-mismatch
4530 Warn if feedback profiles do not match when using the
4531 @option{-fprofile-use} option.
4532 If a source file is changed between compiling with @option{-fprofile-generate}
4533 and with @option{-fprofile-use}, the files with the profile feedback can fail
4534 to match the source file and GCC cannot use the profile feedback
4535 information. By default, this warning is enabled and is treated as an
4536 error. @option{-Wno-coverage-mismatch} can be used to disable the
4537 warning or @option{-Wno-error=coverage-mismatch} can be used to
4538 disable the error. Disabling the error for this warning can result in
4539 poorly optimized code and is useful only in the
4540 case of very minor changes such as bug fixes to an existing code-base.
4541 Completely disabling the warning is not recommended.
4542
4543 @item -Wno-cpp
4544 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4545
4546 Suppress warning messages emitted by @code{#warning} directives.
4547
4548 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4549 @opindex Wdouble-promotion
4550 @opindex Wno-double-promotion
4551 Give a warning when a value of type @code{float} is implicitly
4552 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4553 floating-point unit implement @code{float} in hardware, but emulate
4554 @code{double} in software. On such a machine, doing computations
4555 using @code{double} values is much more expensive because of the
4556 overhead required for software emulation.
4557
4558 It is easy to accidentally do computations with @code{double} because
4559 floating-point literals are implicitly of type @code{double}. For
4560 example, in:
4561 @smallexample
4562 @group
4563 float area(float radius)
4564 @{
4565 return 3.14159 * radius * radius;
4566 @}
4567 @end group
4568 @end smallexample
4569 the compiler performs the entire computation with @code{double}
4570 because the floating-point literal is a @code{double}.
4571
4572 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4573 @opindex Wduplicate-decl-specifier
4574 @opindex Wno-duplicate-decl-specifier
4575 Warn if a declaration has duplicate @code{const}, @code{volatile},
4576 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4577 @option{-Wall}.
4578
4579 @item -Wformat
4580 @itemx -Wformat=@var{n}
4581 @opindex Wformat
4582 @opindex Wno-format
4583 @opindex ffreestanding
4584 @opindex fno-builtin
4585 @opindex Wformat=
4586 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4587 the arguments supplied have types appropriate to the format string
4588 specified, and that the conversions specified in the format string make
4589 sense. This includes standard functions, and others specified by format
4590 attributes (@pxref{Function Attributes}), in the @code{printf},
4591 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4592 not in the C standard) families (or other target-specific families).
4593 Which functions are checked without format attributes having been
4594 specified depends on the standard version selected, and such checks of
4595 functions without the attribute specified are disabled by
4596 @option{-ffreestanding} or @option{-fno-builtin}.
4597
4598 The formats are checked against the format features supported by GNU
4599 libc version 2.2. These include all ISO C90 and C99 features, as well
4600 as features from the Single Unix Specification and some BSD and GNU
4601 extensions. Other library implementations may not support all these
4602 features; GCC does not support warning about features that go beyond a
4603 particular library's limitations. However, if @option{-Wpedantic} is used
4604 with @option{-Wformat}, warnings are given about format features not
4605 in the selected standard version (but not for @code{strfmon} formats,
4606 since those are not in any version of the C standard). @xref{C Dialect
4607 Options,,Options Controlling C Dialect}.
4608
4609 @table @gcctabopt
4610 @item -Wformat=1
4611 @itemx -Wformat
4612 @opindex Wformat
4613 @opindex Wformat=1
4614 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4615 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4616 @option{-Wformat} also checks for null format arguments for several
4617 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4618 aspects of this level of format checking can be disabled by the
4619 options: @option{-Wno-format-contains-nul},
4620 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4621 @option{-Wformat} is enabled by @option{-Wall}.
4622
4623 @item -Wno-format-contains-nul
4624 @opindex Wno-format-contains-nul
4625 @opindex Wformat-contains-nul
4626 If @option{-Wformat} is specified, do not warn about format strings that
4627 contain NUL bytes.
4628
4629 @item -Wno-format-extra-args
4630 @opindex Wno-format-extra-args
4631 @opindex Wformat-extra-args
4632 If @option{-Wformat} is specified, do not warn about excess arguments to a
4633 @code{printf} or @code{scanf} format function. The C standard specifies
4634 that such arguments are ignored.
4635
4636 Where the unused arguments lie between used arguments that are
4637 specified with @samp{$} operand number specifications, normally
4638 warnings are still given, since the implementation could not know what
4639 type to pass to @code{va_arg} to skip the unused arguments. However,
4640 in the case of @code{scanf} formats, this option suppresses the
4641 warning if the unused arguments are all pointers, since the Single
4642 Unix Specification says that such unused arguments are allowed.
4643
4644 @item -Wformat-overflow
4645 @itemx -Wformat-overflow=@var{level}
4646 @opindex Wformat-overflow
4647 @opindex Wno-format-overflow
4648 Warn about calls to formatted input/output functions such as @code{sprintf}
4649 and @code{vsprintf} that might overflow the destination buffer. When the
4650 exact number of bytes written by a format directive cannot be determined
4651 at compile-time it is estimated based on heuristics that depend on the
4652 @var{level} argument and on optimization. While enabling optimization
4653 will in most cases improve the accuracy of the warning, it may also
4654 result in false positives.
4655
4656 @table @gcctabopt
4657 @item -Wformat-overflow
4658 @itemx -Wformat-overflow=1
4659 @opindex Wformat-overflow
4660 @opindex Wno-format-overflow
4661 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4662 employs a conservative approach that warns only about calls that most
4663 likely overflow the buffer. At this level, numeric arguments to format
4664 directives with unknown values are assumed to have the value of one, and
4665 strings of unknown length to be empty. Numeric arguments that are known
4666 to be bounded to a subrange of their type, or string arguments whose output
4667 is bounded either by their directive's precision or by a finite set of
4668 string literals, are assumed to take on the value within the range that
4669 results in the most bytes on output. For example, the call to @code{sprintf}
4670 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4671 the terminating NUL character (@code{'\0'}) appended by the function
4672 to the destination buffer will be written past its end. Increasing
4673 the size of the buffer by a single byte is sufficient to avoid the
4674 warning, though it may not be sufficient to avoid the overflow.
4675
4676 @smallexample
4677 void f (int a, int b)
4678 @{
4679 char buf [13];
4680 sprintf (buf, "a = %i, b = %i\n", a, b);
4681 @}
4682 @end smallexample
4683
4684 @item -Wformat-overflow=2
4685 Level @var{2} warns also about calls that might overflow the destination
4686 buffer given an argument of sufficient length or magnitude. At level
4687 @var{2}, unknown numeric arguments are assumed to have the minimum
4688 representable value for signed types with a precision greater than 1, and
4689 the maximum representable value otherwise. Unknown string arguments whose
4690 length cannot be assumed to be bounded either by the directive's precision,
4691 or by a finite set of string literals they may evaluate to, or the character
4692 array they may point to, are assumed to be 1 character long.
4693
4694 At level @var{2}, the call in the example above is again diagnosed, but
4695 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4696 @code{%i} directive will write some of its digits beyond the end of
4697 the destination buffer. To make the call safe regardless of the values
4698 of the two variables, the size of the destination buffer must be increased
4699 to at least 34 bytes. GCC includes the minimum size of the buffer in
4700 an informational note following the warning.
4701
4702 An alternative to increasing the size of the destination buffer is to
4703 constrain the range of formatted values. The maximum length of string
4704 arguments can be bounded by specifying the precision in the format
4705 directive. When numeric arguments of format directives can be assumed
4706 to be bounded by less than the precision of their type, choosing
4707 an appropriate length modifier to the format specifier will reduce
4708 the required buffer size. For example, if @var{a} and @var{b} in the
4709 example above can be assumed to be within the precision of
4710 the @code{short int} type then using either the @code{%hi} format
4711 directive or casting the argument to @code{short} reduces the maximum
4712 required size of the buffer to 24 bytes.
4713
4714 @smallexample
4715 void f (int a, int b)
4716 @{
4717 char buf [23];
4718 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4719 @}
4720 @end smallexample
4721 @end table
4722
4723 @item -Wno-format-zero-length
4724 @opindex Wno-format-zero-length
4725 @opindex Wformat-zero-length
4726 If @option{-Wformat} is specified, do not warn about zero-length formats.
4727 The C standard specifies that zero-length formats are allowed.
4728
4729
4730 @item -Wformat=2
4731 @opindex Wformat=2
4732 Enable @option{-Wformat} plus additional format checks. Currently
4733 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4734 -Wformat-y2k}.
4735
4736 @item -Wformat-nonliteral
4737 @opindex Wformat-nonliteral
4738 @opindex Wno-format-nonliteral
4739 If @option{-Wformat} is specified, also warn if the format string is not a
4740 string literal and so cannot be checked, unless the format function
4741 takes its format arguments as a @code{va_list}.
4742
4743 @item -Wformat-security
4744 @opindex Wformat-security
4745 @opindex Wno-format-security
4746 If @option{-Wformat} is specified, also warn about uses of format
4747 functions that represent possible security problems. At present, this
4748 warns about calls to @code{printf} and @code{scanf} functions where the
4749 format string is not a string literal and there are no format arguments,
4750 as in @code{printf (foo);}. This may be a security hole if the format
4751 string came from untrusted input and contains @samp{%n}. (This is
4752 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4753 in future warnings may be added to @option{-Wformat-security} that are not
4754 included in @option{-Wformat-nonliteral}.)
4755
4756 @item -Wformat-signedness
4757 @opindex Wformat-signedness
4758 @opindex Wno-format-signedness
4759 If @option{-Wformat} is specified, also warn if the format string
4760 requires an unsigned argument and the argument is signed and vice versa.
4761
4762 @item -Wformat-truncation
4763 @itemx -Wformat-truncation=@var{level}
4764 @opindex Wformat-truncation
4765 @opindex Wno-format-truncation
4766 Warn about calls to formatted input/output functions such as @code{snprintf}
4767 and @code{vsnprintf} that might result in output truncation. When the exact
4768 number of bytes written by a format directive cannot be determined at
4769 compile-time it is estimated based on heuristics that depend on
4770 the @var{level} argument and on optimization. While enabling optimization
4771 will in most cases improve the accuracy of the warning, it may also result
4772 in false positives. Except as noted otherwise, the option uses the same
4773 logic @option{-Wformat-overflow}.
4774
4775 @table @gcctabopt
4776 @item -Wformat-truncation
4777 @itemx -Wformat-truncation=1
4778 @opindex Wformat-truncation
4779 @opindex Wno-format-truncation
4780 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4781 employs a conservative approach that warns only about calls to bounded
4782 functions whose return value is unused and that will most likely result
4783 in output truncation.
4784
4785 @item -Wformat-truncation=2
4786 Level @var{2} warns also about calls to bounded functions whose return
4787 value is used and that might result in truncation given an argument of
4788 sufficient length or magnitude.
4789 @end table
4790
4791 @item -Wformat-y2k
4792 @opindex Wformat-y2k
4793 @opindex Wno-format-y2k
4794 If @option{-Wformat} is specified, also warn about @code{strftime}
4795 formats that may yield only a two-digit year.
4796 @end table
4797
4798 @item -Wnonnull
4799 @opindex Wnonnull
4800 @opindex Wno-nonnull
4801 Warn about passing a null pointer for arguments marked as
4802 requiring a non-null value by the @code{nonnull} function attribute.
4803
4804 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4805 can be disabled with the @option{-Wno-nonnull} option.
4806
4807 @item -Wnonnull-compare
4808 @opindex Wnonnull-compare
4809 @opindex Wno-nonnull-compare
4810 Warn when comparing an argument marked with the @code{nonnull}
4811 function attribute against null inside the function.
4812
4813 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4814 can be disabled with the @option{-Wno-nonnull-compare} option.
4815
4816 @item -Wnull-dereference
4817 @opindex Wnull-dereference
4818 @opindex Wno-null-dereference
4819 Warn if the compiler detects paths that trigger erroneous or
4820 undefined behavior due to dereferencing a null pointer. This option
4821 is only active when @option{-fdelete-null-pointer-checks} is active,
4822 which is enabled by optimizations in most targets. The precision of
4823 the warnings depends on the optimization options used.
4824
4825 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4826 @opindex Winaccessible-base
4827 @opindex Wno-inaccessible-base
4828 Warn when a base class is inaccessible in a class derived from it due to
4829 ambiguity. The warning is enabled by default. Note the warning for virtual
4830 bases is enabled by the @option{-Wextra} option.
4831 @smallexample
4832 @group
4833 struct A @{ int a; @};
4834
4835 struct B : A @{ @};
4836
4837 struct C : B, A @{ @};
4838 @end group
4839 @end smallexample
4840
4841 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4842 @opindex Winit-self
4843 @opindex Wno-init-self
4844 Warn about uninitialized variables that are initialized with themselves.
4845 Note this option can only be used with the @option{-Wuninitialized} option.
4846
4847 For example, GCC warns about @code{i} being uninitialized in the
4848 following snippet only when @option{-Winit-self} has been specified:
4849 @smallexample
4850 @group
4851 int f()
4852 @{
4853 int i = i;
4854 return i;
4855 @}
4856 @end group
4857 @end smallexample
4858
4859 This warning is enabled by @option{-Wall} in C++.
4860
4861 @item -Wimplicit-int @r{(C and Objective-C only)}
4862 @opindex Wimplicit-int
4863 @opindex Wno-implicit-int
4864 Warn when a declaration does not specify a type.
4865 This warning is enabled by @option{-Wall}.
4866
4867 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4868 @opindex Wimplicit-function-declaration
4869 @opindex Wno-implicit-function-declaration
4870 Give a warning whenever a function is used before being declared. In
4871 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4872 enabled by default and it is made into an error by
4873 @option{-pedantic-errors}. This warning is also enabled by
4874 @option{-Wall}.
4875
4876 @item -Wimplicit @r{(C and Objective-C only)}
4877 @opindex Wimplicit
4878 @opindex Wno-implicit
4879 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4880 This warning is enabled by @option{-Wall}.
4881
4882 @item -Wimplicit-fallthrough
4883 @opindex Wimplicit-fallthrough
4884 @opindex Wno-implicit-fallthrough
4885 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4886 and @option{-Wno-implicit-fallthrough} is the same as
4887 @option{-Wimplicit-fallthrough=0}.
4888
4889 @item -Wimplicit-fallthrough=@var{n}
4890 @opindex Wimplicit-fallthrough=
4891 Warn when a switch case falls through. For example:
4892
4893 @smallexample
4894 @group
4895 switch (cond)
4896 @{
4897 case 1:
4898 a = 1;
4899 break;
4900 case 2:
4901 a = 2;
4902 case 3:
4903 a = 3;
4904 break;
4905 @}
4906 @end group
4907 @end smallexample
4908
4909 This warning does not warn when the last statement of a case cannot
4910 fall through, e.g. when there is a return statement or a call to function
4911 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4912 also takes into account control flow statements, such as ifs, and only
4913 warns when appropriate. E.g.@:
4914
4915 @smallexample
4916 @group
4917 switch (cond)
4918 @{
4919 case 1:
4920 if (i > 3) @{
4921 bar (5);
4922 break;
4923 @} else if (i < 1) @{
4924 bar (0);
4925 @} else
4926 return;
4927 default:
4928 @dots{}
4929 @}
4930 @end group
4931 @end smallexample
4932
4933 Since there are occasions where a switch case fall through is desirable,
4934 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4935 to be used along with a null statement to suppress this warning that
4936 would normally occur:
4937
4938 @smallexample
4939 @group
4940 switch (cond)
4941 @{
4942 case 1:
4943 bar (0);
4944 __attribute__ ((fallthrough));
4945 default:
4946 @dots{}
4947 @}
4948 @end group
4949 @end smallexample
4950
4951 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4952 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4953 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4954 Instead of these attributes, it is also possible to add a fallthrough comment
4955 to silence the warning. The whole body of the C or C++ style comment should
4956 match the given regular expressions listed below. The option argument @var{n}
4957 specifies what kind of comments are accepted:
4958
4959 @itemize @bullet
4960
4961 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4962
4963 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4964 expression, any comment is used as fallthrough comment.
4965
4966 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4967 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4968
4969 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4970 following regular expressions:
4971
4972 @itemize @bullet
4973
4974 @item @code{-fallthrough}
4975
4976 @item @code{@@fallthrough@@}
4977
4978 @item @code{lint -fallthrough[ \t]*}
4979
4980 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4981
4982 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4983
4984 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4985
4986 @end itemize
4987
4988 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4989 following regular expressions:
4990
4991 @itemize @bullet
4992
4993 @item @code{-fallthrough}
4994
4995 @item @code{@@fallthrough@@}
4996
4997 @item @code{lint -fallthrough[ \t]*}
4998
4999 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5000
5001 @end itemize
5002
5003 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5004 fallthrough comments, only attributes disable the warning.
5005
5006 @end itemize
5007
5008 The comment needs to be followed after optional whitespace and other comments
5009 by @code{case} or @code{default} keywords or by a user label that precedes some
5010 @code{case} or @code{default} label.
5011
5012 @smallexample
5013 @group
5014 switch (cond)
5015 @{
5016 case 1:
5017 bar (0);
5018 /* FALLTHRU */
5019 default:
5020 @dots{}
5021 @}
5022 @end group
5023 @end smallexample
5024
5025 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5026
5027 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5028 @opindex Wif-not-aligned
5029 @opindex Wno-if-not-aligned
5030 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5031 should be issued. This is enabled by default.
5032 Use @option{-Wno-if-not-aligned} to disable it.
5033
5034 @item -Wignored-qualifiers @r{(C and C++ only)}
5035 @opindex Wignored-qualifiers
5036 @opindex Wno-ignored-qualifiers
5037 Warn if the return type of a function has a type qualifier
5038 such as @code{const}. For ISO C such a type qualifier has no effect,
5039 since the value returned by a function is not an lvalue.
5040 For C++, the warning is only emitted for scalar types or @code{void}.
5041 ISO C prohibits qualified @code{void} return types on function
5042 definitions, so such return types always receive a warning
5043 even without this option.
5044
5045 This warning is also enabled by @option{-Wextra}.
5046
5047 @item -Wignored-attributes @r{(C and C++ only)}
5048 @opindex Wignored-attributes
5049 @opindex Wno-ignored-attributes
5050 Warn when an attribute is ignored. This is different from the
5051 @option{-Wattributes} option in that it warns whenever the compiler decides
5052 to drop an attribute, not that the attribute is either unknown, used in a
5053 wrong place, etc. This warning is enabled by default.
5054
5055 @item -Wmain
5056 @opindex Wmain
5057 @opindex Wno-main
5058 Warn if the type of @code{main} is suspicious. @code{main} should be
5059 a function with external linkage, returning int, taking either zero
5060 arguments, two, or three arguments of appropriate types. This warning
5061 is enabled by default in C++ and is enabled by either @option{-Wall}
5062 or @option{-Wpedantic}.
5063
5064 @item -Wmisleading-indentation @r{(C and C++ only)}
5065 @opindex Wmisleading-indentation
5066 @opindex Wno-misleading-indentation
5067 Warn when the indentation of the code does not reflect the block structure.
5068 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5069 @code{for} clauses with a guarded statement that does not use braces,
5070 followed by an unguarded statement with the same indentation.
5071
5072 In the following example, the call to ``bar'' is misleadingly indented as
5073 if it were guarded by the ``if'' conditional.
5074
5075 @smallexample
5076 if (some_condition ())
5077 foo ();
5078 bar (); /* Gotcha: this is not guarded by the "if". */
5079 @end smallexample
5080
5081 In the case of mixed tabs and spaces, the warning uses the
5082 @option{-ftabstop=} option to determine if the statements line up
5083 (defaulting to 8).
5084
5085 The warning is not issued for code involving multiline preprocessor logic
5086 such as the following example.
5087
5088 @smallexample
5089 if (flagA)
5090 foo (0);
5091 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5092 if (flagB)
5093 #endif
5094 foo (1);
5095 @end smallexample
5096
5097 The warning is not issued after a @code{#line} directive, since this
5098 typically indicates autogenerated code, and no assumptions can be made
5099 about the layout of the file that the directive references.
5100
5101 This warning is enabled by @option{-Wall} in C and C++.
5102
5103 @item -Wmissing-attributes
5104 @opindex Wmissing-attributes
5105 @opindex Wno-missing-attributes
5106 Warn when a declaration of a function is missing one or more attributes
5107 that a related function is declared with and whose absence may adversely
5108 affect the correctness or efficiency of generated code. For example,
5109 the warning is issued for declarations of aliases that use attributes
5110 to specify less restrictive requirements than those of their targets.
5111 This typically represents a potential optimization opportunity.
5112 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5113 issued when the alias is more restrictive than the target, which could
5114 lead to incorrect code generation.
5115 Attributes considered include @code{alloc_align}, @code{alloc_size},
5116 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5117 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5118 @code{returns_nonnull}, and @code{returns_twice}.
5119
5120 In C++, the warning is issued when an explicit specialization of a primary
5121 template declared with attribute @code{alloc_align}, @code{alloc_size},
5122 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5123 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5124 @code{error}, and @code{warning} suppress the warning.
5125 (@pxref{Function Attributes}).
5126
5127 You can use the @code{copy} attribute to apply the same
5128 set of attributes to a declaration as that on another declaration without
5129 explicitly enumerating the attributes. This attribute can be applied
5130 to declarations of functions (@pxref{Common Function Attributes}),
5131 variables (@pxref{Common Variable Attributes}), or types
5132 (@pxref{Common Type Attributes}).
5133
5134 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5135
5136 For example, since the declaration of the primary function template
5137 below makes use of both attribute @code{malloc} and @code{alloc_size}
5138 the declaration of the explicit specialization of the template is
5139 diagnosed because it is missing one of the attributes.
5140
5141 @smallexample
5142 template <class T>
5143 T* __attribute__ ((malloc, alloc_size (1)))
5144 allocate (size_t);
5145
5146 template <>
5147 void* __attribute__ ((malloc)) // missing alloc_size
5148 allocate<void> (size_t);
5149 @end smallexample
5150
5151 @item -Wmissing-braces
5152 @opindex Wmissing-braces
5153 @opindex Wno-missing-braces
5154 Warn if an aggregate or union initializer is not fully bracketed. In
5155 the following example, the initializer for @code{a} is not fully
5156 bracketed, but that for @code{b} is fully bracketed. This warning is
5157 enabled by @option{-Wall} in C.
5158
5159 @smallexample
5160 int a[2][2] = @{ 0, 1, 2, 3 @};
5161 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5162 @end smallexample
5163
5164 This warning is enabled by @option{-Wall}.
5165
5166 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5167 @opindex Wmissing-include-dirs
5168 @opindex Wno-missing-include-dirs
5169 Warn if a user-supplied include directory does not exist.
5170
5171 @item -Wmissing-profile
5172 @opindex Wmissing-profile
5173 @opindex Wno-missing-profile
5174 Warn if feedback profiles are missing when using the
5175 @option{-fprofile-use} option.
5176 This option diagnoses those cases where a new function or a new file is added
5177 to the user code between compiling with @option{-fprofile-generate} and with
5178 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5179 profile feedback data files do not contain any profile feedback information for
5180 the newly added function or file respectively. Also, in the case when profile
5181 count data (.gcda) files are removed, GCC cannot use any profile feedback
5182 information. In all these cases, warnings are issued to inform the user that a
5183 profile generation step is due. @option{-Wno-missing-profile} can be used to
5184 disable the warning. Ignoring the warning can result in poorly optimized code.
5185 Completely disabling the warning is not recommended and should be done only
5186 when non-existent profile data is justified.
5187
5188 @item -Wmultistatement-macros
5189 @opindex Wmultistatement-macros
5190 @opindex Wno-multistatement-macros
5191 Warn about unsafe multiple statement macros that appear to be guarded
5192 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5193 @code{while}, in which only the first statement is actually guarded after
5194 the macro is expanded.
5195
5196 For example:
5197
5198 @smallexample
5199 #define DOIT x++; y++
5200 if (c)
5201 DOIT;
5202 @end smallexample
5203
5204 will increment @code{y} unconditionally, not just when @code{c} holds.
5205 The can usually be fixed by wrapping the macro in a do-while loop:
5206 @smallexample
5207 #define DOIT do @{ x++; y++; @} while (0)
5208 if (c)
5209 DOIT;
5210 @end smallexample
5211
5212 This warning is enabled by @option{-Wall} in C and C++.
5213
5214 @item -Wparentheses
5215 @opindex Wparentheses
5216 @opindex Wno-parentheses
5217 Warn if parentheses are omitted in certain contexts, such
5218 as when there is an assignment in a context where a truth value
5219 is expected, or when operators are nested whose precedence people
5220 often get confused about.
5221
5222 Also warn if a comparison like @code{x<=y<=z} appears; this is
5223 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5224 interpretation from that of ordinary mathematical notation.
5225
5226 Also warn for dangerous uses of the GNU extension to
5227 @code{?:} with omitted middle operand. When the condition
5228 in the @code{?}: operator is a boolean expression, the omitted value is
5229 always 1. Often programmers expect it to be a value computed
5230 inside the conditional expression instead.
5231
5232 For C++ this also warns for some cases of unnecessary parentheses in
5233 declarations, which can indicate an attempt at a function call instead
5234 of a declaration:
5235 @smallexample
5236 @{
5237 // Declares a local variable called mymutex.
5238 std::unique_lock<std::mutex> (mymutex);
5239 // User meant std::unique_lock<std::mutex> lock (mymutex);
5240 @}
5241 @end smallexample
5242
5243 This warning is enabled by @option{-Wall}.
5244
5245 @item -Wsequence-point
5246 @opindex Wsequence-point
5247 @opindex Wno-sequence-point
5248 Warn about code that may have undefined semantics because of violations
5249 of sequence point rules in the C and C++ standards.
5250
5251 The C and C++ standards define the order in which expressions in a C/C++
5252 program are evaluated in terms of @dfn{sequence points}, which represent
5253 a partial ordering between the execution of parts of the program: those
5254 executed before the sequence point, and those executed after it. These
5255 occur after the evaluation of a full expression (one which is not part
5256 of a larger expression), after the evaluation of the first operand of a
5257 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5258 function is called (but after the evaluation of its arguments and the
5259 expression denoting the called function), and in certain other places.
5260 Other than as expressed by the sequence point rules, the order of
5261 evaluation of subexpressions of an expression is not specified. All
5262 these rules describe only a partial order rather than a total order,
5263 since, for example, if two functions are called within one expression
5264 with no sequence point between them, the order in which the functions
5265 are called is not specified. However, the standards committee have
5266 ruled that function calls do not overlap.
5267
5268 It is not specified when between sequence points modifications to the
5269 values of objects take effect. Programs whose behavior depends on this
5270 have undefined behavior; the C and C++ standards specify that ``Between
5271 the previous and next sequence point an object shall have its stored
5272 value modified at most once by the evaluation of an expression.
5273 Furthermore, the prior value shall be read only to determine the value
5274 to be stored.''. If a program breaks these rules, the results on any
5275 particular implementation are entirely unpredictable.
5276
5277 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5278 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5279 diagnosed by this option, and it may give an occasional false positive
5280 result, but in general it has been found fairly effective at detecting
5281 this sort of problem in programs.
5282
5283 The C++17 standard will define the order of evaluation of operands in
5284 more cases: in particular it requires that the right-hand side of an
5285 assignment be evaluated before the left-hand side, so the above
5286 examples are no longer undefined. But this warning will still warn
5287 about them, to help people avoid writing code that is undefined in C
5288 and earlier revisions of C++.
5289
5290 The standard is worded confusingly, therefore there is some debate
5291 over the precise meaning of the sequence point rules in subtle cases.
5292 Links to discussions of the problem, including proposed formal
5293 definitions, may be found on the GCC readings page, at
5294 @uref{http://gcc.gnu.org/@/readings.html}.
5295
5296 This warning is enabled by @option{-Wall} for C and C++.
5297
5298 @item -Wno-return-local-addr
5299 @opindex Wno-return-local-addr
5300 @opindex Wreturn-local-addr
5301 Do not warn about returning a pointer (or in C++, a reference) to a
5302 variable that goes out of scope after the function returns.
5303
5304 @item -Wreturn-type
5305 @opindex Wreturn-type
5306 @opindex Wno-return-type
5307 Warn whenever a function is defined with a return type that defaults
5308 to @code{int}. Also warn about any @code{return} statement with no
5309 return value in a function whose return type is not @code{void}
5310 (falling off the end of the function body is considered returning
5311 without a value).
5312
5313 For C only, warn about a @code{return} statement with an expression in a
5314 function whose return type is @code{void}, unless the expression type is
5315 also @code{void}. As a GNU extension, the latter case is accepted
5316 without a warning unless @option{-Wpedantic} is used. Attempting
5317 to use the return value of a non-@code{void} function other than @code{main}
5318 that flows off the end by reaching the closing curly brace that terminates
5319 the function is undefined.
5320
5321 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5322 than @code{main} results in undefined behavior even when the value of
5323 the function is not used.
5324
5325 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5326
5327 @item -Wshift-count-negative
5328 @opindex Wshift-count-negative
5329 @opindex Wno-shift-count-negative
5330 Warn if shift count is negative. This warning is enabled by default.
5331
5332 @item -Wshift-count-overflow
5333 @opindex Wshift-count-overflow
5334 @opindex Wno-shift-count-overflow
5335 Warn if shift count >= width of type. This warning is enabled by default.
5336
5337 @item -Wshift-negative-value
5338 @opindex Wshift-negative-value
5339 @opindex Wno-shift-negative-value
5340 Warn if left shifting a negative value. This warning is enabled by
5341 @option{-Wextra} in C99 and C++11 modes (and newer).
5342
5343 @item -Wshift-overflow
5344 @itemx -Wshift-overflow=@var{n}
5345 @opindex Wshift-overflow
5346 @opindex Wno-shift-overflow
5347 Warn about left shift overflows. This warning is enabled by
5348 default in C99 and C++11 modes (and newer).
5349
5350 @table @gcctabopt
5351 @item -Wshift-overflow=1
5352 This is the warning level of @option{-Wshift-overflow} and is enabled
5353 by default in C99 and C++11 modes (and newer). This warning level does
5354 not warn about left-shifting 1 into the sign bit. (However, in C, such
5355 an overflow is still rejected in contexts where an integer constant expression
5356 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5357 shifts always wrap.
5358
5359 @item -Wshift-overflow=2
5360 This warning level also warns about left-shifting 1 into the sign bit,
5361 unless C++14 mode (or newer) is active.
5362 @end table
5363
5364 @item -Wswitch
5365 @opindex Wswitch
5366 @opindex Wno-switch
5367 Warn whenever a @code{switch} statement has an index of enumerated type
5368 and lacks a @code{case} for one or more of the named codes of that
5369 enumeration. (The presence of a @code{default} label prevents this
5370 warning.) @code{case} labels outside the enumeration range also
5371 provoke warnings when this option is used (even if there is a
5372 @code{default} label).
5373 This warning is enabled by @option{-Wall}.
5374
5375 @item -Wswitch-default
5376 @opindex Wswitch-default
5377 @opindex Wno-switch-default
5378 Warn whenever a @code{switch} statement does not have a @code{default}
5379 case.
5380
5381 @item -Wswitch-enum
5382 @opindex Wswitch-enum
5383 @opindex Wno-switch-enum
5384 Warn whenever a @code{switch} statement has an index of enumerated type
5385 and lacks a @code{case} for one or more of the named codes of that
5386 enumeration. @code{case} labels outside the enumeration range also
5387 provoke warnings when this option is used. The only difference
5388 between @option{-Wswitch} and this option is that this option gives a
5389 warning about an omitted enumeration code even if there is a
5390 @code{default} label.
5391
5392 @item -Wswitch-bool
5393 @opindex Wswitch-bool
5394 @opindex Wno-switch-bool
5395 Warn whenever a @code{switch} statement has an index of boolean type
5396 and the case values are outside the range of a boolean type.
5397 It is possible to suppress this warning by casting the controlling
5398 expression to a type other than @code{bool}. For example:
5399 @smallexample
5400 @group
5401 switch ((int) (a == 4))
5402 @{
5403 @dots{}
5404 @}
5405 @end group
5406 @end smallexample
5407 This warning is enabled by default for C and C++ programs.
5408
5409 @item -Wswitch-outside-range
5410 @opindex Wswitch-outside-range
5411 @opindex Wno-switch-outside-range
5412 Warn whenever a @code{switch} case has a value that is outside of its
5413 respective type range. This warning is enabled by default for
5414 C and C++ programs.
5415
5416 @item -Wswitch-unreachable
5417 @opindex Wswitch-unreachable
5418 @opindex Wno-switch-unreachable
5419 Warn whenever a @code{switch} statement contains statements between the
5420 controlling expression and the first case label, which will never be
5421 executed. For example:
5422 @smallexample
5423 @group
5424 switch (cond)
5425 @{
5426 i = 15;
5427 @dots{}
5428 case 5:
5429 @dots{}
5430 @}
5431 @end group
5432 @end smallexample
5433 @option{-Wswitch-unreachable} does not warn if the statement between the
5434 controlling expression and the first case label is just a declaration:
5435 @smallexample
5436 @group
5437 switch (cond)
5438 @{
5439 int i;
5440 @dots{}
5441 case 5:
5442 i = 5;
5443 @dots{}
5444 @}
5445 @end group
5446 @end smallexample
5447 This warning is enabled by default for C and C++ programs.
5448
5449 @item -Wsync-nand @r{(C and C++ only)}
5450 @opindex Wsync-nand
5451 @opindex Wno-sync-nand
5452 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5453 built-in functions are used. These functions changed semantics in GCC 4.4.
5454
5455 @item -Wunused-but-set-parameter
5456 @opindex Wunused-but-set-parameter
5457 @opindex Wno-unused-but-set-parameter
5458 Warn whenever a function parameter is assigned to, but otherwise unused
5459 (aside from its declaration).
5460
5461 To suppress this warning use the @code{unused} attribute
5462 (@pxref{Variable Attributes}).
5463
5464 This warning is also enabled by @option{-Wunused} together with
5465 @option{-Wextra}.
5466
5467 @item -Wunused-but-set-variable
5468 @opindex Wunused-but-set-variable
5469 @opindex Wno-unused-but-set-variable
5470 Warn whenever a local variable is assigned to, but otherwise unused
5471 (aside from its declaration).
5472 This warning is enabled by @option{-Wall}.
5473
5474 To suppress this warning use the @code{unused} attribute
5475 (@pxref{Variable Attributes}).
5476
5477 This warning is also enabled by @option{-Wunused}, which is enabled
5478 by @option{-Wall}.
5479
5480 @item -Wunused-function
5481 @opindex Wunused-function
5482 @opindex Wno-unused-function
5483 Warn whenever a static function is declared but not defined or a
5484 non-inline static function is unused.
5485 This warning is enabled by @option{-Wall}.
5486
5487 @item -Wunused-label
5488 @opindex Wunused-label
5489 @opindex Wno-unused-label
5490 Warn whenever a label is declared but not used.
5491 This warning is enabled by @option{-Wall}.
5492
5493 To suppress this warning use the @code{unused} attribute
5494 (@pxref{Variable Attributes}).
5495
5496 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5497 @opindex Wunused-local-typedefs
5498 @opindex Wno-unused-local-typedefs
5499 Warn when a typedef locally defined in a function is not used.
5500 This warning is enabled by @option{-Wall}.
5501
5502 @item -Wunused-parameter
5503 @opindex Wunused-parameter
5504 @opindex Wno-unused-parameter
5505 Warn whenever a function parameter is unused aside from its declaration.
5506
5507 To suppress this warning use the @code{unused} attribute
5508 (@pxref{Variable Attributes}).
5509
5510 @item -Wno-unused-result
5511 @opindex Wunused-result
5512 @opindex Wno-unused-result
5513 Do not warn if a caller of a function marked with attribute
5514 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5515 its return value. The default is @option{-Wunused-result}.
5516
5517 @item -Wunused-variable
5518 @opindex Wunused-variable
5519 @opindex Wno-unused-variable
5520 Warn whenever a local or static variable is unused aside from its
5521 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5522 but not for C++. This warning is enabled by @option{-Wall}.
5523
5524 To suppress this warning use the @code{unused} attribute
5525 (@pxref{Variable Attributes}).
5526
5527 @item -Wunused-const-variable
5528 @itemx -Wunused-const-variable=@var{n}
5529 @opindex Wunused-const-variable
5530 @opindex Wno-unused-const-variable
5531 Warn whenever a constant static variable is unused aside from its declaration.
5532 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5533 for C, but not for C++. In C this declares variable storage, but in C++ this
5534 is not an error since const variables take the place of @code{#define}s.
5535
5536 To suppress this warning use the @code{unused} attribute
5537 (@pxref{Variable Attributes}).
5538
5539 @table @gcctabopt
5540 @item -Wunused-const-variable=1
5541 This is the warning level that is enabled by @option{-Wunused-variable} for
5542 C. It warns only about unused static const variables defined in the main
5543 compilation unit, but not about static const variables declared in any
5544 header included.
5545
5546 @item -Wunused-const-variable=2
5547 This warning level also warns for unused constant static variables in
5548 headers (excluding system headers). This is the warning level of
5549 @option{-Wunused-const-variable} and must be explicitly requested since
5550 in C++ this isn't an error and in C it might be harder to clean up all
5551 headers included.
5552 @end table
5553
5554 @item -Wunused-value
5555 @opindex Wunused-value
5556 @opindex Wno-unused-value
5557 Warn whenever a statement computes a result that is explicitly not
5558 used. To suppress this warning cast the unused expression to
5559 @code{void}. This includes an expression-statement or the left-hand
5560 side of a comma expression that contains no side effects. For example,
5561 an expression such as @code{x[i,j]} causes a warning, while
5562 @code{x[(void)i,j]} does not.
5563
5564 This warning is enabled by @option{-Wall}.
5565
5566 @item -Wunused
5567 @opindex Wunused
5568 @opindex Wno-unused
5569 All the above @option{-Wunused} options combined.
5570
5571 In order to get a warning about an unused function parameter, you must
5572 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5573 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5574
5575 @item -Wuninitialized
5576 @opindex Wuninitialized
5577 @opindex Wno-uninitialized
5578 Warn if an automatic variable is used without first being initialized
5579 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5580 warn if a non-static reference or non-static @code{const} member
5581 appears in a class without constructors.
5582
5583 If you want to warn about code that uses the uninitialized value of the
5584 variable in its own initializer, use the @option{-Winit-self} option.
5585
5586 These warnings occur for individual uninitialized or clobbered
5587 elements of structure, union or array variables as well as for
5588 variables that are uninitialized or clobbered as a whole. They do
5589 not occur for variables or elements declared @code{volatile}. Because
5590 these warnings depend on optimization, the exact variables or elements
5591 for which there are warnings depends on the precise optimization
5592 options and version of GCC used.
5593
5594 Note that there may be no warning about a variable that is used only
5595 to compute a value that itself is never used, because such
5596 computations may be deleted by data flow analysis before the warnings
5597 are printed.
5598
5599 @item -Winvalid-memory-model
5600 @opindex Winvalid-memory-model
5601 @opindex Wno-invalid-memory-model
5602 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5603 and the C11 atomic generic functions with a memory consistency argument
5604 that is either invalid for the operation or outside the range of values
5605 of the @code{memory_order} enumeration. For example, since the
5606 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5607 defined for the relaxed, release, and sequentially consistent memory
5608 orders the following code is diagnosed:
5609
5610 @smallexample
5611 void store (int *i)
5612 @{
5613 __atomic_store_n (i, 0, memory_order_consume);
5614 @}
5615 @end smallexample
5616
5617 @option{-Winvalid-memory-model} is enabled by default.
5618
5619 @item -Wmaybe-uninitialized
5620 @opindex Wmaybe-uninitialized
5621 @opindex Wno-maybe-uninitialized
5622 For an automatic (i.e.@: local) variable, if there exists a path from the
5623 function entry to a use of the variable that is initialized, but there exist
5624 some other paths for which the variable is not initialized, the compiler
5625 emits a warning if it cannot prove the uninitialized paths are not
5626 executed at run time.
5627
5628 These warnings are only possible in optimizing compilation, because otherwise
5629 GCC does not keep track of the state of variables.
5630
5631 These warnings are made optional because GCC may not be able to determine when
5632 the code is correct in spite of appearing to have an error. Here is one
5633 example of how this can happen:
5634
5635 @smallexample
5636 @group
5637 @{
5638 int x;
5639 switch (y)
5640 @{
5641 case 1: x = 1;
5642 break;
5643 case 2: x = 4;
5644 break;
5645 case 3: x = 5;
5646 @}
5647 foo (x);
5648 @}
5649 @end group
5650 @end smallexample
5651
5652 @noindent
5653 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5654 always initialized, but GCC doesn't know this. To suppress the
5655 warning, you need to provide a default case with assert(0) or
5656 similar code.
5657
5658 @cindex @code{longjmp} warnings
5659 This option also warns when a non-volatile automatic variable might be
5660 changed by a call to @code{longjmp}.
5661 The compiler sees only the calls to @code{setjmp}. It cannot know
5662 where @code{longjmp} will be called; in fact, a signal handler could
5663 call it at any point in the code. As a result, you may get a warning
5664 even when there is in fact no problem because @code{longjmp} cannot
5665 in fact be called at the place that would cause a problem.
5666
5667 Some spurious warnings can be avoided if you declare all the functions
5668 you use that never return as @code{noreturn}. @xref{Function
5669 Attributes}.
5670
5671 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5672
5673 @item -Wunknown-pragmas
5674 @opindex Wunknown-pragmas
5675 @opindex Wno-unknown-pragmas
5676 @cindex warning for unknown pragmas
5677 @cindex unknown pragmas, warning
5678 @cindex pragmas, warning of unknown
5679 Warn when a @code{#pragma} directive is encountered that is not understood by
5680 GCC@. If this command-line option is used, warnings are even issued
5681 for unknown pragmas in system header files. This is not the case if
5682 the warnings are only enabled by the @option{-Wall} command-line option.
5683
5684 @item -Wno-pragmas
5685 @opindex Wno-pragmas
5686 @opindex Wpragmas
5687 Do not warn about misuses of pragmas, such as incorrect parameters,
5688 invalid syntax, or conflicts between pragmas. See also
5689 @option{-Wunknown-pragmas}.
5690
5691 @item -Wno-prio-ctor-dtor
5692 @opindex Wno-prio-ctor-dtor
5693 @opindex Wprio-ctor-dtor
5694 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5695 The use of constructor and destructor attributes allow you to assign a
5696 priority to the constructor/destructor to control its order of execution
5697 before @code{main} is called or after it returns. The priority values must be
5698 greater than 100 as the compiler reserves priority values between 0--100 for
5699 the implementation.
5700
5701 @item -Wstrict-aliasing
5702 @opindex Wstrict-aliasing
5703 @opindex Wno-strict-aliasing
5704 This option is only active when @option{-fstrict-aliasing} is active.
5705 It warns about code that might break the strict aliasing rules that the
5706 compiler is using for optimization. The warning does not catch all
5707 cases, but does attempt to catch the more common pitfalls. It is
5708 included in @option{-Wall}.
5709 It is equivalent to @option{-Wstrict-aliasing=3}
5710
5711 @item -Wstrict-aliasing=n
5712 @opindex Wstrict-aliasing=n
5713 This option is only active when @option{-fstrict-aliasing} is active.
5714 It warns about code that might break the strict aliasing rules that the
5715 compiler is using for optimization.
5716 Higher levels correspond to higher accuracy (fewer false positives).
5717 Higher levels also correspond to more effort, similar to the way @option{-O}
5718 works.
5719 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5720
5721 Level 1: Most aggressive, quick, least accurate.
5722 Possibly useful when higher levels
5723 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5724 false negatives. However, it has many false positives.
5725 Warns for all pointer conversions between possibly incompatible types,
5726 even if never dereferenced. Runs in the front end only.
5727
5728 Level 2: Aggressive, quick, not too precise.
5729 May still have many false positives (not as many as level 1 though),
5730 and few false negatives (but possibly more than level 1).
5731 Unlike level 1, it only warns when an address is taken. Warns about
5732 incomplete types. Runs in the front end only.
5733
5734 Level 3 (default for @option{-Wstrict-aliasing}):
5735 Should have very few false positives and few false
5736 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5737 Takes care of the common pun+dereference pattern in the front end:
5738 @code{*(int*)&some_float}.
5739 If optimization is enabled, it also runs in the back end, where it deals
5740 with multiple statement cases using flow-sensitive points-to information.
5741 Only warns when the converted pointer is dereferenced.
5742 Does not warn about incomplete types.
5743
5744 @item -Wstrict-overflow
5745 @itemx -Wstrict-overflow=@var{n}
5746 @opindex Wstrict-overflow
5747 @opindex Wno-strict-overflow
5748 This option is only active when signed overflow is undefined.
5749 It warns about cases where the compiler optimizes based on the
5750 assumption that signed overflow does not occur. Note that it does not
5751 warn about all cases where the code might overflow: it only warns
5752 about cases where the compiler implements some optimization. Thus
5753 this warning depends on the optimization level.
5754
5755 An optimization that assumes that signed overflow does not occur is
5756 perfectly safe if the values of the variables involved are such that
5757 overflow never does, in fact, occur. Therefore this warning can
5758 easily give a false positive: a warning about code that is not
5759 actually a problem. To help focus on important issues, several
5760 warning levels are defined. No warnings are issued for the use of
5761 undefined signed overflow when estimating how many iterations a loop
5762 requires, in particular when determining whether a loop will be
5763 executed at all.
5764
5765 @table @gcctabopt
5766 @item -Wstrict-overflow=1
5767 Warn about cases that are both questionable and easy to avoid. For
5768 example the compiler simplifies
5769 @code{x + 1 > x} to @code{1}. This level of
5770 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5771 are not, and must be explicitly requested.
5772
5773 @item -Wstrict-overflow=2
5774 Also warn about other cases where a comparison is simplified to a
5775 constant. For example: @code{abs (x) >= 0}. This can only be
5776 simplified when signed integer overflow is undefined, because
5777 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5778 zero. @option{-Wstrict-overflow} (with no level) is the same as
5779 @option{-Wstrict-overflow=2}.
5780
5781 @item -Wstrict-overflow=3
5782 Also warn about other cases where a comparison is simplified. For
5783 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5784
5785 @item -Wstrict-overflow=4
5786 Also warn about other simplifications not covered by the above cases.
5787 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5788
5789 @item -Wstrict-overflow=5
5790 Also warn about cases where the compiler reduces the magnitude of a
5791 constant involved in a comparison. For example: @code{x + 2 > y} is
5792 simplified to @code{x + 1 >= y}. This is reported only at the
5793 highest warning level because this simplification applies to many
5794 comparisons, so this warning level gives a very large number of
5795 false positives.
5796 @end table
5797
5798 @item -Wstringop-overflow
5799 @itemx -Wstringop-overflow=@var{type}
5800 @opindex Wstringop-overflow
5801 @opindex Wno-stringop-overflow
5802 Warn for calls to string manipulation functions such as @code{memcpy} and
5803 @code{strcpy} that are determined to overflow the destination buffer. The
5804 optional argument is one greater than the type of Object Size Checking to
5805 perform to determine the size of the destination. @xref{Object Size Checking}.
5806 The argument is meaningful only for functions that operate on character arrays
5807 but not for raw memory functions like @code{memcpy} which always make use
5808 of Object Size type-0. The option also warns for calls that specify a size
5809 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5810 The option produces the best results with optimization enabled but can detect
5811 a small subset of simple buffer overflows even without optimization in
5812 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5813 correspond to the standard functions. In any case, the option warns about
5814 just a subset of buffer overflows detected by the corresponding overflow
5815 checking built-ins. For example, the option will issue a warning for
5816 the @code{strcpy} call below because it copies at least 5 characters
5817 (the string @code{"blue"} including the terminating NUL) into the buffer
5818 of size 4.
5819
5820 @smallexample
5821 enum Color @{ blue, purple, yellow @};
5822 const char* f (enum Color clr)
5823 @{
5824 static char buf [4];
5825 const char *str;
5826 switch (clr)
5827 @{
5828 case blue: str = "blue"; break;
5829 case purple: str = "purple"; break;
5830 case yellow: str = "yellow"; break;
5831 @}
5832
5833 return strcpy (buf, str); // warning here
5834 @}
5835 @end smallexample
5836
5837 Option @option{-Wstringop-overflow=2} is enabled by default.
5838
5839 @table @gcctabopt
5840 @item -Wstringop-overflow
5841 @itemx -Wstringop-overflow=1
5842 @opindex Wstringop-overflow
5843 @opindex Wno-stringop-overflow
5844 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5845 to determine the sizes of destination objects. This is the default setting
5846 of the option. At this setting the option will not warn for writes past
5847 the end of subobjects of larger objects accessed by pointers unless the
5848 size of the largest surrounding object is known. When the destination may
5849 be one of several objects it is assumed to be the largest one of them. On
5850 Linux systems, when optimization is enabled at this setting the option warns
5851 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5852 a non-zero value.
5853
5854 @item -Wstringop-overflow=2
5855 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5856 to determine the sizes of destination objects. At this setting the option
5857 will warn about overflows when writing to members of the largest complete
5858 objects whose exact size is known. It will, however, not warn for excessive
5859 writes to the same members of unknown objects referenced by pointers since
5860 they may point to arrays containing unknown numbers of elements.
5861
5862 @item -Wstringop-overflow=3
5863 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5864 to determine the sizes of destination objects. At this setting the option
5865 warns about overflowing the smallest object or data member. This is the
5866 most restrictive setting of the option that may result in warnings for safe
5867 code.
5868
5869 @item -Wstringop-overflow=4
5870 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5871 to determine the sizes of destination objects. At this setting the option
5872 will warn about overflowing any data members, and when the destination is
5873 one of several objects it uses the size of the largest of them to decide
5874 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5875 setting of the option may result in warnings for benign code.
5876 @end table
5877
5878 @item -Wstringop-truncation
5879 @opindex Wstringop-truncation
5880 @opindex Wno-stringop-truncation
5881 Warn for calls to bounded string manipulation functions such as @code{strncat},
5882 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5883 or leave the destination unchanged.
5884
5885 In the following example, the call to @code{strncat} specifies a bound that
5886 is less than the length of the source string. As a result, the copy of
5887 the source will be truncated and so the call is diagnosed. To avoid the
5888 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5889
5890 @smallexample
5891 void append (char *buf, size_t bufsize)
5892 @{
5893 strncat (buf, ".txt", 3);
5894 @}
5895 @end smallexample
5896
5897 As another example, the following call to @code{strncpy} results in copying
5898 to @code{d} just the characters preceding the terminating NUL, without
5899 appending the NUL to the end. Assuming the result of @code{strncpy} is
5900 necessarily a NUL-terminated string is a common mistake, and so the call
5901 is diagnosed. To avoid the warning when the result is not expected to be
5902 NUL-terminated, call @code{memcpy} instead.
5903
5904 @smallexample
5905 void copy (char *d, const char *s)
5906 @{
5907 strncpy (d, s, strlen (s));
5908 @}
5909 @end smallexample
5910
5911 In the following example, the call to @code{strncpy} specifies the size
5912 of the destination buffer as the bound. If the length of the source
5913 string is equal to or greater than this size the result of the copy will
5914 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5915 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5916 element of the buffer to @code{NUL}.
5917
5918 @smallexample
5919 void copy (const char *s)
5920 @{
5921 char buf[80];
5922 strncpy (buf, s, sizeof buf);
5923 @dots{}
5924 @}
5925 @end smallexample
5926
5927 In situations where a character array is intended to store a sequence
5928 of bytes with no terminating @code{NUL} such an array may be annotated
5929 with attribute @code{nonstring} to avoid this warning. Such arrays,
5930 however, are not suitable arguments to functions that expect
5931 @code{NUL}-terminated strings. To help detect accidental misuses of
5932 such arrays GCC issues warnings unless it can prove that the use is
5933 safe. @xref{Common Variable Attributes}.
5934
5935 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5936 @opindex Wsuggest-attribute=
5937 @opindex Wno-suggest-attribute=
5938 Warn for cases where adding an attribute may be beneficial. The
5939 attributes currently supported are listed below.
5940
5941 @table @gcctabopt
5942 @item -Wsuggest-attribute=pure
5943 @itemx -Wsuggest-attribute=const
5944 @itemx -Wsuggest-attribute=noreturn
5945 @itemx -Wmissing-noreturn
5946 @itemx -Wsuggest-attribute=malloc
5947 @opindex Wsuggest-attribute=pure
5948 @opindex Wno-suggest-attribute=pure
5949 @opindex Wsuggest-attribute=const
5950 @opindex Wno-suggest-attribute=const
5951 @opindex Wsuggest-attribute=noreturn
5952 @opindex Wno-suggest-attribute=noreturn
5953 @opindex Wmissing-noreturn
5954 @opindex Wno-missing-noreturn
5955 @opindex Wsuggest-attribute=malloc
5956 @opindex Wno-suggest-attribute=malloc
5957
5958 Warn about functions that might be candidates for attributes
5959 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5960 only warns for functions visible in other compilation units or (in the case of
5961 @code{pure} and @code{const}) if it cannot prove that the function returns
5962 normally. A function returns normally if it doesn't contain an infinite loop or
5963 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5964 requires option @option{-fipa-pure-const}, which is enabled by default at
5965 @option{-O} and higher. Higher optimization levels improve the accuracy
5966 of the analysis.
5967
5968 @item -Wsuggest-attribute=format
5969 @itemx -Wmissing-format-attribute
5970 @opindex Wsuggest-attribute=format
5971 @opindex Wmissing-format-attribute
5972 @opindex Wno-suggest-attribute=format
5973 @opindex Wno-missing-format-attribute
5974 @opindex Wformat
5975 @opindex Wno-format
5976
5977 Warn about function pointers that might be candidates for @code{format}
5978 attributes. Note these are only possible candidates, not absolute ones.
5979 GCC guesses that function pointers with @code{format} attributes that
5980 are used in assignment, initialization, parameter passing or return
5981 statements should have a corresponding @code{format} attribute in the
5982 resulting type. I.e.@: the left-hand side of the assignment or
5983 initialization, the type of the parameter variable, or the return type
5984 of the containing function respectively should also have a @code{format}
5985 attribute to avoid the warning.
5986
5987 GCC also warns about function definitions that might be
5988 candidates for @code{format} attributes. Again, these are only
5989 possible candidates. GCC guesses that @code{format} attributes
5990 might be appropriate for any function that calls a function like
5991 @code{vprintf} or @code{vscanf}, but this might not always be the
5992 case, and some functions for which @code{format} attributes are
5993 appropriate may not be detected.
5994
5995 @item -Wsuggest-attribute=cold
5996 @opindex Wsuggest-attribute=cold
5997 @opindex Wno-suggest-attribute=cold
5998
5999 Warn about functions that might be candidates for @code{cold} attribute. This
6000 is based on static detection and generally will only warn about functions which
6001 always leads to a call to another @code{cold} function such as wrappers of
6002 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6003 @end table
6004
6005 @item -Wsuggest-final-types
6006 @opindex Wno-suggest-final-types
6007 @opindex Wsuggest-final-types
6008 Warn about types with virtual methods where code quality would be improved
6009 if the type were declared with the C++11 @code{final} specifier,
6010 or, if possible,
6011 declared in an anonymous namespace. This allows GCC to more aggressively
6012 devirtualize the polymorphic calls. This warning is more effective with
6013 link-time optimization,
6014 where the information about the class hierarchy graph is
6015 more complete.
6016
6017 @item -Wsuggest-final-methods
6018 @opindex Wno-suggest-final-methods
6019 @opindex Wsuggest-final-methods
6020 Warn about virtual methods where code quality would be improved if the method
6021 were declared with the C++11 @code{final} specifier,
6022 or, if possible, its type were
6023 declared in an anonymous namespace or with the @code{final} specifier.
6024 This warning is
6025 more effective with link-time optimization, where the information about the
6026 class hierarchy graph is more complete. It is recommended to first consider
6027 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6028 annotations.
6029
6030 @item -Wsuggest-override
6031 Warn about overriding virtual functions that are not marked with the override
6032 keyword.
6033
6034 @item -Walloc-zero
6035 @opindex Wno-alloc-zero
6036 @opindex Walloc-zero
6037 Warn about calls to allocation functions decorated with attribute
6038 @code{alloc_size} that specify zero bytes, including those to the built-in
6039 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6040 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6041 when called with a zero size differs among implementations (and in the case
6042 of @code{realloc} has been deprecated) relying on it may result in subtle
6043 portability bugs and should be avoided.
6044
6045 @item -Walloc-size-larger-than=@var{byte-size}
6046 @opindex Walloc-size-larger-than=
6047 @opindex Wno-alloc-size-larger-than
6048 Warn about calls to functions decorated with attribute @code{alloc_size}
6049 that attempt to allocate objects larger than the specified number of bytes,
6050 or where the result of the size computation in an integer type with infinite
6051 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6052 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6053 Warnings controlled by the option can be disabled either by specifying
6054 @var{byte-size} of @samp{SIZE_MAX} or more or by
6055 @option{-Wno-alloc-size-larger-than}.
6056 @xref{Function Attributes}.
6057
6058 @item -Wno-alloc-size-larger-than
6059 @opindex Wno-alloc-size-larger-than
6060 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6061 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6062 larger.
6063
6064 @item -Walloca
6065 @opindex Wno-alloca
6066 @opindex Walloca
6067 This option warns on all uses of @code{alloca} in the source.
6068
6069 @item -Walloca-larger-than=@var{byte-size}
6070 @opindex Walloca-larger-than=
6071 @opindex Wno-alloca-larger-than
6072 This option warns on calls to @code{alloca} with an integer argument whose
6073 value is either zero, or that is not bounded by a controlling predicate
6074 that limits its value to at most @var{byte-size}. It also warns for calls
6075 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6076 types are considered unbounded even if they appear to be constrained to
6077 the expected range.
6078
6079 For example, a bounded case of @code{alloca} could be:
6080
6081 @smallexample
6082 void func (size_t n)
6083 @{
6084 void *p;
6085 if (n <= 1000)
6086 p = alloca (n);
6087 else
6088 p = malloc (n);
6089 f (p);
6090 @}
6091 @end smallexample
6092
6093 In the above example, passing @code{-Walloca-larger-than=1000} would not
6094 issue a warning because the call to @code{alloca} is known to be at most
6095 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6096 the compiler would emit a warning.
6097
6098 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6099 controlling predicate constraining its integer argument. For example:
6100
6101 @smallexample
6102 void func ()
6103 @{
6104 void *p = alloca (n);
6105 f (p);
6106 @}
6107 @end smallexample
6108
6109 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6110 a warning, but this time because of the lack of bounds checking.
6111
6112 Note, that even seemingly correct code involving signed integers could
6113 cause a warning:
6114
6115 @smallexample
6116 void func (signed int n)
6117 @{
6118 if (n < 500)
6119 @{
6120 p = alloca (n);
6121 f (p);
6122 @}
6123 @}
6124 @end smallexample
6125
6126 In the above example, @var{n} could be negative, causing a larger than
6127 expected argument to be implicitly cast into the @code{alloca} call.
6128
6129 This option also warns when @code{alloca} is used in a loop.
6130
6131 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6132 but is usually only effective when @option{-ftree-vrp} is active (default
6133 for @option{-O2} and above).
6134
6135 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6136
6137 @item -Wno-alloca-larger-than
6138 @opindex Wno-alloca-larger-than
6139 Disable @option{-Walloca-larger-than=} warnings. The option is
6140 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6141
6142 @item -Warray-bounds
6143 @itemx -Warray-bounds=@var{n}
6144 @opindex Wno-array-bounds
6145 @opindex Warray-bounds
6146 This option is only active when @option{-ftree-vrp} is active
6147 (default for @option{-O2} and above). It warns about subscripts to arrays
6148 that are always out of bounds. This warning is enabled by @option{-Wall}.
6149
6150 @table @gcctabopt
6151 @item -Warray-bounds=1
6152 This is the warning level of @option{-Warray-bounds} and is enabled
6153 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6154
6155 @item -Warray-bounds=2
6156 This warning level also warns about out of bounds access for
6157 arrays at the end of a struct and for arrays accessed through
6158 pointers. This warning level may give a larger number of
6159 false positives and is deactivated by default.
6160 @end table
6161
6162 @item -Wattribute-alias=@var{n}
6163 @itemx -Wno-attribute-alias
6164 @opindex Wattribute-alias
6165 @opindex Wno-attribute-alias
6166 Warn about declarations using the @code{alias} and similar attributes whose
6167 target is incompatible with the type of the alias.
6168 @xref{Function Attributes,,Declaring Attributes of Functions}.
6169
6170 @table @gcctabopt
6171 @item -Wattribute-alias=1
6172 The default warning level of the @option{-Wattribute-alias} option diagnoses
6173 incompatibilities between the type of the alias declaration and that of its
6174 target. Such incompatibilities are typically indicative of bugs.
6175
6176 @item -Wattribute-alias=2
6177
6178 At this level @option{-Wattribute-alias} also diagnoses cases where
6179 the attributes of the alias declaration are more restrictive than the
6180 attributes applied to its target. These mismatches can potentially
6181 result in incorrect code generation. In other cases they may be
6182 benign and could be resolved simply by adding the missing attribute to
6183 the target. For comparison, see the @option{-Wmissing-attributes}
6184 option, which controls diagnostics when the alias declaration is less
6185 restrictive than the target, rather than more restrictive.
6186
6187 Attributes considered include @code{alloc_align}, @code{alloc_size},
6188 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6189 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6190 @code{returns_nonnull}, and @code{returns_twice}.
6191 @end table
6192
6193 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6194 This is the default. You can disable these warnings with either
6195 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6196
6197 @item -Wbool-compare
6198 @opindex Wno-bool-compare
6199 @opindex Wbool-compare
6200 Warn about boolean expression compared with an integer value different from
6201 @code{true}/@code{false}. For instance, the following comparison is
6202 always false:
6203 @smallexample
6204 int n = 5;
6205 @dots{}
6206 if ((n > 1) == 2) @{ @dots{} @}
6207 @end smallexample
6208 This warning is enabled by @option{-Wall}.
6209
6210 @item -Wbool-operation
6211 @opindex Wno-bool-operation
6212 @opindex Wbool-operation
6213 Warn about suspicious operations on expressions of a boolean type. For
6214 instance, bitwise negation of a boolean is very likely a bug in the program.
6215 For C, this warning also warns about incrementing or decrementing a boolean,
6216 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6217 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6218
6219 This warning is enabled by @option{-Wall}.
6220
6221 @item -Wduplicated-branches
6222 @opindex Wno-duplicated-branches
6223 @opindex Wduplicated-branches
6224 Warn when an if-else has identical branches. This warning detects cases like
6225 @smallexample
6226 if (p != NULL)
6227 return 0;
6228 else
6229 return 0;
6230 @end smallexample
6231 It doesn't warn when both branches contain just a null statement. This warning
6232 also warn for conditional operators:
6233 @smallexample
6234 int i = x ? *p : *p;
6235 @end smallexample
6236
6237 @item -Wduplicated-cond
6238 @opindex Wno-duplicated-cond
6239 @opindex Wduplicated-cond
6240 Warn about duplicated conditions in an if-else-if chain. For instance,
6241 warn for the following code:
6242 @smallexample
6243 if (p->q != NULL) @{ @dots{} @}
6244 else if (p->q != NULL) @{ @dots{} @}
6245 @end smallexample
6246
6247 @item -Wframe-address
6248 @opindex Wno-frame-address
6249 @opindex Wframe-address
6250 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6251 is called with an argument greater than 0. Such calls may return indeterminate
6252 values or crash the program. The warning is included in @option{-Wall}.
6253
6254 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6255 @opindex Wno-discarded-qualifiers
6256 @opindex Wdiscarded-qualifiers
6257 Do not warn if type qualifiers on pointers are being discarded.
6258 Typically, the compiler warns if a @code{const char *} variable is
6259 passed to a function that takes a @code{char *} parameter. This option
6260 can be used to suppress such a warning.
6261
6262 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6263 @opindex Wno-discarded-array-qualifiers
6264 @opindex Wdiscarded-array-qualifiers
6265 Do not warn if type qualifiers on arrays which are pointer targets
6266 are being discarded. Typically, the compiler warns if a
6267 @code{const int (*)[]} variable is passed to a function that
6268 takes a @code{int (*)[]} parameter. This option can be used to
6269 suppress such a warning.
6270
6271 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6272 @opindex Wno-incompatible-pointer-types
6273 @opindex Wincompatible-pointer-types
6274 Do not warn when there is a conversion between pointers that have incompatible
6275 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6276 which warns for pointer argument passing or assignment with different
6277 signedness.
6278
6279 @item -Wno-int-conversion @r{(C and Objective-C only)}
6280 @opindex Wno-int-conversion
6281 @opindex Wint-conversion
6282 Do not warn about incompatible integer to pointer and pointer to integer
6283 conversions. This warning is about implicit conversions; for explicit
6284 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6285 @option{-Wno-pointer-to-int-cast} may be used.
6286
6287 @item -Wno-div-by-zero
6288 @opindex Wno-div-by-zero
6289 @opindex Wdiv-by-zero
6290 Do not warn about compile-time integer division by zero. Floating-point
6291 division by zero is not warned about, as it can be a legitimate way of
6292 obtaining infinities and NaNs.
6293
6294 @item -Wsystem-headers
6295 @opindex Wsystem-headers
6296 @opindex Wno-system-headers
6297 @cindex warnings from system headers
6298 @cindex system headers, warnings from
6299 Print warning messages for constructs found in system header files.
6300 Warnings from system headers are normally suppressed, on the assumption
6301 that they usually do not indicate real problems and would only make the
6302 compiler output harder to read. Using this command-line option tells
6303 GCC to emit warnings from system headers as if they occurred in user
6304 code. However, note that using @option{-Wall} in conjunction with this
6305 option does @emph{not} warn about unknown pragmas in system
6306 headers---for that, @option{-Wunknown-pragmas} must also be used.
6307
6308 @item -Wtautological-compare
6309 @opindex Wtautological-compare
6310 @opindex Wno-tautological-compare
6311 Warn if a self-comparison always evaluates to true or false. This
6312 warning detects various mistakes such as:
6313 @smallexample
6314 int i = 1;
6315 @dots{}
6316 if (i > i) @{ @dots{} @}
6317 @end smallexample
6318
6319 This warning also warns about bitwise comparisons that always evaluate
6320 to true or false, for instance:
6321 @smallexample
6322 if ((a & 16) == 10) @{ @dots{} @}
6323 @end smallexample
6324 will always be false.
6325
6326 This warning is enabled by @option{-Wall}.
6327
6328 @item -Wtrampolines
6329 @opindex Wtrampolines
6330 @opindex Wno-trampolines
6331 Warn about trampolines generated for pointers to nested functions.
6332 A trampoline is a small piece of data or code that is created at run
6333 time on the stack when the address of a nested function is taken, and is
6334 used to call the nested function indirectly. For some targets, it is
6335 made up of data only and thus requires no special treatment. But, for
6336 most targets, it is made up of code and thus requires the stack to be
6337 made executable in order for the program to work properly.
6338
6339 @item -Wfloat-equal
6340 @opindex Wfloat-equal
6341 @opindex Wno-float-equal
6342 Warn if floating-point values are used in equality comparisons.
6343
6344 The idea behind this is that sometimes it is convenient (for the
6345 programmer) to consider floating-point values as approximations to
6346 infinitely precise real numbers. If you are doing this, then you need
6347 to compute (by analyzing the code, or in some other way) the maximum or
6348 likely maximum error that the computation introduces, and allow for it
6349 when performing comparisons (and when producing output, but that's a
6350 different problem). In particular, instead of testing for equality, you
6351 should check to see whether the two values have ranges that overlap; and
6352 this is done with the relational operators, so equality comparisons are
6353 probably mistaken.
6354
6355 @item -Wtraditional @r{(C and Objective-C only)}
6356 @opindex Wtraditional
6357 @opindex Wno-traditional
6358 Warn about certain constructs that behave differently in traditional and
6359 ISO C@. Also warn about ISO C constructs that have no traditional C
6360 equivalent, and/or problematic constructs that should be avoided.
6361
6362 @itemize @bullet
6363 @item
6364 Macro parameters that appear within string literals in the macro body.
6365 In traditional C macro replacement takes place within string literals,
6366 but in ISO C it does not.
6367
6368 @item
6369 In traditional C, some preprocessor directives did not exist.
6370 Traditional preprocessors only considered a line to be a directive
6371 if the @samp{#} appeared in column 1 on the line. Therefore
6372 @option{-Wtraditional} warns about directives that traditional C
6373 understands but ignores because the @samp{#} does not appear as the
6374 first character on the line. It also suggests you hide directives like
6375 @code{#pragma} not understood by traditional C by indenting them. Some
6376 traditional implementations do not recognize @code{#elif}, so this option
6377 suggests avoiding it altogether.
6378
6379 @item
6380 A function-like macro that appears without arguments.
6381
6382 @item
6383 The unary plus operator.
6384
6385 @item
6386 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6387 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6388 constants.) Note, these suffixes appear in macros defined in the system
6389 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6390 Use of these macros in user code might normally lead to spurious
6391 warnings, however GCC's integrated preprocessor has enough context to
6392 avoid warning in these cases.
6393
6394 @item
6395 A function declared external in one block and then used after the end of
6396 the block.
6397
6398 @item
6399 A @code{switch} statement has an operand of type @code{long}.
6400
6401 @item
6402 A non-@code{static} function declaration follows a @code{static} one.
6403 This construct is not accepted by some traditional C compilers.
6404
6405 @item
6406 The ISO type of an integer constant has a different width or
6407 signedness from its traditional type. This warning is only issued if
6408 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6409 typically represent bit patterns, are not warned about.
6410
6411 @item
6412 Usage of ISO string concatenation is detected.
6413
6414 @item
6415 Initialization of automatic aggregates.
6416
6417 @item
6418 Identifier conflicts with labels. Traditional C lacks a separate
6419 namespace for labels.
6420
6421 @item
6422 Initialization of unions. If the initializer is zero, the warning is
6423 omitted. This is done under the assumption that the zero initializer in
6424 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6425 initializer warnings and relies on default initialization to zero in the
6426 traditional C case.
6427
6428 @item
6429 Conversions by prototypes between fixed/floating-point values and vice
6430 versa. The absence of these prototypes when compiling with traditional
6431 C causes serious problems. This is a subset of the possible
6432 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6433
6434 @item
6435 Use of ISO C style function definitions. This warning intentionally is
6436 @emph{not} issued for prototype declarations or variadic functions
6437 because these ISO C features appear in your code when using
6438 libiberty's traditional C compatibility macros, @code{PARAMS} and
6439 @code{VPARAMS}. This warning is also bypassed for nested functions
6440 because that feature is already a GCC extension and thus not relevant to
6441 traditional C compatibility.
6442 @end itemize
6443
6444 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6445 @opindex Wtraditional-conversion
6446 @opindex Wno-traditional-conversion
6447 Warn if a prototype causes a type conversion that is different from what
6448 would happen to the same argument in the absence of a prototype. This
6449 includes conversions of fixed point to floating and vice versa, and
6450 conversions changing the width or signedness of a fixed-point argument
6451 except when the same as the default promotion.
6452
6453 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6454 @opindex Wdeclaration-after-statement
6455 @opindex Wno-declaration-after-statement
6456 Warn when a declaration is found after a statement in a block. This
6457 construct, known from C++, was introduced with ISO C99 and is by default
6458 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6459
6460 @item -Wshadow
6461 @opindex Wshadow
6462 @opindex Wno-shadow
6463 Warn whenever a local variable or type declaration shadows another
6464 variable, parameter, type, class member (in C++), or instance variable
6465 (in Objective-C) or whenever a built-in function is shadowed. Note
6466 that in C++, the compiler warns if a local variable shadows an
6467 explicit typedef, but not if it shadows a struct/class/enum.
6468 Same as @option{-Wshadow=global}.
6469
6470 @item -Wno-shadow-ivar @r{(Objective-C only)}
6471 @opindex Wno-shadow-ivar
6472 @opindex Wshadow-ivar
6473 Do not warn whenever a local variable shadows an instance variable in an
6474 Objective-C method.
6475
6476 @item -Wshadow=global
6477 @opindex Wshadow=local
6478 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6479
6480 @item -Wshadow=local
6481 @opindex Wshadow=local
6482 Warn when a local variable shadows another local variable or parameter.
6483 This warning is enabled by @option{-Wshadow=global}.
6484
6485 @item -Wshadow=compatible-local
6486 @opindex Wshadow=compatible-local
6487 Warn when a local variable shadows another local variable or parameter
6488 whose type is compatible with that of the shadowing variable. In C++,
6489 type compatibility here means the type of the shadowing variable can be
6490 converted to that of the shadowed variable. The creation of this flag
6491 (in addition to @option{-Wshadow=local}) is based on the idea that when
6492 a local variable shadows another one of incompatible type, it is most
6493 likely intentional, not a bug or typo, as shown in the following example:
6494
6495 @smallexample
6496 @group
6497 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6498 @{
6499 for (int i = 0; i < N; ++i)
6500 @{
6501 ...
6502 @}
6503 ...
6504 @}
6505 @end group
6506 @end smallexample
6507
6508 Since the two variable @code{i} in the example above have incompatible types,
6509 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6510 Because their types are incompatible, if a programmer accidentally uses one
6511 in place of the other, type checking will catch that and emit an error or
6512 warning. So not warning (about shadowing) in this case will not lead to
6513 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6514 possibly reduce the number of warnings triggered by intentional shadowing.
6515
6516 This warning is enabled by @option{-Wshadow=local}.
6517
6518 @item -Wlarger-than=@var{byte-size}
6519 @opindex Wlarger-than=
6520 @opindex Wlarger-than-@var{byte-size}
6521 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6522 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6523 Warnings controlled by the option can be disabled either by specifying
6524 @var{byte-size} of @samp{SIZE_MAX} or more or by
6525 @option{-Wno-larger-than}.
6526
6527 @item -Wno-larger-than
6528 @opindex Wno-larger-than
6529 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6530 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6531
6532 @item -Wframe-larger-than=@var{byte-size}
6533 @opindex Wframe-larger-than=
6534 @opindex Wno-frame-larger-than
6535 Warn if the size of a function frame exceeds @var{byte-size}.
6536 The computation done to determine the stack frame size is approximate
6537 and not conservative.
6538 The actual requirements may be somewhat greater than @var{byte-size}
6539 even if you do not get a warning. In addition, any space allocated
6540 via @code{alloca}, variable-length arrays, or related constructs
6541 is not included by the compiler when determining
6542 whether or not to issue a warning.
6543 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6544 Warnings controlled by the option can be disabled either by specifying
6545 @var{byte-size} of @samp{SIZE_MAX} or more or by
6546 @option{-Wno-frame-larger-than}.
6547
6548 @item -Wno-frame-larger-than
6549 @opindex Wno-frame-larger-than
6550 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6551 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6552
6553 @item -Wno-free-nonheap-object
6554 @opindex Wno-free-nonheap-object
6555 @opindex Wfree-nonheap-object
6556 Do not warn when attempting to free an object that was not allocated
6557 on the heap.
6558
6559 @item -Wstack-usage=@var{byte-size}
6560 @opindex Wstack-usage
6561 @opindex Wno-stack-usage
6562 Warn if the stack usage of a function might exceed @var{byte-size}.
6563 The computation done to determine the stack usage is conservative.
6564 Any space allocated via @code{alloca}, variable-length arrays, or related
6565 constructs is included by the compiler when determining whether or not to
6566 issue a warning.
6567
6568 The message is in keeping with the output of @option{-fstack-usage}.
6569
6570 @itemize
6571 @item
6572 If the stack usage is fully static but exceeds the specified amount, it's:
6573
6574 @smallexample
6575 warning: stack usage is 1120 bytes
6576 @end smallexample
6577 @item
6578 If the stack usage is (partly) dynamic but bounded, it's:
6579
6580 @smallexample
6581 warning: stack usage might be 1648 bytes
6582 @end smallexample
6583 @item
6584 If the stack usage is (partly) dynamic and not bounded, it's:
6585
6586 @smallexample
6587 warning: stack usage might be unbounded
6588 @end smallexample
6589 @end itemize
6590
6591 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6592 Warnings controlled by the option can be disabled either by specifying
6593 @var{byte-size} of @samp{SIZE_MAX} or more or by
6594 @option{-Wno-stack-usage}.
6595
6596 @item -Wno-stack-usage
6597 @opindex Wno-stack-usage
6598 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6599 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6600
6601 @item -Wunsafe-loop-optimizations
6602 @opindex Wunsafe-loop-optimizations
6603 @opindex Wno-unsafe-loop-optimizations
6604 Warn if the loop cannot be optimized because the compiler cannot
6605 assume anything on the bounds of the loop indices. With
6606 @option{-funsafe-loop-optimizations} warn if the compiler makes
6607 such assumptions.
6608
6609 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6610 @opindex Wno-pedantic-ms-format
6611 @opindex Wpedantic-ms-format
6612 When used in combination with @option{-Wformat}
6613 and @option{-pedantic} without GNU extensions, this option
6614 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6615 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6616 which depend on the MS runtime.
6617
6618 @item -Waligned-new
6619 @opindex Waligned-new
6620 @opindex Wno-aligned-new
6621 Warn about a new-expression of a type that requires greater alignment
6622 than the @code{alignof(std::max_align_t)} but uses an allocation
6623 function without an explicit alignment parameter. This option is
6624 enabled by @option{-Wall}.
6625
6626 Normally this only warns about global allocation functions, but
6627 @option{-Waligned-new=all} also warns about class member allocation
6628 functions.
6629
6630 @item -Wplacement-new
6631 @itemx -Wplacement-new=@var{n}
6632 @opindex Wplacement-new
6633 @opindex Wno-placement-new
6634 Warn about placement new expressions with undefined behavior, such as
6635 constructing an object in a buffer that is smaller than the type of
6636 the object. For example, the placement new expression below is diagnosed
6637 because it attempts to construct an array of 64 integers in a buffer only
6638 64 bytes large.
6639 @smallexample
6640 char buf [64];
6641 new (buf) int[64];
6642 @end smallexample
6643 This warning is enabled by default.
6644
6645 @table @gcctabopt
6646 @item -Wplacement-new=1
6647 This is the default warning level of @option{-Wplacement-new}. At this
6648 level the warning is not issued for some strictly undefined constructs that
6649 GCC allows as extensions for compatibility with legacy code. For example,
6650 the following @code{new} expression is not diagnosed at this level even
6651 though it has undefined behavior according to the C++ standard because
6652 it writes past the end of the one-element array.
6653 @smallexample
6654 struct S @{ int n, a[1]; @};
6655 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6656 new (s->a)int [32]();
6657 @end smallexample
6658
6659 @item -Wplacement-new=2
6660 At this level, in addition to diagnosing all the same constructs as at level
6661 1, a diagnostic is also issued for placement new expressions that construct
6662 an object in the last member of structure whose type is an array of a single
6663 element and whose size is less than the size of the object being constructed.
6664 While the previous example would be diagnosed, the following construct makes
6665 use of the flexible member array extension to avoid the warning at level 2.
6666 @smallexample
6667 struct S @{ int n, a[]; @};
6668 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6669 new (s->a)int [32]();
6670 @end smallexample
6671
6672 @end table
6673
6674 @item -Wpointer-arith
6675 @opindex Wpointer-arith
6676 @opindex Wno-pointer-arith
6677 Warn about anything that depends on the ``size of'' a function type or
6678 of @code{void}. GNU C assigns these types a size of 1, for
6679 convenience in calculations with @code{void *} pointers and pointers
6680 to functions. In C++, warn also when an arithmetic operation involves
6681 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6682
6683 @item -Wpointer-compare
6684 @opindex Wpointer-compare
6685 @opindex Wno-pointer-compare
6686 Warn if a pointer is compared with a zero character constant. This usually
6687 means that the pointer was meant to be dereferenced. For example:
6688
6689 @smallexample
6690 const char *p = foo ();
6691 if (p == '\0')
6692 return 42;
6693 @end smallexample
6694
6695 Note that the code above is invalid in C++11.
6696
6697 This warning is enabled by default.
6698
6699 @item -Wtype-limits
6700 @opindex Wtype-limits
6701 @opindex Wno-type-limits
6702 Warn if a comparison is always true or always false due to the limited
6703 range of the data type, but do not warn for constant expressions. For
6704 example, warn if an unsigned variable is compared against zero with
6705 @code{<} or @code{>=}. This warning is also enabled by
6706 @option{-Wextra}.
6707
6708 @item -Wabsolute-value @r{(C and Objective-C only)}
6709 @opindex Wabsolute-value
6710 @opindex Wno-absolute-value
6711 Warn for calls to standard functions that compute the absolute value
6712 of an argument when a more appropriate standard function is available.
6713 For example, calling @code{abs(3.14)} triggers the warning because the
6714 appropriate function to call to compute the absolute value of a double
6715 argument is @code{fabs}. The option also triggers warnings when the
6716 argument in a call to such a function has an unsigned type. This
6717 warning can be suppressed with an explicit type cast and it is also
6718 enabled by @option{-Wextra}.
6719
6720 @include cppwarnopts.texi
6721
6722 @item -Wbad-function-cast @r{(C and Objective-C only)}
6723 @opindex Wbad-function-cast
6724 @opindex Wno-bad-function-cast
6725 Warn when a function call is cast to a non-matching type.
6726 For example, warn if a call to a function returning an integer type
6727 is cast to a pointer type.
6728
6729 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6730 @opindex Wc90-c99-compat
6731 @opindex Wno-c90-c99-compat
6732 Warn about features not present in ISO C90, but present in ISO C99.
6733 For instance, warn about use of variable length arrays, @code{long long}
6734 type, @code{bool} type, compound literals, designated initializers, and so
6735 on. This option is independent of the standards mode. Warnings are disabled
6736 in the expression that follows @code{__extension__}.
6737
6738 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6739 @opindex Wc99-c11-compat
6740 @opindex Wno-c99-c11-compat
6741 Warn about features not present in ISO C99, but present in ISO C11.
6742 For instance, warn about use of anonymous structures and unions,
6743 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6744 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6745 and so on. This option is independent of the standards mode. Warnings are
6746 disabled in the expression that follows @code{__extension__}.
6747
6748 @item -Wc++-compat @r{(C and Objective-C only)}
6749 @opindex Wc++-compat
6750 @opindex Wno-c++-compat
6751 Warn about ISO C constructs that are outside of the common subset of
6752 ISO C and ISO C++, e.g.@: request for implicit conversion from
6753 @code{void *} to a pointer to non-@code{void} type.
6754
6755 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6756 @opindex Wc++11-compat
6757 @opindex Wno-c++11-compat
6758 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6759 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6760 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6761 enabled by @option{-Wall}.
6762
6763 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6764 @opindex Wc++14-compat
6765 @opindex Wno-c++14-compat
6766 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6767 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6768
6769 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6770 @opindex Wc++17-compat
6771 @opindex Wno-c++17-compat
6772 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6773 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6774
6775 @item -Wcast-qual
6776 @opindex Wcast-qual
6777 @opindex Wno-cast-qual
6778 Warn whenever a pointer is cast so as to remove a type qualifier from
6779 the target type. For example, warn if a @code{const char *} is cast
6780 to an ordinary @code{char *}.
6781
6782 Also warn when making a cast that introduces a type qualifier in an
6783 unsafe way. For example, casting @code{char **} to @code{const char **}
6784 is unsafe, as in this example:
6785
6786 @smallexample
6787 /* p is char ** value. */
6788 const char **q = (const char **) p;
6789 /* Assignment of readonly string to const char * is OK. */
6790 *q = "string";
6791 /* Now char** pointer points to read-only memory. */
6792 **p = 'b';
6793 @end smallexample
6794
6795 @item -Wcast-align
6796 @opindex Wcast-align
6797 @opindex Wno-cast-align
6798 Warn whenever a pointer is cast such that the required alignment of the
6799 target is increased. For example, warn if a @code{char *} is cast to
6800 an @code{int *} on machines where integers can only be accessed at
6801 two- or four-byte boundaries.
6802
6803 @item -Wcast-align=strict
6804 @opindex Wcast-align=strict
6805 Warn whenever a pointer is cast such that the required alignment of the
6806 target is increased. For example, warn if a @code{char *} is cast to
6807 an @code{int *} regardless of the target machine.
6808
6809 @item -Wcast-function-type
6810 @opindex Wcast-function-type
6811 @opindex Wno-cast-function-type
6812 Warn when a function pointer is cast to an incompatible function pointer.
6813 In a cast involving function types with a variable argument list only
6814 the types of initial arguments that are provided are considered.
6815 Any parameter of pointer-type matches any other pointer-type. Any benign
6816 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6817 on ILP32 targets. Likewise type qualifiers are ignored. The function
6818 type @code{void (*) (void)} is special and matches everything, which can
6819 be used to suppress this warning.
6820 In a cast involving pointer to member types this warning warns whenever
6821 the type cast is changing the pointer to member type.
6822 This warning is enabled by @option{-Wextra}.
6823
6824 @item -Wwrite-strings
6825 @opindex Wwrite-strings
6826 @opindex Wno-write-strings
6827 When compiling C, give string constants the type @code{const
6828 char[@var{length}]} so that copying the address of one into a
6829 non-@code{const} @code{char *} pointer produces a warning. These
6830 warnings help you find at compile time code that can try to write
6831 into a string constant, but only if you have been very careful about
6832 using @code{const} in declarations and prototypes. Otherwise, it is
6833 just a nuisance. This is why we did not make @option{-Wall} request
6834 these warnings.
6835
6836 When compiling C++, warn about the deprecated conversion from string
6837 literals to @code{char *}. This warning is enabled by default for C++
6838 programs.
6839
6840 @item -Wcatch-value
6841 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6842 @opindex Wcatch-value
6843 @opindex Wno-catch-value
6844 Warn about catch handlers that do not catch via reference.
6845 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6846 warn about polymorphic class types that are caught by value.
6847 With @option{-Wcatch-value=2} warn about all class types that are caught
6848 by value. With @option{-Wcatch-value=3} warn about all types that are
6849 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6850
6851 @item -Wclobbered
6852 @opindex Wclobbered
6853 @opindex Wno-clobbered
6854 Warn for variables that might be changed by @code{longjmp} or
6855 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6856
6857 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6858 @opindex Wconditionally-supported
6859 @opindex Wno-conditionally-supported
6860 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6861
6862 @item -Wconversion
6863 @opindex Wconversion
6864 @opindex Wno-conversion
6865 Warn for implicit conversions that may alter a value. This includes
6866 conversions between real and integer, like @code{abs (x)} when
6867 @code{x} is @code{double}; conversions between signed and unsigned,
6868 like @code{unsigned ui = -1}; and conversions to smaller types, like
6869 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6870 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6871 changed by the conversion like in @code{abs (2.0)}. Warnings about
6872 conversions between signed and unsigned integers can be disabled by
6873 using @option{-Wno-sign-conversion}.
6874
6875 For C++, also warn for confusing overload resolution for user-defined
6876 conversions; and conversions that never use a type conversion
6877 operator: conversions to @code{void}, the same type, a base class or a
6878 reference to them. Warnings about conversions between signed and
6879 unsigned integers are disabled by default in C++ unless
6880 @option{-Wsign-conversion} is explicitly enabled.
6881
6882 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6883 @opindex Wconversion-null
6884 @opindex Wno-conversion-null
6885 Do not warn for conversions between @code{NULL} and non-pointer
6886 types. @option{-Wconversion-null} is enabled by default.
6887
6888 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6889 @opindex Wzero-as-null-pointer-constant
6890 @opindex Wno-zero-as-null-pointer-constant
6891 Warn when a literal @samp{0} is used as null pointer constant. This can
6892 be useful to facilitate the conversion to @code{nullptr} in C++11.
6893
6894 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6895 @opindex Wsubobject-linkage
6896 @opindex Wno-subobject-linkage
6897 Warn if a class type has a base or a field whose type uses the anonymous
6898 namespace or depends on a type with no linkage. If a type A depends on
6899 a type B with no or internal linkage, defining it in multiple
6900 translation units would be an ODR violation because the meaning of B
6901 is different in each translation unit. If A only appears in a single
6902 translation unit, the best way to silence the warning is to give it
6903 internal linkage by putting it in an anonymous namespace as well. The
6904 compiler doesn't give this warning for types defined in the main .C
6905 file, as those are unlikely to have multiple definitions.
6906 @option{-Wsubobject-linkage} is enabled by default.
6907
6908 @item -Wdangling-else
6909 @opindex Wdangling-else
6910 @opindex Wno-dangling-else
6911 Warn about constructions where there may be confusion to which
6912 @code{if} statement an @code{else} branch belongs. Here is an example of
6913 such a case:
6914
6915 @smallexample
6916 @group
6917 @{
6918 if (a)
6919 if (b)
6920 foo ();
6921 else
6922 bar ();
6923 @}
6924 @end group
6925 @end smallexample
6926
6927 In C/C++, every @code{else} branch belongs to the innermost possible
6928 @code{if} statement, which in this example is @code{if (b)}. This is
6929 often not what the programmer expected, as illustrated in the above
6930 example by indentation the programmer chose. When there is the
6931 potential for this confusion, GCC issues a warning when this flag
6932 is specified. To eliminate the warning, add explicit braces around
6933 the innermost @code{if} statement so there is no way the @code{else}
6934 can belong to the enclosing @code{if}. The resulting code
6935 looks like this:
6936
6937 @smallexample
6938 @group
6939 @{
6940 if (a)
6941 @{
6942 if (b)
6943 foo ();
6944 else
6945 bar ();
6946 @}
6947 @}
6948 @end group
6949 @end smallexample
6950
6951 This warning is enabled by @option{-Wparentheses}.
6952
6953 @item -Wdate-time
6954 @opindex Wdate-time
6955 @opindex Wno-date-time
6956 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6957 are encountered as they might prevent bit-wise-identical reproducible
6958 compilations.
6959
6960 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6961 @opindex Wdelete-incomplete
6962 @opindex Wno-delete-incomplete
6963 Warn when deleting a pointer to incomplete type, which may cause
6964 undefined behavior at runtime. This warning is enabled by default.
6965
6966 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6967 @opindex Wuseless-cast
6968 @opindex Wno-useless-cast
6969 Warn when an expression is casted to its own type.
6970
6971 @item -Wempty-body
6972 @opindex Wempty-body
6973 @opindex Wno-empty-body
6974 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6975 while} statement. This warning is also enabled by @option{-Wextra}.
6976
6977 @item -Wenum-compare
6978 @opindex Wenum-compare
6979 @opindex Wno-enum-compare
6980 Warn about a comparison between values of different enumerated types.
6981 In C++ enumerated type mismatches in conditional expressions are also
6982 diagnosed and the warning is enabled by default. In C this warning is
6983 enabled by @option{-Wall}.
6984
6985 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6986 @opindex Wextra-semi
6987 @opindex Wno-extra-semi
6988 Warn about redundant semicolon after in-class function definition.
6989
6990 @item -Wjump-misses-init @r{(C, Objective-C only)}
6991 @opindex Wjump-misses-init
6992 @opindex Wno-jump-misses-init
6993 Warn if a @code{goto} statement or a @code{switch} statement jumps
6994 forward across the initialization of a variable, or jumps backward to a
6995 label after the variable has been initialized. This only warns about
6996 variables that are initialized when they are declared. This warning is
6997 only supported for C and Objective-C; in C++ this sort of branch is an
6998 error in any case.
6999
7000 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7001 can be disabled with the @option{-Wno-jump-misses-init} option.
7002
7003 @item -Wsign-compare
7004 @opindex Wsign-compare
7005 @opindex Wno-sign-compare
7006 @cindex warning for comparison of signed and unsigned values
7007 @cindex comparison of signed and unsigned values, warning
7008 @cindex signed and unsigned values, comparison warning
7009 Warn when a comparison between signed and unsigned values could produce
7010 an incorrect result when the signed value is converted to unsigned.
7011 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7012 also enabled by @option{-Wextra}.
7013
7014 @item -Wsign-conversion
7015 @opindex Wsign-conversion
7016 @opindex Wno-sign-conversion
7017 Warn for implicit conversions that may change the sign of an integer
7018 value, like assigning a signed integer expression to an unsigned
7019 integer variable. An explicit cast silences the warning. In C, this
7020 option is enabled also by @option{-Wconversion}.
7021
7022 @item -Wfloat-conversion
7023 @opindex Wfloat-conversion
7024 @opindex Wno-float-conversion
7025 Warn for implicit conversions that reduce the precision of a real value.
7026 This includes conversions from real to integer, and from higher precision
7027 real to lower precision real values. This option is also enabled by
7028 @option{-Wconversion}.
7029
7030 @item -Wno-scalar-storage-order
7031 @opindex Wno-scalar-storage-order
7032 @opindex Wscalar-storage-order
7033 Do not warn on suspicious constructs involving reverse scalar storage order.
7034
7035 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7036 @opindex Wsized-deallocation
7037 @opindex Wno-sized-deallocation
7038 Warn about a definition of an unsized deallocation function
7039 @smallexample
7040 void operator delete (void *) noexcept;
7041 void operator delete[] (void *) noexcept;
7042 @end smallexample
7043 without a definition of the corresponding sized deallocation function
7044 @smallexample
7045 void operator delete (void *, std::size_t) noexcept;
7046 void operator delete[] (void *, std::size_t) noexcept;
7047 @end smallexample
7048 or vice versa. Enabled by @option{-Wextra} along with
7049 @option{-fsized-deallocation}.
7050
7051 @item -Wsizeof-pointer-div
7052 @opindex Wsizeof-pointer-div
7053 @opindex Wno-sizeof-pointer-div
7054 Warn for suspicious divisions of two sizeof expressions that divide
7055 the pointer size by the element size, which is the usual way to compute
7056 the array size but won't work out correctly with pointers. This warning
7057 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7058 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7059
7060 @item -Wsizeof-pointer-memaccess
7061 @opindex Wsizeof-pointer-memaccess
7062 @opindex Wno-sizeof-pointer-memaccess
7063 Warn for suspicious length parameters to certain string and memory built-in
7064 functions if the argument uses @code{sizeof}. This warning triggers for
7065 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7066 an array, but a pointer, and suggests a possible fix, or about
7067 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7068 also warns about calls to bounded string copy functions like @code{strncat}
7069 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7070 the source array. For example, in the following function the call to
7071 @code{strncat} specifies the size of the source string as the bound. That
7072 is almost certainly a mistake and so the call is diagnosed.
7073 @smallexample
7074 void make_file (const char *name)
7075 @{
7076 char path[PATH_MAX];
7077 strncpy (path, name, sizeof path - 1);
7078 strncat (path, ".text", sizeof ".text");
7079 @dots{}
7080 @}
7081 @end smallexample
7082
7083 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7084
7085 @item -Wsizeof-array-argument
7086 @opindex Wsizeof-array-argument
7087 @opindex Wno-sizeof-array-argument
7088 Warn when the @code{sizeof} operator is applied to a parameter that is
7089 declared as an array in a function definition. This warning is enabled by
7090 default for C and C++ programs.
7091
7092 @item -Wmemset-elt-size
7093 @opindex Wmemset-elt-size
7094 @opindex Wno-memset-elt-size
7095 Warn for suspicious calls to the @code{memset} built-in function, if the
7096 first argument references an array, and the third argument is a number
7097 equal to the number of elements, but not equal to the size of the array
7098 in memory. This indicates that the user has omitted a multiplication by
7099 the element size. This warning is enabled by @option{-Wall}.
7100
7101 @item -Wmemset-transposed-args
7102 @opindex Wmemset-transposed-args
7103 @opindex Wno-memset-transposed-args
7104 Warn for suspicious calls to the @code{memset} built-in function where
7105 the second argument is not zero and the third argument is zero. For
7106 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7107 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7108 is only emitted if the third argument is a literal zero. Otherwise, if
7109 it is an expression that is folded to zero, or a cast of zero to some
7110 type, it is far less likely that the arguments have been mistakenly
7111 transposed and no warning is emitted. This warning is enabled
7112 by @option{-Wall}.
7113
7114 @item -Waddress
7115 @opindex Waddress
7116 @opindex Wno-address
7117 Warn about suspicious uses of memory addresses. These include using
7118 the address of a function in a conditional expression, such as
7119 @code{void func(void); if (func)}, and comparisons against the memory
7120 address of a string literal, such as @code{if (x == "abc")}. Such
7121 uses typically indicate a programmer error: the address of a function
7122 always evaluates to true, so their use in a conditional usually
7123 indicate that the programmer forgot the parentheses in a function
7124 call; and comparisons against string literals result in unspecified
7125 behavior and are not portable in C, so they usually indicate that the
7126 programmer intended to use @code{strcmp}. This warning is enabled by
7127 @option{-Wall}.
7128
7129 @item -Waddress-of-packed-member
7130 @opindex Waddress-of-packed-member
7131 @opindex Wno-address-of-packed-member
7132 Warn when the address of packed member of struct or union is taken,
7133 which usually results in an unaligned pointer value. This is
7134 enabled by default.
7135
7136 @item -Wlogical-op
7137 @opindex Wlogical-op
7138 @opindex Wno-logical-op
7139 Warn about suspicious uses of logical operators in expressions.
7140 This includes using logical operators in contexts where a
7141 bit-wise operator is likely to be expected. Also warns when
7142 the operands of a logical operator are the same:
7143 @smallexample
7144 extern int a;
7145 if (a < 0 && a < 0) @{ @dots{} @}
7146 @end smallexample
7147
7148 @item -Wlogical-not-parentheses
7149 @opindex Wlogical-not-parentheses
7150 @opindex Wno-logical-not-parentheses
7151 Warn about logical not used on the left hand side operand of a comparison.
7152 This option does not warn if the right operand is considered to be a boolean
7153 expression. Its purpose is to detect suspicious code like the following:
7154 @smallexample
7155 int a;
7156 @dots{}
7157 if (!a > 1) @{ @dots{} @}
7158 @end smallexample
7159
7160 It is possible to suppress the warning by wrapping the LHS into
7161 parentheses:
7162 @smallexample
7163 if ((!a) > 1) @{ @dots{} @}
7164 @end smallexample
7165
7166 This warning is enabled by @option{-Wall}.
7167
7168 @item -Waggregate-return
7169 @opindex Waggregate-return
7170 @opindex Wno-aggregate-return
7171 Warn if any functions that return structures or unions are defined or
7172 called. (In languages where you can return an array, this also elicits
7173 a warning.)
7174
7175 @item -Wno-aggressive-loop-optimizations
7176 @opindex Wno-aggressive-loop-optimizations
7177 @opindex Waggressive-loop-optimizations
7178 Warn if in a loop with constant number of iterations the compiler detects
7179 undefined behavior in some statement during one or more of the iterations.
7180
7181 @item -Wno-attributes
7182 @opindex Wno-attributes
7183 @opindex Wattributes
7184 Do not warn if an unexpected @code{__attribute__} is used, such as
7185 unrecognized attributes, function attributes applied to variables,
7186 etc. This does not stop errors for incorrect use of supported
7187 attributes.
7188
7189 @item -Wno-builtin-declaration-mismatch
7190 @opindex Wno-builtin-declaration-mismatch
7191 @opindex Wbuiltin-declaration-mismatch
7192 Warn if a built-in function is declared with an incompatible signature
7193 or as a non-function, or when a built-in function declared with a type
7194 that does not include a prototype is called with arguments whose promoted
7195 types do not match those expected by the function. When @option{-Wextra}
7196 is specified, also warn when a built-in function that takes arguments is
7197 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7198 warning is enabled by default. To avoid the warning include the appropriate
7199 header to bring the prototypes of built-in functions into scope.
7200
7201 For example, the call to @code{memset} below is diagnosed by the warning
7202 because the function expects a value of type @code{size_t} as its argument
7203 but the type of @code{32} is @code{int}. With @option{-Wextra},
7204 the declaration of the function is diagnosed as well.
7205 @smallexample
7206 extern void* memset ();
7207 void f (void *d)
7208 @{
7209 memset (d, '\0', 32);
7210 @}
7211 @end smallexample
7212
7213 @item -Wno-builtin-macro-redefined
7214 @opindex Wno-builtin-macro-redefined
7215 @opindex Wbuiltin-macro-redefined
7216 Do not warn if certain built-in macros are redefined. This suppresses
7217 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7218 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7219
7220 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7221 @opindex Wstrict-prototypes
7222 @opindex Wno-strict-prototypes
7223 Warn if a function is declared or defined without specifying the
7224 argument types. (An old-style function definition is permitted without
7225 a warning if preceded by a declaration that specifies the argument
7226 types.)
7227
7228 @item -Wold-style-declaration @r{(C and Objective-C only)}
7229 @opindex Wold-style-declaration
7230 @opindex Wno-old-style-declaration
7231 Warn for obsolescent usages, according to the C Standard, in a
7232 declaration. For example, warn if storage-class specifiers like
7233 @code{static} are not the first things in a declaration. This warning
7234 is also enabled by @option{-Wextra}.
7235
7236 @item -Wold-style-definition @r{(C and Objective-C only)}
7237 @opindex Wold-style-definition
7238 @opindex Wno-old-style-definition
7239 Warn if an old-style function definition is used. A warning is given
7240 even if there is a previous prototype.
7241
7242 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7243 @opindex Wmissing-parameter-type
7244 @opindex Wno-missing-parameter-type
7245 A function parameter is declared without a type specifier in K&R-style
7246 functions:
7247
7248 @smallexample
7249 void foo(bar) @{ @}
7250 @end smallexample
7251
7252 This warning is also enabled by @option{-Wextra}.
7253
7254 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7255 @opindex Wmissing-prototypes
7256 @opindex Wno-missing-prototypes
7257 Warn if a global function is defined without a previous prototype
7258 declaration. This warning is issued even if the definition itself
7259 provides a prototype. Use this option to detect global functions
7260 that do not have a matching prototype declaration in a header file.
7261 This option is not valid for C++ because all function declarations
7262 provide prototypes and a non-matching declaration declares an
7263 overload rather than conflict with an earlier declaration.
7264 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7265
7266 @item -Wmissing-declarations
7267 @opindex Wmissing-declarations
7268 @opindex Wno-missing-declarations
7269 Warn if a global function is defined without a previous declaration.
7270 Do so even if the definition itself provides a prototype.
7271 Use this option to detect global functions that are not declared in
7272 header files. In C, no warnings are issued for functions with previous
7273 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7274 missing prototypes. In C++, no warnings are issued for function templates,
7275 or for inline functions, or for functions in anonymous namespaces.
7276
7277 @item -Wmissing-field-initializers
7278 @opindex Wmissing-field-initializers
7279 @opindex Wno-missing-field-initializers
7280 @opindex W
7281 @opindex Wextra
7282 @opindex Wno-extra
7283 Warn if a structure's initializer has some fields missing. For
7284 example, the following code causes such a warning, because
7285 @code{x.h} is implicitly zero:
7286
7287 @smallexample
7288 struct s @{ int f, g, h; @};
7289 struct s x = @{ 3, 4 @};
7290 @end smallexample
7291
7292 This option does not warn about designated initializers, so the following
7293 modification does not trigger a warning:
7294
7295 @smallexample
7296 struct s @{ int f, g, h; @};
7297 struct s x = @{ .f = 3, .g = 4 @};
7298 @end smallexample
7299
7300 In C this option does not warn about the universal zero initializer
7301 @samp{@{ 0 @}}:
7302
7303 @smallexample
7304 struct s @{ int f, g, h; @};
7305 struct s x = @{ 0 @};
7306 @end smallexample
7307
7308 Likewise, in C++ this option does not warn about the empty @{ @}
7309 initializer, for example:
7310
7311 @smallexample
7312 struct s @{ int f, g, h; @};
7313 s x = @{ @};
7314 @end smallexample
7315
7316 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7317 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7318
7319 @item -Wno-multichar
7320 @opindex Wno-multichar
7321 @opindex Wmultichar
7322 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7323 Usually they indicate a typo in the user's code, as they have
7324 implementation-defined values, and should not be used in portable code.
7325
7326 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7327 @opindex Wnormalized=
7328 @opindex Wnormalized
7329 @opindex Wno-normalized
7330 @cindex NFC
7331 @cindex NFKC
7332 @cindex character set, input normalization
7333 In ISO C and ISO C++, two identifiers are different if they are
7334 different sequences of characters. However, sometimes when characters
7335 outside the basic ASCII character set are used, you can have two
7336 different character sequences that look the same. To avoid confusion,
7337 the ISO 10646 standard sets out some @dfn{normalization rules} which
7338 when applied ensure that two sequences that look the same are turned into
7339 the same sequence. GCC can warn you if you are using identifiers that
7340 have not been normalized; this option controls that warning.
7341
7342 There are four levels of warning supported by GCC@. The default is
7343 @option{-Wnormalized=nfc}, which warns about any identifier that is
7344 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7345 recommended form for most uses. It is equivalent to
7346 @option{-Wnormalized}.
7347
7348 Unfortunately, there are some characters allowed in identifiers by
7349 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7350 identifiers. That is, there's no way to use these symbols in portable
7351 ISO C or C++ and have all your identifiers in NFC@.
7352 @option{-Wnormalized=id} suppresses the warning for these characters.
7353 It is hoped that future versions of the standards involved will correct
7354 this, which is why this option is not the default.
7355
7356 You can switch the warning off for all characters by writing
7357 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7358 only do this if you are using some other normalization scheme (like
7359 ``D''), because otherwise you can easily create bugs that are
7360 literally impossible to see.
7361
7362 Some characters in ISO 10646 have distinct meanings but look identical
7363 in some fonts or display methodologies, especially once formatting has
7364 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7365 LETTER N'', displays just like a regular @code{n} that has been
7366 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7367 normalization scheme to convert all these into a standard form as
7368 well, and GCC warns if your code is not in NFKC if you use
7369 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7370 about every identifier that contains the letter O because it might be
7371 confused with the digit 0, and so is not the default, but may be
7372 useful as a local coding convention if the programming environment
7373 cannot be fixed to display these characters distinctly.
7374
7375 @item -Wno-attribute-warning
7376 @opindex Wno-attribute-warning
7377 @opindex Wattribute-warning
7378 Do not warn about usage of functions (@pxref{Function Attributes})
7379 declared with @code{warning} attribute. By default, this warning is
7380 enabled. @option{-Wno-attribute-warning} can be used to disable the
7381 warning or @option{-Wno-error=attribute-warning} can be used to
7382 disable the error when compiled with @option{-Werror} flag.
7383
7384 @item -Wno-deprecated
7385 @opindex Wno-deprecated
7386 @opindex Wdeprecated
7387 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7388
7389 @item -Wno-deprecated-declarations
7390 @opindex Wno-deprecated-declarations
7391 @opindex Wdeprecated-declarations
7392 Do not warn about uses of functions (@pxref{Function Attributes}),
7393 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7394 Attributes}) marked as deprecated by using the @code{deprecated}
7395 attribute.
7396
7397 @item -Wno-overflow
7398 @opindex Wno-overflow
7399 @opindex Woverflow
7400 Do not warn about compile-time overflow in constant expressions.
7401
7402 @item -Wno-odr
7403 @opindex Wno-odr
7404 @opindex Wodr
7405 Warn about One Definition Rule violations during link-time optimization.
7406 Enabled by default.
7407
7408 @item -Wopenmp-simd
7409 @opindex Wopenmp-simd
7410 @opindex Wno-openmp-simd
7411 Warn if the vectorizer cost model overrides the OpenMP
7412 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7413 option can be used to relax the cost model.
7414
7415 @item -Woverride-init @r{(C and Objective-C only)}
7416 @opindex Woverride-init
7417 @opindex Wno-override-init
7418 @opindex W
7419 @opindex Wextra
7420 @opindex Wno-extra
7421 Warn if an initialized field without side effects is overridden when
7422 using designated initializers (@pxref{Designated Inits, , Designated
7423 Initializers}).
7424
7425 This warning is included in @option{-Wextra}. To get other
7426 @option{-Wextra} warnings without this one, use @option{-Wextra
7427 -Wno-override-init}.
7428
7429 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7430 @opindex Woverride-init-side-effects
7431 @opindex Wno-override-init-side-effects
7432 Warn if an initialized field with side effects is overridden when
7433 using designated initializers (@pxref{Designated Inits, , Designated
7434 Initializers}). This warning is enabled by default.
7435
7436 @item -Wpacked
7437 @opindex Wpacked
7438 @opindex Wno-packed
7439 Warn if a structure is given the packed attribute, but the packed
7440 attribute has no effect on the layout or size of the structure.
7441 Such structures may be mis-aligned for little benefit. For
7442 instance, in this code, the variable @code{f.x} in @code{struct bar}
7443 is misaligned even though @code{struct bar} does not itself
7444 have the packed attribute:
7445
7446 @smallexample
7447 @group
7448 struct foo @{
7449 int x;
7450 char a, b, c, d;
7451 @} __attribute__((packed));
7452 struct bar @{
7453 char z;
7454 struct foo f;
7455 @};
7456 @end group
7457 @end smallexample
7458
7459 @item -Wpacked-bitfield-compat
7460 @opindex Wpacked-bitfield-compat
7461 @opindex Wno-packed-bitfield-compat
7462 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7463 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7464 the change can lead to differences in the structure layout. GCC
7465 informs you when the offset of such a field has changed in GCC 4.4.
7466 For example there is no longer a 4-bit padding between field @code{a}
7467 and @code{b} in this structure:
7468
7469 @smallexample
7470 struct foo
7471 @{
7472 char a:4;
7473 char b:8;
7474 @} __attribute__ ((packed));
7475 @end smallexample
7476
7477 This warning is enabled by default. Use
7478 @option{-Wno-packed-bitfield-compat} to disable this warning.
7479
7480 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7481 @opindex Wpacked-not-aligned
7482 @opindex Wno-packed-not-aligned
7483 Warn if a structure field with explicitly specified alignment in a
7484 packed struct or union is misaligned. For example, a warning will
7485 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7486 'struct S' is less than 8}, in this code:
7487
7488 @smallexample
7489 @group
7490 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7491 struct __attribute__ ((packed)) S @{
7492 struct S8 s8;
7493 @};
7494 @end group
7495 @end smallexample
7496
7497 This warning is enabled by @option{-Wall}.
7498
7499 @item -Wpadded
7500 @opindex Wpadded
7501 @opindex Wno-padded
7502 Warn if padding is included in a structure, either to align an element
7503 of the structure or to align the whole structure. Sometimes when this
7504 happens it is possible to rearrange the fields of the structure to
7505 reduce the padding and so make the structure smaller.
7506
7507 @item -Wredundant-decls
7508 @opindex Wredundant-decls
7509 @opindex Wno-redundant-decls
7510 Warn if anything is declared more than once in the same scope, even in
7511 cases where multiple declaration is valid and changes nothing.
7512
7513 @item -Wno-restrict
7514 @opindex Wrestrict
7515 @opindex Wno-restrict
7516 Warn when an object referenced by a @code{restrict}-qualified parameter
7517 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7518 argument, or when copies between such objects overlap. For example,
7519 the call to the @code{strcpy} function below attempts to truncate the string
7520 by replacing its initial characters with the last four. However, because
7521 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7522 the call is diagnosed.
7523
7524 @smallexample
7525 void foo (void)
7526 @{
7527 char a[] = "abcd1234";
7528 strcpy (a, a + 4);
7529 @dots{}
7530 @}
7531 @end smallexample
7532 The @option{-Wrestrict} option detects some instances of simple overlap
7533 even without optimization but works best at @option{-O2} and above. It
7534 is included in @option{-Wall}.
7535
7536 @item -Wnested-externs @r{(C and Objective-C only)}
7537 @opindex Wnested-externs
7538 @opindex Wno-nested-externs
7539 Warn if an @code{extern} declaration is encountered within a function.
7540
7541 @item -Wno-inherited-variadic-ctor
7542 @opindex Winherited-variadic-ctor
7543 @opindex Wno-inherited-variadic-ctor
7544 Suppress warnings about use of C++11 inheriting constructors when the
7545 base class inherited from has a C variadic constructor; the warning is
7546 on by default because the ellipsis is not inherited.
7547
7548 @item -Winline
7549 @opindex Winline
7550 @opindex Wno-inline
7551 Warn if a function that is declared as inline cannot be inlined.
7552 Even with this option, the compiler does not warn about failures to
7553 inline functions declared in system headers.
7554
7555 The compiler uses a variety of heuristics to determine whether or not
7556 to inline a function. For example, the compiler takes into account
7557 the size of the function being inlined and the amount of inlining
7558 that has already been done in the current function. Therefore,
7559 seemingly insignificant changes in the source program can cause the
7560 warnings produced by @option{-Winline} to appear or disappear.
7561
7562 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7563 @opindex Wno-invalid-offsetof
7564 @opindex Winvalid-offsetof
7565 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7566 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7567 to a non-standard-layout type is undefined. In existing C++ implementations,
7568 however, @code{offsetof} typically gives meaningful results.
7569 This flag is for users who are aware that they are
7570 writing nonportable code and who have deliberately chosen to ignore the
7571 warning about it.
7572
7573 The restrictions on @code{offsetof} may be relaxed in a future version
7574 of the C++ standard.
7575
7576 @item -Wint-in-bool-context
7577 @opindex Wint-in-bool-context
7578 @opindex Wno-int-in-bool-context
7579 Warn for suspicious use of integer values where boolean values are expected,
7580 such as conditional expressions (?:) using non-boolean integer constants in
7581 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7582 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7583 for all kinds of multiplications regardless of the data type.
7584 This warning is enabled by @option{-Wall}.
7585
7586 @item -Wno-int-to-pointer-cast
7587 @opindex Wno-int-to-pointer-cast
7588 @opindex Wint-to-pointer-cast
7589 Suppress warnings from casts to pointer type of an integer of a
7590 different size. In C++, casting to a pointer type of smaller size is
7591 an error. @option{Wint-to-pointer-cast} is enabled by default.
7592
7593
7594 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7595 @opindex Wno-pointer-to-int-cast
7596 @opindex Wpointer-to-int-cast
7597 Suppress warnings from casts from a pointer to an integer type of a
7598 different size.
7599
7600 @item -Winvalid-pch
7601 @opindex Winvalid-pch
7602 @opindex Wno-invalid-pch
7603 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7604 the search path but cannot be used.
7605
7606 @item -Wlong-long
7607 @opindex Wlong-long
7608 @opindex Wno-long-long
7609 Warn if @code{long long} type is used. This is enabled by either
7610 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7611 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7612
7613 @item -Wvariadic-macros
7614 @opindex Wvariadic-macros
7615 @opindex Wno-variadic-macros
7616 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7617 alternate syntax is used in ISO C99 mode. This is enabled by either
7618 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7619 messages, use @option{-Wno-variadic-macros}.
7620
7621 @item -Wvarargs
7622 @opindex Wvarargs
7623 @opindex Wno-varargs
7624 Warn upon questionable usage of the macros used to handle variable
7625 arguments like @code{va_start}. This is default. To inhibit the
7626 warning messages, use @option{-Wno-varargs}.
7627
7628 @item -Wvector-operation-performance
7629 @opindex Wvector-operation-performance
7630 @opindex Wno-vector-operation-performance
7631 Warn if vector operation is not implemented via SIMD capabilities of the
7632 architecture. Mainly useful for the performance tuning.
7633 Vector operation can be implemented @code{piecewise}, which means that the
7634 scalar operation is performed on every vector element;
7635 @code{in parallel}, which means that the vector operation is implemented
7636 using scalars of wider type, which normally is more performance efficient;
7637 and @code{as a single scalar}, which means that vector fits into a
7638 scalar type.
7639
7640 @item -Wno-virtual-move-assign
7641 @opindex Wvirtual-move-assign
7642 @opindex Wno-virtual-move-assign
7643 Suppress warnings about inheriting from a virtual base with a
7644 non-trivial C++11 move assignment operator. This is dangerous because
7645 if the virtual base is reachable along more than one path, it is
7646 moved multiple times, which can mean both objects end up in the
7647 moved-from state. If the move assignment operator is written to avoid
7648 moving from a moved-from object, this warning can be disabled.
7649
7650 @item -Wvla
7651 @opindex Wvla
7652 @opindex Wno-vla
7653 Warn if a variable-length array is used in the code.
7654 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7655 the variable-length array.
7656
7657 @item -Wvla-larger-than=@var{byte-size}
7658 @opindex Wvla-larger-than=
7659 @opindex Wno-vla-larger-than
7660 If this option is used, the compiler will warn for declarations of
7661 variable-length arrays whose size is either unbounded, or bounded
7662 by an argument that allows the array size to exceed @var{byte-size}
7663 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7664 works, but with variable-length arrays.
7665
7666 Note that GCC may optimize small variable-length arrays of a known
7667 value into plain arrays, so this warning may not get triggered for
7668 such arrays.
7669
7670 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7671 is typically only effective when @option{-ftree-vrp} is active (default
7672 for @option{-O2} and above).
7673
7674 See also @option{-Walloca-larger-than=@var{byte-size}}.
7675
7676 @item -Wno-vla-larger-than
7677 @opindex Wno-vla-larger-than
7678 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7679 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7680
7681 @item -Wvolatile-register-var
7682 @opindex Wvolatile-register-var
7683 @opindex Wno-volatile-register-var
7684 Warn if a register variable is declared volatile. The volatile
7685 modifier does not inhibit all optimizations that may eliminate reads
7686 and/or writes to register variables. This warning is enabled by
7687 @option{-Wall}.
7688
7689 @item -Wdisabled-optimization
7690 @opindex Wdisabled-optimization
7691 @opindex Wno-disabled-optimization
7692 Warn if a requested optimization pass is disabled. This warning does
7693 not generally indicate that there is anything wrong with your code; it
7694 merely indicates that GCC's optimizers are unable to handle the code
7695 effectively. Often, the problem is that your code is too big or too
7696 complex; GCC refuses to optimize programs when the optimization
7697 itself is likely to take inordinate amounts of time.
7698
7699 @item -Wpointer-sign @r{(C and Objective-C only)}
7700 @opindex Wpointer-sign
7701 @opindex Wno-pointer-sign
7702 Warn for pointer argument passing or assignment with different signedness.
7703 This option is only supported for C and Objective-C@. It is implied by
7704 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7705 @option{-Wno-pointer-sign}.
7706
7707 @item -Wstack-protector
7708 @opindex Wstack-protector
7709 @opindex Wno-stack-protector
7710 This option is only active when @option{-fstack-protector} is active. It
7711 warns about functions that are not protected against stack smashing.
7712
7713 @item -Woverlength-strings
7714 @opindex Woverlength-strings
7715 @opindex Wno-overlength-strings
7716 Warn about string constants that are longer than the ``minimum
7717 maximum'' length specified in the C standard. Modern compilers
7718 generally allow string constants that are much longer than the
7719 standard's minimum limit, but very portable programs should avoid
7720 using longer strings.
7721
7722 The limit applies @emph{after} string constant concatenation, and does
7723 not count the trailing NUL@. In C90, the limit was 509 characters; in
7724 C99, it was raised to 4095. C++98 does not specify a normative
7725 minimum maximum, so we do not diagnose overlength strings in C++@.
7726
7727 This option is implied by @option{-Wpedantic}, and can be disabled with
7728 @option{-Wno-overlength-strings}.
7729
7730 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7731 @opindex Wunsuffixed-float-constants
7732 @opindex Wno-unsuffixed-float-constants
7733
7734 Issue a warning for any floating constant that does not have
7735 a suffix. When used together with @option{-Wsystem-headers} it
7736 warns about such constants in system header files. This can be useful
7737 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7738 from the decimal floating-point extension to C99.
7739
7740 @item -Wno-designated-init @r{(C and Objective-C only)}
7741 Suppress warnings when a positional initializer is used to initialize
7742 a structure that has been marked with the @code{designated_init}
7743 attribute.
7744
7745 @item -Whsa
7746 Issue a warning when HSAIL cannot be emitted for the compiled function or
7747 OpenMP construct.
7748
7749 @end table
7750
7751 @node Debugging Options
7752 @section Options for Debugging Your Program
7753 @cindex options, debugging
7754 @cindex debugging information options
7755
7756 To tell GCC to emit extra information for use by a debugger, in almost
7757 all cases you need only to add @option{-g} to your other options.
7758
7759 GCC allows you to use @option{-g} with
7760 @option{-O}. The shortcuts taken by optimized code may occasionally
7761 be surprising: some variables you declared may not exist
7762 at all; flow of control may briefly move where you did not expect it;
7763 some statements may not be executed because they compute constant
7764 results or their values are already at hand; some statements may
7765 execute in different places because they have been moved out of loops.
7766 Nevertheless it is possible to debug optimized output. This makes
7767 it reasonable to use the optimizer for programs that might have bugs.
7768
7769 If you are not using some other optimization option, consider
7770 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7771 With no @option{-O} option at all, some compiler passes that collect
7772 information useful for debugging do not run at all, so that
7773 @option{-Og} may result in a better debugging experience.
7774
7775 @table @gcctabopt
7776 @item -g
7777 @opindex g
7778 Produce debugging information in the operating system's native format
7779 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7780 information.
7781
7782 On most systems that use stabs format, @option{-g} enables use of extra
7783 debugging information that only GDB can use; this extra information
7784 makes debugging work better in GDB but probably makes other debuggers
7785 crash or
7786 refuse to read the program. If you want to control for certain whether
7787 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7788 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7789
7790 @item -ggdb
7791 @opindex ggdb
7792 Produce debugging information for use by GDB@. This means to use the
7793 most expressive format available (DWARF, stabs, or the native format
7794 if neither of those are supported), including GDB extensions if at all
7795 possible.
7796
7797 @item -gdwarf
7798 @itemx -gdwarf-@var{version}
7799 @opindex gdwarf
7800 Produce debugging information in DWARF format (if that is supported).
7801 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7802 for most targets is 4. DWARF Version 5 is only experimental.
7803
7804 Note that with DWARF Version 2, some ports require and always
7805 use some non-conflicting DWARF 3 extensions in the unwind tables.
7806
7807 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7808 for maximum benefit.
7809
7810 GCC no longer supports DWARF Version 1, which is substantially
7811 different than Version 2 and later. For historical reasons, some
7812 other DWARF-related options such as
7813 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7814 in their names, but apply to all currently-supported versions of DWARF.
7815
7816 @item -gstabs
7817 @opindex gstabs
7818 Produce debugging information in stabs format (if that is supported),
7819 without GDB extensions. This is the format used by DBX on most BSD
7820 systems. On MIPS, Alpha and System V Release 4 systems this option
7821 produces stabs debugging output that is not understood by DBX@.
7822 On System V Release 4 systems this option requires the GNU assembler.
7823
7824 @item -gstabs+
7825 @opindex gstabs+
7826 Produce debugging information in stabs format (if that is supported),
7827 using GNU extensions understood only by the GNU debugger (GDB)@. The
7828 use of these extensions is likely to make other debuggers crash or
7829 refuse to read the program.
7830
7831 @item -gxcoff
7832 @opindex gxcoff
7833 Produce debugging information in XCOFF format (if that is supported).
7834 This is the format used by the DBX debugger on IBM RS/6000 systems.
7835
7836 @item -gxcoff+
7837 @opindex gxcoff+
7838 Produce debugging information in XCOFF format (if that is supported),
7839 using GNU extensions understood only by the GNU debugger (GDB)@. The
7840 use of these extensions is likely to make other debuggers crash or
7841 refuse to read the program, and may cause assemblers other than the GNU
7842 assembler (GAS) to fail with an error.
7843
7844 @item -gvms
7845 @opindex gvms
7846 Produce debugging information in Alpha/VMS debug format (if that is
7847 supported). This is the format used by DEBUG on Alpha/VMS systems.
7848
7849 @item -g@var{level}
7850 @itemx -ggdb@var{level}
7851 @itemx -gstabs@var{level}
7852 @itemx -gxcoff@var{level}
7853 @itemx -gvms@var{level}
7854 Request debugging information and also use @var{level} to specify how
7855 much information. The default level is 2.
7856
7857 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7858 @option{-g}.
7859
7860 Level 1 produces minimal information, enough for making backtraces in
7861 parts of the program that you don't plan to debug. This includes
7862 descriptions of functions and external variables, and line number
7863 tables, but no information about local variables.
7864
7865 Level 3 includes extra information, such as all the macro definitions
7866 present in the program. Some debuggers support macro expansion when
7867 you use @option{-g3}.
7868
7869 If you use multiple @option{-g} options, with or without level numbers,
7870 the last such option is the one that is effective.
7871
7872 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7873 confusion with @option{-gdwarf-@var{level}}.
7874 Instead use an additional @option{-g@var{level}} option to change the
7875 debug level for DWARF.
7876
7877 @item -fno-eliminate-unused-debug-symbols
7878 @opindex feliminate-unused-debug-symbols
7879 @opindex fno-eliminate-unused-debug-symbols
7880 By default, no debug information is produced for symbols that are not actually
7881 used. Use this option if you want debug information for all symbols.
7882
7883 @item -femit-class-debug-always
7884 @opindex femit-class-debug-always
7885 Instead of emitting debugging information for a C++ class in only one
7886 object file, emit it in all object files using the class. This option
7887 should be used only with debuggers that are unable to handle the way GCC
7888 normally emits debugging information for classes because using this
7889 option increases the size of debugging information by as much as a
7890 factor of two.
7891
7892 @item -fno-merge-debug-strings
7893 @opindex fmerge-debug-strings
7894 @opindex fno-merge-debug-strings
7895 Direct the linker to not merge together strings in the debugging
7896 information that are identical in different object files. Merging is
7897 not supported by all assemblers or linkers. Merging decreases the size
7898 of the debug information in the output file at the cost of increasing
7899 link processing time. Merging is enabled by default.
7900
7901 @item -fdebug-prefix-map=@var{old}=@var{new}
7902 @opindex fdebug-prefix-map
7903 When compiling files residing in directory @file{@var{old}}, record
7904 debugging information describing them as if the files resided in
7905 directory @file{@var{new}} instead. This can be used to replace a
7906 build-time path with an install-time path in the debug info. It can
7907 also be used to change an absolute path to a relative path by using
7908 @file{.} for @var{new}. This can give more reproducible builds, which
7909 are location independent, but may require an extra command to tell GDB
7910 where to find the source files. See also @option{-ffile-prefix-map}.
7911
7912 @item -fvar-tracking
7913 @opindex fvar-tracking
7914 Run variable tracking pass. It computes where variables are stored at each
7915 position in code. Better debugging information is then generated
7916 (if the debugging information format supports this information).
7917
7918 It is enabled by default when compiling with optimization (@option{-Os},
7919 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7920 the debug info format supports it.
7921
7922 @item -fvar-tracking-assignments
7923 @opindex fvar-tracking-assignments
7924 @opindex fno-var-tracking-assignments
7925 Annotate assignments to user variables early in the compilation and
7926 attempt to carry the annotations over throughout the compilation all the
7927 way to the end, in an attempt to improve debug information while
7928 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7929
7930 It can be enabled even if var-tracking is disabled, in which case
7931 annotations are created and maintained, but discarded at the end.
7932 By default, this flag is enabled together with @option{-fvar-tracking},
7933 except when selective scheduling is enabled.
7934
7935 @item -gsplit-dwarf
7936 @opindex gsplit-dwarf
7937 Separate as much DWARF debugging information as possible into a
7938 separate output file with the extension @file{.dwo}. This option allows
7939 the build system to avoid linking files with debug information. To
7940 be useful, this option requires a debugger capable of reading @file{.dwo}
7941 files.
7942
7943 @item -gdescribe-dies
7944 @opindex gdescribe-dies
7945 Add description attributes to some DWARF DIEs that have no name attribute,
7946 such as artificial variables, external references and call site
7947 parameter DIEs.
7948
7949 @item -gpubnames
7950 @opindex gpubnames
7951 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7952
7953 @item -ggnu-pubnames
7954 @opindex ggnu-pubnames
7955 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7956 suitable for conversion into a GDB@ index. This option is only useful
7957 with a linker that can produce GDB@ index version 7.
7958
7959 @item -fdebug-types-section
7960 @opindex fdebug-types-section
7961 @opindex fno-debug-types-section
7962 When using DWARF Version 4 or higher, type DIEs can be put into
7963 their own @code{.debug_types} section instead of making them part of the
7964 @code{.debug_info} section. It is more efficient to put them in a separate
7965 comdat section since the linker can then remove duplicates.
7966 But not all DWARF consumers support @code{.debug_types} sections yet
7967 and on some objects @code{.debug_types} produces larger instead of smaller
7968 debugging information.
7969
7970 @item -grecord-gcc-switches
7971 @itemx -gno-record-gcc-switches
7972 @opindex grecord-gcc-switches
7973 @opindex gno-record-gcc-switches
7974 This switch causes the command-line options used to invoke the
7975 compiler that may affect code generation to be appended to the
7976 DW_AT_producer attribute in DWARF debugging information. The options
7977 are concatenated with spaces separating them from each other and from
7978 the compiler version.
7979 It is enabled by default.
7980 See also @option{-frecord-gcc-switches} for another
7981 way of storing compiler options into the object file.
7982
7983 @item -gstrict-dwarf
7984 @opindex gstrict-dwarf
7985 Disallow using extensions of later DWARF standard version than selected
7986 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7987 DWARF extensions from later standard versions is allowed.
7988
7989 @item -gno-strict-dwarf
7990 @opindex gno-strict-dwarf
7991 Allow using extensions of later DWARF standard version than selected with
7992 @option{-gdwarf-@var{version}}.
7993
7994 @item -gas-loc-support
7995 @opindex gas-loc-support
7996 Inform the compiler that the assembler supports @code{.loc} directives.
7997 It may then use them for the assembler to generate DWARF2+ line number
7998 tables.
7999
8000 This is generally desirable, because assembler-generated line-number
8001 tables are a lot more compact than those the compiler can generate
8002 itself.
8003
8004 This option will be enabled by default if, at GCC configure time, the
8005 assembler was found to support such directives.
8006
8007 @item -gno-as-loc-support
8008 @opindex gno-as-loc-support
8009 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8010 line number tables are to be generated.
8011
8012 @item -gas-locview-support
8013 @opindex gas-locview-support
8014 Inform the compiler that the assembler supports @code{view} assignment
8015 and reset assertion checking in @code{.loc} directives.
8016
8017 This option will be enabled by default if, at GCC configure time, the
8018 assembler was found to support them.
8019
8020 @item -gno-as-locview-support
8021 Force GCC to assign view numbers internally, if
8022 @option{-gvariable-location-views} are explicitly requested.
8023
8024 @item -gcolumn-info
8025 @itemx -gno-column-info
8026 @opindex gcolumn-info
8027 @opindex gno-column-info
8028 Emit location column information into DWARF debugging information, rather
8029 than just file and line.
8030 This option is enabled by default.
8031
8032 @item -gstatement-frontiers
8033 @itemx -gno-statement-frontiers
8034 @opindex gstatement-frontiers
8035 @opindex gno-statement-frontiers
8036 This option causes GCC to create markers in the internal representation
8037 at the beginning of statements, and to keep them roughly in place
8038 throughout compilation, using them to guide the output of @code{is_stmt}
8039 markers in the line number table. This is enabled by default when
8040 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8041 @dots{}), and outputting DWARF 2 debug information at the normal level.
8042
8043 @item -gvariable-location-views
8044 @itemx -gvariable-location-views=incompat5
8045 @itemx -gno-variable-location-views
8046 @opindex gvariable-location-views
8047 @opindex gvariable-location-views=incompat5
8048 @opindex gno-variable-location-views
8049 Augment variable location lists with progressive view numbers implied
8050 from the line number table. This enables debug information consumers to
8051 inspect state at certain points of the program, even if no instructions
8052 associated with the corresponding source locations are present at that
8053 point. If the assembler lacks support for view numbers in line number
8054 tables, this will cause the compiler to emit the line number table,
8055 which generally makes them somewhat less compact. The augmented line
8056 number tables and location lists are fully backward-compatible, so they
8057 can be consumed by debug information consumers that are not aware of
8058 these augmentations, but they won't derive any benefit from them either.
8059
8060 This is enabled by default when outputting DWARF 2 debug information at
8061 the normal level, as long as there is assembler support,
8062 @option{-fvar-tracking-assignments} is enabled and
8063 @option{-gstrict-dwarf} is not. When assembler support is not
8064 available, this may still be enabled, but it will force GCC to output
8065 internal line number tables, and if
8066 @option{-ginternal-reset-location-views} is not enabled, that will most
8067 certainly lead to silently mismatching location views.
8068
8069 There is a proposed representation for view numbers that is not backward
8070 compatible with the location list format introduced in DWARF 5, that can
8071 be enabled with @option{-gvariable-location-views=incompat5}. This
8072 option may be removed in the future, is only provided as a reference
8073 implementation of the proposed representation. Debug information
8074 consumers are not expected to support this extended format, and they
8075 would be rendered unable to decode location lists using it.
8076
8077 @item -ginternal-reset-location-views
8078 @itemx -gnointernal-reset-location-views
8079 @opindex ginternal-reset-location-views
8080 @opindex gno-internal-reset-location-views
8081 Attempt to determine location views that can be omitted from location
8082 view lists. This requires the compiler to have very accurate insn
8083 length estimates, which isn't always the case, and it may cause
8084 incorrect view lists to be generated silently when using an assembler
8085 that does not support location view lists. The GNU assembler will flag
8086 any such error as a @code{view number mismatch}. This is only enabled
8087 on ports that define a reliable estimation function.
8088
8089 @item -ginline-points
8090 @itemx -gno-inline-points
8091 @opindex ginline-points
8092 @opindex gno-inline-points
8093 Generate extended debug information for inlined functions. Location
8094 view tracking markers are inserted at inlined entry points, so that
8095 address and view numbers can be computed and output in debug
8096 information. This can be enabled independently of location views, in
8097 which case the view numbers won't be output, but it can only be enabled
8098 along with statement frontiers, and it is only enabled by default if
8099 location views are enabled.
8100
8101 @item -gz@r{[}=@var{type}@r{]}
8102 @opindex gz
8103 Produce compressed debug sections in DWARF format, if that is supported.
8104 If @var{type} is not given, the default type depends on the capabilities
8105 of the assembler and linker used. @var{type} may be one of
8106 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8107 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8108 compression in traditional GNU format). If the linker doesn't support
8109 writing compressed debug sections, the option is rejected. Otherwise,
8110 if the assembler does not support them, @option{-gz} is silently ignored
8111 when producing object files.
8112
8113 @item -femit-struct-debug-baseonly
8114 @opindex femit-struct-debug-baseonly
8115 Emit debug information for struct-like types
8116 only when the base name of the compilation source file
8117 matches the base name of file in which the struct is defined.
8118
8119 This option substantially reduces the size of debugging information,
8120 but at significant potential loss in type information to the debugger.
8121 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8122 See @option{-femit-struct-debug-detailed} for more detailed control.
8123
8124 This option works only with DWARF debug output.
8125
8126 @item -femit-struct-debug-reduced
8127 @opindex femit-struct-debug-reduced
8128 Emit debug information for struct-like types
8129 only when the base name of the compilation source file
8130 matches the base name of file in which the type is defined,
8131 unless the struct is a template or defined in a system header.
8132
8133 This option significantly reduces the size of debugging information,
8134 with some potential loss in type information to the debugger.
8135 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8136 See @option{-femit-struct-debug-detailed} for more detailed control.
8137
8138 This option works only with DWARF debug output.
8139
8140 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8141 @opindex femit-struct-debug-detailed
8142 Specify the struct-like types
8143 for which the compiler generates debug information.
8144 The intent is to reduce duplicate struct debug information
8145 between different object files within the same program.
8146
8147 This option is a detailed version of
8148 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8149 which serves for most needs.
8150
8151 A specification has the syntax@*
8152 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8153
8154 The optional first word limits the specification to
8155 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8156 A struct type is used directly when it is the type of a variable, member.
8157 Indirect uses arise through pointers to structs.
8158 That is, when use of an incomplete struct is valid, the use is indirect.
8159 An example is
8160 @samp{struct one direct; struct two * indirect;}.
8161
8162 The optional second word limits the specification to
8163 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8164 Generic structs are a bit complicated to explain.
8165 For C++, these are non-explicit specializations of template classes,
8166 or non-template classes within the above.
8167 Other programming languages have generics,
8168 but @option{-femit-struct-debug-detailed} does not yet implement them.
8169
8170 The third word specifies the source files for those
8171 structs for which the compiler should emit debug information.
8172 The values @samp{none} and @samp{any} have the normal meaning.
8173 The value @samp{base} means that
8174 the base of name of the file in which the type declaration appears
8175 must match the base of the name of the main compilation file.
8176 In practice, this means that when compiling @file{foo.c}, debug information
8177 is generated for types declared in that file and @file{foo.h},
8178 but not other header files.
8179 The value @samp{sys} means those types satisfying @samp{base}
8180 or declared in system or compiler headers.
8181
8182 You may need to experiment to determine the best settings for your application.
8183
8184 The default is @option{-femit-struct-debug-detailed=all}.
8185
8186 This option works only with DWARF debug output.
8187
8188 @item -fno-dwarf2-cfi-asm
8189 @opindex fdwarf2-cfi-asm
8190 @opindex fno-dwarf2-cfi-asm
8191 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8192 instead of using GAS @code{.cfi_*} directives.
8193
8194 @item -fno-eliminate-unused-debug-types
8195 @opindex feliminate-unused-debug-types
8196 @opindex fno-eliminate-unused-debug-types
8197 Normally, when producing DWARF output, GCC avoids producing debug symbol
8198 output for types that are nowhere used in the source file being compiled.
8199 Sometimes it is useful to have GCC emit debugging
8200 information for all types declared in a compilation
8201 unit, regardless of whether or not they are actually used
8202 in that compilation unit, for example
8203 if, in the debugger, you want to cast a value to a type that is
8204 not actually used in your program (but is declared). More often,
8205 however, this results in a significant amount of wasted space.
8206 @end table
8207
8208 @node Optimize Options
8209 @section Options That Control Optimization
8210 @cindex optimize options
8211 @cindex options, optimization
8212
8213 These options control various sorts of optimizations.
8214
8215 Without any optimization option, the compiler's goal is to reduce the
8216 cost of compilation and to make debugging produce the expected
8217 results. Statements are independent: if you stop the program with a
8218 breakpoint between statements, you can then assign a new value to any
8219 variable or change the program counter to any other statement in the
8220 function and get exactly the results you expect from the source
8221 code.
8222
8223 Turning on optimization flags makes the compiler attempt to improve
8224 the performance and/or code size at the expense of compilation time
8225 and possibly the ability to debug the program.
8226
8227 The compiler performs optimization based on the knowledge it has of the
8228 program. Compiling multiple files at once to a single output file mode allows
8229 the compiler to use information gained from all of the files when compiling
8230 each of them.
8231
8232 Not all optimizations are controlled directly by a flag. Only
8233 optimizations that have a flag are listed in this section.
8234
8235 Most optimizations are completely disabled at @option{-O0} or if an
8236 @option{-O} level is not set on the command line, even if individual
8237 optimization flags are specified. Similarly, @option{-Og} suppresses
8238 many optimization passes.
8239
8240 Depending on the target and how GCC was configured, a slightly different
8241 set of optimizations may be enabled at each @option{-O} level than
8242 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8243 to find out the exact set of optimizations that are enabled at each level.
8244 @xref{Overall Options}, for examples.
8245
8246 @table @gcctabopt
8247 @item -O
8248 @itemx -O1
8249 @opindex O
8250 @opindex O1
8251 Optimize. Optimizing compilation takes somewhat more time, and a lot
8252 more memory for a large function.
8253
8254 With @option{-O}, the compiler tries to reduce code size and execution
8255 time, without performing any optimizations that take a great deal of
8256 compilation time.
8257
8258 @c Note that in addition to the default_options_table list in opts.c,
8259 @c several optimization flags default to true but control optimization
8260 @c passes that are explicitly disabled at -O0.
8261
8262 @option{-O} turns on the following optimization flags:
8263
8264 @c Please keep the following list alphabetized.
8265 @gccoptlist{-fauto-inc-dec @gol
8266 -fbranch-count-reg @gol
8267 -fcombine-stack-adjustments @gol
8268 -fcompare-elim @gol
8269 -fcprop-registers @gol
8270 -fdce @gol
8271 -fdefer-pop @gol
8272 -fdelayed-branch @gol
8273 -fdse @gol
8274 -fforward-propagate @gol
8275 -fguess-branch-probability @gol
8276 -fif-conversion @gol
8277 -fif-conversion2 @gol
8278 -finline-functions-called-once @gol
8279 -fipa-profile @gol
8280 -fipa-pure-const @gol
8281 -fipa-reference @gol
8282 -fipa-reference-addressable @gol
8283 -fmerge-constants @gol
8284 -fmove-loop-invariants @gol
8285 -fomit-frame-pointer @gol
8286 -freorder-blocks @gol
8287 -fshrink-wrap @gol
8288 -fshrink-wrap-separate @gol
8289 -fsplit-wide-types @gol
8290 -fssa-backprop @gol
8291 -fssa-phiopt @gol
8292 -ftree-bit-ccp @gol
8293 -ftree-ccp @gol
8294 -ftree-ch @gol
8295 -ftree-coalesce-vars @gol
8296 -ftree-copy-prop @gol
8297 -ftree-dce @gol
8298 -ftree-dominator-opts @gol
8299 -ftree-dse @gol
8300 -ftree-forwprop @gol
8301 -ftree-fre @gol
8302 -ftree-phiprop @gol
8303 -ftree-pta @gol
8304 -ftree-scev-cprop @gol
8305 -ftree-sink @gol
8306 -ftree-slsr @gol
8307 -ftree-sra @gol
8308 -ftree-ter @gol
8309 -funit-at-a-time}
8310
8311 @item -O2
8312 @opindex O2
8313 Optimize even more. GCC performs nearly all supported optimizations
8314 that do not involve a space-speed tradeoff.
8315 As compared to @option{-O}, this option increases both compilation time
8316 and the performance of the generated code.
8317
8318 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8319 also turns on the following optimization flags:
8320
8321 @c Please keep the following list alphabetized!
8322 @gccoptlist{-falign-functions -falign-jumps @gol
8323 -falign-labels -falign-loops @gol
8324 -fcaller-saves @gol
8325 -fcode-hoisting @gol
8326 -fcrossjumping @gol
8327 -fcse-follow-jumps -fcse-skip-blocks @gol
8328 -fdelete-null-pointer-checks @gol
8329 -fdevirtualize -fdevirtualize-speculatively @gol
8330 -fexpensive-optimizations @gol
8331 -ffinite-loops @gol
8332 -fgcse -fgcse-lm @gol
8333 -fhoist-adjacent-loads @gol
8334 -finline-small-functions @gol
8335 -findirect-inlining @gol
8336 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8337 -fipa-ra -fipa-sra -fipa-vrp @gol
8338 -fisolate-erroneous-paths-dereference @gol
8339 -flra-remat @gol
8340 -foptimize-sibling-calls @gol
8341 -foptimize-strlen @gol
8342 -fpartial-inlining @gol
8343 -fpeephole2 @gol
8344 -freorder-blocks-algorithm=stc @gol
8345 -freorder-blocks-and-partition -freorder-functions @gol
8346 -frerun-cse-after-loop @gol
8347 -fschedule-insns -fschedule-insns2 @gol
8348 -fsched-interblock -fsched-spec @gol
8349 -fstore-merging @gol
8350 -fstrict-aliasing @gol
8351 -fthread-jumps @gol
8352 -ftree-builtin-call-dce @gol
8353 -ftree-pre @gol
8354 -ftree-switch-conversion -ftree-tail-merge @gol
8355 -ftree-vrp}
8356
8357 Please note the warning under @option{-fgcse} about
8358 invoking @option{-O2} on programs that use computed gotos.
8359
8360 @item -O3
8361 @opindex O3
8362 Optimize yet more. @option{-O3} turns on all optimizations specified
8363 by @option{-O2} and also turns on the following optimization flags:
8364
8365 @c Please keep the following list alphabetized!
8366 @gccoptlist{-fgcse-after-reload @gol
8367 -finline-functions @gol
8368 -fipa-cp-clone
8369 -floop-interchange @gol
8370 -floop-unroll-and-jam @gol
8371 -fpeel-loops @gol
8372 -fpredictive-commoning @gol
8373 -fsplit-paths @gol
8374 -ftree-loop-distribute-patterns @gol
8375 -ftree-loop-distribution @gol
8376 -ftree-loop-vectorize @gol
8377 -ftree-partial-pre @gol
8378 -ftree-slp-vectorize @gol
8379 -funswitch-loops @gol
8380 -fvect-cost-model @gol
8381 -fversion-loops-for-strides}
8382
8383 @item -O0
8384 @opindex O0
8385 Reduce compilation time and make debugging produce the expected
8386 results. This is the default.
8387
8388 @item -Os
8389 @opindex Os
8390 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8391 except those that often increase code size:
8392
8393 @gccoptlist{-falign-functions -falign-jumps @gol
8394 -falign-labels -falign-loops @gol
8395 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8396
8397 It also enables @option{-finline-functions}, causes the compiler to tune for
8398 code size rather than execution speed, and performs further optimizations
8399 designed to reduce code size.
8400
8401 @item -Ofast
8402 @opindex Ofast
8403 Disregard strict standards compliance. @option{-Ofast} enables all
8404 @option{-O3} optimizations. It also enables optimizations that are not
8405 valid for all standard-compliant programs.
8406 It turns on @option{-ffast-math} and the Fortran-specific
8407 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8408 specified, and @option{-fno-protect-parens}.
8409
8410 @item -Og
8411 @opindex Og
8412 Optimize debugging experience. @option{-Og} should be the optimization
8413 level of choice for the standard edit-compile-debug cycle, offering
8414 a reasonable level of optimization while maintaining fast compilation
8415 and a good debugging experience. It is a better choice than @option{-O0}
8416 for producing debuggable code because some compiler passes
8417 that collect debug information are disabled at @option{-O0}.
8418
8419 Like @option{-O0}, @option{-Og} completely disables a number of
8420 optimization passes so that individual options controlling them have
8421 no effect. Otherwise @option{-Og} enables all @option{-O1}
8422 optimization flags except for those that may interfere with debugging:
8423
8424 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8425 -fif-conversion -fif-conversion2 @gol
8426 -finline-functions-called-once @gol
8427 -fmove-loop-invariants -fssa-phiopt @gol
8428 -ftree-bit-ccp -ftree-pta -ftree-sra}
8429
8430 @end table
8431
8432 If you use multiple @option{-O} options, with or without level numbers,
8433 the last such option is the one that is effective.
8434
8435 Options of the form @option{-f@var{flag}} specify machine-independent
8436 flags. Most flags have both positive and negative forms; the negative
8437 form of @option{-ffoo} is @option{-fno-foo}. In the table
8438 below, only one of the forms is listed---the one you typically
8439 use. You can figure out the other form by either removing @samp{no-}
8440 or adding it.
8441
8442 The following options control specific optimizations. They are either
8443 activated by @option{-O} options or are related to ones that are. You
8444 can use the following flags in the rare cases when ``fine-tuning'' of
8445 optimizations to be performed is desired.
8446
8447 @table @gcctabopt
8448 @item -fno-defer-pop
8449 @opindex fno-defer-pop
8450 @opindex fdefer-pop
8451 For machines that must pop arguments after a function call, always pop
8452 the arguments as soon as each function returns.
8453 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8454 this allows the compiler to let arguments accumulate on the stack for several
8455 function calls and pop them all at once.
8456
8457 @item -fforward-propagate
8458 @opindex fforward-propagate
8459 Perform a forward propagation pass on RTL@. The pass tries to combine two
8460 instructions and checks if the result can be simplified. If loop unrolling
8461 is active, two passes are performed and the second is scheduled after
8462 loop unrolling.
8463
8464 This option is enabled by default at optimization levels @option{-O},
8465 @option{-O2}, @option{-O3}, @option{-Os}.
8466
8467 @item -ffp-contract=@var{style}
8468 @opindex ffp-contract
8469 @option{-ffp-contract=off} disables floating-point expression contraction.
8470 @option{-ffp-contract=fast} enables floating-point expression contraction
8471 such as forming of fused multiply-add operations if the target has
8472 native support for them.
8473 @option{-ffp-contract=on} enables floating-point expression contraction
8474 if allowed by the language standard. This is currently not implemented
8475 and treated equal to @option{-ffp-contract=off}.
8476
8477 The default is @option{-ffp-contract=fast}.
8478
8479 @item -fomit-frame-pointer
8480 @opindex fomit-frame-pointer
8481 Omit the frame pointer in functions that don't need one. This avoids the
8482 instructions to save, set up and restore the frame pointer; on many targets
8483 it also makes an extra register available.
8484
8485 On some targets this flag has no effect because the standard calling sequence
8486 always uses a frame pointer, so it cannot be omitted.
8487
8488 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8489 is used in all functions. Several targets always omit the frame pointer in
8490 leaf functions.
8491
8492 Enabled by default at @option{-O} and higher.
8493
8494 @item -foptimize-sibling-calls
8495 @opindex foptimize-sibling-calls
8496 Optimize sibling and tail recursive calls.
8497
8498 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8499
8500 @item -foptimize-strlen
8501 @opindex foptimize-strlen
8502 Optimize various standard C string functions (e.g.@: @code{strlen},
8503 @code{strchr} or @code{strcpy}) and
8504 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8505
8506 Enabled at levels @option{-O2}, @option{-O3}.
8507
8508 @item -fno-inline
8509 @opindex fno-inline
8510 @opindex finline
8511 Do not expand any functions inline apart from those marked with
8512 the @code{always_inline} attribute. This is the default when not
8513 optimizing.
8514
8515 Single functions can be exempted from inlining by marking them
8516 with the @code{noinline} attribute.
8517
8518 @item -finline-small-functions
8519 @opindex finline-small-functions
8520 Integrate functions into their callers when their body is smaller than expected
8521 function call code (so overall size of program gets smaller). The compiler
8522 heuristically decides which functions are simple enough to be worth integrating
8523 in this way. This inlining applies to all functions, even those not declared
8524 inline.
8525
8526 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8527
8528 @item -findirect-inlining
8529 @opindex findirect-inlining
8530 Inline also indirect calls that are discovered to be known at compile
8531 time thanks to previous inlining. This option has any effect only
8532 when inlining itself is turned on by the @option{-finline-functions}
8533 or @option{-finline-small-functions} options.
8534
8535 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8536
8537 @item -finline-functions
8538 @opindex finline-functions
8539 Consider all functions for inlining, even if they are not declared inline.
8540 The compiler heuristically decides which functions are worth integrating
8541 in this way.
8542
8543 If all calls to a given function are integrated, and the function is
8544 declared @code{static}, then the function is normally not output as
8545 assembler code in its own right.
8546
8547 Enabled at levels @option{-O3}, @option{-Os}. Also enabled
8548 by @option{-fprofile-use} and @option{-fauto-profile}.
8549
8550 @item -finline-functions-called-once
8551 @opindex finline-functions-called-once
8552 Consider all @code{static} functions called once for inlining into their
8553 caller even if they are not marked @code{inline}. If a call to a given
8554 function is integrated, then the function is not output as assembler code
8555 in its own right.
8556
8557 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8558 but not @option{-Og}.
8559
8560 @item -fearly-inlining
8561 @opindex fearly-inlining
8562 Inline functions marked by @code{always_inline} and functions whose body seems
8563 smaller than the function call overhead early before doing
8564 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8565 makes profiling significantly cheaper and usually inlining faster on programs
8566 having large chains of nested wrapper functions.
8567
8568 Enabled by default.
8569
8570 @item -fipa-sra
8571 @opindex fipa-sra
8572 Perform interprocedural scalar replacement of aggregates, removal of
8573 unused parameters and replacement of parameters passed by reference
8574 by parameters passed by value.
8575
8576 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8577
8578 @item -finline-limit=@var{n}
8579 @opindex finline-limit
8580 By default, GCC limits the size of functions that can be inlined. This flag
8581 allows coarse control of this limit. @var{n} is the size of functions that
8582 can be inlined in number of pseudo instructions.
8583
8584 Inlining is actually controlled by a number of parameters, which may be
8585 specified individually by using @option{--param @var{name}=@var{value}}.
8586 The @option{-finline-limit=@var{n}} option sets some of these parameters
8587 as follows:
8588
8589 @table @gcctabopt
8590 @item max-inline-insns-single
8591 is set to @var{n}/2.
8592 @item max-inline-insns-auto
8593 is set to @var{n}/2.
8594 @end table
8595
8596 See below for a documentation of the individual
8597 parameters controlling inlining and for the defaults of these parameters.
8598
8599 @emph{Note:} there may be no value to @option{-finline-limit} that results
8600 in default behavior.
8601
8602 @emph{Note:} pseudo instruction represents, in this particular context, an
8603 abstract measurement of function's size. In no way does it represent a count
8604 of assembly instructions and as such its exact meaning might change from one
8605 release to an another.
8606
8607 @item -fno-keep-inline-dllexport
8608 @opindex fno-keep-inline-dllexport
8609 @opindex fkeep-inline-dllexport
8610 This is a more fine-grained version of @option{-fkeep-inline-functions},
8611 which applies only to functions that are declared using the @code{dllexport}
8612 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8613 Functions}.
8614
8615 @item -fkeep-inline-functions
8616 @opindex fkeep-inline-functions
8617 In C, emit @code{static} functions that are declared @code{inline}
8618 into the object file, even if the function has been inlined into all
8619 of its callers. This switch does not affect functions using the
8620 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8621 inline functions into the object file.
8622
8623 @item -fkeep-static-functions
8624 @opindex fkeep-static-functions
8625 Emit @code{static} functions into the object file, even if the function
8626 is never used.
8627
8628 @item -fkeep-static-consts
8629 @opindex fkeep-static-consts
8630 Emit variables declared @code{static const} when optimization isn't turned
8631 on, even if the variables aren't referenced.
8632
8633 GCC enables this option by default. If you want to force the compiler to
8634 check if a variable is referenced, regardless of whether or not
8635 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8636
8637 @item -fmerge-constants
8638 @opindex fmerge-constants
8639 Attempt to merge identical constants (string constants and floating-point
8640 constants) across compilation units.
8641
8642 This option is the default for optimized compilation if the assembler and
8643 linker support it. Use @option{-fno-merge-constants} to inhibit this
8644 behavior.
8645
8646 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8647
8648 @item -fmerge-all-constants
8649 @opindex fmerge-all-constants
8650 Attempt to merge identical constants and identical variables.
8651
8652 This option implies @option{-fmerge-constants}. In addition to
8653 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8654 arrays or initialized constant variables with integral or floating-point
8655 types. Languages like C or C++ require each variable, including multiple
8656 instances of the same variable in recursive calls, to have distinct locations,
8657 so using this option results in non-conforming
8658 behavior.
8659
8660 @item -fmodulo-sched
8661 @opindex fmodulo-sched
8662 Perform swing modulo scheduling immediately before the first scheduling
8663 pass. This pass looks at innermost loops and reorders their
8664 instructions by overlapping different iterations.
8665
8666 @item -fmodulo-sched-allow-regmoves
8667 @opindex fmodulo-sched-allow-regmoves
8668 Perform more aggressive SMS-based modulo scheduling with register moves
8669 allowed. By setting this flag certain anti-dependences edges are
8670 deleted, which triggers the generation of reg-moves based on the
8671 life-range analysis. This option is effective only with
8672 @option{-fmodulo-sched} enabled.
8673
8674 @item -fno-branch-count-reg
8675 @opindex fno-branch-count-reg
8676 @opindex fbranch-count-reg
8677 Disable the optimization pass that scans for opportunities to use
8678 ``decrement and branch'' instructions on a count register instead of
8679 instruction sequences that decrement a register, compare it against zero, and
8680 then branch based upon the result. This option is only meaningful on
8681 architectures that support such instructions, which include x86, PowerPC,
8682 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8683 doesn't remove the decrement and branch instructions from the generated
8684 instruction stream introduced by other optimization passes.
8685
8686 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8687 except for @option{-Og}.
8688
8689 @item -fno-function-cse
8690 @opindex fno-function-cse
8691 @opindex ffunction-cse
8692 Do not put function addresses in registers; make each instruction that
8693 calls a constant function contain the function's address explicitly.
8694
8695 This option results in less efficient code, but some strange hacks
8696 that alter the assembler output may be confused by the optimizations
8697 performed when this option is not used.
8698
8699 The default is @option{-ffunction-cse}
8700
8701 @item -fno-zero-initialized-in-bss
8702 @opindex fno-zero-initialized-in-bss
8703 @opindex fzero-initialized-in-bss
8704 If the target supports a BSS section, GCC by default puts variables that
8705 are initialized to zero into BSS@. This can save space in the resulting
8706 code.
8707
8708 This option turns off this behavior because some programs explicitly
8709 rely on variables going to the data section---e.g., so that the
8710 resulting executable can find the beginning of that section and/or make
8711 assumptions based on that.
8712
8713 The default is @option{-fzero-initialized-in-bss}.
8714
8715 @item -fthread-jumps
8716 @opindex fthread-jumps
8717 Perform optimizations that check to see if a jump branches to a
8718 location where another comparison subsumed by the first is found. If
8719 so, the first branch is redirected to either the destination of the
8720 second branch or a point immediately following it, depending on whether
8721 the condition is known to be true or false.
8722
8723 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8724
8725 @item -fsplit-wide-types
8726 @opindex fsplit-wide-types
8727 When using a type that occupies multiple registers, such as @code{long
8728 long} on a 32-bit system, split the registers apart and allocate them
8729 independently. This normally generates better code for those types,
8730 but may make debugging more difficult.
8731
8732 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8733 @option{-Os}.
8734
8735 @item -fsplit-wide-types-early
8736 @opindex fsplit-wide-types-early
8737 Fully split wide types early, instead of very late.
8738 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8739
8740 This is the default on some targets.
8741
8742 @item -fcse-follow-jumps
8743 @opindex fcse-follow-jumps
8744 In common subexpression elimination (CSE), scan through jump instructions
8745 when the target of the jump is not reached by any other path. For
8746 example, when CSE encounters an @code{if} statement with an
8747 @code{else} clause, CSE follows the jump when the condition
8748 tested is false.
8749
8750 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8751
8752 @item -fcse-skip-blocks
8753 @opindex fcse-skip-blocks
8754 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8755 follow jumps that conditionally skip over blocks. When CSE
8756 encounters a simple @code{if} statement with no else clause,
8757 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8758 body of the @code{if}.
8759
8760 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8761
8762 @item -frerun-cse-after-loop
8763 @opindex frerun-cse-after-loop
8764 Re-run common subexpression elimination after loop optimizations are
8765 performed.
8766
8767 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8768
8769 @item -fgcse
8770 @opindex fgcse
8771 Perform a global common subexpression elimination pass.
8772 This pass also performs global constant and copy propagation.
8773
8774 @emph{Note:} When compiling a program using computed gotos, a GCC
8775 extension, you may get better run-time performance if you disable
8776 the global common subexpression elimination pass by adding
8777 @option{-fno-gcse} to the command line.
8778
8779 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8780
8781 @item -fgcse-lm
8782 @opindex fgcse-lm
8783 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8784 attempts to move loads that are only killed by stores into themselves. This
8785 allows a loop containing a load/store sequence to be changed to a load outside
8786 the loop, and a copy/store within the loop.
8787
8788 Enabled by default when @option{-fgcse} is enabled.
8789
8790 @item -fgcse-sm
8791 @opindex fgcse-sm
8792 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8793 global common subexpression elimination. This pass attempts to move
8794 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8795 loops containing a load/store sequence can be changed to a load before
8796 the loop and a store after the loop.
8797
8798 Not enabled at any optimization level.
8799
8800 @item -fgcse-las
8801 @opindex fgcse-las
8802 When @option{-fgcse-las} is enabled, the global common subexpression
8803 elimination pass eliminates redundant loads that come after stores to the
8804 same memory location (both partial and full redundancies).
8805
8806 Not enabled at any optimization level.
8807
8808 @item -fgcse-after-reload
8809 @opindex fgcse-after-reload
8810 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8811 pass is performed after reload. The purpose of this pass is to clean up
8812 redundant spilling.
8813
8814 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8815
8816 @item -faggressive-loop-optimizations
8817 @opindex faggressive-loop-optimizations
8818 This option tells the loop optimizer to use language constraints to
8819 derive bounds for the number of iterations of a loop. This assumes that
8820 loop code does not invoke undefined behavior by for example causing signed
8821 integer overflows or out-of-bound array accesses. The bounds for the
8822 number of iterations of a loop are used to guide loop unrolling and peeling
8823 and loop exit test optimizations.
8824 This option is enabled by default.
8825
8826 @item -funconstrained-commons
8827 @opindex funconstrained-commons
8828 This option tells the compiler that variables declared in common blocks
8829 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8830 prevents certain optimizations that depend on knowing the array bounds.
8831
8832 @item -fcrossjumping
8833 @opindex fcrossjumping
8834 Perform cross-jumping transformation.
8835 This transformation unifies equivalent code and saves code size. The
8836 resulting code may or may not perform better than without cross-jumping.
8837
8838 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8839
8840 @item -fauto-inc-dec
8841 @opindex fauto-inc-dec
8842 Combine increments or decrements of addresses with memory accesses.
8843 This pass is always skipped on architectures that do not have
8844 instructions to support this. Enabled by default at @option{-O} and
8845 higher on architectures that support this.
8846
8847 @item -fdce
8848 @opindex fdce
8849 Perform dead code elimination (DCE) on RTL@.
8850 Enabled by default at @option{-O} and higher.
8851
8852 @item -fdse
8853 @opindex fdse
8854 Perform dead store elimination (DSE) on RTL@.
8855 Enabled by default at @option{-O} and higher.
8856
8857 @item -fif-conversion
8858 @opindex fif-conversion
8859 Attempt to transform conditional jumps into branch-less equivalents. This
8860 includes use of conditional moves, min, max, set flags and abs instructions, and
8861 some tricks doable by standard arithmetics. The use of conditional execution
8862 on chips where it is available is controlled by @option{-fif-conversion2}.
8863
8864 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8865 not with @option{-Og}.
8866
8867 @item -fif-conversion2
8868 @opindex fif-conversion2
8869 Use conditional execution (where available) to transform conditional jumps into
8870 branch-less equivalents.
8871
8872 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8873 not with @option{-Og}.
8874
8875 @item -fdeclone-ctor-dtor
8876 @opindex fdeclone-ctor-dtor
8877 The C++ ABI requires multiple entry points for constructors and
8878 destructors: one for a base subobject, one for a complete object, and
8879 one for a virtual destructor that calls operator delete afterwards.
8880 For a hierarchy with virtual bases, the base and complete variants are
8881 clones, which means two copies of the function. With this option, the
8882 base and complete variants are changed to be thunks that call a common
8883 implementation.
8884
8885 Enabled by @option{-Os}.
8886
8887 @item -fdelete-null-pointer-checks
8888 @opindex fdelete-null-pointer-checks
8889 Assume that programs cannot safely dereference null pointers, and that
8890 no code or data element resides at address zero.
8891 This option enables simple constant
8892 folding optimizations at all optimization levels. In addition, other
8893 optimization passes in GCC use this flag to control global dataflow
8894 analyses that eliminate useless checks for null pointers; these assume
8895 that a memory access to address zero always results in a trap, so
8896 that if a pointer is checked after it has already been dereferenced,
8897 it cannot be null.
8898
8899 Note however that in some environments this assumption is not true.
8900 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8901 for programs that depend on that behavior.
8902
8903 This option is enabled by default on most targets. On Nios II ELF, it
8904 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8905
8906 Passes that use the dataflow information
8907 are enabled independently at different optimization levels.
8908
8909 @item -fdevirtualize
8910 @opindex fdevirtualize
8911 Attempt to convert calls to virtual functions to direct calls. This
8912 is done both within a procedure and interprocedurally as part of
8913 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8914 propagation (@option{-fipa-cp}).
8915 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8916
8917 @item -fdevirtualize-speculatively
8918 @opindex fdevirtualize-speculatively
8919 Attempt to convert calls to virtual functions to speculative direct calls.
8920 Based on the analysis of the type inheritance graph, determine for a given call
8921 the set of likely targets. If the set is small, preferably of size 1, change
8922 the call into a conditional deciding between direct and indirect calls. The
8923 speculative calls enable more optimizations, such as inlining. When they seem
8924 useless after further optimization, they are converted back into original form.
8925
8926 @item -fdevirtualize-at-ltrans
8927 @opindex fdevirtualize-at-ltrans
8928 Stream extra information needed for aggressive devirtualization when running
8929 the link-time optimizer in local transformation mode.
8930 This option enables more devirtualization but
8931 significantly increases the size of streamed data. For this reason it is
8932 disabled by default.
8933
8934 @item -fexpensive-optimizations
8935 @opindex fexpensive-optimizations
8936 Perform a number of minor optimizations that are relatively expensive.
8937
8938 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8939
8940 @item -free
8941 @opindex free
8942 Attempt to remove redundant extension instructions. This is especially
8943 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8944 registers after writing to their lower 32-bit half.
8945
8946 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8947 @option{-O3}, @option{-Os}.
8948
8949 @item -fno-lifetime-dse
8950 @opindex fno-lifetime-dse
8951 @opindex flifetime-dse
8952 In C++ the value of an object is only affected by changes within its
8953 lifetime: when the constructor begins, the object has an indeterminate
8954 value, and any changes during the lifetime of the object are dead when
8955 the object is destroyed. Normally dead store elimination will take
8956 advantage of this; if your code relies on the value of the object
8957 storage persisting beyond the lifetime of the object, you can use this
8958 flag to disable this optimization. To preserve stores before the
8959 constructor starts (e.g.@: because your operator new clears the object
8960 storage) but still treat the object as dead after the destructor you,
8961 can use @option{-flifetime-dse=1}. The default behavior can be
8962 explicitly selected with @option{-flifetime-dse=2}.
8963 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8964
8965 @item -flive-range-shrinkage
8966 @opindex flive-range-shrinkage
8967 Attempt to decrease register pressure through register live range
8968 shrinkage. This is helpful for fast processors with small or moderate
8969 size register sets.
8970
8971 @item -fira-algorithm=@var{algorithm}
8972 @opindex fira-algorithm
8973 Use the specified coloring algorithm for the integrated register
8974 allocator. The @var{algorithm} argument can be @samp{priority}, which
8975 specifies Chow's priority coloring, or @samp{CB}, which specifies
8976 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8977 for all architectures, but for those targets that do support it, it is
8978 the default because it generates better code.
8979
8980 @item -fira-region=@var{region}
8981 @opindex fira-region
8982 Use specified regions for the integrated register allocator. The
8983 @var{region} argument should be one of the following:
8984
8985 @table @samp
8986
8987 @item all
8988 Use all loops as register allocation regions.
8989 This can give the best results for machines with a small and/or
8990 irregular register set.
8991
8992 @item mixed
8993 Use all loops except for loops with small register pressure
8994 as the regions. This value usually gives
8995 the best results in most cases and for most architectures,
8996 and is enabled by default when compiling with optimization for speed
8997 (@option{-O}, @option{-O2}, @dots{}).
8998
8999 @item one
9000 Use all functions as a single region.
9001 This typically results in the smallest code size, and is enabled by default for
9002 @option{-Os} or @option{-O0}.
9003
9004 @end table
9005
9006 @item -fira-hoist-pressure
9007 @opindex fira-hoist-pressure
9008 Use IRA to evaluate register pressure in the code hoisting pass for
9009 decisions to hoist expressions. This option usually results in smaller
9010 code, but it can slow the compiler down.
9011
9012 This option is enabled at level @option{-Os} for all targets.
9013
9014 @item -fira-loop-pressure
9015 @opindex fira-loop-pressure
9016 Use IRA to evaluate register pressure in loops for decisions to move
9017 loop invariants. This option usually results in generation
9018 of faster and smaller code on machines with large register files (>= 32
9019 registers), but it can slow the compiler down.
9020
9021 This option is enabled at level @option{-O3} for some targets.
9022
9023 @item -fno-ira-share-save-slots
9024 @opindex fno-ira-share-save-slots
9025 @opindex fira-share-save-slots
9026 Disable sharing of stack slots used for saving call-used hard
9027 registers living through a call. Each hard register gets a
9028 separate stack slot, and as a result function stack frames are
9029 larger.
9030
9031 @item -fno-ira-share-spill-slots
9032 @opindex fno-ira-share-spill-slots
9033 @opindex fira-share-spill-slots
9034 Disable sharing of stack slots allocated for pseudo-registers. Each
9035 pseudo-register that does not get a hard register gets a separate
9036 stack slot, and as a result function stack frames are larger.
9037
9038 @item -flra-remat
9039 @opindex flra-remat
9040 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9041 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9042 values if it is profitable.
9043
9044 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9045
9046 @item -fdelayed-branch
9047 @opindex fdelayed-branch
9048 If supported for the target machine, attempt to reorder instructions
9049 to exploit instruction slots available after delayed branch
9050 instructions.
9051
9052 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9053 but not at @option{-Og}.
9054
9055 @item -fschedule-insns
9056 @opindex fschedule-insns
9057 If supported for the target machine, attempt to reorder instructions to
9058 eliminate execution stalls due to required data being unavailable. This
9059 helps machines that have slow floating point or memory load instructions
9060 by allowing other instructions to be issued until the result of the load
9061 or floating-point instruction is required.
9062
9063 Enabled at levels @option{-O2}, @option{-O3}.
9064
9065 @item -fschedule-insns2
9066 @opindex fschedule-insns2
9067 Similar to @option{-fschedule-insns}, but requests an additional pass of
9068 instruction scheduling after register allocation has been done. This is
9069 especially useful on machines with a relatively small number of
9070 registers and where memory load instructions take more than one cycle.
9071
9072 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9073
9074 @item -fno-sched-interblock
9075 @opindex fno-sched-interblock
9076 @opindex fsched-interblock
9077 Disable instruction scheduling across basic blocks, which
9078 is normally enabled when scheduling before register allocation, i.e.@:
9079 with @option{-fschedule-insns} or at @option{-O2} or higher.
9080
9081 @item -fno-sched-spec
9082 @opindex fno-sched-spec
9083 @opindex fsched-spec
9084 Disable speculative motion of non-load instructions, which
9085 is normally enabled when scheduling before register allocation, i.e.@:
9086 with @option{-fschedule-insns} or at @option{-O2} or higher.
9087
9088 @item -fsched-pressure
9089 @opindex fsched-pressure
9090 Enable register pressure sensitive insn scheduling before register
9091 allocation. This only makes sense when scheduling before register
9092 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9093 @option{-O2} or higher. Usage of this option can improve the
9094 generated code and decrease its size by preventing register pressure
9095 increase above the number of available hard registers and subsequent
9096 spills in register allocation.
9097
9098 @item -fsched-spec-load
9099 @opindex fsched-spec-load
9100 Allow speculative motion of some load instructions. This only makes
9101 sense when scheduling before register allocation, i.e.@: with
9102 @option{-fschedule-insns} or at @option{-O2} or higher.
9103
9104 @item -fsched-spec-load-dangerous
9105 @opindex fsched-spec-load-dangerous
9106 Allow speculative motion of more load instructions. This only makes
9107 sense when scheduling before register allocation, i.e.@: with
9108 @option{-fschedule-insns} or at @option{-O2} or higher.
9109
9110 @item -fsched-stalled-insns
9111 @itemx -fsched-stalled-insns=@var{n}
9112 @opindex fsched-stalled-insns
9113 Define how many insns (if any) can be moved prematurely from the queue
9114 of stalled insns into the ready list during the second scheduling pass.
9115 @option{-fno-sched-stalled-insns} means that no insns are moved
9116 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9117 on how many queued insns can be moved prematurely.
9118 @option{-fsched-stalled-insns} without a value is equivalent to
9119 @option{-fsched-stalled-insns=1}.
9120
9121 @item -fsched-stalled-insns-dep
9122 @itemx -fsched-stalled-insns-dep=@var{n}
9123 @opindex fsched-stalled-insns-dep
9124 Define how many insn groups (cycles) are examined for a dependency
9125 on a stalled insn that is a candidate for premature removal from the queue
9126 of stalled insns. This has an effect only during the second scheduling pass,
9127 and only if @option{-fsched-stalled-insns} is used.
9128 @option{-fno-sched-stalled-insns-dep} is equivalent to
9129 @option{-fsched-stalled-insns-dep=0}.
9130 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9131 @option{-fsched-stalled-insns-dep=1}.
9132
9133 @item -fsched2-use-superblocks
9134 @opindex fsched2-use-superblocks
9135 When scheduling after register allocation, use superblock scheduling.
9136 This allows motion across basic block boundaries,
9137 resulting in faster schedules. This option is experimental, as not all machine
9138 descriptions used by GCC model the CPU closely enough to avoid unreliable
9139 results from the algorithm.
9140
9141 This only makes sense when scheduling after register allocation, i.e.@: with
9142 @option{-fschedule-insns2} or at @option{-O2} or higher.
9143
9144 @item -fsched-group-heuristic
9145 @opindex fsched-group-heuristic
9146 Enable the group heuristic in the scheduler. This heuristic favors
9147 the instruction that belongs to a schedule group. This is enabled
9148 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9149 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9150
9151 @item -fsched-critical-path-heuristic
9152 @opindex fsched-critical-path-heuristic
9153 Enable the critical-path heuristic in the scheduler. This heuristic favors
9154 instructions on the critical path. This is enabled by default when
9155 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9156 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9157
9158 @item -fsched-spec-insn-heuristic
9159 @opindex fsched-spec-insn-heuristic
9160 Enable the speculative instruction heuristic in the scheduler. This
9161 heuristic favors speculative instructions with greater dependency weakness.
9162 This is enabled by default when scheduling is enabled, i.e.@:
9163 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9164 or at @option{-O2} or higher.
9165
9166 @item -fsched-rank-heuristic
9167 @opindex fsched-rank-heuristic
9168 Enable the rank heuristic in the scheduler. This heuristic favors
9169 the instruction belonging to a basic block with greater size or frequency.
9170 This is enabled by default when scheduling is enabled, i.e.@:
9171 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9172 at @option{-O2} or higher.
9173
9174 @item -fsched-last-insn-heuristic
9175 @opindex fsched-last-insn-heuristic
9176 Enable the last-instruction heuristic in the scheduler. This heuristic
9177 favors the instruction that is less dependent on the last instruction
9178 scheduled. This is enabled by default when scheduling is enabled,
9179 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9180 at @option{-O2} or higher.
9181
9182 @item -fsched-dep-count-heuristic
9183 @opindex fsched-dep-count-heuristic
9184 Enable the dependent-count heuristic in the scheduler. This heuristic
9185 favors the instruction that has more instructions depending on it.
9186 This is enabled by default when scheduling is enabled, i.e.@:
9187 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9188 at @option{-O2} or higher.
9189
9190 @item -freschedule-modulo-scheduled-loops
9191 @opindex freschedule-modulo-scheduled-loops
9192 Modulo scheduling is performed before traditional scheduling. If a loop
9193 is modulo scheduled, later scheduling passes may change its schedule.
9194 Use this option to control that behavior.
9195
9196 @item -fselective-scheduling
9197 @opindex fselective-scheduling
9198 Schedule instructions using selective scheduling algorithm. Selective
9199 scheduling runs instead of the first scheduler pass.
9200
9201 @item -fselective-scheduling2
9202 @opindex fselective-scheduling2
9203 Schedule instructions using selective scheduling algorithm. Selective
9204 scheduling runs instead of the second scheduler pass.
9205
9206 @item -fsel-sched-pipelining
9207 @opindex fsel-sched-pipelining
9208 Enable software pipelining of innermost loops during selective scheduling.
9209 This option has no effect unless one of @option{-fselective-scheduling} or
9210 @option{-fselective-scheduling2} is turned on.
9211
9212 @item -fsel-sched-pipelining-outer-loops
9213 @opindex fsel-sched-pipelining-outer-loops
9214 When pipelining loops during selective scheduling, also pipeline outer loops.
9215 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9216
9217 @item -fsemantic-interposition
9218 @opindex fsemantic-interposition
9219 Some object formats, like ELF, allow interposing of symbols by the
9220 dynamic linker.
9221 This means that for symbols exported from the DSO, the compiler cannot perform
9222 interprocedural propagation, inlining and other optimizations in anticipation
9223 that the function or variable in question may change. While this feature is
9224 useful, for example, to rewrite memory allocation functions by a debugging
9225 implementation, it is expensive in the terms of code quality.
9226 With @option{-fno-semantic-interposition} the compiler assumes that
9227 if interposition happens for functions the overwriting function will have
9228 precisely the same semantics (and side effects).
9229 Similarly if interposition happens
9230 for variables, the constructor of the variable will be the same. The flag
9231 has no effect for functions explicitly declared inline
9232 (where it is never allowed for interposition to change semantics)
9233 and for symbols explicitly declared weak.
9234
9235 @item -fshrink-wrap
9236 @opindex fshrink-wrap
9237 Emit function prologues only before parts of the function that need it,
9238 rather than at the top of the function. This flag is enabled by default at
9239 @option{-O} and higher.
9240
9241 @item -fshrink-wrap-separate
9242 @opindex fshrink-wrap-separate
9243 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9244 those parts are only executed when needed.
9245 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9246 is also turned on and the target supports this.
9247
9248 @item -fcaller-saves
9249 @opindex fcaller-saves
9250 Enable allocation of values to registers that are clobbered by
9251 function calls, by emitting extra instructions to save and restore the
9252 registers around such calls. Such allocation is done only when it
9253 seems to result in better code.
9254
9255 This option is always enabled by default on certain machines, usually
9256 those which have no call-preserved registers to use instead.
9257
9258 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9259
9260 @item -fcombine-stack-adjustments
9261 @opindex fcombine-stack-adjustments
9262 Tracks stack adjustments (pushes and pops) and stack memory references
9263 and then tries to find ways to combine them.
9264
9265 Enabled by default at @option{-O1} and higher.
9266
9267 @item -fipa-ra
9268 @opindex fipa-ra
9269 Use caller save registers for allocation if those registers are not used by
9270 any called function. In that case it is not necessary to save and restore
9271 them around calls. This is only possible if called functions are part of
9272 same compilation unit as current function and they are compiled before it.
9273
9274 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9275 is disabled if generated code will be instrumented for profiling
9276 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9277 exactly (this happens on targets that do not expose prologues
9278 and epilogues in RTL).
9279
9280 @item -fconserve-stack
9281 @opindex fconserve-stack
9282 Attempt to minimize stack usage. The compiler attempts to use less
9283 stack space, even if that makes the program slower. This option
9284 implies setting the @option{large-stack-frame} parameter to 100
9285 and the @option{large-stack-frame-growth} parameter to 400.
9286
9287 @item -ftree-reassoc
9288 @opindex ftree-reassoc
9289 Perform reassociation on trees. This flag is enabled by default
9290 at @option{-O} and higher.
9291
9292 @item -fcode-hoisting
9293 @opindex fcode-hoisting
9294 Perform code hoisting. Code hoisting tries to move the
9295 evaluation of expressions executed on all paths to the function exit
9296 as early as possible. This is especially useful as a code size
9297 optimization, but it often helps for code speed as well.
9298 This flag is enabled by default at @option{-O2} and higher.
9299
9300 @item -ftree-pre
9301 @opindex ftree-pre
9302 Perform partial redundancy elimination (PRE) on trees. This flag is
9303 enabled by default at @option{-O2} and @option{-O3}.
9304
9305 @item -ftree-partial-pre
9306 @opindex ftree-partial-pre
9307 Make partial redundancy elimination (PRE) more aggressive. This flag is
9308 enabled by default at @option{-O3}.
9309
9310 @item -ftree-forwprop
9311 @opindex ftree-forwprop
9312 Perform forward propagation on trees. This flag is enabled by default
9313 at @option{-O} and higher.
9314
9315 @item -ftree-fre
9316 @opindex ftree-fre
9317 Perform full redundancy elimination (FRE) on trees. The difference
9318 between FRE and PRE is that FRE only considers expressions
9319 that are computed on all paths leading to the redundant computation.
9320 This analysis is faster than PRE, though it exposes fewer redundancies.
9321 This flag is enabled by default at @option{-O} and higher.
9322
9323 @item -ftree-phiprop
9324 @opindex ftree-phiprop
9325 Perform hoisting of loads from conditional pointers on trees. This
9326 pass is enabled by default at @option{-O} and higher.
9327
9328 @item -fhoist-adjacent-loads
9329 @opindex fhoist-adjacent-loads
9330 Speculatively hoist loads from both branches of an if-then-else if the
9331 loads are from adjacent locations in the same structure and the target
9332 architecture has a conditional move instruction. This flag is enabled
9333 by default at @option{-O2} and higher.
9334
9335 @item -ftree-copy-prop
9336 @opindex ftree-copy-prop
9337 Perform copy propagation on trees. This pass eliminates unnecessary
9338 copy operations. This flag is enabled by default at @option{-O} and
9339 higher.
9340
9341 @item -fipa-pure-const
9342 @opindex fipa-pure-const
9343 Discover which functions are pure or constant.
9344 Enabled by default at @option{-O} and higher.
9345
9346 @item -fipa-reference
9347 @opindex fipa-reference
9348 Discover which static variables do not escape the
9349 compilation unit.
9350 Enabled by default at @option{-O} and higher.
9351
9352 @item -fipa-reference-addressable
9353 @opindex fipa-reference-addressable
9354 Discover read-only, write-only and non-addressable static variables.
9355 Enabled by default at @option{-O} and higher.
9356
9357 @item -fipa-stack-alignment
9358 @opindex fipa-stack-alignment
9359 Reduce stack alignment on call sites if possible.
9360 Enabled by default.
9361
9362 @item -fipa-pta
9363 @opindex fipa-pta
9364 Perform interprocedural pointer analysis and interprocedural modification
9365 and reference analysis. This option can cause excessive memory and
9366 compile-time usage on large compilation units. It is not enabled by
9367 default at any optimization level.
9368
9369 @item -fipa-profile
9370 @opindex fipa-profile
9371 Perform interprocedural profile propagation. The functions called only from
9372 cold functions are marked as cold. Also functions executed once (such as
9373 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9374 functions and loop less parts of functions executed once are then optimized for
9375 size.
9376 Enabled by default at @option{-O} and higher.
9377
9378 @item -fipa-cp
9379 @opindex fipa-cp
9380 Perform interprocedural constant propagation.
9381 This optimization analyzes the program to determine when values passed
9382 to functions are constants and then optimizes accordingly.
9383 This optimization can substantially increase performance
9384 if the application has constants passed to functions.
9385 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9386 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9387
9388 @item -fipa-cp-clone
9389 @opindex fipa-cp-clone
9390 Perform function cloning to make interprocedural constant propagation stronger.
9391 When enabled, interprocedural constant propagation performs function cloning
9392 when externally visible function can be called with constant arguments.
9393 Because this optimization can create multiple copies of functions,
9394 it may significantly increase code size
9395 (see @option{--param ipcp-unit-growth=@var{value}}).
9396 This flag is enabled by default at @option{-O3}.
9397 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9398
9399 @item -fipa-bit-cp
9400 @opindex fipa-bit-cp
9401 When enabled, perform interprocedural bitwise constant
9402 propagation. This flag is enabled by default at @option{-O2} and
9403 by @option{-fprofile-use} and @option{-fauto-profile}.
9404 It requires that @option{-fipa-cp} is enabled.
9405
9406 @item -fipa-vrp
9407 @opindex fipa-vrp
9408 When enabled, perform interprocedural propagation of value
9409 ranges. This flag is enabled by default at @option{-O2}. It requires
9410 that @option{-fipa-cp} is enabled.
9411
9412 @item -fipa-icf
9413 @opindex fipa-icf
9414 Perform Identical Code Folding for functions and read-only variables.
9415 The optimization reduces code size and may disturb unwind stacks by replacing
9416 a function by equivalent one with a different name. The optimization works
9417 more effectively with link-time optimization enabled.
9418
9419 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9420 works on different levels and thus the optimizations are not same - there are
9421 equivalences that are found only by GCC and equivalences found only by Gold.
9422
9423 This flag is enabled by default at @option{-O2} and @option{-Os}.
9424
9425 @item -flive-patching=@var{level}
9426 @opindex flive-patching
9427 Control GCC's optimizations to produce output suitable for live-patching.
9428
9429 If the compiler's optimization uses a function's body or information extracted
9430 from its body to optimize/change another function, the latter is called an
9431 impacted function of the former. If a function is patched, its impacted
9432 functions should be patched too.
9433
9434 The impacted functions are determined by the compiler's interprocedural
9435 optimizations. For example, a caller is impacted when inlining a function
9436 into its caller,
9437 cloning a function and changing its caller to call this new clone,
9438 or extracting a function's pureness/constness information to optimize
9439 its direct or indirect callers, etc.
9440
9441 Usually, the more IPA optimizations enabled, the larger the number of
9442 impacted functions for each function. In order to control the number of
9443 impacted functions and more easily compute the list of impacted function,
9444 IPA optimizations can be partially enabled at two different levels.
9445
9446 The @var{level} argument should be one of the following:
9447
9448 @table @samp
9449
9450 @item inline-clone
9451
9452 Only enable inlining and cloning optimizations, which includes inlining,
9453 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9454 As a result, when patching a function, all its callers and its clones'
9455 callers are impacted, therefore need to be patched as well.
9456
9457 @option{-flive-patching=inline-clone} disables the following optimization flags:
9458 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9459 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9460 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9461 -fipa-stack-alignment}
9462
9463 @item inline-only-static
9464
9465 Only enable inlining of static functions.
9466 As a result, when patching a static function, all its callers are impacted
9467 and so need to be patched as well.
9468
9469 In addition to all the flags that @option{-flive-patching=inline-clone}
9470 disables,
9471 @option{-flive-patching=inline-only-static} disables the following additional
9472 optimization flags:
9473 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9474
9475 @end table
9476
9477 When @option{-flive-patching} is specified without any value, the default value
9478 is @var{inline-clone}.
9479
9480 This flag is disabled by default.
9481
9482 Note that @option{-flive-patching} is not supported with link-time optimization
9483 (@option{-flto}).
9484
9485 @item -fisolate-erroneous-paths-dereference
9486 @opindex fisolate-erroneous-paths-dereference
9487 Detect paths that trigger erroneous or undefined behavior due to
9488 dereferencing a null pointer. Isolate those paths from the main control
9489 flow and turn the statement with erroneous or undefined behavior into a trap.
9490 This flag is enabled by default at @option{-O2} and higher and depends on
9491 @option{-fdelete-null-pointer-checks} also being enabled.
9492
9493 @item -fisolate-erroneous-paths-attribute
9494 @opindex fisolate-erroneous-paths-attribute
9495 Detect paths that trigger erroneous or undefined behavior due to a null value
9496 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9497 attribute. Isolate those paths from the main control flow and turn the
9498 statement with erroneous or undefined behavior into a trap. This is not
9499 currently enabled, but may be enabled by @option{-O2} in the future.
9500
9501 @item -ftree-sink
9502 @opindex ftree-sink
9503 Perform forward store motion on trees. This flag is
9504 enabled by default at @option{-O} and higher.
9505
9506 @item -ftree-bit-ccp
9507 @opindex ftree-bit-ccp
9508 Perform sparse conditional bit constant propagation on trees and propagate
9509 pointer alignment information.
9510 This pass only operates on local scalar variables and is enabled by default
9511 at @option{-O1} and higher, except for @option{-Og}.
9512 It requires that @option{-ftree-ccp} is enabled.
9513
9514 @item -ftree-ccp
9515 @opindex ftree-ccp
9516 Perform sparse conditional constant propagation (CCP) on trees. This
9517 pass only operates on local scalar variables and is enabled by default
9518 at @option{-O} and higher.
9519
9520 @item -fssa-backprop
9521 @opindex fssa-backprop
9522 Propagate information about uses of a value up the definition chain
9523 in order to simplify the definitions. For example, this pass strips
9524 sign operations if the sign of a value never matters. The flag is
9525 enabled by default at @option{-O} and higher.
9526
9527 @item -fssa-phiopt
9528 @opindex fssa-phiopt
9529 Perform pattern matching on SSA PHI nodes to optimize conditional
9530 code. This pass is enabled by default at @option{-O1} and higher,
9531 except for @option{-Og}.
9532
9533 @item -ftree-switch-conversion
9534 @opindex ftree-switch-conversion
9535 Perform conversion of simple initializations in a switch to
9536 initializations from a scalar array. This flag is enabled by default
9537 at @option{-O2} and higher.
9538
9539 @item -ftree-tail-merge
9540 @opindex ftree-tail-merge
9541 Look for identical code sequences. When found, replace one with a jump to the
9542 other. This optimization is known as tail merging or cross jumping. This flag
9543 is enabled by default at @option{-O2} and higher. The compilation time
9544 in this pass can
9545 be limited using @option{max-tail-merge-comparisons} parameter and
9546 @option{max-tail-merge-iterations} parameter.
9547
9548 @item -ftree-dce
9549 @opindex ftree-dce
9550 Perform dead code elimination (DCE) on trees. This flag is enabled by
9551 default at @option{-O} and higher.
9552
9553 @item -ftree-builtin-call-dce
9554 @opindex ftree-builtin-call-dce
9555 Perform conditional dead code elimination (DCE) for calls to built-in functions
9556 that may set @code{errno} but are otherwise free of side effects. This flag is
9557 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9558 specified.
9559
9560 @item -ffinite-loops
9561 @opindex ffinite-loops
9562 @opindex fno-finite-loops
9563 Assume that a loop with an exit will eventually take the exit and not loop
9564 indefinitely. This allows the compiler to remove loops that otherwise have
9565 no side-effects, not considering eventual endless looping as such.
9566
9567 This option is enabled by default at @option{-O2}.
9568
9569 @item -ftree-dominator-opts
9570 @opindex ftree-dominator-opts
9571 Perform a variety of simple scalar cleanups (constant/copy
9572 propagation, redundancy elimination, range propagation and expression
9573 simplification) based on a dominator tree traversal. This also
9574 performs jump threading (to reduce jumps to jumps). This flag is
9575 enabled by default at @option{-O} and higher.
9576
9577 @item -ftree-dse
9578 @opindex ftree-dse
9579 Perform dead store elimination (DSE) on trees. A dead store is a store into
9580 a memory location that is later overwritten by another store without
9581 any intervening loads. In this case the earlier store can be deleted. This
9582 flag is enabled by default at @option{-O} and higher.
9583
9584 @item -ftree-ch
9585 @opindex ftree-ch
9586 Perform loop header copying on trees. This is beneficial since it increases
9587 effectiveness of code motion optimizations. It also saves one jump. This flag
9588 is enabled by default at @option{-O} and higher. It is not enabled
9589 for @option{-Os}, since it usually increases code size.
9590
9591 @item -ftree-loop-optimize
9592 @opindex ftree-loop-optimize
9593 Perform loop optimizations on trees. This flag is enabled by default
9594 at @option{-O} and higher.
9595
9596 @item -ftree-loop-linear
9597 @itemx -floop-strip-mine
9598 @itemx -floop-block
9599 @opindex ftree-loop-linear
9600 @opindex floop-strip-mine
9601 @opindex floop-block
9602 Perform loop nest optimizations. Same as
9603 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9604 to be configured with @option{--with-isl} to enable the Graphite loop
9605 transformation infrastructure.
9606
9607 @item -fgraphite-identity
9608 @opindex fgraphite-identity
9609 Enable the identity transformation for graphite. For every SCoP we generate
9610 the polyhedral representation and transform it back to gimple. Using
9611 @option{-fgraphite-identity} we can check the costs or benefits of the
9612 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9613 are also performed by the code generator isl, like index splitting and
9614 dead code elimination in loops.
9615
9616 @item -floop-nest-optimize
9617 @opindex floop-nest-optimize
9618 Enable the isl based loop nest optimizer. This is a generic loop nest
9619 optimizer based on the Pluto optimization algorithms. It calculates a loop
9620 structure optimized for data-locality and parallelism. This option
9621 is experimental.
9622
9623 @item -floop-parallelize-all
9624 @opindex floop-parallelize-all
9625 Use the Graphite data dependence analysis to identify loops that can
9626 be parallelized. Parallelize all the loops that can be analyzed to
9627 not contain loop carried dependences without checking that it is
9628 profitable to parallelize the loops.
9629
9630 @item -ftree-coalesce-vars
9631 @opindex ftree-coalesce-vars
9632 While transforming the program out of the SSA representation, attempt to
9633 reduce copying by coalescing versions of different user-defined
9634 variables, instead of just compiler temporaries. This may severely
9635 limit the ability to debug an optimized program compiled with
9636 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9637 prevents SSA coalescing of user variables. This option is enabled by
9638 default if optimization is enabled, and it does very little otherwise.
9639
9640 @item -ftree-loop-if-convert
9641 @opindex ftree-loop-if-convert
9642 Attempt to transform conditional jumps in the innermost loops to
9643 branch-less equivalents. The intent is to remove control-flow from
9644 the innermost loops in order to improve the ability of the
9645 vectorization pass to handle these loops. This is enabled by default
9646 if vectorization is enabled.
9647
9648 @item -ftree-loop-distribution
9649 @opindex ftree-loop-distribution
9650 Perform loop distribution. This flag can improve cache performance on
9651 big loop bodies and allow further loop optimizations, like
9652 parallelization or vectorization, to take place. For example, the loop
9653 @smallexample
9654 DO I = 1, N
9655 A(I) = B(I) + C
9656 D(I) = E(I) * F
9657 ENDDO
9658 @end smallexample
9659 is transformed to
9660 @smallexample
9661 DO I = 1, N
9662 A(I) = B(I) + C
9663 ENDDO
9664 DO I = 1, N
9665 D(I) = E(I) * F
9666 ENDDO
9667 @end smallexample
9668 This flag is enabled by default at @option{-O3}.
9669 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9670
9671 @item -ftree-loop-distribute-patterns
9672 @opindex ftree-loop-distribute-patterns
9673 Perform loop distribution of patterns that can be code generated with
9674 calls to a library. This flag is enabled by default at @option{-O3}, and
9675 by @option{-fprofile-use} and @option{-fauto-profile}.
9676
9677 This pass distributes the initialization loops and generates a call to
9678 memset zero. For example, the loop
9679 @smallexample
9680 DO I = 1, N
9681 A(I) = 0
9682 B(I) = A(I) + I
9683 ENDDO
9684 @end smallexample
9685 is transformed to
9686 @smallexample
9687 DO I = 1, N
9688 A(I) = 0
9689 ENDDO
9690 DO I = 1, N
9691 B(I) = A(I) + I
9692 ENDDO
9693 @end smallexample
9694 and the initialization loop is transformed into a call to memset zero.
9695 This flag is enabled by default at @option{-O3}.
9696 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9697
9698 @item -floop-interchange
9699 @opindex floop-interchange
9700 Perform loop interchange outside of graphite. This flag can improve cache
9701 performance on loop nest and allow further loop optimizations, like
9702 vectorization, to take place. For example, the loop
9703 @smallexample
9704 for (int i = 0; i < N; i++)
9705 for (int j = 0; j < N; j++)
9706 for (int k = 0; k < N; k++)
9707 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9708 @end smallexample
9709 is transformed to
9710 @smallexample
9711 for (int i = 0; i < N; i++)
9712 for (int k = 0; k < N; k++)
9713 for (int j = 0; j < N; j++)
9714 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9715 @end smallexample
9716 This flag is enabled by default at @option{-O3}.
9717 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9718
9719 @item -floop-unroll-and-jam
9720 @opindex floop-unroll-and-jam
9721 Apply unroll and jam transformations on feasible loops. In a loop
9722 nest this unrolls the outer loop by some factor and fuses the resulting
9723 multiple inner loops. This flag is enabled by default at @option{-O3}.
9724 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9725
9726 @item -ftree-loop-im
9727 @opindex ftree-loop-im
9728 Perform loop invariant motion on trees. This pass moves only invariants that
9729 are hard to handle at RTL level (function calls, operations that expand to
9730 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9731 operands of conditions that are invariant out of the loop, so that we can use
9732 just trivial invariantness analysis in loop unswitching. The pass also includes
9733 store motion.
9734
9735 @item -ftree-loop-ivcanon
9736 @opindex ftree-loop-ivcanon
9737 Create a canonical counter for number of iterations in loops for which
9738 determining number of iterations requires complicated analysis. Later
9739 optimizations then may determine the number easily. Useful especially
9740 in connection with unrolling.
9741
9742 @item -ftree-scev-cprop
9743 @opindex ftree-scev-cprop
9744 Perform final value replacement. If a variable is modified in a loop
9745 in such a way that its value when exiting the loop can be determined using
9746 only its initial value and the number of loop iterations, replace uses of
9747 the final value by such a computation, provided it is sufficiently cheap.
9748 This reduces data dependencies and may allow further simplifications.
9749 Enabled by default at @option{-O} and higher.
9750
9751 @item -fivopts
9752 @opindex fivopts
9753 Perform induction variable optimizations (strength reduction, induction
9754 variable merging and induction variable elimination) on trees.
9755
9756 @item -ftree-parallelize-loops=n
9757 @opindex ftree-parallelize-loops
9758 Parallelize loops, i.e., split their iteration space to run in n threads.
9759 This is only possible for loops whose iterations are independent
9760 and can be arbitrarily reordered. The optimization is only
9761 profitable on multiprocessor machines, for loops that are CPU-intensive,
9762 rather than constrained e.g.@: by memory bandwidth. This option
9763 implies @option{-pthread}, and thus is only supported on targets
9764 that have support for @option{-pthread}.
9765
9766 @item -ftree-pta
9767 @opindex ftree-pta
9768 Perform function-local points-to analysis on trees. This flag is
9769 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9770
9771 @item -ftree-sra
9772 @opindex ftree-sra
9773 Perform scalar replacement of aggregates. This pass replaces structure
9774 references with scalars to prevent committing structures to memory too
9775 early. This flag is enabled by default at @option{-O1} and higher,
9776 except for @option{-Og}.
9777
9778 @item -fstore-merging
9779 @opindex fstore-merging
9780 Perform merging of narrow stores to consecutive memory addresses. This pass
9781 merges contiguous stores of immediate values narrower than a word into fewer
9782 wider stores to reduce the number of instructions. This is enabled by default
9783 at @option{-O2} and higher as well as @option{-Os}.
9784
9785 @item -ftree-ter
9786 @opindex ftree-ter
9787 Perform temporary expression replacement during the SSA->normal phase. Single
9788 use/single def temporaries are replaced at their use location with their
9789 defining expression. This results in non-GIMPLE code, but gives the expanders
9790 much more complex trees to work on resulting in better RTL generation. This is
9791 enabled by default at @option{-O} and higher.
9792
9793 @item -ftree-slsr
9794 @opindex ftree-slsr
9795 Perform straight-line strength reduction on trees. This recognizes related
9796 expressions involving multiplications and replaces them by less expensive
9797 calculations when possible. This is enabled by default at @option{-O} and
9798 higher.
9799
9800 @item -ftree-vectorize
9801 @opindex ftree-vectorize
9802 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9803 and @option{-ftree-slp-vectorize} if not explicitly specified.
9804
9805 @item -ftree-loop-vectorize
9806 @opindex ftree-loop-vectorize
9807 Perform loop vectorization on trees. This flag is enabled by default at
9808 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9809 and @option{-fauto-profile}.
9810
9811 @item -ftree-slp-vectorize
9812 @opindex ftree-slp-vectorize
9813 Perform basic block vectorization on trees. This flag is enabled by default at
9814 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9815 and @option{-fauto-profile}.
9816
9817 @item -fvect-cost-model=@var{model}
9818 @opindex fvect-cost-model
9819 Alter the cost model used for vectorization. The @var{model} argument
9820 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9821 With the @samp{unlimited} model the vectorized code-path is assumed
9822 to be profitable while with the @samp{dynamic} model a runtime check
9823 guards the vectorized code-path to enable it only for iteration
9824 counts that will likely execute faster than when executing the original
9825 scalar loop. The @samp{cheap} model disables vectorization of
9826 loops where doing so would be cost prohibitive for example due to
9827 required runtime checks for data dependence or alignment but otherwise
9828 is equal to the @samp{dynamic} model.
9829 The default cost model depends on other optimization flags and is
9830 either @samp{dynamic} or @samp{cheap}.
9831
9832 @item -fsimd-cost-model=@var{model}
9833 @opindex fsimd-cost-model
9834 Alter the cost model used for vectorization of loops marked with the OpenMP
9835 simd directive. The @var{model} argument should be one of
9836 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9837 have the same meaning as described in @option{-fvect-cost-model} and by
9838 default a cost model defined with @option{-fvect-cost-model} is used.
9839
9840 @item -ftree-vrp
9841 @opindex ftree-vrp
9842 Perform Value Range Propagation on trees. This is similar to the
9843 constant propagation pass, but instead of values, ranges of values are
9844 propagated. This allows the optimizers to remove unnecessary range
9845 checks like array bound checks and null pointer checks. This is
9846 enabled by default at @option{-O2} and higher. Null pointer check
9847 elimination is only done if @option{-fdelete-null-pointer-checks} is
9848 enabled.
9849
9850 @item -fsplit-paths
9851 @opindex fsplit-paths
9852 Split paths leading to loop backedges. This can improve dead code
9853 elimination and common subexpression elimination. This is enabled by
9854 default at @option{-O3} and above.
9855
9856 @item -fsplit-ivs-in-unroller
9857 @opindex fsplit-ivs-in-unroller
9858 Enables expression of values of induction variables in later iterations
9859 of the unrolled loop using the value in the first iteration. This breaks
9860 long dependency chains, thus improving efficiency of the scheduling passes.
9861
9862 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9863 same effect. However, that is not reliable in cases where the loop body
9864 is more complicated than a single basic block. It also does not work at all
9865 on some architectures due to restrictions in the CSE pass.
9866
9867 This optimization is enabled by default.
9868
9869 @item -fvariable-expansion-in-unroller
9870 @opindex fvariable-expansion-in-unroller
9871 With this option, the compiler creates multiple copies of some
9872 local variables when unrolling a loop, which can result in superior code.
9873
9874 This optimization is enabled by default for PowerPC targets, but disabled
9875 by default otherwise.
9876
9877 @item -fpartial-inlining
9878 @opindex fpartial-inlining
9879 Inline parts of functions. This option has any effect only
9880 when inlining itself is turned on by the @option{-finline-functions}
9881 or @option{-finline-small-functions} options.
9882
9883 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9884
9885 @item -fpredictive-commoning
9886 @opindex fpredictive-commoning
9887 Perform predictive commoning optimization, i.e., reusing computations
9888 (especially memory loads and stores) performed in previous
9889 iterations of loops.
9890
9891 This option is enabled at level @option{-O3}.
9892 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9893
9894 @item -fprefetch-loop-arrays
9895 @opindex fprefetch-loop-arrays
9896 If supported by the target machine, generate instructions to prefetch
9897 memory to improve the performance of loops that access large arrays.
9898
9899 This option may generate better or worse code; results are highly
9900 dependent on the structure of loops within the source code.
9901
9902 Disabled at level @option{-Os}.
9903
9904 @item -fno-printf-return-value
9905 @opindex fno-printf-return-value
9906 @opindex fprintf-return-value
9907 Do not substitute constants for known return value of formatted output
9908 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9909 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9910 transformation allows GCC to optimize or even eliminate branches based
9911 on the known return value of these functions called with arguments that
9912 are either constant, or whose values are known to be in a range that
9913 makes determining the exact return value possible. For example, when
9914 @option{-fprintf-return-value} is in effect, both the branch and the
9915 body of the @code{if} statement (but not the call to @code{snprint})
9916 can be optimized away when @code{i} is a 32-bit or smaller integer
9917 because the return value is guaranteed to be at most 8.
9918
9919 @smallexample
9920 char buf[9];
9921 if (snprintf (buf, "%08x", i) >= sizeof buf)
9922 @dots{}
9923 @end smallexample
9924
9925 The @option{-fprintf-return-value} option relies on other optimizations
9926 and yields best results with @option{-O2} and above. It works in tandem
9927 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9928 options. The @option{-fprintf-return-value} option is enabled by default.
9929
9930 @item -fno-peephole
9931 @itemx -fno-peephole2
9932 @opindex fno-peephole
9933 @opindex fpeephole
9934 @opindex fno-peephole2
9935 @opindex fpeephole2
9936 Disable any machine-specific peephole optimizations. The difference
9937 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9938 are implemented in the compiler; some targets use one, some use the
9939 other, a few use both.
9940
9941 @option{-fpeephole} is enabled by default.
9942 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9943
9944 @item -fno-guess-branch-probability
9945 @opindex fno-guess-branch-probability
9946 @opindex fguess-branch-probability
9947 Do not guess branch probabilities using heuristics.
9948
9949 GCC uses heuristics to guess branch probabilities if they are
9950 not provided by profiling feedback (@option{-fprofile-arcs}). These
9951 heuristics are based on the control flow graph. If some branch probabilities
9952 are specified by @code{__builtin_expect}, then the heuristics are
9953 used to guess branch probabilities for the rest of the control flow graph,
9954 taking the @code{__builtin_expect} info into account. The interactions
9955 between the heuristics and @code{__builtin_expect} can be complex, and in
9956 some cases, it may be useful to disable the heuristics so that the effects
9957 of @code{__builtin_expect} are easier to understand.
9958
9959 It is also possible to specify expected probability of the expression
9960 with @code{__builtin_expect_with_probability} built-in function.
9961
9962 The default is @option{-fguess-branch-probability} at levels
9963 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9964
9965 @item -freorder-blocks
9966 @opindex freorder-blocks
9967 Reorder basic blocks in the compiled function in order to reduce number of
9968 taken branches and improve code locality.
9969
9970 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9971
9972 @item -freorder-blocks-algorithm=@var{algorithm}
9973 @opindex freorder-blocks-algorithm
9974 Use the specified algorithm for basic block reordering. The
9975 @var{algorithm} argument can be @samp{simple}, which does not increase
9976 code size (except sometimes due to secondary effects like alignment),
9977 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9978 put all often executed code together, minimizing the number of branches
9979 executed by making extra copies of code.
9980
9981 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9982 @samp{stc} at levels @option{-O2}, @option{-O3}.
9983
9984 @item -freorder-blocks-and-partition
9985 @opindex freorder-blocks-and-partition
9986 In addition to reordering basic blocks in the compiled function, in order
9987 to reduce number of taken branches, partitions hot and cold basic blocks
9988 into separate sections of the assembly and @file{.o} files, to improve
9989 paging and cache locality performance.
9990
9991 This optimization is automatically turned off in the presence of
9992 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9993 section attribute and on any architecture that does not support named
9994 sections. When @option{-fsplit-stack} is used this option is not
9995 enabled by default (to avoid linker errors), but may be enabled
9996 explicitly (if using a working linker).
9997
9998 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9999
10000 @item -freorder-functions
10001 @opindex freorder-functions
10002 Reorder functions in the object file in order to
10003 improve code locality. This is implemented by using special
10004 subsections @code{.text.hot} for most frequently executed functions and
10005 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10006 the linker so object file format must support named sections and linker must
10007 place them in a reasonable way.
10008
10009 This option isn't effective unless you either provide profile feedback
10010 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10011 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10012
10013 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10014
10015 @item -fstrict-aliasing
10016 @opindex fstrict-aliasing
10017 Allow the compiler to assume the strictest aliasing rules applicable to
10018 the language being compiled. For C (and C++), this activates
10019 optimizations based on the type of expressions. In particular, an
10020 object of one type is assumed never to reside at the same address as an
10021 object of a different type, unless the types are almost the same. For
10022 example, an @code{unsigned int} can alias an @code{int}, but not a
10023 @code{void*} or a @code{double}. A character type may alias any other
10024 type.
10025
10026 @anchor{Type-punning}Pay special attention to code like this:
10027 @smallexample
10028 union a_union @{
10029 int i;
10030 double d;
10031 @};
10032
10033 int f() @{
10034 union a_union t;
10035 t.d = 3.0;
10036 return t.i;
10037 @}
10038 @end smallexample
10039 The practice of reading from a different union member than the one most
10040 recently written to (called ``type-punning'') is common. Even with
10041 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10042 is accessed through the union type. So, the code above works as
10043 expected. @xref{Structures unions enumerations and bit-fields
10044 implementation}. However, this code might not:
10045 @smallexample
10046 int f() @{
10047 union a_union t;
10048 int* ip;
10049 t.d = 3.0;
10050 ip = &t.i;
10051 return *ip;
10052 @}
10053 @end smallexample
10054
10055 Similarly, access by taking the address, casting the resulting pointer
10056 and dereferencing the result has undefined behavior, even if the cast
10057 uses a union type, e.g.:
10058 @smallexample
10059 int f() @{
10060 double d = 3.0;
10061 return ((union a_union *) &d)->i;
10062 @}
10063 @end smallexample
10064
10065 The @option{-fstrict-aliasing} option is enabled at levels
10066 @option{-O2}, @option{-O3}, @option{-Os}.
10067
10068 @item -falign-functions
10069 @itemx -falign-functions=@var{n}
10070 @itemx -falign-functions=@var{n}:@var{m}
10071 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10072 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10073 @opindex falign-functions
10074 Align the start of functions to the next power-of-two greater than
10075 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10076 the first @var{m} bytes of the function can be fetched by the CPU
10077 without crossing an @var{n}-byte alignment boundary.
10078
10079 If @var{m} is not specified, it defaults to @var{n}.
10080
10081 Examples: @option{-falign-functions=32} aligns functions to the next
10082 32-byte boundary, @option{-falign-functions=24} aligns to the next
10083 32-byte boundary only if this can be done by skipping 23 bytes or less,
10084 @option{-falign-functions=32:7} aligns to the next
10085 32-byte boundary only if this can be done by skipping 6 bytes or less.
10086
10087 The second pair of @var{n2}:@var{m2} values allows you to specify
10088 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10089 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10090 otherwise aligns to the next 32-byte boundary if this can be done
10091 by skipping 2 bytes or less.
10092 If @var{m2} is not specified, it defaults to @var{n2}.
10093
10094 Some assemblers only support this flag when @var{n} is a power of two;
10095 in that case, it is rounded up.
10096
10097 @option{-fno-align-functions} and @option{-falign-functions=1} are
10098 equivalent and mean that functions are not aligned.
10099
10100 If @var{n} is not specified or is zero, use a machine-dependent default.
10101 The maximum allowed @var{n} option value is 65536.
10102
10103 Enabled at levels @option{-O2}, @option{-O3}.
10104
10105 @item -flimit-function-alignment
10106 If this option is enabled, the compiler tries to avoid unnecessarily
10107 overaligning functions. It attempts to instruct the assembler to align
10108 by the amount specified by @option{-falign-functions}, but not to
10109 skip more bytes than the size of the function.
10110
10111 @item -falign-labels
10112 @itemx -falign-labels=@var{n}
10113 @itemx -falign-labels=@var{n}:@var{m}
10114 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10115 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10116 @opindex falign-labels
10117 Align all branch targets to a power-of-two boundary.
10118
10119 Parameters of this option are analogous to the @option{-falign-functions} option.
10120 @option{-fno-align-labels} and @option{-falign-labels=1} are
10121 equivalent and mean that labels are not aligned.
10122
10123 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10124 are greater than this value, then their values are used instead.
10125
10126 If @var{n} is not specified or is zero, use a machine-dependent default
10127 which is very likely to be @samp{1}, meaning no alignment.
10128 The maximum allowed @var{n} option value is 65536.
10129
10130 Enabled at levels @option{-O2}, @option{-O3}.
10131
10132 @item -falign-loops
10133 @itemx -falign-loops=@var{n}
10134 @itemx -falign-loops=@var{n}:@var{m}
10135 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10136 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10137 @opindex falign-loops
10138 Align loops to a power-of-two boundary. If the loops are executed
10139 many times, this makes up for any execution of the dummy padding
10140 instructions.
10141
10142 Parameters of this option are analogous to the @option{-falign-functions} option.
10143 @option{-fno-align-loops} and @option{-falign-loops=1} are
10144 equivalent and mean that loops are not aligned.
10145 The maximum allowed @var{n} option value is 65536.
10146
10147 If @var{n} is not specified or is zero, use a machine-dependent default.
10148
10149 Enabled at levels @option{-O2}, @option{-O3}.
10150
10151 @item -falign-jumps
10152 @itemx -falign-jumps=@var{n}
10153 @itemx -falign-jumps=@var{n}:@var{m}
10154 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10155 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10156 @opindex falign-jumps
10157 Align branch targets to a power-of-two boundary, for branch targets
10158 where the targets can only be reached by jumping. In this case,
10159 no dummy operations need be executed.
10160
10161 Parameters of this option are analogous to the @option{-falign-functions} option.
10162 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10163 equivalent and mean that loops are not aligned.
10164
10165 If @var{n} is not specified or is zero, use a machine-dependent default.
10166 The maximum allowed @var{n} option value is 65536.
10167
10168 Enabled at levels @option{-O2}, @option{-O3}.
10169
10170 @item -funit-at-a-time
10171 @opindex funit-at-a-time
10172 This option is left for compatibility reasons. @option{-funit-at-a-time}
10173 has no effect, while @option{-fno-unit-at-a-time} implies
10174 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10175
10176 Enabled by default.
10177
10178 @item -fno-toplevel-reorder
10179 @opindex fno-toplevel-reorder
10180 @opindex ftoplevel-reorder
10181 Do not reorder top-level functions, variables, and @code{asm}
10182 statements. Output them in the same order that they appear in the
10183 input file. When this option is used, unreferenced static variables
10184 are not removed. This option is intended to support existing code
10185 that relies on a particular ordering. For new code, it is better to
10186 use attributes when possible.
10187
10188 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10189 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10190 Additionally @option{-fno-toplevel-reorder} implies
10191 @option{-fno-section-anchors}.
10192
10193 @item -fweb
10194 @opindex fweb
10195 Constructs webs as commonly used for register allocation purposes and assign
10196 each web individual pseudo register. This allows the register allocation pass
10197 to operate on pseudos directly, but also strengthens several other optimization
10198 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10199 however, make debugging impossible, since variables no longer stay in a
10200 ``home register''.
10201
10202 Enabled by default with @option{-funroll-loops}.
10203
10204 @item -fwhole-program
10205 @opindex fwhole-program
10206 Assume that the current compilation unit represents the whole program being
10207 compiled. All public functions and variables with the exception of @code{main}
10208 and those merged by attribute @code{externally_visible} become static functions
10209 and in effect are optimized more aggressively by interprocedural optimizers.
10210
10211 This option should not be used in combination with @option{-flto}.
10212 Instead relying on a linker plugin should provide safer and more precise
10213 information.
10214
10215 @item -flto[=@var{n}]
10216 @opindex flto
10217 This option runs the standard link-time optimizer. When invoked
10218 with source code, it generates GIMPLE (one of GCC's internal
10219 representations) and writes it to special ELF sections in the object
10220 file. When the object files are linked together, all the function
10221 bodies are read from these ELF sections and instantiated as if they
10222 had been part of the same translation unit.
10223
10224 To use the link-time optimizer, @option{-flto} and optimization
10225 options should be specified at compile time and during the final link.
10226 It is recommended that you compile all the files participating in the
10227 same link with the same options and also specify those options at
10228 link time.
10229 For example:
10230
10231 @smallexample
10232 gcc -c -O2 -flto foo.c
10233 gcc -c -O2 -flto bar.c
10234 gcc -o myprog -flto -O2 foo.o bar.o
10235 @end smallexample
10236
10237 The first two invocations to GCC save a bytecode representation
10238 of GIMPLE into special ELF sections inside @file{foo.o} and
10239 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10240 @file{foo.o} and @file{bar.o}, merges the two files into a single
10241 internal image, and compiles the result as usual. Since both
10242 @file{foo.o} and @file{bar.o} are merged into a single image, this
10243 causes all the interprocedural analyses and optimizations in GCC to
10244 work across the two files as if they were a single one. This means,
10245 for example, that the inliner is able to inline functions in
10246 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10247
10248 Another (simpler) way to enable link-time optimization is:
10249
10250 @smallexample
10251 gcc -o myprog -flto -O2 foo.c bar.c
10252 @end smallexample
10253
10254 The above generates bytecode for @file{foo.c} and @file{bar.c},
10255 merges them together into a single GIMPLE representation and optimizes
10256 them as usual to produce @file{myprog}.
10257
10258 The important thing to keep in mind is that to enable link-time
10259 optimizations you need to use the GCC driver to perform the link step.
10260 GCC automatically performs link-time optimization if any of the
10261 objects involved were compiled with the @option{-flto} command-line option.
10262 You can always override
10263 the automatic decision to do link-time optimization
10264 by passing @option{-fno-lto} to the link command.
10265
10266 To make whole program optimization effective, it is necessary to make
10267 certain whole program assumptions. The compiler needs to know
10268 what functions and variables can be accessed by libraries and runtime
10269 outside of the link-time optimized unit. When supported by the linker,
10270 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10271 to the compiler about used and externally visible symbols. When
10272 the linker plugin is not available, @option{-fwhole-program} should be
10273 used to allow the compiler to make these assumptions, which leads
10274 to more aggressive optimization decisions.
10275
10276 When a file is compiled with @option{-flto} without
10277 @option{-fuse-linker-plugin}, the generated object file is larger than
10278 a regular object file because it contains GIMPLE bytecodes and the usual
10279 final code (see @option{-ffat-lto-objects}. This means that
10280 object files with LTO information can be linked as normal object
10281 files; if @option{-fno-lto} is passed to the linker, no
10282 interprocedural optimizations are applied. Note that when
10283 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10284 but you cannot perform a regular, non-LTO link on them.
10285
10286 When producing the final binary, GCC only
10287 applies link-time optimizations to those files that contain bytecode.
10288 Therefore, you can mix and match object files and libraries with
10289 GIMPLE bytecodes and final object code. GCC automatically selects
10290 which files to optimize in LTO mode and which files to link without
10291 further processing.
10292
10293 Generally, options specified at link time override those
10294 specified at compile time, although in some cases GCC attempts to infer
10295 link-time options from the settings used to compile the input files.
10296
10297 If you do not specify an optimization level option @option{-O} at
10298 link time, then GCC uses the highest optimization level
10299 used when compiling the object files. Note that it is generally
10300 ineffective to specify an optimization level option only at link time and
10301 not at compile time, for two reasons. First, compiling without
10302 optimization suppresses compiler passes that gather information
10303 needed for effective optimization at link time. Second, some early
10304 optimization passes can be performed only at compile time and
10305 not at link time.
10306
10307 There are some code generation flags preserved by GCC when
10308 generating bytecodes, as they need to be used during the final link.
10309 Currently, the following options and their settings are taken from
10310 the first object file that explicitly specifies them:
10311 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10312 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10313 and all the @option{-m} target flags.
10314
10315 Certain ABI-changing flags are required to match in all compilation units,
10316 and trying to override this at link time with a conflicting value
10317 is ignored. This includes options such as @option{-freg-struct-return}
10318 and @option{-fpcc-struct-return}.
10319
10320 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10321 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10322 are passed through to the link stage and merged conservatively for
10323 conflicting translation units. Specifically
10324 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10325 precedence; and for example @option{-ffp-contract=off} takes precedence
10326 over @option{-ffp-contract=fast}. You can override them at link time.
10327
10328 If LTO encounters objects with C linkage declared with incompatible
10329 types in separate translation units to be linked together (undefined
10330 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10331 issued. The behavior is still undefined at run time. Similar
10332 diagnostics may be raised for other languages.
10333
10334 Another feature of LTO is that it is possible to apply interprocedural
10335 optimizations on files written in different languages:
10336
10337 @smallexample
10338 gcc -c -flto foo.c
10339 g++ -c -flto bar.cc
10340 gfortran -c -flto baz.f90
10341 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10342 @end smallexample
10343
10344 Notice that the final link is done with @command{g++} to get the C++
10345 runtime libraries and @option{-lgfortran} is added to get the Fortran
10346 runtime libraries. In general, when mixing languages in LTO mode, you
10347 should use the same link command options as when mixing languages in a
10348 regular (non-LTO) compilation.
10349
10350 If object files containing GIMPLE bytecode are stored in a library archive, say
10351 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10352 are using a linker with plugin support. To create static libraries suitable
10353 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10354 and @command{ranlib};
10355 to show the symbols of object files with GIMPLE bytecode, use
10356 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10357 and @command{nm} have been compiled with plugin support. At link time, use the
10358 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10359 the LTO optimization process:
10360
10361 @smallexample
10362 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10363 @end smallexample
10364
10365 With the linker plugin enabled, the linker extracts the needed
10366 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10367 to make them part of the aggregated GIMPLE image to be optimized.
10368
10369 If you are not using a linker with plugin support and/or do not
10370 enable the linker plugin, then the objects inside @file{libfoo.a}
10371 are extracted and linked as usual, but they do not participate
10372 in the LTO optimization process. In order to make a static library suitable
10373 for both LTO optimization and usual linkage, compile its object files with
10374 @option{-flto} @option{-ffat-lto-objects}.
10375
10376 Link-time optimizations do not require the presence of the whole program to
10377 operate. If the program does not require any symbols to be exported, it is
10378 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10379 the interprocedural optimizers to use more aggressive assumptions which may
10380 lead to improved optimization opportunities.
10381 Use of @option{-fwhole-program} is not needed when linker plugin is
10382 active (see @option{-fuse-linker-plugin}).
10383
10384 The current implementation of LTO makes no
10385 attempt to generate bytecode that is portable between different
10386 types of hosts. The bytecode files are versioned and there is a
10387 strict version check, so bytecode files generated in one version of
10388 GCC do not work with an older or newer version of GCC.
10389
10390 Link-time optimization does not work well with generation of debugging
10391 information on systems other than those using a combination of ELF and
10392 DWARF.
10393
10394 If you specify the optional @var{n}, the optimization and code
10395 generation done at link time is executed in parallel using @var{n}
10396 parallel jobs by utilizing an installed @command{make} program. The
10397 environment variable @env{MAKE} may be used to override the program
10398 used. The default value for @var{n} is 1.
10399
10400 You can also specify @option{-flto=jobserver} to use GNU make's
10401 job server mode to determine the number of parallel jobs. This
10402 is useful when the Makefile calling GCC is already executing in parallel.
10403 You must prepend a @samp{+} to the command recipe in the parent Makefile
10404 for this to work. This option likely only works if @env{MAKE} is
10405 GNU make.
10406
10407 @item -flto-partition=@var{alg}
10408 @opindex flto-partition
10409 Specify the partitioning algorithm used by the link-time optimizer.
10410 The value is either @samp{1to1} to specify a partitioning mirroring
10411 the original source files or @samp{balanced} to specify partitioning
10412 into equally sized chunks (whenever possible) or @samp{max} to create
10413 new partition for every symbol where possible. Specifying @samp{none}
10414 as an algorithm disables partitioning and streaming completely.
10415 The default value is @samp{balanced}. While @samp{1to1} can be used
10416 as an workaround for various code ordering issues, the @samp{max}
10417 partitioning is intended for internal testing only.
10418 The value @samp{one} specifies that exactly one partition should be
10419 used while the value @samp{none} bypasses partitioning and executes
10420 the link-time optimization step directly from the WPA phase.
10421
10422 @item -flto-compression-level=@var{n}
10423 @opindex flto-compression-level
10424 This option specifies the level of compression used for intermediate
10425 language written to LTO object files, and is only meaningful in
10426 conjunction with LTO mode (@option{-flto}). Valid
10427 values are 0 (no compression) to 9 (maximum compression). Values
10428 outside this range are clamped to either 0 or 9. If the option is not
10429 given, a default balanced compression setting is used.
10430
10431 @item -fuse-linker-plugin
10432 @opindex fuse-linker-plugin
10433 Enables the use of a linker plugin during link-time optimization. This
10434 option relies on plugin support in the linker, which is available in gold
10435 or in GNU ld 2.21 or newer.
10436
10437 This option enables the extraction of object files with GIMPLE bytecode out
10438 of library archives. This improves the quality of optimization by exposing
10439 more code to the link-time optimizer. This information specifies what
10440 symbols can be accessed externally (by non-LTO object or during dynamic
10441 linking). Resulting code quality improvements on binaries (and shared
10442 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10443 See @option{-flto} for a description of the effect of this flag and how to
10444 use it.
10445
10446 This option is enabled by default when LTO support in GCC is enabled
10447 and GCC was configured for use with
10448 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10449
10450 @item -ffat-lto-objects
10451 @opindex ffat-lto-objects
10452 Fat LTO objects are object files that contain both the intermediate language
10453 and the object code. This makes them usable for both LTO linking and normal
10454 linking. This option is effective only when compiling with @option{-flto}
10455 and is ignored at link time.
10456
10457 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10458 requires the complete toolchain to be aware of LTO. It requires a linker with
10459 linker plugin support for basic functionality. Additionally,
10460 @command{nm}, @command{ar} and @command{ranlib}
10461 need to support linker plugins to allow a full-featured build environment
10462 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10463 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10464 to these tools. With non fat LTO makefiles need to be modified to use them.
10465
10466 Note that modern binutils provide plugin auto-load mechanism.
10467 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10468 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10469 @command{gcc-ranlib}).
10470
10471 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10472 support.
10473
10474 @item -fcompare-elim
10475 @opindex fcompare-elim
10476 After register allocation and post-register allocation instruction splitting,
10477 identify arithmetic instructions that compute processor flags similar to a
10478 comparison operation based on that arithmetic. If possible, eliminate the
10479 explicit comparison operation.
10480
10481 This pass only applies to certain targets that cannot explicitly represent
10482 the comparison operation before register allocation is complete.
10483
10484 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10485
10486 @item -fcprop-registers
10487 @opindex fcprop-registers
10488 After register allocation and post-register allocation instruction splitting,
10489 perform a copy-propagation pass to try to reduce scheduling dependencies
10490 and occasionally eliminate the copy.
10491
10492 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10493
10494 @item -fprofile-correction
10495 @opindex fprofile-correction
10496 Profiles collected using an instrumented binary for multi-threaded programs may
10497 be inconsistent due to missed counter updates. When this option is specified,
10498 GCC uses heuristics to correct or smooth out such inconsistencies. By
10499 default, GCC emits an error message when an inconsistent profile is detected.
10500
10501 This option is enabled by @option{-fauto-profile}.
10502
10503 @item -fprofile-use
10504 @itemx -fprofile-use=@var{path}
10505 @opindex fprofile-use
10506 Enable profile feedback-directed optimizations,
10507 and the following optimizations, many of which
10508 are generally profitable only with profile feedback available:
10509
10510 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10511 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10512 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10513 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10514 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10515 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10516 -fprofile-reorder-functions}
10517
10518 Before you can use this option, you must first generate profiling information.
10519 @xref{Instrumentation Options}, for information about the
10520 @option{-fprofile-generate} option.
10521
10522 By default, GCC emits an error message if the feedback profiles do not
10523 match the source code. This error can be turned into a warning by using
10524 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10525 optimized code. Additionally, by default, GCC also emits a warning message if
10526 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10527
10528 If @var{path} is specified, GCC looks at the @var{path} to find
10529 the profile feedback data files. See @option{-fprofile-dir}.
10530
10531 @item -fauto-profile
10532 @itemx -fauto-profile=@var{path}
10533 @opindex fauto-profile
10534 Enable sampling-based feedback-directed optimizations,
10535 and the following optimizations,
10536 many of which are generally profitable only with profile feedback available:
10537
10538 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10539 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10540 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10541 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10542 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10543 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10544 -fprofile-correction}
10545
10546 @var{path} is the name of a file containing AutoFDO profile information.
10547 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10548
10549 Producing an AutoFDO profile data file requires running your program
10550 with the @command{perf} utility on a supported GNU/Linux target system.
10551 For more information, see @uref{https://perf.wiki.kernel.org/}.
10552
10553 E.g.
10554 @smallexample
10555 perf record -e br_inst_retired:near_taken -b -o perf.data \
10556 -- your_program
10557 @end smallexample
10558
10559 Then use the @command{create_gcov} tool to convert the raw profile data
10560 to a format that can be used by GCC.@ You must also supply the
10561 unstripped binary for your program to this tool.
10562 See @uref{https://github.com/google/autofdo}.
10563
10564 E.g.
10565 @smallexample
10566 create_gcov --binary=your_program.unstripped --profile=perf.data \
10567 --gcov=profile.afdo
10568 @end smallexample
10569 @end table
10570
10571 The following options control compiler behavior regarding floating-point
10572 arithmetic. These options trade off between speed and
10573 correctness. All must be specifically enabled.
10574
10575 @table @gcctabopt
10576 @item -ffloat-store
10577 @opindex ffloat-store
10578 Do not store floating-point variables in registers, and inhibit other
10579 options that might change whether a floating-point value is taken from a
10580 register or memory.
10581
10582 @cindex floating-point precision
10583 This option prevents undesirable excess precision on machines such as
10584 the 68000 where the floating registers (of the 68881) keep more
10585 precision than a @code{double} is supposed to have. Similarly for the
10586 x86 architecture. For most programs, the excess precision does only
10587 good, but a few programs rely on the precise definition of IEEE floating
10588 point. Use @option{-ffloat-store} for such programs, after modifying
10589 them to store all pertinent intermediate computations into variables.
10590
10591 @item -fexcess-precision=@var{style}
10592 @opindex fexcess-precision
10593 This option allows further control over excess precision on machines
10594 where floating-point operations occur in a format with more precision or
10595 range than the IEEE standard and interchange floating-point types. By
10596 default, @option{-fexcess-precision=fast} is in effect; this means that
10597 operations may be carried out in a wider precision than the types specified
10598 in the source if that would result in faster code, and it is unpredictable
10599 when rounding to the types specified in the source code takes place.
10600 When compiling C, if @option{-fexcess-precision=standard} is specified then
10601 excess precision follows the rules specified in ISO C99; in particular,
10602 both casts and assignments cause values to be rounded to their
10603 semantic types (whereas @option{-ffloat-store} only affects
10604 assignments). This option is enabled by default for C if a strict
10605 conformance option such as @option{-std=c99} is used.
10606 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10607 regardless of whether a strict conformance option is used.
10608
10609 @opindex mfpmath
10610 @option{-fexcess-precision=standard} is not implemented for languages
10611 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10612 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10613 semantics apply without excess precision, and in the latter, rounding
10614 is unpredictable.
10615
10616 @item -ffast-math
10617 @opindex ffast-math
10618 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10619 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10620 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10621 @option{-fexcess-precision=fast}.
10622
10623 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10624
10625 This option is not turned on by any @option{-O} option besides
10626 @option{-Ofast} since it can result in incorrect output for programs
10627 that depend on an exact implementation of IEEE or ISO rules/specifications
10628 for math functions. It may, however, yield faster code for programs
10629 that do not require the guarantees of these specifications.
10630
10631 @item -fno-math-errno
10632 @opindex fno-math-errno
10633 @opindex fmath-errno
10634 Do not set @code{errno} after calling math functions that are executed
10635 with a single instruction, e.g., @code{sqrt}. A program that relies on
10636 IEEE exceptions for math error handling may want to use this flag
10637 for speed while maintaining IEEE arithmetic compatibility.
10638
10639 This option is not turned on by any @option{-O} option since
10640 it can result in incorrect output for programs that depend on
10641 an exact implementation of IEEE or ISO rules/specifications for
10642 math functions. It may, however, yield faster code for programs
10643 that do not require the guarantees of these specifications.
10644
10645 The default is @option{-fmath-errno}.
10646
10647 On Darwin systems, the math library never sets @code{errno}. There is
10648 therefore no reason for the compiler to consider the possibility that
10649 it might, and @option{-fno-math-errno} is the default.
10650
10651 @item -funsafe-math-optimizations
10652 @opindex funsafe-math-optimizations
10653
10654 Allow optimizations for floating-point arithmetic that (a) assume
10655 that arguments and results are valid and (b) may violate IEEE or
10656 ANSI standards. When used at link time, it may include libraries
10657 or startup files that change the default FPU control word or other
10658 similar optimizations.
10659
10660 This option is not turned on by any @option{-O} option since
10661 it can result in incorrect output for programs that depend on
10662 an exact implementation of IEEE or ISO rules/specifications for
10663 math functions. It may, however, yield faster code for programs
10664 that do not require the guarantees of these specifications.
10665 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10666 @option{-fassociative-math} and @option{-freciprocal-math}.
10667
10668 The default is @option{-fno-unsafe-math-optimizations}.
10669
10670 @item -fassociative-math
10671 @opindex fassociative-math
10672
10673 Allow re-association of operands in series of floating-point operations.
10674 This violates the ISO C and C++ language standard by possibly changing
10675 computation result. NOTE: re-ordering may change the sign of zero as
10676 well as ignore NaNs and inhibit or create underflow or overflow (and
10677 thus cannot be used on code that relies on rounding behavior like
10678 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10679 and thus may not be used when ordered comparisons are required.
10680 This option requires that both @option{-fno-signed-zeros} and
10681 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10682 much sense with @option{-frounding-math}. For Fortran the option
10683 is automatically enabled when both @option{-fno-signed-zeros} and
10684 @option{-fno-trapping-math} are in effect.
10685
10686 The default is @option{-fno-associative-math}.
10687
10688 @item -freciprocal-math
10689 @opindex freciprocal-math
10690
10691 Allow the reciprocal of a value to be used instead of dividing by
10692 the value if this enables optimizations. For example @code{x / y}
10693 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10694 is subject to common subexpression elimination. Note that this loses
10695 precision and increases the number of flops operating on the value.
10696
10697 The default is @option{-fno-reciprocal-math}.
10698
10699 @item -ffinite-math-only
10700 @opindex ffinite-math-only
10701 Allow optimizations for floating-point arithmetic that assume
10702 that arguments and results are not NaNs or +-Infs.
10703
10704 This option is not turned on by any @option{-O} option since
10705 it can result in incorrect output for programs that depend on
10706 an exact implementation of IEEE or ISO rules/specifications for
10707 math functions. It may, however, yield faster code for programs
10708 that do not require the guarantees of these specifications.
10709
10710 The default is @option{-fno-finite-math-only}.
10711
10712 @item -fno-signed-zeros
10713 @opindex fno-signed-zeros
10714 @opindex fsigned-zeros
10715 Allow optimizations for floating-point arithmetic that ignore the
10716 signedness of zero. IEEE arithmetic specifies the behavior of
10717 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10718 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10719 This option implies that the sign of a zero result isn't significant.
10720
10721 The default is @option{-fsigned-zeros}.
10722
10723 @item -fno-trapping-math
10724 @opindex fno-trapping-math
10725 @opindex ftrapping-math
10726 Compile code assuming that floating-point operations cannot generate
10727 user-visible traps. These traps include division by zero, overflow,
10728 underflow, inexact result and invalid operation. This option requires
10729 that @option{-fno-signaling-nans} be in effect. Setting this option may
10730 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10731
10732 This option should never be turned on by any @option{-O} option since
10733 it can result in incorrect output for programs that depend on
10734 an exact implementation of IEEE or ISO rules/specifications for
10735 math functions.
10736
10737 The default is @option{-ftrapping-math}.
10738
10739 @item -frounding-math
10740 @opindex frounding-math
10741 Disable transformations and optimizations that assume default floating-point
10742 rounding behavior. This is round-to-zero for all floating point
10743 to integer conversions, and round-to-nearest for all other arithmetic
10744 truncations. This option should be specified for programs that change
10745 the FP rounding mode dynamically, or that may be executed with a
10746 non-default rounding mode. This option disables constant folding of
10747 floating-point expressions at compile time (which may be affected by
10748 rounding mode) and arithmetic transformations that are unsafe in the
10749 presence of sign-dependent rounding modes.
10750
10751 The default is @option{-fno-rounding-math}.
10752
10753 This option is experimental and does not currently guarantee to
10754 disable all GCC optimizations that are affected by rounding mode.
10755 Future versions of GCC may provide finer control of this setting
10756 using C99's @code{FENV_ACCESS} pragma. This command-line option
10757 will be used to specify the default state for @code{FENV_ACCESS}.
10758
10759 @item -fsignaling-nans
10760 @opindex fsignaling-nans
10761 Compile code assuming that IEEE signaling NaNs may generate user-visible
10762 traps during floating-point operations. Setting this option disables
10763 optimizations that may change the number of exceptions visible with
10764 signaling NaNs. This option implies @option{-ftrapping-math}.
10765
10766 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10767 be defined.
10768
10769 The default is @option{-fno-signaling-nans}.
10770
10771 This option is experimental and does not currently guarantee to
10772 disable all GCC optimizations that affect signaling NaN behavior.
10773
10774 @item -fno-fp-int-builtin-inexact
10775 @opindex fno-fp-int-builtin-inexact
10776 @opindex ffp-int-builtin-inexact
10777 Do not allow the built-in functions @code{ceil}, @code{floor},
10778 @code{round} and @code{trunc}, and their @code{float} and @code{long
10779 double} variants, to generate code that raises the ``inexact''
10780 floating-point exception for noninteger arguments. ISO C99 and C11
10781 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10782 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10783 functions to do so.
10784
10785 The default is @option{-ffp-int-builtin-inexact}, allowing the
10786 exception to be raised. This option does nothing unless
10787 @option{-ftrapping-math} is in effect.
10788
10789 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10790 generate a call to a library function then the ``inexact'' exception
10791 may be raised if the library implementation does not follow TS 18661.
10792
10793 @item -fsingle-precision-constant
10794 @opindex fsingle-precision-constant
10795 Treat floating-point constants as single precision instead of
10796 implicitly converting them to double-precision constants.
10797
10798 @item -fcx-limited-range
10799 @opindex fcx-limited-range
10800 When enabled, this option states that a range reduction step is not
10801 needed when performing complex division. Also, there is no checking
10802 whether the result of a complex multiplication or division is @code{NaN
10803 + I*NaN}, with an attempt to rescue the situation in that case. The
10804 default is @option{-fno-cx-limited-range}, but is enabled by
10805 @option{-ffast-math}.
10806
10807 This option controls the default setting of the ISO C99
10808 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10809 all languages.
10810
10811 @item -fcx-fortran-rules
10812 @opindex fcx-fortran-rules
10813 Complex multiplication and division follow Fortran rules. Range
10814 reduction is done as part of complex division, but there is no checking
10815 whether the result of a complex multiplication or division is @code{NaN
10816 + I*NaN}, with an attempt to rescue the situation in that case.
10817
10818 The default is @option{-fno-cx-fortran-rules}.
10819
10820 @end table
10821
10822 The following options control optimizations that may improve
10823 performance, but are not enabled by any @option{-O} options. This
10824 section includes experimental options that may produce broken code.
10825
10826 @table @gcctabopt
10827 @item -fbranch-probabilities
10828 @opindex fbranch-probabilities
10829 After running a program compiled with @option{-fprofile-arcs}
10830 (@pxref{Instrumentation Options}),
10831 you can compile it a second time using
10832 @option{-fbranch-probabilities}, to improve optimizations based on
10833 the number of times each branch was taken. When a program
10834 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10835 counts to a file called @file{@var{sourcename}.gcda} for each source
10836 file. The information in this data file is very dependent on the
10837 structure of the generated code, so you must use the same source code
10838 and the same optimization options for both compilations.
10839
10840 With @option{-fbranch-probabilities}, GCC puts a
10841 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10842 These can be used to improve optimization. Currently, they are only
10843 used in one place: in @file{reorg.c}, instead of guessing which path a
10844 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10845 exactly determine which path is taken more often.
10846
10847 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10848
10849 @item -fprofile-values
10850 @opindex fprofile-values
10851 If combined with @option{-fprofile-arcs}, it adds code so that some
10852 data about values of expressions in the program is gathered.
10853
10854 With @option{-fbranch-probabilities}, it reads back the data gathered
10855 from profiling values of expressions for usage in optimizations.
10856
10857 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10858 @option{-fauto-profile}.
10859
10860 @item -fprofile-reorder-functions
10861 @opindex fprofile-reorder-functions
10862 Function reordering based on profile instrumentation collects
10863 first time of execution of a function and orders these functions
10864 in ascending order.
10865
10866 Enabled with @option{-fprofile-use}.
10867
10868 @item -fvpt
10869 @opindex fvpt
10870 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10871 to add code to gather information about values of expressions.
10872
10873 With @option{-fbranch-probabilities}, it reads back the data gathered
10874 and actually performs the optimizations based on them.
10875 Currently the optimizations include specialization of division operations
10876 using the knowledge about the value of the denominator.
10877
10878 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10879
10880 @item -frename-registers
10881 @opindex frename-registers
10882 Attempt to avoid false dependencies in scheduled code by making use
10883 of registers left over after register allocation. This optimization
10884 most benefits processors with lots of registers. Depending on the
10885 debug information format adopted by the target, however, it can
10886 make debugging impossible, since variables no longer stay in
10887 a ``home register''.
10888
10889 Enabled by default with @option{-funroll-loops}.
10890
10891 @item -fschedule-fusion
10892 @opindex fschedule-fusion
10893 Performs a target dependent pass over the instruction stream to schedule
10894 instructions of same type together because target machine can execute them
10895 more efficiently if they are adjacent to each other in the instruction flow.
10896
10897 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10898
10899 @item -ftracer
10900 @opindex ftracer
10901 Perform tail duplication to enlarge superblock size. This transformation
10902 simplifies the control flow of the function allowing other optimizations to do
10903 a better job.
10904
10905 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10906
10907 @item -funroll-loops
10908 @opindex funroll-loops
10909 Unroll loops whose number of iterations can be determined at compile time or
10910 upon entry to the loop. @option{-funroll-loops} implies
10911 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10912 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10913 a small constant number of iterations). This option makes code larger, and may
10914 or may not make it run faster.
10915
10916 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10917
10918 @item -funroll-all-loops
10919 @opindex funroll-all-loops
10920 Unroll all loops, even if their number of iterations is uncertain when
10921 the loop is entered. This usually makes programs run more slowly.
10922 @option{-funroll-all-loops} implies the same options as
10923 @option{-funroll-loops}.
10924
10925 @item -fpeel-loops
10926 @opindex fpeel-loops
10927 Peels loops for which there is enough information that they do not
10928 roll much (from profile feedback or static analysis). It also turns on
10929 complete loop peeling (i.e.@: complete removal of loops with small constant
10930 number of iterations).
10931
10932 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10933
10934 @item -fmove-loop-invariants
10935 @opindex fmove-loop-invariants
10936 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10937 at level @option{-O1} and higher, except for @option{-Og}.
10938
10939 @item -fsplit-loops
10940 @opindex fsplit-loops
10941 Split a loop into two if it contains a condition that's always true
10942 for one side of the iteration space and false for the other.
10943
10944 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10945
10946 @item -funswitch-loops
10947 @opindex funswitch-loops
10948 Move branches with loop invariant conditions out of the loop, with duplicates
10949 of the loop on both branches (modified according to result of the condition).
10950
10951 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10952
10953 @item -fversion-loops-for-strides
10954 @opindex fversion-loops-for-strides
10955 If a loop iterates over an array with a variable stride, create another
10956 version of the loop that assumes the stride is always one. For example:
10957
10958 @smallexample
10959 for (int i = 0; i < n; ++i)
10960 x[i * stride] = @dots{};
10961 @end smallexample
10962
10963 becomes:
10964
10965 @smallexample
10966 if (stride == 1)
10967 for (int i = 0; i < n; ++i)
10968 x[i] = @dots{};
10969 else
10970 for (int i = 0; i < n; ++i)
10971 x[i * stride] = @dots{};
10972 @end smallexample
10973
10974 This is particularly useful for assumed-shape arrays in Fortran where
10975 (for example) it allows better vectorization assuming contiguous accesses.
10976 This flag is enabled by default at @option{-O3}.
10977 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10978
10979 @item -ffunction-sections
10980 @itemx -fdata-sections
10981 @opindex ffunction-sections
10982 @opindex fdata-sections
10983 Place each function or data item into its own section in the output
10984 file if the target supports arbitrary sections. The name of the
10985 function or the name of the data item determines the section's name
10986 in the output file.
10987
10988 Use these options on systems where the linker can perform optimizations to
10989 improve locality of reference in the instruction space. Most systems using the
10990 ELF object format have linkers with such optimizations. On AIX, the linker
10991 rearranges sections (CSECTs) based on the call graph. The performance impact
10992 varies.
10993
10994 Together with a linker garbage collection (linker @option{--gc-sections}
10995 option) these options may lead to smaller statically-linked executables (after
10996 stripping).
10997
10998 On ELF/DWARF systems these options do not degenerate the quality of the debug
10999 information. There could be issues with other object files/debug info formats.
11000
11001 Only use these options when there are significant benefits from doing so. When
11002 you specify these options, the assembler and linker create larger object and
11003 executable files and are also slower. These options affect code generation.
11004 They prevent optimizations by the compiler and assembler using relative
11005 locations inside a translation unit since the locations are unknown until
11006 link time. An example of such an optimization is relaxing calls to short call
11007 instructions.
11008
11009 @item -fbranch-target-load-optimize
11010 @opindex fbranch-target-load-optimize
11011 Perform branch target register load optimization before prologue / epilogue
11012 threading.
11013 The use of target registers can typically be exposed only during reload,
11014 thus hoisting loads out of loops and doing inter-block scheduling needs
11015 a separate optimization pass.
11016
11017 @item -fbranch-target-load-optimize2
11018 @opindex fbranch-target-load-optimize2
11019 Perform branch target register load optimization after prologue / epilogue
11020 threading.
11021
11022 @item -fbtr-bb-exclusive
11023 @opindex fbtr-bb-exclusive
11024 When performing branch target register load optimization, don't reuse
11025 branch target registers within any basic block.
11026
11027 @item -fstdarg-opt
11028 @opindex fstdarg-opt
11029 Optimize the prologue of variadic argument functions with respect to usage of
11030 those arguments.
11031
11032 @item -fsection-anchors
11033 @opindex fsection-anchors
11034 Try to reduce the number of symbolic address calculations by using
11035 shared ``anchor'' symbols to address nearby objects. This transformation
11036 can help to reduce the number of GOT entries and GOT accesses on some
11037 targets.
11038
11039 For example, the implementation of the following function @code{foo}:
11040
11041 @smallexample
11042 static int a, b, c;
11043 int foo (void) @{ return a + b + c; @}
11044 @end smallexample
11045
11046 @noindent
11047 usually calculates the addresses of all three variables, but if you
11048 compile it with @option{-fsection-anchors}, it accesses the variables
11049 from a common anchor point instead. The effect is similar to the
11050 following pseudocode (which isn't valid C):
11051
11052 @smallexample
11053 int foo (void)
11054 @{
11055 register int *xr = &x;
11056 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11057 @}
11058 @end smallexample
11059
11060 Not all targets support this option.
11061
11062 @item --param @var{name}=@var{value}
11063 @opindex param
11064 In some places, GCC uses various constants to control the amount of
11065 optimization that is done. For example, GCC does not inline functions
11066 that contain more than a certain number of instructions. You can
11067 control some of these constants on the command line using the
11068 @option{--param} option.
11069
11070 The names of specific parameters, and the meaning of the values, are
11071 tied to the internals of the compiler, and are subject to change
11072 without notice in future releases.
11073
11074 In order to get minimal, maximal and default value of a parameter,
11075 one can use @option{--help=param -Q} options.
11076
11077 In each case, the @var{value} is an integer. The allowable choices for
11078 @var{name} are:
11079
11080 @table @gcctabopt
11081 @item predictable-branch-outcome
11082 When branch is predicted to be taken with probability lower than this threshold
11083 (in percent), then it is considered well predictable.
11084
11085 @item max-rtl-if-conversion-insns
11086 RTL if-conversion tries to remove conditional branches around a block and
11087 replace them with conditionally executed instructions. This parameter
11088 gives the maximum number of instructions in a block which should be
11089 considered for if-conversion. The compiler will
11090 also use other heuristics to decide whether if-conversion is likely to be
11091 profitable.
11092
11093 @item max-rtl-if-conversion-predictable-cost
11094 @itemx max-rtl-if-conversion-unpredictable-cost
11095 RTL if-conversion will try to remove conditional branches around a block
11096 and replace them with conditionally executed instructions. These parameters
11097 give the maximum permissible cost for the sequence that would be generated
11098 by if-conversion depending on whether the branch is statically determined
11099 to be predictable or not. The units for this parameter are the same as
11100 those for the GCC internal seq_cost metric. The compiler will try to
11101 provide a reasonable default for this parameter using the BRANCH_COST
11102 target macro.
11103
11104 @item max-crossjump-edges
11105 The maximum number of incoming edges to consider for cross-jumping.
11106 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11107 the number of edges incoming to each block. Increasing values mean
11108 more aggressive optimization, making the compilation time increase with
11109 probably small improvement in executable size.
11110
11111 @item min-crossjump-insns
11112 The minimum number of instructions that must be matched at the end
11113 of two blocks before cross-jumping is performed on them. This
11114 value is ignored in the case where all instructions in the block being
11115 cross-jumped from are matched.
11116
11117 @item max-grow-copy-bb-insns
11118 The maximum code size expansion factor when copying basic blocks
11119 instead of jumping. The expansion is relative to a jump instruction.
11120
11121 @item max-goto-duplication-insns
11122 The maximum number of instructions to duplicate to a block that jumps
11123 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11124 passes, GCC factors computed gotos early in the compilation process,
11125 and unfactors them as late as possible. Only computed jumps at the
11126 end of a basic blocks with no more than max-goto-duplication-insns are
11127 unfactored.
11128
11129 @item max-delay-slot-insn-search
11130 The maximum number of instructions to consider when looking for an
11131 instruction to fill a delay slot. If more than this arbitrary number of
11132 instructions are searched, the time savings from filling the delay slot
11133 are minimal, so stop searching. Increasing values mean more
11134 aggressive optimization, making the compilation time increase with probably
11135 small improvement in execution time.
11136
11137 @item max-delay-slot-live-search
11138 When trying to fill delay slots, the maximum number of instructions to
11139 consider when searching for a block with valid live register
11140 information. Increasing this arbitrarily chosen value means more
11141 aggressive optimization, increasing the compilation time. This parameter
11142 should be removed when the delay slot code is rewritten to maintain the
11143 control-flow graph.
11144
11145 @item max-gcse-memory
11146 The approximate maximum amount of memory that can be allocated in
11147 order to perform the global common subexpression elimination
11148 optimization. If more memory than specified is required, the
11149 optimization is not done.
11150
11151 @item max-gcse-insertion-ratio
11152 If the ratio of expression insertions to deletions is larger than this value
11153 for any expression, then RTL PRE inserts or removes the expression and thus
11154 leaves partially redundant computations in the instruction stream.
11155
11156 @item max-pending-list-length
11157 The maximum number of pending dependencies scheduling allows
11158 before flushing the current state and starting over. Large functions
11159 with few branches or calls can create excessively large lists which
11160 needlessly consume memory and resources.
11161
11162 @item max-modulo-backtrack-attempts
11163 The maximum number of backtrack attempts the scheduler should make
11164 when modulo scheduling a loop. Larger values can exponentially increase
11165 compilation time.
11166
11167 @item max-inline-insns-single
11168 Several parameters control the tree inliner used in GCC@.
11169 This number sets the maximum number of instructions (counted in GCC's
11170 internal representation) in a single function that the tree inliner
11171 considers for inlining. This only affects functions declared
11172 inline and methods implemented in a class declaration (C++).
11173
11174 @item max-inline-insns-auto
11175 When you use @option{-finline-functions} (included in @option{-O3}),
11176 a lot of functions that would otherwise not be considered for inlining
11177 by the compiler are investigated. To those functions, a different
11178 (more restrictive) limit compared to functions declared inline can
11179 be applied.
11180
11181 @item max-inline-insns-small
11182 This is bound applied to calls which are considered relevant with
11183 @option{-finline-small-functions}.
11184
11185 @item max-inline-insns-size
11186 This is bound applied to calls which are optimized for size. Small growth
11187 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11188
11189 @item uninlined-function-insns
11190 Number of instructions accounted by inliner for function overhead such as
11191 function prologue and epilogue.
11192
11193 @item uninlined-function-time
11194 Extra time accounted by inliner for function overhead such as time needed to
11195 execute function prologue and epilogue
11196
11197 @item uninlined-thunk-insns
11198 @item uninlined-thunk-time
11199 Same as @option{--param uninlined-function-insns} and
11200 @option{--param uninlined-function-time} but applied to function thunks
11201
11202 @item inline-min-speedup
11203 When estimated performance improvement of caller + callee runtime exceeds this
11204 threshold (in percent), the function can be inlined regardless of the limit on
11205 @option{--param max-inline-insns-single} and @option{--param
11206 max-inline-insns-auto}.
11207
11208 @item large-function-insns
11209 The limit specifying really large functions. For functions larger than this
11210 limit after inlining, inlining is constrained by
11211 @option{--param large-function-growth}. This parameter is useful primarily
11212 to avoid extreme compilation time caused by non-linear algorithms used by the
11213 back end.
11214
11215 @item large-function-growth
11216 Specifies maximal growth of large function caused by inlining in percents.
11217 For example, parameter value 100 limits large function growth to 2.0 times
11218 the original size.
11219
11220 @item large-unit-insns
11221 The limit specifying large translation unit. Growth caused by inlining of
11222 units larger than this limit is limited by @option{--param inline-unit-growth}.
11223 For small units this might be too tight.
11224 For example, consider a unit consisting of function A
11225 that is inline and B that just calls A three times. If B is small relative to
11226 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11227 large units consisting of small inlineable functions, however, the overall unit
11228 growth limit is needed to avoid exponential explosion of code size. Thus for
11229 smaller units, the size is increased to @option{--param large-unit-insns}
11230 before applying @option{--param inline-unit-growth}.
11231
11232 @item inline-unit-growth
11233 Specifies maximal overall growth of the compilation unit caused by inlining.
11234 For example, parameter value 20 limits unit growth to 1.2 times the original
11235 size. Cold functions (either marked cold via an attribute or by profile
11236 feedback) are not accounted into the unit size.
11237
11238 @item ipcp-unit-growth
11239 Specifies maximal overall growth of the compilation unit caused by
11240 interprocedural constant propagation. For example, parameter value 10 limits
11241 unit growth to 1.1 times the original size.
11242
11243 @item large-stack-frame
11244 The limit specifying large stack frames. While inlining the algorithm is trying
11245 to not grow past this limit too much.
11246
11247 @item large-stack-frame-growth
11248 Specifies maximal growth of large stack frames caused by inlining in percents.
11249 For example, parameter value 1000 limits large stack frame growth to 11 times
11250 the original size.
11251
11252 @item max-inline-insns-recursive
11253 @itemx max-inline-insns-recursive-auto
11254 Specifies the maximum number of instructions an out-of-line copy of a
11255 self-recursive inline
11256 function can grow into by performing recursive inlining.
11257
11258 @option{--param max-inline-insns-recursive} applies to functions
11259 declared inline.
11260 For functions not declared inline, recursive inlining
11261 happens only when @option{-finline-functions} (included in @option{-O3}) is
11262 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11263
11264 @item max-inline-recursive-depth
11265 @itemx max-inline-recursive-depth-auto
11266 Specifies the maximum recursion depth used for recursive inlining.
11267
11268 @option{--param max-inline-recursive-depth} applies to functions
11269 declared inline. For functions not declared inline, recursive inlining
11270 happens only when @option{-finline-functions} (included in @option{-O3}) is
11271 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11272
11273 @item min-inline-recursive-probability
11274 Recursive inlining is profitable only for function having deep recursion
11275 in average and can hurt for function having little recursion depth by
11276 increasing the prologue size or complexity of function body to other
11277 optimizers.
11278
11279 When profile feedback is available (see @option{-fprofile-generate}) the actual
11280 recursion depth can be guessed from the probability that function recurses
11281 via a given call expression. This parameter limits inlining only to call
11282 expressions whose probability exceeds the given threshold (in percents).
11283
11284 @item early-inlining-insns
11285 Specify growth that the early inliner can make. In effect it increases
11286 the amount of inlining for code having a large abstraction penalty.
11287
11288 @item max-early-inliner-iterations
11289 Limit of iterations of the early inliner. This basically bounds
11290 the number of nested indirect calls the early inliner can resolve.
11291 Deeper chains are still handled by late inlining.
11292
11293 @item comdat-sharing-probability
11294 Probability (in percent) that C++ inline function with comdat visibility
11295 are shared across multiple compilation units.
11296
11297 @item profile-func-internal-id
11298 A parameter to control whether to use function internal id in profile
11299 database lookup. If the value is 0, the compiler uses an id that
11300 is based on function assembler name and filename, which makes old profile
11301 data more tolerant to source changes such as function reordering etc.
11302
11303 @item min-vect-loop-bound
11304 The minimum number of iterations under which loops are not vectorized
11305 when @option{-ftree-vectorize} is used. The number of iterations after
11306 vectorization needs to be greater than the value specified by this option
11307 to allow vectorization.
11308
11309 @item gcse-cost-distance-ratio
11310 Scaling factor in calculation of maximum distance an expression
11311 can be moved by GCSE optimizations. This is currently supported only in the
11312 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11313 is with simple expressions, i.e., the expressions that have cost
11314 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11315 hoisting of simple expressions.
11316
11317 @item gcse-unrestricted-cost
11318 Cost, roughly measured as the cost of a single typical machine
11319 instruction, at which GCSE optimizations do not constrain
11320 the distance an expression can travel. This is currently
11321 supported only in the code hoisting pass. The lesser the cost,
11322 the more aggressive code hoisting is. Specifying 0
11323 allows all expressions to travel unrestricted distances.
11324
11325 @item max-hoist-depth
11326 The depth of search in the dominator tree for expressions to hoist.
11327 This is used to avoid quadratic behavior in hoisting algorithm.
11328 The value of 0 does not limit on the search, but may slow down compilation
11329 of huge functions.
11330
11331 @item max-tail-merge-comparisons
11332 The maximum amount of similar bbs to compare a bb with. This is used to
11333 avoid quadratic behavior in tree tail merging.
11334
11335 @item max-tail-merge-iterations
11336 The maximum amount of iterations of the pass over the function. This is used to
11337 limit compilation time in tree tail merging.
11338
11339 @item store-merging-allow-unaligned
11340 Allow the store merging pass to introduce unaligned stores if it is legal to
11341 do so.
11342
11343 @item max-stores-to-merge
11344 The maximum number of stores to attempt to merge into wider stores in the store
11345 merging pass.
11346
11347 @item max-unrolled-insns
11348 The maximum number of instructions that a loop may have to be unrolled.
11349 If a loop is unrolled, this parameter also determines how many times
11350 the loop code is unrolled.
11351
11352 @item max-average-unrolled-insns
11353 The maximum number of instructions biased by probabilities of their execution
11354 that a loop may have to be unrolled. If a loop is unrolled,
11355 this parameter also determines how many times the loop code is unrolled.
11356
11357 @item max-unroll-times
11358 The maximum number of unrollings of a single loop.
11359
11360 @item max-peeled-insns
11361 The maximum number of instructions that a loop may have to be peeled.
11362 If a loop is peeled, this parameter also determines how many times
11363 the loop code is peeled.
11364
11365 @item max-peel-times
11366 The maximum number of peelings of a single loop.
11367
11368 @item max-peel-branches
11369 The maximum number of branches on the hot path through the peeled sequence.
11370
11371 @item max-completely-peeled-insns
11372 The maximum number of insns of a completely peeled loop.
11373
11374 @item max-completely-peel-times
11375 The maximum number of iterations of a loop to be suitable for complete peeling.
11376
11377 @item max-completely-peel-loop-nest-depth
11378 The maximum depth of a loop nest suitable for complete peeling.
11379
11380 @item max-unswitch-insns
11381 The maximum number of insns of an unswitched loop.
11382
11383 @item max-unswitch-level
11384 The maximum number of branches unswitched in a single loop.
11385
11386 @item lim-expensive
11387 The minimum cost of an expensive expression in the loop invariant motion.
11388
11389 @item iv-consider-all-candidates-bound
11390 Bound on number of candidates for induction variables, below which
11391 all candidates are considered for each use in induction variable
11392 optimizations. If there are more candidates than this,
11393 only the most relevant ones are considered to avoid quadratic time complexity.
11394
11395 @item iv-max-considered-uses
11396 The induction variable optimizations give up on loops that contain more
11397 induction variable uses.
11398
11399 @item iv-always-prune-cand-set-bound
11400 If the number of candidates in the set is smaller than this value,
11401 always try to remove unnecessary ivs from the set
11402 when adding a new one.
11403
11404 @item avg-loop-niter
11405 Average number of iterations of a loop.
11406
11407 @item dse-max-object-size
11408 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11409 Larger values may result in larger compilation times.
11410
11411 @item dse-max-alias-queries-per-store
11412 Maximum number of queries into the alias oracle per store.
11413 Larger values result in larger compilation times and may result in more
11414 removed dead stores.
11415
11416 @item scev-max-expr-size
11417 Bound on size of expressions used in the scalar evolutions analyzer.
11418 Large expressions slow the analyzer.
11419
11420 @item scev-max-expr-complexity
11421 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11422 Complex expressions slow the analyzer.
11423
11424 @item max-tree-if-conversion-phi-args
11425 Maximum number of arguments in a PHI supported by TREE if conversion
11426 unless the loop is marked with simd pragma.
11427
11428 @item vect-max-version-for-alignment-checks
11429 The maximum number of run-time checks that can be performed when
11430 doing loop versioning for alignment in the vectorizer.
11431
11432 @item vect-max-version-for-alias-checks
11433 The maximum number of run-time checks that can be performed when
11434 doing loop versioning for alias in the vectorizer.
11435
11436 @item vect-max-peeling-for-alignment
11437 The maximum number of loop peels to enhance access alignment
11438 for vectorizer. Value -1 means no limit.
11439
11440 @item max-iterations-to-track
11441 The maximum number of iterations of a loop the brute-force algorithm
11442 for analysis of the number of iterations of the loop tries to evaluate.
11443
11444 @item hot-bb-count-ws-permille
11445 A basic block profile count is considered hot if it contributes to
11446 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
11447
11448 @item hot-bb-frequency-fraction
11449 Select fraction of the entry block frequency of executions of basic block in
11450 function given basic block needs to have to be considered hot.
11451
11452 @item max-predicted-iterations
11453 The maximum number of loop iterations we predict statically. This is useful
11454 in cases where a function contains a single loop with known bound and
11455 another loop with unknown bound.
11456 The known number of iterations is predicted correctly, while
11457 the unknown number of iterations average to roughly 10. This means that the
11458 loop without bounds appears artificially cold relative to the other one.
11459
11460 @item builtin-expect-probability
11461 Control the probability of the expression having the specified value. This
11462 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11463
11464 @item builtin-string-cmp-inline-length
11465 The maximum length of a constant string for a builtin string cmp call
11466 eligible for inlining.
11467
11468 @item align-threshold
11469
11470 Select fraction of the maximal frequency of executions of a basic block in
11471 a function to align the basic block.
11472
11473 @item align-loop-iterations
11474
11475 A loop expected to iterate at least the selected number of iterations is
11476 aligned.
11477
11478 @item tracer-dynamic-coverage
11479 @itemx tracer-dynamic-coverage-feedback
11480
11481 This value is used to limit superblock formation once the given percentage of
11482 executed instructions is covered. This limits unnecessary code size
11483 expansion.
11484
11485 The @option{tracer-dynamic-coverage-feedback} parameter
11486 is used only when profile
11487 feedback is available. The real profiles (as opposed to statically estimated
11488 ones) are much less balanced allowing the threshold to be larger value.
11489
11490 @item tracer-max-code-growth
11491 Stop tail duplication once code growth has reached given percentage. This is
11492 a rather artificial limit, as most of the duplicates are eliminated later in
11493 cross jumping, so it may be set to much higher values than is the desired code
11494 growth.
11495
11496 @item tracer-min-branch-ratio
11497
11498 Stop reverse growth when the reverse probability of best edge is less than this
11499 threshold (in percent).
11500
11501 @item tracer-min-branch-probability
11502 @itemx tracer-min-branch-probability-feedback
11503
11504 Stop forward growth if the best edge has probability lower than this
11505 threshold.
11506
11507 Similarly to @option{tracer-dynamic-coverage} two parameters are
11508 provided. @option{tracer-min-branch-probability-feedback} is used for
11509 compilation with profile feedback and @option{tracer-min-branch-probability}
11510 compilation without. The value for compilation with profile feedback
11511 needs to be more conservative (higher) in order to make tracer
11512 effective.
11513
11514 @item stack-clash-protection-guard-size
11515 Specify the size of the operating system provided stack guard as
11516 2 raised to @var{num} bytes. Higher values may reduce the
11517 number of explicit probes, but a value larger than the operating system
11518 provided guard will leave code vulnerable to stack clash style attacks.
11519
11520 @item stack-clash-protection-probe-interval
11521 Stack clash protection involves probing stack space as it is allocated. This
11522 param controls the maximum distance between probes into the stack as 2 raised
11523 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11524 larger than the operating system provided guard will leave code vulnerable to
11525 stack clash style attacks.
11526
11527 @item max-cse-path-length
11528
11529 The maximum number of basic blocks on path that CSE considers.
11530
11531 @item max-cse-insns
11532 The maximum number of instructions CSE processes before flushing.
11533
11534 @item ggc-min-expand
11535
11536 GCC uses a garbage collector to manage its own memory allocation. This
11537 parameter specifies the minimum percentage by which the garbage
11538 collector's heap should be allowed to expand between collections.
11539 Tuning this may improve compilation speed; it has no effect on code
11540 generation.
11541
11542 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11543 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11544 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11545 GCC is not able to calculate RAM on a particular platform, the lower
11546 bound of 30% is used. Setting this parameter and
11547 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11548 every opportunity. This is extremely slow, but can be useful for
11549 debugging.
11550
11551 @item ggc-min-heapsize
11552
11553 Minimum size of the garbage collector's heap before it begins bothering
11554 to collect garbage. The first collection occurs after the heap expands
11555 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11556 tuning this may improve compilation speed, and has no effect on code
11557 generation.
11558
11559 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11560 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11561 with a lower bound of 4096 (four megabytes) and an upper bound of
11562 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11563 particular platform, the lower bound is used. Setting this parameter
11564 very large effectively disables garbage collection. Setting this
11565 parameter and @option{ggc-min-expand} to zero causes a full collection
11566 to occur at every opportunity.
11567
11568 @item max-reload-search-insns
11569 The maximum number of instruction reload should look backward for equivalent
11570 register. Increasing values mean more aggressive optimization, making the
11571 compilation time increase with probably slightly better performance.
11572
11573 @item max-cselib-memory-locations
11574 The maximum number of memory locations cselib should take into account.
11575 Increasing values mean more aggressive optimization, making the compilation time
11576 increase with probably slightly better performance.
11577
11578 @item max-sched-ready-insns
11579 The maximum number of instructions ready to be issued the scheduler should
11580 consider at any given time during the first scheduling pass. Increasing
11581 values mean more thorough searches, making the compilation time increase
11582 with probably little benefit.
11583
11584 @item max-sched-region-blocks
11585 The maximum number of blocks in a region to be considered for
11586 interblock scheduling.
11587
11588 @item max-pipeline-region-blocks
11589 The maximum number of blocks in a region to be considered for
11590 pipelining in the selective scheduler.
11591
11592 @item max-sched-region-insns
11593 The maximum number of insns in a region to be considered for
11594 interblock scheduling.
11595
11596 @item max-pipeline-region-insns
11597 The maximum number of insns in a region to be considered for
11598 pipelining in the selective scheduler.
11599
11600 @item min-spec-prob
11601 The minimum probability (in percents) of reaching a source block
11602 for interblock speculative scheduling.
11603
11604 @item max-sched-extend-regions-iters
11605 The maximum number of iterations through CFG to extend regions.
11606 A value of 0 disables region extensions.
11607
11608 @item max-sched-insn-conflict-delay
11609 The maximum conflict delay for an insn to be considered for speculative motion.
11610
11611 @item sched-spec-prob-cutoff
11612 The minimal probability of speculation success (in percents), so that
11613 speculative insns are scheduled.
11614
11615 @item sched-state-edge-prob-cutoff
11616 The minimum probability an edge must have for the scheduler to save its
11617 state across it.
11618
11619 @item sched-mem-true-dep-cost
11620 Minimal distance (in CPU cycles) between store and load targeting same
11621 memory locations.
11622
11623 @item selsched-max-lookahead
11624 The maximum size of the lookahead window of selective scheduling. It is a
11625 depth of search for available instructions.
11626
11627 @item selsched-max-sched-times
11628 The maximum number of times that an instruction is scheduled during
11629 selective scheduling. This is the limit on the number of iterations
11630 through which the instruction may be pipelined.
11631
11632 @item selsched-insns-to-rename
11633 The maximum number of best instructions in the ready list that are considered
11634 for renaming in the selective scheduler.
11635
11636 @item sms-min-sc
11637 The minimum value of stage count that swing modulo scheduler
11638 generates.
11639
11640 @item max-last-value-rtl
11641 The maximum size measured as number of RTLs that can be recorded in an expression
11642 in combiner for a pseudo register as last known value of that register.
11643
11644 @item max-combine-insns
11645 The maximum number of instructions the RTL combiner tries to combine.
11646
11647 @item integer-share-limit
11648 Small integer constants can use a shared data structure, reducing the
11649 compiler's memory usage and increasing its speed. This sets the maximum
11650 value of a shared integer constant.
11651
11652 @item ssp-buffer-size
11653 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11654 protection when @option{-fstack-protection} is used.
11655
11656 @item min-size-for-stack-sharing
11657 The minimum size of variables taking part in stack slot sharing when not
11658 optimizing.
11659
11660 @item max-jump-thread-duplication-stmts
11661 Maximum number of statements allowed in a block that needs to be
11662 duplicated when threading jumps.
11663
11664 @item max-fields-for-field-sensitive
11665 Maximum number of fields in a structure treated in
11666 a field sensitive manner during pointer analysis.
11667
11668 @item prefetch-latency
11669 Estimate on average number of instructions that are executed before
11670 prefetch finishes. The distance prefetched ahead is proportional
11671 to this constant. Increasing this number may also lead to less
11672 streams being prefetched (see @option{simultaneous-prefetches}).
11673
11674 @item simultaneous-prefetches
11675 Maximum number of prefetches that can run at the same time.
11676
11677 @item l1-cache-line-size
11678 The size of cache line in L1 data cache, in bytes.
11679
11680 @item l1-cache-size
11681 The size of L1 data cache, in kilobytes.
11682
11683 @item l2-cache-size
11684 The size of L2 data cache, in kilobytes.
11685
11686 @item prefetch-dynamic-strides
11687 Whether the loop array prefetch pass should issue software prefetch hints
11688 for strides that are non-constant. In some cases this may be
11689 beneficial, though the fact the stride is non-constant may make it
11690 hard to predict when there is clear benefit to issuing these hints.
11691
11692 Set to 1 if the prefetch hints should be issued for non-constant
11693 strides. Set to 0 if prefetch hints should be issued only for strides that
11694 are known to be constant and below @option{prefetch-minimum-stride}.
11695
11696 @item prefetch-minimum-stride
11697 Minimum constant stride, in bytes, to start using prefetch hints for. If
11698 the stride is less than this threshold, prefetch hints will not be issued.
11699
11700 This setting is useful for processors that have hardware prefetchers, in
11701 which case there may be conflicts between the hardware prefetchers and
11702 the software prefetchers. If the hardware prefetchers have a maximum
11703 stride they can handle, it should be used here to improve the use of
11704 software prefetchers.
11705
11706 A value of -1 means we don't have a threshold and therefore
11707 prefetch hints can be issued for any constant stride.
11708
11709 This setting is only useful for strides that are known and constant.
11710
11711 @item loop-interchange-max-num-stmts
11712 The maximum number of stmts in a loop to be interchanged.
11713
11714 @item loop-interchange-stride-ratio
11715 The minimum ratio between stride of two loops for interchange to be profitable.
11716
11717 @item min-insn-to-prefetch-ratio
11718 The minimum ratio between the number of instructions and the
11719 number of prefetches to enable prefetching in a loop.
11720
11721 @item prefetch-min-insn-to-mem-ratio
11722 The minimum ratio between the number of instructions and the
11723 number of memory references to enable prefetching in a loop.
11724
11725 @item use-canonical-types
11726 Whether the compiler should use the ``canonical'' type system.
11727 Should always be 1, which uses a more efficient internal
11728 mechanism for comparing types in C++ and Objective-C++. However, if
11729 bugs in the canonical type system are causing compilation failures,
11730 set this value to 0 to disable canonical types.
11731
11732 @item switch-conversion-max-branch-ratio
11733 Switch initialization conversion refuses to create arrays that are
11734 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11735 branches in the switch.
11736
11737 @item max-partial-antic-length
11738 Maximum length of the partial antic set computed during the tree
11739 partial redundancy elimination optimization (@option{-ftree-pre}) when
11740 optimizing at @option{-O3} and above. For some sorts of source code
11741 the enhanced partial redundancy elimination optimization can run away,
11742 consuming all of the memory available on the host machine. This
11743 parameter sets a limit on the length of the sets that are computed,
11744 which prevents the runaway behavior. Setting a value of 0 for
11745 this parameter allows an unlimited set length.
11746
11747 @item rpo-vn-max-loop-depth
11748 Maximum loop depth that is value-numbered optimistically.
11749 When the limit hits the innermost
11750 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11751 loop nest are value-numbered optimistically and the remaining ones not.
11752
11753 @item sccvn-max-alias-queries-per-access
11754 Maximum number of alias-oracle queries we perform when looking for
11755 redundancies for loads and stores. If this limit is hit the search
11756 is aborted and the load or store is not considered redundant. The
11757 number of queries is algorithmically limited to the number of
11758 stores on all paths from the load to the function entry.
11759
11760 @item ira-max-loops-num
11761 IRA uses regional register allocation by default. If a function
11762 contains more loops than the number given by this parameter, only at most
11763 the given number of the most frequently-executed loops form regions
11764 for regional register allocation.
11765
11766 @item ira-max-conflict-table-size
11767 Although IRA uses a sophisticated algorithm to compress the conflict
11768 table, the table can still require excessive amounts of memory for
11769 huge functions. If the conflict table for a function could be more
11770 than the size in MB given by this parameter, the register allocator
11771 instead uses a faster, simpler, and lower-quality
11772 algorithm that does not require building a pseudo-register conflict table.
11773
11774 @item ira-loop-reserved-regs
11775 IRA can be used to evaluate more accurate register pressure in loops
11776 for decisions to move loop invariants (see @option{-O3}). The number
11777 of available registers reserved for some other purposes is given
11778 by this parameter. Default of the parameter
11779 is the best found from numerous experiments.
11780
11781 @item lra-inheritance-ebb-probability-cutoff
11782 LRA tries to reuse values reloaded in registers in subsequent insns.
11783 This optimization is called inheritance. EBB is used as a region to
11784 do this optimization. The parameter defines a minimal fall-through
11785 edge probability in percentage used to add BB to inheritance EBB in
11786 LRA. The default value was chosen
11787 from numerous runs of SPEC2000 on x86-64.
11788
11789 @item loop-invariant-max-bbs-in-loop
11790 Loop invariant motion can be very expensive, both in compilation time and
11791 in amount of needed compile-time memory, with very large loops. Loops
11792 with more basic blocks than this parameter won't have loop invariant
11793 motion optimization performed on them.
11794
11795 @item loop-max-datarefs-for-datadeps
11796 Building data dependencies is expensive for very large loops. This
11797 parameter limits the number of data references in loops that are
11798 considered for data dependence analysis. These large loops are no
11799 handled by the optimizations using loop data dependencies.
11800
11801 @item max-vartrack-size
11802 Sets a maximum number of hash table slots to use during variable
11803 tracking dataflow analysis of any function. If this limit is exceeded
11804 with variable tracking at assignments enabled, analysis for that
11805 function is retried without it, after removing all debug insns from
11806 the function. If the limit is exceeded even without debug insns, var
11807 tracking analysis is completely disabled for the function. Setting
11808 the parameter to zero makes it unlimited.
11809
11810 @item max-vartrack-expr-depth
11811 Sets a maximum number of recursion levels when attempting to map
11812 variable names or debug temporaries to value expressions. This trades
11813 compilation time for more complete debug information. If this is set too
11814 low, value expressions that are available and could be represented in
11815 debug information may end up not being used; setting this higher may
11816 enable the compiler to find more complex debug expressions, but compile
11817 time and memory use may grow.
11818
11819 @item max-debug-marker-count
11820 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11821 markers) to avoid complexity explosion at inlining or expanding to RTL.
11822 If a function has more such gimple stmts than the set limit, such stmts
11823 will be dropped from the inlined copy of a function, and from its RTL
11824 expansion.
11825
11826 @item min-nondebug-insn-uid
11827 Use uids starting at this parameter for nondebug insns. The range below
11828 the parameter is reserved exclusively for debug insns created by
11829 @option{-fvar-tracking-assignments}, but debug insns may get
11830 (non-overlapping) uids above it if the reserved range is exhausted.
11831
11832 @item ipa-sra-ptr-growth-factor
11833 IPA-SRA replaces a pointer to an aggregate with one or more new
11834 parameters only when their cumulative size is less or equal to
11835 @option{ipa-sra-ptr-growth-factor} times the size of the original
11836 pointer parameter.
11837
11838 @item sra-max-scalarization-size-Ospeed
11839 @itemx sra-max-scalarization-size-Osize
11840 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11841 replace scalar parts of aggregates with uses of independent scalar
11842 variables. These parameters control the maximum size, in storage units,
11843 of aggregate which is considered for replacement when compiling for
11844 speed
11845 (@option{sra-max-scalarization-size-Ospeed}) or size
11846 (@option{sra-max-scalarization-size-Osize}) respectively.
11847
11848 @item tm-max-aggregate-size
11849 When making copies of thread-local variables in a transaction, this
11850 parameter specifies the size in bytes after which variables are
11851 saved with the logging functions as opposed to save/restore code
11852 sequence pairs. This option only applies when using
11853 @option{-fgnu-tm}.
11854
11855 @item graphite-max-nb-scop-params
11856 To avoid exponential effects in the Graphite loop transforms, the
11857 number of parameters in a Static Control Part (SCoP) is bounded.
11858 A value of zero can be used to lift
11859 the bound. A variable whose value is unknown at compilation time and
11860 defined outside a SCoP is a parameter of the SCoP.
11861
11862 @item loop-block-tile-size
11863 Loop blocking or strip mining transforms, enabled with
11864 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11865 loop in the loop nest by a given number of iterations. The strip
11866 length can be changed using the @option{loop-block-tile-size}
11867 parameter.
11868
11869 @item ipa-cp-value-list-size
11870 IPA-CP attempts to track all possible values and types passed to a function's
11871 parameter in order to propagate them and perform devirtualization.
11872 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11873 stores per one formal parameter of a function.
11874
11875 @item ipa-cp-eval-threshold
11876 IPA-CP calculates its own score of cloning profitability heuristics
11877 and performs those cloning opportunities with scores that exceed
11878 @option{ipa-cp-eval-threshold}.
11879
11880 @item ipa-cp-recursion-penalty
11881 Percentage penalty the recursive functions will receive when they
11882 are evaluated for cloning.
11883
11884 @item ipa-cp-single-call-penalty
11885 Percentage penalty functions containing a single call to another
11886 function will receive when they are evaluated for cloning.
11887
11888 @item ipa-max-agg-items
11889 IPA-CP is also capable to propagate a number of scalar values passed
11890 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11891 number of such values per one parameter.
11892
11893 @item ipa-cp-loop-hint-bonus
11894 When IPA-CP determines that a cloning candidate would make the number
11895 of iterations of a loop known, it adds a bonus of
11896 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11897 the candidate.
11898
11899 @item ipa-max-aa-steps
11900 During its analysis of function bodies, IPA-CP employs alias analysis
11901 in order to track values pointed to by function parameters. In order
11902 not spend too much time analyzing huge functions, it gives up and
11903 consider all memory clobbered after examining
11904 @option{ipa-max-aa-steps} statements modifying memory.
11905
11906 @item lto-partitions
11907 Specify desired number of partitions produced during WHOPR compilation.
11908 The number of partitions should exceed the number of CPUs used for compilation.
11909
11910 @item lto-min-partition
11911 Size of minimal partition for WHOPR (in estimated instructions).
11912 This prevents expenses of splitting very small programs into too many
11913 partitions.
11914
11915 @item lto-max-partition
11916 Size of max partition for WHOPR (in estimated instructions).
11917 to provide an upper bound for individual size of partition.
11918 Meant to be used only with balanced partitioning.
11919
11920 @item lto-max-streaming-parallelism
11921 Maximal number of parallel processes used for LTO streaming.
11922
11923 @item cxx-max-namespaces-for-diagnostic-help
11924 The maximum number of namespaces to consult for suggestions when C++
11925 name lookup fails for an identifier.
11926
11927 @item sink-frequency-threshold
11928 The maximum relative execution frequency (in percents) of the target block
11929 relative to a statement's original block to allow statement sinking of a
11930 statement. Larger numbers result in more aggressive statement sinking.
11931 A small positive adjustment is applied for
11932 statements with memory operands as those are even more profitable so sink.
11933
11934 @item max-stores-to-sink
11935 The maximum number of conditional store pairs that can be sunk. Set to 0
11936 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11937 (@option{-ftree-loop-if-convert}) is disabled.
11938
11939 @item allow-store-data-races
11940 Allow optimizers to introduce new data races on stores.
11941 Set to 1 to allow, otherwise to 0.
11942
11943 @item case-values-threshold
11944 The smallest number of different values for which it is best to use a
11945 jump-table instead of a tree of conditional branches. If the value is
11946 0, use the default for the machine.
11947
11948 @item jump-table-max-growth-ratio-for-size
11949 The maximum code size growth ratio when expanding
11950 into a jump table (in percent). The parameter is used when
11951 optimizing for size.
11952
11953 @item jump-table-max-growth-ratio-for-speed
11954 The maximum code size growth ratio when expanding
11955 into a jump table (in percent). The parameter is used when
11956 optimizing for speed.
11957
11958 @item tree-reassoc-width
11959 Set the maximum number of instructions executed in parallel in
11960 reassociated tree. This parameter overrides target dependent
11961 heuristics used by default if has non zero value.
11962
11963 @item sched-pressure-algorithm
11964 Choose between the two available implementations of
11965 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11966 and is the more likely to prevent instructions from being reordered.
11967 Algorithm 2 was designed to be a compromise between the relatively
11968 conservative approach taken by algorithm 1 and the rather aggressive
11969 approach taken by the default scheduler. It relies more heavily on
11970 having a regular register file and accurate register pressure classes.
11971 See @file{haifa-sched.c} in the GCC sources for more details.
11972
11973 The default choice depends on the target.
11974
11975 @item max-slsr-cand-scan
11976 Set the maximum number of existing candidates that are considered when
11977 seeking a basis for a new straight-line strength reduction candidate.
11978
11979 @item asan-globals
11980 Enable buffer overflow detection for global objects. This kind
11981 of protection is enabled by default if you are using
11982 @option{-fsanitize=address} option.
11983 To disable global objects protection use @option{--param asan-globals=0}.
11984
11985 @item asan-stack
11986 Enable buffer overflow detection for stack objects. This kind of
11987 protection is enabled by default when using @option{-fsanitize=address}.
11988 To disable stack protection use @option{--param asan-stack=0} option.
11989
11990 @item asan-instrument-reads
11991 Enable buffer overflow detection for memory reads. This kind of
11992 protection is enabled by default when using @option{-fsanitize=address}.
11993 To disable memory reads protection use
11994 @option{--param asan-instrument-reads=0}.
11995
11996 @item asan-instrument-writes
11997 Enable buffer overflow detection for memory writes. This kind of
11998 protection is enabled by default when using @option{-fsanitize=address}.
11999 To disable memory writes protection use
12000 @option{--param asan-instrument-writes=0} option.
12001
12002 @item asan-memintrin
12003 Enable detection for built-in functions. This kind of protection
12004 is enabled by default when using @option{-fsanitize=address}.
12005 To disable built-in functions protection use
12006 @option{--param asan-memintrin=0}.
12007
12008 @item asan-use-after-return
12009 Enable detection of use-after-return. This kind of protection
12010 is enabled by default when using the @option{-fsanitize=address} option.
12011 To disable it use @option{--param asan-use-after-return=0}.
12012
12013 Note: By default the check is disabled at run time. To enable it,
12014 add @code{detect_stack_use_after_return=1} to the environment variable
12015 @env{ASAN_OPTIONS}.
12016
12017 @item asan-instrumentation-with-call-threshold
12018 If number of memory accesses in function being instrumented
12019 is greater or equal to this number, use callbacks instead of inline checks.
12020 E.g. to disable inline code use
12021 @option{--param asan-instrumentation-with-call-threshold=0}.
12022
12023 @item use-after-scope-direct-emission-threshold
12024 If the size of a local variable in bytes is smaller or equal to this
12025 number, directly poison (or unpoison) shadow memory instead of using
12026 run-time callbacks.
12027
12028 @item max-fsm-thread-path-insns
12029 Maximum number of instructions to copy when duplicating blocks on a
12030 finite state automaton jump thread path.
12031
12032 @item max-fsm-thread-length
12033 Maximum number of basic blocks on a finite state automaton jump thread
12034 path.
12035
12036 @item max-fsm-thread-paths
12037 Maximum number of new jump thread paths to create for a finite state
12038 automaton.
12039
12040 @item parloops-chunk-size
12041 Chunk size of omp schedule for loops parallelized by parloops.
12042
12043 @item parloops-schedule
12044 Schedule type of omp schedule for loops parallelized by parloops (static,
12045 dynamic, guided, auto, runtime).
12046
12047 @item parloops-min-per-thread
12048 The minimum number of iterations per thread of an innermost parallelized
12049 loop for which the parallelized variant is preferred over the single threaded
12050 one. Note that for a parallelized loop nest the
12051 minimum number of iterations of the outermost loop per thread is two.
12052
12053 @item max-ssa-name-query-depth
12054 Maximum depth of recursion when querying properties of SSA names in things
12055 like fold routines. One level of recursion corresponds to following a
12056 use-def chain.
12057
12058 @item hsa-gen-debug-stores
12059 Enable emission of special debug stores within HSA kernels which are
12060 then read and reported by libgomp plugin. Generation of these stores
12061 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12062 enable it.
12063
12064 @item max-speculative-devirt-maydefs
12065 The maximum number of may-defs we analyze when looking for a must-def
12066 specifying the dynamic type of an object that invokes a virtual call
12067 we may be able to devirtualize speculatively.
12068
12069 @item max-vrp-switch-assertions
12070 The maximum number of assertions to add along the default edge of a switch
12071 statement during VRP.
12072
12073 @item unroll-jam-min-percent
12074 The minimum percentage of memory references that must be optimized
12075 away for the unroll-and-jam transformation to be considered profitable.
12076
12077 @item unroll-jam-max-unroll
12078 The maximum number of times the outer loop should be unrolled by
12079 the unroll-and-jam transformation.
12080
12081 @item max-rtl-if-conversion-unpredictable-cost
12082 Maximum permissible cost for the sequence that would be generated
12083 by the RTL if-conversion pass for a branch that is considered unpredictable.
12084
12085 @item max-variable-expansions-in-unroller
12086 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12087 of times that an individual variable will be expanded during loop unrolling.
12088
12089 @item tracer-min-branch-probability-feedback
12090 Stop forward growth if the probability of best edge is less than
12091 this threshold (in percent). Used when profile feedback is available.
12092
12093 @item partial-inlining-entry-probability
12094 Maximum probability of the entry BB of split region
12095 (in percent relative to entry BB of the function)
12096 to make partial inlining happen.
12097
12098 @item max-tracked-strlens
12099 Maximum number of strings for which strlen optimization pass will
12100 track string lengths.
12101
12102 @item gcse-after-reload-partial-fraction
12103 The threshold ratio for performing partial redundancy
12104 elimination after reload.
12105
12106 @item gcse-after-reload-critical-fraction
12107 The threshold ratio of critical edges execution count that
12108 permit performing redundancy elimination after reload.
12109
12110 @item max-loop-header-insns
12111 The maximum number of insns in loop header duplicated
12112 by the copy loop headers pass.
12113
12114 @item vect-epilogues-nomask
12115 Enable loop epilogue vectorization using smaller vector size.
12116
12117 @item slp-max-insns-in-bb
12118 Maximum number of instructions in basic block to be
12119 considered for SLP vectorization.
12120
12121 @item avoid-fma-max-bits
12122 Maximum number of bits for which we avoid creating FMAs.
12123
12124 @item sms-loop-average-count-threshold
12125 A threshold on the average loop count considered by the swing modulo scheduler.
12126
12127 @item sms-dfa-history
12128 The number of cycles the swing modulo scheduler considers when checking
12129 conflicts using DFA.
12130
12131 @item hot-bb-count-fraction
12132 Select fraction of the maximal count of repetitions of basic block
12133 in program given basic block needs
12134 to have to be considered hot (used in non-LTO mode)
12135
12136 @item max-inline-insns-recursive-auto
12137 The maximum number of instructions non-inline function
12138 can grow to via recursive inlining.
12139
12140 @item graphite-allow-codegen-errors
12141 Whether codegen errors should be ICEs when @option{-fchecking}.
12142
12143 @item sms-max-ii-factor
12144 A factor for tuning the upper bound that swing modulo scheduler
12145 uses for scheduling a loop.
12146
12147 @item lra-max-considered-reload-pseudos
12148 The max number of reload pseudos which are considered during
12149 spilling a non-reload pseudo.
12150
12151 @item max-pow-sqrt-depth
12152 Maximum depth of sqrt chains to use when synthesizing exponentiation
12153 by a real constant.
12154
12155 @item max-dse-active-local-stores
12156 Maximum number of active local stores in RTL dead store elimination.
12157
12158 @item asan-instrument-allocas
12159 Enable asan allocas/VLAs protection.
12160
12161 @item max-iterations-computation-cost
12162 Bound on the cost of an expression to compute the number of iterations.
12163
12164 @item max-isl-operations
12165 Maximum number of isl operations, 0 means unlimited.
12166
12167 @item graphite-max-arrays-per-scop
12168 Maximum number of arrays per scop.
12169
12170 @item max-vartrack-reverse-op-size
12171 Max. size of loc list for which reverse ops should be added.
12172
12173 @item unlikely-bb-count-fraction
12174 The minimum fraction of profile runs a given basic block execution count
12175 must be not to be considered unlikely.
12176
12177 @item tracer-dynamic-coverage-feedback
12178 The percentage of function, weighted by execution frequency,
12179 that must be covered by trace formation.
12180 Used when profile feedback is available.
12181
12182 @item max-inline-recursive-depth-auto
12183 The maximum depth of recursive inlining for non-inline functions.
12184
12185 @item fsm-scale-path-stmts
12186 Scale factor to apply to the number of statements in a threading path
12187 when comparing to the number of (scaled) blocks.
12188
12189 @item fsm-maximum-phi-arguments
12190 Maximum number of arguments a PHI may have before the FSM threader
12191 will not try to thread through its block.
12192
12193 @item uninit-control-dep-attempts
12194 Maximum number of nested calls to search for control dependencies
12195 during uninitialized variable analysis.
12196
12197 @item max-once-peeled-insns
12198 The maximum number of insns of a peeled loop that rolls only once.
12199
12200 @item sra-max-scalarization-size-Osize
12201 Maximum size, in storage units, of an aggregate
12202 which should be considered for scalarization when compiling for size.
12203
12204 @item fsm-scale-path-blocks
12205 Scale factor to apply to the number of blocks in a threading path
12206 when comparing to the number of (scaled) statements.
12207
12208 @item sched-autopref-queue-depth
12209 Hardware autoprefetcher scheduler model control flag.
12210 Number of lookahead cycles the model looks into; at '
12211 ' only enable instruction sorting heuristic.
12212
12213 @item loop-versioning-max-inner-insns
12214 The maximum number of instructions that an inner loop can have
12215 before the loop versioning pass considers it too big to copy.
12216
12217 @item loop-versioning-max-outer-insns
12218 The maximum number of instructions that an outer loop can have
12219 before the loop versioning pass considers it too big to copy,
12220 discounting any instructions in inner loops that directly benefit
12221 from versioning.
12222
12223 @item ssa-name-def-chain-limit
12224 The maximum number of SSA_NAME assignments to follow in determining
12225 a property of a variable such as its value. This limits the number
12226 of iterations or recursive calls GCC performs when optimizing certain
12227 statements or when determining their validity prior to issuing
12228 diagnostics.
12229
12230 @end table
12231 @end table
12232
12233 @node Instrumentation Options
12234 @section Program Instrumentation Options
12235 @cindex instrumentation options
12236 @cindex program instrumentation options
12237 @cindex run-time error checking options
12238 @cindex profiling options
12239 @cindex options, program instrumentation
12240 @cindex options, run-time error checking
12241 @cindex options, profiling
12242
12243 GCC supports a number of command-line options that control adding
12244 run-time instrumentation to the code it normally generates.
12245 For example, one purpose of instrumentation is collect profiling
12246 statistics for use in finding program hot spots, code coverage
12247 analysis, or profile-guided optimizations.
12248 Another class of program instrumentation is adding run-time checking
12249 to detect programming errors like invalid pointer
12250 dereferences or out-of-bounds array accesses, as well as deliberately
12251 hostile attacks such as stack smashing or C++ vtable hijacking.
12252 There is also a general hook which can be used to implement other
12253 forms of tracing or function-level instrumentation for debug or
12254 program analysis purposes.
12255
12256 @table @gcctabopt
12257 @cindex @command{prof}
12258 @cindex @command{gprof}
12259 @item -p
12260 @itemx -pg
12261 @opindex p
12262 @opindex pg
12263 Generate extra code to write profile information suitable for the
12264 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12265 (for @option{-pg}). You must use this option when compiling
12266 the source files you want data about, and you must also use it when
12267 linking.
12268
12269 You can use the function attribute @code{no_instrument_function} to
12270 suppress profiling of individual functions when compiling with these options.
12271 @xref{Common Function Attributes}.
12272
12273 @item -fprofile-arcs
12274 @opindex fprofile-arcs
12275 Add code so that program flow @dfn{arcs} are instrumented. During
12276 execution the program records how many times each branch and call is
12277 executed and how many times it is taken or returns. On targets that support
12278 constructors with priority support, profiling properly handles constructors,
12279 destructors and C++ constructors (and destructors) of classes which are used
12280 as a type of a global variable.
12281
12282 When the compiled
12283 program exits it saves this data to a file called
12284 @file{@var{auxname}.gcda} for each source file. The data may be used for
12285 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12286 test coverage analysis (@option{-ftest-coverage}). Each object file's
12287 @var{auxname} is generated from the name of the output file, if
12288 explicitly specified and it is not the final executable, otherwise it is
12289 the basename of the source file. In both cases any suffix is removed
12290 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12291 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12292 @xref{Cross-profiling}.
12293
12294 @cindex @command{gcov}
12295 @item --coverage
12296 @opindex coverage
12297
12298 This option is used to compile and link code instrumented for coverage
12299 analysis. The option is a synonym for @option{-fprofile-arcs}
12300 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12301 linking). See the documentation for those options for more details.
12302
12303 @itemize
12304
12305 @item
12306 Compile the source files with @option{-fprofile-arcs} plus optimization
12307 and code generation options. For test coverage analysis, use the
12308 additional @option{-ftest-coverage} option. You do not need to profile
12309 every source file in a program.
12310
12311 @item
12312 Compile the source files additionally with @option{-fprofile-abs-path}
12313 to create absolute path names in the @file{.gcno} files. This allows
12314 @command{gcov} to find the correct sources in projects where compilations
12315 occur with different working directories.
12316
12317 @item
12318 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12319 (the latter implies the former).
12320
12321 @item
12322 Run the program on a representative workload to generate the arc profile
12323 information. This may be repeated any number of times. You can run
12324 concurrent instances of your program, and provided that the file system
12325 supports locking, the data files will be correctly updated. Unless
12326 a strict ISO C dialect option is in effect, @code{fork} calls are
12327 detected and correctly handled without double counting.
12328
12329 @item
12330 For profile-directed optimizations, compile the source files again with
12331 the same optimization and code generation options plus
12332 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12333 Control Optimization}).
12334
12335 @item
12336 For test coverage analysis, use @command{gcov} to produce human readable
12337 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12338 @command{gcov} documentation for further information.
12339
12340 @end itemize
12341
12342 With @option{-fprofile-arcs}, for each function of your program GCC
12343 creates a program flow graph, then finds a spanning tree for the graph.
12344 Only arcs that are not on the spanning tree have to be instrumented: the
12345 compiler adds code to count the number of times that these arcs are
12346 executed. When an arc is the only exit or only entrance to a block, the
12347 instrumentation code can be added to the block; otherwise, a new basic
12348 block must be created to hold the instrumentation code.
12349
12350 @need 2000
12351 @item -ftest-coverage
12352 @opindex ftest-coverage
12353 Produce a notes file that the @command{gcov} code-coverage utility
12354 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12355 show program coverage. Each source file's note file is called
12356 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12357 above for a description of @var{auxname} and instructions on how to
12358 generate test coverage data. Coverage data matches the source files
12359 more closely if you do not optimize.
12360
12361 @item -fprofile-abs-path
12362 @opindex fprofile-abs-path
12363 Automatically convert relative source file names to absolute path names
12364 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12365 sources in projects where compilations occur with different working
12366 directories.
12367
12368 @item -fprofile-dir=@var{path}
12369 @opindex fprofile-dir
12370
12371 Set the directory to search for the profile data files in to @var{path}.
12372 This option affects only the profile data generated by
12373 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12374 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12375 and its related options. Both absolute and relative paths can be used.
12376 By default, GCC uses the current directory as @var{path}, thus the
12377 profile data file appears in the same directory as the object file.
12378 In order to prevent the file name clashing, if the object file name is
12379 not an absolute path, we mangle the absolute path of the
12380 @file{@var{sourcename}.gcda} file and use it as the file name of a
12381 @file{.gcda} file. See similar option @option{-fprofile-note}.
12382
12383 When an executable is run in a massive parallel environment, it is recommended
12384 to save profile to different folders. That can be done with variables
12385 in @var{path} that are exported during run-time:
12386
12387 @table @gcctabopt
12388
12389 @item %p
12390 process ID.
12391
12392 @item %q@{VAR@}
12393 value of environment variable @var{VAR}
12394
12395 @end table
12396
12397 @item -fprofile-generate
12398 @itemx -fprofile-generate=@var{path}
12399 @opindex fprofile-generate
12400
12401 Enable options usually used for instrumenting application to produce
12402 profile useful for later recompilation with profile feedback based
12403 optimization. You must use @option{-fprofile-generate} both when
12404 compiling and when linking your program.
12405
12406 The following options are enabled:
12407 @option{-fprofile-arcs}, @option{-fprofile-values},
12408 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12409
12410 If @var{path} is specified, GCC looks at the @var{path} to find
12411 the profile feedback data files. See @option{-fprofile-dir}.
12412
12413 To optimize the program based on the collected profile information, use
12414 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12415
12416 @item -fprofile-note=@var{path}
12417 @opindex fprofile-note
12418
12419 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12420 location. If you combine the option with multiple source files,
12421 the @file{.gcno} file will be overwritten.
12422
12423 @item -fprofile-update=@var{method}
12424 @opindex fprofile-update
12425
12426 Alter the update method for an application instrumented for profile
12427 feedback based optimization. The @var{method} argument should be one of
12428 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12429 The first one is useful for single-threaded applications,
12430 while the second one prevents profile corruption by emitting thread-safe code.
12431
12432 @strong{Warning:} When an application does not properly join all threads
12433 (or creates an detached thread), a profile file can be still corrupted.
12434
12435 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12436 when supported by a target, or to @samp{single} otherwise. The GCC driver
12437 automatically selects @samp{prefer-atomic} when @option{-pthread}
12438 is present in the command line.
12439
12440 @item -fprofile-filter-files=@var{regex}
12441 @opindex fprofile-filter-files
12442
12443 Instrument only functions from files where names match
12444 any regular expression (separated by a semi-colon).
12445
12446 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12447 only @file{main.c} and all C files starting with 'module'.
12448
12449 @item -fprofile-exclude-files=@var{regex}
12450 @opindex fprofile-exclude-files
12451
12452 Instrument only functions from files where names do not match
12453 all the regular expressions (separated by a semi-colon).
12454
12455 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12456 of all files that are located in @file{/usr/} folder.
12457
12458 @item -fsanitize=address
12459 @opindex fsanitize=address
12460 Enable AddressSanitizer, a fast memory error detector.
12461 Memory access instructions are instrumented to detect
12462 out-of-bounds and use-after-free bugs.
12463 The option enables @option{-fsanitize-address-use-after-scope}.
12464 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12465 more details. The run-time behavior can be influenced using the
12466 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12467 the available options are shown at startup of the instrumented program. See
12468 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12469 for a list of supported options.
12470 The option cannot be combined with @option{-fsanitize=thread}.
12471
12472 @item -fsanitize=kernel-address
12473 @opindex fsanitize=kernel-address
12474 Enable AddressSanitizer for Linux kernel.
12475 See @uref{https://github.com/google/kasan/wiki} for more details.
12476
12477 @item -fsanitize=pointer-compare
12478 @opindex fsanitize=pointer-compare
12479 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12480 The option must be combined with either @option{-fsanitize=kernel-address} or
12481 @option{-fsanitize=address}
12482 The option cannot be combined with @option{-fsanitize=thread}.
12483 Note: By default the check is disabled at run time. To enable it,
12484 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12485 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12486 invalid operation only when both pointers are non-null.
12487
12488 @item -fsanitize=pointer-subtract
12489 @opindex fsanitize=pointer-subtract
12490 Instrument subtraction with pointer operands.
12491 The option must be combined with either @option{-fsanitize=kernel-address} or
12492 @option{-fsanitize=address}
12493 The option cannot be combined with @option{-fsanitize=thread}.
12494 Note: By default the check is disabled at run time. To enable it,
12495 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12496 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12497 invalid operation only when both pointers are non-null.
12498
12499 @item -fsanitize=thread
12500 @opindex fsanitize=thread
12501 Enable ThreadSanitizer, a fast data race detector.
12502 Memory access instructions are instrumented to detect
12503 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12504 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12505 environment variable; see
12506 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12507 supported options.
12508 The option cannot be combined with @option{-fsanitize=address},
12509 @option{-fsanitize=leak}.
12510
12511 Note that sanitized atomic builtins cannot throw exceptions when
12512 operating on invalid memory addresses with non-call exceptions
12513 (@option{-fnon-call-exceptions}).
12514
12515 @item -fsanitize=leak
12516 @opindex fsanitize=leak
12517 Enable LeakSanitizer, a memory leak detector.
12518 This option only matters for linking of executables and
12519 the executable is linked against a library that overrides @code{malloc}
12520 and other allocator functions. See
12521 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12522 details. The run-time behavior can be influenced using the
12523 @env{LSAN_OPTIONS} environment variable.
12524 The option cannot be combined with @option{-fsanitize=thread}.
12525
12526 @item -fsanitize=undefined
12527 @opindex fsanitize=undefined
12528 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12529 Various computations are instrumented to detect undefined behavior
12530 at runtime. Current suboptions are:
12531
12532 @table @gcctabopt
12533
12534 @item -fsanitize=shift
12535 @opindex fsanitize=shift
12536 This option enables checking that the result of a shift operation is
12537 not undefined. Note that what exactly is considered undefined differs
12538 slightly between C and C++, as well as between ISO C90 and C99, etc.
12539 This option has two suboptions, @option{-fsanitize=shift-base} and
12540 @option{-fsanitize=shift-exponent}.
12541
12542 @item -fsanitize=shift-exponent
12543 @opindex fsanitize=shift-exponent
12544 This option enables checking that the second argument of a shift operation
12545 is not negative and is smaller than the precision of the promoted first
12546 argument.
12547
12548 @item -fsanitize=shift-base
12549 @opindex fsanitize=shift-base
12550 If the second argument of a shift operation is within range, check that the
12551 result of a shift operation is not undefined. Note that what exactly is
12552 considered undefined differs slightly between C and C++, as well as between
12553 ISO C90 and C99, etc.
12554
12555 @item -fsanitize=integer-divide-by-zero
12556 @opindex fsanitize=integer-divide-by-zero
12557 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12558
12559 @item -fsanitize=unreachable
12560 @opindex fsanitize=unreachable
12561 With this option, the compiler turns the @code{__builtin_unreachable}
12562 call into a diagnostics message call instead. When reaching the
12563 @code{__builtin_unreachable} call, the behavior is undefined.
12564
12565 @item -fsanitize=vla-bound
12566 @opindex fsanitize=vla-bound
12567 This option instructs the compiler to check that the size of a variable
12568 length array is positive.
12569
12570 @item -fsanitize=null
12571 @opindex fsanitize=null
12572 This option enables pointer checking. Particularly, the application
12573 built with this option turned on will issue an error message when it
12574 tries to dereference a NULL pointer, or if a reference (possibly an
12575 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12576 on an object pointed by a NULL pointer.
12577
12578 @item -fsanitize=return
12579 @opindex fsanitize=return
12580 This option enables return statement checking. Programs
12581 built with this option turned on will issue an error message
12582 when the end of a non-void function is reached without actually
12583 returning a value. This option works in C++ only.
12584
12585 @item -fsanitize=signed-integer-overflow
12586 @opindex fsanitize=signed-integer-overflow
12587 This option enables signed integer overflow checking. We check that
12588 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12589 does not overflow in the signed arithmetics. Note, integer promotion
12590 rules must be taken into account. That is, the following is not an
12591 overflow:
12592 @smallexample
12593 signed char a = SCHAR_MAX;
12594 a++;
12595 @end smallexample
12596
12597 @item -fsanitize=bounds
12598 @opindex fsanitize=bounds
12599 This option enables instrumentation of array bounds. Various out of bounds
12600 accesses are detected. Flexible array members, flexible array member-like
12601 arrays, and initializers of variables with static storage are not instrumented.
12602
12603 @item -fsanitize=bounds-strict
12604 @opindex fsanitize=bounds-strict
12605 This option enables strict instrumentation of array bounds. Most out of bounds
12606 accesses are detected, including flexible array members and flexible array
12607 member-like arrays. Initializers of variables with static storage are not
12608 instrumented.
12609
12610 @item -fsanitize=alignment
12611 @opindex fsanitize=alignment
12612
12613 This option enables checking of alignment of pointers when they are
12614 dereferenced, or when a reference is bound to insufficiently aligned target,
12615 or when a method or constructor is invoked on insufficiently aligned object.
12616
12617 @item -fsanitize=object-size
12618 @opindex fsanitize=object-size
12619 This option enables instrumentation of memory references using the
12620 @code{__builtin_object_size} function. Various out of bounds pointer
12621 accesses are detected.
12622
12623 @item -fsanitize=float-divide-by-zero
12624 @opindex fsanitize=float-divide-by-zero
12625 Detect floating-point division by zero. Unlike other similar options,
12626 @option{-fsanitize=float-divide-by-zero} is not enabled by
12627 @option{-fsanitize=undefined}, since floating-point division by zero can
12628 be a legitimate way of obtaining infinities and NaNs.
12629
12630 @item -fsanitize=float-cast-overflow
12631 @opindex fsanitize=float-cast-overflow
12632 This option enables floating-point type to integer conversion checking.
12633 We check that the result of the conversion does not overflow.
12634 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12635 not enabled by @option{-fsanitize=undefined}.
12636 This option does not work well with @code{FE_INVALID} exceptions enabled.
12637
12638 @item -fsanitize=nonnull-attribute
12639 @opindex fsanitize=nonnull-attribute
12640
12641 This option enables instrumentation of calls, checking whether null values
12642 are not passed to arguments marked as requiring a non-null value by the
12643 @code{nonnull} function attribute.
12644
12645 @item -fsanitize=returns-nonnull-attribute
12646 @opindex fsanitize=returns-nonnull-attribute
12647
12648 This option enables instrumentation of return statements in functions
12649 marked with @code{returns_nonnull} function attribute, to detect returning
12650 of null values from such functions.
12651
12652 @item -fsanitize=bool
12653 @opindex fsanitize=bool
12654
12655 This option enables instrumentation of loads from bool. If a value other
12656 than 0/1 is loaded, a run-time error is issued.
12657
12658 @item -fsanitize=enum
12659 @opindex fsanitize=enum
12660
12661 This option enables instrumentation of loads from an enum type. If
12662 a value outside the range of values for the enum type is loaded,
12663 a run-time error is issued.
12664
12665 @item -fsanitize=vptr
12666 @opindex fsanitize=vptr
12667
12668 This option enables instrumentation of C++ member function calls, member
12669 accesses and some conversions between pointers to base and derived classes,
12670 to verify the referenced object has the correct dynamic type.
12671
12672 @item -fsanitize=pointer-overflow
12673 @opindex fsanitize=pointer-overflow
12674
12675 This option enables instrumentation of pointer arithmetics. If the pointer
12676 arithmetics overflows, a run-time error is issued.
12677
12678 @item -fsanitize=builtin
12679 @opindex fsanitize=builtin
12680
12681 This option enables instrumentation of arguments to selected builtin
12682 functions. If an invalid value is passed to such arguments, a run-time
12683 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12684 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12685 by this option.
12686
12687 @end table
12688
12689 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12690 @option{-fsanitize=undefined} gives a diagnostic message.
12691 This currently works only for the C family of languages.
12692
12693 @item -fno-sanitize=all
12694 @opindex fno-sanitize=all
12695
12696 This option disables all previously enabled sanitizers.
12697 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12698 together.
12699
12700 @item -fasan-shadow-offset=@var{number}
12701 @opindex fasan-shadow-offset
12702 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12703 It is useful for experimenting with different shadow memory layouts in
12704 Kernel AddressSanitizer.
12705
12706 @item -fsanitize-sections=@var{s1},@var{s2},...
12707 @opindex fsanitize-sections
12708 Sanitize global variables in selected user-defined sections. @var{si} may
12709 contain wildcards.
12710
12711 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12712 @opindex fsanitize-recover
12713 @opindex fno-sanitize-recover
12714 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12715 mentioned in comma-separated list of @var{opts}. Enabling this option
12716 for a sanitizer component causes it to attempt to continue
12717 running the program as if no error happened. This means multiple
12718 runtime errors can be reported in a single program run, and the exit
12719 code of the program may indicate success even when errors
12720 have been reported. The @option{-fno-sanitize-recover=} option
12721 can be used to alter
12722 this behavior: only the first detected error is reported
12723 and program then exits with a non-zero exit code.
12724
12725 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12726 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12727 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12728 @option{-fsanitize=bounds-strict},
12729 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12730 For these sanitizers error recovery is turned on by default,
12731 except @option{-fsanitize=address}, for which this feature is experimental.
12732 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12733 accepted, the former enables recovery for all sanitizers that support it,
12734 the latter disables recovery for all sanitizers that support it.
12735
12736 Even if a recovery mode is turned on the compiler side, it needs to be also
12737 enabled on the runtime library side, otherwise the failures are still fatal.
12738 The runtime library defaults to @code{halt_on_error=0} for
12739 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12740 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12741 setting the @code{halt_on_error} flag in the corresponding environment variable.
12742
12743 Syntax without an explicit @var{opts} parameter is deprecated. It is
12744 equivalent to specifying an @var{opts} list of:
12745
12746 @smallexample
12747 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12748 @end smallexample
12749
12750 @item -fsanitize-address-use-after-scope
12751 @opindex fsanitize-address-use-after-scope
12752 Enable sanitization of local variables to detect use-after-scope bugs.
12753 The option sets @option{-fstack-reuse} to @samp{none}.
12754
12755 @item -fsanitize-undefined-trap-on-error
12756 @opindex fsanitize-undefined-trap-on-error
12757 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12758 report undefined behavior using @code{__builtin_trap} rather than
12759 a @code{libubsan} library routine. The advantage of this is that the
12760 @code{libubsan} library is not needed and is not linked in, so this
12761 is usable even in freestanding environments.
12762
12763 @item -fsanitize-coverage=trace-pc
12764 @opindex fsanitize-coverage=trace-pc
12765 Enable coverage-guided fuzzing code instrumentation.
12766 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12767
12768 @item -fsanitize-coverage=trace-cmp
12769 @opindex fsanitize-coverage=trace-cmp
12770 Enable dataflow guided fuzzing code instrumentation.
12771 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12772 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12773 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12774 variable or @code{__sanitizer_cov_trace_const_cmp1},
12775 @code{__sanitizer_cov_trace_const_cmp2},
12776 @code{__sanitizer_cov_trace_const_cmp4} or
12777 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12778 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12779 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12780 @code{__sanitizer_cov_trace_switch} for switch statements.
12781
12782 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12783 @opindex fcf-protection
12784 Enable code instrumentation of control-flow transfers to increase
12785 program security by checking that target addresses of control-flow
12786 transfer instructions (such as indirect function call, function return,
12787 indirect jump) are valid. This prevents diverting the flow of control
12788 to an unexpected target. This is intended to protect against such
12789 threats as Return-oriented Programming (ROP), and similarly
12790 call/jmp-oriented programming (COP/JOP).
12791
12792 The value @code{branch} tells the compiler to implement checking of
12793 validity of control-flow transfer at the point of indirect branch
12794 instructions, i.e.@: call/jmp instructions. The value @code{return}
12795 implements checking of validity at the point of returning from a
12796 function. The value @code{full} is an alias for specifying both
12797 @code{branch} and @code{return}. The value @code{none} turns off
12798 instrumentation.
12799
12800 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12801 used. The first bit of @code{__CET__} is set to 1 for the value
12802 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12803 the @code{return}.
12804
12805 You can also use the @code{nocf_check} attribute to identify
12806 which functions and calls should be skipped from instrumentation
12807 (@pxref{Function Attributes}).
12808
12809 Currently the x86 GNU/Linux target provides an implementation based
12810 on Intel Control-flow Enforcement Technology (CET).
12811
12812 @item -fstack-protector
12813 @opindex fstack-protector
12814 Emit extra code to check for buffer overflows, such as stack smashing
12815 attacks. This is done by adding a guard variable to functions with
12816 vulnerable objects. This includes functions that call @code{alloca}, and
12817 functions with buffers larger than 8 bytes. The guards are initialized
12818 when a function is entered and then checked when the function exits.
12819 If a guard check fails, an error message is printed and the program exits.
12820
12821 @item -fstack-protector-all
12822 @opindex fstack-protector-all
12823 Like @option{-fstack-protector} except that all functions are protected.
12824
12825 @item -fstack-protector-strong
12826 @opindex fstack-protector-strong
12827 Like @option{-fstack-protector} but includes additional functions to
12828 be protected --- those that have local array definitions, or have
12829 references to local frame addresses.
12830
12831 @item -fstack-protector-explicit
12832 @opindex fstack-protector-explicit
12833 Like @option{-fstack-protector} but only protects those functions which
12834 have the @code{stack_protect} attribute.
12835
12836 @item -fstack-check
12837 @opindex fstack-check
12838 Generate code to verify that you do not go beyond the boundary of the
12839 stack. You should specify this flag if you are running in an
12840 environment with multiple threads, but you only rarely need to specify it in
12841 a single-threaded environment since stack overflow is automatically
12842 detected on nearly all systems if there is only one stack.
12843
12844 Note that this switch does not actually cause checking to be done; the
12845 operating system or the language runtime must do that. The switch causes
12846 generation of code to ensure that they see the stack being extended.
12847
12848 You can additionally specify a string parameter: @samp{no} means no
12849 checking, @samp{generic} means force the use of old-style checking,
12850 @samp{specific} means use the best checking method and is equivalent
12851 to bare @option{-fstack-check}.
12852
12853 Old-style checking is a generic mechanism that requires no specific
12854 target support in the compiler but comes with the following drawbacks:
12855
12856 @enumerate
12857 @item
12858 Modified allocation strategy for large objects: they are always
12859 allocated dynamically if their size exceeds a fixed threshold. Note this
12860 may change the semantics of some code.
12861
12862 @item
12863 Fixed limit on the size of the static frame of functions: when it is
12864 topped by a particular function, stack checking is not reliable and
12865 a warning is issued by the compiler.
12866
12867 @item
12868 Inefficiency: because of both the modified allocation strategy and the
12869 generic implementation, code performance is hampered.
12870 @end enumerate
12871
12872 Note that old-style stack checking is also the fallback method for
12873 @samp{specific} if no target support has been added in the compiler.
12874
12875 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12876 and stack overflows. @samp{specific} is an excellent choice when compiling
12877 Ada code. It is not generally sufficient to protect against stack-clash
12878 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12879
12880 @item -fstack-clash-protection
12881 @opindex fstack-clash-protection
12882 Generate code to prevent stack clash style attacks. When this option is
12883 enabled, the compiler will only allocate one page of stack space at a time
12884 and each page is accessed immediately after allocation. Thus, it prevents
12885 allocations from jumping over any stack guard page provided by the
12886 operating system.
12887
12888 Most targets do not fully support stack clash protection. However, on
12889 those targets @option{-fstack-clash-protection} will protect dynamic stack
12890 allocations. @option{-fstack-clash-protection} may also provide limited
12891 protection for static stack allocations if the target supports
12892 @option{-fstack-check=specific}.
12893
12894 @item -fstack-limit-register=@var{reg}
12895 @itemx -fstack-limit-symbol=@var{sym}
12896 @itemx -fno-stack-limit
12897 @opindex fstack-limit-register
12898 @opindex fstack-limit-symbol
12899 @opindex fno-stack-limit
12900 Generate code to ensure that the stack does not grow beyond a certain value,
12901 either the value of a register or the address of a symbol. If a larger
12902 stack is required, a signal is raised at run time. For most targets,
12903 the signal is raised before the stack overruns the boundary, so
12904 it is possible to catch the signal without taking special precautions.
12905
12906 For instance, if the stack starts at absolute address @samp{0x80000000}
12907 and grows downwards, you can use the flags
12908 @option{-fstack-limit-symbol=__stack_limit} and
12909 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12910 of 128KB@. Note that this may only work with the GNU linker.
12911
12912 You can locally override stack limit checking by using the
12913 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12914
12915 @item -fsplit-stack
12916 @opindex fsplit-stack
12917 Generate code to automatically split the stack before it overflows.
12918 The resulting program has a discontiguous stack which can only
12919 overflow if the program is unable to allocate any more memory. This
12920 is most useful when running threaded programs, as it is no longer
12921 necessary to calculate a good stack size to use for each thread. This
12922 is currently only implemented for the x86 targets running
12923 GNU/Linux.
12924
12925 When code compiled with @option{-fsplit-stack} calls code compiled
12926 without @option{-fsplit-stack}, there may not be much stack space
12927 available for the latter code to run. If compiling all code,
12928 including library code, with @option{-fsplit-stack} is not an option,
12929 then the linker can fix up these calls so that the code compiled
12930 without @option{-fsplit-stack} always has a large stack. Support for
12931 this is implemented in the gold linker in GNU binutils release 2.21
12932 and later.
12933
12934 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12935 @opindex fvtable-verify
12936 This option is only available when compiling C++ code.
12937 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12938 feature that verifies at run time, for every virtual call, that
12939 the vtable pointer through which the call is made is valid for the type of
12940 the object, and has not been corrupted or overwritten. If an invalid vtable
12941 pointer is detected at run time, an error is reported and execution of the
12942 program is immediately halted.
12943
12944 This option causes run-time data structures to be built at program startup,
12945 which are used for verifying the vtable pointers.
12946 The options @samp{std} and @samp{preinit}
12947 control the timing of when these data structures are built. In both cases the
12948 data structures are built before execution reaches @code{main}. Using
12949 @option{-fvtable-verify=std} causes the data structures to be built after
12950 shared libraries have been loaded and initialized.
12951 @option{-fvtable-verify=preinit} causes them to be built before shared
12952 libraries have been loaded and initialized.
12953
12954 If this option appears multiple times in the command line with different
12955 values specified, @samp{none} takes highest priority over both @samp{std} and
12956 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12957
12958 @item -fvtv-debug
12959 @opindex fvtv-debug
12960 When used in conjunction with @option{-fvtable-verify=std} or
12961 @option{-fvtable-verify=preinit}, causes debug versions of the
12962 runtime functions for the vtable verification feature to be called.
12963 This flag also causes the compiler to log information about which
12964 vtable pointers it finds for each class.
12965 This information is written to a file named @file{vtv_set_ptr_data.log}
12966 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12967 if that is defined or the current working directory otherwise.
12968
12969 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12970 file, be sure to delete any existing one.
12971
12972 @item -fvtv-counts
12973 @opindex fvtv-counts
12974 This is a debugging flag. When used in conjunction with
12975 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12976 causes the compiler to keep track of the total number of virtual calls
12977 it encounters and the number of verifications it inserts. It also
12978 counts the number of calls to certain run-time library functions
12979 that it inserts and logs this information for each compilation unit.
12980 The compiler writes this information to a file named
12981 @file{vtv_count_data.log} in the directory named by the environment
12982 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12983 directory otherwise. It also counts the size of the vtable pointer sets
12984 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12985 in the same directory.
12986
12987 Note: This feature @emph{appends} data to the log files. To get fresh log
12988 files, be sure to delete any existing ones.
12989
12990 @item -finstrument-functions
12991 @opindex finstrument-functions
12992 Generate instrumentation calls for entry and exit to functions. Just
12993 after function entry and just before function exit, the following
12994 profiling functions are called with the address of the current
12995 function and its call site. (On some platforms,
12996 @code{__builtin_return_address} does not work beyond the current
12997 function, so the call site information may not be available to the
12998 profiling functions otherwise.)
12999
13000 @smallexample
13001 void __cyg_profile_func_enter (void *this_fn,
13002 void *call_site);
13003 void __cyg_profile_func_exit (void *this_fn,
13004 void *call_site);
13005 @end smallexample
13006
13007 The first argument is the address of the start of the current function,
13008 which may be looked up exactly in the symbol table.
13009
13010 This instrumentation is also done for functions expanded inline in other
13011 functions. The profiling calls indicate where, conceptually, the
13012 inline function is entered and exited. This means that addressable
13013 versions of such functions must be available. If all your uses of a
13014 function are expanded inline, this may mean an additional expansion of
13015 code size. If you use @code{extern inline} in your C code, an
13016 addressable version of such functions must be provided. (This is
13017 normally the case anyway, but if you get lucky and the optimizer always
13018 expands the functions inline, you might have gotten away without
13019 providing static copies.)
13020
13021 A function may be given the attribute @code{no_instrument_function}, in
13022 which case this instrumentation is not done. This can be used, for
13023 example, for the profiling functions listed above, high-priority
13024 interrupt routines, and any functions from which the profiling functions
13025 cannot safely be called (perhaps signal handlers, if the profiling
13026 routines generate output or allocate memory).
13027 @xref{Common Function Attributes}.
13028
13029 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13030 @opindex finstrument-functions-exclude-file-list
13031
13032 Set the list of functions that are excluded from instrumentation (see
13033 the description of @option{-finstrument-functions}). If the file that
13034 contains a function definition matches with one of @var{file}, then
13035 that function is not instrumented. The match is done on substrings:
13036 if the @var{file} parameter is a substring of the file name, it is
13037 considered to be a match.
13038
13039 For example:
13040
13041 @smallexample
13042 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13043 @end smallexample
13044
13045 @noindent
13046 excludes any inline function defined in files whose pathnames
13047 contain @file{/bits/stl} or @file{include/sys}.
13048
13049 If, for some reason, you want to include letter @samp{,} in one of
13050 @var{sym}, write @samp{\,}. For example,
13051 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13052 (note the single quote surrounding the option).
13053
13054 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13055 @opindex finstrument-functions-exclude-function-list
13056
13057 This is similar to @option{-finstrument-functions-exclude-file-list},
13058 but this option sets the list of function names to be excluded from
13059 instrumentation. The function name to be matched is its user-visible
13060 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13061 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13062 match is done on substrings: if the @var{sym} parameter is a substring
13063 of the function name, it is considered to be a match. For C99 and C++
13064 extended identifiers, the function name must be given in UTF-8, not
13065 using universal character names.
13066
13067 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13068 @opindex fpatchable-function-entry
13069 Generate @var{N} NOPs right at the beginning
13070 of each function, with the function entry point before the @var{M}th NOP.
13071 If @var{M} is omitted, it defaults to @code{0} so the
13072 function entry points to the address just at the first NOP.
13073 The NOP instructions reserve extra space which can be used to patch in
13074 any desired instrumentation at run time, provided that the code segment
13075 is writable. The amount of space is controllable indirectly via
13076 the number of NOPs; the NOP instruction used corresponds to the instruction
13077 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13078 is target-specific and may also depend on the architecture variant and/or
13079 other compilation options.
13080
13081 For run-time identification, the starting addresses of these areas,
13082 which correspond to their respective function entries minus @var{M},
13083 are additionally collected in the @code{__patchable_function_entries}
13084 section of the resulting binary.
13085
13086 Note that the value of @code{__attribute__ ((patchable_function_entry
13087 (N,M)))} takes precedence over command-line option
13088 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13089 the area size or to remove it completely on a single function.
13090 If @code{N=0}, no pad location is recorded.
13091
13092 The NOP instructions are inserted at---and maybe before, depending on
13093 @var{M}---the function entry address, even before the prologue.
13094
13095 @end table
13096
13097
13098 @node Preprocessor Options
13099 @section Options Controlling the Preprocessor
13100 @cindex preprocessor options
13101 @cindex options, preprocessor
13102
13103 These options control the C preprocessor, which is run on each C source
13104 file before actual compilation.
13105
13106 If you use the @option{-E} option, nothing is done except preprocessing.
13107 Some of these options make sense only together with @option{-E} because
13108 they cause the preprocessor output to be unsuitable for actual
13109 compilation.
13110
13111 In addition to the options listed here, there are a number of options
13112 to control search paths for include files documented in
13113 @ref{Directory Options}.
13114 Options to control preprocessor diagnostics are listed in
13115 @ref{Warning Options}.
13116
13117 @table @gcctabopt
13118 @include cppopts.texi
13119
13120 @item -Wp,@var{option}
13121 @opindex Wp
13122 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13123 and pass @var{option} directly through to the preprocessor. If
13124 @var{option} contains commas, it is split into multiple options at the
13125 commas. However, many options are modified, translated or interpreted
13126 by the compiler driver before being passed to the preprocessor, and
13127 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13128 interface is undocumented and subject to change, so whenever possible
13129 you should avoid using @option{-Wp} and let the driver handle the
13130 options instead.
13131
13132 @item -Xpreprocessor @var{option}
13133 @opindex Xpreprocessor
13134 Pass @var{option} as an option to the preprocessor. You can use this to
13135 supply system-specific preprocessor options that GCC does not
13136 recognize.
13137
13138 If you want to pass an option that takes an argument, you must use
13139 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13140
13141 @item -no-integrated-cpp
13142 @opindex no-integrated-cpp
13143 Perform preprocessing as a separate pass before compilation.
13144 By default, GCC performs preprocessing as an integrated part of
13145 input tokenization and parsing.
13146 If this option is provided, the appropriate language front end
13147 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13148 and Objective-C, respectively) is instead invoked twice,
13149 once for preprocessing only and once for actual compilation
13150 of the preprocessed input.
13151 This option may be useful in conjunction with the @option{-B} or
13152 @option{-wrapper} options to specify an alternate preprocessor or
13153 perform additional processing of the program source between
13154 normal preprocessing and compilation.
13155
13156 @end table
13157
13158 @node Assembler Options
13159 @section Passing Options to the Assembler
13160
13161 @c prevent bad page break with this line
13162 You can pass options to the assembler.
13163
13164 @table @gcctabopt
13165 @item -Wa,@var{option}
13166 @opindex Wa
13167 Pass @var{option} as an option to the assembler. If @var{option}
13168 contains commas, it is split into multiple options at the commas.
13169
13170 @item -Xassembler @var{option}
13171 @opindex Xassembler
13172 Pass @var{option} as an option to the assembler. You can use this to
13173 supply system-specific assembler options that GCC does not
13174 recognize.
13175
13176 If you want to pass an option that takes an argument, you must use
13177 @option{-Xassembler} twice, once for the option and once for the argument.
13178
13179 @end table
13180
13181 @node Link Options
13182 @section Options for Linking
13183 @cindex link options
13184 @cindex options, linking
13185
13186 These options come into play when the compiler links object files into
13187 an executable output file. They are meaningless if the compiler is
13188 not doing a link step.
13189
13190 @table @gcctabopt
13191 @cindex file names
13192 @item @var{object-file-name}
13193 A file name that does not end in a special recognized suffix is
13194 considered to name an object file or library. (Object files are
13195 distinguished from libraries by the linker according to the file
13196 contents.) If linking is done, these object files are used as input
13197 to the linker.
13198
13199 @item -c
13200 @itemx -S
13201 @itemx -E
13202 @opindex c
13203 @opindex S
13204 @opindex E
13205 If any of these options is used, then the linker is not run, and
13206 object file names should not be used as arguments. @xref{Overall
13207 Options}.
13208
13209 @item -flinker-output=@var{type}
13210 @opindex flinker-output
13211 This option controls code generation of the link-time optimizer. By
13212 default the linker output is automatically determined by the linker
13213 plugin. For debugging the compiler and if incremental linking with a
13214 non-LTO object file is desired, it may be useful to control the type
13215 manually.
13216
13217 If @var{type} is @samp{exec}, code generation produces a static
13218 binary. In this case @option{-fpic} and @option{-fpie} are both
13219 disabled.
13220
13221 If @var{type} is @samp{dyn}, code generation produces a shared
13222 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13223 but not enabled automatically. This allows to build shared libraries
13224 without position-independent code on architectures where this is
13225 possible, i.e.@: on x86.
13226
13227 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13228 executable. This results in similar optimizations as @samp{exec}
13229 except that @option{-fpie} is not disabled if specified at compilation
13230 time.
13231
13232 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13233 done. The sections containing intermediate code for link-time optimization are
13234 merged, pre-optimized, and output to the resulting object file. In addition, if
13235 @option{-ffat-lto-objects} is specified, binary code is produced for future
13236 non-LTO linking. The object file produced by incremental linking is smaller
13237 than a static library produced from the same object files. At link time the
13238 result of incremental linking also loads faster than a static
13239 library assuming that the majority of objects in the library are used.
13240
13241 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13242 code generation is forced, a final binary is produced, and the intermediate
13243 code for later link-time optimization is stripped. When multiple object files
13244 are linked together the resulting code is better optimized than with
13245 link-time optimizations disabled (for example, cross-module inlining
13246 happens), but most of benefits of whole program optimizations are lost.
13247
13248 During the incremental link (by @option{-r}) the linker plugin defaults to
13249 @option{rel}. With current interfaces to GNU Binutils it is however not
13250 possible to incrementally link LTO objects and non-LTO objects into a single
13251 mixed object file. If any of object files in incremental link cannot
13252 be used for link-time optimization, the linker plugin issues a warning and
13253 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13254 recommended to link such objects into static library instead. Alternatively it
13255 is possible to use H.J. Lu's binutils with support for mixed objects.
13256
13257 @item -fuse-ld=bfd
13258 @opindex fuse-ld=bfd
13259 Use the @command{bfd} linker instead of the default linker.
13260
13261 @item -fuse-ld=gold
13262 @opindex fuse-ld=gold
13263 Use the @command{gold} linker instead of the default linker.
13264
13265 @item -fuse-ld=lld
13266 @opindex fuse-ld=lld
13267 Use the LLVM @command{lld} linker instead of the default linker.
13268
13269 @cindex Libraries
13270 @item -l@var{library}
13271 @itemx -l @var{library}
13272 @opindex l
13273 Search the library named @var{library} when linking. (The second
13274 alternative with the library as a separate argument is only for
13275 POSIX compliance and is not recommended.)
13276
13277 The @option{-l} option is passed directly to the linker by GCC. Refer
13278 to your linker documentation for exact details. The general
13279 description below applies to the GNU linker.
13280
13281 The linker searches a standard list of directories for the library.
13282 The directories searched include several standard system directories
13283 plus any that you specify with @option{-L}.
13284
13285 Static libraries are archives of object files, and have file names
13286 like @file{lib@var{library}.a}. Some targets also support shared
13287 libraries, which typically have names like @file{lib@var{library}.so}.
13288 If both static and shared libraries are found, the linker gives
13289 preference to linking with the shared library unless the
13290 @option{-static} option is used.
13291
13292 It makes a difference where in the command you write this option; the
13293 linker searches and processes libraries and object files in the order they
13294 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13295 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13296 to functions in @samp{z}, those functions may not be loaded.
13297
13298 @item -lobjc
13299 @opindex lobjc
13300 You need this special case of the @option{-l} option in order to
13301 link an Objective-C or Objective-C++ program.
13302
13303 @item -nostartfiles
13304 @opindex nostartfiles
13305 Do not use the standard system startup files when linking.
13306 The standard system libraries are used normally, unless @option{-nostdlib},
13307 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13308
13309 @item -nodefaultlibs
13310 @opindex nodefaultlibs
13311 Do not use the standard system libraries when linking.
13312 Only the libraries you specify are passed to the linker, and options
13313 specifying linkage of the system libraries, such as @option{-static-libgcc}
13314 or @option{-shared-libgcc}, are ignored.
13315 The standard startup files are used normally, unless @option{-nostartfiles}
13316 is used.
13317
13318 The compiler may generate calls to @code{memcmp},
13319 @code{memset}, @code{memcpy} and @code{memmove}.
13320 These entries are usually resolved by entries in
13321 libc. These entry points should be supplied through some other
13322 mechanism when this option is specified.
13323
13324 @item -nolibc
13325 @opindex nolibc
13326 Do not use the C library or system libraries tightly coupled with it when
13327 linking. Still link with the startup files, @file{libgcc} or toolchain
13328 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13329 or @file{libstdc++} unless options preventing their inclusion are used as
13330 well. This typically removes @option{-lc} from the link command line, as well
13331 as system libraries that normally go with it and become meaningless when
13332 absence of a C library is assumed, for example @option{-lpthread} or
13333 @option{-lm} in some configurations. This is intended for bare-board
13334 targets when there is indeed no C library available.
13335
13336 @item -nostdlib
13337 @opindex nostdlib
13338 Do not use the standard system startup files or libraries when linking.
13339 No startup files and only the libraries you specify are passed to
13340 the linker, and options specifying linkage of the system libraries, such as
13341 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13342
13343 The compiler may generate calls to @code{memcmp}, @code{memset},
13344 @code{memcpy} and @code{memmove}.
13345 These entries are usually resolved by entries in
13346 libc. These entry points should be supplied through some other
13347 mechanism when this option is specified.
13348
13349 @cindex @option{-lgcc}, use with @option{-nostdlib}
13350 @cindex @option{-nostdlib} and unresolved references
13351 @cindex unresolved references and @option{-nostdlib}
13352 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13353 @cindex @option{-nodefaultlibs} and unresolved references
13354 @cindex unresolved references and @option{-nodefaultlibs}
13355 One of the standard libraries bypassed by @option{-nostdlib} and
13356 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13357 which GCC uses to overcome shortcomings of particular machines, or special
13358 needs for some languages.
13359 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13360 Collection (GCC) Internals},
13361 for more discussion of @file{libgcc.a}.)
13362 In most cases, you need @file{libgcc.a} even when you want to avoid
13363 other standard libraries. In other words, when you specify @option{-nostdlib}
13364 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13365 This ensures that you have no unresolved references to internal GCC
13366 library subroutines.
13367 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13368 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13369 GNU Compiler Collection (GCC) Internals}.)
13370
13371 @item -e @var{entry}
13372 @itemx --entry=@var{entry}
13373 @opindex e
13374 @opindex entry
13375
13376 Specify that the program entry point is @var{entry}. The argument is
13377 interpreted by the linker; the GNU linker accepts either a symbol name
13378 or an address.
13379
13380 @item -pie
13381 @opindex pie
13382 Produce a dynamically linked position independent executable on targets
13383 that support it. For predictable results, you must also specify the same
13384 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13385 or model suboptions) when you specify this linker option.
13386
13387 @item -no-pie
13388 @opindex no-pie
13389 Don't produce a dynamically linked position independent executable.
13390
13391 @item -static-pie
13392 @opindex static-pie
13393 Produce a static position independent executable on targets that support
13394 it. A static position independent executable is similar to a static
13395 executable, but can be loaded at any address without a dynamic linker.
13396 For predictable results, you must also specify the same set of options
13397 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13398 suboptions) when you specify this linker option.
13399
13400 @item -pthread
13401 @opindex pthread
13402 Link with the POSIX threads library. This option is supported on
13403 GNU/Linux targets, most other Unix derivatives, and also on
13404 x86 Cygwin and MinGW targets. On some targets this option also sets
13405 flags for the preprocessor, so it should be used consistently for both
13406 compilation and linking.
13407
13408 @item -r
13409 @opindex r
13410 Produce a relocatable object as output. This is also known as partial
13411 linking.
13412
13413 @item -rdynamic
13414 @opindex rdynamic
13415 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13416 that support it. This instructs the linker to add all symbols, not
13417 only used ones, to the dynamic symbol table. This option is needed
13418 for some uses of @code{dlopen} or to allow obtaining backtraces
13419 from within a program.
13420
13421 @item -s
13422 @opindex s
13423 Remove all symbol table and relocation information from the executable.
13424
13425 @item -static
13426 @opindex static
13427 On systems that support dynamic linking, this overrides @option{-pie}
13428 and prevents linking with the shared libraries. On other systems, this
13429 option has no effect.
13430
13431 @item -shared
13432 @opindex shared
13433 Produce a shared object which can then be linked with other objects to
13434 form an executable. Not all systems support this option. For predictable
13435 results, you must also specify the same set of options used for compilation
13436 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13437 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13438 needs to build supplementary stub code for constructors to work. On
13439 multi-libbed systems, @samp{gcc -shared} must select the correct support
13440 libraries to link against. Failing to supply the correct flags may lead
13441 to subtle defects. Supplying them in cases where they are not necessary
13442 is innocuous.}
13443
13444 @item -shared-libgcc
13445 @itemx -static-libgcc
13446 @opindex shared-libgcc
13447 @opindex static-libgcc
13448 On systems that provide @file{libgcc} as a shared library, these options
13449 force the use of either the shared or static version, respectively.
13450 If no shared version of @file{libgcc} was built when the compiler was
13451 configured, these options have no effect.
13452
13453 There are several situations in which an application should use the
13454 shared @file{libgcc} instead of the static version. The most common
13455 of these is when the application wishes to throw and catch exceptions
13456 across different shared libraries. In that case, each of the libraries
13457 as well as the application itself should use the shared @file{libgcc}.
13458
13459 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13460 whenever you build a shared library or a main executable, because C++
13461 programs typically use exceptions, so this is the right thing to do.
13462
13463 If, instead, you use the GCC driver to create shared libraries, you may
13464 find that they are not always linked with the shared @file{libgcc}.
13465 If GCC finds, at its configuration time, that you have a non-GNU linker
13466 or a GNU linker that does not support option @option{--eh-frame-hdr},
13467 it links the shared version of @file{libgcc} into shared libraries
13468 by default. Otherwise, it takes advantage of the linker and optimizes
13469 away the linking with the shared version of @file{libgcc}, linking with
13470 the static version of libgcc by default. This allows exceptions to
13471 propagate through such shared libraries, without incurring relocation
13472 costs at library load time.
13473
13474 However, if a library or main executable is supposed to throw or catch
13475 exceptions, you must link it using the G++ driver, or using the option
13476 @option{-shared-libgcc}, such that it is linked with the shared
13477 @file{libgcc}.
13478
13479 @item -static-libasan
13480 @opindex static-libasan
13481 When the @option{-fsanitize=address} option is used to link a program,
13482 the GCC driver automatically links against @option{libasan}. If
13483 @file{libasan} is available as a shared library, and the @option{-static}
13484 option is not used, then this links against the shared version of
13485 @file{libasan}. The @option{-static-libasan} option directs the GCC
13486 driver to link @file{libasan} statically, without necessarily linking
13487 other libraries statically.
13488
13489 @item -static-libtsan
13490 @opindex static-libtsan
13491 When the @option{-fsanitize=thread} option is used to link a program,
13492 the GCC driver automatically links against @option{libtsan}. If
13493 @file{libtsan} is available as a shared library, and the @option{-static}
13494 option is not used, then this links against the shared version of
13495 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13496 driver to link @file{libtsan} statically, without necessarily linking
13497 other libraries statically.
13498
13499 @item -static-liblsan
13500 @opindex static-liblsan
13501 When the @option{-fsanitize=leak} option is used to link a program,
13502 the GCC driver automatically links against @option{liblsan}. If
13503 @file{liblsan} is available as a shared library, and the @option{-static}
13504 option is not used, then this links against the shared version of
13505 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13506 driver to link @file{liblsan} statically, without necessarily linking
13507 other libraries statically.
13508
13509 @item -static-libubsan
13510 @opindex static-libubsan
13511 When the @option{-fsanitize=undefined} option is used to link a program,
13512 the GCC driver automatically links against @option{libubsan}. If
13513 @file{libubsan} is available as a shared library, and the @option{-static}
13514 option is not used, then this links against the shared version of
13515 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13516 driver to link @file{libubsan} statically, without necessarily linking
13517 other libraries statically.
13518
13519 @item -static-libstdc++
13520 @opindex static-libstdc++
13521 When the @command{g++} program is used to link a C++ program, it
13522 normally automatically links against @option{libstdc++}. If
13523 @file{libstdc++} is available as a shared library, and the
13524 @option{-static} option is not used, then this links against the
13525 shared version of @file{libstdc++}. That is normally fine. However, it
13526 is sometimes useful to freeze the version of @file{libstdc++} used by
13527 the program without going all the way to a fully static link. The
13528 @option{-static-libstdc++} option directs the @command{g++} driver to
13529 link @file{libstdc++} statically, without necessarily linking other
13530 libraries statically.
13531
13532 @item -symbolic
13533 @opindex symbolic
13534 Bind references to global symbols when building a shared object. Warn
13535 about any unresolved references (unless overridden by the link editor
13536 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13537 this option.
13538
13539 @item -T @var{script}
13540 @opindex T
13541 @cindex linker script
13542 Use @var{script} as the linker script. This option is supported by most
13543 systems using the GNU linker. On some targets, such as bare-board
13544 targets without an operating system, the @option{-T} option may be required
13545 when linking to avoid references to undefined symbols.
13546
13547 @item -Xlinker @var{option}
13548 @opindex Xlinker
13549 Pass @var{option} as an option to the linker. You can use this to
13550 supply system-specific linker options that GCC does not recognize.
13551
13552 If you want to pass an option that takes a separate argument, you must use
13553 @option{-Xlinker} twice, once for the option and once for the argument.
13554 For example, to pass @option{-assert definitions}, you must write
13555 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13556 @option{-Xlinker "-assert definitions"}, because this passes the entire
13557 string as a single argument, which is not what the linker expects.
13558
13559 When using the GNU linker, it is usually more convenient to pass
13560 arguments to linker options using the @option{@var{option}=@var{value}}
13561 syntax than as separate arguments. For example, you can specify
13562 @option{-Xlinker -Map=output.map} rather than
13563 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13564 this syntax for command-line options.
13565
13566 @item -Wl,@var{option}
13567 @opindex Wl
13568 Pass @var{option} as an option to the linker. If @var{option} contains
13569 commas, it is split into multiple options at the commas. You can use this
13570 syntax to pass an argument to the option.
13571 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13572 linker. When using the GNU linker, you can also get the same effect with
13573 @option{-Wl,-Map=output.map}.
13574
13575 @item -u @var{symbol}
13576 @opindex u
13577 Pretend the symbol @var{symbol} is undefined, to force linking of
13578 library modules to define it. You can use @option{-u} multiple times with
13579 different symbols to force loading of additional library modules.
13580
13581 @item -z @var{keyword}
13582 @opindex z
13583 @option{-z} is passed directly on to the linker along with the keyword
13584 @var{keyword}. See the section in the documentation of your linker for
13585 permitted values and their meanings.
13586 @end table
13587
13588 @node Directory Options
13589 @section Options for Directory Search
13590 @cindex directory options
13591 @cindex options, directory search
13592 @cindex search path
13593
13594 These options specify directories to search for header files, for
13595 libraries and for parts of the compiler:
13596
13597 @table @gcctabopt
13598 @include cppdiropts.texi
13599
13600 @item -iplugindir=@var{dir}
13601 @opindex iplugindir=
13602 Set the directory to search for plugins that are passed
13603 by @option{-fplugin=@var{name}} instead of
13604 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13605 to be used by the user, but only passed by the driver.
13606
13607 @item -L@var{dir}
13608 @opindex L
13609 Add directory @var{dir} to the list of directories to be searched
13610 for @option{-l}.
13611
13612 @item -B@var{prefix}
13613 @opindex B
13614 This option specifies where to find the executables, libraries,
13615 include files, and data files of the compiler itself.
13616
13617 The compiler driver program runs one or more of the subprograms
13618 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13619 @var{prefix} as a prefix for each program it tries to run, both with and
13620 without @samp{@var{machine}/@var{version}/} for the corresponding target
13621 machine and compiler version.
13622
13623 For each subprogram to be run, the compiler driver first tries the
13624 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13625 is not specified, the driver tries two standard prefixes,
13626 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13627 those results in a file name that is found, the unmodified program
13628 name is searched for using the directories specified in your
13629 @env{PATH} environment variable.
13630
13631 The compiler checks to see if the path provided by @option{-B}
13632 refers to a directory, and if necessary it adds a directory
13633 separator character at the end of the path.
13634
13635 @option{-B} prefixes that effectively specify directory names also apply
13636 to libraries in the linker, because the compiler translates these
13637 options into @option{-L} options for the linker. They also apply to
13638 include files in the preprocessor, because the compiler translates these
13639 options into @option{-isystem} options for the preprocessor. In this case,
13640 the compiler appends @samp{include} to the prefix.
13641
13642 The runtime support file @file{libgcc.a} can also be searched for using
13643 the @option{-B} prefix, if needed. If it is not found there, the two
13644 standard prefixes above are tried, and that is all. The file is left
13645 out of the link if it is not found by those means.
13646
13647 Another way to specify a prefix much like the @option{-B} prefix is to use
13648 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13649 Variables}.
13650
13651 As a special kludge, if the path provided by @option{-B} is
13652 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13653 9, then it is replaced by @file{[dir/]include}. This is to help
13654 with boot-strapping the compiler.
13655
13656 @item -no-canonical-prefixes
13657 @opindex no-canonical-prefixes
13658 Do not expand any symbolic links, resolve references to @samp{/../}
13659 or @samp{/./}, or make the path absolute when generating a relative
13660 prefix.
13661
13662 @item --sysroot=@var{dir}
13663 @opindex sysroot
13664 Use @var{dir} as the logical root directory for headers and libraries.
13665 For example, if the compiler normally searches for headers in
13666 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13667 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13668
13669 If you use both this option and the @option{-isysroot} option, then
13670 the @option{--sysroot} option applies to libraries, but the
13671 @option{-isysroot} option applies to header files.
13672
13673 The GNU linker (beginning with version 2.16) has the necessary support
13674 for this option. If your linker does not support this option, the
13675 header file aspect of @option{--sysroot} still works, but the
13676 library aspect does not.
13677
13678 @item --no-sysroot-suffix
13679 @opindex no-sysroot-suffix
13680 For some targets, a suffix is added to the root directory specified
13681 with @option{--sysroot}, depending on the other options used, so that
13682 headers may for example be found in
13683 @file{@var{dir}/@var{suffix}/usr/include} instead of
13684 @file{@var{dir}/usr/include}. This option disables the addition of
13685 such a suffix.
13686
13687 @end table
13688
13689 @node Code Gen Options
13690 @section Options for Code Generation Conventions
13691 @cindex code generation conventions
13692 @cindex options, code generation
13693 @cindex run-time options
13694
13695 These machine-independent options control the interface conventions
13696 used in code generation.
13697
13698 Most of them have both positive and negative forms; the negative form
13699 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13700 one of the forms is listed---the one that is not the default. You
13701 can figure out the other form by either removing @samp{no-} or adding
13702 it.
13703
13704 @table @gcctabopt
13705 @item -fstack-reuse=@var{reuse-level}
13706 @opindex fstack_reuse
13707 This option controls stack space reuse for user declared local/auto variables
13708 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13709 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13710 local variables and temporaries, @samp{named_vars} enables the reuse only for
13711 user defined local variables with names, and @samp{none} disables stack reuse
13712 completely. The default value is @samp{all}. The option is needed when the
13713 program extends the lifetime of a scoped local variable or a compiler generated
13714 temporary beyond the end point defined by the language. When a lifetime of
13715 a variable ends, and if the variable lives in memory, the optimizing compiler
13716 has the freedom to reuse its stack space with other temporaries or scoped
13717 local variables whose live range does not overlap with it. Legacy code extending
13718 local lifetime is likely to break with the stack reuse optimization.
13719
13720 For example,
13721
13722 @smallexample
13723 int *p;
13724 @{
13725 int local1;
13726
13727 p = &local1;
13728 local1 = 10;
13729 ....
13730 @}
13731 @{
13732 int local2;
13733 local2 = 20;
13734 ...
13735 @}
13736
13737 if (*p == 10) // out of scope use of local1
13738 @{
13739
13740 @}
13741 @end smallexample
13742
13743 Another example:
13744 @smallexample
13745
13746 struct A
13747 @{
13748 A(int k) : i(k), j(k) @{ @}
13749 int i;
13750 int j;
13751 @};
13752
13753 A *ap;
13754
13755 void foo(const A& ar)
13756 @{
13757 ap = &ar;
13758 @}
13759
13760 void bar()
13761 @{
13762 foo(A(10)); // temp object's lifetime ends when foo returns
13763
13764 @{
13765 A a(20);
13766 ....
13767 @}
13768 ap->i+= 10; // ap references out of scope temp whose space
13769 // is reused with a. What is the value of ap->i?
13770 @}
13771
13772 @end smallexample
13773
13774 The lifetime of a compiler generated temporary is well defined by the C++
13775 standard. When a lifetime of a temporary ends, and if the temporary lives
13776 in memory, the optimizing compiler has the freedom to reuse its stack
13777 space with other temporaries or scoped local variables whose live range
13778 does not overlap with it. However some of the legacy code relies on
13779 the behavior of older compilers in which temporaries' stack space is
13780 not reused, the aggressive stack reuse can lead to runtime errors. This
13781 option is used to control the temporary stack reuse optimization.
13782
13783 @item -ftrapv
13784 @opindex ftrapv
13785 This option generates traps for signed overflow on addition, subtraction,
13786 multiplication operations.
13787 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13788 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13789 @option{-fwrapv} being effective. Note that only active options override, so
13790 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13791 results in @option{-ftrapv} being effective.
13792
13793 @item -fwrapv
13794 @opindex fwrapv
13795 This option instructs the compiler to assume that signed arithmetic
13796 overflow of addition, subtraction and multiplication wraps around
13797 using twos-complement representation. This flag enables some optimizations
13798 and disables others.
13799 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13800 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13801 @option{-fwrapv} being effective. Note that only active options override, so
13802 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13803 results in @option{-ftrapv} being effective.
13804
13805 @item -fwrapv-pointer
13806 @opindex fwrapv-pointer
13807 This option instructs the compiler to assume that pointer arithmetic
13808 overflow on addition and subtraction wraps around using twos-complement
13809 representation. This flag disables some optimizations which assume
13810 pointer overflow is invalid.
13811
13812 @item -fstrict-overflow
13813 @opindex fstrict-overflow
13814 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13815 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13816
13817 @item -fexceptions
13818 @opindex fexceptions
13819 Enable exception handling. Generates extra code needed to propagate
13820 exceptions. For some targets, this implies GCC generates frame
13821 unwind information for all functions, which can produce significant data
13822 size overhead, although it does not affect execution. If you do not
13823 specify this option, GCC enables it by default for languages like
13824 C++ that normally require exception handling, and disables it for
13825 languages like C that do not normally require it. However, you may need
13826 to enable this option when compiling C code that needs to interoperate
13827 properly with exception handlers written in C++. You may also wish to
13828 disable this option if you are compiling older C++ programs that don't
13829 use exception handling.
13830
13831 @item -fnon-call-exceptions
13832 @opindex fnon-call-exceptions
13833 Generate code that allows trapping instructions to throw exceptions.
13834 Note that this requires platform-specific runtime support that does
13835 not exist everywhere. Moreover, it only allows @emph{trapping}
13836 instructions to throw exceptions, i.e.@: memory references or floating-point
13837 instructions. It does not allow exceptions to be thrown from
13838 arbitrary signal handlers such as @code{SIGALRM}.
13839
13840 @item -fdelete-dead-exceptions
13841 @opindex fdelete-dead-exceptions
13842 Consider that instructions that may throw exceptions but don't otherwise
13843 contribute to the execution of the program can be optimized away.
13844 This option is enabled by default for the Ada front end, as permitted by
13845 the Ada language specification.
13846 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13847
13848 @item -funwind-tables
13849 @opindex funwind-tables
13850 Similar to @option{-fexceptions}, except that it just generates any needed
13851 static data, but does not affect the generated code in any other way.
13852 You normally do not need to enable this option; instead, a language processor
13853 that needs this handling enables it on your behalf.
13854
13855 @item -fasynchronous-unwind-tables
13856 @opindex fasynchronous-unwind-tables
13857 Generate unwind table in DWARF format, if supported by target machine. The
13858 table is exact at each instruction boundary, so it can be used for stack
13859 unwinding from asynchronous events (such as debugger or garbage collector).
13860
13861 @item -fno-gnu-unique
13862 @opindex fno-gnu-unique
13863 @opindex fgnu-unique
13864 On systems with recent GNU assembler and C library, the C++ compiler
13865 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13866 of template static data members and static local variables in inline
13867 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13868 is necessary to avoid problems with a library used by two different
13869 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13870 therefore disagreeing with the other one about the binding of the
13871 symbol. But this causes @code{dlclose} to be ignored for affected
13872 DSOs; if your program relies on reinitialization of a DSO via
13873 @code{dlclose} and @code{dlopen}, you can use
13874 @option{-fno-gnu-unique}.
13875
13876 @item -fpcc-struct-return
13877 @opindex fpcc-struct-return
13878 Return ``short'' @code{struct} and @code{union} values in memory like
13879 longer ones, rather than in registers. This convention is less
13880 efficient, but it has the advantage of allowing intercallability between
13881 GCC-compiled files and files compiled with other compilers, particularly
13882 the Portable C Compiler (pcc).
13883
13884 The precise convention for returning structures in memory depends
13885 on the target configuration macros.
13886
13887 Short structures and unions are those whose size and alignment match
13888 that of some integer type.
13889
13890 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13891 switch is not binary compatible with code compiled with the
13892 @option{-freg-struct-return} switch.
13893 Use it to conform to a non-default application binary interface.
13894
13895 @item -freg-struct-return
13896 @opindex freg-struct-return
13897 Return @code{struct} and @code{union} values in registers when possible.
13898 This is more efficient for small structures than
13899 @option{-fpcc-struct-return}.
13900
13901 If you specify neither @option{-fpcc-struct-return} nor
13902 @option{-freg-struct-return}, GCC defaults to whichever convention is
13903 standard for the target. If there is no standard convention, GCC
13904 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13905 the principal compiler. In those cases, we can choose the standard, and
13906 we chose the more efficient register return alternative.
13907
13908 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13909 switch is not binary compatible with code compiled with the
13910 @option{-fpcc-struct-return} switch.
13911 Use it to conform to a non-default application binary interface.
13912
13913 @item -fshort-enums
13914 @opindex fshort-enums
13915 Allocate to an @code{enum} type only as many bytes as it needs for the
13916 declared range of possible values. Specifically, the @code{enum} type
13917 is equivalent to the smallest integer type that has enough room.
13918
13919 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13920 code that is not binary compatible with code generated without that switch.
13921 Use it to conform to a non-default application binary interface.
13922
13923 @item -fshort-wchar
13924 @opindex fshort-wchar
13925 Override the underlying type for @code{wchar_t} to be @code{short
13926 unsigned int} instead of the default for the target. This option is
13927 useful for building programs to run under WINE@.
13928
13929 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13930 code that is not binary compatible with code generated without that switch.
13931 Use it to conform to a non-default application binary interface.
13932
13933 @item -fno-common
13934 @opindex fno-common
13935 @opindex fcommon
13936 @cindex tentative definitions
13937 In C code, this option controls the placement of global variables
13938 defined without an initializer, known as @dfn{tentative definitions}
13939 in the C standard. Tentative definitions are distinct from declarations
13940 of a variable with the @code{extern} keyword, which do not allocate storage.
13941
13942 Unix C compilers have traditionally allocated storage for
13943 uninitialized global variables in a common block. This allows the
13944 linker to resolve all tentative definitions of the same variable
13945 in different compilation units to the same object, or to a non-tentative
13946 definition.
13947 This is the behavior specified by @option{-fcommon}, and is the default for
13948 GCC on most targets.
13949 On the other hand, this behavior is not required by ISO
13950 C, and on some targets may carry a speed or code size penalty on
13951 variable references.
13952
13953 The @option{-fno-common} option specifies that the compiler should instead
13954 place uninitialized global variables in the BSS section of the object file.
13955 This inhibits the merging of tentative definitions by the linker so
13956 you get a multiple-definition error if the same
13957 variable is defined in more than one compilation unit.
13958 Compiling with @option{-fno-common} is useful on targets for which
13959 it provides better performance, or if you wish to verify that the
13960 program will work on other systems that always treat uninitialized
13961 variable definitions this way.
13962
13963 @item -fno-ident
13964 @opindex fno-ident
13965 @opindex fident
13966 Ignore the @code{#ident} directive.
13967
13968 @item -finhibit-size-directive
13969 @opindex finhibit-size-directive
13970 Don't output a @code{.size} assembler directive, or anything else that
13971 would cause trouble if the function is split in the middle, and the
13972 two halves are placed at locations far apart in memory. This option is
13973 used when compiling @file{crtstuff.c}; you should not need to use it
13974 for anything else.
13975
13976 @item -fverbose-asm
13977 @opindex fverbose-asm
13978 Put extra commentary information in the generated assembly code to
13979 make it more readable. This option is generally only of use to those
13980 who actually need to read the generated assembly code (perhaps while
13981 debugging the compiler itself).
13982
13983 @option{-fno-verbose-asm}, the default, causes the
13984 extra information to be omitted and is useful when comparing two assembler
13985 files.
13986
13987 The added comments include:
13988
13989 @itemize @bullet
13990
13991 @item
13992 information on the compiler version and command-line options,
13993
13994 @item
13995 the source code lines associated with the assembly instructions,
13996 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13997
13998 @item
13999 hints on which high-level expressions correspond to
14000 the various assembly instruction operands.
14001
14002 @end itemize
14003
14004 For example, given this C source file:
14005
14006 @smallexample
14007 int test (int n)
14008 @{
14009 int i;
14010 int total = 0;
14011
14012 for (i = 0; i < n; i++)
14013 total += i * i;
14014
14015 return total;
14016 @}
14017 @end smallexample
14018
14019 compiling to (x86_64) assembly via @option{-S} and emitting the result
14020 direct to stdout via @option{-o} @option{-}
14021
14022 @smallexample
14023 gcc -S test.c -fverbose-asm -Os -o -
14024 @end smallexample
14025
14026 gives output similar to this:
14027
14028 @smallexample
14029 .file "test.c"
14030 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14031 [...snip...]
14032 # options passed:
14033 [...snip...]
14034
14035 .text
14036 .globl test
14037 .type test, @@function
14038 test:
14039 .LFB0:
14040 .cfi_startproc
14041 # test.c:4: int total = 0;
14042 xorl %eax, %eax # <retval>
14043 # test.c:6: for (i = 0; i < n; i++)
14044 xorl %edx, %edx # i
14045 .L2:
14046 # test.c:6: for (i = 0; i < n; i++)
14047 cmpl %edi, %edx # n, i
14048 jge .L5 #,
14049 # test.c:7: total += i * i;
14050 movl %edx, %ecx # i, tmp92
14051 imull %edx, %ecx # i, tmp92
14052 # test.c:6: for (i = 0; i < n; i++)
14053 incl %edx # i
14054 # test.c:7: total += i * i;
14055 addl %ecx, %eax # tmp92, <retval>
14056 jmp .L2 #
14057 .L5:
14058 # test.c:10: @}
14059 ret
14060 .cfi_endproc
14061 .LFE0:
14062 .size test, .-test
14063 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14064 .section .note.GNU-stack,"",@@progbits
14065 @end smallexample
14066
14067 The comments are intended for humans rather than machines and hence the
14068 precise format of the comments is subject to change.
14069
14070 @item -frecord-gcc-switches
14071 @opindex frecord-gcc-switches
14072 This switch causes the command line used to invoke the
14073 compiler to be recorded into the object file that is being created.
14074 This switch is only implemented on some targets and the exact format
14075 of the recording is target and binary file format dependent, but it
14076 usually takes the form of a section containing ASCII text. This
14077 switch is related to the @option{-fverbose-asm} switch, but that
14078 switch only records information in the assembler output file as
14079 comments, so it never reaches the object file.
14080 See also @option{-grecord-gcc-switches} for another
14081 way of storing compiler options into the object file.
14082
14083 @item -fpic
14084 @opindex fpic
14085 @cindex global offset table
14086 @cindex PIC
14087 Generate position-independent code (PIC) suitable for use in a shared
14088 library, if supported for the target machine. Such code accesses all
14089 constant addresses through a global offset table (GOT)@. The dynamic
14090 loader resolves the GOT entries when the program starts (the dynamic
14091 loader is not part of GCC; it is part of the operating system). If
14092 the GOT size for the linked executable exceeds a machine-specific
14093 maximum size, you get an error message from the linker indicating that
14094 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14095 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14096 on the m68k and RS/6000. The x86 has no such limit.)
14097
14098 Position-independent code requires special support, and therefore works
14099 only on certain machines. For the x86, GCC supports PIC for System V
14100 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14101 position-independent.
14102
14103 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14104 are defined to 1.
14105
14106 @item -fPIC
14107 @opindex fPIC
14108 If supported for the target machine, emit position-independent code,
14109 suitable for dynamic linking and avoiding any limit on the size of the
14110 global offset table. This option makes a difference on AArch64, m68k,
14111 PowerPC and SPARC@.
14112
14113 Position-independent code requires special support, and therefore works
14114 only on certain machines.
14115
14116 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14117 are defined to 2.
14118
14119 @item -fpie
14120 @itemx -fPIE
14121 @opindex fpie
14122 @opindex fPIE
14123 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14124 generated position-independent code can be only linked into executables.
14125 Usually these options are used to compile code that will be linked using
14126 the @option{-pie} GCC option.
14127
14128 @option{-fpie} and @option{-fPIE} both define the macros
14129 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14130 for @option{-fpie} and 2 for @option{-fPIE}.
14131
14132 @item -fno-plt
14133 @opindex fno-plt
14134 @opindex fplt
14135 Do not use the PLT for external function calls in position-independent code.
14136 Instead, load the callee address at call sites from the GOT and branch to it.
14137 This leads to more efficient code by eliminating PLT stubs and exposing
14138 GOT loads to optimizations. On architectures such as 32-bit x86 where
14139 PLT stubs expect the GOT pointer in a specific register, this gives more
14140 register allocation freedom to the compiler.
14141 Lazy binding requires use of the PLT;
14142 with @option{-fno-plt} all external symbols are resolved at load time.
14143
14144 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14145 through the PLT for specific external functions.
14146
14147 In position-dependent code, a few targets also convert calls to
14148 functions that are marked to not use the PLT to use the GOT instead.
14149
14150 @item -fno-jump-tables
14151 @opindex fno-jump-tables
14152 @opindex fjump-tables
14153 Do not use jump tables for switch statements even where it would be
14154 more efficient than other code generation strategies. This option is
14155 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14156 building code that forms part of a dynamic linker and cannot
14157 reference the address of a jump table. On some targets, jump tables
14158 do not require a GOT and this option is not needed.
14159
14160 @item -ffixed-@var{reg}
14161 @opindex ffixed
14162 Treat the register named @var{reg} as a fixed register; generated code
14163 should never refer to it (except perhaps as a stack pointer, frame
14164 pointer or in some other fixed role).
14165
14166 @var{reg} must be the name of a register. The register names accepted
14167 are machine-specific and are defined in the @code{REGISTER_NAMES}
14168 macro in the machine description macro file.
14169
14170 This flag does not have a negative form, because it specifies a
14171 three-way choice.
14172
14173 @item -fcall-used-@var{reg}
14174 @opindex fcall-used
14175 Treat the register named @var{reg} as an allocable register that is
14176 clobbered by function calls. It may be allocated for temporaries or
14177 variables that do not live across a call. Functions compiled this way
14178 do not save and restore the register @var{reg}.
14179
14180 It is an error to use this flag with the frame pointer or stack pointer.
14181 Use of this flag for other registers that have fixed pervasive roles in
14182 the machine's execution model produces disastrous results.
14183
14184 This flag does not have a negative form, because it specifies a
14185 three-way choice.
14186
14187 @item -fcall-saved-@var{reg}
14188 @opindex fcall-saved
14189 Treat the register named @var{reg} as an allocable register saved by
14190 functions. It may be allocated even for temporaries or variables that
14191 live across a call. Functions compiled this way save and restore
14192 the register @var{reg} if they use it.
14193
14194 It is an error to use this flag with the frame pointer or stack pointer.
14195 Use of this flag for other registers that have fixed pervasive roles in
14196 the machine's execution model produces disastrous results.
14197
14198 A different sort of disaster results from the use of this flag for
14199 a register in which function values may be returned.
14200
14201 This flag does not have a negative form, because it specifies a
14202 three-way choice.
14203
14204 @item -fpack-struct[=@var{n}]
14205 @opindex fpack-struct
14206 Without a value specified, pack all structure members together without
14207 holes. When a value is specified (which must be a small power of two), pack
14208 structure members according to this value, representing the maximum
14209 alignment (that is, objects with default alignment requirements larger than
14210 this are output potentially unaligned at the next fitting location.
14211
14212 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14213 code that is not binary compatible with code generated without that switch.
14214 Additionally, it makes the code suboptimal.
14215 Use it to conform to a non-default application binary interface.
14216
14217 @item -fleading-underscore
14218 @opindex fleading-underscore
14219 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14220 change the way C symbols are represented in the object file. One use
14221 is to help link with legacy assembly code.
14222
14223 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14224 generate code that is not binary compatible with code generated without that
14225 switch. Use it to conform to a non-default application binary interface.
14226 Not all targets provide complete support for this switch.
14227
14228 @item -ftls-model=@var{model}
14229 @opindex ftls-model
14230 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14231 The @var{model} argument should be one of @samp{global-dynamic},
14232 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14233 Note that the choice is subject to optimization: the compiler may use
14234 a more efficient model for symbols not visible outside of the translation
14235 unit, or if @option{-fpic} is not given on the command line.
14236
14237 The default without @option{-fpic} is @samp{initial-exec}; with
14238 @option{-fpic} the default is @samp{global-dynamic}.
14239
14240 @item -ftrampolines
14241 @opindex ftrampolines
14242 For targets that normally need trampolines for nested functions, always
14243 generate them instead of using descriptors. Otherwise, for targets that
14244 do not need them, like for example HP-PA or IA-64, do nothing.
14245
14246 A trampoline is a small piece of code that is created at run time on the
14247 stack when the address of a nested function is taken, and is used to call
14248 the nested function indirectly. Therefore, it requires the stack to be
14249 made executable in order for the program to work properly.
14250
14251 @option{-fno-trampolines} is enabled by default on a language by language
14252 basis to let the compiler avoid generating them, if it computes that this
14253 is safe, and replace them with descriptors. Descriptors are made up of data
14254 only, but the generated code must be prepared to deal with them. As of this
14255 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14256
14257 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14258 @option{-fno-trampolines} are not binary compatible if nested functions are
14259 present. This option must therefore be used on a program-wide basis and be
14260 manipulated with extreme care.
14261
14262 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14263 @opindex fvisibility
14264 Set the default ELF image symbol visibility to the specified option---all
14265 symbols are marked with this unless overridden within the code.
14266 Using this feature can very substantially improve linking and
14267 load times of shared object libraries, produce more optimized
14268 code, provide near-perfect API export and prevent symbol clashes.
14269 It is @strong{strongly} recommended that you use this in any shared objects
14270 you distribute.
14271
14272 Despite the nomenclature, @samp{default} always means public; i.e.,
14273 available to be linked against from outside the shared object.
14274 @samp{protected} and @samp{internal} are pretty useless in real-world
14275 usage so the only other commonly used option is @samp{hidden}.
14276 The default if @option{-fvisibility} isn't specified is
14277 @samp{default}, i.e., make every symbol public.
14278
14279 A good explanation of the benefits offered by ensuring ELF
14280 symbols have the correct visibility is given by ``How To Write
14281 Shared Libraries'' by Ulrich Drepper (which can be found at
14282 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14283 solution made possible by this option to marking things hidden when
14284 the default is public is to make the default hidden and mark things
14285 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14286 and @code{__attribute__ ((visibility("default")))} instead of
14287 @code{__declspec(dllexport)} you get almost identical semantics with
14288 identical syntax. This is a great boon to those working with
14289 cross-platform projects.
14290
14291 For those adding visibility support to existing code, you may find
14292 @code{#pragma GCC visibility} of use. This works by you enclosing
14293 the declarations you wish to set visibility for with (for example)
14294 @code{#pragma GCC visibility push(hidden)} and
14295 @code{#pragma GCC visibility pop}.
14296 Bear in mind that symbol visibility should be viewed @strong{as
14297 part of the API interface contract} and thus all new code should
14298 always specify visibility when it is not the default; i.e., declarations
14299 only for use within the local DSO should @strong{always} be marked explicitly
14300 as hidden as so to avoid PLT indirection overheads---making this
14301 abundantly clear also aids readability and self-documentation of the code.
14302 Note that due to ISO C++ specification requirements, @code{operator new} and
14303 @code{operator delete} must always be of default visibility.
14304
14305 Be aware that headers from outside your project, in particular system
14306 headers and headers from any other library you use, may not be
14307 expecting to be compiled with visibility other than the default. You
14308 may need to explicitly say @code{#pragma GCC visibility push(default)}
14309 before including any such headers.
14310
14311 @code{extern} declarations are not affected by @option{-fvisibility}, so
14312 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14313 no modifications. However, this means that calls to @code{extern}
14314 functions with no explicit visibility use the PLT, so it is more
14315 effective to use @code{__attribute ((visibility))} and/or
14316 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14317 declarations should be treated as hidden.
14318
14319 Note that @option{-fvisibility} does affect C++ vague linkage
14320 entities. This means that, for instance, an exception class that is
14321 be thrown between DSOs must be explicitly marked with default
14322 visibility so that the @samp{type_info} nodes are unified between
14323 the DSOs.
14324
14325 An overview of these techniques, their benefits and how to use them
14326 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14327
14328 @item -fstrict-volatile-bitfields
14329 @opindex fstrict-volatile-bitfields
14330 This option should be used if accesses to volatile bit-fields (or other
14331 structure fields, although the compiler usually honors those types
14332 anyway) should use a single access of the width of the
14333 field's type, aligned to a natural alignment if possible. For
14334 example, targets with memory-mapped peripheral registers might require
14335 all such accesses to be 16 bits wide; with this flag you can
14336 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14337 is 16 bits on these targets) to force GCC to use 16-bit accesses
14338 instead of, perhaps, a more efficient 32-bit access.
14339
14340 If this option is disabled, the compiler uses the most efficient
14341 instruction. In the previous example, that might be a 32-bit load
14342 instruction, even though that accesses bytes that do not contain
14343 any portion of the bit-field, or memory-mapped registers unrelated to
14344 the one being updated.
14345
14346 In some cases, such as when the @code{packed} attribute is applied to a
14347 structure field, it may not be possible to access the field with a single
14348 read or write that is correctly aligned for the target machine. In this
14349 case GCC falls back to generating multiple accesses rather than code that
14350 will fault or truncate the result at run time.
14351
14352 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14353 not allowed to touch non bit-field members. It is therefore recommended
14354 to define all bits of the field's type as bit-field members.
14355
14356 The default value of this option is determined by the application binary
14357 interface for the target processor.
14358
14359 @item -fsync-libcalls
14360 @opindex fsync-libcalls
14361 This option controls whether any out-of-line instance of the @code{__sync}
14362 family of functions may be used to implement the C++11 @code{__atomic}
14363 family of functions.
14364
14365 The default value of this option is enabled, thus the only useful form
14366 of the option is @option{-fno-sync-libcalls}. This option is used in
14367 the implementation of the @file{libatomic} runtime library.
14368
14369 @end table
14370
14371 @node Developer Options
14372 @section GCC Developer Options
14373 @cindex developer options
14374 @cindex debugging GCC
14375 @cindex debug dump options
14376 @cindex dump options
14377 @cindex compilation statistics
14378
14379 This section describes command-line options that are primarily of
14380 interest to GCC developers, including options to support compiler
14381 testing and investigation of compiler bugs and compile-time
14382 performance problems. This includes options that produce debug dumps
14383 at various points in the compilation; that print statistics such as
14384 memory use and execution time; and that print information about GCC's
14385 configuration, such as where it searches for libraries. You should
14386 rarely need to use any of these options for ordinary compilation and
14387 linking tasks.
14388
14389 Many developer options that cause GCC to dump output to a file take an
14390 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14391 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14392 error.
14393
14394 If @samp{=@var{filename}} is omitted, a default dump file name is
14395 constructed by concatenating the base dump file name, a pass number,
14396 phase letter, and pass name. The base dump file name is the name of
14397 output file produced by the compiler if explicitly specified and not
14398 an executable; otherwise it is the source file name.
14399 The pass number is determined by the order passes are registered with
14400 the compiler's pass manager.
14401 This is generally the same as the order of execution, but passes
14402 registered by plugins, target-specific passes, or passes that are
14403 otherwise registered late are numbered higher than the pass named
14404 @samp{final}, even if they are executed earlier. The phase letter is
14405 one of @samp{i} (inter-procedural analysis), @samp{l}
14406 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14407 The files are created in the directory of the output file.
14408
14409 @table @gcctabopt
14410
14411 @item -d@var{letters}
14412 @itemx -fdump-rtl-@var{pass}
14413 @itemx -fdump-rtl-@var{pass}=@var{filename}
14414 @opindex d
14415 @opindex fdump-rtl-@var{pass}
14416 Says to make debugging dumps during compilation at times specified by
14417 @var{letters}. This is used for debugging the RTL-based passes of the
14418 compiler.
14419
14420 Some @option{-d@var{letters}} switches have different meaning when
14421 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14422 for information about preprocessor-specific dump options.
14423
14424 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14425 @option{-d} option @var{letters}. Here are the possible
14426 letters for use in @var{pass} and @var{letters}, and their meanings:
14427
14428 @table @gcctabopt
14429
14430 @item -fdump-rtl-alignments
14431 @opindex fdump-rtl-alignments
14432 Dump after branch alignments have been computed.
14433
14434 @item -fdump-rtl-asmcons
14435 @opindex fdump-rtl-asmcons
14436 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14437
14438 @item -fdump-rtl-auto_inc_dec
14439 @opindex fdump-rtl-auto_inc_dec
14440 Dump after auto-inc-dec discovery. This pass is only run on
14441 architectures that have auto inc or auto dec instructions.
14442
14443 @item -fdump-rtl-barriers
14444 @opindex fdump-rtl-barriers
14445 Dump after cleaning up the barrier instructions.
14446
14447 @item -fdump-rtl-bbpart
14448 @opindex fdump-rtl-bbpart
14449 Dump after partitioning hot and cold basic blocks.
14450
14451 @item -fdump-rtl-bbro
14452 @opindex fdump-rtl-bbro
14453 Dump after block reordering.
14454
14455 @item -fdump-rtl-btl1
14456 @itemx -fdump-rtl-btl2
14457 @opindex fdump-rtl-btl2
14458 @opindex fdump-rtl-btl2
14459 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14460 after the two branch
14461 target load optimization passes.
14462
14463 @item -fdump-rtl-bypass
14464 @opindex fdump-rtl-bypass
14465 Dump after jump bypassing and control flow optimizations.
14466
14467 @item -fdump-rtl-combine
14468 @opindex fdump-rtl-combine
14469 Dump after the RTL instruction combination pass.
14470
14471 @item -fdump-rtl-compgotos
14472 @opindex fdump-rtl-compgotos
14473 Dump after duplicating the computed gotos.
14474
14475 @item -fdump-rtl-ce1
14476 @itemx -fdump-rtl-ce2
14477 @itemx -fdump-rtl-ce3
14478 @opindex fdump-rtl-ce1
14479 @opindex fdump-rtl-ce2
14480 @opindex fdump-rtl-ce3
14481 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14482 @option{-fdump-rtl-ce3} enable dumping after the three
14483 if conversion passes.
14484
14485 @item -fdump-rtl-cprop_hardreg
14486 @opindex fdump-rtl-cprop_hardreg
14487 Dump after hard register copy propagation.
14488
14489 @item -fdump-rtl-csa
14490 @opindex fdump-rtl-csa
14491 Dump after combining stack adjustments.
14492
14493 @item -fdump-rtl-cse1
14494 @itemx -fdump-rtl-cse2
14495 @opindex fdump-rtl-cse1
14496 @opindex fdump-rtl-cse2
14497 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14498 the two common subexpression elimination passes.
14499
14500 @item -fdump-rtl-dce
14501 @opindex fdump-rtl-dce
14502 Dump after the standalone dead code elimination passes.
14503
14504 @item -fdump-rtl-dbr
14505 @opindex fdump-rtl-dbr
14506 Dump after delayed branch scheduling.
14507
14508 @item -fdump-rtl-dce1
14509 @itemx -fdump-rtl-dce2
14510 @opindex fdump-rtl-dce1
14511 @opindex fdump-rtl-dce2
14512 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14513 the two dead store elimination passes.
14514
14515 @item -fdump-rtl-eh
14516 @opindex fdump-rtl-eh
14517 Dump after finalization of EH handling code.
14518
14519 @item -fdump-rtl-eh_ranges
14520 @opindex fdump-rtl-eh_ranges
14521 Dump after conversion of EH handling range regions.
14522
14523 @item -fdump-rtl-expand
14524 @opindex fdump-rtl-expand
14525 Dump after RTL generation.
14526
14527 @item -fdump-rtl-fwprop1
14528 @itemx -fdump-rtl-fwprop2
14529 @opindex fdump-rtl-fwprop1
14530 @opindex fdump-rtl-fwprop2
14531 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14532 dumping after the two forward propagation passes.
14533
14534 @item -fdump-rtl-gcse1
14535 @itemx -fdump-rtl-gcse2
14536 @opindex fdump-rtl-gcse1
14537 @opindex fdump-rtl-gcse2
14538 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14539 after global common subexpression elimination.
14540
14541 @item -fdump-rtl-init-regs
14542 @opindex fdump-rtl-init-regs
14543 Dump after the initialization of the registers.
14544
14545 @item -fdump-rtl-initvals
14546 @opindex fdump-rtl-initvals
14547 Dump after the computation of the initial value sets.
14548
14549 @item -fdump-rtl-into_cfglayout
14550 @opindex fdump-rtl-into_cfglayout
14551 Dump after converting to cfglayout mode.
14552
14553 @item -fdump-rtl-ira
14554 @opindex fdump-rtl-ira
14555 Dump after iterated register allocation.
14556
14557 @item -fdump-rtl-jump
14558 @opindex fdump-rtl-jump
14559 Dump after the second jump optimization.
14560
14561 @item -fdump-rtl-loop2
14562 @opindex fdump-rtl-loop2
14563 @option{-fdump-rtl-loop2} enables dumping after the rtl
14564 loop optimization passes.
14565
14566 @item -fdump-rtl-mach
14567 @opindex fdump-rtl-mach
14568 Dump after performing the machine dependent reorganization pass, if that
14569 pass exists.
14570
14571 @item -fdump-rtl-mode_sw
14572 @opindex fdump-rtl-mode_sw
14573 Dump after removing redundant mode switches.
14574
14575 @item -fdump-rtl-rnreg
14576 @opindex fdump-rtl-rnreg
14577 Dump after register renumbering.
14578
14579 @item -fdump-rtl-outof_cfglayout
14580 @opindex fdump-rtl-outof_cfglayout
14581 Dump after converting from cfglayout mode.
14582
14583 @item -fdump-rtl-peephole2
14584 @opindex fdump-rtl-peephole2
14585 Dump after the peephole pass.
14586
14587 @item -fdump-rtl-postreload
14588 @opindex fdump-rtl-postreload
14589 Dump after post-reload optimizations.
14590
14591 @item -fdump-rtl-pro_and_epilogue
14592 @opindex fdump-rtl-pro_and_epilogue
14593 Dump after generating the function prologues and epilogues.
14594
14595 @item -fdump-rtl-sched1
14596 @itemx -fdump-rtl-sched2
14597 @opindex fdump-rtl-sched1
14598 @opindex fdump-rtl-sched2
14599 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14600 after the basic block scheduling passes.
14601
14602 @item -fdump-rtl-ree
14603 @opindex fdump-rtl-ree
14604 Dump after sign/zero extension elimination.
14605
14606 @item -fdump-rtl-seqabstr
14607 @opindex fdump-rtl-seqabstr
14608 Dump after common sequence discovery.
14609
14610 @item -fdump-rtl-shorten
14611 @opindex fdump-rtl-shorten
14612 Dump after shortening branches.
14613
14614 @item -fdump-rtl-sibling
14615 @opindex fdump-rtl-sibling
14616 Dump after sibling call optimizations.
14617
14618 @item -fdump-rtl-split1
14619 @itemx -fdump-rtl-split2
14620 @itemx -fdump-rtl-split3
14621 @itemx -fdump-rtl-split4
14622 @itemx -fdump-rtl-split5
14623 @opindex fdump-rtl-split1
14624 @opindex fdump-rtl-split2
14625 @opindex fdump-rtl-split3
14626 @opindex fdump-rtl-split4
14627 @opindex fdump-rtl-split5
14628 These options enable dumping after five rounds of
14629 instruction splitting.
14630
14631 @item -fdump-rtl-sms
14632 @opindex fdump-rtl-sms
14633 Dump after modulo scheduling. This pass is only run on some
14634 architectures.
14635
14636 @item -fdump-rtl-stack
14637 @opindex fdump-rtl-stack
14638 Dump after conversion from GCC's ``flat register file'' registers to the
14639 x87's stack-like registers. This pass is only run on x86 variants.
14640
14641 @item -fdump-rtl-subreg1
14642 @itemx -fdump-rtl-subreg2
14643 @opindex fdump-rtl-subreg1
14644 @opindex fdump-rtl-subreg2
14645 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14646 the two subreg expansion passes.
14647
14648 @item -fdump-rtl-unshare
14649 @opindex fdump-rtl-unshare
14650 Dump after all rtl has been unshared.
14651
14652 @item -fdump-rtl-vartrack
14653 @opindex fdump-rtl-vartrack
14654 Dump after variable tracking.
14655
14656 @item -fdump-rtl-vregs
14657 @opindex fdump-rtl-vregs
14658 Dump after converting virtual registers to hard registers.
14659
14660 @item -fdump-rtl-web
14661 @opindex fdump-rtl-web
14662 Dump after live range splitting.
14663
14664 @item -fdump-rtl-regclass
14665 @itemx -fdump-rtl-subregs_of_mode_init
14666 @itemx -fdump-rtl-subregs_of_mode_finish
14667 @itemx -fdump-rtl-dfinit
14668 @itemx -fdump-rtl-dfinish
14669 @opindex fdump-rtl-regclass
14670 @opindex fdump-rtl-subregs_of_mode_init
14671 @opindex fdump-rtl-subregs_of_mode_finish
14672 @opindex fdump-rtl-dfinit
14673 @opindex fdump-rtl-dfinish
14674 These dumps are defined but always produce empty files.
14675
14676 @item -da
14677 @itemx -fdump-rtl-all
14678 @opindex da
14679 @opindex fdump-rtl-all
14680 Produce all the dumps listed above.
14681
14682 @item -dA
14683 @opindex dA
14684 Annotate the assembler output with miscellaneous debugging information.
14685
14686 @item -dD
14687 @opindex dD
14688 Dump all macro definitions, at the end of preprocessing, in addition to
14689 normal output.
14690
14691 @item -dH
14692 @opindex dH
14693 Produce a core dump whenever an error occurs.
14694
14695 @item -dp
14696 @opindex dp
14697 Annotate the assembler output with a comment indicating which
14698 pattern and alternative is used. The length and cost of each instruction are
14699 also printed.
14700
14701 @item -dP
14702 @opindex dP
14703 Dump the RTL in the assembler output as a comment before each instruction.
14704 Also turns on @option{-dp} annotation.
14705
14706 @item -dx
14707 @opindex dx
14708 Just generate RTL for a function instead of compiling it. Usually used
14709 with @option{-fdump-rtl-expand}.
14710 @end table
14711
14712 @item -fdump-debug
14713 @opindex fdump-debug
14714 Dump debugging information generated during the debug
14715 generation phase.
14716
14717 @item -fdump-earlydebug
14718 @opindex fdump-earlydebug
14719 Dump debugging information generated during the early debug
14720 generation phase.
14721
14722 @item -fdump-noaddr
14723 @opindex fdump-noaddr
14724 When doing debugging dumps, suppress address output. This makes it more
14725 feasible to use diff on debugging dumps for compiler invocations with
14726 different compiler binaries and/or different
14727 text / bss / data / heap / stack / dso start locations.
14728
14729 @item -freport-bug
14730 @opindex freport-bug
14731 Collect and dump debug information into a temporary file if an
14732 internal compiler error (ICE) occurs.
14733
14734 @item -fdump-unnumbered
14735 @opindex fdump-unnumbered
14736 When doing debugging dumps, suppress instruction numbers and address output.
14737 This makes it more feasible to use diff on debugging dumps for compiler
14738 invocations with different options, in particular with and without
14739 @option{-g}.
14740
14741 @item -fdump-unnumbered-links
14742 @opindex fdump-unnumbered-links
14743 When doing debugging dumps (see @option{-d} option above), suppress
14744 instruction numbers for the links to the previous and next instructions
14745 in a sequence.
14746
14747 @item -fdump-ipa-@var{switch}
14748 @itemx -fdump-ipa-@var{switch}-@var{options}
14749 @opindex fdump-ipa
14750 Control the dumping at various stages of inter-procedural analysis
14751 language tree to a file. The file name is generated by appending a
14752 switch specific suffix to the source file name, and the file is created
14753 in the same directory as the output file. The following dumps are
14754 possible:
14755
14756 @table @samp
14757 @item all
14758 Enables all inter-procedural analysis dumps.
14759
14760 @item cgraph
14761 Dumps information about call-graph optimization, unused function removal,
14762 and inlining decisions.
14763
14764 @item inline
14765 Dump after function inlining.
14766
14767 @end table
14768
14769 Additionally, the options @option{-optimized}, @option{-missed},
14770 @option{-note}, and @option{-all} can be provided, with the same meaning
14771 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14772
14773 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14774 information on callsites that were inlined, along with callsites
14775 that were not inlined.
14776
14777 By default, the dump will contain messages about successful
14778 optimizations (equivalent to @option{-optimized}) together with
14779 low-level details about the analysis.
14780
14781 @item -fdump-lang-all
14782 @itemx -fdump-lang-@var{switch}
14783 @itemx -fdump-lang-@var{switch}-@var{options}
14784 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14785 @opindex fdump-lang-all
14786 @opindex fdump-lang
14787 Control the dumping of language-specific information. The @var{options}
14788 and @var{filename} portions behave as described in the
14789 @option{-fdump-tree} option. The following @var{switch} values are
14790 accepted:
14791
14792 @table @samp
14793 @item all
14794
14795 Enable all language-specific dumps.
14796
14797 @item class
14798 Dump class hierarchy information. Virtual table information is emitted
14799 unless '@option{slim}' is specified. This option is applicable to C++ only.
14800
14801 @item raw
14802 Dump the raw internal tree data. This option is applicable to C++ only.
14803
14804 @end table
14805
14806 @item -fdump-passes
14807 @opindex fdump-passes
14808 Print on @file{stderr} the list of optimization passes that are turned
14809 on and off by the current command-line options.
14810
14811 @item -fdump-statistics-@var{option}
14812 @opindex fdump-statistics
14813 Enable and control dumping of pass statistics in a separate file. The
14814 file name is generated by appending a suffix ending in
14815 @samp{.statistics} to the source file name, and the file is created in
14816 the same directory as the output file. If the @samp{-@var{option}}
14817 form is used, @samp{-stats} causes counters to be summed over the
14818 whole compilation unit while @samp{-details} dumps every event as
14819 the passes generate them. The default with no option is to sum
14820 counters for each function compiled.
14821
14822 @item -fdump-tree-all
14823 @itemx -fdump-tree-@var{switch}
14824 @itemx -fdump-tree-@var{switch}-@var{options}
14825 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14826 @opindex fdump-tree-all
14827 @opindex fdump-tree
14828 Control the dumping at various stages of processing the intermediate
14829 language tree to a file. If the @samp{-@var{options}}
14830 form is used, @var{options} is a list of @samp{-} separated options
14831 which control the details of the dump. Not all options are applicable
14832 to all dumps; those that are not meaningful are ignored. The
14833 following options are available
14834
14835 @table @samp
14836 @item address
14837 Print the address of each node. Usually this is not meaningful as it
14838 changes according to the environment and source file. Its primary use
14839 is for tying up a dump file with a debug environment.
14840 @item asmname
14841 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14842 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14843 use working backward from mangled names in the assembly file.
14844 @item slim
14845 When dumping front-end intermediate representations, inhibit dumping
14846 of members of a scope or body of a function merely because that scope
14847 has been reached. Only dump such items when they are directly reachable
14848 by some other path.
14849
14850 When dumping pretty-printed trees, this option inhibits dumping the
14851 bodies of control structures.
14852
14853 When dumping RTL, print the RTL in slim (condensed) form instead of
14854 the default LISP-like representation.
14855 @item raw
14856 Print a raw representation of the tree. By default, trees are
14857 pretty-printed into a C-like representation.
14858 @item details
14859 Enable more detailed dumps (not honored by every dump option). Also
14860 include information from the optimization passes.
14861 @item stats
14862 Enable dumping various statistics about the pass (not honored by every dump
14863 option).
14864 @item blocks
14865 Enable showing basic block boundaries (disabled in raw dumps).
14866 @item graph
14867 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14868 dump a representation of the control flow graph suitable for viewing with
14869 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14870 the file is pretty-printed as a subgraph, so that GraphViz can render them
14871 all in a single plot.
14872
14873 This option currently only works for RTL dumps, and the RTL is always
14874 dumped in slim form.
14875 @item vops
14876 Enable showing virtual operands for every statement.
14877 @item lineno
14878 Enable showing line numbers for statements.
14879 @item uid
14880 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14881 @item verbose
14882 Enable showing the tree dump for each statement.
14883 @item eh
14884 Enable showing the EH region number holding each statement.
14885 @item scev
14886 Enable showing scalar evolution analysis details.
14887 @item optimized
14888 Enable showing optimization information (only available in certain
14889 passes).
14890 @item missed
14891 Enable showing missed optimization information (only available in certain
14892 passes).
14893 @item note
14894 Enable other detailed optimization information (only available in
14895 certain passes).
14896 @item all
14897 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14898 and @option{lineno}.
14899 @item optall
14900 Turn on all optimization options, i.e., @option{optimized},
14901 @option{missed}, and @option{note}.
14902 @end table
14903
14904 To determine what tree dumps are available or find the dump for a pass
14905 of interest follow the steps below.
14906
14907 @enumerate
14908 @item
14909 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14910 look for a code that corresponds to the pass you are interested in.
14911 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14912 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14913 The number at the end distinguishes distinct invocations of the same pass.
14914 @item
14915 To enable the creation of the dump file, append the pass code to
14916 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14917 to enable the dump from the Early Value Range Propagation pass, invoke
14918 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14919 specify the name of the dump file. If you don't specify one, GCC
14920 creates as described below.
14921 @item
14922 Find the pass dump in a file whose name is composed of three components
14923 separated by a period: the name of the source file GCC was invoked to
14924 compile, a numeric suffix indicating the pass number followed by the
14925 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14926 and finally the pass code. For example, the Early VRP pass dump might
14927 be in a file named @file{myfile.c.038t.evrp} in the current working
14928 directory. Note that the numeric codes are not stable and may change
14929 from one version of GCC to another.
14930 @end enumerate
14931
14932 @item -fopt-info
14933 @itemx -fopt-info-@var{options}
14934 @itemx -fopt-info-@var{options}=@var{filename}
14935 @opindex fopt-info
14936 Controls optimization dumps from various optimization passes. If the
14937 @samp{-@var{options}} form is used, @var{options} is a list of
14938 @samp{-} separated option keywords to select the dump details and
14939 optimizations.
14940
14941 The @var{options} can be divided into three groups:
14942 @enumerate
14943 @item
14944 options describing what kinds of messages should be emitted,
14945 @item
14946 options describing the verbosity of the dump, and
14947 @item
14948 options describing which optimizations should be included.
14949 @end enumerate
14950 The options from each group can be freely mixed as they are
14951 non-overlapping. However, in case of any conflicts,
14952 the later options override the earlier options on the command
14953 line.
14954
14955 The following options control which kinds of messages should be emitted:
14956
14957 @table @samp
14958 @item optimized
14959 Print information when an optimization is successfully applied. It is
14960 up to a pass to decide which information is relevant. For example, the
14961 vectorizer passes print the source location of loops which are
14962 successfully vectorized.
14963 @item missed
14964 Print information about missed optimizations. Individual passes
14965 control which information to include in the output.
14966 @item note
14967 Print verbose information about optimizations, such as certain
14968 transformations, more detailed messages about decisions etc.
14969 @item all
14970 Print detailed optimization information. This includes
14971 @samp{optimized}, @samp{missed}, and @samp{note}.
14972 @end table
14973
14974 The following option controls the dump verbosity:
14975
14976 @table @samp
14977 @item internals
14978 By default, only ``high-level'' messages are emitted. This option enables
14979 additional, more detailed, messages, which are likely to only be of interest
14980 to GCC developers.
14981 @end table
14982
14983 One or more of the following option keywords can be used to describe a
14984 group of optimizations:
14985
14986 @table @samp
14987 @item ipa
14988 Enable dumps from all interprocedural optimizations.
14989 @item loop
14990 Enable dumps from all loop optimizations.
14991 @item inline
14992 Enable dumps from all inlining optimizations.
14993 @item omp
14994 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14995 @item vec
14996 Enable dumps from all vectorization optimizations.
14997 @item optall
14998 Enable dumps from all optimizations. This is a superset of
14999 the optimization groups listed above.
15000 @end table
15001
15002 If @var{options} is
15003 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15004 about successful optimizations from all the passes, omitting messages
15005 that are treated as ``internals''.
15006
15007 If the @var{filename} is provided, then the dumps from all the
15008 applicable optimizations are concatenated into the @var{filename}.
15009 Otherwise the dump is output onto @file{stderr}. Though multiple
15010 @option{-fopt-info} options are accepted, only one of them can include
15011 a @var{filename}. If other filenames are provided then all but the
15012 first such option are ignored.
15013
15014 Note that the output @var{filename} is overwritten
15015 in case of multiple translation units. If a combined output from
15016 multiple translation units is desired, @file{stderr} should be used
15017 instead.
15018
15019 In the following example, the optimization info is output to
15020 @file{stderr}:
15021
15022 @smallexample
15023 gcc -O3 -fopt-info
15024 @end smallexample
15025
15026 This example:
15027 @smallexample
15028 gcc -O3 -fopt-info-missed=missed.all
15029 @end smallexample
15030
15031 @noindent
15032 outputs missed optimization report from all the passes into
15033 @file{missed.all}, and this one:
15034
15035 @smallexample
15036 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15037 @end smallexample
15038
15039 @noindent
15040 prints information about missed optimization opportunities from
15041 vectorization passes on @file{stderr}.
15042 Note that @option{-fopt-info-vec-missed} is equivalent to
15043 @option{-fopt-info-missed-vec}. The order of the optimization group
15044 names and message types listed after @option{-fopt-info} does not matter.
15045
15046 As another example,
15047 @smallexample
15048 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15049 @end smallexample
15050
15051 @noindent
15052 outputs information about missed optimizations as well as
15053 optimized locations from all the inlining passes into
15054 @file{inline.txt}.
15055
15056 Finally, consider:
15057
15058 @smallexample
15059 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15060 @end smallexample
15061
15062 @noindent
15063 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15064 in conflict since only one output file is allowed. In this case, only
15065 the first option takes effect and the subsequent options are
15066 ignored. Thus only @file{vec.miss} is produced which contains
15067 dumps from the vectorizer about missed opportunities.
15068
15069 @item -fsave-optimization-record
15070 @opindex fsave-optimization-record
15071 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15072 were performed, for those optimizations that support @option{-fopt-info}.
15073
15074 This option is experimental and the format of the data within the
15075 compressed JSON file is subject to change.
15076
15077 It is roughly equivalent to a machine-readable version of
15078 @option{-fopt-info-all}, as a collection of messages with source file,
15079 line number and column number, with the following additional data for
15080 each message:
15081
15082 @itemize @bullet
15083
15084 @item
15085 the execution count of the code being optimized, along with metadata about
15086 whether this was from actual profile data, or just an estimate, allowing
15087 consumers to prioritize messages by code hotness,
15088
15089 @item
15090 the function name of the code being optimized, where applicable,
15091
15092 @item
15093 the ``inlining chain'' for the code being optimized, so that when
15094 a function is inlined into several different places (which might
15095 themselves be inlined), the reader can distinguish between the copies,
15096
15097 @item
15098 objects identifying those parts of the message that refer to expressions,
15099 statements or symbol-table nodes, which of these categories they are, and,
15100 when available, their source code location,
15101
15102 @item
15103 the GCC pass that emitted the message, and
15104
15105 @item
15106 the location in GCC's own code from which the message was emitted
15107
15108 @end itemize
15109
15110 Additionally, some messages are logically nested within other
15111 messages, reflecting implementation details of the optimization
15112 passes.
15113
15114 @item -fsched-verbose=@var{n}
15115 @opindex fsched-verbose
15116 On targets that use instruction scheduling, this option controls the
15117 amount of debugging output the scheduler prints to the dump files.
15118
15119 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15120 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15121 For @var{n} greater than one, it also output basic block probabilities,
15122 detailed ready list information and unit/insn info. For @var{n} greater
15123 than two, it includes RTL at abort point, control-flow and regions info.
15124 And for @var{n} over four, @option{-fsched-verbose} also includes
15125 dependence info.
15126
15127
15128
15129 @item -fenable-@var{kind}-@var{pass}
15130 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15131 @opindex fdisable-
15132 @opindex fenable-
15133
15134 This is a set of options that are used to explicitly disable/enable
15135 optimization passes. These options are intended for use for debugging GCC.
15136 Compiler users should use regular options for enabling/disabling
15137 passes instead.
15138
15139 @table @gcctabopt
15140
15141 @item -fdisable-ipa-@var{pass}
15142 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15143 statically invoked in the compiler multiple times, the pass name should be
15144 appended with a sequential number starting from 1.
15145
15146 @item -fdisable-rtl-@var{pass}
15147 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15148 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15149 statically invoked in the compiler multiple times, the pass name should be
15150 appended with a sequential number starting from 1. @var{range-list} is a
15151 comma-separated list of function ranges or assembler names. Each range is a number
15152 pair separated by a colon. The range is inclusive in both ends. If the range
15153 is trivial, the number pair can be simplified as a single number. If the
15154 function's call graph node's @var{uid} falls within one of the specified ranges,
15155 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15156 function header of a dump file, and the pass names can be dumped by using
15157 option @option{-fdump-passes}.
15158
15159 @item -fdisable-tree-@var{pass}
15160 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15161 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15162 option arguments.
15163
15164 @item -fenable-ipa-@var{pass}
15165 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15166 statically invoked in the compiler multiple times, the pass name should be
15167 appended with a sequential number starting from 1.
15168
15169 @item -fenable-rtl-@var{pass}
15170 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15171 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15172 description and examples.
15173
15174 @item -fenable-tree-@var{pass}
15175 @itemx -fenable-tree-@var{pass}=@var{range-list}
15176 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15177 of option arguments.
15178
15179 @end table
15180
15181 Here are some examples showing uses of these options.
15182
15183 @smallexample
15184
15185 # disable ccp1 for all functions
15186 -fdisable-tree-ccp1
15187 # disable complete unroll for function whose cgraph node uid is 1
15188 -fenable-tree-cunroll=1
15189 # disable gcse2 for functions at the following ranges [1,1],
15190 # [300,400], and [400,1000]
15191 # disable gcse2 for functions foo and foo2
15192 -fdisable-rtl-gcse2=foo,foo2
15193 # disable early inlining
15194 -fdisable-tree-einline
15195 # disable ipa inlining
15196 -fdisable-ipa-inline
15197 # enable tree full unroll
15198 -fenable-tree-unroll
15199
15200 @end smallexample
15201
15202 @item -fchecking
15203 @itemx -fchecking=@var{n}
15204 @opindex fchecking
15205 @opindex fno-checking
15206 Enable internal consistency checking. The default depends on
15207 the compiler configuration. @option{-fchecking=2} enables further
15208 internal consistency checking that might affect code generation.
15209
15210 @item -frandom-seed=@var{string}
15211 @opindex frandom-seed
15212 This option provides a seed that GCC uses in place of
15213 random numbers in generating certain symbol names
15214 that have to be different in every compiled file. It is also used to
15215 place unique stamps in coverage data files and the object files that
15216 produce them. You can use the @option{-frandom-seed} option to produce
15217 reproducibly identical object files.
15218
15219 The @var{string} can either be a number (decimal, octal or hex) or an
15220 arbitrary string (in which case it's converted to a number by
15221 computing CRC32).
15222
15223 The @var{string} should be different for every file you compile.
15224
15225 @item -save-temps
15226 @itemx -save-temps=cwd
15227 @opindex save-temps
15228 Store the usual ``temporary'' intermediate files permanently; place them
15229 in the current directory and name them based on the source file. Thus,
15230 compiling @file{foo.c} with @option{-c -save-temps} produces files
15231 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15232 preprocessed @file{foo.i} output file even though the compiler now
15233 normally uses an integrated preprocessor.
15234
15235 When used in combination with the @option{-x} command-line option,
15236 @option{-save-temps} is sensible enough to avoid over writing an
15237 input source file with the same extension as an intermediate file.
15238 The corresponding intermediate file may be obtained by renaming the
15239 source file before using @option{-save-temps}.
15240
15241 If you invoke GCC in parallel, compiling several different source
15242 files that share a common base name in different subdirectories or the
15243 same source file compiled for multiple output destinations, it is
15244 likely that the different parallel compilers will interfere with each
15245 other, and overwrite the temporary files. For instance:
15246
15247 @smallexample
15248 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15249 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15250 @end smallexample
15251
15252 may result in @file{foo.i} and @file{foo.o} being written to
15253 simultaneously by both compilers.
15254
15255 @item -save-temps=obj
15256 @opindex save-temps=obj
15257 Store the usual ``temporary'' intermediate files permanently. If the
15258 @option{-o} option is used, the temporary files are based on the
15259 object file. If the @option{-o} option is not used, the
15260 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15261
15262 For example:
15263
15264 @smallexample
15265 gcc -save-temps=obj -c foo.c
15266 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15267 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15268 @end smallexample
15269
15270 @noindent
15271 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15272 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15273 @file{dir2/yfoobar.o}.
15274
15275 @item -time@r{[}=@var{file}@r{]}
15276 @opindex time
15277 Report the CPU time taken by each subprocess in the compilation
15278 sequence. For C source files, this is the compiler proper and assembler
15279 (plus the linker if linking is done).
15280
15281 Without the specification of an output file, the output looks like this:
15282
15283 @smallexample
15284 # cc1 0.12 0.01
15285 # as 0.00 0.01
15286 @end smallexample
15287
15288 The first number on each line is the ``user time'', that is time spent
15289 executing the program itself. The second number is ``system time'',
15290 time spent executing operating system routines on behalf of the program.
15291 Both numbers are in seconds.
15292
15293 With the specification of an output file, the output is appended to the
15294 named file, and it looks like this:
15295
15296 @smallexample
15297 0.12 0.01 cc1 @var{options}
15298 0.00 0.01 as @var{options}
15299 @end smallexample
15300
15301 The ``user time'' and the ``system time'' are moved before the program
15302 name, and the options passed to the program are displayed, so that one
15303 can later tell what file was being compiled, and with which options.
15304
15305 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15306 @opindex fdump-final-insns
15307 Dump the final internal representation (RTL) to @var{file}. If the
15308 optional argument is omitted (or if @var{file} is @code{.}), the name
15309 of the dump file is determined by appending @code{.gkd} to the
15310 compilation output file name.
15311
15312 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15313 @opindex fcompare-debug
15314 @opindex fno-compare-debug
15315 If no error occurs during compilation, run the compiler a second time,
15316 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15317 passed to the second compilation. Dump the final internal
15318 representation in both compilations, and print an error if they differ.
15319
15320 If the equal sign is omitted, the default @option{-gtoggle} is used.
15321
15322 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15323 and nonzero, implicitly enables @option{-fcompare-debug}. If
15324 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15325 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15326 is used.
15327
15328 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15329 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15330 of the final representation and the second compilation, preventing even
15331 @env{GCC_COMPARE_DEBUG} from taking effect.
15332
15333 To verify full coverage during @option{-fcompare-debug} testing, set
15334 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15335 which GCC rejects as an invalid option in any actual compilation
15336 (rather than preprocessing, assembly or linking). To get just a
15337 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15338 not overridden} will do.
15339
15340 @item -fcompare-debug-second
15341 @opindex fcompare-debug-second
15342 This option is implicitly passed to the compiler for the second
15343 compilation requested by @option{-fcompare-debug}, along with options to
15344 silence warnings, and omitting other options that would cause the compiler
15345 to produce output to files or to standard output as a side effect. Dump
15346 files and preserved temporary files are renamed so as to contain the
15347 @code{.gk} additional extension during the second compilation, to avoid
15348 overwriting those generated by the first.
15349
15350 When this option is passed to the compiler driver, it causes the
15351 @emph{first} compilation to be skipped, which makes it useful for little
15352 other than debugging the compiler proper.
15353
15354 @item -gtoggle
15355 @opindex gtoggle
15356 Turn off generation of debug info, if leaving out this option
15357 generates it, or turn it on at level 2 otherwise. The position of this
15358 argument in the command line does not matter; it takes effect after all
15359 other options are processed, and it does so only once, no matter how
15360 many times it is given. This is mainly intended to be used with
15361 @option{-fcompare-debug}.
15362
15363 @item -fvar-tracking-assignments-toggle
15364 @opindex fvar-tracking-assignments-toggle
15365 @opindex fno-var-tracking-assignments-toggle
15366 Toggle @option{-fvar-tracking-assignments}, in the same way that
15367 @option{-gtoggle} toggles @option{-g}.
15368
15369 @item -Q
15370 @opindex Q
15371 Makes the compiler print out each function name as it is compiled, and
15372 print some statistics about each pass when it finishes.
15373
15374 @item -ftime-report
15375 @opindex ftime-report
15376 Makes the compiler print some statistics about the time consumed by each
15377 pass when it finishes.
15378
15379 @item -ftime-report-details
15380 @opindex ftime-report-details
15381 Record the time consumed by infrastructure parts separately for each pass.
15382
15383 @item -fira-verbose=@var{n}
15384 @opindex fira-verbose
15385 Control the verbosity of the dump file for the integrated register allocator.
15386 The default value is 5. If the value @var{n} is greater or equal to 10,
15387 the dump output is sent to stderr using the same format as @var{n} minus 10.
15388
15389 @item -flto-report
15390 @opindex flto-report
15391 Prints a report with internal details on the workings of the link-time
15392 optimizer. The contents of this report vary from version to version.
15393 It is meant to be useful to GCC developers when processing object
15394 files in LTO mode (via @option{-flto}).
15395
15396 Disabled by default.
15397
15398 @item -flto-report-wpa
15399 @opindex flto-report-wpa
15400 Like @option{-flto-report}, but only print for the WPA phase of link-time
15401 optimization.
15402
15403 @item -fmem-report
15404 @opindex fmem-report
15405 Makes the compiler print some statistics about permanent memory
15406 allocation when it finishes.
15407
15408 @item -fmem-report-wpa
15409 @opindex fmem-report-wpa
15410 Makes the compiler print some statistics about permanent memory
15411 allocation for the WPA phase only.
15412
15413 @item -fpre-ipa-mem-report
15414 @opindex fpre-ipa-mem-report
15415 @item -fpost-ipa-mem-report
15416 @opindex fpost-ipa-mem-report
15417 Makes the compiler print some statistics about permanent memory
15418 allocation before or after interprocedural optimization.
15419
15420 @item -fprofile-report
15421 @opindex fprofile-report
15422 Makes the compiler print some statistics about consistency of the
15423 (estimated) profile and effect of individual passes.
15424
15425 @item -fstack-usage
15426 @opindex fstack-usage
15427 Makes the compiler output stack usage information for the program, on a
15428 per-function basis. The filename for the dump is made by appending
15429 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15430 the output file, if explicitly specified and it is not an executable,
15431 otherwise it is the basename of the source file. An entry is made up
15432 of three fields:
15433
15434 @itemize
15435 @item
15436 The name of the function.
15437 @item
15438 A number of bytes.
15439 @item
15440 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15441 @end itemize
15442
15443 The qualifier @code{static} means that the function manipulates the stack
15444 statically: a fixed number of bytes are allocated for the frame on function
15445 entry and released on function exit; no stack adjustments are otherwise made
15446 in the function. The second field is this fixed number of bytes.
15447
15448 The qualifier @code{dynamic} means that the function manipulates the stack
15449 dynamically: in addition to the static allocation described above, stack
15450 adjustments are made in the body of the function, for example to push/pop
15451 arguments around function calls. If the qualifier @code{bounded} is also
15452 present, the amount of these adjustments is bounded at compile time and
15453 the second field is an upper bound of the total amount of stack used by
15454 the function. If it is not present, the amount of these adjustments is
15455 not bounded at compile time and the second field only represents the
15456 bounded part.
15457
15458 @item -fstats
15459 @opindex fstats
15460 Emit statistics about front-end processing at the end of the compilation.
15461 This option is supported only by the C++ front end, and
15462 the information is generally only useful to the G++ development team.
15463
15464 @item -fdbg-cnt-list
15465 @opindex fdbg-cnt-list
15466 Print the name and the counter upper bound for all debug counters.
15467
15468
15469 @item -fdbg-cnt=@var{counter-value-list}
15470 @opindex fdbg-cnt
15471 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15472 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15473 tuples which sets the lower and the upper bound of each debug
15474 counter @var{name}. The @var{lower_bound} is optional and is zero
15475 initialized if not set.
15476 All debug counters have the initial upper bound of @code{UINT_MAX};
15477 thus @code{dbg_cnt} returns true always unless the upper bound
15478 is set by this option.
15479 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15480 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15481 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15482
15483 @item -print-file-name=@var{library}
15484 @opindex print-file-name
15485 Print the full absolute name of the library file @var{library} that
15486 would be used when linking---and don't do anything else. With this
15487 option, GCC does not compile or link anything; it just prints the
15488 file name.
15489
15490 @item -print-multi-directory
15491 @opindex print-multi-directory
15492 Print the directory name corresponding to the multilib selected by any
15493 other switches present in the command line. This directory is supposed
15494 to exist in @env{GCC_EXEC_PREFIX}.
15495
15496 @item -print-multi-lib
15497 @opindex print-multi-lib
15498 Print the mapping from multilib directory names to compiler switches
15499 that enable them. The directory name is separated from the switches by
15500 @samp{;}, and each switch starts with an @samp{@@} instead of the
15501 @samp{-}, without spaces between multiple switches. This is supposed to
15502 ease shell processing.
15503
15504 @item -print-multi-os-directory
15505 @opindex print-multi-os-directory
15506 Print the path to OS libraries for the selected
15507 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15508 present in the @file{lib} subdirectory and no multilibs are used, this is
15509 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15510 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15511 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15512 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15513
15514 @item -print-multiarch
15515 @opindex print-multiarch
15516 Print the path to OS libraries for the selected multiarch,
15517 relative to some @file{lib} subdirectory.
15518
15519 @item -print-prog-name=@var{program}
15520 @opindex print-prog-name
15521 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15522
15523 @item -print-libgcc-file-name
15524 @opindex print-libgcc-file-name
15525 Same as @option{-print-file-name=libgcc.a}.
15526
15527 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15528 but you do want to link with @file{libgcc.a}. You can do:
15529
15530 @smallexample
15531 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15532 @end smallexample
15533
15534 @item -print-search-dirs
15535 @opindex print-search-dirs
15536 Print the name of the configured installation directory and a list of
15537 program and library directories @command{gcc} searches---and don't do anything else.
15538
15539 This is useful when @command{gcc} prints the error message
15540 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15541 To resolve this you either need to put @file{cpp0} and the other compiler
15542 components where @command{gcc} expects to find them, or you can set the environment
15543 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15544 Don't forget the trailing @samp{/}.
15545 @xref{Environment Variables}.
15546
15547 @item -print-sysroot
15548 @opindex print-sysroot
15549 Print the target sysroot directory that is used during
15550 compilation. This is the target sysroot specified either at configure
15551 time or using the @option{--sysroot} option, possibly with an extra
15552 suffix that depends on compilation options. If no target sysroot is
15553 specified, the option prints nothing.
15554
15555 @item -print-sysroot-headers-suffix
15556 @opindex print-sysroot-headers-suffix
15557 Print the suffix added to the target sysroot when searching for
15558 headers, or give an error if the compiler is not configured with such
15559 a suffix---and don't do anything else.
15560
15561 @item -dumpmachine
15562 @opindex dumpmachine
15563 Print the compiler's target machine (for example,
15564 @samp{i686-pc-linux-gnu})---and don't do anything else.
15565
15566 @item -dumpversion
15567 @opindex dumpversion
15568 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15569 anything else. This is the compiler version used in filesystem paths and
15570 specs. Depending on how the compiler has been configured it can be just
15571 a single number (major version), two numbers separated by a dot (major and
15572 minor version) or three numbers separated by dots (major, minor and patchlevel
15573 version).
15574
15575 @item -dumpfullversion
15576 @opindex dumpfullversion
15577 Print the full compiler version---and don't do anything else. The output is
15578 always three numbers separated by dots, major, minor and patchlevel version.
15579
15580 @item -dumpspecs
15581 @opindex dumpspecs
15582 Print the compiler's built-in specs---and don't do anything else. (This
15583 is used when GCC itself is being built.) @xref{Spec Files}.
15584 @end table
15585
15586 @node Submodel Options
15587 @section Machine-Dependent Options
15588 @cindex submodel options
15589 @cindex specifying hardware config
15590 @cindex hardware models and configurations, specifying
15591 @cindex target-dependent options
15592 @cindex machine-dependent options
15593
15594 Each target machine supported by GCC can have its own options---for
15595 example, to allow you to compile for a particular processor variant or
15596 ABI, or to control optimizations specific to that machine. By
15597 convention, the names of machine-specific options start with
15598 @samp{-m}.
15599
15600 Some configurations of the compiler also support additional target-specific
15601 options, usually for compatibility with other compilers on the same
15602 platform.
15603
15604 @c This list is ordered alphanumerically by subsection name.
15605 @c It should be the same order and spelling as these options are listed
15606 @c in Machine Dependent Options
15607
15608 @menu
15609 * AArch64 Options::
15610 * Adapteva Epiphany Options::
15611 * AMD GCN Options::
15612 * ARC Options::
15613 * ARM Options::
15614 * AVR Options::
15615 * Blackfin Options::
15616 * C6X Options::
15617 * CRIS Options::
15618 * CR16 Options::
15619 * C-SKY Options::
15620 * Darwin Options::
15621 * DEC Alpha Options::
15622 * FR30 Options::
15623 * FT32 Options::
15624 * FRV Options::
15625 * GNU/Linux Options::
15626 * H8/300 Options::
15627 * HPPA Options::
15628 * IA-64 Options::
15629 * LM32 Options::
15630 * M32C Options::
15631 * M32R/D Options::
15632 * M680x0 Options::
15633 * MCore Options::
15634 * MeP Options::
15635 * MicroBlaze Options::
15636 * MIPS Options::
15637 * MMIX Options::
15638 * MN10300 Options::
15639 * Moxie Options::
15640 * MSP430 Options::
15641 * NDS32 Options::
15642 * Nios II Options::
15643 * Nvidia PTX Options::
15644 * OpenRISC Options::
15645 * PDP-11 Options::
15646 * picoChip Options::
15647 * PowerPC Options::
15648 * PRU Options::
15649 * RISC-V Options::
15650 * RL78 Options::
15651 * RS/6000 and PowerPC Options::
15652 * RX Options::
15653 * S/390 and zSeries Options::
15654 * Score Options::
15655 * SH Options::
15656 * Solaris 2 Options::
15657 * SPARC Options::
15658 * SPU Options::
15659 * System V Options::
15660 * TILE-Gx Options::
15661 * TILEPro Options::
15662 * V850 Options::
15663 * VAX Options::
15664 * Visium Options::
15665 * VMS Options::
15666 * VxWorks Options::
15667 * x86 Options::
15668 * x86 Windows Options::
15669 * Xstormy16 Options::
15670 * Xtensa Options::
15671 * zSeries Options::
15672 @end menu
15673
15674 @node AArch64 Options
15675 @subsection AArch64 Options
15676 @cindex AArch64 Options
15677
15678 These options are defined for AArch64 implementations:
15679
15680 @table @gcctabopt
15681
15682 @item -mabi=@var{name}
15683 @opindex mabi
15684 Generate code for the specified data model. Permissible values
15685 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15686 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15687 but long int and pointers are 64 bits.
15688
15689 The default depends on the specific target configuration. Note that
15690 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15691 entire program with the same ABI, and link with a compatible set of libraries.
15692
15693 @item -mbig-endian
15694 @opindex mbig-endian
15695 Generate big-endian code. This is the default when GCC is configured for an
15696 @samp{aarch64_be-*-*} target.
15697
15698 @item -mgeneral-regs-only
15699 @opindex mgeneral-regs-only
15700 Generate code which uses only the general-purpose registers. This will prevent
15701 the compiler from using floating-point and Advanced SIMD registers but will not
15702 impose any restrictions on the assembler.
15703
15704 @item -mlittle-endian
15705 @opindex mlittle-endian
15706 Generate little-endian code. This is the default when GCC is configured for an
15707 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15708
15709 @item -mcmodel=tiny
15710 @opindex mcmodel=tiny
15711 Generate code for the tiny code model. The program and its statically defined
15712 symbols must be within 1MB of each other. Programs can be statically or
15713 dynamically linked.
15714
15715 @item -mcmodel=small
15716 @opindex mcmodel=small
15717 Generate code for the small code model. The program and its statically defined
15718 symbols must be within 4GB of each other. Programs can be statically or
15719 dynamically linked. This is the default code model.
15720
15721 @item -mcmodel=large
15722 @opindex mcmodel=large
15723 Generate code for the large code model. This makes no assumptions about
15724 addresses and sizes of sections. Programs can be statically linked only.
15725
15726 @item -mstrict-align
15727 @itemx -mno-strict-align
15728 @opindex mstrict-align
15729 @opindex mno-strict-align
15730 Avoid or allow generating memory accesses that may not be aligned on a natural
15731 object boundary as described in the architecture specification.
15732
15733 @item -momit-leaf-frame-pointer
15734 @itemx -mno-omit-leaf-frame-pointer
15735 @opindex momit-leaf-frame-pointer
15736 @opindex mno-omit-leaf-frame-pointer
15737 Omit or keep the frame pointer in leaf functions. The former behavior is the
15738 default.
15739
15740 @item -mstack-protector-guard=@var{guard}
15741 @itemx -mstack-protector-guard-reg=@var{reg}
15742 @itemx -mstack-protector-guard-offset=@var{offset}
15743 @opindex mstack-protector-guard
15744 @opindex mstack-protector-guard-reg
15745 @opindex mstack-protector-guard-offset
15746 Generate stack protection code using canary at @var{guard}. Supported
15747 locations are @samp{global} for a global canary or @samp{sysreg} for a
15748 canary in an appropriate system register.
15749
15750 With the latter choice the options
15751 @option{-mstack-protector-guard-reg=@var{reg}} and
15752 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15753 which system register to use as base register for reading the canary,
15754 and from what offset from that base register. There is no default
15755 register or offset as this is entirely for use within the Linux
15756 kernel.
15757
15758 @item -mstack-protector-guard=@var{guard}
15759 @itemx -mstack-protector-guard-reg=@var{reg}
15760 @itemx -mstack-protector-guard-offset=@var{offset}
15761 @opindex mstack-protector-guard
15762 @opindex mstack-protector-guard-reg
15763 @opindex mstack-protector-guard-offset
15764 Generate stack protection code using canary at @var{guard}. Supported
15765 locations are @samp{global} for a global canary or @samp{sysreg} for a
15766 canary in an appropriate system register.
15767
15768 With the latter choice the options
15769 @option{-mstack-protector-guard-reg=@var{reg}} and
15770 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15771 which system register to use as base register for reading the canary,
15772 and from what offset from that base register. There is no default
15773 register or offset as this is entirely for use within the Linux
15774 kernel.
15775
15776 @item -mtls-dialect=desc
15777 @opindex mtls-dialect=desc
15778 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15779 of TLS variables. This is the default.
15780
15781 @item -mtls-dialect=traditional
15782 @opindex mtls-dialect=traditional
15783 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15784 of TLS variables.
15785
15786 @item -mtls-size=@var{size}
15787 @opindex mtls-size
15788 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15789 This option requires binutils 2.26 or newer.
15790
15791 @item -mfix-cortex-a53-835769
15792 @itemx -mno-fix-cortex-a53-835769
15793 @opindex mfix-cortex-a53-835769
15794 @opindex mno-fix-cortex-a53-835769
15795 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15796 This involves inserting a NOP instruction between memory instructions and
15797 64-bit integer multiply-accumulate instructions.
15798
15799 @item -mfix-cortex-a53-843419
15800 @itemx -mno-fix-cortex-a53-843419
15801 @opindex mfix-cortex-a53-843419
15802 @opindex mno-fix-cortex-a53-843419
15803 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15804 This erratum workaround is made at link time and this will only pass the
15805 corresponding flag to the linker.
15806
15807 @item -mlow-precision-recip-sqrt
15808 @itemx -mno-low-precision-recip-sqrt
15809 @opindex mlow-precision-recip-sqrt
15810 @opindex mno-low-precision-recip-sqrt
15811 Enable or disable the reciprocal square root approximation.
15812 This option only has an effect if @option{-ffast-math} or
15813 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15814 precision of reciprocal square root results to about 16 bits for
15815 single precision and to 32 bits for double precision.
15816
15817 @item -mlow-precision-sqrt
15818 @itemx -mno-low-precision-sqrt
15819 @opindex mlow-precision-sqrt
15820 @opindex mno-low-precision-sqrt
15821 Enable or disable the square root approximation.
15822 This option only has an effect if @option{-ffast-math} or
15823 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15824 precision of square root results to about 16 bits for
15825 single precision and to 32 bits for double precision.
15826 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15827
15828 @item -mlow-precision-div
15829 @itemx -mno-low-precision-div
15830 @opindex mlow-precision-div
15831 @opindex mno-low-precision-div
15832 Enable or disable the division approximation.
15833 This option only has an effect if @option{-ffast-math} or
15834 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15835 precision of division results to about 16 bits for
15836 single precision and to 32 bits for double precision.
15837
15838 @item -mtrack-speculation
15839 @itemx -mno-track-speculation
15840 Enable or disable generation of additional code to track speculative
15841 execution through conditional branches. The tracking state can then
15842 be used by the compiler when expanding calls to
15843 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15844 sequence to be generated.
15845
15846 @item -march=@var{name}
15847 @opindex march
15848 Specify the name of the target architecture and, optionally, one or
15849 more feature modifiers. This option has the form
15850 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15851
15852 The permissible values for @var{arch} are @samp{armv8-a},
15853 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15854 @samp{armv8.5-a} or @var{native}.
15855
15856 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15857 support for the ARMv8.5-A architecture extensions.
15858
15859 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15860 support for the ARMv8.4-A architecture extensions.
15861
15862 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15863 support for the ARMv8.3-A architecture extensions.
15864
15865 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15866 support for the ARMv8.2-A architecture extensions.
15867
15868 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15869 support for the ARMv8.1-A architecture extension. In particular, it
15870 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15871
15872 The value @samp{native} is available on native AArch64 GNU/Linux and
15873 causes the compiler to pick the architecture of the host system. This
15874 option has no effect if the compiler is unable to recognize the
15875 architecture of the host system,
15876
15877 The permissible values for @var{feature} are listed in the sub-section
15878 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15879 Feature Modifiers}. Where conflicting feature modifiers are
15880 specified, the right-most feature is used.
15881
15882 GCC uses @var{name} to determine what kind of instructions it can emit
15883 when generating assembly code. If @option{-march} is specified
15884 without either of @option{-mtune} or @option{-mcpu} also being
15885 specified, the code is tuned to perform well across a range of target
15886 processors implementing the target architecture.
15887
15888 @item -mtune=@var{name}
15889 @opindex mtune
15890 Specify the name of the target processor for which GCC should tune the
15891 performance of the code. Permissible values for this option are:
15892 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15893 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15894 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15895 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15896 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15897 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15898 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15899 @samp{thunderxt83}, @samp{thunderx2t99},
15900 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15901 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15902 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15903 @samp{native}.
15904
15905 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15906 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15907 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15908 should tune for a big.LITTLE system.
15909
15910 Additionally on native AArch64 GNU/Linux systems the value
15911 @samp{native} tunes performance to the host system. This option has no effect
15912 if the compiler is unable to recognize the processor of the host system.
15913
15914 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15915 are specified, the code is tuned to perform well across a range
15916 of target processors.
15917
15918 This option cannot be suffixed by feature modifiers.
15919
15920 @item -mcpu=@var{name}
15921 @opindex mcpu
15922 Specify the name of the target processor, optionally suffixed by one
15923 or more feature modifiers. This option has the form
15924 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15925 the permissible values for @var{cpu} are the same as those available
15926 for @option{-mtune}. The permissible values for @var{feature} are
15927 documented in the sub-section on
15928 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15929 Feature Modifiers}. Where conflicting feature modifiers are
15930 specified, the right-most feature is used.
15931
15932 GCC uses @var{name} to determine what kind of instructions it can emit when
15933 generating assembly code (as if by @option{-march}) and to determine
15934 the target processor for which to tune for performance (as if
15935 by @option{-mtune}). Where this option is used in conjunction
15936 with @option{-march} or @option{-mtune}, those options take precedence
15937 over the appropriate part of this option.
15938
15939 @item -moverride=@var{string}
15940 @opindex moverride
15941 Override tuning decisions made by the back-end in response to a
15942 @option{-mtune=} switch. The syntax, semantics, and accepted values
15943 for @var{string} in this option are not guaranteed to be consistent
15944 across releases.
15945
15946 This option is only intended to be useful when developing GCC.
15947
15948 @item -mverbose-cost-dump
15949 @opindex mverbose-cost-dump
15950 Enable verbose cost model dumping in the debug dump files. This option is
15951 provided for use in debugging the compiler.
15952
15953 @item -mpc-relative-literal-loads
15954 @itemx -mno-pc-relative-literal-loads
15955 @opindex mpc-relative-literal-loads
15956 @opindex mno-pc-relative-literal-loads
15957 Enable or disable PC-relative literal loads. With this option literal pools are
15958 accessed using a single instruction and emitted after each function. This
15959 limits the maximum size of functions to 1MB. This is enabled by default for
15960 @option{-mcmodel=tiny}.
15961
15962 @item -msign-return-address=@var{scope}
15963 @opindex msign-return-address
15964 Select the function scope on which return address signing will be applied.
15965 Permissible values are @samp{none}, which disables return address signing,
15966 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15967 functions, and @samp{all}, which enables pointer signing for all functions. The
15968 default value is @samp{none}. This option has been deprecated by
15969 -mbranch-protection.
15970
15971 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
15972 @opindex mbranch-protection
15973 Select the branch protection features to use.
15974 @samp{none} is the default and turns off all types of branch protection.
15975 @samp{standard} turns on all types of branch protection features. If a feature
15976 has additional tuning options, then @samp{standard} sets it to its standard
15977 level.
15978 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
15979 level: signing functions that save the return address to memory (non-leaf
15980 functions will practically always do this) using the a-key. The optional
15981 argument @samp{leaf} can be used to extend the signing to include leaf
15982 functions. The optional argument @samp{b-key} can be used to sign the functions
15983 with the B-key instead of the A-key.
15984 @samp{bti} turns on branch target identification mechanism.
15985
15986 @item -msve-vector-bits=@var{bits}
15987 @opindex msve-vector-bits
15988 Specify the number of bits in an SVE vector register. This option only has
15989 an effect when SVE is enabled.
15990
15991 GCC supports two forms of SVE code generation: ``vector-length
15992 agnostic'' output that works with any size of vector register and
15993 ``vector-length specific'' output that allows GCC to make assumptions
15994 about the vector length when it is useful for optimization reasons.
15995 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
15996 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
15997 Specifying @samp{scalable} selects vector-length agnostic
15998 output. At present @samp{-msve-vector-bits=128} also generates vector-length
15999 agnostic output. All other values generate vector-length specific code.
16000 The behavior of these values may change in future releases and no value except
16001 @samp{scalable} should be relied on for producing code that is portable across
16002 different hardware SVE vector lengths.
16003
16004 The default is @samp{-msve-vector-bits=scalable}, which produces
16005 vector-length agnostic code.
16006 @end table
16007
16008 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16009 @anchor{aarch64-feature-modifiers}
16010 @cindex @option{-march} feature modifiers
16011 @cindex @option{-mcpu} feature modifiers
16012 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16013 the following and their inverses @option{no@var{feature}}:
16014
16015 @table @samp
16016 @item crc
16017 Enable CRC extension. This is on by default for
16018 @option{-march=armv8.1-a}.
16019 @item crypto
16020 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16021 instructions.
16022 @item fp
16023 Enable floating-point instructions. This is on by default for all possible
16024 values for options @option{-march} and @option{-mcpu}.
16025 @item simd
16026 Enable Advanced SIMD instructions. This also enables floating-point
16027 instructions. This is on by default for all possible values for options
16028 @option{-march} and @option{-mcpu}.
16029 @item sve
16030 Enable Scalable Vector Extension instructions. This also enables Advanced
16031 SIMD and floating-point instructions.
16032 @item lse
16033 Enable Large System Extension instructions. This is on by default for
16034 @option{-march=armv8.1-a}.
16035 @item rdma
16036 Enable Round Double Multiply Accumulate instructions. This is on by default
16037 for @option{-march=armv8.1-a}.
16038 @item fp16
16039 Enable FP16 extension. This also enables floating-point instructions.
16040 @item fp16fml
16041 Enable FP16 fmla extension. This also enables FP16 extensions and
16042 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.
16043
16044 @item rcpc
16045 Enable the RcPc extension. This does not change code generation from GCC,
16046 but is passed on to the assembler, enabling inline asm statements to use
16047 instructions from the RcPc extension.
16048 @item dotprod
16049 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16050 @item aes
16051 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16052 SIMD instructions.
16053 @item sha2
16054 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16055 @item sha3
16056 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16057 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16058 @item sm4
16059 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16060 Use of this option with architectures prior to Armv8.2-A is not supported.
16061 @item profile
16062 Enable the Statistical Profiling extension. This option is only to enable the
16063 extension at the assembler level and does not affect code generation.
16064 @item rng
16065 Enable the Armv8.5-a Random Number instructions. This option is only to
16066 enable the extension at the assembler level and does not affect code
16067 generation.
16068 @item memtag
16069 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16070 enable the extension at the assembler level and does not affect code
16071 generation.
16072 @item sb
16073 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16074 enable the extension at the assembler level and does not affect code
16075 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16076 @item ssbs
16077 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16078 is only to enable the extension at the assembler level and does not affect code
16079 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16080 @item predres
16081 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16082 This option is only to enable the extension at the assembler level and does
16083 not affect code generation. This option is enabled by default for
16084 @item sve2
16085 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16086 instructions.
16087 @item sve2-bitperm
16088 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16089 @item sve2-sm4
16090 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16091 @item sve2-aes
16092 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16093 @item sve2-sha3
16094 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16095 @option{-march=armv8.5-a}.
16096
16097 @end table
16098
16099 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16100 which implies @option{fp}.
16101 Conversely, @option{nofp} implies @option{nosimd}, which implies
16102 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16103
16104 @node Adapteva Epiphany Options
16105 @subsection Adapteva Epiphany Options
16106
16107 These @samp{-m} options are defined for Adapteva Epiphany:
16108
16109 @table @gcctabopt
16110 @item -mhalf-reg-file
16111 @opindex mhalf-reg-file
16112 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16113 That allows code to run on hardware variants that lack these registers.
16114
16115 @item -mprefer-short-insn-regs
16116 @opindex mprefer-short-insn-regs
16117 Preferentially allocate registers that allow short instruction generation.
16118 This can result in increased instruction count, so this may either reduce or
16119 increase overall code size.
16120
16121 @item -mbranch-cost=@var{num}
16122 @opindex mbranch-cost
16123 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16124 This cost is only a heuristic and is not guaranteed to produce
16125 consistent results across releases.
16126
16127 @item -mcmove
16128 @opindex mcmove
16129 Enable the generation of conditional moves.
16130
16131 @item -mnops=@var{num}
16132 @opindex mnops
16133 Emit @var{num} NOPs before every other generated instruction.
16134
16135 @item -mno-soft-cmpsf
16136 @opindex mno-soft-cmpsf
16137 @opindex msoft-cmpsf
16138 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16139 and test the flags. This is faster than a software comparison, but can
16140 get incorrect results in the presence of NaNs, or when two different small
16141 numbers are compared such that their difference is calculated as zero.
16142 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16143 software comparisons.
16144
16145 @item -mstack-offset=@var{num}
16146 @opindex mstack-offset
16147 Set the offset between the top of the stack and the stack pointer.
16148 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16149 can be used by leaf functions without stack allocation.
16150 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16151 Note also that this option changes the ABI; compiling a program with a
16152 different stack offset than the libraries have been compiled with
16153 generally does not work.
16154 This option can be useful if you want to evaluate if a different stack
16155 offset would give you better code, but to actually use a different stack
16156 offset to build working programs, it is recommended to configure the
16157 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16158
16159 @item -mno-round-nearest
16160 @opindex mno-round-nearest
16161 @opindex mround-nearest
16162 Make the scheduler assume that the rounding mode has been set to
16163 truncating. The default is @option{-mround-nearest}.
16164
16165 @item -mlong-calls
16166 @opindex mlong-calls
16167 If not otherwise specified by an attribute, assume all calls might be beyond
16168 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16169 function address into a register before performing a (otherwise direct) call.
16170 This is the default.
16171
16172 @item -mshort-calls
16173 @opindex short-calls
16174 If not otherwise specified by an attribute, assume all direct calls are
16175 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16176 for direct calls. The default is @option{-mlong-calls}.
16177
16178 @item -msmall16
16179 @opindex msmall16
16180 Assume addresses can be loaded as 16-bit unsigned values. This does not
16181 apply to function addresses for which @option{-mlong-calls} semantics
16182 are in effect.
16183
16184 @item -mfp-mode=@var{mode}
16185 @opindex mfp-mode
16186 Set the prevailing mode of the floating-point unit.
16187 This determines the floating-point mode that is provided and expected
16188 at function call and return time. Making this mode match the mode you
16189 predominantly need at function start can make your programs smaller and
16190 faster by avoiding unnecessary mode switches.
16191
16192 @var{mode} can be set to one the following values:
16193
16194 @table @samp
16195 @item caller
16196 Any mode at function entry is valid, and retained or restored when
16197 the function returns, and when it calls other functions.
16198 This mode is useful for compiling libraries or other compilation units
16199 you might want to incorporate into different programs with different
16200 prevailing FPU modes, and the convenience of being able to use a single
16201 object file outweighs the size and speed overhead for any extra
16202 mode switching that might be needed, compared with what would be needed
16203 with a more specific choice of prevailing FPU mode.
16204
16205 @item truncate
16206 This is the mode used for floating-point calculations with
16207 truncating (i.e.@: round towards zero) rounding mode. That includes
16208 conversion from floating point to integer.
16209
16210 @item round-nearest
16211 This is the mode used for floating-point calculations with
16212 round-to-nearest-or-even rounding mode.
16213
16214 @item int
16215 This is the mode used to perform integer calculations in the FPU, e.g.@:
16216 integer multiply, or integer multiply-and-accumulate.
16217 @end table
16218
16219 The default is @option{-mfp-mode=caller}
16220
16221 @item -mno-split-lohi
16222 @itemx -mno-postinc
16223 @itemx -mno-postmodify
16224 @opindex mno-split-lohi
16225 @opindex msplit-lohi
16226 @opindex mno-postinc
16227 @opindex mpostinc
16228 @opindex mno-postmodify
16229 @opindex mpostmodify
16230 Code generation tweaks that disable, respectively, splitting of 32-bit
16231 loads, generation of post-increment addresses, and generation of
16232 post-modify addresses. The defaults are @option{msplit-lohi},
16233 @option{-mpost-inc}, and @option{-mpost-modify}.
16234
16235 @item -mnovect-double
16236 @opindex mno-vect-double
16237 @opindex mvect-double
16238 Change the preferred SIMD mode to SImode. The default is
16239 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16240
16241 @item -max-vect-align=@var{num}
16242 @opindex max-vect-align
16243 The maximum alignment for SIMD vector mode types.
16244 @var{num} may be 4 or 8. The default is 8.
16245 Note that this is an ABI change, even though many library function
16246 interfaces are unaffected if they don't use SIMD vector modes
16247 in places that affect size and/or alignment of relevant types.
16248
16249 @item -msplit-vecmove-early
16250 @opindex msplit-vecmove-early
16251 Split vector moves into single word moves before reload. In theory this
16252 can give better register allocation, but so far the reverse seems to be
16253 generally the case.
16254
16255 @item -m1reg-@var{reg}
16256 @opindex m1reg-
16257 Specify a register to hold the constant @minus{}1, which makes loading small negative
16258 constants and certain bitmasks faster.
16259 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16260 which specify use of that register as a fixed register,
16261 and @samp{none}, which means that no register is used for this
16262 purpose. The default is @option{-m1reg-none}.
16263
16264 @end table
16265
16266 @node AMD GCN Options
16267 @subsection AMD GCN Options
16268 @cindex AMD GCN Options
16269
16270 These options are defined specifically for the AMD GCN port.
16271
16272 @table @gcctabopt
16273
16274 @item -march=@var{gpu}
16275 @opindex march
16276 @itemx -mtune=@var{gpu}
16277 @opindex mtune
16278 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16279 are
16280
16281 @table @samp
16282 @opindex fiji
16283 @item fiji
16284 Compile for GCN3 Fiji devices (gfx803).
16285
16286 @item gfx900
16287 Compile for GCN5 Vega 10 devices (gfx900).
16288
16289 @item gfx906
16290 Compile for GCN5 Vega 20 devices (gfx906).
16291
16292 @end table
16293
16294 @item -mstack-size=@var{bytes}
16295 @opindex mstack-size
16296 Specify how many @var{bytes} of stack space will be requested for each GPU
16297 thread (wave-front). Beware that there may be many threads and limited memory
16298 available. The size of the stack allocation may also have an impact on
16299 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16300 1MB otherwise.
16301
16302 @end table
16303
16304 @node ARC Options
16305 @subsection ARC Options
16306 @cindex ARC options
16307
16308 The following options control the architecture variant for which code
16309 is being compiled:
16310
16311 @c architecture variants
16312 @table @gcctabopt
16313
16314 @item -mbarrel-shifter
16315 @opindex mbarrel-shifter
16316 Generate instructions supported by barrel shifter. This is the default
16317 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16318
16319 @item -mjli-always
16320 @opindex mjli-alawys
16321 Force to call a function using jli_s instruction. This option is
16322 valid only for ARCv2 architecture.
16323
16324 @item -mcpu=@var{cpu}
16325 @opindex mcpu
16326 Set architecture type, register usage, and instruction scheduling
16327 parameters for @var{cpu}. There are also shortcut alias options
16328 available for backward compatibility and convenience. Supported
16329 values for @var{cpu} are
16330
16331 @table @samp
16332 @opindex mA6
16333 @opindex mARC600
16334 @item arc600
16335 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16336
16337 @item arc601
16338 @opindex mARC601
16339 Compile for ARC601. Alias: @option{-mARC601}.
16340
16341 @item arc700
16342 @opindex mA7
16343 @opindex mARC700
16344 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16345 This is the default when configured with @option{--with-cpu=arc700}@.
16346
16347 @item arcem
16348 Compile for ARC EM.
16349
16350 @item archs
16351 Compile for ARC HS.
16352
16353 @item em
16354 Compile for ARC EM CPU with no hardware extensions.
16355
16356 @item em4
16357 Compile for ARC EM4 CPU.
16358
16359 @item em4_dmips
16360 Compile for ARC EM4 DMIPS CPU.
16361
16362 @item em4_fpus
16363 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16364 extension.
16365
16366 @item em4_fpuda
16367 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16368 double assist instructions.
16369
16370 @item hs
16371 Compile for ARC HS CPU with no hardware extensions except the atomic
16372 instructions.
16373
16374 @item hs34
16375 Compile for ARC HS34 CPU.
16376
16377 @item hs38
16378 Compile for ARC HS38 CPU.
16379
16380 @item hs38_linux
16381 Compile for ARC HS38 CPU with all hardware extensions on.
16382
16383 @item arc600_norm
16384 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16385
16386 @item arc600_mul32x16
16387 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16388 instructions enabled.
16389
16390 @item arc600_mul64
16391 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16392 instructions enabled.
16393
16394 @item arc601_norm
16395 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16396
16397 @item arc601_mul32x16
16398 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16399 instructions enabled.
16400
16401 @item arc601_mul64
16402 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16403 instructions enabled.
16404
16405 @item nps400
16406 Compile for ARC 700 on NPS400 chip.
16407
16408 @item em_mini
16409 Compile for ARC EM minimalist configuration featuring reduced register
16410 set.
16411
16412 @end table
16413
16414 @item -mdpfp
16415 @opindex mdpfp
16416 @itemx -mdpfp-compact
16417 @opindex mdpfp-compact
16418 Generate double-precision FPX instructions, tuned for the compact
16419 implementation.
16420
16421 @item -mdpfp-fast
16422 @opindex mdpfp-fast
16423 Generate double-precision FPX instructions, tuned for the fast
16424 implementation.
16425
16426 @item -mno-dpfp-lrsr
16427 @opindex mno-dpfp-lrsr
16428 Disable @code{lr} and @code{sr} instructions from using FPX extension
16429 aux registers.
16430
16431 @item -mea
16432 @opindex mea
16433 Generate extended arithmetic instructions. Currently only
16434 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16435 supported. This is always enabled for @option{-mcpu=ARC700}.
16436
16437 @item -mno-mpy
16438 @opindex mno-mpy
16439 @opindex mmpy
16440 Do not generate @code{mpy}-family instructions for ARC700. This option is
16441 deprecated.
16442
16443 @item -mmul32x16
16444 @opindex mmul32x16
16445 Generate 32x16-bit multiply and multiply-accumulate instructions.
16446
16447 @item -mmul64
16448 @opindex mmul64
16449 Generate @code{mul64} and @code{mulu64} instructions.
16450 Only valid for @option{-mcpu=ARC600}.
16451
16452 @item -mnorm
16453 @opindex mnorm
16454 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16455 is in effect.
16456
16457 @item -mspfp
16458 @opindex mspfp
16459 @itemx -mspfp-compact
16460 @opindex mspfp-compact
16461 Generate single-precision FPX instructions, tuned for the compact
16462 implementation.
16463
16464 @item -mspfp-fast
16465 @opindex mspfp-fast
16466 Generate single-precision FPX instructions, tuned for the fast
16467 implementation.
16468
16469 @item -msimd
16470 @opindex msimd
16471 Enable generation of ARC SIMD instructions via target-specific
16472 builtins. Only valid for @option{-mcpu=ARC700}.
16473
16474 @item -msoft-float
16475 @opindex msoft-float
16476 This option ignored; it is provided for compatibility purposes only.
16477 Software floating-point code is emitted by default, and this default
16478 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16479 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16480 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16481
16482 @item -mswap
16483 @opindex mswap
16484 Generate @code{swap} instructions.
16485
16486 @item -matomic
16487 @opindex matomic
16488 This enables use of the locked load/store conditional extension to implement
16489 atomic memory built-in functions. Not available for ARC 6xx or ARC
16490 EM cores.
16491
16492 @item -mdiv-rem
16493 @opindex mdiv-rem
16494 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16495
16496 @item -mcode-density
16497 @opindex mcode-density
16498 Enable code density instructions for ARC EM.
16499 This option is on by default for ARC HS.
16500
16501 @item -mll64
16502 @opindex mll64
16503 Enable double load/store operations for ARC HS cores.
16504
16505 @item -mtp-regno=@var{regno}
16506 @opindex mtp-regno
16507 Specify thread pointer register number.
16508
16509 @item -mmpy-option=@var{multo}
16510 @opindex mmpy-option
16511 Compile ARCv2 code with a multiplier design option. You can specify
16512 the option using either a string or numeric value for @var{multo}.
16513 @samp{wlh1} is the default value. The recognized values are:
16514
16515 @table @samp
16516 @item 0
16517 @itemx none
16518 No multiplier available.
16519
16520 @item 1
16521 @itemx w
16522 16x16 multiplier, fully pipelined.
16523 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16524
16525 @item 2
16526 @itemx wlh1
16527 32x32 multiplier, fully
16528 pipelined (1 stage). The following instructions are additionally
16529 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16530
16531 @item 3
16532 @itemx wlh2
16533 32x32 multiplier, fully pipelined
16534 (2 stages). The following instructions are additionally enabled: @code{mpy},
16535 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16536
16537 @item 4
16538 @itemx wlh3
16539 Two 16x16 multipliers, blocking,
16540 sequential. The following instructions are additionally enabled: @code{mpy},
16541 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16542
16543 @item 5
16544 @itemx wlh4
16545 One 16x16 multiplier, blocking,
16546 sequential. The following instructions are additionally enabled: @code{mpy},
16547 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16548
16549 @item 6
16550 @itemx wlh5
16551 One 32x4 multiplier, blocking,
16552 sequential. The following instructions are additionally enabled: @code{mpy},
16553 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16554
16555 @item 7
16556 @itemx plus_dmpy
16557 ARC HS SIMD support.
16558
16559 @item 8
16560 @itemx plus_macd
16561 ARC HS SIMD support.
16562
16563 @item 9
16564 @itemx plus_qmacw
16565 ARC HS SIMD support.
16566
16567 @end table
16568
16569 This option is only available for ARCv2 cores@.
16570
16571 @item -mfpu=@var{fpu}
16572 @opindex mfpu
16573 Enables support for specific floating-point hardware extensions for ARCv2
16574 cores. Supported values for @var{fpu} are:
16575
16576 @table @samp
16577
16578 @item fpus
16579 Enables support for single-precision floating-point hardware
16580 extensions@.
16581
16582 @item fpud
16583 Enables support for double-precision floating-point hardware
16584 extensions. The single-precision floating-point extension is also
16585 enabled. Not available for ARC EM@.
16586
16587 @item fpuda
16588 Enables support for double-precision floating-point hardware
16589 extensions using double-precision assist instructions. The single-precision
16590 floating-point extension is also enabled. This option is
16591 only available for ARC EM@.
16592
16593 @item fpuda_div
16594 Enables support for double-precision floating-point hardware
16595 extensions using double-precision assist instructions.
16596 The single-precision floating-point, square-root, and divide
16597 extensions are also enabled. This option is
16598 only available for ARC EM@.
16599
16600 @item fpuda_fma
16601 Enables support for double-precision floating-point hardware
16602 extensions using double-precision assist instructions.
16603 The single-precision floating-point and fused multiply and add
16604 hardware extensions are also enabled. This option is
16605 only available for ARC EM@.
16606
16607 @item fpuda_all
16608 Enables support for double-precision floating-point hardware
16609 extensions using double-precision assist instructions.
16610 All single-precision floating-point hardware extensions are also
16611 enabled. This option is only available for ARC EM@.
16612
16613 @item fpus_div
16614 Enables support for single-precision floating-point, square-root and divide
16615 hardware extensions@.
16616
16617 @item fpud_div
16618 Enables support for double-precision floating-point, square-root and divide
16619 hardware extensions. This option
16620 includes option @samp{fpus_div}. Not available for ARC EM@.
16621
16622 @item fpus_fma
16623 Enables support for single-precision floating-point and
16624 fused multiply and add hardware extensions@.
16625
16626 @item fpud_fma
16627 Enables support for double-precision floating-point and
16628 fused multiply and add hardware extensions. This option
16629 includes option @samp{fpus_fma}. Not available for ARC EM@.
16630
16631 @item fpus_all
16632 Enables support for all single-precision floating-point hardware
16633 extensions@.
16634
16635 @item fpud_all
16636 Enables support for all single- and double-precision floating-point
16637 hardware extensions. Not available for ARC EM@.
16638
16639 @end table
16640
16641 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16642 @opindex mirq-ctrl-saved
16643 Specifies general-purposes registers that the processor automatically
16644 saves/restores on interrupt entry and exit. @var{register-range} is
16645 specified as two registers separated by a dash. The register range
16646 always starts with @code{r0}, the upper limit is @code{fp} register.
16647 @var{blink} and @var{lp_count} are optional. This option is only
16648 valid for ARC EM and ARC HS cores.
16649
16650 @item -mrgf-banked-regs=@var{number}
16651 @opindex mrgf-banked-regs
16652 Specifies the number of registers replicated in second register bank
16653 on entry to fast interrupt. Fast interrupts are interrupts with the
16654 highest priority level P0. These interrupts save only PC and STATUS32
16655 registers to avoid memory transactions during interrupt entry and exit
16656 sequences. Use this option when you are using fast interrupts in an
16657 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16658
16659 @item -mlpc-width=@var{width}
16660 @opindex mlpc-width
16661 Specify the width of the @code{lp_count} register. Valid values for
16662 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16663 fixed to 32 bits. If the width is less than 32, the compiler does not
16664 attempt to transform loops in your program to use the zero-delay loop
16665 mechanism unless it is known that the @code{lp_count} register can
16666 hold the required loop-counter value. Depending on the width
16667 specified, the compiler and run-time library might continue to use the
16668 loop mechanism for various needs. This option defines macro
16669 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16670
16671 @item -mrf16
16672 @opindex mrf16
16673 This option instructs the compiler to generate code for a 16-entry
16674 register file. This option defines the @code{__ARC_RF16__}
16675 preprocessor macro.
16676
16677 @item -mbranch-index
16678 @opindex mbranch-index
16679 Enable use of @code{bi} or @code{bih} instructions to implement jump
16680 tables.
16681
16682 @end table
16683
16684 The following options are passed through to the assembler, and also
16685 define preprocessor macro symbols.
16686
16687 @c Flags used by the assembler, but for which we define preprocessor
16688 @c macro symbols as well.
16689 @table @gcctabopt
16690 @item -mdsp-packa
16691 @opindex mdsp-packa
16692 Passed down to the assembler to enable the DSP Pack A extensions.
16693 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16694 deprecated.
16695
16696 @item -mdvbf
16697 @opindex mdvbf
16698 Passed down to the assembler to enable the dual Viterbi butterfly
16699 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16700 option is deprecated.
16701
16702 @c ARC700 4.10 extension instruction
16703 @item -mlock
16704 @opindex mlock
16705 Passed down to the assembler to enable the locked load/store
16706 conditional extension. Also sets the preprocessor symbol
16707 @code{__Xlock}.
16708
16709 @item -mmac-d16
16710 @opindex mmac-d16
16711 Passed down to the assembler. Also sets the preprocessor symbol
16712 @code{__Xxmac_d16}. This option is deprecated.
16713
16714 @item -mmac-24
16715 @opindex mmac-24
16716 Passed down to the assembler. Also sets the preprocessor symbol
16717 @code{__Xxmac_24}. This option is deprecated.
16718
16719 @c ARC700 4.10 extension instruction
16720 @item -mrtsc
16721 @opindex mrtsc
16722 Passed down to the assembler to enable the 64-bit time-stamp counter
16723 extension instruction. Also sets the preprocessor symbol
16724 @code{__Xrtsc}. This option is deprecated.
16725
16726 @c ARC700 4.10 extension instruction
16727 @item -mswape
16728 @opindex mswape
16729 Passed down to the assembler to enable the swap byte ordering
16730 extension instruction. Also sets the preprocessor symbol
16731 @code{__Xswape}.
16732
16733 @item -mtelephony
16734 @opindex mtelephony
16735 Passed down to the assembler to enable dual- and single-operand
16736 instructions for telephony. Also sets the preprocessor symbol
16737 @code{__Xtelephony}. This option is deprecated.
16738
16739 @item -mxy
16740 @opindex mxy
16741 Passed down to the assembler to enable the XY memory extension. Also
16742 sets the preprocessor symbol @code{__Xxy}.
16743
16744 @end table
16745
16746 The following options control how the assembly code is annotated:
16747
16748 @c Assembly annotation options
16749 @table @gcctabopt
16750 @item -misize
16751 @opindex misize
16752 Annotate assembler instructions with estimated addresses.
16753
16754 @item -mannotate-align
16755 @opindex mannotate-align
16756 Explain what alignment considerations lead to the decision to make an
16757 instruction short or long.
16758
16759 @end table
16760
16761 The following options are passed through to the linker:
16762
16763 @c options passed through to the linker
16764 @table @gcctabopt
16765 @item -marclinux
16766 @opindex marclinux
16767 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16768 This option is enabled by default in tool chains built for
16769 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16770 when profiling is not requested.
16771
16772 @item -marclinux_prof
16773 @opindex marclinux_prof
16774 Passed through to the linker, to specify use of the
16775 @code{arclinux_prof} emulation. This option is enabled by default in
16776 tool chains built for @w{@code{arc-linux-uclibc}} and
16777 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16778
16779 @end table
16780
16781 The following options control the semantics of generated code:
16782
16783 @c semantically relevant code generation options
16784 @table @gcctabopt
16785 @item -mlong-calls
16786 @opindex mlong-calls
16787 Generate calls as register indirect calls, thus providing access
16788 to the full 32-bit address range.
16789
16790 @item -mmedium-calls
16791 @opindex mmedium-calls
16792 Don't use less than 25-bit addressing range for calls, which is the
16793 offset available for an unconditional branch-and-link
16794 instruction. Conditional execution of function calls is suppressed, to
16795 allow use of the 25-bit range, rather than the 21-bit range with
16796 conditional branch-and-link. This is the default for tool chains built
16797 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16798
16799 @item -G @var{num}
16800 @opindex G
16801 Put definitions of externally-visible data in a small data section if
16802 that data is no bigger than @var{num} bytes. The default value of
16803 @var{num} is 4 for any ARC configuration, or 8 when we have double
16804 load/store operations.
16805
16806 @item -mno-sdata
16807 @opindex mno-sdata
16808 @opindex msdata
16809 Do not generate sdata references. This is the default for tool chains
16810 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16811 targets.
16812
16813 @item -mvolatile-cache
16814 @opindex mvolatile-cache
16815 Use ordinarily cached memory accesses for volatile references. This is the
16816 default.
16817
16818 @item -mno-volatile-cache
16819 @opindex mno-volatile-cache
16820 @opindex mvolatile-cache
16821 Enable cache bypass for volatile references.
16822
16823 @end table
16824
16825 The following options fine tune code generation:
16826 @c code generation tuning options
16827 @table @gcctabopt
16828 @item -malign-call
16829 @opindex malign-call
16830 Do alignment optimizations for call instructions.
16831
16832 @item -mauto-modify-reg
16833 @opindex mauto-modify-reg
16834 Enable the use of pre/post modify with register displacement.
16835
16836 @item -mbbit-peephole
16837 @opindex mbbit-peephole
16838 Enable bbit peephole2.
16839
16840 @item -mno-brcc
16841 @opindex mno-brcc
16842 This option disables a target-specific pass in @file{arc_reorg} to
16843 generate compare-and-branch (@code{br@var{cc}}) instructions.
16844 It has no effect on
16845 generation of these instructions driven by the combiner pass.
16846
16847 @item -mcase-vector-pcrel
16848 @opindex mcase-vector-pcrel
16849 Use PC-relative switch case tables to enable case table shortening.
16850 This is the default for @option{-Os}.
16851
16852 @item -mcompact-casesi
16853 @opindex mcompact-casesi
16854 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16855 and only available for ARCv1 cores. This option is deprecated.
16856
16857 @item -mno-cond-exec
16858 @opindex mno-cond-exec
16859 Disable the ARCompact-specific pass to generate conditional
16860 execution instructions.
16861
16862 Due to delay slot scheduling and interactions between operand numbers,
16863 literal sizes, instruction lengths, and the support for conditional execution,
16864 the target-independent pass to generate conditional execution is often lacking,
16865 so the ARC port has kept a special pass around that tries to find more
16866 conditional execution generation opportunities after register allocation,
16867 branch shortening, and delay slot scheduling have been done. This pass
16868 generally, but not always, improves performance and code size, at the cost of
16869 extra compilation time, which is why there is an option to switch it off.
16870 If you have a problem with call instructions exceeding their allowable
16871 offset range because they are conditionalized, you should consider using
16872 @option{-mmedium-calls} instead.
16873
16874 @item -mearly-cbranchsi
16875 @opindex mearly-cbranchsi
16876 Enable pre-reload use of the @code{cbranchsi} pattern.
16877
16878 @item -mexpand-adddi
16879 @opindex mexpand-adddi
16880 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16881 @code{add.f}, @code{adc} etc. This option is deprecated.
16882
16883 @item -mindexed-loads
16884 @opindex mindexed-loads
16885 Enable the use of indexed loads. This can be problematic because some
16886 optimizers then assume that indexed stores exist, which is not
16887 the case.
16888
16889 @item -mlra
16890 @opindex mlra
16891 Enable Local Register Allocation. This is still experimental for ARC,
16892 so by default the compiler uses standard reload
16893 (i.e.@: @option{-mno-lra}).
16894
16895 @item -mlra-priority-none
16896 @opindex mlra-priority-none
16897 Don't indicate any priority for target registers.
16898
16899 @item -mlra-priority-compact
16900 @opindex mlra-priority-compact
16901 Indicate target register priority for r0..r3 / r12..r15.
16902
16903 @item -mlra-priority-noncompact
16904 @opindex mlra-priority-noncompact
16905 Reduce target register priority for r0..r3 / r12..r15.
16906
16907 @item -mmillicode
16908 @opindex mmillicode
16909 When optimizing for size (using @option{-Os}), prologues and epilogues
16910 that have to save or restore a large number of registers are often
16911 shortened by using call to a special function in libgcc; this is
16912 referred to as a @emph{millicode} call. As these calls can pose
16913 performance issues, and/or cause linking issues when linking in a
16914 nonstandard way, this option is provided to turn on or off millicode
16915 call generation.
16916
16917 @item -mcode-density-frame
16918 @opindex mcode-density-frame
16919 This option enable the compiler to emit @code{enter} and @code{leave}
16920 instructions. These instructions are only valid for CPUs with
16921 code-density feature.
16922
16923 @item -mmixed-code
16924 @opindex mmixed-code
16925 Tweak register allocation to help 16-bit instruction generation.
16926 This generally has the effect of decreasing the average instruction size
16927 while increasing the instruction count.
16928
16929 @item -mq-class
16930 @opindex mq-class
16931 Enable @samp{q} instruction alternatives.
16932 This is the default for @option{-Os}.
16933
16934 @item -mRcq
16935 @opindex mRcq
16936 Enable @samp{Rcq} constraint handling.
16937 Most short code generation depends on this.
16938 This is the default.
16939
16940 @item -mRcw
16941 @opindex mRcw
16942 Enable @samp{Rcw} constraint handling.
16943 Most ccfsm condexec mostly depends on this.
16944 This is the default.
16945
16946 @item -msize-level=@var{level}
16947 @opindex msize-level
16948 Fine-tune size optimization with regards to instruction lengths and alignment.
16949 The recognized values for @var{level} are:
16950 @table @samp
16951 @item 0
16952 No size optimization. This level is deprecated and treated like @samp{1}.
16953
16954 @item 1
16955 Short instructions are used opportunistically.
16956
16957 @item 2
16958 In addition, alignment of loops and of code after barriers are dropped.
16959
16960 @item 3
16961 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16962
16963 @end table
16964
16965 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16966 the behavior when this is not set is equivalent to level @samp{1}.
16967
16968 @item -mtune=@var{cpu}
16969 @opindex mtune
16970 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16971 by @option{-mcpu=}.
16972
16973 Supported values for @var{cpu} are
16974
16975 @table @samp
16976 @item ARC600
16977 Tune for ARC600 CPU.
16978
16979 @item ARC601
16980 Tune for ARC601 CPU.
16981
16982 @item ARC700
16983 Tune for ARC700 CPU with standard multiplier block.
16984
16985 @item ARC700-xmac
16986 Tune for ARC700 CPU with XMAC block.
16987
16988 @item ARC725D
16989 Tune for ARC725D CPU.
16990
16991 @item ARC750D
16992 Tune for ARC750D CPU.
16993
16994 @end table
16995
16996 @item -mmultcost=@var{num}
16997 @opindex mmultcost
16998 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16999 normal instruction.
17000
17001 @item -munalign-prob-threshold=@var{probability}
17002 @opindex munalign-prob-threshold
17003 Set probability threshold for unaligning branches.
17004 When tuning for @samp{ARC700} and optimizing for speed, branches without
17005 filled delay slot are preferably emitted unaligned and long, unless
17006 profiling indicates that the probability for the branch to be taken
17007 is below @var{probability}. @xref{Cross-profiling}.
17008 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17009
17010 @end table
17011
17012 The following options are maintained for backward compatibility, but
17013 are now deprecated and will be removed in a future release:
17014
17015 @c Deprecated options
17016 @table @gcctabopt
17017
17018 @item -margonaut
17019 @opindex margonaut
17020 Obsolete FPX.
17021
17022 @item -mbig-endian
17023 @opindex mbig-endian
17024 @itemx -EB
17025 @opindex EB
17026 Compile code for big-endian targets. Use of these options is now
17027 deprecated. Big-endian code is supported by configuring GCC to build
17028 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17029 for which big endian is the default.
17030
17031 @item -mlittle-endian
17032 @opindex mlittle-endian
17033 @itemx -EL
17034 @opindex EL
17035 Compile code for little-endian targets. Use of these options is now
17036 deprecated. Little-endian code is supported by configuring GCC to build
17037 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17038 for which little endian is the default.
17039
17040 @item -mbarrel_shifter
17041 @opindex mbarrel_shifter
17042 Replaced by @option{-mbarrel-shifter}.
17043
17044 @item -mdpfp_compact
17045 @opindex mdpfp_compact
17046 Replaced by @option{-mdpfp-compact}.
17047
17048 @item -mdpfp_fast
17049 @opindex mdpfp_fast
17050 Replaced by @option{-mdpfp-fast}.
17051
17052 @item -mdsp_packa
17053 @opindex mdsp_packa
17054 Replaced by @option{-mdsp-packa}.
17055
17056 @item -mEA
17057 @opindex mEA
17058 Replaced by @option{-mea}.
17059
17060 @item -mmac_24
17061 @opindex mmac_24
17062 Replaced by @option{-mmac-24}.
17063
17064 @item -mmac_d16
17065 @opindex mmac_d16
17066 Replaced by @option{-mmac-d16}.
17067
17068 @item -mspfp_compact
17069 @opindex mspfp_compact
17070 Replaced by @option{-mspfp-compact}.
17071
17072 @item -mspfp_fast
17073 @opindex mspfp_fast
17074 Replaced by @option{-mspfp-fast}.
17075
17076 @item -mtune=@var{cpu}
17077 @opindex mtune
17078 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17079 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17080 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17081
17082 @item -multcost=@var{num}
17083 @opindex multcost
17084 Replaced by @option{-mmultcost}.
17085
17086 @end table
17087
17088 @node ARM Options
17089 @subsection ARM Options
17090 @cindex ARM options
17091
17092 These @samp{-m} options are defined for the ARM port:
17093
17094 @table @gcctabopt
17095 @item -mabi=@var{name}
17096 @opindex mabi
17097 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17098 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17099
17100 @item -mapcs-frame
17101 @opindex mapcs-frame
17102 Generate a stack frame that is compliant with the ARM Procedure Call
17103 Standard for all functions, even if this is not strictly necessary for
17104 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17105 with this option causes the stack frames not to be generated for
17106 leaf functions. The default is @option{-mno-apcs-frame}.
17107 This option is deprecated.
17108
17109 @item -mapcs
17110 @opindex mapcs
17111 This is a synonym for @option{-mapcs-frame} and is deprecated.
17112
17113 @ignore
17114 @c not currently implemented
17115 @item -mapcs-stack-check
17116 @opindex mapcs-stack-check
17117 Generate code to check the amount of stack space available upon entry to
17118 every function (that actually uses some stack space). If there is
17119 insufficient space available then either the function
17120 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17121 called, depending upon the amount of stack space required. The runtime
17122 system is required to provide these functions. The default is
17123 @option{-mno-apcs-stack-check}, since this produces smaller code.
17124
17125 @c not currently implemented
17126 @item -mapcs-reentrant
17127 @opindex mapcs-reentrant
17128 Generate reentrant, position-independent code. The default is
17129 @option{-mno-apcs-reentrant}.
17130 @end ignore
17131
17132 @item -mthumb-interwork
17133 @opindex mthumb-interwork
17134 Generate code that supports calling between the ARM and Thumb
17135 instruction sets. Without this option, on pre-v5 architectures, the
17136 two instruction sets cannot be reliably used inside one program. The
17137 default is @option{-mno-thumb-interwork}, since slightly larger code
17138 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17139 configurations this option is meaningless.
17140
17141 @item -mno-sched-prolog
17142 @opindex mno-sched-prolog
17143 @opindex msched-prolog
17144 Prevent the reordering of instructions in the function prologue, or the
17145 merging of those instruction with the instructions in the function's
17146 body. This means that all functions start with a recognizable set
17147 of instructions (or in fact one of a choice from a small set of
17148 different function prologues), and this information can be used to
17149 locate the start of functions inside an executable piece of code. The
17150 default is @option{-msched-prolog}.
17151
17152 @item -mfloat-abi=@var{name}
17153 @opindex mfloat-abi
17154 Specifies which floating-point ABI to use. Permissible values
17155 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17156
17157 Specifying @samp{soft} causes GCC to generate output containing
17158 library calls for floating-point operations.
17159 @samp{softfp} allows the generation of code using hardware floating-point
17160 instructions, but still uses the soft-float calling conventions.
17161 @samp{hard} allows generation of floating-point instructions
17162 and uses FPU-specific calling conventions.
17163
17164 The default depends on the specific target configuration. Note that
17165 the hard-float and soft-float ABIs are not link-compatible; you must
17166 compile your entire program with the same ABI, and link with a
17167 compatible set of libraries.
17168
17169 @item -mgeneral-regs-only
17170 @opindex mgeneral-regs-only
17171 Generate code which uses only the general-purpose registers. This will prevent
17172 the compiler from using floating-point and Advanced SIMD registers but will not
17173 impose any restrictions on the assembler.
17174
17175 @item -mlittle-endian
17176 @opindex mlittle-endian
17177 Generate code for a processor running in little-endian mode. This is
17178 the default for all standard configurations.
17179
17180 @item -mbig-endian
17181 @opindex mbig-endian
17182 Generate code for a processor running in big-endian mode; the default is
17183 to compile code for a little-endian processor.
17184
17185 @item -mbe8
17186 @itemx -mbe32
17187 @opindex mbe8
17188 When linking a big-endian image select between BE8 and BE32 formats.
17189 The option has no effect for little-endian images and is ignored. The
17190 default is dependent on the selected target architecture. For ARMv6
17191 and later architectures the default is BE8, for older architectures
17192 the default is BE32. BE32 format has been deprecated by ARM.
17193
17194 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17195 @opindex march
17196 This specifies the name of the target ARM architecture. GCC uses this
17197 name to determine what kind of instructions it can emit when generating
17198 assembly code. This option can be used in conjunction with or instead
17199 of the @option{-mcpu=} option.
17200
17201 Permissible names are:
17202 @samp{armv4t},
17203 @samp{armv5t}, @samp{armv5te},
17204 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17205 @samp{armv6z}, @samp{armv6zk},
17206 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17207 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17208 @samp{armv8.4-a},
17209 @samp{armv8.5-a},
17210 @samp{armv7-r},
17211 @samp{armv8-r},
17212 @samp{armv6-m}, @samp{armv6s-m},
17213 @samp{armv7-m}, @samp{armv7e-m},
17214 @samp{armv8-m.base}, @samp{armv8-m.main},
17215 @samp{iwmmxt} and @samp{iwmmxt2}.
17216
17217 Additionally, the following architectures, which lack support for the
17218 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17219
17220 Many of the architectures support extensions. These can be added by
17221 appending @samp{+@var{extension}} to the architecture name. Extension
17222 options are processed in order and capabilities accumulate. An extension
17223 will also enable any necessary base extensions
17224 upon which it depends. For example, the @samp{+crypto} extension
17225 will always enable the @samp{+simd} extension. The exception to the
17226 additive construction is for extensions that are prefixed with
17227 @samp{+no@dots{}}: these extensions disable the specified option and
17228 any other extensions that may depend on the presence of that
17229 extension.
17230
17231 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17232 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17233 entirely disabled by the @samp{+nofp} option that follows it.
17234
17235 Most extension names are generically named, but have an effect that is
17236 dependent upon the architecture to which it is applied. For example,
17237 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17238 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17239 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17240 variant for @samp{armv8-a}.
17241
17242 The table below lists the supported extensions for each architecture.
17243 Architectures not mentioned do not support any extensions.
17244
17245 @table @samp
17246 @item armv5te
17247 @itemx armv6
17248 @itemx armv6j
17249 @itemx armv6k
17250 @itemx armv6kz
17251 @itemx armv6t2
17252 @itemx armv6z
17253 @itemx armv6zk
17254 @table @samp
17255 @item +fp
17256 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17257 used as an alias for this extension.
17258
17259 @item +nofp
17260 Disable the floating-point instructions.
17261 @end table
17262
17263 @item armv7
17264 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17265 @table @samp
17266 @item +fp
17267 The VFPv3 floating-point instructions, with 16 double-precision
17268 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17269 for this extension. Note that floating-point is not supported by the
17270 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17271 ARMv7-R architectures.
17272
17273 @item +nofp
17274 Disable the floating-point instructions.
17275 @end table
17276
17277 @item armv7-a
17278 @table @samp
17279 @item +mp
17280 The multiprocessing extension.
17281
17282 @item +sec
17283 The security extension.
17284
17285 @item +fp
17286 The VFPv3 floating-point instructions, with 16 double-precision
17287 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17288 for this extension.
17289
17290 @item +simd
17291 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17292 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17293 for this extension.
17294
17295 @item +vfpv3
17296 The VFPv3 floating-point instructions, with 32 double-precision
17297 registers.
17298
17299 @item +vfpv3-d16-fp16
17300 The VFPv3 floating-point instructions, with 16 double-precision
17301 registers and the half-precision floating-point conversion operations.
17302
17303 @item +vfpv3-fp16
17304 The VFPv3 floating-point instructions, with 32 double-precision
17305 registers and the half-precision floating-point conversion operations.
17306
17307 @item +vfpv4-d16
17308 The VFPv4 floating-point instructions, with 16 double-precision
17309 registers.
17310
17311 @item +vfpv4
17312 The VFPv4 floating-point instructions, with 32 double-precision
17313 registers.
17314
17315 @item +neon-fp16
17316 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17317 the half-precision floating-point conversion operations.
17318
17319 @item +neon-vfpv4
17320 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17321
17322 @item +nosimd
17323 Disable the Advanced SIMD instructions (does not disable floating point).
17324
17325 @item +nofp
17326 Disable the floating-point and Advanced SIMD instructions.
17327 @end table
17328
17329 @item armv7ve
17330 The extended version of the ARMv7-A architecture with support for
17331 virtualization.
17332 @table @samp
17333 @item +fp
17334 The VFPv4 floating-point instructions, with 16 double-precision registers.
17335 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17336
17337 @item +simd
17338 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17339 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17340
17341 @item +vfpv3-d16
17342 The VFPv3 floating-point instructions, with 16 double-precision
17343 registers.
17344
17345 @item +vfpv3
17346 The VFPv3 floating-point instructions, with 32 double-precision
17347 registers.
17348
17349 @item +vfpv3-d16-fp16
17350 The VFPv3 floating-point instructions, with 16 double-precision
17351 registers and the half-precision floating-point conversion operations.
17352
17353 @item +vfpv3-fp16
17354 The VFPv3 floating-point instructions, with 32 double-precision
17355 registers and the half-precision floating-point conversion operations.
17356
17357 @item +vfpv4-d16
17358 The VFPv4 floating-point instructions, with 16 double-precision
17359 registers.
17360
17361 @item +vfpv4
17362 The VFPv4 floating-point instructions, with 32 double-precision
17363 registers.
17364
17365 @item +neon
17366 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17367 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17368
17369 @item +neon-fp16
17370 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17371 the half-precision floating-point conversion operations.
17372
17373 @item +nosimd
17374 Disable the Advanced SIMD instructions (does not disable floating point).
17375
17376 @item +nofp
17377 Disable the floating-point and Advanced SIMD instructions.
17378 @end table
17379
17380 @item armv8-a
17381 @table @samp
17382 @item +crc
17383 The Cyclic Redundancy Check (CRC) instructions.
17384 @item +simd
17385 The ARMv8-A Advanced SIMD and floating-point instructions.
17386 @item +crypto
17387 The cryptographic instructions.
17388 @item +nocrypto
17389 Disable the cryptographic instructions.
17390 @item +nofp
17391 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17392 @item +sb
17393 Speculation Barrier Instruction.
17394 @item +predres
17395 Execution and Data Prediction Restriction Instructions.
17396 @end table
17397
17398 @item armv8.1-a
17399 @table @samp
17400 @item +simd
17401 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17402
17403 @item +crypto
17404 The cryptographic instructions. This also enables the Advanced SIMD and
17405 floating-point instructions.
17406
17407 @item +nocrypto
17408 Disable the cryptographic instructions.
17409
17410 @item +nofp
17411 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17412
17413 @item +sb
17414 Speculation Barrier Instruction.
17415
17416 @item +predres
17417 Execution and Data Prediction Restriction Instructions.
17418 @end table
17419
17420 @item armv8.2-a
17421 @itemx armv8.3-a
17422 @table @samp
17423 @item +fp16
17424 The half-precision floating-point data processing instructions.
17425 This also enables the Advanced SIMD and floating-point instructions.
17426
17427 @item +fp16fml
17428 The half-precision floating-point fmla extension. This also enables
17429 the half-precision floating-point extension and Advanced SIMD and
17430 floating-point instructions.
17431
17432 @item +simd
17433 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17434
17435 @item +crypto
17436 The cryptographic instructions. This also enables the Advanced SIMD and
17437 floating-point instructions.
17438
17439 @item +dotprod
17440 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17441
17442 @item +nocrypto
17443 Disable the cryptographic extension.
17444
17445 @item +nofp
17446 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17447
17448 @item +sb
17449 Speculation Barrier Instruction.
17450
17451 @item +predres
17452 Execution and Data Prediction Restriction Instructions.
17453 @end table
17454
17455 @item armv8.4-a
17456 @table @samp
17457 @item +fp16
17458 The half-precision floating-point data processing instructions.
17459 This also enables the Advanced SIMD and floating-point instructions as well
17460 as the Dot Product extension and the half-precision floating-point fmla
17461 extension.
17462
17463 @item +simd
17464 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17465 Dot Product extension.
17466
17467 @item +crypto
17468 The cryptographic instructions. This also enables the Advanced SIMD and
17469 floating-point instructions as well as the Dot Product extension.
17470
17471 @item +nocrypto
17472 Disable the cryptographic extension.
17473
17474 @item +nofp
17475 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17476
17477 @item +sb
17478 Speculation Barrier Instruction.
17479
17480 @item +predres
17481 Execution and Data Prediction Restriction Instructions.
17482 @end table
17483
17484 @item armv8.5-a
17485 @table @samp
17486 @item +fp16
17487 The half-precision floating-point data processing instructions.
17488 This also enables the Advanced SIMD and floating-point instructions as well
17489 as the Dot Product extension and the half-precision floating-point fmla
17490 extension.
17491
17492 @item +simd
17493 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17494 Dot Product extension.
17495
17496 @item +crypto
17497 The cryptographic instructions. This also enables the Advanced SIMD and
17498 floating-point instructions as well as the Dot Product extension.
17499
17500 @item +nocrypto
17501 Disable the cryptographic extension.
17502
17503 @item +nofp
17504 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17505 @end table
17506
17507 @item armv7-r
17508 @table @samp
17509 @item +fp.sp
17510 The single-precision VFPv3 floating-point instructions. The extension
17511 @samp{+vfpv3xd} can be used as an alias for this extension.
17512
17513 @item +fp
17514 The VFPv3 floating-point instructions with 16 double-precision registers.
17515 The extension +vfpv3-d16 can be used as an alias for this extension.
17516
17517 @item +vfpv3xd-d16-fp16
17518 The single-precision VFPv3 floating-point instructions with 16 double-precision
17519 registers and the half-precision floating-point conversion operations.
17520
17521 @item +vfpv3-d16-fp16
17522 The VFPv3 floating-point instructions with 16 double-precision
17523 registers and the half-precision floating-point conversion operations.
17524
17525 @item +nofp
17526 Disable the floating-point extension.
17527
17528 @item +idiv
17529 The ARM-state integer division instructions.
17530
17531 @item +noidiv
17532 Disable the ARM-state integer division extension.
17533 @end table
17534
17535 @item armv7e-m
17536 @table @samp
17537 @item +fp
17538 The single-precision VFPv4 floating-point instructions.
17539
17540 @item +fpv5
17541 The single-precision FPv5 floating-point instructions.
17542
17543 @item +fp.dp
17544 The single- and double-precision FPv5 floating-point instructions.
17545
17546 @item +nofp
17547 Disable the floating-point extensions.
17548 @end table
17549
17550 @item armv8-m.main
17551 @table @samp
17552 @item +dsp
17553 The DSP instructions.
17554
17555 @item +nodsp
17556 Disable the DSP extension.
17557
17558 @item +fp
17559 The single-precision floating-point instructions.
17560
17561 @item +fp.dp
17562 The single- and double-precision floating-point instructions.
17563
17564 @item +nofp
17565 Disable the floating-point extension.
17566 @end table
17567
17568 @item armv8-r
17569 @table @samp
17570 @item +crc
17571 The Cyclic Redundancy Check (CRC) instructions.
17572 @item +fp.sp
17573 The single-precision FPv5 floating-point instructions.
17574 @item +simd
17575 The ARMv8-A Advanced SIMD and floating-point instructions.
17576 @item +crypto
17577 The cryptographic instructions.
17578 @item +nocrypto
17579 Disable the cryptographic instructions.
17580 @item +nofp
17581 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17582 @end table
17583
17584 @end table
17585
17586 @option{-march=native} causes the compiler to auto-detect the architecture
17587 of the build computer. At present, this feature is only supported on
17588 GNU/Linux, and not all architectures are recognized. If the auto-detect
17589 is unsuccessful the option has no effect.
17590
17591 @item -mtune=@var{name}
17592 @opindex mtune
17593 This option specifies the name of the target ARM processor for
17594 which GCC should tune the performance of the code.
17595 For some ARM implementations better performance can be obtained by using
17596 this option.
17597 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17598 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17599 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17600 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17601 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17602 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17603 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17604 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17605 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17606 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17607 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17608 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17609 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17610 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17611 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17612 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17613 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17614 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17615 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17616 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17617 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17618 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17619
17620 Additionally, this option can specify that GCC should tune the performance
17621 of the code for a big.LITTLE system. Permissible names are:
17622 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17623 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17624 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17625 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17626
17627 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17628 performance for a blend of processors within architecture @var{arch}.
17629 The aim is to generate code that run well on the current most popular
17630 processors, balancing between optimizations that benefit some CPUs in the
17631 range, and avoiding performance pitfalls of other CPUs. The effects of
17632 this option may change in future GCC versions as CPU models come and go.
17633
17634 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17635 the extension options do not affect the tuning of the generated code.
17636
17637 @option{-mtune=native} causes the compiler to auto-detect the CPU
17638 of the build computer. At present, this feature is only supported on
17639 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17640 unsuccessful the option has no effect.
17641
17642 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17643 @opindex mcpu
17644 This specifies the name of the target ARM processor. GCC uses this name
17645 to derive the name of the target ARM architecture (as if specified
17646 by @option{-march}) and the ARM processor type for which to tune for
17647 performance (as if specified by @option{-mtune}). Where this option
17648 is used in conjunction with @option{-march} or @option{-mtune},
17649 those options take precedence over the appropriate part of this option.
17650
17651 Many of the supported CPUs implement optional architectural
17652 extensions. Where this is so the architectural extensions are
17653 normally enabled by default. If implementations that lack the
17654 extension exist, then the extension syntax can be used to disable
17655 those extensions that have been omitted. For floating-point and
17656 Advanced SIMD (Neon) instructions, the settings of the options
17657 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17658 floating-point and Advanced SIMD instructions will only be used if
17659 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17660 @option{-mfpu} other than @samp{auto} will override the available
17661 floating-point and SIMD extension instructions.
17662
17663 For example, @samp{cortex-a9} can be found in three major
17664 configurations: integer only, with just a floating-point unit or with
17665 floating-point and Advanced SIMD. The default is to enable all the
17666 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17667 be used to disable just the SIMD or both the SIMD and floating-point
17668 instructions respectively.
17669
17670 Permissible names for this option are the same as those for
17671 @option{-mtune}.
17672
17673 The following extension options are common to the listed CPUs:
17674
17675 @table @samp
17676 @item +nodsp
17677 Disable the DSP instructions on @samp{cortex-m33}.
17678
17679 @item +nofp
17680 Disables the floating-point instructions on @samp{arm9e},
17681 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17682 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17683 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17684 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17685 Disables the floating-point and SIMD instructions on
17686 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17687 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17688 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17689 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17690 @samp{cortex-a53} and @samp{cortex-a55}.
17691
17692 @item +nofp.dp
17693 Disables the double-precision component of the floating-point instructions
17694 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17695 @samp{cortex-m7}.
17696
17697 @item +nosimd
17698 Disables the SIMD (but not floating-point) instructions on
17699 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17700 and @samp{cortex-a9}.
17701
17702 @item +crypto
17703 Enables the cryptographic instructions on @samp{cortex-a32},
17704 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17705 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17706 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17707 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17708 @samp{cortex-a75.cortex-a55}.
17709 @end table
17710
17711 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17712 VFPv3 with 16 double-precision registers. It supports the following
17713 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17714 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17715 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17716 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17717 the extensions to @option{-march=armv7-a}.
17718
17719 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17720 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17721 See @option{-mtune} for more information.
17722
17723 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17724 of the build computer. At present, this feature is only supported on
17725 GNU/Linux, and not all architectures are recognized. If the auto-detect
17726 is unsuccessful the option has no effect.
17727
17728 @item -mfpu=@var{name}
17729 @opindex mfpu
17730 This specifies what floating-point hardware (or hardware emulation) is
17731 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17732 @samp{vfpv3},
17733 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17734 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17735 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17736 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17737 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17738 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17739 is an alias for @samp{vfpv2}.
17740
17741 The setting @samp{auto} is the default and is special. It causes the
17742 compiler to select the floating-point and Advanced SIMD instructions
17743 based on the settings of @option{-mcpu} and @option{-march}.
17744
17745 If the selected floating-point hardware includes the NEON extension
17746 (e.g.@: @option{-mfpu=neon}), note that floating-point
17747 operations are not generated by GCC's auto-vectorization pass unless
17748 @option{-funsafe-math-optimizations} is also specified. This is
17749 because NEON hardware does not fully implement the IEEE 754 standard for
17750 floating-point arithmetic (in particular denormal values are treated as
17751 zero), so the use of NEON instructions may lead to a loss of precision.
17752
17753 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}).
17754
17755 @item -mfp16-format=@var{name}
17756 @opindex mfp16-format
17757 Specify the format of the @code{__fp16} half-precision floating-point type.
17758 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17759 the default is @samp{none}, in which case the @code{__fp16} type is not
17760 defined. @xref{Half-Precision}, for more information.
17761
17762 @item -mstructure-size-boundary=@var{n}
17763 @opindex mstructure-size-boundary
17764 The sizes of all structures and unions are rounded up to a multiple
17765 of the number of bits set by this option. Permissible values are 8, 32
17766 and 64. The default value varies for different toolchains. For the COFF
17767 targeted toolchain the default value is 8. A value of 64 is only allowed
17768 if the underlying ABI supports it.
17769
17770 Specifying a larger number can produce faster, more efficient code, but
17771 can also increase the size of the program. Different values are potentially
17772 incompatible. Code compiled with one value cannot necessarily expect to
17773 work with code or libraries compiled with another value, if they exchange
17774 information using structures or unions.
17775
17776 This option is deprecated.
17777
17778 @item -mabort-on-noreturn
17779 @opindex mabort-on-noreturn
17780 Generate a call to the function @code{abort} at the end of a
17781 @code{noreturn} function. It is executed if the function tries to
17782 return.
17783
17784 @item -mlong-calls
17785 @itemx -mno-long-calls
17786 @opindex mlong-calls
17787 @opindex mno-long-calls
17788 Tells the compiler to perform function calls by first loading the
17789 address of the function into a register and then performing a subroutine
17790 call on this register. This switch is needed if the target function
17791 lies outside of the 64-megabyte addressing range of the offset-based
17792 version of subroutine call instruction.
17793
17794 Even if this switch is enabled, not all function calls are turned
17795 into long calls. The heuristic is that static functions, functions
17796 that have the @code{short_call} attribute, functions that are inside
17797 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17798 definitions have already been compiled within the current compilation
17799 unit are not turned into long calls. The exceptions to this rule are
17800 that weak function definitions, functions with the @code{long_call}
17801 attribute or the @code{section} attribute, and functions that are within
17802 the scope of a @code{#pragma long_calls} directive are always
17803 turned into long calls.
17804
17805 This feature is not enabled by default. Specifying
17806 @option{-mno-long-calls} restores the default behavior, as does
17807 placing the function calls within the scope of a @code{#pragma
17808 long_calls_off} directive. Note these switches have no effect on how
17809 the compiler generates code to handle function calls via function
17810 pointers.
17811
17812 @item -msingle-pic-base
17813 @opindex msingle-pic-base
17814 Treat the register used for PIC addressing as read-only, rather than
17815 loading it in the prologue for each function. The runtime system is
17816 responsible for initializing this register with an appropriate value
17817 before execution begins.
17818
17819 @item -mpic-register=@var{reg}
17820 @opindex mpic-register
17821 Specify the register to be used for PIC addressing.
17822 For standard PIC base case, the default is any suitable register
17823 determined by compiler. For single PIC base case, the default is
17824 @samp{R9} if target is EABI based or stack-checking is enabled,
17825 otherwise the default is @samp{R10}.
17826
17827 @item -mpic-data-is-text-relative
17828 @opindex mpic-data-is-text-relative
17829 Assume that the displacement between the text and data segments is fixed
17830 at static link time. This permits using PC-relative addressing
17831 operations to access data known to be in the data segment. For
17832 non-VxWorks RTP targets, this option is enabled by default. When
17833 disabled on such targets, it will enable @option{-msingle-pic-base} by
17834 default.
17835
17836 @item -mpoke-function-name
17837 @opindex mpoke-function-name
17838 Write the name of each function into the text section, directly
17839 preceding the function prologue. The generated code is similar to this:
17840
17841 @smallexample
17842 t0
17843 .ascii "arm_poke_function_name", 0
17844 .align
17845 t1
17846 .word 0xff000000 + (t1 - t0)
17847 arm_poke_function_name
17848 mov ip, sp
17849 stmfd sp!, @{fp, ip, lr, pc@}
17850 sub fp, ip, #4
17851 @end smallexample
17852
17853 When performing a stack backtrace, code can inspect the value of
17854 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17855 location @code{pc - 12} and the top 8 bits are set, then we know that
17856 there is a function name embedded immediately preceding this location
17857 and has length @code{((pc[-3]) & 0xff000000)}.
17858
17859 @item -mthumb
17860 @itemx -marm
17861 @opindex marm
17862 @opindex mthumb
17863
17864 Select between generating code that executes in ARM and Thumb
17865 states. The default for most configurations is to generate code
17866 that executes in ARM state, but the default can be changed by
17867 configuring GCC with the @option{--with-mode=}@var{state}
17868 configure option.
17869
17870 You can also override the ARM and Thumb mode for each function
17871 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17872 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17873
17874 @item -mflip-thumb
17875 @opindex mflip-thumb
17876 Switch ARM/Thumb modes on alternating functions.
17877 This option is provided for regression testing of mixed Thumb/ARM code
17878 generation, and is not intended for ordinary use in compiling code.
17879
17880 @item -mtpcs-frame
17881 @opindex mtpcs-frame
17882 Generate a stack frame that is compliant with the Thumb Procedure Call
17883 Standard for all non-leaf functions. (A leaf function is one that does
17884 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17885
17886 @item -mtpcs-leaf-frame
17887 @opindex mtpcs-leaf-frame
17888 Generate a stack frame that is compliant with the Thumb Procedure Call
17889 Standard for all leaf functions. (A leaf function is one that does
17890 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17891
17892 @item -mcallee-super-interworking
17893 @opindex mcallee-super-interworking
17894 Gives all externally visible functions in the file being compiled an ARM
17895 instruction set header which switches to Thumb mode before executing the
17896 rest of the function. This allows these functions to be called from
17897 non-interworking code. This option is not valid in AAPCS configurations
17898 because interworking is enabled by default.
17899
17900 @item -mcaller-super-interworking
17901 @opindex mcaller-super-interworking
17902 Allows calls via function pointers (including virtual functions) to
17903 execute correctly regardless of whether the target code has been
17904 compiled for interworking or not. There is a small overhead in the cost
17905 of executing a function pointer if this option is enabled. This option
17906 is not valid in AAPCS configurations because interworking is enabled
17907 by default.
17908
17909 @item -mtp=@var{name}
17910 @opindex mtp
17911 Specify the access model for the thread local storage pointer. The valid
17912 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17913 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17914 (supported in the arm6k architecture), and @samp{auto}, which uses the
17915 best available method for the selected processor. The default setting is
17916 @samp{auto}.
17917
17918 @item -mtls-dialect=@var{dialect}
17919 @opindex mtls-dialect
17920 Specify the dialect to use for accessing thread local storage. Two
17921 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17922 @samp{gnu} dialect selects the original GNU scheme for supporting
17923 local and global dynamic TLS models. The @samp{gnu2} dialect
17924 selects the GNU descriptor scheme, which provides better performance
17925 for shared libraries. The GNU descriptor scheme is compatible with
17926 the original scheme, but does require new assembler, linker and
17927 library support. Initial and local exec TLS models are unaffected by
17928 this option and always use the original scheme.
17929
17930 @item -mword-relocations
17931 @opindex mword-relocations
17932 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17933 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17934 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17935 is specified. This option conflicts with @option{-mslow-flash-data}.
17936
17937 @item -mfix-cortex-m3-ldrd
17938 @opindex mfix-cortex-m3-ldrd
17939 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17940 with overlapping destination and base registers are used. This option avoids
17941 generating these instructions. This option is enabled by default when
17942 @option{-mcpu=cortex-m3} is specified.
17943
17944 @item -munaligned-access
17945 @itemx -mno-unaligned-access
17946 @opindex munaligned-access
17947 @opindex mno-unaligned-access
17948 Enables (or disables) reading and writing of 16- and 32- bit values
17949 from addresses that are not 16- or 32- bit aligned. By default
17950 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17951 ARMv8-M Baseline architectures, and enabled for all other
17952 architectures. If unaligned access is not enabled then words in packed
17953 data structures are accessed a byte at a time.
17954
17955 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17956 generated object file to either true or false, depending upon the
17957 setting of this option. If unaligned access is enabled then the
17958 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17959 defined.
17960
17961 @item -mneon-for-64bits
17962 @opindex mneon-for-64bits
17963 Enables using Neon to handle scalar 64-bits operations. This is
17964 disabled by default since the cost of moving data from core registers
17965 to Neon is high.
17966
17967 @item -mslow-flash-data
17968 @opindex mslow-flash-data
17969 Assume loading data from flash is slower than fetching instruction.
17970 Therefore literal load is minimized for better performance.
17971 This option is only supported when compiling for ARMv7 M-profile and
17972 off by default. It conflicts with @option{-mword-relocations}.
17973
17974 @item -masm-syntax-unified
17975 @opindex masm-syntax-unified
17976 Assume inline assembler is using unified asm syntax. The default is
17977 currently off which implies divided syntax. This option has no impact
17978 on Thumb2. However, this may change in future releases of GCC.
17979 Divided syntax should be considered deprecated.
17980
17981 @item -mrestrict-it
17982 @opindex mrestrict-it
17983 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17984 IT blocks can only contain a single 16-bit instruction from a select
17985 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17986
17987 @item -mprint-tune-info
17988 @opindex mprint-tune-info
17989 Print CPU tuning information as comment in assembler file. This is
17990 an option used only for regression testing of the compiler and not
17991 intended for ordinary use in compiling code. This option is disabled
17992 by default.
17993
17994 @item -mverbose-cost-dump
17995 @opindex mverbose-cost-dump
17996 Enable verbose cost model dumping in the debug dump files. This option is
17997 provided for use in debugging the compiler.
17998
17999 @item -mpure-code
18000 @opindex mpure-code
18001 Do not allow constant data to be placed in code sections.
18002 Additionally, when compiling for ELF object format give all text sections the
18003 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18004 is only available when generating non-pic code for M-profile targets with the
18005 MOVT instruction.
18006
18007 @item -mcmse
18008 @opindex mcmse
18009 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18010 Development Tools Engineering Specification", which can be found on
18011 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18012 @end table
18013
18014 @node AVR Options
18015 @subsection AVR Options
18016 @cindex AVR Options
18017
18018 These options are defined for AVR implementations:
18019
18020 @table @gcctabopt
18021 @item -mmcu=@var{mcu}
18022 @opindex mmcu
18023 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18024
18025 The default for this option is@tie{}@samp{avr2}.
18026
18027 GCC supports the following AVR devices and ISAs:
18028
18029 @include avr-mmcu.texi
18030
18031 @item -mabsdata
18032 @opindex mabsdata
18033
18034 Assume that all data in static storage can be accessed by LDS / STS
18035 instructions. This option has only an effect on reduced Tiny devices like
18036 ATtiny40. See also the @code{absdata}
18037 @ref{AVR Variable Attributes,variable attribute}.
18038
18039 @item -maccumulate-args
18040 @opindex maccumulate-args
18041 Accumulate outgoing function arguments and acquire/release the needed
18042 stack space for outgoing function arguments once in function
18043 prologue/epilogue. Without this option, outgoing arguments are pushed
18044 before calling a function and popped afterwards.
18045
18046 Popping the arguments after the function call can be expensive on
18047 AVR so that accumulating the stack space might lead to smaller
18048 executables because arguments need not be removed from the
18049 stack after such a function call.
18050
18051 This option can lead to reduced code size for functions that perform
18052 several calls to functions that get their arguments on the stack like
18053 calls to printf-like functions.
18054
18055 @item -mbranch-cost=@var{cost}
18056 @opindex mbranch-cost
18057 Set the branch costs for conditional branch instructions to
18058 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18059 integers. The default branch cost is 0.
18060
18061 @item -mcall-prologues
18062 @opindex mcall-prologues
18063 Functions prologues/epilogues are expanded as calls to appropriate
18064 subroutines. Code size is smaller.
18065
18066 @item -mgas-isr-prologues
18067 @opindex mgas-isr-prologues
18068 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18069 instruction supported by GNU Binutils.
18070 If this option is on, the feature can still be disabled for individual
18071 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18072 function attribute. This feature is activated per default
18073 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18074 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18075
18076 @item -mint8
18077 @opindex mint8
18078 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18079 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18080 and @code{long long} is 4 bytes. Please note that this option does not
18081 conform to the C standards, but it results in smaller code
18082 size.
18083
18084 @item -mmain-is-OS_task
18085 @opindex mmain-is-OS_task
18086 Do not save registers in @code{main}. The effect is the same like
18087 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18088 to @code{main}. It is activated per default if optimization is on.
18089
18090 @item -mn-flash=@var{num}
18091 @opindex mn-flash
18092 Assume that the flash memory has a size of
18093 @var{num} times 64@tie{}KiB.
18094
18095 @item -mno-interrupts
18096 @opindex mno-interrupts
18097 Generated code is not compatible with hardware interrupts.
18098 Code size is smaller.
18099
18100 @item -mrelax
18101 @opindex mrelax
18102 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18103 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18104 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18105 the assembler's command line and the @option{--relax} option to the
18106 linker's command line.
18107
18108 Jump relaxing is performed by the linker because jump offsets are not
18109 known before code is located. Therefore, the assembler code generated by the
18110 compiler is the same, but the instructions in the executable may
18111 differ from instructions in the assembler code.
18112
18113 Relaxing must be turned on if linker stubs are needed, see the
18114 section on @code{EIND} and linker stubs below.
18115
18116 @item -mrmw
18117 @opindex mrmw
18118 Assume that the device supports the Read-Modify-Write
18119 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18120
18121 @item -mshort-calls
18122 @opindex mshort-calls
18123
18124 Assume that @code{RJMP} and @code{RCALL} can target the whole
18125 program memory.
18126
18127 This option is used internally for multilib selection. It is
18128 not an optimization option, and you don't need to set it by hand.
18129
18130 @item -msp8
18131 @opindex msp8
18132 Treat the stack pointer register as an 8-bit register,
18133 i.e.@: assume the high byte of the stack pointer is zero.
18134 In general, you don't need to set this option by hand.
18135
18136 This option is used internally by the compiler to select and
18137 build multilibs for architectures @code{avr2} and @code{avr25}.
18138 These architectures mix devices with and without @code{SPH}.
18139 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18140 the compiler driver adds or removes this option from the compiler
18141 proper's command line, because the compiler then knows if the device
18142 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18143 register or not.
18144
18145 @item -mstrict-X
18146 @opindex mstrict-X
18147 Use address register @code{X} in a way proposed by the hardware. This means
18148 that @code{X} is only used in indirect, post-increment or
18149 pre-decrement addressing.
18150
18151 Without this option, the @code{X} register may be used in the same way
18152 as @code{Y} or @code{Z} which then is emulated by additional
18153 instructions.
18154 For example, loading a value with @code{X+const} addressing with a
18155 small non-negative @code{const < 64} to a register @var{Rn} is
18156 performed as
18157
18158 @example
18159 adiw r26, const ; X += const
18160 ld @var{Rn}, X ; @var{Rn} = *X
18161 sbiw r26, const ; X -= const
18162 @end example
18163
18164 @item -mtiny-stack
18165 @opindex mtiny-stack
18166 Only change the lower 8@tie{}bits of the stack pointer.
18167
18168 @item -mfract-convert-truncate
18169 @opindex mfract-convert-truncate
18170 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18171
18172 @item -nodevicelib
18173 @opindex nodevicelib
18174 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18175
18176 @item -Waddr-space-convert
18177 @opindex Waddr-space-convert
18178 @opindex Wno-addr-space-convert
18179 Warn about conversions between address spaces in the case where the
18180 resulting address space is not contained in the incoming address space.
18181
18182 @item -Wmisspelled-isr
18183 @opindex Wmisspelled-isr
18184 @opindex Wno-misspelled-isr
18185 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18186 Enabled by default.
18187 @end table
18188
18189 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18190 @cindex @code{EIND}
18191 Pointers in the implementation are 16@tie{}bits wide.
18192 The address of a function or label is represented as word address so
18193 that indirect jumps and calls can target any code address in the
18194 range of 64@tie{}Ki words.
18195
18196 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18197 bytes of program memory space, there is a special function register called
18198 @code{EIND} that serves as most significant part of the target address
18199 when @code{EICALL} or @code{EIJMP} instructions are used.
18200
18201 Indirect jumps and calls on these devices are handled as follows by
18202 the compiler and are subject to some limitations:
18203
18204 @itemize @bullet
18205
18206 @item
18207 The compiler never sets @code{EIND}.
18208
18209 @item
18210 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18211 instructions or might read @code{EIND} directly in order to emulate an
18212 indirect call/jump by means of a @code{RET} instruction.
18213
18214 @item
18215 The compiler assumes that @code{EIND} never changes during the startup
18216 code or during the application. In particular, @code{EIND} is not
18217 saved/restored in function or interrupt service routine
18218 prologue/epilogue.
18219
18220 @item
18221 For indirect calls to functions and computed goto, the linker
18222 generates @emph{stubs}. Stubs are jump pads sometimes also called
18223 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18224 The stub contains a direct jump to the desired address.
18225
18226 @item
18227 Linker relaxation must be turned on so that the linker generates
18228 the stubs correctly in all situations. See the compiler option
18229 @option{-mrelax} and the linker option @option{--relax}.
18230 There are corner cases where the linker is supposed to generate stubs
18231 but aborts without relaxation and without a helpful error message.
18232
18233 @item
18234 The default linker script is arranged for code with @code{EIND = 0}.
18235 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18236 linker script has to be used in order to place the sections whose
18237 name start with @code{.trampolines} into the segment where @code{EIND}
18238 points to.
18239
18240 @item
18241 The startup code from libgcc never sets @code{EIND}.
18242 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18243 For the impact of AVR-LibC on @code{EIND}, see the
18244 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18245
18246 @item
18247 It is legitimate for user-specific startup code to set up @code{EIND}
18248 early, for example by means of initialization code located in
18249 section @code{.init3}. Such code runs prior to general startup code
18250 that initializes RAM and calls constructors, but after the bit
18251 of startup code from AVR-LibC that sets @code{EIND} to the segment
18252 where the vector table is located.
18253 @example
18254 #include <avr/io.h>
18255
18256 static void
18257 __attribute__((section(".init3"),naked,used,no_instrument_function))
18258 init3_set_eind (void)
18259 @{
18260 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18261 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18262 @}
18263 @end example
18264
18265 @noindent
18266 The @code{__trampolines_start} symbol is defined in the linker script.
18267
18268 @item
18269 Stubs are generated automatically by the linker if
18270 the following two conditions are met:
18271 @itemize @minus
18272
18273 @item The address of a label is taken by means of the @code{gs} modifier
18274 (short for @emph{generate stubs}) like so:
18275 @example
18276 LDI r24, lo8(gs(@var{func}))
18277 LDI r25, hi8(gs(@var{func}))
18278 @end example
18279 @item The final location of that label is in a code segment
18280 @emph{outside} the segment where the stubs are located.
18281 @end itemize
18282
18283 @item
18284 The compiler emits such @code{gs} modifiers for code labels in the
18285 following situations:
18286 @itemize @minus
18287 @item Taking address of a function or code label.
18288 @item Computed goto.
18289 @item If prologue-save function is used, see @option{-mcall-prologues}
18290 command-line option.
18291 @item Switch/case dispatch tables. If you do not want such dispatch
18292 tables you can specify the @option{-fno-jump-tables} command-line option.
18293 @item C and C++ constructors/destructors called during startup/shutdown.
18294 @item If the tools hit a @code{gs()} modifier explained above.
18295 @end itemize
18296
18297 @item
18298 Jumping to non-symbolic addresses like so is @emph{not} supported:
18299
18300 @example
18301 int main (void)
18302 @{
18303 /* Call function at word address 0x2 */
18304 return ((int(*)(void)) 0x2)();
18305 @}
18306 @end example
18307
18308 Instead, a stub has to be set up, i.e.@: the function has to be called
18309 through a symbol (@code{func_4} in the example):
18310
18311 @example
18312 int main (void)
18313 @{
18314 extern int func_4 (void);
18315
18316 /* Call function at byte address 0x4 */
18317 return func_4();
18318 @}
18319 @end example
18320
18321 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18322 Alternatively, @code{func_4} can be defined in the linker script.
18323 @end itemize
18324
18325 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18326 @cindex @code{RAMPD}
18327 @cindex @code{RAMPX}
18328 @cindex @code{RAMPY}
18329 @cindex @code{RAMPZ}
18330 Some AVR devices support memories larger than the 64@tie{}KiB range
18331 that can be accessed with 16-bit pointers. To access memory locations
18332 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18333 register is used as high part of the address:
18334 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18335 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18336 register, respectively, to get a wide address. Similarly,
18337 @code{RAMPD} is used together with direct addressing.
18338
18339 @itemize
18340 @item
18341 The startup code initializes the @code{RAMP} special function
18342 registers with zero.
18343
18344 @item
18345 If a @ref{AVR Named Address Spaces,named address space} other than
18346 generic or @code{__flash} is used, then @code{RAMPZ} is set
18347 as needed before the operation.
18348
18349 @item
18350 If the device supports RAM larger than 64@tie{}KiB and the compiler
18351 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18352 is reset to zero after the operation.
18353
18354 @item
18355 If the device comes with a specific @code{RAMP} register, the ISR
18356 prologue/epilogue saves/restores that SFR and initializes it with
18357 zero in case the ISR code might (implicitly) use it.
18358
18359 @item
18360 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18361 If you use inline assembler to read from locations outside the
18362 16-bit address range and change one of the @code{RAMP} registers,
18363 you must reset it to zero after the access.
18364
18365 @end itemize
18366
18367 @subsubsection AVR Built-in Macros
18368
18369 GCC defines several built-in macros so that the user code can test
18370 for the presence or absence of features. Almost any of the following
18371 built-in macros are deduced from device capabilities and thus
18372 triggered by the @option{-mmcu=} command-line option.
18373
18374 For even more AVR-specific built-in macros see
18375 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18376
18377 @table @code
18378
18379 @item __AVR_ARCH__
18380 Build-in macro that resolves to a decimal number that identifies the
18381 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18382 Possible values are:
18383
18384 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18385 @code{4}, @code{5}, @code{51}, @code{6}
18386
18387 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18388 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18389
18390 respectively and
18391
18392 @code{100},
18393 @code{102}, @code{103}, @code{104},
18394 @code{105}, @code{106}, @code{107}
18395
18396 for @var{mcu}=@code{avrtiny},
18397 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18398 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18399 If @var{mcu} specifies a device, this built-in macro is set
18400 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18401 defined to @code{4}.
18402
18403 @item __AVR_@var{Device}__
18404 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18405 the device's name. For example, @option{-mmcu=atmega8} defines the
18406 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18407 @code{__AVR_ATtiny261A__}, etc.
18408
18409 The built-in macros' names follow
18410 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18411 the device name as from the AVR user manual. The difference between
18412 @var{Device} in the built-in macro and @var{device} in
18413 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18414
18415 If @var{device} is not a device but only a core architecture like
18416 @samp{avr51}, this macro is not defined.
18417
18418 @item __AVR_DEVICE_NAME__
18419 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18420 the device's name. For example, with @option{-mmcu=atmega8} the macro
18421 is defined to @code{atmega8}.
18422
18423 If @var{device} is not a device but only a core architecture like
18424 @samp{avr51}, this macro is not defined.
18425
18426 @item __AVR_XMEGA__
18427 The device / architecture belongs to the XMEGA family of devices.
18428
18429 @item __AVR_HAVE_ELPM__
18430 The device has the @code{ELPM} instruction.
18431
18432 @item __AVR_HAVE_ELPMX__
18433 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18434 R@var{n},Z+} instructions.
18435
18436 @item __AVR_HAVE_MOVW__
18437 The device has the @code{MOVW} instruction to perform 16-bit
18438 register-register moves.
18439
18440 @item __AVR_HAVE_LPMX__
18441 The device has the @code{LPM R@var{n},Z} and
18442 @code{LPM R@var{n},Z+} instructions.
18443
18444 @item __AVR_HAVE_MUL__
18445 The device has a hardware multiplier.
18446
18447 @item __AVR_HAVE_JMP_CALL__
18448 The device has the @code{JMP} and @code{CALL} instructions.
18449 This is the case for devices with more than 8@tie{}KiB of program
18450 memory.
18451
18452 @item __AVR_HAVE_EIJMP_EICALL__
18453 @itemx __AVR_3_BYTE_PC__
18454 The device has the @code{EIJMP} and @code{EICALL} instructions.
18455 This is the case for devices with more than 128@tie{}KiB of program memory.
18456 This also means that the program counter
18457 (PC) is 3@tie{}bytes wide.
18458
18459 @item __AVR_2_BYTE_PC__
18460 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18461 with up to 128@tie{}KiB of program memory.
18462
18463 @item __AVR_HAVE_8BIT_SP__
18464 @itemx __AVR_HAVE_16BIT_SP__
18465 The stack pointer (SP) register is treated as 8-bit respectively
18466 16-bit register by the compiler.
18467 The definition of these macros is affected by @option{-mtiny-stack}.
18468
18469 @item __AVR_HAVE_SPH__
18470 @itemx __AVR_SP8__
18471 The device has the SPH (high part of stack pointer) special function
18472 register or has an 8-bit stack pointer, respectively.
18473 The definition of these macros is affected by @option{-mmcu=} and
18474 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18475 by @option{-msp8}.
18476
18477 @item __AVR_HAVE_RAMPD__
18478 @itemx __AVR_HAVE_RAMPX__
18479 @itemx __AVR_HAVE_RAMPY__
18480 @itemx __AVR_HAVE_RAMPZ__
18481 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18482 @code{RAMPZ} special function register, respectively.
18483
18484 @item __NO_INTERRUPTS__
18485 This macro reflects the @option{-mno-interrupts} command-line option.
18486
18487 @item __AVR_ERRATA_SKIP__
18488 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18489 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18490 instructions because of a hardware erratum. Skip instructions are
18491 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18492 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18493 set.
18494
18495 @item __AVR_ISA_RMW__
18496 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18497
18498 @item __AVR_SFR_OFFSET__=@var{offset}
18499 Instructions that can address I/O special function registers directly
18500 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18501 address as if addressed by an instruction to access RAM like @code{LD}
18502 or @code{STS}. This offset depends on the device architecture and has
18503 to be subtracted from the RAM address in order to get the
18504 respective I/O@tie{}address.
18505
18506 @item __AVR_SHORT_CALLS__
18507 The @option{-mshort-calls} command line option is set.
18508
18509 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18510 Some devices support reading from flash memory by means of @code{LD*}
18511 instructions. The flash memory is seen in the data address space
18512 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18513 is not defined, this feature is not available. If defined,
18514 the address space is linear and there is no need to put
18515 @code{.rodata} into RAM. This is handled by the default linker
18516 description file, and is currently available for
18517 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18518 there is no need to use address spaces like @code{__flash} or
18519 features like attribute @code{progmem} and @code{pgm_read_*}.
18520
18521 @item __WITH_AVRLIBC__
18522 The compiler is configured to be used together with AVR-Libc.
18523 See the @option{--with-avrlibc} configure option.
18524
18525 @end table
18526
18527 @node Blackfin Options
18528 @subsection Blackfin Options
18529 @cindex Blackfin Options
18530
18531 @table @gcctabopt
18532 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18533 @opindex mcpu=
18534 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18535 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18536 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18537 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18538 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18539 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18540 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18541 @samp{bf561}, @samp{bf592}.
18542
18543 The optional @var{sirevision} specifies the silicon revision of the target
18544 Blackfin processor. Any workarounds available for the targeted silicon revision
18545 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18546 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18547 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18548 hexadecimal digits representing the major and minor numbers in the silicon
18549 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18550 is not defined. If @var{sirevision} is @samp{any}, the
18551 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18552 If this optional @var{sirevision} is not used, GCC assumes the latest known
18553 silicon revision of the targeted Blackfin processor.
18554
18555 GCC defines a preprocessor macro for the specified @var{cpu}.
18556 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18557 provided by libgloss to be linked in if @option{-msim} is not given.
18558
18559 Without this option, @samp{bf532} is used as the processor by default.
18560
18561 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18562 only the preprocessor macro is defined.
18563
18564 @item -msim
18565 @opindex msim
18566 Specifies that the program will be run on the simulator. This causes
18567 the simulator BSP provided by libgloss to be linked in. This option
18568 has effect only for @samp{bfin-elf} toolchain.
18569 Certain other options, such as @option{-mid-shared-library} and
18570 @option{-mfdpic}, imply @option{-msim}.
18571
18572 @item -momit-leaf-frame-pointer
18573 @opindex momit-leaf-frame-pointer
18574 Don't keep the frame pointer in a register for leaf functions. This
18575 avoids the instructions to save, set up and restore frame pointers and
18576 makes an extra register available in leaf functions.
18577
18578 @item -mspecld-anomaly
18579 @opindex mspecld-anomaly
18580 When enabled, the compiler ensures that the generated code does not
18581 contain speculative loads after jump instructions. If this option is used,
18582 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18583
18584 @item -mno-specld-anomaly
18585 @opindex mno-specld-anomaly
18586 @opindex mspecld-anomaly
18587 Don't generate extra code to prevent speculative loads from occurring.
18588
18589 @item -mcsync-anomaly
18590 @opindex mcsync-anomaly
18591 When enabled, the compiler ensures that the generated code does not
18592 contain CSYNC or SSYNC instructions too soon after conditional branches.
18593 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18594
18595 @item -mno-csync-anomaly
18596 @opindex mno-csync-anomaly
18597 @opindex mcsync-anomaly
18598 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18599 occurring too soon after a conditional branch.
18600
18601 @item -mlow64k
18602 @opindex mlow64k
18603 When enabled, the compiler is free to take advantage of the knowledge that
18604 the entire program fits into the low 64k of memory.
18605
18606 @item -mno-low64k
18607 @opindex mno-low64k
18608 Assume that the program is arbitrarily large. This is the default.
18609
18610 @item -mstack-check-l1
18611 @opindex mstack-check-l1
18612 Do stack checking using information placed into L1 scratchpad memory by the
18613 uClinux kernel.
18614
18615 @item -mid-shared-library
18616 @opindex mid-shared-library
18617 Generate code that supports shared libraries via the library ID method.
18618 This allows for execute in place and shared libraries in an environment
18619 without virtual memory management. This option implies @option{-fPIC}.
18620 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18621
18622 @item -mno-id-shared-library
18623 @opindex mno-id-shared-library
18624 @opindex mid-shared-library
18625 Generate code that doesn't assume ID-based shared libraries are being used.
18626 This is the default.
18627
18628 @item -mleaf-id-shared-library
18629 @opindex mleaf-id-shared-library
18630 Generate code that supports shared libraries via the library ID method,
18631 but assumes that this library or executable won't link against any other
18632 ID shared libraries. That allows the compiler to use faster code for jumps
18633 and calls.
18634
18635 @item -mno-leaf-id-shared-library
18636 @opindex mno-leaf-id-shared-library
18637 @opindex mleaf-id-shared-library
18638 Do not assume that the code being compiled won't link against any ID shared
18639 libraries. Slower code is generated for jump and call insns.
18640
18641 @item -mshared-library-id=n
18642 @opindex mshared-library-id
18643 Specifies the identification number of the ID-based shared library being
18644 compiled. Specifying a value of 0 generates more compact code; specifying
18645 other values forces the allocation of that number to the current
18646 library but is no more space- or time-efficient than omitting this option.
18647
18648 @item -msep-data
18649 @opindex msep-data
18650 Generate code that allows the data segment to be located in a different
18651 area of memory from the text segment. This allows for execute in place in
18652 an environment without virtual memory management by eliminating relocations
18653 against the text section.
18654
18655 @item -mno-sep-data
18656 @opindex mno-sep-data
18657 @opindex msep-data
18658 Generate code that assumes that the data segment follows the text segment.
18659 This is the default.
18660
18661 @item -mlong-calls
18662 @itemx -mno-long-calls
18663 @opindex mlong-calls
18664 @opindex mno-long-calls
18665 Tells the compiler to perform function calls by first loading the
18666 address of the function into a register and then performing a subroutine
18667 call on this register. This switch is needed if the target function
18668 lies outside of the 24-bit addressing range of the offset-based
18669 version of subroutine call instruction.
18670
18671 This feature is not enabled by default. Specifying
18672 @option{-mno-long-calls} restores the default behavior. Note these
18673 switches have no effect on how the compiler generates code to handle
18674 function calls via function pointers.
18675
18676 @item -mfast-fp
18677 @opindex mfast-fp
18678 Link with the fast floating-point library. This library relaxes some of
18679 the IEEE floating-point standard's rules for checking inputs against
18680 Not-a-Number (NAN), in the interest of performance.
18681
18682 @item -minline-plt
18683 @opindex minline-plt
18684 Enable inlining of PLT entries in function calls to functions that are
18685 not known to bind locally. It has no effect without @option{-mfdpic}.
18686
18687 @item -mmulticore
18688 @opindex mmulticore
18689 Build a standalone application for multicore Blackfin processors.
18690 This option causes proper start files and link scripts supporting
18691 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18692 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18693
18694 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18695 selects the one-application-per-core programming model. Without
18696 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18697 programming model is used. In this model, the main function of Core B
18698 should be named as @code{coreb_main}.
18699
18700 If this option is not used, the single-core application programming
18701 model is used.
18702
18703 @item -mcorea
18704 @opindex mcorea
18705 Build a standalone application for Core A of BF561 when using
18706 the one-application-per-core programming model. Proper start files
18707 and link scripts are used to support Core A, and the macro
18708 @code{__BFIN_COREA} is defined.
18709 This option can only be used in conjunction with @option{-mmulticore}.
18710
18711 @item -mcoreb
18712 @opindex mcoreb
18713 Build a standalone application for Core B of BF561 when using
18714 the one-application-per-core programming model. Proper start files
18715 and link scripts are used to support Core B, and the macro
18716 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18717 should be used instead of @code{main}.
18718 This option can only be used in conjunction with @option{-mmulticore}.
18719
18720 @item -msdram
18721 @opindex msdram
18722 Build a standalone application for SDRAM. Proper start files and
18723 link scripts are used to put the application into SDRAM, and the macro
18724 @code{__BFIN_SDRAM} is defined.
18725 The loader should initialize SDRAM before loading the application.
18726
18727 @item -micplb
18728 @opindex micplb
18729 Assume that ICPLBs are enabled at run time. This has an effect on certain
18730 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18731 are enabled; for standalone applications the default is off.
18732 @end table
18733
18734 @node C6X Options
18735 @subsection C6X Options
18736 @cindex C6X Options
18737
18738 @table @gcctabopt
18739 @item -march=@var{name}
18740 @opindex march
18741 This specifies the name of the target architecture. GCC uses this
18742 name to determine what kind of instructions it can emit when generating
18743 assembly code. Permissible names are: @samp{c62x},
18744 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18745
18746 @item -mbig-endian
18747 @opindex mbig-endian
18748 Generate code for a big-endian target.
18749
18750 @item -mlittle-endian
18751 @opindex mlittle-endian
18752 Generate code for a little-endian target. This is the default.
18753
18754 @item -msim
18755 @opindex msim
18756 Choose startup files and linker script suitable for the simulator.
18757
18758 @item -msdata=default
18759 @opindex msdata=default
18760 Put small global and static data in the @code{.neardata} section,
18761 which is pointed to by register @code{B14}. Put small uninitialized
18762 global and static data in the @code{.bss} section, which is adjacent
18763 to the @code{.neardata} section. Put small read-only data into the
18764 @code{.rodata} section. The corresponding sections used for large
18765 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18766
18767 @item -msdata=all
18768 @opindex msdata=all
18769 Put all data, not just small objects, into the sections reserved for
18770 small data, and use addressing relative to the @code{B14} register to
18771 access them.
18772
18773 @item -msdata=none
18774 @opindex msdata=none
18775 Make no use of the sections reserved for small data, and use absolute
18776 addresses to access all data. Put all initialized global and static
18777 data in the @code{.fardata} section, and all uninitialized data in the
18778 @code{.far} section. Put all constant data into the @code{.const}
18779 section.
18780 @end table
18781
18782 @node CRIS Options
18783 @subsection CRIS Options
18784 @cindex CRIS Options
18785
18786 These options are defined specifically for the CRIS ports.
18787
18788 @table @gcctabopt
18789 @item -march=@var{architecture-type}
18790 @itemx -mcpu=@var{architecture-type}
18791 @opindex march
18792 @opindex mcpu
18793 Generate code for the specified architecture. The choices for
18794 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18795 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18796 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18797 @samp{v10}.
18798
18799 @item -mtune=@var{architecture-type}
18800 @opindex mtune
18801 Tune to @var{architecture-type} everything applicable about the generated
18802 code, except for the ABI and the set of available instructions. The
18803 choices for @var{architecture-type} are the same as for
18804 @option{-march=@var{architecture-type}}.
18805
18806 @item -mmax-stack-frame=@var{n}
18807 @opindex mmax-stack-frame
18808 Warn when the stack frame of a function exceeds @var{n} bytes.
18809
18810 @item -metrax4
18811 @itemx -metrax100
18812 @opindex metrax4
18813 @opindex metrax100
18814 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18815 @option{-march=v3} and @option{-march=v8} respectively.
18816
18817 @item -mmul-bug-workaround
18818 @itemx -mno-mul-bug-workaround
18819 @opindex mmul-bug-workaround
18820 @opindex mno-mul-bug-workaround
18821 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18822 models where it applies. This option is active by default.
18823
18824 @item -mpdebug
18825 @opindex mpdebug
18826 Enable CRIS-specific verbose debug-related information in the assembly
18827 code. This option also has the effect of turning off the @samp{#NO_APP}
18828 formatted-code indicator to the assembler at the beginning of the
18829 assembly file.
18830
18831 @item -mcc-init
18832 @opindex mcc-init
18833 Do not use condition-code results from previous instruction; always emit
18834 compare and test instructions before use of condition codes.
18835
18836 @item -mno-side-effects
18837 @opindex mno-side-effects
18838 @opindex mside-effects
18839 Do not emit instructions with side effects in addressing modes other than
18840 post-increment.
18841
18842 @item -mstack-align
18843 @itemx -mno-stack-align
18844 @itemx -mdata-align
18845 @itemx -mno-data-align
18846 @itemx -mconst-align
18847 @itemx -mno-const-align
18848 @opindex mstack-align
18849 @opindex mno-stack-align
18850 @opindex mdata-align
18851 @opindex mno-data-align
18852 @opindex mconst-align
18853 @opindex mno-const-align
18854 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18855 stack frame, individual data and constants to be aligned for the maximum
18856 single data access size for the chosen CPU model. The default is to
18857 arrange for 32-bit alignment. ABI details such as structure layout are
18858 not affected by these options.
18859
18860 @item -m32-bit
18861 @itemx -m16-bit
18862 @itemx -m8-bit
18863 @opindex m32-bit
18864 @opindex m16-bit
18865 @opindex m8-bit
18866 Similar to the stack- data- and const-align options above, these options
18867 arrange for stack frame, writable data and constants to all be 32-bit,
18868 16-bit or 8-bit aligned. The default is 32-bit alignment.
18869
18870 @item -mno-prologue-epilogue
18871 @itemx -mprologue-epilogue
18872 @opindex mno-prologue-epilogue
18873 @opindex mprologue-epilogue
18874 With @option{-mno-prologue-epilogue}, the normal function prologue and
18875 epilogue which set up the stack frame are omitted and no return
18876 instructions or return sequences are generated in the code. Use this
18877 option only together with visual inspection of the compiled code: no
18878 warnings or errors are generated when call-saved registers must be saved,
18879 or storage for local variables needs to be allocated.
18880
18881 @item -mno-gotplt
18882 @itemx -mgotplt
18883 @opindex mno-gotplt
18884 @opindex mgotplt
18885 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18886 instruction sequences that load addresses for functions from the PLT part
18887 of the GOT rather than (traditional on other architectures) calls to the
18888 PLT@. The default is @option{-mgotplt}.
18889
18890 @item -melf
18891 @opindex melf
18892 Legacy no-op option only recognized with the cris-axis-elf and
18893 cris-axis-linux-gnu targets.
18894
18895 @item -mlinux
18896 @opindex mlinux
18897 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18898
18899 @item -sim
18900 @opindex sim
18901 This option, recognized for the cris-axis-elf, arranges
18902 to link with input-output functions from a simulator library. Code,
18903 initialized data and zero-initialized data are allocated consecutively.
18904
18905 @item -sim2
18906 @opindex sim2
18907 Like @option{-sim}, but pass linker options to locate initialized data at
18908 0x40000000 and zero-initialized data at 0x80000000.
18909 @end table
18910
18911 @node CR16 Options
18912 @subsection CR16 Options
18913 @cindex CR16 Options
18914
18915 These options are defined specifically for the CR16 ports.
18916
18917 @table @gcctabopt
18918
18919 @item -mmac
18920 @opindex mmac
18921 Enable the use of multiply-accumulate instructions. Disabled by default.
18922
18923 @item -mcr16cplus
18924 @itemx -mcr16c
18925 @opindex mcr16cplus
18926 @opindex mcr16c
18927 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18928 is default.
18929
18930 @item -msim
18931 @opindex msim
18932 Links the library libsim.a which is in compatible with simulator. Applicable
18933 to ELF compiler only.
18934
18935 @item -mint32
18936 @opindex mint32
18937 Choose integer type as 32-bit wide.
18938
18939 @item -mbit-ops
18940 @opindex mbit-ops
18941 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18942
18943 @item -mdata-model=@var{model}
18944 @opindex mdata-model
18945 Choose a data model. The choices for @var{model} are @samp{near},
18946 @samp{far} or @samp{medium}. @samp{medium} is default.
18947 However, @samp{far} is not valid with @option{-mcr16c}, as the
18948 CR16C architecture does not support the far data model.
18949 @end table
18950
18951 @node C-SKY Options
18952 @subsection C-SKY Options
18953 @cindex C-SKY Options
18954
18955 GCC supports these options when compiling for C-SKY V2 processors.
18956
18957 @table @gcctabopt
18958
18959 @item -march=@var{arch}
18960 @opindex march=
18961 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18962 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18963 The default is @samp{ck810}.
18964
18965 @item -mcpu=@var{cpu}
18966 @opindex mcpu=
18967 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18968 @samp{ck801}, @samp{ck801t},
18969 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18970 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18971 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18972 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18973 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18974 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18975 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18976 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18977 @samp{ck803eftr1}, @samp{ck803efhtr1},
18978 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18979 @samp{ck803sef}, @samp{ck803seft},
18980 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18981 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18982 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18983 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18984
18985 @item -mbig-endian
18986 @opindex mbig-endian
18987 @itemx -EB
18988 @opindex EB
18989 @itemx -mlittle-endian
18990 @opindex mlittle-endian
18991 @itemx -EL
18992 @opindex EL
18993
18994 Select big- or little-endian code. The default is little-endian.
18995
18996 @item -mhard-float
18997 @opindex mhard-float
18998 @itemx -msoft-float
18999 @opindex msoft-float
19000
19001 Select hardware or software floating-point implementations.
19002 The default is soft float.
19003
19004 @item -mdouble-float
19005 @itemx -mno-double-float
19006 @opindex mdouble-float
19007 When @option{-mhard-float} is in effect, enable generation of
19008 double-precision float instructions. This is the default except
19009 when compiling for CK803.
19010
19011 @item -mfdivdu
19012 @itemx -mno-fdivdu
19013 @opindex mfdivdu
19014 When @option{-mhard-float} is in effect, enable generation of
19015 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19016 This is the default except when compiling for CK803.
19017
19018 @item -mfpu=@var{fpu}
19019 @opindex mfpu=
19020 Select the floating-point processor. This option can only be used with
19021 @option{-mhard-float}.
19022 Values for @var{fpu} are
19023 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19024 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19025 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19026
19027 @item -melrw
19028 @itemx -mno-elrw
19029 @opindex melrw
19030 Enable the extended @code{lrw} instruction. This option defaults to on
19031 for CK801 and off otherwise.
19032
19033 @item -mistack
19034 @itemx -mno-istack
19035 @opindex mistack
19036 Enable interrupt stack instructions; the default is off.
19037
19038 The @option{-mistack} option is required to handle the
19039 @code{interrupt} and @code{isr} function attributes
19040 (@pxref{C-SKY Function Attributes}).
19041
19042 @item -mmp
19043 @opindex mmp
19044 Enable multiprocessor instructions; the default is off.
19045
19046 @item -mcp
19047 @opindex mcp
19048 Enable coprocessor instructions; the default is off.
19049
19050 @item -mcache
19051 @opindex mcache
19052 Enable coprocessor instructions; the default is off.
19053
19054 @item -msecurity
19055 @opindex msecurity
19056 Enable C-SKY security instructions; the default is off.
19057
19058 @item -mtrust
19059 @opindex mtrust
19060 Enable C-SKY trust instructions; the default is off.
19061
19062 @item -mdsp
19063 @opindex mdsp
19064 @itemx -medsp
19065 @opindex medsp
19066 @itemx -mvdsp
19067 @opindex mvdsp
19068 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19069 All of these options default to off.
19070
19071 @item -mdiv
19072 @itemx -mno-div
19073 @opindex mdiv
19074 Generate divide instructions. Default is off.
19075
19076 @item -msmart
19077 @itemx -mno-smart
19078 @opindex msmart
19079 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19080 use of 16-bit instructions. This option is ignored for CK801 where this
19081 is the required behavior, and it defaults to on for CK802.
19082 For other targets, the default is off.
19083
19084 @item -mhigh-registers
19085 @itemx -mno-high-registers
19086 @opindex mhigh-registers
19087 Generate code using the high registers numbered 16-31. This option
19088 is not supported on CK801, CK802, or CK803, and is enabled by default
19089 for other processors.
19090
19091 @item -manchor
19092 @itemx -mno-anchor
19093 @opindex manchor
19094 Generate code using global anchor symbol addresses.
19095
19096 @item -mpushpop
19097 @itemx -mno-pushpop
19098 @opindex mpushpop
19099 Generate code using @code{push} and @code{pop} instructions. This option
19100 defaults to on.
19101
19102 @item -mmultiple-stld
19103 @itemx -mstm
19104 @itemx -mno-multiple-stld
19105 @itemx -mno-stm
19106 @opindex mmultiple-stld
19107 Generate code using @code{stm} and @code{ldm} instructions. This option
19108 isn't supported on CK801 but is enabled by default on other processors.
19109
19110 @item -mconstpool
19111 @itemx -mno-constpool
19112 @opindex mconstpool
19113 Create constant pools in the compiler instead of deferring it to the
19114 assembler. This option is the default and required for correct code
19115 generation on CK801 and CK802, and is optional on other processors.
19116
19117 @item -mstack-size
19118 @item -mno-stack-size
19119 @opindex mstack-size
19120 Emit @code{.stack_size} directives for each function in the assembly
19121 output. This option defaults to off.
19122
19123 @item -mccrt
19124 @itemx -mno-ccrt
19125 @opindex mccrt
19126 Generate code for the C-SKY compiler runtime instead of libgcc. This
19127 option defaults to off.
19128
19129 @item -mbranch-cost=@var{n}
19130 @opindex mbranch-cost=
19131 Set the branch costs to roughly @code{n} instructions. The default is 1.
19132
19133 @item -msched-prolog
19134 @itemx -mno-sched-prolog
19135 @opindex msched-prolog
19136 Permit scheduling of function prologue and epilogue sequences. Using
19137 this option can result in code that is not compliant with the C-SKY V2 ABI
19138 prologue requirements and that cannot be debugged or backtraced.
19139 It is disabled by default.
19140
19141 @end table
19142
19143 @node Darwin Options
19144 @subsection Darwin Options
19145 @cindex Darwin options
19146
19147 These options are defined for all architectures running the Darwin operating
19148 system.
19149
19150 FSF GCC on Darwin does not create ``fat'' object files; it creates
19151 an object file for the single architecture that GCC was built to
19152 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19153 @option{-arch} options are used; it does so by running the compiler or
19154 linker multiple times and joining the results together with
19155 @file{lipo}.
19156
19157 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19158 @samp{i686}) is determined by the flags that specify the ISA
19159 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19160 @option{-force_cpusubtype_ALL} option can be used to override this.
19161
19162 The Darwin tools vary in their behavior when presented with an ISA
19163 mismatch. The assembler, @file{as}, only permits instructions to
19164 be used that are valid for the subtype of the file it is generating,
19165 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19166 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19167 and prints an error if asked to create a shared library with a less
19168 restrictive subtype than its input files (for instance, trying to put
19169 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19170 for executables, @command{ld}, quietly gives the executable the most
19171 restrictive subtype of any of its input files.
19172
19173 @table @gcctabopt
19174 @item -F@var{dir}
19175 @opindex F
19176 Add the framework directory @var{dir} to the head of the list of
19177 directories to be searched for header files. These directories are
19178 interleaved with those specified by @option{-I} options and are
19179 scanned in a left-to-right order.
19180
19181 A framework directory is a directory with frameworks in it. A
19182 framework is a directory with a @file{Headers} and/or
19183 @file{PrivateHeaders} directory contained directly in it that ends
19184 in @file{.framework}. The name of a framework is the name of this
19185 directory excluding the @file{.framework}. Headers associated with
19186 the framework are found in one of those two directories, with
19187 @file{Headers} being searched first. A subframework is a framework
19188 directory that is in a framework's @file{Frameworks} directory.
19189 Includes of subframework headers can only appear in a header of a
19190 framework that contains the subframework, or in a sibling subframework
19191 header. Two subframeworks are siblings if they occur in the same
19192 framework. A subframework should not have the same name as a
19193 framework; a warning is issued if this is violated. Currently a
19194 subframework cannot have subframeworks; in the future, the mechanism
19195 may be extended to support this. The standard frameworks can be found
19196 in @file{/System/Library/Frameworks} and
19197 @file{/Library/Frameworks}. An example include looks like
19198 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19199 the name of the framework and @file{header.h} is found in the
19200 @file{PrivateHeaders} or @file{Headers} directory.
19201
19202 @item -iframework@var{dir}
19203 @opindex iframework
19204 Like @option{-F} except the directory is a treated as a system
19205 directory. The main difference between this @option{-iframework} and
19206 @option{-F} is that with @option{-iframework} the compiler does not
19207 warn about constructs contained within header files found via
19208 @var{dir}. This option is valid only for the C family of languages.
19209
19210 @item -gused
19211 @opindex gused
19212 Emit debugging information for symbols that are used. For stabs
19213 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19214 This is by default ON@.
19215
19216 @item -gfull
19217 @opindex gfull
19218 Emit debugging information for all symbols and types.
19219
19220 @item -mmacosx-version-min=@var{version}
19221 The earliest version of MacOS X that this executable will run on
19222 is @var{version}. Typical values of @var{version} include @code{10.1},
19223 @code{10.2}, and @code{10.3.9}.
19224
19225 If the compiler was built to use the system's headers by default,
19226 then the default for this option is the system version on which the
19227 compiler is running, otherwise the default is to make choices that
19228 are compatible with as many systems and code bases as possible.
19229
19230 @item -mkernel
19231 @opindex mkernel
19232 Enable kernel development mode. The @option{-mkernel} option sets
19233 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19234 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19235 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19236 applicable. This mode also sets @option{-mno-altivec},
19237 @option{-msoft-float}, @option{-fno-builtin} and
19238 @option{-mlong-branch} for PowerPC targets.
19239
19240 @item -mone-byte-bool
19241 @opindex mone-byte-bool
19242 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19243 By default @code{sizeof(bool)} is @code{4} when compiling for
19244 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19245 option has no effect on x86.
19246
19247 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19248 to generate code that is not binary compatible with code generated
19249 without that switch. Using this switch may require recompiling all
19250 other modules in a program, including system libraries. Use this
19251 switch to conform to a non-default data model.
19252
19253 @item -mfix-and-continue
19254 @itemx -ffix-and-continue
19255 @itemx -findirect-data
19256 @opindex mfix-and-continue
19257 @opindex ffix-and-continue
19258 @opindex findirect-data
19259 Generate code suitable for fast turnaround development, such as to
19260 allow GDB to dynamically load @file{.o} files into already-running
19261 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19262 are provided for backwards compatibility.
19263
19264 @item -all_load
19265 @opindex all_load
19266 Loads all members of static archive libraries.
19267 See man ld(1) for more information.
19268
19269 @item -arch_errors_fatal
19270 @opindex arch_errors_fatal
19271 Cause the errors having to do with files that have the wrong architecture
19272 to be fatal.
19273
19274 @item -bind_at_load
19275 @opindex bind_at_load
19276 Causes the output file to be marked such that the dynamic linker will
19277 bind all undefined references when the file is loaded or launched.
19278
19279 @item -bundle
19280 @opindex bundle
19281 Produce a Mach-o bundle format file.
19282 See man ld(1) for more information.
19283
19284 @item -bundle_loader @var{executable}
19285 @opindex bundle_loader
19286 This option specifies the @var{executable} that will load the build
19287 output file being linked. See man ld(1) for more information.
19288
19289 @item -dynamiclib
19290 @opindex dynamiclib
19291 When passed this option, GCC produces a dynamic library instead of
19292 an executable when linking, using the Darwin @file{libtool} command.
19293
19294 @item -force_cpusubtype_ALL
19295 @opindex force_cpusubtype_ALL
19296 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19297 one controlled by the @option{-mcpu} or @option{-march} option.
19298
19299 @item -allowable_client @var{client_name}
19300 @itemx -client_name
19301 @itemx -compatibility_version
19302 @itemx -current_version
19303 @itemx -dead_strip
19304 @itemx -dependency-file
19305 @itemx -dylib_file
19306 @itemx -dylinker_install_name
19307 @itemx -dynamic
19308 @itemx -exported_symbols_list
19309 @itemx -filelist
19310 @need 800
19311 @itemx -flat_namespace
19312 @itemx -force_flat_namespace
19313 @itemx -headerpad_max_install_names
19314 @itemx -image_base
19315 @itemx -init
19316 @itemx -install_name
19317 @itemx -keep_private_externs
19318 @itemx -multi_module
19319 @itemx -multiply_defined
19320 @itemx -multiply_defined_unused
19321 @need 800
19322 @itemx -noall_load
19323 @itemx -no_dead_strip_inits_and_terms
19324 @itemx -nofixprebinding
19325 @itemx -nomultidefs
19326 @itemx -noprebind
19327 @itemx -noseglinkedit
19328 @itemx -pagezero_size
19329 @itemx -prebind
19330 @itemx -prebind_all_twolevel_modules
19331 @itemx -private_bundle
19332 @need 800
19333 @itemx -read_only_relocs
19334 @itemx -sectalign
19335 @itemx -sectobjectsymbols
19336 @itemx -whyload
19337 @itemx -seg1addr
19338 @itemx -sectcreate
19339 @itemx -sectobjectsymbols
19340 @itemx -sectorder
19341 @itemx -segaddr
19342 @itemx -segs_read_only_addr
19343 @need 800
19344 @itemx -segs_read_write_addr
19345 @itemx -seg_addr_table
19346 @itemx -seg_addr_table_filename
19347 @itemx -seglinkedit
19348 @itemx -segprot
19349 @itemx -segs_read_only_addr
19350 @itemx -segs_read_write_addr
19351 @itemx -single_module
19352 @itemx -static
19353 @itemx -sub_library
19354 @need 800
19355 @itemx -sub_umbrella
19356 @itemx -twolevel_namespace
19357 @itemx -umbrella
19358 @itemx -undefined
19359 @itemx -unexported_symbols_list
19360 @itemx -weak_reference_mismatches
19361 @itemx -whatsloaded
19362 @opindex allowable_client
19363 @opindex client_name
19364 @opindex compatibility_version
19365 @opindex current_version
19366 @opindex dead_strip
19367 @opindex dependency-file
19368 @opindex dylib_file
19369 @opindex dylinker_install_name
19370 @opindex dynamic
19371 @opindex exported_symbols_list
19372 @opindex filelist
19373 @opindex flat_namespace
19374 @opindex force_flat_namespace
19375 @opindex headerpad_max_install_names
19376 @opindex image_base
19377 @opindex init
19378 @opindex install_name
19379 @opindex keep_private_externs
19380 @opindex multi_module
19381 @opindex multiply_defined
19382 @opindex multiply_defined_unused
19383 @opindex noall_load
19384 @opindex no_dead_strip_inits_and_terms
19385 @opindex nofixprebinding
19386 @opindex nomultidefs
19387 @opindex noprebind
19388 @opindex noseglinkedit
19389 @opindex pagezero_size
19390 @opindex prebind
19391 @opindex prebind_all_twolevel_modules
19392 @opindex private_bundle
19393 @opindex read_only_relocs
19394 @opindex sectalign
19395 @opindex sectobjectsymbols
19396 @opindex whyload
19397 @opindex seg1addr
19398 @opindex sectcreate
19399 @opindex sectobjectsymbols
19400 @opindex sectorder
19401 @opindex segaddr
19402 @opindex segs_read_only_addr
19403 @opindex segs_read_write_addr
19404 @opindex seg_addr_table
19405 @opindex seg_addr_table_filename
19406 @opindex seglinkedit
19407 @opindex segprot
19408 @opindex segs_read_only_addr
19409 @opindex segs_read_write_addr
19410 @opindex single_module
19411 @opindex static
19412 @opindex sub_library
19413 @opindex sub_umbrella
19414 @opindex twolevel_namespace
19415 @opindex umbrella
19416 @opindex undefined
19417 @opindex unexported_symbols_list
19418 @opindex weak_reference_mismatches
19419 @opindex whatsloaded
19420 These options are passed to the Darwin linker. The Darwin linker man page
19421 describes them in detail.
19422 @end table
19423
19424 @node DEC Alpha Options
19425 @subsection DEC Alpha Options
19426
19427 These @samp{-m} options are defined for the DEC Alpha implementations:
19428
19429 @table @gcctabopt
19430 @item -mno-soft-float
19431 @itemx -msoft-float
19432 @opindex mno-soft-float
19433 @opindex msoft-float
19434 Use (do not use) the hardware floating-point instructions for
19435 floating-point operations. When @option{-msoft-float} is specified,
19436 functions in @file{libgcc.a} are used to perform floating-point
19437 operations. Unless they are replaced by routines that emulate the
19438 floating-point operations, or compiled in such a way as to call such
19439 emulations routines, these routines issue floating-point
19440 operations. If you are compiling for an Alpha without floating-point
19441 operations, you must ensure that the library is built so as not to call
19442 them.
19443
19444 Note that Alpha implementations without floating-point operations are
19445 required to have floating-point registers.
19446
19447 @item -mfp-reg
19448 @itemx -mno-fp-regs
19449 @opindex mfp-reg
19450 @opindex mno-fp-regs
19451 Generate code that uses (does not use) the floating-point register set.
19452 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19453 register set is not used, floating-point operands are passed in integer
19454 registers as if they were integers and floating-point results are passed
19455 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19456 so any function with a floating-point argument or return value called by code
19457 compiled with @option{-mno-fp-regs} must also be compiled with that
19458 option.
19459
19460 A typical use of this option is building a kernel that does not use,
19461 and hence need not save and restore, any floating-point registers.
19462
19463 @item -mieee
19464 @opindex mieee
19465 The Alpha architecture implements floating-point hardware optimized for
19466 maximum performance. It is mostly compliant with the IEEE floating-point
19467 standard. However, for full compliance, software assistance is
19468 required. This option generates code fully IEEE-compliant code
19469 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19470 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19471 defined during compilation. The resulting code is less efficient but is
19472 able to correctly support denormalized numbers and exceptional IEEE
19473 values such as not-a-number and plus/minus infinity. Other Alpha
19474 compilers call this option @option{-ieee_with_no_inexact}.
19475
19476 @item -mieee-with-inexact
19477 @opindex mieee-with-inexact
19478 This is like @option{-mieee} except the generated code also maintains
19479 the IEEE @var{inexact-flag}. Turning on this option causes the
19480 generated code to implement fully-compliant IEEE math. In addition to
19481 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19482 macro. On some Alpha implementations the resulting code may execute
19483 significantly slower than the code generated by default. Since there is
19484 very little code that depends on the @var{inexact-flag}, you should
19485 normally not specify this option. Other Alpha compilers call this
19486 option @option{-ieee_with_inexact}.
19487
19488 @item -mfp-trap-mode=@var{trap-mode}
19489 @opindex mfp-trap-mode
19490 This option controls what floating-point related traps are enabled.
19491 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19492 The trap mode can be set to one of four values:
19493
19494 @table @samp
19495 @item n
19496 This is the default (normal) setting. The only traps that are enabled
19497 are the ones that cannot be disabled in software (e.g., division by zero
19498 trap).
19499
19500 @item u
19501 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19502 as well.
19503
19504 @item su
19505 Like @samp{u}, but the instructions are marked to be safe for software
19506 completion (see Alpha architecture manual for details).
19507
19508 @item sui
19509 Like @samp{su}, but inexact traps are enabled as well.
19510 @end table
19511
19512 @item -mfp-rounding-mode=@var{rounding-mode}
19513 @opindex mfp-rounding-mode
19514 Selects the IEEE rounding mode. Other Alpha compilers call this option
19515 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19516 of:
19517
19518 @table @samp
19519 @item n
19520 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19521 the nearest machine number or towards the even machine number in case
19522 of a tie.
19523
19524 @item m
19525 Round towards minus infinity.
19526
19527 @item c
19528 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19529
19530 @item d
19531 Dynamic rounding mode. A field in the floating-point control register
19532 (@var{fpcr}, see Alpha architecture reference manual) controls the
19533 rounding mode in effect. The C library initializes this register for
19534 rounding towards plus infinity. Thus, unless your program modifies the
19535 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19536 @end table
19537
19538 @item -mtrap-precision=@var{trap-precision}
19539 @opindex mtrap-precision
19540 In the Alpha architecture, floating-point traps are imprecise. This
19541 means without software assistance it is impossible to recover from a
19542 floating trap and program execution normally needs to be terminated.
19543 GCC can generate code that can assist operating system trap handlers
19544 in determining the exact location that caused a floating-point trap.
19545 Depending on the requirements of an application, different levels of
19546 precisions can be selected:
19547
19548 @table @samp
19549 @item p
19550 Program precision. This option is the default and means a trap handler
19551 can only identify which program caused a floating-point exception.
19552
19553 @item f
19554 Function precision. The trap handler can determine the function that
19555 caused a floating-point exception.
19556
19557 @item i
19558 Instruction precision. The trap handler can determine the exact
19559 instruction that caused a floating-point exception.
19560 @end table
19561
19562 Other Alpha compilers provide the equivalent options called
19563 @option{-scope_safe} and @option{-resumption_safe}.
19564
19565 @item -mieee-conformant
19566 @opindex mieee-conformant
19567 This option marks the generated code as IEEE conformant. You must not
19568 use this option unless you also specify @option{-mtrap-precision=i} and either
19569 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19570 is to emit the line @samp{.eflag 48} in the function prologue of the
19571 generated assembly file.
19572
19573 @item -mbuild-constants
19574 @opindex mbuild-constants
19575 Normally GCC examines a 32- or 64-bit integer constant to
19576 see if it can construct it from smaller constants in two or three
19577 instructions. If it cannot, it outputs the constant as a literal and
19578 generates code to load it from the data segment at run time.
19579
19580 Use this option to require GCC to construct @emph{all} integer constants
19581 using code, even if it takes more instructions (the maximum is six).
19582
19583 You typically use this option to build a shared library dynamic
19584 loader. Itself a shared library, it must relocate itself in memory
19585 before it can find the variables and constants in its own data segment.
19586
19587 @item -mbwx
19588 @itemx -mno-bwx
19589 @itemx -mcix
19590 @itemx -mno-cix
19591 @itemx -mfix
19592 @itemx -mno-fix
19593 @itemx -mmax
19594 @itemx -mno-max
19595 @opindex mbwx
19596 @opindex mno-bwx
19597 @opindex mcix
19598 @opindex mno-cix
19599 @opindex mfix
19600 @opindex mno-fix
19601 @opindex mmax
19602 @opindex mno-max
19603 Indicate whether GCC should generate code to use the optional BWX,
19604 CIX, FIX and MAX instruction sets. The default is to use the instruction
19605 sets supported by the CPU type specified via @option{-mcpu=} option or that
19606 of the CPU on which GCC was built if none is specified.
19607
19608 @item -mfloat-vax
19609 @itemx -mfloat-ieee
19610 @opindex mfloat-vax
19611 @opindex mfloat-ieee
19612 Generate code that uses (does not use) VAX F and G floating-point
19613 arithmetic instead of IEEE single and double precision.
19614
19615 @item -mexplicit-relocs
19616 @itemx -mno-explicit-relocs
19617 @opindex mexplicit-relocs
19618 @opindex mno-explicit-relocs
19619 Older Alpha assemblers provided no way to generate symbol relocations
19620 except via assembler macros. Use of these macros does not allow
19621 optimal instruction scheduling. GNU binutils as of version 2.12
19622 supports a new syntax that allows the compiler to explicitly mark
19623 which relocations should apply to which instructions. This option
19624 is mostly useful for debugging, as GCC detects the capabilities of
19625 the assembler when it is built and sets the default accordingly.
19626
19627 @item -msmall-data
19628 @itemx -mlarge-data
19629 @opindex msmall-data
19630 @opindex mlarge-data
19631 When @option{-mexplicit-relocs} is in effect, static data is
19632 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19633 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19634 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19635 16-bit relocations off of the @code{$gp} register. This limits the
19636 size of the small data area to 64KB, but allows the variables to be
19637 directly accessed via a single instruction.
19638
19639 The default is @option{-mlarge-data}. With this option the data area
19640 is limited to just below 2GB@. Programs that require more than 2GB of
19641 data must use @code{malloc} or @code{mmap} to allocate the data in the
19642 heap instead of in the program's data segment.
19643
19644 When generating code for shared libraries, @option{-fpic} implies
19645 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19646
19647 @item -msmall-text
19648 @itemx -mlarge-text
19649 @opindex msmall-text
19650 @opindex mlarge-text
19651 When @option{-msmall-text} is used, the compiler assumes that the
19652 code of the entire program (or shared library) fits in 4MB, and is
19653 thus reachable with a branch instruction. When @option{-msmall-data}
19654 is used, the compiler can assume that all local symbols share the
19655 same @code{$gp} value, and thus reduce the number of instructions
19656 required for a function call from 4 to 1.
19657
19658 The default is @option{-mlarge-text}.
19659
19660 @item -mcpu=@var{cpu_type}
19661 @opindex mcpu
19662 Set the instruction set and instruction scheduling parameters for
19663 machine type @var{cpu_type}. You can specify either the @samp{EV}
19664 style name or the corresponding chip number. GCC supports scheduling
19665 parameters for the EV4, EV5 and EV6 family of processors and
19666 chooses the default values for the instruction set from the processor
19667 you specify. If you do not specify a processor type, GCC defaults
19668 to the processor on which the compiler was built.
19669
19670 Supported values for @var{cpu_type} are
19671
19672 @table @samp
19673 @item ev4
19674 @itemx ev45
19675 @itemx 21064
19676 Schedules as an EV4 and has no instruction set extensions.
19677
19678 @item ev5
19679 @itemx 21164
19680 Schedules as an EV5 and has no instruction set extensions.
19681
19682 @item ev56
19683 @itemx 21164a
19684 Schedules as an EV5 and supports the BWX extension.
19685
19686 @item pca56
19687 @itemx 21164pc
19688 @itemx 21164PC
19689 Schedules as an EV5 and supports the BWX and MAX extensions.
19690
19691 @item ev6
19692 @itemx 21264
19693 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19694
19695 @item ev67
19696 @itemx 21264a
19697 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19698 @end table
19699
19700 Native toolchains also support the value @samp{native},
19701 which selects the best architecture option for the host processor.
19702 @option{-mcpu=native} has no effect if GCC does not recognize
19703 the processor.
19704
19705 @item -mtune=@var{cpu_type}
19706 @opindex mtune
19707 Set only the instruction scheduling parameters for machine type
19708 @var{cpu_type}. The instruction set is not changed.
19709
19710 Native toolchains also support the value @samp{native},
19711 which selects the best architecture option for the host processor.
19712 @option{-mtune=native} has no effect if GCC does not recognize
19713 the processor.
19714
19715 @item -mmemory-latency=@var{time}
19716 @opindex mmemory-latency
19717 Sets the latency the scheduler should assume for typical memory
19718 references as seen by the application. This number is highly
19719 dependent on the memory access patterns used by the application
19720 and the size of the external cache on the machine.
19721
19722 Valid options for @var{time} are
19723
19724 @table @samp
19725 @item @var{number}
19726 A decimal number representing clock cycles.
19727
19728 @item L1
19729 @itemx L2
19730 @itemx L3
19731 @itemx main
19732 The compiler contains estimates of the number of clock cycles for
19733 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19734 (also called Dcache, Scache, and Bcache), as well as to main memory.
19735 Note that L3 is only valid for EV5.
19736
19737 @end table
19738 @end table
19739
19740 @node FR30 Options
19741 @subsection FR30 Options
19742 @cindex FR30 Options
19743
19744 These options are defined specifically for the FR30 port.
19745
19746 @table @gcctabopt
19747
19748 @item -msmall-model
19749 @opindex msmall-model
19750 Use the small address space model. This can produce smaller code, but
19751 it does assume that all symbolic values and addresses fit into a
19752 20-bit range.
19753
19754 @item -mno-lsim
19755 @opindex mno-lsim
19756 Assume that runtime support has been provided and so there is no need
19757 to include the simulator library (@file{libsim.a}) on the linker
19758 command line.
19759
19760 @end table
19761
19762 @node FT32 Options
19763 @subsection FT32 Options
19764 @cindex FT32 Options
19765
19766 These options are defined specifically for the FT32 port.
19767
19768 @table @gcctabopt
19769
19770 @item -msim
19771 @opindex msim
19772 Specifies that the program will be run on the simulator. This causes
19773 an alternate runtime startup and library to be linked.
19774 You must not use this option when generating programs that will run on
19775 real hardware; you must provide your own runtime library for whatever
19776 I/O functions are needed.
19777
19778 @item -mlra
19779 @opindex mlra
19780 Enable Local Register Allocation. This is still experimental for FT32,
19781 so by default the compiler uses standard reload.
19782
19783 @item -mnodiv
19784 @opindex mnodiv
19785 Do not use div and mod instructions.
19786
19787 @item -mft32b
19788 @opindex mft32b
19789 Enable use of the extended instructions of the FT32B processor.
19790
19791 @item -mcompress
19792 @opindex mcompress
19793 Compress all code using the Ft32B code compression scheme.
19794
19795 @item -mnopm
19796 @opindex mnopm
19797 Do not generate code that reads program memory.
19798
19799 @end table
19800
19801 @node FRV Options
19802 @subsection FRV Options
19803 @cindex FRV Options
19804
19805 @table @gcctabopt
19806 @item -mgpr-32
19807 @opindex mgpr-32
19808
19809 Only use the first 32 general-purpose registers.
19810
19811 @item -mgpr-64
19812 @opindex mgpr-64
19813
19814 Use all 64 general-purpose registers.
19815
19816 @item -mfpr-32
19817 @opindex mfpr-32
19818
19819 Use only the first 32 floating-point registers.
19820
19821 @item -mfpr-64
19822 @opindex mfpr-64
19823
19824 Use all 64 floating-point registers.
19825
19826 @item -mhard-float
19827 @opindex mhard-float
19828
19829 Use hardware instructions for floating-point operations.
19830
19831 @item -msoft-float
19832 @opindex msoft-float
19833
19834 Use library routines for floating-point operations.
19835
19836 @item -malloc-cc
19837 @opindex malloc-cc
19838
19839 Dynamically allocate condition code registers.
19840
19841 @item -mfixed-cc
19842 @opindex mfixed-cc
19843
19844 Do not try to dynamically allocate condition code registers, only
19845 use @code{icc0} and @code{fcc0}.
19846
19847 @item -mdword
19848 @opindex mdword
19849
19850 Change ABI to use double word insns.
19851
19852 @item -mno-dword
19853 @opindex mno-dword
19854 @opindex mdword
19855
19856 Do not use double word instructions.
19857
19858 @item -mdouble
19859 @opindex mdouble
19860
19861 Use floating-point double instructions.
19862
19863 @item -mno-double
19864 @opindex mno-double
19865
19866 Do not use floating-point double instructions.
19867
19868 @item -mmedia
19869 @opindex mmedia
19870
19871 Use media instructions.
19872
19873 @item -mno-media
19874 @opindex mno-media
19875
19876 Do not use media instructions.
19877
19878 @item -mmuladd
19879 @opindex mmuladd
19880
19881 Use multiply and add/subtract instructions.
19882
19883 @item -mno-muladd
19884 @opindex mno-muladd
19885
19886 Do not use multiply and add/subtract instructions.
19887
19888 @item -mfdpic
19889 @opindex mfdpic
19890
19891 Select the FDPIC ABI, which uses function descriptors to represent
19892 pointers to functions. Without any PIC/PIE-related options, it
19893 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19894 assumes GOT entries and small data are within a 12-bit range from the
19895 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19896 are computed with 32 bits.
19897 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19898
19899 @item -minline-plt
19900 @opindex minline-plt
19901
19902 Enable inlining of PLT entries in function calls to functions that are
19903 not known to bind locally. It has no effect without @option{-mfdpic}.
19904 It's enabled by default if optimizing for speed and compiling for
19905 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19906 optimization option such as @option{-O3} or above is present in the
19907 command line.
19908
19909 @item -mTLS
19910 @opindex mTLS
19911
19912 Assume a large TLS segment when generating thread-local code.
19913
19914 @item -mtls
19915 @opindex mtls
19916
19917 Do not assume a large TLS segment when generating thread-local code.
19918
19919 @item -mgprel-ro
19920 @opindex mgprel-ro
19921
19922 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19923 that is known to be in read-only sections. It's enabled by default,
19924 except for @option{-fpic} or @option{-fpie}: even though it may help
19925 make the global offset table smaller, it trades 1 instruction for 4.
19926 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19927 one of which may be shared by multiple symbols, and it avoids the need
19928 for a GOT entry for the referenced symbol, so it's more likely to be a
19929 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19930
19931 @item -multilib-library-pic
19932 @opindex multilib-library-pic
19933
19934 Link with the (library, not FD) pic libraries. It's implied by
19935 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19936 @option{-fpic} without @option{-mfdpic}. You should never have to use
19937 it explicitly.
19938
19939 @item -mlinked-fp
19940 @opindex mlinked-fp
19941
19942 Follow the EABI requirement of always creating a frame pointer whenever
19943 a stack frame is allocated. This option is enabled by default and can
19944 be disabled with @option{-mno-linked-fp}.
19945
19946 @item -mlong-calls
19947 @opindex mlong-calls
19948
19949 Use indirect addressing to call functions outside the current
19950 compilation unit. This allows the functions to be placed anywhere
19951 within the 32-bit address space.
19952
19953 @item -malign-labels
19954 @opindex malign-labels
19955
19956 Try to align labels to an 8-byte boundary by inserting NOPs into the
19957 previous packet. This option only has an effect when VLIW packing
19958 is enabled. It doesn't create new packets; it merely adds NOPs to
19959 existing ones.
19960
19961 @item -mlibrary-pic
19962 @opindex mlibrary-pic
19963
19964 Generate position-independent EABI code.
19965
19966 @item -macc-4
19967 @opindex macc-4
19968
19969 Use only the first four media accumulator registers.
19970
19971 @item -macc-8
19972 @opindex macc-8
19973
19974 Use all eight media accumulator registers.
19975
19976 @item -mpack
19977 @opindex mpack
19978
19979 Pack VLIW instructions.
19980
19981 @item -mno-pack
19982 @opindex mno-pack
19983
19984 Do not pack VLIW instructions.
19985
19986 @item -mno-eflags
19987 @opindex mno-eflags
19988
19989 Do not mark ABI switches in e_flags.
19990
19991 @item -mcond-move
19992 @opindex mcond-move
19993
19994 Enable the use of conditional-move instructions (default).
19995
19996 This switch is mainly for debugging the compiler and will likely be removed
19997 in a future version.
19998
19999 @item -mno-cond-move
20000 @opindex mno-cond-move
20001
20002 Disable the use of conditional-move instructions.
20003
20004 This switch is mainly for debugging the compiler and will likely be removed
20005 in a future version.
20006
20007 @item -mscc
20008 @opindex mscc
20009
20010 Enable the use of conditional set instructions (default).
20011
20012 This switch is mainly for debugging the compiler and will likely be removed
20013 in a future version.
20014
20015 @item -mno-scc
20016 @opindex mno-scc
20017
20018 Disable the use of conditional set instructions.
20019
20020 This switch is mainly for debugging the compiler and will likely be removed
20021 in a future version.
20022
20023 @item -mcond-exec
20024 @opindex mcond-exec
20025
20026 Enable the use of conditional execution (default).
20027
20028 This switch is mainly for debugging the compiler and will likely be removed
20029 in a future version.
20030
20031 @item -mno-cond-exec
20032 @opindex mno-cond-exec
20033
20034 Disable the use of conditional execution.
20035
20036 This switch is mainly for debugging the compiler and will likely be removed
20037 in a future version.
20038
20039 @item -mvliw-branch
20040 @opindex mvliw-branch
20041
20042 Run a pass to pack branches into VLIW instructions (default).
20043
20044 This switch is mainly for debugging the compiler and will likely be removed
20045 in a future version.
20046
20047 @item -mno-vliw-branch
20048 @opindex mno-vliw-branch
20049
20050 Do not run a pass to pack branches into VLIW instructions.
20051
20052 This switch is mainly for debugging the compiler and will likely be removed
20053 in a future version.
20054
20055 @item -mmulti-cond-exec
20056 @opindex mmulti-cond-exec
20057
20058 Enable optimization of @code{&&} and @code{||} in conditional execution
20059 (default).
20060
20061 This switch is mainly for debugging the compiler and will likely be removed
20062 in a future version.
20063
20064 @item -mno-multi-cond-exec
20065 @opindex mno-multi-cond-exec
20066
20067 Disable optimization of @code{&&} and @code{||} in conditional execution.
20068
20069 This switch is mainly for debugging the compiler and will likely be removed
20070 in a future version.
20071
20072 @item -mnested-cond-exec
20073 @opindex mnested-cond-exec
20074
20075 Enable nested conditional execution optimizations (default).
20076
20077 This switch is mainly for debugging the compiler and will likely be removed
20078 in a future version.
20079
20080 @item -mno-nested-cond-exec
20081 @opindex mno-nested-cond-exec
20082
20083 Disable nested conditional execution optimizations.
20084
20085 This switch is mainly for debugging the compiler and will likely be removed
20086 in a future version.
20087
20088 @item -moptimize-membar
20089 @opindex moptimize-membar
20090
20091 This switch removes redundant @code{membar} instructions from the
20092 compiler-generated code. It is enabled by default.
20093
20094 @item -mno-optimize-membar
20095 @opindex mno-optimize-membar
20096 @opindex moptimize-membar
20097
20098 This switch disables the automatic removal of redundant @code{membar}
20099 instructions from the generated code.
20100
20101 @item -mtomcat-stats
20102 @opindex mtomcat-stats
20103
20104 Cause gas to print out tomcat statistics.
20105
20106 @item -mcpu=@var{cpu}
20107 @opindex mcpu
20108
20109 Select the processor type for which to generate code. Possible values are
20110 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20111 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20112
20113 @end table
20114
20115 @node GNU/Linux Options
20116 @subsection GNU/Linux Options
20117
20118 These @samp{-m} options are defined for GNU/Linux targets:
20119
20120 @table @gcctabopt
20121 @item -mglibc
20122 @opindex mglibc
20123 Use the GNU C library. This is the default except
20124 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20125 @samp{*-*-linux-*android*} targets.
20126
20127 @item -muclibc
20128 @opindex muclibc
20129 Use uClibc C library. This is the default on
20130 @samp{*-*-linux-*uclibc*} targets.
20131
20132 @item -mmusl
20133 @opindex mmusl
20134 Use the musl C library. This is the default on
20135 @samp{*-*-linux-*musl*} targets.
20136
20137 @item -mbionic
20138 @opindex mbionic
20139 Use Bionic C library. This is the default on
20140 @samp{*-*-linux-*android*} targets.
20141
20142 @item -mandroid
20143 @opindex mandroid
20144 Compile code compatible with Android platform. This is the default on
20145 @samp{*-*-linux-*android*} targets.
20146
20147 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20148 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20149 this option makes the GCC driver pass Android-specific options to the linker.
20150 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20151 to be defined.
20152
20153 @item -tno-android-cc
20154 @opindex tno-android-cc
20155 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20156 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20157 @option{-fno-rtti} by default.
20158
20159 @item -tno-android-ld
20160 @opindex tno-android-ld
20161 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20162 linking options to the linker.
20163
20164 @end table
20165
20166 @node H8/300 Options
20167 @subsection H8/300 Options
20168
20169 These @samp{-m} options are defined for the H8/300 implementations:
20170
20171 @table @gcctabopt
20172 @item -mrelax
20173 @opindex mrelax
20174 Shorten some address references at link time, when possible; uses the
20175 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20176 ld, Using ld}, for a fuller description.
20177
20178 @item -mh
20179 @opindex mh
20180 Generate code for the H8/300H@.
20181
20182 @item -ms
20183 @opindex ms
20184 Generate code for the H8S@.
20185
20186 @item -mn
20187 @opindex mn
20188 Generate code for the H8S and H8/300H in the normal mode. This switch
20189 must be used either with @option{-mh} or @option{-ms}.
20190
20191 @item -ms2600
20192 @opindex ms2600
20193 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20194
20195 @item -mexr
20196 @opindex mexr
20197 Extended registers are stored on stack before execution of function
20198 with monitor attribute. Default option is @option{-mexr}.
20199 This option is valid only for H8S targets.
20200
20201 @item -mno-exr
20202 @opindex mno-exr
20203 @opindex mexr
20204 Extended registers are not stored on stack before execution of function
20205 with monitor attribute. Default option is @option{-mno-exr}.
20206 This option is valid only for H8S targets.
20207
20208 @item -mint32
20209 @opindex mint32
20210 Make @code{int} data 32 bits by default.
20211
20212 @item -malign-300
20213 @opindex malign-300
20214 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20215 The default for the H8/300H and H8S is to align longs and floats on
20216 4-byte boundaries.
20217 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20218 This option has no effect on the H8/300.
20219 @end table
20220
20221 @node HPPA Options
20222 @subsection HPPA Options
20223 @cindex HPPA Options
20224
20225 These @samp{-m} options are defined for the HPPA family of computers:
20226
20227 @table @gcctabopt
20228 @item -march=@var{architecture-type}
20229 @opindex march
20230 Generate code for the specified architecture. The choices for
20231 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20232 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20233 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20234 architecture option for your machine. Code compiled for lower numbered
20235 architectures runs on higher numbered architectures, but not the
20236 other way around.
20237
20238 @item -mpa-risc-1-0
20239 @itemx -mpa-risc-1-1
20240 @itemx -mpa-risc-2-0
20241 @opindex mpa-risc-1-0
20242 @opindex mpa-risc-1-1
20243 @opindex mpa-risc-2-0
20244 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20245
20246 @item -mcaller-copies
20247 @opindex mcaller-copies
20248 The caller copies function arguments passed by hidden reference. This
20249 option should be used with care as it is not compatible with the default
20250 32-bit runtime. However, only aggregates larger than eight bytes are
20251 passed by hidden reference and the option provides better compatibility
20252 with OpenMP.
20253
20254 @item -mjump-in-delay
20255 @opindex mjump-in-delay
20256 This option is ignored and provided for compatibility purposes only.
20257
20258 @item -mdisable-fpregs
20259 @opindex mdisable-fpregs
20260 Prevent floating-point registers from being used in any manner. This is
20261 necessary for compiling kernels that perform lazy context switching of
20262 floating-point registers. If you use this option and attempt to perform
20263 floating-point operations, the compiler aborts.
20264
20265 @item -mdisable-indexing
20266 @opindex mdisable-indexing
20267 Prevent the compiler from using indexing address modes. This avoids some
20268 rather obscure problems when compiling MIG generated code under MACH@.
20269
20270 @item -mno-space-regs
20271 @opindex mno-space-regs
20272 @opindex mspace-regs
20273 Generate code that assumes the target has no space registers. This allows
20274 GCC to generate faster indirect calls and use unscaled index address modes.
20275
20276 Such code is suitable for level 0 PA systems and kernels.
20277
20278 @item -mfast-indirect-calls
20279 @opindex mfast-indirect-calls
20280 Generate code that assumes calls never cross space boundaries. This
20281 allows GCC to emit code that performs faster indirect calls.
20282
20283 This option does not work in the presence of shared libraries or nested
20284 functions.
20285
20286 @item -mfixed-range=@var{register-range}
20287 @opindex mfixed-range
20288 Generate code treating the given register range as fixed registers.
20289 A fixed register is one that the register allocator cannot use. This is
20290 useful when compiling kernel code. A register range is specified as
20291 two registers separated by a dash. Multiple register ranges can be
20292 specified separated by a comma.
20293
20294 @item -mlong-load-store
20295 @opindex mlong-load-store
20296 Generate 3-instruction load and store sequences as sometimes required by
20297 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20298 the HP compilers.
20299
20300 @item -mportable-runtime
20301 @opindex mportable-runtime
20302 Use the portable calling conventions proposed by HP for ELF systems.
20303
20304 @item -mgas
20305 @opindex mgas
20306 Enable the use of assembler directives only GAS understands.
20307
20308 @item -mschedule=@var{cpu-type}
20309 @opindex mschedule
20310 Schedule code according to the constraints for the machine type
20311 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20312 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20313 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20314 proper scheduling option for your machine. The default scheduling is
20315 @samp{8000}.
20316
20317 @item -mlinker-opt
20318 @opindex mlinker-opt
20319 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20320 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20321 linkers in which they give bogus error messages when linking some programs.
20322
20323 @item -msoft-float
20324 @opindex msoft-float
20325 Generate output containing library calls for floating point.
20326 @strong{Warning:} the requisite libraries are not available for all HPPA
20327 targets. Normally the facilities of the machine's usual C compiler are
20328 used, but this cannot be done directly in cross-compilation. You must make
20329 your own arrangements to provide suitable library functions for
20330 cross-compilation.
20331
20332 @option{-msoft-float} changes the calling convention in the output file;
20333 therefore, it is only useful if you compile @emph{all} of a program with
20334 this option. In particular, you need to compile @file{libgcc.a}, the
20335 library that comes with GCC, with @option{-msoft-float} in order for
20336 this to work.
20337
20338 @item -msio
20339 @opindex msio
20340 Generate the predefine, @code{_SIO}, for server IO@. The default is
20341 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20342 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20343 options are available under HP-UX and HI-UX@.
20344
20345 @item -mgnu-ld
20346 @opindex mgnu-ld
20347 Use options specific to GNU @command{ld}.
20348 This passes @option{-shared} to @command{ld} when
20349 building a shared library. It is the default when GCC is configured,
20350 explicitly or implicitly, with the GNU linker. This option does not
20351 affect which @command{ld} is called; it only changes what parameters
20352 are passed to that @command{ld}.
20353 The @command{ld} that is called is determined by the
20354 @option{--with-ld} configure option, GCC's program search path, and
20355 finally by the user's @env{PATH}. The linker used by GCC can be printed
20356 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20357 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20358
20359 @item -mhp-ld
20360 @opindex mhp-ld
20361 Use options specific to HP @command{ld}.
20362 This passes @option{-b} to @command{ld} when building
20363 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20364 links. It is the default when GCC is configured, explicitly or
20365 implicitly, with the HP linker. This option does not affect
20366 which @command{ld} is called; it only changes what parameters are passed to that
20367 @command{ld}.
20368 The @command{ld} that is called is determined by the @option{--with-ld}
20369 configure option, GCC's program search path, and finally by the user's
20370 @env{PATH}. The linker used by GCC can be printed using @samp{which
20371 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20372 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20373
20374 @item -mlong-calls
20375 @opindex mno-long-calls
20376 @opindex mlong-calls
20377 Generate code that uses long call sequences. This ensures that a call
20378 is always able to reach linker generated stubs. The default is to generate
20379 long calls only when the distance from the call site to the beginning
20380 of the function or translation unit, as the case may be, exceeds a
20381 predefined limit set by the branch type being used. The limits for
20382 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20383 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20384 240,000 bytes.
20385
20386 Distances are measured from the beginning of functions when using the
20387 @option{-ffunction-sections} option, or when using the @option{-mgas}
20388 and @option{-mno-portable-runtime} options together under HP-UX with
20389 the SOM linker.
20390
20391 It is normally not desirable to use this option as it degrades
20392 performance. However, it may be useful in large applications,
20393 particularly when partial linking is used to build the application.
20394
20395 The types of long calls used depends on the capabilities of the
20396 assembler and linker, and the type of code being generated. The
20397 impact on systems that support long absolute calls, and long pic
20398 symbol-difference or pc-relative calls should be relatively small.
20399 However, an indirect call is used on 32-bit ELF systems in pic code
20400 and it is quite long.
20401
20402 @item -munix=@var{unix-std}
20403 @opindex march
20404 Generate compiler predefines and select a startfile for the specified
20405 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20406 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20407 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20408 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20409 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20410 and later.
20411
20412 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20413 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20414 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20415 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20416 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20417 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20418
20419 It is @emph{important} to note that this option changes the interfaces
20420 for various library routines. It also affects the operational behavior
20421 of the C library. Thus, @emph{extreme} care is needed in using this
20422 option.
20423
20424 Library code that is intended to operate with more than one UNIX
20425 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20426 as appropriate. Most GNU software doesn't provide this capability.
20427
20428 @item -nolibdld
20429 @opindex nolibdld
20430 Suppress the generation of link options to search libdld.sl when the
20431 @option{-static} option is specified on HP-UX 10 and later.
20432
20433 @item -static
20434 @opindex static
20435 The HP-UX implementation of setlocale in libc has a dependency on
20436 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20437 when the @option{-static} option is specified, special link options
20438 are needed to resolve this dependency.
20439
20440 On HP-UX 10 and later, the GCC driver adds the necessary options to
20441 link with libdld.sl when the @option{-static} option is specified.
20442 This causes the resulting binary to be dynamic. On the 64-bit port,
20443 the linkers generate dynamic binaries by default in any case. The
20444 @option{-nolibdld} option can be used to prevent the GCC driver from
20445 adding these link options.
20446
20447 @item -threads
20448 @opindex threads
20449 Add support for multithreading with the @dfn{dce thread} library
20450 under HP-UX@. This option sets flags for both the preprocessor and
20451 linker.
20452 @end table
20453
20454 @node IA-64 Options
20455 @subsection IA-64 Options
20456 @cindex IA-64 Options
20457
20458 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20459
20460 @table @gcctabopt
20461 @item -mbig-endian
20462 @opindex mbig-endian
20463 Generate code for a big-endian target. This is the default for HP-UX@.
20464
20465 @item -mlittle-endian
20466 @opindex mlittle-endian
20467 Generate code for a little-endian target. This is the default for AIX5
20468 and GNU/Linux.
20469
20470 @item -mgnu-as
20471 @itemx -mno-gnu-as
20472 @opindex mgnu-as
20473 @opindex mno-gnu-as
20474 Generate (or don't) code for the GNU assembler. This is the default.
20475 @c Also, this is the default if the configure option @option{--with-gnu-as}
20476 @c is used.
20477
20478 @item -mgnu-ld
20479 @itemx -mno-gnu-ld
20480 @opindex mgnu-ld
20481 @opindex mno-gnu-ld
20482 Generate (or don't) code for the GNU linker. This is the default.
20483 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20484 @c is used.
20485
20486 @item -mno-pic
20487 @opindex mno-pic
20488 Generate code that does not use a global pointer register. The result
20489 is not position independent code, and violates the IA-64 ABI@.
20490
20491 @item -mvolatile-asm-stop
20492 @itemx -mno-volatile-asm-stop
20493 @opindex mvolatile-asm-stop
20494 @opindex mno-volatile-asm-stop
20495 Generate (or don't) a stop bit immediately before and after volatile asm
20496 statements.
20497
20498 @item -mregister-names
20499 @itemx -mno-register-names
20500 @opindex mregister-names
20501 @opindex mno-register-names
20502 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20503 the stacked registers. This may make assembler output more readable.
20504
20505 @item -mno-sdata
20506 @itemx -msdata
20507 @opindex mno-sdata
20508 @opindex msdata
20509 Disable (or enable) optimizations that use the small data section. This may
20510 be useful for working around optimizer bugs.
20511
20512 @item -mconstant-gp
20513 @opindex mconstant-gp
20514 Generate code that uses a single constant global pointer value. This is
20515 useful when compiling kernel code.
20516
20517 @item -mauto-pic
20518 @opindex mauto-pic
20519 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20520 This is useful when compiling firmware code.
20521
20522 @item -minline-float-divide-min-latency
20523 @opindex minline-float-divide-min-latency
20524 Generate code for inline divides of floating-point values
20525 using the minimum latency algorithm.
20526
20527 @item -minline-float-divide-max-throughput
20528 @opindex minline-float-divide-max-throughput
20529 Generate code for inline divides of floating-point values
20530 using the maximum throughput algorithm.
20531
20532 @item -mno-inline-float-divide
20533 @opindex mno-inline-float-divide
20534 Do not generate inline code for divides of floating-point values.
20535
20536 @item -minline-int-divide-min-latency
20537 @opindex minline-int-divide-min-latency
20538 Generate code for inline divides of integer values
20539 using the minimum latency algorithm.
20540
20541 @item -minline-int-divide-max-throughput
20542 @opindex minline-int-divide-max-throughput
20543 Generate code for inline divides of integer values
20544 using the maximum throughput algorithm.
20545
20546 @item -mno-inline-int-divide
20547 @opindex mno-inline-int-divide
20548 @opindex minline-int-divide
20549 Do not generate inline code for divides of integer values.
20550
20551 @item -minline-sqrt-min-latency
20552 @opindex minline-sqrt-min-latency
20553 Generate code for inline square roots
20554 using the minimum latency algorithm.
20555
20556 @item -minline-sqrt-max-throughput
20557 @opindex minline-sqrt-max-throughput
20558 Generate code for inline square roots
20559 using the maximum throughput algorithm.
20560
20561 @item -mno-inline-sqrt
20562 @opindex mno-inline-sqrt
20563 Do not generate inline code for @code{sqrt}.
20564
20565 @item -mfused-madd
20566 @itemx -mno-fused-madd
20567 @opindex mfused-madd
20568 @opindex mno-fused-madd
20569 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20570 instructions. The default is to use these instructions.
20571
20572 @item -mno-dwarf2-asm
20573 @itemx -mdwarf2-asm
20574 @opindex mno-dwarf2-asm
20575 @opindex mdwarf2-asm
20576 Don't (or do) generate assembler code for the DWARF line number debugging
20577 info. This may be useful when not using the GNU assembler.
20578
20579 @item -mearly-stop-bits
20580 @itemx -mno-early-stop-bits
20581 @opindex mearly-stop-bits
20582 @opindex mno-early-stop-bits
20583 Allow stop bits to be placed earlier than immediately preceding the
20584 instruction that triggered the stop bit. This can improve instruction
20585 scheduling, but does not always do so.
20586
20587 @item -mfixed-range=@var{register-range}
20588 @opindex mfixed-range
20589 Generate code treating the given register range as fixed registers.
20590 A fixed register is one that the register allocator cannot use. This is
20591 useful when compiling kernel code. A register range is specified as
20592 two registers separated by a dash. Multiple register ranges can be
20593 specified separated by a comma.
20594
20595 @item -mtls-size=@var{tls-size}
20596 @opindex mtls-size
20597 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20598 64.
20599
20600 @item -mtune=@var{cpu-type}
20601 @opindex mtune
20602 Tune the instruction scheduling for a particular CPU, Valid values are
20603 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20604 and @samp{mckinley}.
20605
20606 @item -milp32
20607 @itemx -mlp64
20608 @opindex milp32
20609 @opindex mlp64
20610 Generate code for a 32-bit or 64-bit environment.
20611 The 32-bit environment sets int, long and pointer to 32 bits.
20612 The 64-bit environment sets int to 32 bits and long and pointer
20613 to 64 bits. These are HP-UX specific flags.
20614
20615 @item -mno-sched-br-data-spec
20616 @itemx -msched-br-data-spec
20617 @opindex mno-sched-br-data-spec
20618 @opindex msched-br-data-spec
20619 (Dis/En)able data speculative scheduling before reload.
20620 This results in generation of @code{ld.a} instructions and
20621 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20622 The default setting is disabled.
20623
20624 @item -msched-ar-data-spec
20625 @itemx -mno-sched-ar-data-spec
20626 @opindex msched-ar-data-spec
20627 @opindex mno-sched-ar-data-spec
20628 (En/Dis)able data speculative scheduling after reload.
20629 This results in generation of @code{ld.a} instructions and
20630 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20631 The default setting is enabled.
20632
20633 @item -mno-sched-control-spec
20634 @itemx -msched-control-spec
20635 @opindex mno-sched-control-spec
20636 @opindex msched-control-spec
20637 (Dis/En)able control speculative scheduling. This feature is
20638 available only during region scheduling (i.e.@: before reload).
20639 This results in generation of the @code{ld.s} instructions and
20640 the corresponding check instructions @code{chk.s}.
20641 The default setting is disabled.
20642
20643 @item -msched-br-in-data-spec
20644 @itemx -mno-sched-br-in-data-spec
20645 @opindex msched-br-in-data-spec
20646 @opindex mno-sched-br-in-data-spec
20647 (En/Dis)able speculative scheduling of the instructions that
20648 are dependent on the data speculative loads before reload.
20649 This is effective only with @option{-msched-br-data-spec} enabled.
20650 The default setting is enabled.
20651
20652 @item -msched-ar-in-data-spec
20653 @itemx -mno-sched-ar-in-data-spec
20654 @opindex msched-ar-in-data-spec
20655 @opindex mno-sched-ar-in-data-spec
20656 (En/Dis)able speculative scheduling of the instructions that
20657 are dependent on the data speculative loads after reload.
20658 This is effective only with @option{-msched-ar-data-spec} enabled.
20659 The default setting is enabled.
20660
20661 @item -msched-in-control-spec
20662 @itemx -mno-sched-in-control-spec
20663 @opindex msched-in-control-spec
20664 @opindex mno-sched-in-control-spec
20665 (En/Dis)able speculative scheduling of the instructions that
20666 are dependent on the control speculative loads.
20667 This is effective only with @option{-msched-control-spec} enabled.
20668 The default setting is enabled.
20669
20670 @item -mno-sched-prefer-non-data-spec-insns
20671 @itemx -msched-prefer-non-data-spec-insns
20672 @opindex mno-sched-prefer-non-data-spec-insns
20673 @opindex msched-prefer-non-data-spec-insns
20674 If enabled, data-speculative instructions are chosen for schedule
20675 only if there are no other choices at the moment. This makes
20676 the use of the data speculation much more conservative.
20677 The default setting is disabled.
20678
20679 @item -mno-sched-prefer-non-control-spec-insns
20680 @itemx -msched-prefer-non-control-spec-insns
20681 @opindex mno-sched-prefer-non-control-spec-insns
20682 @opindex msched-prefer-non-control-spec-insns
20683 If enabled, control-speculative instructions are chosen for schedule
20684 only if there are no other choices at the moment. This makes
20685 the use of the control speculation much more conservative.
20686 The default setting is disabled.
20687
20688 @item -mno-sched-count-spec-in-critical-path
20689 @itemx -msched-count-spec-in-critical-path
20690 @opindex mno-sched-count-spec-in-critical-path
20691 @opindex msched-count-spec-in-critical-path
20692 If enabled, speculative dependencies are considered during
20693 computation of the instructions priorities. This makes the use of the
20694 speculation a bit more conservative.
20695 The default setting is disabled.
20696
20697 @item -msched-spec-ldc
20698 @opindex msched-spec-ldc
20699 Use a simple data speculation check. This option is on by default.
20700
20701 @item -msched-control-spec-ldc
20702 @opindex msched-spec-ldc
20703 Use a simple check for control speculation. This option is on by default.
20704
20705 @item -msched-stop-bits-after-every-cycle
20706 @opindex msched-stop-bits-after-every-cycle
20707 Place a stop bit after every cycle when scheduling. This option is on
20708 by default.
20709
20710 @item -msched-fp-mem-deps-zero-cost
20711 @opindex msched-fp-mem-deps-zero-cost
20712 Assume that floating-point stores and loads are not likely to cause a conflict
20713 when placed into the same instruction group. This option is disabled by
20714 default.
20715
20716 @item -msel-sched-dont-check-control-spec
20717 @opindex msel-sched-dont-check-control-spec
20718 Generate checks for control speculation in selective scheduling.
20719 This flag is disabled by default.
20720
20721 @item -msched-max-memory-insns=@var{max-insns}
20722 @opindex msched-max-memory-insns
20723 Limit on the number of memory insns per instruction group, giving lower
20724 priority to subsequent memory insns attempting to schedule in the same
20725 instruction group. Frequently useful to prevent cache bank conflicts.
20726 The default value is 1.
20727
20728 @item -msched-max-memory-insns-hard-limit
20729 @opindex msched-max-memory-insns-hard-limit
20730 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20731 disallowing more than that number in an instruction group.
20732 Otherwise, the limit is ``soft'', meaning that non-memory operations
20733 are preferred when the limit is reached, but memory operations may still
20734 be scheduled.
20735
20736 @end table
20737
20738 @node LM32 Options
20739 @subsection LM32 Options
20740 @cindex LM32 options
20741
20742 These @option{-m} options are defined for the LatticeMico32 architecture:
20743
20744 @table @gcctabopt
20745 @item -mbarrel-shift-enabled
20746 @opindex mbarrel-shift-enabled
20747 Enable barrel-shift instructions.
20748
20749 @item -mdivide-enabled
20750 @opindex mdivide-enabled
20751 Enable divide and modulus instructions.
20752
20753 @item -mmultiply-enabled
20754 @opindex multiply-enabled
20755 Enable multiply instructions.
20756
20757 @item -msign-extend-enabled
20758 @opindex msign-extend-enabled
20759 Enable sign extend instructions.
20760
20761 @item -muser-enabled
20762 @opindex muser-enabled
20763 Enable user-defined instructions.
20764
20765 @end table
20766
20767 @node M32C Options
20768 @subsection M32C Options
20769 @cindex M32C options
20770
20771 @table @gcctabopt
20772 @item -mcpu=@var{name}
20773 @opindex mcpu=
20774 Select the CPU for which code is generated. @var{name} may be one of
20775 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20776 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20777 the M32C/80 series.
20778
20779 @item -msim
20780 @opindex msim
20781 Specifies that the program will be run on the simulator. This causes
20782 an alternate runtime library to be linked in which supports, for
20783 example, file I/O@. You must not use this option when generating
20784 programs that will run on real hardware; you must provide your own
20785 runtime library for whatever I/O functions are needed.
20786
20787 @item -memregs=@var{number}
20788 @opindex memregs=
20789 Specifies the number of memory-based pseudo-registers GCC uses
20790 during code generation. These pseudo-registers are used like real
20791 registers, so there is a tradeoff between GCC's ability to fit the
20792 code into available registers, and the performance penalty of using
20793 memory instead of registers. Note that all modules in a program must
20794 be compiled with the same value for this option. Because of that, you
20795 must not use this option with GCC's default runtime libraries.
20796
20797 @end table
20798
20799 @node M32R/D Options
20800 @subsection M32R/D Options
20801 @cindex M32R/D options
20802
20803 These @option{-m} options are defined for Renesas M32R/D architectures:
20804
20805 @table @gcctabopt
20806 @item -m32r2
20807 @opindex m32r2
20808 Generate code for the M32R/2@.
20809
20810 @item -m32rx
20811 @opindex m32rx
20812 Generate code for the M32R/X@.
20813
20814 @item -m32r
20815 @opindex m32r
20816 Generate code for the M32R@. This is the default.
20817
20818 @item -mmodel=small
20819 @opindex mmodel=small
20820 Assume all objects live in the lower 16MB of memory (so that their addresses
20821 can be loaded with the @code{ld24} instruction), and assume all subroutines
20822 are reachable with the @code{bl} instruction.
20823 This is the default.
20824
20825 The addressability of a particular object can be set with the
20826 @code{model} attribute.
20827
20828 @item -mmodel=medium
20829 @opindex mmodel=medium
20830 Assume objects may be anywhere in the 32-bit address space (the compiler
20831 generates @code{seth/add3} instructions to load their addresses), and
20832 assume all subroutines are reachable with the @code{bl} instruction.
20833
20834 @item -mmodel=large
20835 @opindex mmodel=large
20836 Assume objects may be anywhere in the 32-bit address space (the compiler
20837 generates @code{seth/add3} instructions to load their addresses), and
20838 assume subroutines may not be reachable with the @code{bl} instruction
20839 (the compiler generates the much slower @code{seth/add3/jl}
20840 instruction sequence).
20841
20842 @item -msdata=none
20843 @opindex msdata=none
20844 Disable use of the small data area. Variables are put into
20845 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20846 @code{section} attribute has been specified).
20847 This is the default.
20848
20849 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20850 Objects may be explicitly put in the small data area with the
20851 @code{section} attribute using one of these sections.
20852
20853 @item -msdata=sdata
20854 @opindex msdata=sdata
20855 Put small global and static data in the small data area, but do not
20856 generate special code to reference them.
20857
20858 @item -msdata=use
20859 @opindex msdata=use
20860 Put small global and static data in the small data area, and generate
20861 special instructions to reference them.
20862
20863 @item -G @var{num}
20864 @opindex G
20865 @cindex smaller data references
20866 Put global and static objects less than or equal to @var{num} bytes
20867 into the small data or BSS sections instead of the normal data or BSS
20868 sections. The default value of @var{num} is 8.
20869 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20870 for this option to have any effect.
20871
20872 All modules should be compiled with the same @option{-G @var{num}} value.
20873 Compiling with different values of @var{num} may or may not work; if it
20874 doesn't the linker gives an error message---incorrect code is not
20875 generated.
20876
20877 @item -mdebug
20878 @opindex mdebug
20879 Makes the M32R-specific code in the compiler display some statistics
20880 that might help in debugging programs.
20881
20882 @item -malign-loops
20883 @opindex malign-loops
20884 Align all loops to a 32-byte boundary.
20885
20886 @item -mno-align-loops
20887 @opindex mno-align-loops
20888 Do not enforce a 32-byte alignment for loops. This is the default.
20889
20890 @item -missue-rate=@var{number}
20891 @opindex missue-rate=@var{number}
20892 Issue @var{number} instructions per cycle. @var{number} can only be 1
20893 or 2.
20894
20895 @item -mbranch-cost=@var{number}
20896 @opindex mbranch-cost=@var{number}
20897 @var{number} can only be 1 or 2. If it is 1 then branches are
20898 preferred over conditional code, if it is 2, then the opposite applies.
20899
20900 @item -mflush-trap=@var{number}
20901 @opindex mflush-trap=@var{number}
20902 Specifies the trap number to use to flush the cache. The default is
20903 12. Valid numbers are between 0 and 15 inclusive.
20904
20905 @item -mno-flush-trap
20906 @opindex mno-flush-trap
20907 Specifies that the cache cannot be flushed by using a trap.
20908
20909 @item -mflush-func=@var{name}
20910 @opindex mflush-func=@var{name}
20911 Specifies the name of the operating system function to call to flush
20912 the cache. The default is @samp{_flush_cache}, but a function call
20913 is only used if a trap is not available.
20914
20915 @item -mno-flush-func
20916 @opindex mno-flush-func
20917 Indicates that there is no OS function for flushing the cache.
20918
20919 @end table
20920
20921 @node M680x0 Options
20922 @subsection M680x0 Options
20923 @cindex M680x0 options
20924
20925 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20926 The default settings depend on which architecture was selected when
20927 the compiler was configured; the defaults for the most common choices
20928 are given below.
20929
20930 @table @gcctabopt
20931 @item -march=@var{arch}
20932 @opindex march
20933 Generate code for a specific M680x0 or ColdFire instruction set
20934 architecture. Permissible values of @var{arch} for M680x0
20935 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20936 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20937 architectures are selected according to Freescale's ISA classification
20938 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20939 @samp{isab} and @samp{isac}.
20940
20941 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20942 code for a ColdFire target. The @var{arch} in this macro is one of the
20943 @option{-march} arguments given above.
20944
20945 When used together, @option{-march} and @option{-mtune} select code
20946 that runs on a family of similar processors but that is optimized
20947 for a particular microarchitecture.
20948
20949 @item -mcpu=@var{cpu}
20950 @opindex mcpu
20951 Generate code for a specific M680x0 or ColdFire processor.
20952 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20953 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20954 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20955 below, which also classifies the CPUs into families:
20956
20957 @multitable @columnfractions 0.20 0.80
20958 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20959 @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}
20960 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20961 @item @samp{5206e} @tab @samp{5206e}
20962 @item @samp{5208} @tab @samp{5207} @samp{5208}
20963 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20964 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20965 @item @samp{5216} @tab @samp{5214} @samp{5216}
20966 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20967 @item @samp{5225} @tab @samp{5224} @samp{5225}
20968 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20969 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20970 @item @samp{5249} @tab @samp{5249}
20971 @item @samp{5250} @tab @samp{5250}
20972 @item @samp{5271} @tab @samp{5270} @samp{5271}
20973 @item @samp{5272} @tab @samp{5272}
20974 @item @samp{5275} @tab @samp{5274} @samp{5275}
20975 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20976 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20977 @item @samp{5307} @tab @samp{5307}
20978 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20979 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20980 @item @samp{5407} @tab @samp{5407}
20981 @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}
20982 @end multitable
20983
20984 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20985 @var{arch} is compatible with @var{cpu}. Other combinations of
20986 @option{-mcpu} and @option{-march} are rejected.
20987
20988 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20989 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20990 where the value of @var{family} is given by the table above.
20991
20992 @item -mtune=@var{tune}
20993 @opindex mtune
20994 Tune the code for a particular microarchitecture within the
20995 constraints set by @option{-march} and @option{-mcpu}.
20996 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20997 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20998 and @samp{cpu32}. The ColdFire microarchitectures
20999 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21000
21001 You can also use @option{-mtune=68020-40} for code that needs
21002 to run relatively well on 68020, 68030 and 68040 targets.
21003 @option{-mtune=68020-60} is similar but includes 68060 targets
21004 as well. These two options select the same tuning decisions as
21005 @option{-m68020-40} and @option{-m68020-60} respectively.
21006
21007 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21008 when tuning for 680x0 architecture @var{arch}. It also defines
21009 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21010 option is used. If GCC is tuning for a range of architectures,
21011 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21012 it defines the macros for every architecture in the range.
21013
21014 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21015 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21016 of the arguments given above.
21017
21018 @item -m68000
21019 @itemx -mc68000
21020 @opindex m68000
21021 @opindex mc68000
21022 Generate output for a 68000. This is the default
21023 when the compiler is configured for 68000-based systems.
21024 It is equivalent to @option{-march=68000}.
21025
21026 Use this option for microcontrollers with a 68000 or EC000 core,
21027 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21028
21029 @item -m68010
21030 @opindex m68010
21031 Generate output for a 68010. This is the default
21032 when the compiler is configured for 68010-based systems.
21033 It is equivalent to @option{-march=68010}.
21034
21035 @item -m68020
21036 @itemx -mc68020
21037 @opindex m68020
21038 @opindex mc68020
21039 Generate output for a 68020. This is the default
21040 when the compiler is configured for 68020-based systems.
21041 It is equivalent to @option{-march=68020}.
21042
21043 @item -m68030
21044 @opindex m68030
21045 Generate output for a 68030. This is the default when the compiler is
21046 configured for 68030-based systems. It is equivalent to
21047 @option{-march=68030}.
21048
21049 @item -m68040
21050 @opindex m68040
21051 Generate output for a 68040. This is the default when the compiler is
21052 configured for 68040-based systems. It is equivalent to
21053 @option{-march=68040}.
21054
21055 This option inhibits the use of 68881/68882 instructions that have to be
21056 emulated by software on the 68040. Use this option if your 68040 does not
21057 have code to emulate those instructions.
21058
21059 @item -m68060
21060 @opindex m68060
21061 Generate output for a 68060. This is the default when the compiler is
21062 configured for 68060-based systems. It is equivalent to
21063 @option{-march=68060}.
21064
21065 This option inhibits the use of 68020 and 68881/68882 instructions that
21066 have to be emulated by software on the 68060. Use this option if your 68060
21067 does not have code to emulate those instructions.
21068
21069 @item -mcpu32
21070 @opindex mcpu32
21071 Generate output for a CPU32. This is the default
21072 when the compiler is configured for CPU32-based systems.
21073 It is equivalent to @option{-march=cpu32}.
21074
21075 Use this option for microcontrollers with a
21076 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21077 68336, 68340, 68341, 68349 and 68360.
21078
21079 @item -m5200
21080 @opindex m5200
21081 Generate output for a 520X ColdFire CPU@. This is the default
21082 when the compiler is configured for 520X-based systems.
21083 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21084 in favor of that option.
21085
21086 Use this option for microcontroller with a 5200 core, including
21087 the MCF5202, MCF5203, MCF5204 and MCF5206.
21088
21089 @item -m5206e
21090 @opindex m5206e
21091 Generate output for a 5206e ColdFire CPU@. The option is now
21092 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21093
21094 @item -m528x
21095 @opindex m528x
21096 Generate output for a member of the ColdFire 528X family.
21097 The option is now deprecated in favor of the equivalent
21098 @option{-mcpu=528x}.
21099
21100 @item -m5307
21101 @opindex m5307
21102 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21103 in favor of the equivalent @option{-mcpu=5307}.
21104
21105 @item -m5407
21106 @opindex m5407
21107 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21108 in favor of the equivalent @option{-mcpu=5407}.
21109
21110 @item -mcfv4e
21111 @opindex mcfv4e
21112 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21113 This includes use of hardware floating-point instructions.
21114 The option is equivalent to @option{-mcpu=547x}, and is now
21115 deprecated in favor of that option.
21116
21117 @item -m68020-40
21118 @opindex m68020-40
21119 Generate output for a 68040, without using any of the new instructions.
21120 This results in code that can run relatively efficiently on either a
21121 68020/68881 or a 68030 or a 68040. The generated code does use the
21122 68881 instructions that are emulated on the 68040.
21123
21124 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21125
21126 @item -m68020-60
21127 @opindex m68020-60
21128 Generate output for a 68060, without using any of the new instructions.
21129 This results in code that can run relatively efficiently on either a
21130 68020/68881 or a 68030 or a 68040. The generated code does use the
21131 68881 instructions that are emulated on the 68060.
21132
21133 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21134
21135 @item -mhard-float
21136 @itemx -m68881
21137 @opindex mhard-float
21138 @opindex m68881
21139 Generate floating-point instructions. This is the default for 68020
21140 and above, and for ColdFire devices that have an FPU@. It defines the
21141 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21142 on ColdFire targets.
21143
21144 @item -msoft-float
21145 @opindex msoft-float
21146 Do not generate floating-point instructions; use library calls instead.
21147 This is the default for 68000, 68010, and 68832 targets. It is also
21148 the default for ColdFire devices that have no FPU.
21149
21150 @item -mdiv
21151 @itemx -mno-div
21152 @opindex mdiv
21153 @opindex mno-div
21154 Generate (do not generate) ColdFire hardware divide and remainder
21155 instructions. If @option{-march} is used without @option{-mcpu},
21156 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21157 architectures. Otherwise, the default is taken from the target CPU
21158 (either the default CPU, or the one specified by @option{-mcpu}). For
21159 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21160 @option{-mcpu=5206e}.
21161
21162 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21163
21164 @item -mshort
21165 @opindex mshort
21166 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21167 Additionally, parameters passed on the stack are also aligned to a
21168 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21169
21170 @item -mno-short
21171 @opindex mno-short
21172 Do not consider type @code{int} to be 16 bits wide. This is the default.
21173
21174 @item -mnobitfield
21175 @itemx -mno-bitfield
21176 @opindex mnobitfield
21177 @opindex mno-bitfield
21178 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21179 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21180
21181 @item -mbitfield
21182 @opindex mbitfield
21183 Do use the bit-field instructions. The @option{-m68020} option implies
21184 @option{-mbitfield}. This is the default if you use a configuration
21185 designed for a 68020.
21186
21187 @item -mrtd
21188 @opindex mrtd
21189 Use a different function-calling convention, in which functions
21190 that take a fixed number of arguments return with the @code{rtd}
21191 instruction, which pops their arguments while returning. This
21192 saves one instruction in the caller since there is no need to pop
21193 the arguments there.
21194
21195 This calling convention is incompatible with the one normally
21196 used on Unix, so you cannot use it if you need to call libraries
21197 compiled with the Unix compiler.
21198
21199 Also, you must provide function prototypes for all functions that
21200 take variable numbers of arguments (including @code{printf});
21201 otherwise incorrect code is generated for calls to those
21202 functions.
21203
21204 In addition, seriously incorrect code results if you call a
21205 function with too many arguments. (Normally, extra arguments are
21206 harmlessly ignored.)
21207
21208 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21209 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21210
21211 The default is @option{-mno-rtd}.
21212
21213 @item -malign-int
21214 @itemx -mno-align-int
21215 @opindex malign-int
21216 @opindex mno-align-int
21217 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21218 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21219 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21220 Aligning variables on 32-bit boundaries produces code that runs somewhat
21221 faster on processors with 32-bit busses at the expense of more memory.
21222
21223 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21224 aligns structures containing the above types differently than
21225 most published application binary interface specifications for the m68k.
21226
21227 @item -mpcrel
21228 @opindex mpcrel
21229 Use the pc-relative addressing mode of the 68000 directly, instead of
21230 using a global offset table. At present, this option implies @option{-fpic},
21231 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21232 not presently supported with @option{-mpcrel}, though this could be supported for
21233 68020 and higher processors.
21234
21235 @item -mno-strict-align
21236 @itemx -mstrict-align
21237 @opindex mno-strict-align
21238 @opindex mstrict-align
21239 Do not (do) assume that unaligned memory references are handled by
21240 the system.
21241
21242 @item -msep-data
21243 Generate code that allows the data segment to be located in a different
21244 area of memory from the text segment. This allows for execute-in-place in
21245 an environment without virtual memory management. This option implies
21246 @option{-fPIC}.
21247
21248 @item -mno-sep-data
21249 Generate code that assumes that the data segment follows the text segment.
21250 This is the default.
21251
21252 @item -mid-shared-library
21253 Generate code that supports shared libraries via the library ID method.
21254 This allows for execute-in-place and shared libraries in an environment
21255 without virtual memory management. This option implies @option{-fPIC}.
21256
21257 @item -mno-id-shared-library
21258 Generate code that doesn't assume ID-based shared libraries are being used.
21259 This is the default.
21260
21261 @item -mshared-library-id=n
21262 Specifies the identification number of the ID-based shared library being
21263 compiled. Specifying a value of 0 generates more compact code; specifying
21264 other values forces the allocation of that number to the current
21265 library, but is no more space- or time-efficient than omitting this option.
21266
21267 @item -mxgot
21268 @itemx -mno-xgot
21269 @opindex mxgot
21270 @opindex mno-xgot
21271 When generating position-independent code for ColdFire, generate code
21272 that works if the GOT has more than 8192 entries. This code is
21273 larger and slower than code generated without this option. On M680x0
21274 processors, this option is not needed; @option{-fPIC} suffices.
21275
21276 GCC normally uses a single instruction to load values from the GOT@.
21277 While this is relatively efficient, it only works if the GOT
21278 is smaller than about 64k. Anything larger causes the linker
21279 to report an error such as:
21280
21281 @cindex relocation truncated to fit (ColdFire)
21282 @smallexample
21283 relocation truncated to fit: R_68K_GOT16O foobar
21284 @end smallexample
21285
21286 If this happens, you should recompile your code with @option{-mxgot}.
21287 It should then work with very large GOTs. However, code generated with
21288 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21289 the value of a global symbol.
21290
21291 Note that some linkers, including newer versions of the GNU linker,
21292 can create multiple GOTs and sort GOT entries. If you have such a linker,
21293 you should only need to use @option{-mxgot} when compiling a single
21294 object file that accesses more than 8192 GOT entries. Very few do.
21295
21296 These options have no effect unless GCC is generating
21297 position-independent code.
21298
21299 @item -mlong-jump-table-offsets
21300 @opindex mlong-jump-table-offsets
21301 Use 32-bit offsets in @code{switch} tables. The default is to use
21302 16-bit offsets.
21303
21304 @end table
21305
21306 @node MCore Options
21307 @subsection MCore Options
21308 @cindex MCore options
21309
21310 These are the @samp{-m} options defined for the Motorola M*Core
21311 processors.
21312
21313 @table @gcctabopt
21314
21315 @item -mhardlit
21316 @itemx -mno-hardlit
21317 @opindex mhardlit
21318 @opindex mno-hardlit
21319 Inline constants into the code stream if it can be done in two
21320 instructions or less.
21321
21322 @item -mdiv
21323 @itemx -mno-div
21324 @opindex mdiv
21325 @opindex mno-div
21326 Use the divide instruction. (Enabled by default).
21327
21328 @item -mrelax-immediate
21329 @itemx -mno-relax-immediate
21330 @opindex mrelax-immediate
21331 @opindex mno-relax-immediate
21332 Allow arbitrary-sized immediates in bit operations.
21333
21334 @item -mwide-bitfields
21335 @itemx -mno-wide-bitfields
21336 @opindex mwide-bitfields
21337 @opindex mno-wide-bitfields
21338 Always treat bit-fields as @code{int}-sized.
21339
21340 @item -m4byte-functions
21341 @itemx -mno-4byte-functions
21342 @opindex m4byte-functions
21343 @opindex mno-4byte-functions
21344 Force all functions to be aligned to a 4-byte boundary.
21345
21346 @item -mcallgraph-data
21347 @itemx -mno-callgraph-data
21348 @opindex mcallgraph-data
21349 @opindex mno-callgraph-data
21350 Emit callgraph information.
21351
21352 @item -mslow-bytes
21353 @itemx -mno-slow-bytes
21354 @opindex mslow-bytes
21355 @opindex mno-slow-bytes
21356 Prefer word access when reading byte quantities.
21357
21358 @item -mlittle-endian
21359 @itemx -mbig-endian
21360 @opindex mlittle-endian
21361 @opindex mbig-endian
21362 Generate code for a little-endian target.
21363
21364 @item -m210
21365 @itemx -m340
21366 @opindex m210
21367 @opindex m340
21368 Generate code for the 210 processor.
21369
21370 @item -mno-lsim
21371 @opindex mno-lsim
21372 Assume that runtime support has been provided and so omit the
21373 simulator library (@file{libsim.a)} from the linker command line.
21374
21375 @item -mstack-increment=@var{size}
21376 @opindex mstack-increment
21377 Set the maximum amount for a single stack increment operation. Large
21378 values can increase the speed of programs that contain functions
21379 that need a large amount of stack space, but they can also trigger a
21380 segmentation fault if the stack is extended too much. The default
21381 value is 0x1000.
21382
21383 @end table
21384
21385 @node MeP Options
21386 @subsection MeP Options
21387 @cindex MeP options
21388
21389 @table @gcctabopt
21390
21391 @item -mabsdiff
21392 @opindex mabsdiff
21393 Enables the @code{abs} instruction, which is the absolute difference
21394 between two registers.
21395
21396 @item -mall-opts
21397 @opindex mall-opts
21398 Enables all the optional instructions---average, multiply, divide, bit
21399 operations, leading zero, absolute difference, min/max, clip, and
21400 saturation.
21401
21402
21403 @item -maverage
21404 @opindex maverage
21405 Enables the @code{ave} instruction, which computes the average of two
21406 registers.
21407
21408 @item -mbased=@var{n}
21409 @opindex mbased=
21410 Variables of size @var{n} bytes or smaller are placed in the
21411 @code{.based} section by default. Based variables use the @code{$tp}
21412 register as a base register, and there is a 128-byte limit to the
21413 @code{.based} section.
21414
21415 @item -mbitops
21416 @opindex mbitops
21417 Enables the bit operation instructions---bit test (@code{btstm}), set
21418 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21419 test-and-set (@code{tas}).
21420
21421 @item -mc=@var{name}
21422 @opindex mc=
21423 Selects which section constant data is placed in. @var{name} may
21424 be @samp{tiny}, @samp{near}, or @samp{far}.
21425
21426 @item -mclip
21427 @opindex mclip
21428 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21429 useful unless you also provide @option{-mminmax}.
21430
21431 @item -mconfig=@var{name}
21432 @opindex mconfig=
21433 Selects one of the built-in core configurations. Each MeP chip has
21434 one or more modules in it; each module has a core CPU and a variety of
21435 coprocessors, optional instructions, and peripherals. The
21436 @code{MeP-Integrator} tool, not part of GCC, provides these
21437 configurations through this option; using this option is the same as
21438 using all the corresponding command-line options. The default
21439 configuration is @samp{default}.
21440
21441 @item -mcop
21442 @opindex mcop
21443 Enables the coprocessor instructions. By default, this is a 32-bit
21444 coprocessor. Note that the coprocessor is normally enabled via the
21445 @option{-mconfig=} option.
21446
21447 @item -mcop32
21448 @opindex mcop32
21449 Enables the 32-bit coprocessor's instructions.
21450
21451 @item -mcop64
21452 @opindex mcop64
21453 Enables the 64-bit coprocessor's instructions.
21454
21455 @item -mivc2
21456 @opindex mivc2
21457 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21458
21459 @item -mdc
21460 @opindex mdc
21461 Causes constant variables to be placed in the @code{.near} section.
21462
21463 @item -mdiv
21464 @opindex mdiv
21465 Enables the @code{div} and @code{divu} instructions.
21466
21467 @item -meb
21468 @opindex meb
21469 Generate big-endian code.
21470
21471 @item -mel
21472 @opindex mel
21473 Generate little-endian code.
21474
21475 @item -mio-volatile
21476 @opindex mio-volatile
21477 Tells the compiler that any variable marked with the @code{io}
21478 attribute is to be considered volatile.
21479
21480 @item -ml
21481 @opindex ml
21482 Causes variables to be assigned to the @code{.far} section by default.
21483
21484 @item -mleadz
21485 @opindex mleadz
21486 Enables the @code{leadz} (leading zero) instruction.
21487
21488 @item -mm
21489 @opindex mm
21490 Causes variables to be assigned to the @code{.near} section by default.
21491
21492 @item -mminmax
21493 @opindex mminmax
21494 Enables the @code{min} and @code{max} instructions.
21495
21496 @item -mmult
21497 @opindex mmult
21498 Enables the multiplication and multiply-accumulate instructions.
21499
21500 @item -mno-opts
21501 @opindex mno-opts
21502 Disables all the optional instructions enabled by @option{-mall-opts}.
21503
21504 @item -mrepeat
21505 @opindex mrepeat
21506 Enables the @code{repeat} and @code{erepeat} instructions, used for
21507 low-overhead looping.
21508
21509 @item -ms
21510 @opindex ms
21511 Causes all variables to default to the @code{.tiny} section. Note
21512 that there is a 65536-byte limit to this section. Accesses to these
21513 variables use the @code{%gp} base register.
21514
21515 @item -msatur
21516 @opindex msatur
21517 Enables the saturation instructions. Note that the compiler does not
21518 currently generate these itself, but this option is included for
21519 compatibility with other tools, like @code{as}.
21520
21521 @item -msdram
21522 @opindex msdram
21523 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21524
21525 @item -msim
21526 @opindex msim
21527 Link the simulator run-time libraries.
21528
21529 @item -msimnovec
21530 @opindex msimnovec
21531 Link the simulator runtime libraries, excluding built-in support
21532 for reset and exception vectors and tables.
21533
21534 @item -mtf
21535 @opindex mtf
21536 Causes all functions to default to the @code{.far} section. Without
21537 this option, functions default to the @code{.near} section.
21538
21539 @item -mtiny=@var{n}
21540 @opindex mtiny=
21541 Variables that are @var{n} bytes or smaller are allocated to the
21542 @code{.tiny} section. These variables use the @code{$gp} base
21543 register. The default for this option is 4, but note that there's a
21544 65536-byte limit to the @code{.tiny} section.
21545
21546 @end table
21547
21548 @node MicroBlaze Options
21549 @subsection MicroBlaze Options
21550 @cindex MicroBlaze Options
21551
21552 @table @gcctabopt
21553
21554 @item -msoft-float
21555 @opindex msoft-float
21556 Use software emulation for floating point (default).
21557
21558 @item -mhard-float
21559 @opindex mhard-float
21560 Use hardware floating-point instructions.
21561
21562 @item -mmemcpy
21563 @opindex mmemcpy
21564 Do not optimize block moves, use @code{memcpy}.
21565
21566 @item -mno-clearbss
21567 @opindex mno-clearbss
21568 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21569
21570 @item -mcpu=@var{cpu-type}
21571 @opindex mcpu=
21572 Use features of, and schedule code for, the given CPU.
21573 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21574 where @var{X} is a major version, @var{YY} is the minor version, and
21575 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21576 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21577
21578 @item -mxl-soft-mul
21579 @opindex mxl-soft-mul
21580 Use software multiply emulation (default).
21581
21582 @item -mxl-soft-div
21583 @opindex mxl-soft-div
21584 Use software emulation for divides (default).
21585
21586 @item -mxl-barrel-shift
21587 @opindex mxl-barrel-shift
21588 Use the hardware barrel shifter.
21589
21590 @item -mxl-pattern-compare
21591 @opindex mxl-pattern-compare
21592 Use pattern compare instructions.
21593
21594 @item -msmall-divides
21595 @opindex msmall-divides
21596 Use table lookup optimization for small signed integer divisions.
21597
21598 @item -mxl-stack-check
21599 @opindex mxl-stack-check
21600 This option is deprecated. Use @option{-fstack-check} instead.
21601
21602 @item -mxl-gp-opt
21603 @opindex mxl-gp-opt
21604 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21605
21606 @item -mxl-multiply-high
21607 @opindex mxl-multiply-high
21608 Use multiply high instructions for high part of 32x32 multiply.
21609
21610 @item -mxl-float-convert
21611 @opindex mxl-float-convert
21612 Use hardware floating-point conversion instructions.
21613
21614 @item -mxl-float-sqrt
21615 @opindex mxl-float-sqrt
21616 Use hardware floating-point square root instruction.
21617
21618 @item -mbig-endian
21619 @opindex mbig-endian
21620 Generate code for a big-endian target.
21621
21622 @item -mlittle-endian
21623 @opindex mlittle-endian
21624 Generate code for a little-endian target.
21625
21626 @item -mxl-reorder
21627 @opindex mxl-reorder
21628 Use reorder instructions (swap and byte reversed load/store).
21629
21630 @item -mxl-mode-@var{app-model}
21631 Select application model @var{app-model}. Valid models are
21632 @table @samp
21633 @item executable
21634 normal executable (default), uses startup code @file{crt0.o}.
21635
21636 @item -mpic-data-is-text-relative
21637 @opindex mpic-data-is-text-relative
21638 Assume that the displacement between the text and data segments is fixed
21639 at static link time. This allows data to be referenced by offset from start of
21640 text address instead of GOT since PC-relative addressing is not supported.
21641
21642 @item xmdstub
21643 for use with Xilinx Microprocessor Debugger (XMD) based
21644 software intrusive debug agent called xmdstub. This uses startup file
21645 @file{crt1.o} and sets the start address of the program to 0x800.
21646
21647 @item bootstrap
21648 for applications that are loaded using a bootloader.
21649 This model uses startup file @file{crt2.o} which does not contain a processor
21650 reset vector handler. This is suitable for transferring control on a
21651 processor reset to the bootloader rather than the application.
21652
21653 @item novectors
21654 for applications that do not require any of the
21655 MicroBlaze vectors. This option may be useful for applications running
21656 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21657 @end table
21658
21659 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21660 @option{-mxl-mode-@var{app-model}}.
21661
21662 @end table
21663
21664 @node MIPS Options
21665 @subsection MIPS Options
21666 @cindex MIPS options
21667
21668 @table @gcctabopt
21669
21670 @item -EB
21671 @opindex EB
21672 Generate big-endian code.
21673
21674 @item -EL
21675 @opindex EL
21676 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21677 configurations.
21678
21679 @item -march=@var{arch}
21680 @opindex march
21681 Generate code that runs on @var{arch}, which can be the name of a
21682 generic MIPS ISA, or the name of a particular processor.
21683 The ISA names are:
21684 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21685 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21686 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21687 @samp{mips64r5} and @samp{mips64r6}.
21688 The processor names are:
21689 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21690 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21691 @samp{5kc}, @samp{5kf},
21692 @samp{20kc},
21693 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21694 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21695 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21696 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21697 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21698 @samp{i6400}, @samp{i6500},
21699 @samp{interaptiv},
21700 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21701 @samp{gs464e}, @samp{gs264e},
21702 @samp{m4k},
21703 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21704 @samp{m5100}, @samp{m5101},
21705 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21706 @samp{orion},
21707 @samp{p5600}, @samp{p6600},
21708 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21709 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21710 @samp{r6000}, @samp{r8000},
21711 @samp{rm7000}, @samp{rm9000},
21712 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21713 @samp{sb1},
21714 @samp{sr71000},
21715 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21716 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21717 @samp{xlr} and @samp{xlp}.
21718 The special value @samp{from-abi} selects the
21719 most compatible architecture for the selected ABI (that is,
21720 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21721
21722 The native Linux/GNU toolchain also supports the value @samp{native},
21723 which selects the best architecture option for the host processor.
21724 @option{-march=native} has no effect if GCC does not recognize
21725 the processor.
21726
21727 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21728 (for example, @option{-march=r2k}). Prefixes are optional, and
21729 @samp{vr} may be written @samp{r}.
21730
21731 Names of the form @samp{@var{n}f2_1} refer to processors with
21732 FPUs clocked at half the rate of the core, names of the form
21733 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21734 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21735 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21736 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21737 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21738 accepted as synonyms for @samp{@var{n}f1_1}.
21739
21740 GCC defines two macros based on the value of this option. The first
21741 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21742 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21743 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21744 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21745 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21746
21747 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21748 above. In other words, it has the full prefix and does not
21749 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21750 the macro names the resolved architecture (either @code{"mips1"} or
21751 @code{"mips3"}). It names the default architecture when no
21752 @option{-march} option is given.
21753
21754 @item -mtune=@var{arch}
21755 @opindex mtune
21756 Optimize for @var{arch}. Among other things, this option controls
21757 the way instructions are scheduled, and the perceived cost of arithmetic
21758 operations. The list of @var{arch} values is the same as for
21759 @option{-march}.
21760
21761 When this option is not used, GCC optimizes for the processor
21762 specified by @option{-march}. By using @option{-march} and
21763 @option{-mtune} together, it is possible to generate code that
21764 runs on a family of processors, but optimize the code for one
21765 particular member of that family.
21766
21767 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21768 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21769 @option{-march} ones described above.
21770
21771 @item -mips1
21772 @opindex mips1
21773 Equivalent to @option{-march=mips1}.
21774
21775 @item -mips2
21776 @opindex mips2
21777 Equivalent to @option{-march=mips2}.
21778
21779 @item -mips3
21780 @opindex mips3
21781 Equivalent to @option{-march=mips3}.
21782
21783 @item -mips4
21784 @opindex mips4
21785 Equivalent to @option{-march=mips4}.
21786
21787 @item -mips32
21788 @opindex mips32
21789 Equivalent to @option{-march=mips32}.
21790
21791 @item -mips32r3
21792 @opindex mips32r3
21793 Equivalent to @option{-march=mips32r3}.
21794
21795 @item -mips32r5
21796 @opindex mips32r5
21797 Equivalent to @option{-march=mips32r5}.
21798
21799 @item -mips32r6
21800 @opindex mips32r6
21801 Equivalent to @option{-march=mips32r6}.
21802
21803 @item -mips64
21804 @opindex mips64
21805 Equivalent to @option{-march=mips64}.
21806
21807 @item -mips64r2
21808 @opindex mips64r2
21809 Equivalent to @option{-march=mips64r2}.
21810
21811 @item -mips64r3
21812 @opindex mips64r3
21813 Equivalent to @option{-march=mips64r3}.
21814
21815 @item -mips64r5
21816 @opindex mips64r5
21817 Equivalent to @option{-march=mips64r5}.
21818
21819 @item -mips64r6
21820 @opindex mips64r6
21821 Equivalent to @option{-march=mips64r6}.
21822
21823 @item -mips16
21824 @itemx -mno-mips16
21825 @opindex mips16
21826 @opindex mno-mips16
21827 Generate (do not generate) MIPS16 code. If GCC is targeting a
21828 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21829
21830 MIPS16 code generation can also be controlled on a per-function basis
21831 by means of @code{mips16} and @code{nomips16} attributes.
21832 @xref{Function Attributes}, for more information.
21833
21834 @item -mflip-mips16
21835 @opindex mflip-mips16
21836 Generate MIPS16 code on alternating functions. This option is provided
21837 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21838 not intended for ordinary use in compiling user code.
21839
21840 @item -minterlink-compressed
21841 @itemx -mno-interlink-compressed
21842 @opindex minterlink-compressed
21843 @opindex mno-interlink-compressed
21844 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21845 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21846
21847 For example, code using the standard ISA encoding cannot jump directly
21848 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21849 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21850 knows that the target of the jump is not compressed.
21851
21852 @item -minterlink-mips16
21853 @itemx -mno-interlink-mips16
21854 @opindex minterlink-mips16
21855 @opindex mno-interlink-mips16
21856 Aliases of @option{-minterlink-compressed} and
21857 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21858 and are retained for backwards compatibility.
21859
21860 @item -mabi=32
21861 @itemx -mabi=o64
21862 @itemx -mabi=n32
21863 @itemx -mabi=64
21864 @itemx -mabi=eabi
21865 @opindex mabi=32
21866 @opindex mabi=o64
21867 @opindex mabi=n32
21868 @opindex mabi=64
21869 @opindex mabi=eabi
21870 Generate code for the given ABI@.
21871
21872 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21873 generates 64-bit code when you select a 64-bit architecture, but you
21874 can use @option{-mgp32} to get 32-bit code instead.
21875
21876 For information about the O64 ABI, see
21877 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21878
21879 GCC supports a variant of the o32 ABI in which floating-point registers
21880 are 64 rather than 32 bits wide. You can select this combination with
21881 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21882 and @code{mfhc1} instructions and is therefore only supported for
21883 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21884
21885 The register assignments for arguments and return values remain the
21886 same, but each scalar value is passed in a single 64-bit register
21887 rather than a pair of 32-bit registers. For example, scalar
21888 floating-point values are returned in @samp{$f0} only, not a
21889 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21890 remains the same in that the even-numbered double-precision registers
21891 are saved.
21892
21893 Two additional variants of the o32 ABI are supported to enable
21894 a transition from 32-bit to 64-bit registers. These are FPXX
21895 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21896 The FPXX extension mandates that all code must execute correctly
21897 when run using 32-bit or 64-bit registers. The code can be interlinked
21898 with either FP32 or FP64, but not both.
21899 The FP64A extension is similar to the FP64 extension but forbids the
21900 use of odd-numbered single-precision registers. This can be used
21901 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21902 processors and allows both FP32 and FP64A code to interlink and
21903 run in the same process without changing FPU modes.
21904
21905 @item -mabicalls
21906 @itemx -mno-abicalls
21907 @opindex mabicalls
21908 @opindex mno-abicalls
21909 Generate (do not generate) code that is suitable for SVR4-style
21910 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21911 systems.
21912
21913 @item -mshared
21914 @itemx -mno-shared
21915 Generate (do not generate) code that is fully position-independent,
21916 and that can therefore be linked into shared libraries. This option
21917 only affects @option{-mabicalls}.
21918
21919 All @option{-mabicalls} code has traditionally been position-independent,
21920 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21921 as an extension, the GNU toolchain allows executables to use absolute
21922 accesses for locally-binding symbols. It can also use shorter GP
21923 initialization sequences and generate direct calls to locally-defined
21924 functions. This mode is selected by @option{-mno-shared}.
21925
21926 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21927 objects that can only be linked by the GNU linker. However, the option
21928 does not affect the ABI of the final executable; it only affects the ABI
21929 of relocatable objects. Using @option{-mno-shared} generally makes
21930 executables both smaller and quicker.
21931
21932 @option{-mshared} is the default.
21933
21934 @item -mplt
21935 @itemx -mno-plt
21936 @opindex mplt
21937 @opindex mno-plt
21938 Assume (do not assume) that the static and dynamic linkers
21939 support PLTs and copy relocations. This option only affects
21940 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21941 has no effect without @option{-msym32}.
21942
21943 You can make @option{-mplt} the default by configuring
21944 GCC with @option{--with-mips-plt}. The default is
21945 @option{-mno-plt} otherwise.
21946
21947 @item -mxgot
21948 @itemx -mno-xgot
21949 @opindex mxgot
21950 @opindex mno-xgot
21951 Lift (do not lift) the usual restrictions on the size of the global
21952 offset table.
21953
21954 GCC normally uses a single instruction to load values from the GOT@.
21955 While this is relatively efficient, it only works if the GOT
21956 is smaller than about 64k. Anything larger causes the linker
21957 to report an error such as:
21958
21959 @cindex relocation truncated to fit (MIPS)
21960 @smallexample
21961 relocation truncated to fit: R_MIPS_GOT16 foobar
21962 @end smallexample
21963
21964 If this happens, you should recompile your code with @option{-mxgot}.
21965 This works with very large GOTs, although the code is also
21966 less efficient, since it takes three instructions to fetch the
21967 value of a global symbol.
21968
21969 Note that some linkers can create multiple GOTs. If you have such a
21970 linker, you should only need to use @option{-mxgot} when a single object
21971 file accesses more than 64k's worth of GOT entries. Very few do.
21972
21973 These options have no effect unless GCC is generating position
21974 independent code.
21975
21976 @item -mgp32
21977 @opindex mgp32
21978 Assume that general-purpose registers are 32 bits wide.
21979
21980 @item -mgp64
21981 @opindex mgp64
21982 Assume that general-purpose registers are 64 bits wide.
21983
21984 @item -mfp32
21985 @opindex mfp32
21986 Assume that floating-point registers are 32 bits wide.
21987
21988 @item -mfp64
21989 @opindex mfp64
21990 Assume that floating-point registers are 64 bits wide.
21991
21992 @item -mfpxx
21993 @opindex mfpxx
21994 Do not assume the width of floating-point registers.
21995
21996 @item -mhard-float
21997 @opindex mhard-float
21998 Use floating-point coprocessor instructions.
21999
22000 @item -msoft-float
22001 @opindex msoft-float
22002 Do not use floating-point coprocessor instructions. Implement
22003 floating-point calculations using library calls instead.
22004
22005 @item -mno-float
22006 @opindex mno-float
22007 Equivalent to @option{-msoft-float}, but additionally asserts that the
22008 program being compiled does not perform any floating-point operations.
22009 This option is presently supported only by some bare-metal MIPS
22010 configurations, where it may select a special set of libraries
22011 that lack all floating-point support (including, for example, the
22012 floating-point @code{printf} formats).
22013 If code compiled with @option{-mno-float} accidentally contains
22014 floating-point operations, it is likely to suffer a link-time
22015 or run-time failure.
22016
22017 @item -msingle-float
22018 @opindex msingle-float
22019 Assume that the floating-point coprocessor only supports single-precision
22020 operations.
22021
22022 @item -mdouble-float
22023 @opindex mdouble-float
22024 Assume that the floating-point coprocessor supports double-precision
22025 operations. This is the default.
22026
22027 @item -modd-spreg
22028 @itemx -mno-odd-spreg
22029 @opindex modd-spreg
22030 @opindex mno-odd-spreg
22031 Enable the use of odd-numbered single-precision floating-point registers
22032 for the o32 ABI. This is the default for processors that are known to
22033 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22034 is set by default.
22035
22036 @item -mabs=2008
22037 @itemx -mabs=legacy
22038 @opindex mabs=2008
22039 @opindex mabs=legacy
22040 These options control the treatment of the special not-a-number (NaN)
22041 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22042 @code{neg.@i{fmt}} machine instructions.
22043
22044 By default or when @option{-mabs=legacy} is used the legacy
22045 treatment is selected. In this case these instructions are considered
22046 arithmetic and avoided where correct operation is required and the
22047 input operand might be a NaN. A longer sequence of instructions that
22048 manipulate the sign bit of floating-point datum manually is used
22049 instead unless the @option{-ffinite-math-only} option has also been
22050 specified.
22051
22052 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22053 this case these instructions are considered non-arithmetic and therefore
22054 operating correctly in all cases, including in particular where the
22055 input operand is a NaN. These instructions are therefore always used
22056 for the respective operations.
22057
22058 @item -mnan=2008
22059 @itemx -mnan=legacy
22060 @opindex mnan=2008
22061 @opindex mnan=legacy
22062 These options control the encoding of the special not-a-number (NaN)
22063 IEEE 754 floating-point data.
22064
22065 The @option{-mnan=legacy} option selects the legacy encoding. In this
22066 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22067 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22068 by the first bit of their trailing significand field being 1.
22069
22070 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22071 this case qNaNs are denoted by the first bit of their trailing
22072 significand field being 1, whereas sNaNs are denoted by the first bit of
22073 their trailing significand field being 0.
22074
22075 The default is @option{-mnan=legacy} unless GCC has been configured with
22076 @option{--with-nan=2008}.
22077
22078 @item -mllsc
22079 @itemx -mno-llsc
22080 @opindex mllsc
22081 @opindex mno-llsc
22082 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22083 implement atomic memory built-in functions. When neither option is
22084 specified, GCC uses the instructions if the target architecture
22085 supports them.
22086
22087 @option{-mllsc} is useful if the runtime environment can emulate the
22088 instructions and @option{-mno-llsc} can be useful when compiling for
22089 nonstandard ISAs. You can make either option the default by
22090 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22091 respectively. @option{--with-llsc} is the default for some
22092 configurations; see the installation documentation for details.
22093
22094 @item -mdsp
22095 @itemx -mno-dsp
22096 @opindex mdsp
22097 @opindex mno-dsp
22098 Use (do not use) revision 1 of the MIPS DSP ASE@.
22099 @xref{MIPS DSP Built-in Functions}. This option defines the
22100 preprocessor macro @code{__mips_dsp}. It also defines
22101 @code{__mips_dsp_rev} to 1.
22102
22103 @item -mdspr2
22104 @itemx -mno-dspr2
22105 @opindex mdspr2
22106 @opindex mno-dspr2
22107 Use (do not use) revision 2 of the MIPS DSP ASE@.
22108 @xref{MIPS DSP Built-in Functions}. This option defines the
22109 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22110 It also defines @code{__mips_dsp_rev} to 2.
22111
22112 @item -msmartmips
22113 @itemx -mno-smartmips
22114 @opindex msmartmips
22115 @opindex mno-smartmips
22116 Use (do not use) the MIPS SmartMIPS ASE.
22117
22118 @item -mpaired-single
22119 @itemx -mno-paired-single
22120 @opindex mpaired-single
22121 @opindex mno-paired-single
22122 Use (do not use) paired-single floating-point instructions.
22123 @xref{MIPS Paired-Single Support}. This option requires
22124 hardware floating-point support to be enabled.
22125
22126 @item -mdmx
22127 @itemx -mno-mdmx
22128 @opindex mdmx
22129 @opindex mno-mdmx
22130 Use (do not use) MIPS Digital Media Extension instructions.
22131 This option can only be used when generating 64-bit code and requires
22132 hardware floating-point support to be enabled.
22133
22134 @item -mips3d
22135 @itemx -mno-mips3d
22136 @opindex mips3d
22137 @opindex mno-mips3d
22138 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22139 The option @option{-mips3d} implies @option{-mpaired-single}.
22140
22141 @item -mmicromips
22142 @itemx -mno-micromips
22143 @opindex mmicromips
22144 @opindex mno-mmicromips
22145 Generate (do not generate) microMIPS code.
22146
22147 MicroMIPS code generation can also be controlled on a per-function basis
22148 by means of @code{micromips} and @code{nomicromips} attributes.
22149 @xref{Function Attributes}, for more information.
22150
22151 @item -mmt
22152 @itemx -mno-mt
22153 @opindex mmt
22154 @opindex mno-mt
22155 Use (do not use) MT Multithreading instructions.
22156
22157 @item -mmcu
22158 @itemx -mno-mcu
22159 @opindex mmcu
22160 @opindex mno-mcu
22161 Use (do not use) the MIPS MCU ASE instructions.
22162
22163 @item -meva
22164 @itemx -mno-eva
22165 @opindex meva
22166 @opindex mno-eva
22167 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22168
22169 @item -mvirt
22170 @itemx -mno-virt
22171 @opindex mvirt
22172 @opindex mno-virt
22173 Use (do not use) the MIPS Virtualization (VZ) instructions.
22174
22175 @item -mxpa
22176 @itemx -mno-xpa
22177 @opindex mxpa
22178 @opindex mno-xpa
22179 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22180
22181 @item -mcrc
22182 @itemx -mno-crc
22183 @opindex mcrc
22184 @opindex mno-crc
22185 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22186
22187 @item -mginv
22188 @itemx -mno-ginv
22189 @opindex mginv
22190 @opindex mno-ginv
22191 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22192
22193 @item -mloongson-mmi
22194 @itemx -mno-loongson-mmi
22195 @opindex mloongson-mmi
22196 @opindex mno-loongson-mmi
22197 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22198
22199 @item -mloongson-ext
22200 @itemx -mno-loongson-ext
22201 @opindex mloongson-ext
22202 @opindex mno-loongson-ext
22203 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22204
22205 @item -mloongson-ext2
22206 @itemx -mno-loongson-ext2
22207 @opindex mloongson-ext2
22208 @opindex mno-loongson-ext2
22209 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22210
22211 @item -mlong64
22212 @opindex mlong64
22213 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22214 an explanation of the default and the way that the pointer size is
22215 determined.
22216
22217 @item -mlong32
22218 @opindex mlong32
22219 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22220
22221 The default size of @code{int}s, @code{long}s and pointers depends on
22222 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22223 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22224 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22225 or the same size as integer registers, whichever is smaller.
22226
22227 @item -msym32
22228 @itemx -mno-sym32
22229 @opindex msym32
22230 @opindex mno-sym32
22231 Assume (do not assume) that all symbols have 32-bit values, regardless
22232 of the selected ABI@. This option is useful in combination with
22233 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22234 to generate shorter and faster references to symbolic addresses.
22235
22236 @item -G @var{num}
22237 @opindex G
22238 Put definitions of externally-visible data in a small data section
22239 if that data is no bigger than @var{num} bytes. GCC can then generate
22240 more efficient accesses to the data; see @option{-mgpopt} for details.
22241
22242 The default @option{-G} option depends on the configuration.
22243
22244 @item -mlocal-sdata
22245 @itemx -mno-local-sdata
22246 @opindex mlocal-sdata
22247 @opindex mno-local-sdata
22248 Extend (do not extend) the @option{-G} behavior to local data too,
22249 such as to static variables in C@. @option{-mlocal-sdata} is the
22250 default for all configurations.
22251
22252 If the linker complains that an application is using too much small data,
22253 you might want to try rebuilding the less performance-critical parts with
22254 @option{-mno-local-sdata}. You might also want to build large
22255 libraries with @option{-mno-local-sdata}, so that the libraries leave
22256 more room for the main program.
22257
22258 @item -mextern-sdata
22259 @itemx -mno-extern-sdata
22260 @opindex mextern-sdata
22261 @opindex mno-extern-sdata
22262 Assume (do not assume) that externally-defined data is in
22263 a small data section if the size of that data is within the @option{-G} limit.
22264 @option{-mextern-sdata} is the default for all configurations.
22265
22266 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22267 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22268 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22269 is placed in a small data section. If @var{Var} is defined by another
22270 module, you must either compile that module with a high-enough
22271 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22272 definition. If @var{Var} is common, you must link the application
22273 with a high-enough @option{-G} setting.
22274
22275 The easiest way of satisfying these restrictions is to compile
22276 and link every module with the same @option{-G} option. However,
22277 you may wish to build a library that supports several different
22278 small data limits. You can do this by compiling the library with
22279 the highest supported @option{-G} setting and additionally using
22280 @option{-mno-extern-sdata} to stop the library from making assumptions
22281 about externally-defined data.
22282
22283 @item -mgpopt
22284 @itemx -mno-gpopt
22285 @opindex mgpopt
22286 @opindex mno-gpopt
22287 Use (do not use) GP-relative accesses for symbols that are known to be
22288 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22289 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22290 configurations.
22291
22292 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22293 might not hold the value of @code{_gp}. For example, if the code is
22294 part of a library that might be used in a boot monitor, programs that
22295 call boot monitor routines pass an unknown value in @code{$gp}.
22296 (In such situations, the boot monitor itself is usually compiled
22297 with @option{-G0}.)
22298
22299 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22300 @option{-mno-extern-sdata}.
22301
22302 @item -membedded-data
22303 @itemx -mno-embedded-data
22304 @opindex membedded-data
22305 @opindex mno-embedded-data
22306 Allocate variables to the read-only data section first if possible, then
22307 next in the small data section if possible, otherwise in data. This gives
22308 slightly slower code than the default, but reduces the amount of RAM required
22309 when executing, and thus may be preferred for some embedded systems.
22310
22311 @item -muninit-const-in-rodata
22312 @itemx -mno-uninit-const-in-rodata
22313 @opindex muninit-const-in-rodata
22314 @opindex mno-uninit-const-in-rodata
22315 Put uninitialized @code{const} variables in the read-only data section.
22316 This option is only meaningful in conjunction with @option{-membedded-data}.
22317
22318 @item -mcode-readable=@var{setting}
22319 @opindex mcode-readable
22320 Specify whether GCC may generate code that reads from executable sections.
22321 There are three possible settings:
22322
22323 @table @gcctabopt
22324 @item -mcode-readable=yes
22325 Instructions may freely access executable sections. This is the
22326 default setting.
22327
22328 @item -mcode-readable=pcrel
22329 MIPS16 PC-relative load instructions can access executable sections,
22330 but other instructions must not do so. This option is useful on 4KSc
22331 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22332 It is also useful on processors that can be configured to have a dual
22333 instruction/data SRAM interface and that, like the M4K, automatically
22334 redirect PC-relative loads to the instruction RAM.
22335
22336 @item -mcode-readable=no
22337 Instructions must not access executable sections. This option can be
22338 useful on targets that are configured to have a dual instruction/data
22339 SRAM interface but that (unlike the M4K) do not automatically redirect
22340 PC-relative loads to the instruction RAM.
22341 @end table
22342
22343 @item -msplit-addresses
22344 @itemx -mno-split-addresses
22345 @opindex msplit-addresses
22346 @opindex mno-split-addresses
22347 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22348 relocation operators. This option has been superseded by
22349 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22350
22351 @item -mexplicit-relocs
22352 @itemx -mno-explicit-relocs
22353 @opindex mexplicit-relocs
22354 @opindex mno-explicit-relocs
22355 Use (do not use) assembler relocation operators when dealing with symbolic
22356 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22357 is to use assembler macros instead.
22358
22359 @option{-mexplicit-relocs} is the default if GCC was configured
22360 to use an assembler that supports relocation operators.
22361
22362 @item -mcheck-zero-division
22363 @itemx -mno-check-zero-division
22364 @opindex mcheck-zero-division
22365 @opindex mno-check-zero-division
22366 Trap (do not trap) on integer division by zero.
22367
22368 The default is @option{-mcheck-zero-division}.
22369
22370 @item -mdivide-traps
22371 @itemx -mdivide-breaks
22372 @opindex mdivide-traps
22373 @opindex mdivide-breaks
22374 MIPS systems check for division by zero by generating either a
22375 conditional trap or a break instruction. Using traps results in
22376 smaller code, but is only supported on MIPS II and later. Also, some
22377 versions of the Linux kernel have a bug that prevents trap from
22378 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22379 allow conditional traps on architectures that support them and
22380 @option{-mdivide-breaks} to force the use of breaks.
22381
22382 The default is usually @option{-mdivide-traps}, but this can be
22383 overridden at configure time using @option{--with-divide=breaks}.
22384 Divide-by-zero checks can be completely disabled using
22385 @option{-mno-check-zero-division}.
22386
22387 @item -mload-store-pairs
22388 @itemx -mno-load-store-pairs
22389 @opindex mload-store-pairs
22390 @opindex mno-load-store-pairs
22391 Enable (disable) an optimization that pairs consecutive load or store
22392 instructions to enable load/store bonding. This option is enabled by
22393 default but only takes effect when the selected architecture is known
22394 to support bonding.
22395
22396 @item -mmemcpy
22397 @itemx -mno-memcpy
22398 @opindex mmemcpy
22399 @opindex mno-memcpy
22400 Force (do not force) the use of @code{memcpy} for non-trivial block
22401 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22402 most constant-sized copies.
22403
22404 @item -mlong-calls
22405 @itemx -mno-long-calls
22406 @opindex mlong-calls
22407 @opindex mno-long-calls
22408 Disable (do not disable) use of the @code{jal} instruction. Calling
22409 functions using @code{jal} is more efficient but requires the caller
22410 and callee to be in the same 256 megabyte segment.
22411
22412 This option has no effect on abicalls code. The default is
22413 @option{-mno-long-calls}.
22414
22415 @item -mmad
22416 @itemx -mno-mad
22417 @opindex mmad
22418 @opindex mno-mad
22419 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22420 instructions, as provided by the R4650 ISA@.
22421
22422 @item -mimadd
22423 @itemx -mno-imadd
22424 @opindex mimadd
22425 @opindex mno-imadd
22426 Enable (disable) use of the @code{madd} and @code{msub} integer
22427 instructions. The default is @option{-mimadd} on architectures
22428 that support @code{madd} and @code{msub} except for the 74k
22429 architecture where it was found to generate slower code.
22430
22431 @item -mfused-madd
22432 @itemx -mno-fused-madd
22433 @opindex mfused-madd
22434 @opindex mno-fused-madd
22435 Enable (disable) use of the floating-point multiply-accumulate
22436 instructions, when they are available. The default is
22437 @option{-mfused-madd}.
22438
22439 On the R8000 CPU when multiply-accumulate instructions are used,
22440 the intermediate product is calculated to infinite precision
22441 and is not subject to the FCSR Flush to Zero bit. This may be
22442 undesirable in some circumstances. On other processors the result
22443 is numerically identical to the equivalent computation using
22444 separate multiply, add, subtract and negate instructions.
22445
22446 @item -nocpp
22447 @opindex nocpp
22448 Tell the MIPS assembler to not run its preprocessor over user
22449 assembler files (with a @samp{.s} suffix) when assembling them.
22450
22451 @item -mfix-24k
22452 @itemx -mno-fix-24k
22453 @opindex mfix-24k
22454 @opindex mno-fix-24k
22455 Work around the 24K E48 (lost data on stores during refill) errata.
22456 The workarounds are implemented by the assembler rather than by GCC@.
22457
22458 @item -mfix-r4000
22459 @itemx -mno-fix-r4000
22460 @opindex mfix-r4000
22461 @opindex mno-fix-r4000
22462 Work around certain R4000 CPU errata:
22463 @itemize @minus
22464 @item
22465 A double-word or a variable shift may give an incorrect result if executed
22466 immediately after starting an integer division.
22467 @item
22468 A double-word or a variable shift may give an incorrect result if executed
22469 while an integer multiplication is in progress.
22470 @item
22471 An integer division may give an incorrect result if started in a delay slot
22472 of a taken branch or a jump.
22473 @end itemize
22474
22475 @item -mfix-r4400
22476 @itemx -mno-fix-r4400
22477 @opindex mfix-r4400
22478 @opindex mno-fix-r4400
22479 Work around certain R4400 CPU errata:
22480 @itemize @minus
22481 @item
22482 A double-word or a variable shift may give an incorrect result if executed
22483 immediately after starting an integer division.
22484 @end itemize
22485
22486 @item -mfix-r10000
22487 @itemx -mno-fix-r10000
22488 @opindex mfix-r10000
22489 @opindex mno-fix-r10000
22490 Work around certain R10000 errata:
22491 @itemize @minus
22492 @item
22493 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22494 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22495 @end itemize
22496
22497 This option can only be used if the target architecture supports
22498 branch-likely instructions. @option{-mfix-r10000} is the default when
22499 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22500 otherwise.
22501
22502 @item -mfix-r5900
22503 @itemx -mno-fix-r5900
22504 @opindex mfix-r5900
22505 Do not attempt to schedule the preceding instruction into the delay slot
22506 of a branch instruction placed at the end of a short loop of six
22507 instructions or fewer and always schedule a @code{nop} instruction there
22508 instead. The short loop bug under certain conditions causes loops to
22509 execute only once or twice, due to a hardware bug in the R5900 chip. The
22510 workaround is implemented by the assembler rather than by GCC@.
22511
22512 @item -mfix-rm7000
22513 @itemx -mno-fix-rm7000
22514 @opindex mfix-rm7000
22515 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22516 workarounds are implemented by the assembler rather than by GCC@.
22517
22518 @item -mfix-vr4120
22519 @itemx -mno-fix-vr4120
22520 @opindex mfix-vr4120
22521 Work around certain VR4120 errata:
22522 @itemize @minus
22523 @item
22524 @code{dmultu} does not always produce the correct result.
22525 @item
22526 @code{div} and @code{ddiv} do not always produce the correct result if one
22527 of the operands is negative.
22528 @end itemize
22529 The workarounds for the division errata rely on special functions in
22530 @file{libgcc.a}. At present, these functions are only provided by
22531 the @code{mips64vr*-elf} configurations.
22532
22533 Other VR4120 errata require a NOP to be inserted between certain pairs of
22534 instructions. These errata are handled by the assembler, not by GCC itself.
22535
22536 @item -mfix-vr4130
22537 @opindex mfix-vr4130
22538 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22539 workarounds are implemented by the assembler rather than by GCC,
22540 although GCC avoids using @code{mflo} and @code{mfhi} if the
22541 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22542 instructions are available instead.
22543
22544 @item -mfix-sb1
22545 @itemx -mno-fix-sb1
22546 @opindex mfix-sb1
22547 Work around certain SB-1 CPU core errata.
22548 (This flag currently works around the SB-1 revision 2
22549 ``F1'' and ``F2'' floating-point errata.)
22550
22551 @item -mr10k-cache-barrier=@var{setting}
22552 @opindex mr10k-cache-barrier
22553 Specify whether GCC should insert cache barriers to avoid the
22554 side effects of speculation on R10K processors.
22555
22556 In common with many processors, the R10K tries to predict the outcome
22557 of a conditional branch and speculatively executes instructions from
22558 the ``taken'' branch. It later aborts these instructions if the
22559 predicted outcome is wrong. However, on the R10K, even aborted
22560 instructions can have side effects.
22561
22562 This problem only affects kernel stores and, depending on the system,
22563 kernel loads. As an example, a speculatively-executed store may load
22564 the target memory into cache and mark the cache line as dirty, even if
22565 the store itself is later aborted. If a DMA operation writes to the
22566 same area of memory before the ``dirty'' line is flushed, the cached
22567 data overwrites the DMA-ed data. See the R10K processor manual
22568 for a full description, including other potential problems.
22569
22570 One workaround is to insert cache barrier instructions before every memory
22571 access that might be speculatively executed and that might have side
22572 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22573 controls GCC's implementation of this workaround. It assumes that
22574 aborted accesses to any byte in the following regions does not have
22575 side effects:
22576
22577 @enumerate
22578 @item
22579 the memory occupied by the current function's stack frame;
22580
22581 @item
22582 the memory occupied by an incoming stack argument;
22583
22584 @item
22585 the memory occupied by an object with a link-time-constant address.
22586 @end enumerate
22587
22588 It is the kernel's responsibility to ensure that speculative
22589 accesses to these regions are indeed safe.
22590
22591 If the input program contains a function declaration such as:
22592
22593 @smallexample
22594 void foo (void);
22595 @end smallexample
22596
22597 then the implementation of @code{foo} must allow @code{j foo} and
22598 @code{jal foo} to be executed speculatively. GCC honors this
22599 restriction for functions it compiles itself. It expects non-GCC
22600 functions (such as hand-written assembly code) to do the same.
22601
22602 The option has three forms:
22603
22604 @table @gcctabopt
22605 @item -mr10k-cache-barrier=load-store
22606 Insert a cache barrier before a load or store that might be
22607 speculatively executed and that might have side effects even
22608 if aborted.
22609
22610 @item -mr10k-cache-barrier=store
22611 Insert a cache barrier before a store that might be speculatively
22612 executed and that might have side effects even if aborted.
22613
22614 @item -mr10k-cache-barrier=none
22615 Disable the insertion of cache barriers. This is the default setting.
22616 @end table
22617
22618 @item -mflush-func=@var{func}
22619 @itemx -mno-flush-func
22620 @opindex mflush-func
22621 Specifies the function to call to flush the I and D caches, or to not
22622 call any such function. If called, the function must take the same
22623 arguments as the common @code{_flush_func}, that is, the address of the
22624 memory range for which the cache is being flushed, the size of the
22625 memory range, and the number 3 (to flush both caches). The default
22626 depends on the target GCC was configured for, but commonly is either
22627 @code{_flush_func} or @code{__cpu_flush}.
22628
22629 @item mbranch-cost=@var{num}
22630 @opindex mbranch-cost
22631 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22632 This cost is only a heuristic and is not guaranteed to produce
22633 consistent results across releases. A zero cost redundantly selects
22634 the default, which is based on the @option{-mtune} setting.
22635
22636 @item -mbranch-likely
22637 @itemx -mno-branch-likely
22638 @opindex mbranch-likely
22639 @opindex mno-branch-likely
22640 Enable or disable use of Branch Likely instructions, regardless of the
22641 default for the selected architecture. By default, Branch Likely
22642 instructions may be generated if they are supported by the selected
22643 architecture. An exception is for the MIPS32 and MIPS64 architectures
22644 and processors that implement those architectures; for those, Branch
22645 Likely instructions are not be generated by default because the MIPS32
22646 and MIPS64 architectures specifically deprecate their use.
22647
22648 @item -mcompact-branches=never
22649 @itemx -mcompact-branches=optimal
22650 @itemx -mcompact-branches=always
22651 @opindex mcompact-branches=never
22652 @opindex mcompact-branches=optimal
22653 @opindex mcompact-branches=always
22654 These options control which form of branches will be generated. The
22655 default is @option{-mcompact-branches=optimal}.
22656
22657 The @option{-mcompact-branches=never} option ensures that compact branch
22658 instructions will never be generated.
22659
22660 The @option{-mcompact-branches=always} option ensures that a compact
22661 branch instruction will be generated if available. If a compact branch
22662 instruction is not available, a delay slot form of the branch will be
22663 used instead.
22664
22665 This option is supported from MIPS Release 6 onwards.
22666
22667 The @option{-mcompact-branches=optimal} option will cause a delay slot
22668 branch to be used if one is available in the current ISA and the delay
22669 slot is successfully filled. If the delay slot is not filled, a compact
22670 branch will be chosen if one is available.
22671
22672 @item -mfp-exceptions
22673 @itemx -mno-fp-exceptions
22674 @opindex mfp-exceptions
22675 Specifies whether FP exceptions are enabled. This affects how
22676 FP instructions are scheduled for some processors.
22677 The default is that FP exceptions are
22678 enabled.
22679
22680 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22681 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22682 FP pipe.
22683
22684 @item -mvr4130-align
22685 @itemx -mno-vr4130-align
22686 @opindex mvr4130-align
22687 The VR4130 pipeline is two-way superscalar, but can only issue two
22688 instructions together if the first one is 8-byte aligned. When this
22689 option is enabled, GCC aligns pairs of instructions that it
22690 thinks should execute in parallel.
22691
22692 This option only has an effect when optimizing for the VR4130.
22693 It normally makes code faster, but at the expense of making it bigger.
22694 It is enabled by default at optimization level @option{-O3}.
22695
22696 @item -msynci
22697 @itemx -mno-synci
22698 @opindex msynci
22699 Enable (disable) generation of @code{synci} instructions on
22700 architectures that support it. The @code{synci} instructions (if
22701 enabled) are generated when @code{__builtin___clear_cache} is
22702 compiled.
22703
22704 This option defaults to @option{-mno-synci}, but the default can be
22705 overridden by configuring GCC with @option{--with-synci}.
22706
22707 When compiling code for single processor systems, it is generally safe
22708 to use @code{synci}. However, on many multi-core (SMP) systems, it
22709 does not invalidate the instruction caches on all cores and may lead
22710 to undefined behavior.
22711
22712 @item -mrelax-pic-calls
22713 @itemx -mno-relax-pic-calls
22714 @opindex mrelax-pic-calls
22715 Try to turn PIC calls that are normally dispatched via register
22716 @code{$25} into direct calls. This is only possible if the linker can
22717 resolve the destination at link time and if the destination is within
22718 range for a direct call.
22719
22720 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22721 an assembler and a linker that support the @code{.reloc} assembly
22722 directive and @option{-mexplicit-relocs} is in effect. With
22723 @option{-mno-explicit-relocs}, this optimization can be performed by the
22724 assembler and the linker alone without help from the compiler.
22725
22726 @item -mmcount-ra-address
22727 @itemx -mno-mcount-ra-address
22728 @opindex mmcount-ra-address
22729 @opindex mno-mcount-ra-address
22730 Emit (do not emit) code that allows @code{_mcount} to modify the
22731 calling function's return address. When enabled, this option extends
22732 the usual @code{_mcount} interface with a new @var{ra-address}
22733 parameter, which has type @code{intptr_t *} and is passed in register
22734 @code{$12}. @code{_mcount} can then modify the return address by
22735 doing both of the following:
22736 @itemize
22737 @item
22738 Returning the new address in register @code{$31}.
22739 @item
22740 Storing the new address in @code{*@var{ra-address}},
22741 if @var{ra-address} is nonnull.
22742 @end itemize
22743
22744 The default is @option{-mno-mcount-ra-address}.
22745
22746 @item -mframe-header-opt
22747 @itemx -mno-frame-header-opt
22748 @opindex mframe-header-opt
22749 Enable (disable) frame header optimization in the o32 ABI. When using the
22750 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22751 function to write out register arguments. When enabled, this optimization
22752 will suppress the allocation of the frame header if it can be determined that
22753 it is unused.
22754
22755 This optimization is off by default at all optimization levels.
22756
22757 @item -mlxc1-sxc1
22758 @itemx -mno-lxc1-sxc1
22759 @opindex mlxc1-sxc1
22760 When applicable, enable (disable) the generation of @code{lwxc1},
22761 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22762
22763 @item -mmadd4
22764 @itemx -mno-madd4
22765 @opindex mmadd4
22766 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22767 @code{madd.d} and related instructions. Enabled by default.
22768
22769 @end table
22770
22771 @node MMIX Options
22772 @subsection MMIX Options
22773 @cindex MMIX Options
22774
22775 These options are defined for the MMIX:
22776
22777 @table @gcctabopt
22778 @item -mlibfuncs
22779 @itemx -mno-libfuncs
22780 @opindex mlibfuncs
22781 @opindex mno-libfuncs
22782 Specify that intrinsic library functions are being compiled, passing all
22783 values in registers, no matter the size.
22784
22785 @item -mepsilon
22786 @itemx -mno-epsilon
22787 @opindex mepsilon
22788 @opindex mno-epsilon
22789 Generate floating-point comparison instructions that compare with respect
22790 to the @code{rE} epsilon register.
22791
22792 @item -mabi=mmixware
22793 @itemx -mabi=gnu
22794 @opindex mabi=mmixware
22795 @opindex mabi=gnu
22796 Generate code that passes function parameters and return values that (in
22797 the called function) are seen as registers @code{$0} and up, as opposed to
22798 the GNU ABI which uses global registers @code{$231} and up.
22799
22800 @item -mzero-extend
22801 @itemx -mno-zero-extend
22802 @opindex mzero-extend
22803 @opindex mno-zero-extend
22804 When reading data from memory in sizes shorter than 64 bits, use (do not
22805 use) zero-extending load instructions by default, rather than
22806 sign-extending ones.
22807
22808 @item -mknuthdiv
22809 @itemx -mno-knuthdiv
22810 @opindex mknuthdiv
22811 @opindex mno-knuthdiv
22812 Make the result of a division yielding a remainder have the same sign as
22813 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22814 remainder follows the sign of the dividend. Both methods are
22815 arithmetically valid, the latter being almost exclusively used.
22816
22817 @item -mtoplevel-symbols
22818 @itemx -mno-toplevel-symbols
22819 @opindex mtoplevel-symbols
22820 @opindex mno-toplevel-symbols
22821 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22822 code can be used with the @code{PREFIX} assembly directive.
22823
22824 @item -melf
22825 @opindex melf
22826 Generate an executable in the ELF format, rather than the default
22827 @samp{mmo} format used by the @command{mmix} simulator.
22828
22829 @item -mbranch-predict
22830 @itemx -mno-branch-predict
22831 @opindex mbranch-predict
22832 @opindex mno-branch-predict
22833 Use (do not use) the probable-branch instructions, when static branch
22834 prediction indicates a probable branch.
22835
22836 @item -mbase-addresses
22837 @itemx -mno-base-addresses
22838 @opindex mbase-addresses
22839 @opindex mno-base-addresses
22840 Generate (do not generate) code that uses @emph{base addresses}. Using a
22841 base address automatically generates a request (handled by the assembler
22842 and the linker) for a constant to be set up in a global register. The
22843 register is used for one or more base address requests within the range 0
22844 to 255 from the value held in the register. The generally leads to short
22845 and fast code, but the number of different data items that can be
22846 addressed is limited. This means that a program that uses lots of static
22847 data may require @option{-mno-base-addresses}.
22848
22849 @item -msingle-exit
22850 @itemx -mno-single-exit
22851 @opindex msingle-exit
22852 @opindex mno-single-exit
22853 Force (do not force) generated code to have a single exit point in each
22854 function.
22855 @end table
22856
22857 @node MN10300 Options
22858 @subsection MN10300 Options
22859 @cindex MN10300 options
22860
22861 These @option{-m} options are defined for Matsushita MN10300 architectures:
22862
22863 @table @gcctabopt
22864 @item -mmult-bug
22865 @opindex mmult-bug
22866 Generate code to avoid bugs in the multiply instructions for the MN10300
22867 processors. This is the default.
22868
22869 @item -mno-mult-bug
22870 @opindex mno-mult-bug
22871 Do not generate code to avoid bugs in the multiply instructions for the
22872 MN10300 processors.
22873
22874 @item -mam33
22875 @opindex mam33
22876 Generate code using features specific to the AM33 processor.
22877
22878 @item -mno-am33
22879 @opindex mno-am33
22880 Do not generate code using features specific to the AM33 processor. This
22881 is the default.
22882
22883 @item -mam33-2
22884 @opindex mam33-2
22885 Generate code using features specific to the AM33/2.0 processor.
22886
22887 @item -mam34
22888 @opindex mam34
22889 Generate code using features specific to the AM34 processor.
22890
22891 @item -mtune=@var{cpu-type}
22892 @opindex mtune
22893 Use the timing characteristics of the indicated CPU type when
22894 scheduling instructions. This does not change the targeted processor
22895 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22896 @samp{am33-2} or @samp{am34}.
22897
22898 @item -mreturn-pointer-on-d0
22899 @opindex mreturn-pointer-on-d0
22900 When generating a function that returns a pointer, return the pointer
22901 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22902 only in @code{a0}, and attempts to call such functions without a prototype
22903 result in errors. Note that this option is on by default; use
22904 @option{-mno-return-pointer-on-d0} to disable it.
22905
22906 @item -mno-crt0
22907 @opindex mno-crt0
22908 Do not link in the C run-time initialization object file.
22909
22910 @item -mrelax
22911 @opindex mrelax
22912 Indicate to the linker that it should perform a relaxation optimization pass
22913 to shorten branches, calls and absolute memory addresses. This option only
22914 has an effect when used on the command line for the final link step.
22915
22916 This option makes symbolic debugging impossible.
22917
22918 @item -mliw
22919 @opindex mliw
22920 Allow the compiler to generate @emph{Long Instruction Word}
22921 instructions if the target is the @samp{AM33} or later. This is the
22922 default. This option defines the preprocessor macro @code{__LIW__}.
22923
22924 @item -mno-liw
22925 @opindex mno-liw
22926 Do not allow the compiler to generate @emph{Long Instruction Word}
22927 instructions. This option defines the preprocessor macro
22928 @code{__NO_LIW__}.
22929
22930 @item -msetlb
22931 @opindex msetlb
22932 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22933 instructions if the target is the @samp{AM33} or later. This is the
22934 default. This option defines the preprocessor macro @code{__SETLB__}.
22935
22936 @item -mno-setlb
22937 @opindex mno-setlb
22938 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22939 instructions. This option defines the preprocessor macro
22940 @code{__NO_SETLB__}.
22941
22942 @end table
22943
22944 @node Moxie Options
22945 @subsection Moxie Options
22946 @cindex Moxie Options
22947
22948 @table @gcctabopt
22949
22950 @item -meb
22951 @opindex meb
22952 Generate big-endian code. This is the default for @samp{moxie-*-*}
22953 configurations.
22954
22955 @item -mel
22956 @opindex mel
22957 Generate little-endian code.
22958
22959 @item -mmul.x
22960 @opindex mmul.x
22961 Generate mul.x and umul.x instructions. This is the default for
22962 @samp{moxiebox-*-*} configurations.
22963
22964 @item -mno-crt0
22965 @opindex mno-crt0
22966 Do not link in the C run-time initialization object file.
22967
22968 @end table
22969
22970 @node MSP430 Options
22971 @subsection MSP430 Options
22972 @cindex MSP430 Options
22973
22974 These options are defined for the MSP430:
22975
22976 @table @gcctabopt
22977
22978 @item -masm-hex
22979 @opindex masm-hex
22980 Force assembly output to always use hex constants. Normally such
22981 constants are signed decimals, but this option is available for
22982 testsuite and/or aesthetic purposes.
22983
22984 @item -mmcu=
22985 @opindex mmcu=
22986 Select the MCU to target. This is used to create a C preprocessor
22987 symbol based upon the MCU name, converted to upper case and pre- and
22988 post-fixed with @samp{__}. This in turn is used by the
22989 @file{msp430.h} header file to select an MCU-specific supplementary
22990 header file.
22991
22992 The option also sets the ISA to use. If the MCU name is one that is
22993 known to only support the 430 ISA then that is selected, otherwise the
22994 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22995 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22996 name selects the 430X ISA.
22997
22998 In addition an MCU-specific linker script is added to the linker
22999 command line. The script's name is the name of the MCU with
23000 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23001 command line defines the C preprocessor symbol @code{__XXX__} and
23002 cause the linker to search for a script called @file{xxx.ld}.
23003
23004 This option is also passed on to the assembler.
23005
23006 @item -mwarn-mcu
23007 @itemx -mno-warn-mcu
23008 @opindex mwarn-mcu
23009 @opindex mno-warn-mcu
23010 This option enables or disables warnings about conflicts between the
23011 MCU name specified by the @option{-mmcu} option and the ISA set by the
23012 @option{-mcpu} option and/or the hardware multiply support set by the
23013 @option{-mhwmult} option. It also toggles warnings about unrecognized
23014 MCU names. This option is on by default.
23015
23016 @item -mcpu=
23017 @opindex mcpu=
23018 Specifies the ISA to use. Accepted values are @samp{msp430},
23019 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23020 @option{-mmcu=} option should be used to select the ISA.
23021
23022 @item -msim
23023 @opindex msim
23024 Link to the simulator runtime libraries and linker script. Overrides
23025 any scripts that would be selected by the @option{-mmcu=} option.
23026
23027 @item -mlarge
23028 @opindex mlarge
23029 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23030
23031 @item -msmall
23032 @opindex msmall
23033 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23034
23035 @item -mrelax
23036 @opindex mrelax
23037 This option is passed to the assembler and linker, and allows the
23038 linker to perform certain optimizations that cannot be done until
23039 the final link.
23040
23041 @item mhwmult=
23042 @opindex mhwmult=
23043 Describes the type of hardware multiply supported by the target.
23044 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23045 for the original 16-bit-only multiply supported by early MCUs.
23046 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23047 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23048 A value of @samp{auto} can also be given. This tells GCC to deduce
23049 the hardware multiply support based upon the MCU name provided by the
23050 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23051 the MCU name is not recognized then no hardware multiply support is
23052 assumed. @code{auto} is the default setting.
23053
23054 Hardware multiplies are normally performed by calling a library
23055 routine. This saves space in the generated code. When compiling at
23056 @option{-O3} or higher however the hardware multiplier is invoked
23057 inline. This makes for bigger, but faster code.
23058
23059 The hardware multiply routines disable interrupts whilst running and
23060 restore the previous interrupt state when they finish. This makes
23061 them safe to use inside interrupt handlers as well as in normal code.
23062
23063 @item -minrt
23064 @opindex minrt
23065 Enable the use of a minimum runtime environment - no static
23066 initializers or constructors. This is intended for memory-constrained
23067 devices. The compiler includes special symbols in some objects
23068 that tell the linker and runtime which code fragments are required.
23069
23070 @item -mcode-region=
23071 @itemx -mdata-region=
23072 @opindex mcode-region
23073 @opindex mdata-region
23074 These options tell the compiler where to place functions and data that
23075 do not have one of the @code{lower}, @code{upper}, @code{either} or
23076 @code{section} attributes. Possible values are @code{lower},
23077 @code{upper}, @code{either} or @code{any}. The first three behave
23078 like the corresponding attribute. The fourth possible value -
23079 @code{any} - is the default. It leaves placement entirely up to the
23080 linker script and how it assigns the standard sections
23081 (@code{.text}, @code{.data}, etc) to the memory regions.
23082
23083 @item -msilicon-errata=
23084 @opindex msilicon-errata
23085 This option passes on a request to assembler to enable the fixes for
23086 the named silicon errata.
23087
23088 @item -msilicon-errata-warn=
23089 @opindex msilicon-errata-warn
23090 This option passes on a request to the assembler to enable warning
23091 messages when a silicon errata might need to be applied.
23092
23093 @end table
23094
23095 @node NDS32 Options
23096 @subsection NDS32 Options
23097 @cindex NDS32 Options
23098
23099 These options are defined for NDS32 implementations:
23100
23101 @table @gcctabopt
23102
23103 @item -mbig-endian
23104 @opindex mbig-endian
23105 Generate code in big-endian mode.
23106
23107 @item -mlittle-endian
23108 @opindex mlittle-endian
23109 Generate code in little-endian mode.
23110
23111 @item -mreduced-regs
23112 @opindex mreduced-regs
23113 Use reduced-set registers for register allocation.
23114
23115 @item -mfull-regs
23116 @opindex mfull-regs
23117 Use full-set registers for register allocation.
23118
23119 @item -mcmov
23120 @opindex mcmov
23121 Generate conditional move instructions.
23122
23123 @item -mno-cmov
23124 @opindex mno-cmov
23125 Do not generate conditional move instructions.
23126
23127 @item -mext-perf
23128 @opindex mext-perf
23129 Generate performance extension instructions.
23130
23131 @item -mno-ext-perf
23132 @opindex mno-ext-perf
23133 Do not generate performance extension instructions.
23134
23135 @item -mext-perf2
23136 @opindex mext-perf2
23137 Generate performance extension 2 instructions.
23138
23139 @item -mno-ext-perf2
23140 @opindex mno-ext-perf2
23141 Do not generate performance extension 2 instructions.
23142
23143 @item -mext-string
23144 @opindex mext-string
23145 Generate string extension instructions.
23146
23147 @item -mno-ext-string
23148 @opindex mno-ext-string
23149 Do not generate string extension instructions.
23150
23151 @item -mv3push
23152 @opindex mv3push
23153 Generate v3 push25/pop25 instructions.
23154
23155 @item -mno-v3push
23156 @opindex mno-v3push
23157 Do not generate v3 push25/pop25 instructions.
23158
23159 @item -m16-bit
23160 @opindex m16-bit
23161 Generate 16-bit instructions.
23162
23163 @item -mno-16-bit
23164 @opindex mno-16-bit
23165 Do not generate 16-bit instructions.
23166
23167 @item -misr-vector-size=@var{num}
23168 @opindex misr-vector-size
23169 Specify the size of each interrupt vector, which must be 4 or 16.
23170
23171 @item -mcache-block-size=@var{num}
23172 @opindex mcache-block-size
23173 Specify the size of each cache block,
23174 which must be a power of 2 between 4 and 512.
23175
23176 @item -march=@var{arch}
23177 @opindex march
23178 Specify the name of the target architecture.
23179
23180 @item -mcmodel=@var{code-model}
23181 @opindex mcmodel
23182 Set the code model to one of
23183 @table @asis
23184 @item @samp{small}
23185 All the data and read-only data segments must be within 512KB addressing space.
23186 The text segment must be within 16MB addressing space.
23187 @item @samp{medium}
23188 The data segment must be within 512KB while the read-only data segment can be
23189 within 4GB addressing space. The text segment should be still within 16MB
23190 addressing space.
23191 @item @samp{large}
23192 All the text and data segments can be within 4GB addressing space.
23193 @end table
23194
23195 @item -mctor-dtor
23196 @opindex mctor-dtor
23197 Enable constructor/destructor feature.
23198
23199 @item -mrelax
23200 @opindex mrelax
23201 Guide linker to relax instructions.
23202
23203 @end table
23204
23205 @node Nios II Options
23206 @subsection Nios II Options
23207 @cindex Nios II options
23208 @cindex Altera Nios II options
23209
23210 These are the options defined for the Altera Nios II processor.
23211
23212 @table @gcctabopt
23213
23214 @item -G @var{num}
23215 @opindex G
23216 @cindex smaller data references
23217 Put global and static objects less than or equal to @var{num} bytes
23218 into the small data or BSS sections instead of the normal data or BSS
23219 sections. The default value of @var{num} is 8.
23220
23221 @item -mgpopt=@var{option}
23222 @itemx -mgpopt
23223 @itemx -mno-gpopt
23224 @opindex mgpopt
23225 @opindex mno-gpopt
23226 Generate (do not generate) GP-relative accesses. The following
23227 @var{option} names are recognized:
23228
23229 @table @samp
23230
23231 @item none
23232 Do not generate GP-relative accesses.
23233
23234 @item local
23235 Generate GP-relative accesses for small data objects that are not
23236 external, weak, or uninitialized common symbols.
23237 Also use GP-relative addressing for objects that
23238 have been explicitly placed in a small data section via a @code{section}
23239 attribute.
23240
23241 @item global
23242 As for @samp{local}, but also generate GP-relative accesses for
23243 small data objects that are external, weak, or common. If you use this option,
23244 you must ensure that all parts of your program (including libraries) are
23245 compiled with the same @option{-G} setting.
23246
23247 @item data
23248 Generate GP-relative accesses for all data objects in the program. If you
23249 use this option, the entire data and BSS segments
23250 of your program must fit in 64K of memory and you must use an appropriate
23251 linker script to allocate them within the addressable range of the
23252 global pointer.
23253
23254 @item all
23255 Generate GP-relative addresses for function pointers as well as data
23256 pointers. If you use this option, the entire text, data, and BSS segments
23257 of your program must fit in 64K of memory and you must use an appropriate
23258 linker script to allocate them within the addressable range of the
23259 global pointer.
23260
23261 @end table
23262
23263 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23264 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23265
23266 The default is @option{-mgpopt} except when @option{-fpic} or
23267 @option{-fPIC} is specified to generate position-independent code.
23268 Note that the Nios II ABI does not permit GP-relative accesses from
23269 shared libraries.
23270
23271 You may need to specify @option{-mno-gpopt} explicitly when building
23272 programs that include large amounts of small data, including large
23273 GOT data sections. In this case, the 16-bit offset for GP-relative
23274 addressing may not be large enough to allow access to the entire
23275 small data section.
23276
23277 @item -mgprel-sec=@var{regexp}
23278 @opindex mgprel-sec
23279 This option specifies additional section names that can be accessed via
23280 GP-relative addressing. It is most useful in conjunction with
23281 @code{section} attributes on variable declarations
23282 (@pxref{Common Variable Attributes}) and a custom linker script.
23283 The @var{regexp} is a POSIX Extended Regular Expression.
23284
23285 This option does not affect the behavior of the @option{-G} option, and
23286 the specified sections are in addition to the standard @code{.sdata}
23287 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23288
23289 @item -mr0rel-sec=@var{regexp}
23290 @opindex mr0rel-sec
23291 This option specifies names of sections that can be accessed via a
23292 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23293 of the 32-bit address space. It is most useful in conjunction with
23294 @code{section} attributes on variable declarations
23295 (@pxref{Common Variable Attributes}) and a custom linker script.
23296 The @var{regexp} is a POSIX Extended Regular Expression.
23297
23298 In contrast to the use of GP-relative addressing for small data,
23299 zero-based addressing is never generated by default and there are no
23300 conventional section names used in standard linker scripts for sections
23301 in the low or high areas of memory.
23302
23303 @item -mel
23304 @itemx -meb
23305 @opindex mel
23306 @opindex meb
23307 Generate little-endian (default) or big-endian (experimental) code,
23308 respectively.
23309
23310 @item -march=@var{arch}
23311 @opindex march
23312 This specifies the name of the target Nios II architecture. GCC uses this
23313 name to determine what kind of instructions it can emit when generating
23314 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23315
23316 The preprocessor macro @code{__nios2_arch__} is available to programs,
23317 with value 1 or 2, indicating the targeted ISA level.
23318
23319 @item -mbypass-cache
23320 @itemx -mno-bypass-cache
23321 @opindex mno-bypass-cache
23322 @opindex mbypass-cache
23323 Force all load and store instructions to always bypass cache by
23324 using I/O variants of the instructions. The default is not to
23325 bypass the cache.
23326
23327 @item -mno-cache-volatile
23328 @itemx -mcache-volatile
23329 @opindex mcache-volatile
23330 @opindex mno-cache-volatile
23331 Volatile memory access bypass the cache using the I/O variants of
23332 the load and store instructions. The default is not to bypass the cache.
23333
23334 @item -mno-fast-sw-div
23335 @itemx -mfast-sw-div
23336 @opindex mno-fast-sw-div
23337 @opindex mfast-sw-div
23338 Do not use table-based fast divide for small numbers. The default
23339 is to use the fast divide at @option{-O3} and above.
23340
23341 @item -mno-hw-mul
23342 @itemx -mhw-mul
23343 @itemx -mno-hw-mulx
23344 @itemx -mhw-mulx
23345 @itemx -mno-hw-div
23346 @itemx -mhw-div
23347 @opindex mno-hw-mul
23348 @opindex mhw-mul
23349 @opindex mno-hw-mulx
23350 @opindex mhw-mulx
23351 @opindex mno-hw-div
23352 @opindex mhw-div
23353 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23354 instructions by the compiler. The default is to emit @code{mul}
23355 and not emit @code{div} and @code{mulx}.
23356
23357 @item -mbmx
23358 @itemx -mno-bmx
23359 @itemx -mcdx
23360 @itemx -mno-cdx
23361 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23362 CDX (code density) instructions. Enabling these instructions also
23363 requires @option{-march=r2}. Since these instructions are optional
23364 extensions to the R2 architecture, the default is not to emit them.
23365
23366 @item -mcustom-@var{insn}=@var{N}
23367 @itemx -mno-custom-@var{insn}
23368 @opindex mcustom-@var{insn}
23369 @opindex mno-custom-@var{insn}
23370 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23371 custom instruction with encoding @var{N} when generating code that uses
23372 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23373 instruction 253 for single-precision floating-point add operations instead
23374 of the default behavior of using a library call.
23375
23376 The following values of @var{insn} are supported. Except as otherwise
23377 noted, floating-point operations are expected to be implemented with
23378 normal IEEE 754 semantics and correspond directly to the C operators or the
23379 equivalent GCC built-in functions (@pxref{Other Builtins}).
23380
23381 Single-precision floating point:
23382 @table @asis
23383
23384 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23385 Binary arithmetic operations.
23386
23387 @item @samp{fnegs}
23388 Unary negation.
23389
23390 @item @samp{fabss}
23391 Unary absolute value.
23392
23393 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23394 Comparison operations.
23395
23396 @item @samp{fmins}, @samp{fmaxs}
23397 Floating-point minimum and maximum. These instructions are only
23398 generated if @option{-ffinite-math-only} is specified.
23399
23400 @item @samp{fsqrts}
23401 Unary square root operation.
23402
23403 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23404 Floating-point trigonometric and exponential functions. These instructions
23405 are only generated if @option{-funsafe-math-optimizations} is also specified.
23406
23407 @end table
23408
23409 Double-precision floating point:
23410 @table @asis
23411
23412 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23413 Binary arithmetic operations.
23414
23415 @item @samp{fnegd}
23416 Unary negation.
23417
23418 @item @samp{fabsd}
23419 Unary absolute value.
23420
23421 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23422 Comparison operations.
23423
23424 @item @samp{fmind}, @samp{fmaxd}
23425 Double-precision minimum and maximum. These instructions are only
23426 generated if @option{-ffinite-math-only} is specified.
23427
23428 @item @samp{fsqrtd}
23429 Unary square root operation.
23430
23431 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23432 Double-precision trigonometric and exponential functions. These instructions
23433 are only generated if @option{-funsafe-math-optimizations} is also specified.
23434
23435 @end table
23436
23437 Conversions:
23438 @table @asis
23439 @item @samp{fextsd}
23440 Conversion from single precision to double precision.
23441
23442 @item @samp{ftruncds}
23443 Conversion from double precision to single precision.
23444
23445 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23446 Conversion from floating point to signed or unsigned integer types, with
23447 truncation towards zero.
23448
23449 @item @samp{round}
23450 Conversion from single-precision floating point to signed integer,
23451 rounding to the nearest integer and ties away from zero.
23452 This corresponds to the @code{__builtin_lroundf} function when
23453 @option{-fno-math-errno} is used.
23454
23455 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23456 Conversion from signed or unsigned integer types to floating-point types.
23457
23458 @end table
23459
23460 In addition, all of the following transfer instructions for internal
23461 registers X and Y must be provided to use any of the double-precision
23462 floating-point instructions. Custom instructions taking two
23463 double-precision source operands expect the first operand in the
23464 64-bit register X. The other operand (or only operand of a unary
23465 operation) is given to the custom arithmetic instruction with the
23466 least significant half in source register @var{src1} and the most
23467 significant half in @var{src2}. A custom instruction that returns a
23468 double-precision result returns the most significant 32 bits in the
23469 destination register and the other half in 32-bit register Y.
23470 GCC automatically generates the necessary code sequences to write
23471 register X and/or read register Y when double-precision floating-point
23472 instructions are used.
23473
23474 @table @asis
23475
23476 @item @samp{fwrx}
23477 Write @var{src1} into the least significant half of X and @var{src2} into
23478 the most significant half of X.
23479
23480 @item @samp{fwry}
23481 Write @var{src1} into Y.
23482
23483 @item @samp{frdxhi}, @samp{frdxlo}
23484 Read the most or least (respectively) significant half of X and store it in
23485 @var{dest}.
23486
23487 @item @samp{frdy}
23488 Read the value of Y and store it into @var{dest}.
23489 @end table
23490
23491 Note that you can gain more local control over generation of Nios II custom
23492 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23493 and @code{target("no-custom-@var{insn}")} function attributes
23494 (@pxref{Function Attributes})
23495 or pragmas (@pxref{Function Specific Option Pragmas}).
23496
23497 @item -mcustom-fpu-cfg=@var{name}
23498 @opindex mcustom-fpu-cfg
23499
23500 This option enables a predefined, named set of custom instruction encodings
23501 (see @option{-mcustom-@var{insn}} above).
23502 Currently, the following sets are defined:
23503
23504 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23505 @gccoptlist{-mcustom-fmuls=252 @gol
23506 -mcustom-fadds=253 @gol
23507 -mcustom-fsubs=254 @gol
23508 -fsingle-precision-constant}
23509
23510 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23511 @gccoptlist{-mcustom-fmuls=252 @gol
23512 -mcustom-fadds=253 @gol
23513 -mcustom-fsubs=254 @gol
23514 -mcustom-fdivs=255 @gol
23515 -fsingle-precision-constant}
23516
23517 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23518 @gccoptlist{-mcustom-floatus=243 @gol
23519 -mcustom-fixsi=244 @gol
23520 -mcustom-floatis=245 @gol
23521 -mcustom-fcmpgts=246 @gol
23522 -mcustom-fcmples=249 @gol
23523 -mcustom-fcmpeqs=250 @gol
23524 -mcustom-fcmpnes=251 @gol
23525 -mcustom-fmuls=252 @gol
23526 -mcustom-fadds=253 @gol
23527 -mcustom-fsubs=254 @gol
23528 -mcustom-fdivs=255 @gol
23529 -fsingle-precision-constant}
23530
23531 Custom instruction assignments given by individual
23532 @option{-mcustom-@var{insn}=} options override those given by
23533 @option{-mcustom-fpu-cfg=}, regardless of the
23534 order of the options on the command line.
23535
23536 Note that you can gain more local control over selection of a FPU
23537 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23538 function attribute (@pxref{Function Attributes})
23539 or pragma (@pxref{Function Specific Option Pragmas}).
23540
23541 @end table
23542
23543 These additional @samp{-m} options are available for the Altera Nios II
23544 ELF (bare-metal) target:
23545
23546 @table @gcctabopt
23547
23548 @item -mhal
23549 @opindex mhal
23550 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23551 startup and termination code, and is typically used in conjunction with
23552 @option{-msys-crt0=} to specify the location of the alternate startup code
23553 provided by the HAL BSP.
23554
23555 @item -msmallc
23556 @opindex msmallc
23557 Link with a limited version of the C library, @option{-lsmallc}, rather than
23558 Newlib.
23559
23560 @item -msys-crt0=@var{startfile}
23561 @opindex msys-crt0
23562 @var{startfile} is the file name of the startfile (crt0) to use
23563 when linking. This option is only useful in conjunction with @option{-mhal}.
23564
23565 @item -msys-lib=@var{systemlib}
23566 @opindex msys-lib
23567 @var{systemlib} is the library name of the library that provides
23568 low-level system calls required by the C library,
23569 e.g.@: @code{read} and @code{write}.
23570 This option is typically used to link with a library provided by a HAL BSP.
23571
23572 @end table
23573
23574 @node Nvidia PTX Options
23575 @subsection Nvidia PTX Options
23576 @cindex Nvidia PTX options
23577 @cindex nvptx options
23578
23579 These options are defined for Nvidia PTX:
23580
23581 @table @gcctabopt
23582
23583 @item -m32
23584 @itemx -m64
23585 @opindex m32
23586 @opindex m64
23587 Generate code for 32-bit or 64-bit ABI.
23588
23589 @item -misa=@var{ISA-string}
23590 @opindex march
23591 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23592 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23593 @samp{sm_35}. The default ISA is sm_30.
23594
23595 @item -mmainkernel
23596 @opindex mmainkernel
23597 Link in code for a __main kernel. This is for stand-alone instead of
23598 offloading execution.
23599
23600 @item -moptimize
23601 @opindex moptimize
23602 Apply partitioned execution optimizations. This is the default when any
23603 level of optimization is selected.
23604
23605 @item -msoft-stack
23606 @opindex msoft-stack
23607 Generate code that does not use @code{.local} memory
23608 directly for stack storage. Instead, a per-warp stack pointer is
23609 maintained explicitly. This enables variable-length stack allocation (with
23610 variable-length arrays or @code{alloca}), and when global memory is used for
23611 underlying storage, makes it possible to access automatic variables from other
23612 threads, or with atomic instructions. This code generation variant is used
23613 for OpenMP offloading, but the option is exposed on its own for the purpose
23614 of testing the compiler; to generate code suitable for linking into programs
23615 using OpenMP offloading, use option @option{-mgomp}.
23616
23617 @item -muniform-simt
23618 @opindex muniform-simt
23619 Switch to code generation variant that allows to execute all threads in each
23620 warp, while maintaining memory state and side effects as if only one thread
23621 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23622 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23623 current lane index equals the master lane index), and the register being
23624 assigned is copied via a shuffle instruction from the master lane. Outside of
23625 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23626 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23627 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23628 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23629 with current lane index to compute the master lane index.
23630
23631 @item -mgomp
23632 @opindex mgomp
23633 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23634 @option{-muniform-simt} options, and selects corresponding multilib variant.
23635
23636 @end table
23637
23638 @node OpenRISC Options
23639 @subsection OpenRISC Options
23640 @cindex OpenRISC Options
23641
23642 These options are defined for OpenRISC:
23643
23644 @table @gcctabopt
23645
23646 @item -mboard=@var{name}
23647 @opindex mboard
23648 Configure a board specific runtime. This will be passed to the linker for
23649 newlib board library linking. The default is @code{or1ksim}.
23650
23651 @item -mnewlib
23652 @opindex mnewlib
23653 This option is ignored; it is for compatibility purposes only. This used to
23654 select linker and preprocessor options for use with newlib.
23655
23656 @item -msoft-div
23657 @itemx -mhard-div
23658 @opindex msoft-div
23659 @opindex mhard-div
23660 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23661 This default is hardware divide.
23662
23663 @item -msoft-mul
23664 @itemx -mhard-mul
23665 @opindex msoft-mul
23666 @opindex mhard-mul
23667 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23668 This default is hardware multiply.
23669
23670 @item -msoft-float
23671 @itemx -mhard-float
23672 @opindex msoft-float
23673 @opindex mhard-float
23674 Select software or hardware for floating point operations.
23675 The default is software.
23676
23677 @item -mdouble-float
23678 @opindex mdouble-float
23679 When @option{-mhard-float} is selected, enables generation of double-precision
23680 floating point instructions. By default functions from @file{libgcc} are used
23681 to perform double-precision floating point operations.
23682
23683 @item -munordered-float
23684 @opindex munordered-float
23685 When @option{-mhard-float} is selected, enables generation of unordered
23686 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23687 functions from @file{libgcc} are used to perform unordered floating point
23688 compare and set flag operations.
23689
23690 @item -mcmov
23691 @opindex mcmov
23692 Enable generation of conditional move (@code{l.cmov}) instructions. By
23693 default the equivalent will be generated using using set and branch.
23694
23695 @item -mror
23696 @opindex mror
23697 Enable generation of rotate right (@code{l.ror}) instructions. By default
23698 functions from @file{libgcc} are used to perform rotate right operations.
23699
23700 @item -mrori
23701 @opindex mrori
23702 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23703 By default functions from @file{libgcc} are used to perform rotate right with
23704 immediate operations.
23705
23706 @item -msext
23707 @opindex msext
23708 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23709 memory loads are used to perform sign extension.
23710
23711 @item -msfimm
23712 @opindex msfimm
23713 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23714 instructions. By default extra instructions will be generated to store the
23715 immediate to a register first.
23716
23717 @item -mshftimm
23718 @opindex mshftimm
23719 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23720 @code{l.slli}) instructions. By default extra instructions will be generated
23721 to store the immediate to a register first.
23722
23723
23724 @end table
23725
23726 @node PDP-11 Options
23727 @subsection PDP-11 Options
23728 @cindex PDP-11 Options
23729
23730 These options are defined for the PDP-11:
23731
23732 @table @gcctabopt
23733 @item -mfpu
23734 @opindex mfpu
23735 Use hardware FPP floating point. This is the default. (FIS floating
23736 point on the PDP-11/40 is not supported.) Implies -m45.
23737
23738 @item -msoft-float
23739 @opindex msoft-float
23740 Do not use hardware floating point.
23741
23742 @item -mac0
23743 @opindex mac0
23744 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23745
23746 @item -mno-ac0
23747 @opindex mno-ac0
23748 Return floating-point results in memory. This is the default.
23749
23750 @item -m40
23751 @opindex m40
23752 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23753
23754 @item -m45
23755 @opindex m45
23756 Generate code for a PDP-11/45. This is the default.
23757
23758 @item -m10
23759 @opindex m10
23760 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23761
23762 @item -mint16
23763 @itemx -mno-int32
23764 @opindex mint16
23765 @opindex mno-int32
23766 Use 16-bit @code{int}. This is the default.
23767
23768 @item -mint32
23769 @itemx -mno-int16
23770 @opindex mint32
23771 @opindex mno-int16
23772 Use 32-bit @code{int}.
23773
23774 @item -msplit
23775 @opindex msplit
23776 Target has split instruction and data space. Implies -m45.
23777
23778 @item -munix-asm
23779 @opindex munix-asm
23780 Use Unix assembler syntax.
23781
23782 @item -mdec-asm
23783 @opindex mdec-asm
23784 Use DEC assembler syntax.
23785
23786 @item -mgnu-asm
23787 @opindex mgnu-asm
23788 Use GNU assembler syntax. This is the default.
23789
23790 @item -mlra
23791 @opindex mlra
23792 Use the new LRA register allocator. By default, the old ``reload''
23793 allocator is used.
23794 @end table
23795
23796 @node picoChip Options
23797 @subsection picoChip Options
23798 @cindex picoChip options
23799
23800 These @samp{-m} options are defined for picoChip implementations:
23801
23802 @table @gcctabopt
23803
23804 @item -mae=@var{ae_type}
23805 @opindex mcpu
23806 Set the instruction set, register set, and instruction scheduling
23807 parameters for array element type @var{ae_type}. Supported values
23808 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23809
23810 @option{-mae=ANY} selects a completely generic AE type. Code
23811 generated with this option runs on any of the other AE types. The
23812 code is not as efficient as it would be if compiled for a specific
23813 AE type, and some types of operation (e.g., multiplication) do not
23814 work properly on all types of AE.
23815
23816 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23817 for compiled code, and is the default.
23818
23819 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23820 option may suffer from poor performance of byte (char) manipulation,
23821 since the DSP AE does not provide hardware support for byte load/stores.
23822
23823 @item -msymbol-as-address
23824 Enable the compiler to directly use a symbol name as an address in a
23825 load/store instruction, without first loading it into a
23826 register. Typically, the use of this option generates larger
23827 programs, which run faster than when the option isn't used. However, the
23828 results vary from program to program, so it is left as a user option,
23829 rather than being permanently enabled.
23830
23831 @item -mno-inefficient-warnings
23832 Disables warnings about the generation of inefficient code. These
23833 warnings can be generated, for example, when compiling code that
23834 performs byte-level memory operations on the MAC AE type. The MAC AE has
23835 no hardware support for byte-level memory operations, so all byte
23836 load/stores must be synthesized from word load/store operations. This is
23837 inefficient and a warning is generated to indicate
23838 that you should rewrite the code to avoid byte operations, or to target
23839 an AE type that has the necessary hardware support. This option disables
23840 these warnings.
23841
23842 @end table
23843
23844 @node PowerPC Options
23845 @subsection PowerPC Options
23846 @cindex PowerPC options
23847
23848 These are listed under @xref{RS/6000 and PowerPC Options}.
23849
23850 @node PRU Options
23851 @subsection PRU Options
23852 @cindex PRU Options
23853
23854 These command-line options are defined for PRU target:
23855
23856 @table @gcctabopt
23857 @item -minrt
23858 @opindex minrt
23859 Link with a minimum runtime environment, with no support for static
23860 initializers and constructors. Using this option can significantly reduce
23861 the size of the final ELF binary. Beware that the compiler could still
23862 generate code with static initializers and constructors. It is up to the
23863 programmer to ensure that the source program will not use those features.
23864
23865 @item -mmcu=@var{mcu}
23866 @opindex mmcu
23867 Specify the PRU MCU variant to use. Check Newlib for the exact list of
23868 supported MCUs.
23869
23870 @item -mno-relax
23871 @opindex mno-relax
23872 Make GCC pass the @option{--no-relax} command-line option to the linker
23873 instead of the @option{--relax} option.
23874
23875 @item -mloop
23876 @opindex mloop
23877 Allow (or do not allow) GCC to use the LOOP instruction.
23878
23879 @item -mabi=@var{variant}
23880 @opindex mabi
23881 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
23882 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
23883 more naturally with certain GCC assumptions. These are the differences:
23884
23885 @table @samp
23886 @item Function Pointer Size
23887 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
23888 supports only 32-bit data and code pointers.
23889
23890 @item Optional Return Value Pointer
23891 Function return values larger than 64 bits are passed by using a hidden
23892 pointer as the first argument of the function. TI ABI, though, mandates that
23893 the pointer can be NULL in case the caller is not using the returned value.
23894 GNU always passes and expects a valid return value pointer.
23895
23896 @end table
23897
23898 The current @option{-mabi=ti} implementation simply raises a compile error
23899 when any of the above code constructs is detected. As a consequence
23900 the standard C library cannot be built and it is omitted when linking with
23901 @option{-mabi=ti}.
23902
23903 Relaxation is a GNU feature and for safety reasons is disabled when using
23904 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
23905 instructions, so the GNU linker cannot adjust them when shortening adjacent
23906 LDI32 pseudo instructions.
23907
23908 @end table
23909
23910 @node RISC-V Options
23911 @subsection RISC-V Options
23912 @cindex RISC-V Options
23913
23914 These command-line options are defined for RISC-V targets:
23915
23916 @table @gcctabopt
23917 @item -mbranch-cost=@var{n}
23918 @opindex mbranch-cost
23919 Set the cost of branches to roughly @var{n} instructions.
23920
23921 @item -mplt
23922 @itemx -mno-plt
23923 @opindex plt
23924 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23925 non-PIC. The default is @option{-mplt}.
23926
23927 @item -mabi=@var{ABI-string}
23928 @opindex mabi
23929 Specify integer and floating-point calling convention. @var{ABI-string}
23930 contains two parts: the size of integer types and the registers used for
23931 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23932 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23933 32-bit), and that floating-point values up to 64 bits wide are passed in F
23934 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23935 allows the compiler to generate code that uses the F and D extensions but only
23936 allows floating-point values up to 32 bits long to be passed in registers; or
23937 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23938 passed in registers.
23939
23940 The default for this argument is system dependent, users who want a specific
23941 calling convention should specify one explicitly. The valid calling
23942 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23943 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23944 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23945 invalid because the ABI requires 64-bit values be passed in F registers, but F
23946 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23947 only be used with the @samp{rv32e} architecture. This ABI is not well
23948 specified at present, and is subject to change.
23949
23950 @item -mfdiv
23951 @itemx -mno-fdiv
23952 @opindex mfdiv
23953 Do or don't use hardware floating-point divide and square root instructions.
23954 This requires the F or D extensions for floating-point registers. The default
23955 is to use them if the specified architecture has these instructions.
23956
23957 @item -mdiv
23958 @itemx -mno-div
23959 @opindex mdiv
23960 Do or don't use hardware instructions for integer division. This requires the
23961 M extension. The default is to use them if the specified architecture has
23962 these instructions.
23963
23964 @item -march=@var{ISA-string}
23965 @opindex march
23966 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23967 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23968 @samp{rv32imaf}.
23969
23970 @item -mtune=@var{processor-string}
23971 @opindex mtune
23972 Optimize the output for the given processor, specified by microarchitecture
23973 name. Permissible values for this option are: @samp{rocket},
23974 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
23975 and @samp{size}.
23976
23977 When @option{-mtune=} is not specified, the default is @samp{rocket}.
23978
23979 The @samp{size} choice is not intended for use by end-users. This is used
23980 when @option{-Os} is specified. It overrides the instruction cost info
23981 provided by @option{-mtune=}, but does not override the pipeline info. This
23982 helps reduce code size while still giving good performance.
23983
23984 @item -mpreferred-stack-boundary=@var{num}
23985 @opindex mpreferred-stack-boundary
23986 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23987 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23988 the default is 4 (16 bytes or 128-bits).
23989
23990 @strong{Warning:} If you use this switch, then you must build all modules with
23991 the same value, including any libraries. This includes the system libraries
23992 and startup modules.
23993
23994 @item -msmall-data-limit=@var{n}
23995 @opindex msmall-data-limit
23996 Put global and static data smaller than @var{n} bytes into a special section
23997 (on some targets).
23998
23999 @item -msave-restore
24000 @itemx -mno-save-restore
24001 @opindex msave-restore
24002 Do or don't use smaller but slower prologue and epilogue code that uses
24003 library function calls. The default is to use fast inline prologues and
24004 epilogues.
24005
24006 @item -mstrict-align
24007 @itemx -mno-strict-align
24008 @opindex mstrict-align
24009 Do not or do generate unaligned memory accesses. The default is set depending
24010 on whether the processor we are optimizing for supports fast unaligned access
24011 or not.
24012
24013 @item -mcmodel=medlow
24014 @opindex mcmodel=medlow
24015 Generate code for the medium-low code model. The program and its statically
24016 defined symbols must lie within a single 2 GiB address range and must lie
24017 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24018 statically or dynamically linked. This is the default code model.
24019
24020 @item -mcmodel=medany
24021 @opindex mcmodel=medany
24022 Generate code for the medium-any code model. The program and its statically
24023 defined symbols must be within any single 2 GiB address range. Programs can be
24024 statically or dynamically linked.
24025
24026 @item -mexplicit-relocs
24027 @itemx -mno-exlicit-relocs
24028 Use or do not use assembler relocation operators when dealing with symbolic
24029 addresses. The alternative is to use assembler macros instead, which may
24030 limit optimization.
24031
24032 @item -mrelax
24033 @itemx -mno-relax
24034 Take advantage of linker relaxations to reduce the number of instructions
24035 required to materialize symbol addresses. The default is to take advantage of
24036 linker relaxations.
24037
24038 @item -memit-attribute
24039 @itemx -mno-emit-attribute
24040 Emit (do not emit) RISC-V attribute to record extra information into ELF
24041 objects. This feature requires at least binutils 2.32.
24042 @end table
24043
24044 @node RL78 Options
24045 @subsection RL78 Options
24046 @cindex RL78 Options
24047
24048 @table @gcctabopt
24049
24050 @item -msim
24051 @opindex msim
24052 Links in additional target libraries to support operation within a
24053 simulator.
24054
24055 @item -mmul=none
24056 @itemx -mmul=g10
24057 @itemx -mmul=g13
24058 @itemx -mmul=g14
24059 @itemx -mmul=rl78
24060 @opindex mmul
24061 Specifies the type of hardware multiplication and division support to
24062 be used. The simplest is @code{none}, which uses software for both
24063 multiplication and division. This is the default. The @code{g13}
24064 value is for the hardware multiply/divide peripheral found on the
24065 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24066 the multiplication and division instructions supported by the RL78/G14
24067 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24068 the value @code{mg10} is an alias for @code{none}.
24069
24070 In addition a C preprocessor macro is defined, based upon the setting
24071 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24072 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24073
24074 @item -mcpu=g10
24075 @itemx -mcpu=g13
24076 @itemx -mcpu=g14
24077 @itemx -mcpu=rl78
24078 @opindex mcpu
24079 Specifies the RL78 core to target. The default is the G14 core, also
24080 known as an S3 core or just RL78. The G13 or S2 core does not have
24081 multiply or divide instructions, instead it uses a hardware peripheral
24082 for these operations. The G10 or S1 core does not have register
24083 banks, so it uses a different calling convention.
24084
24085 If this option is set it also selects the type of hardware multiply
24086 support to use, unless this is overridden by an explicit
24087 @option{-mmul=none} option on the command line. Thus specifying
24088 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24089 peripheral and specifying @option{-mcpu=g10} disables the use of
24090 hardware multiplications altogether.
24091
24092 Note, although the RL78/G14 core is the default target, specifying
24093 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24094 change the behavior of the toolchain since it also enables G14
24095 hardware multiply support. If these options are not specified on the
24096 command line then software multiplication routines will be used even
24097 though the code targets the RL78 core. This is for backwards
24098 compatibility with older toolchains which did not have hardware
24099 multiply and divide support.
24100
24101 In addition a C preprocessor macro is defined, based upon the setting
24102 of this option. Possible values are: @code{__RL78_G10__},
24103 @code{__RL78_G13__} or @code{__RL78_G14__}.
24104
24105 @item -mg10
24106 @itemx -mg13
24107 @itemx -mg14
24108 @itemx -mrl78
24109 @opindex mg10
24110 @opindex mg13
24111 @opindex mg14
24112 @opindex mrl78
24113 These are aliases for the corresponding @option{-mcpu=} option. They
24114 are provided for backwards compatibility.
24115
24116 @item -mallregs
24117 @opindex mallregs
24118 Allow the compiler to use all of the available registers. By default
24119 registers @code{r24..r31} are reserved for use in interrupt handlers.
24120 With this option enabled these registers can be used in ordinary
24121 functions as well.
24122
24123 @item -m64bit-doubles
24124 @itemx -m32bit-doubles
24125 @opindex m64bit-doubles
24126 @opindex m32bit-doubles
24127 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24128 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24129 @option{-m32bit-doubles}.
24130
24131 @item -msave-mduc-in-interrupts
24132 @itemx -mno-save-mduc-in-interrupts
24133 @opindex msave-mduc-in-interrupts
24134 @opindex mno-save-mduc-in-interrupts
24135 Specifies that interrupt handler functions should preserve the
24136 MDUC registers. This is only necessary if normal code might use
24137 the MDUC registers, for example because it performs multiplication
24138 and division operations. The default is to ignore the MDUC registers
24139 as this makes the interrupt handlers faster. The target option -mg13
24140 needs to be passed for this to work as this feature is only available
24141 on the G13 target (S2 core). The MDUC registers will only be saved
24142 if the interrupt handler performs a multiplication or division
24143 operation or it calls another function.
24144
24145 @end table
24146
24147 @node RS/6000 and PowerPC Options
24148 @subsection IBM RS/6000 and PowerPC Options
24149 @cindex RS/6000 and PowerPC Options
24150 @cindex IBM RS/6000 and PowerPC Options
24151
24152 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24153 @table @gcctabopt
24154 @item -mpowerpc-gpopt
24155 @itemx -mno-powerpc-gpopt
24156 @itemx -mpowerpc-gfxopt
24157 @itemx -mno-powerpc-gfxopt
24158 @need 800
24159 @itemx -mpowerpc64
24160 @itemx -mno-powerpc64
24161 @itemx -mmfcrf
24162 @itemx -mno-mfcrf
24163 @itemx -mpopcntb
24164 @itemx -mno-popcntb
24165 @itemx -mpopcntd
24166 @itemx -mno-popcntd
24167 @itemx -mfprnd
24168 @itemx -mno-fprnd
24169 @need 800
24170 @itemx -mcmpb
24171 @itemx -mno-cmpb
24172 @itemx -mhard-dfp
24173 @itemx -mno-hard-dfp
24174 @opindex mpowerpc-gpopt
24175 @opindex mno-powerpc-gpopt
24176 @opindex mpowerpc-gfxopt
24177 @opindex mno-powerpc-gfxopt
24178 @opindex mpowerpc64
24179 @opindex mno-powerpc64
24180 @opindex mmfcrf
24181 @opindex mno-mfcrf
24182 @opindex mpopcntb
24183 @opindex mno-popcntb
24184 @opindex mpopcntd
24185 @opindex mno-popcntd
24186 @opindex mfprnd
24187 @opindex mno-fprnd
24188 @opindex mcmpb
24189 @opindex mno-cmpb
24190 @opindex mhard-dfp
24191 @opindex mno-hard-dfp
24192 You use these options to specify which instructions are available on the
24193 processor you are using. The default value of these options is
24194 determined when configuring GCC@. Specifying the
24195 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24196 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24197 rather than the options listed above.
24198
24199 Specifying @option{-mpowerpc-gpopt} allows
24200 GCC to use the optional PowerPC architecture instructions in the
24201 General Purpose group, including floating-point square root. Specifying
24202 @option{-mpowerpc-gfxopt} allows GCC to
24203 use the optional PowerPC architecture instructions in the Graphics
24204 group, including floating-point select.
24205
24206 The @option{-mmfcrf} option allows GCC to generate the move from
24207 condition register field instruction implemented on the POWER4
24208 processor and other processors that support the PowerPC V2.01
24209 architecture.
24210 The @option{-mpopcntb} option allows GCC to generate the popcount and
24211 double-precision FP reciprocal estimate instruction implemented on the
24212 POWER5 processor and other processors that support the PowerPC V2.02
24213 architecture.
24214 The @option{-mpopcntd} option allows GCC to generate the popcount
24215 instruction implemented on the POWER7 processor and other processors
24216 that support the PowerPC V2.06 architecture.
24217 The @option{-mfprnd} option allows GCC to generate the FP round to
24218 integer instructions implemented on the POWER5+ processor and other
24219 processors that support the PowerPC V2.03 architecture.
24220 The @option{-mcmpb} option allows GCC to generate the compare bytes
24221 instruction implemented on the POWER6 processor and other processors
24222 that support the PowerPC V2.05 architecture.
24223 The @option{-mhard-dfp} option allows GCC to generate the decimal
24224 floating-point instructions implemented on some POWER processors.
24225
24226 The @option{-mpowerpc64} option allows GCC to generate the additional
24227 64-bit instructions that are found in the full PowerPC64 architecture
24228 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24229 @option{-mno-powerpc64}.
24230
24231 @item -mcpu=@var{cpu_type}
24232 @opindex mcpu
24233 Set architecture type, register usage, and
24234 instruction scheduling parameters for machine type @var{cpu_type}.
24235 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24236 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24237 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24238 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24239 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24240 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24241 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24242 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24243 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24244 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24245 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24246 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24247
24248 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24249 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24250 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24251 architecture machine types, with an appropriate, generic processor
24252 model assumed for scheduling purposes.
24253
24254 Specifying @samp{native} as cpu type detects and selects the
24255 architecture option that corresponds to the host processor of the
24256 system performing the compilation.
24257 @option{-mcpu=native} has no effect if GCC does not recognize the
24258 processor.
24259
24260 The other options specify a specific processor. Code generated under
24261 those options runs best on that processor, and may not run at all on
24262 others.
24263
24264 The @option{-mcpu} options automatically enable or disable the
24265 following options:
24266
24267 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24268 -mpopcntb -mpopcntd -mpowerpc64 @gol
24269 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24270 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24271 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24272 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24273
24274 The particular options set for any particular CPU varies between
24275 compiler versions, depending on what setting seems to produce optimal
24276 code for that CPU; it doesn't necessarily reflect the actual hardware's
24277 capabilities. If you wish to set an individual option to a particular
24278 value, you may specify it after the @option{-mcpu} option, like
24279 @option{-mcpu=970 -mno-altivec}.
24280
24281 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24282 not enabled or disabled by the @option{-mcpu} option at present because
24283 AIX does not have full support for these options. You may still
24284 enable or disable them individually if you're sure it'll work in your
24285 environment.
24286
24287 @item -mtune=@var{cpu_type}
24288 @opindex mtune
24289 Set the instruction scheduling parameters for machine type
24290 @var{cpu_type}, but do not set the architecture type or register usage,
24291 as @option{-mcpu=@var{cpu_type}} does. The same
24292 values for @var{cpu_type} are used for @option{-mtune} as for
24293 @option{-mcpu}. If both are specified, the code generated uses the
24294 architecture and registers set by @option{-mcpu}, but the
24295 scheduling parameters set by @option{-mtune}.
24296
24297 @item -mcmodel=small
24298 @opindex mcmodel=small
24299 Generate PowerPC64 code for the small model: The TOC is limited to
24300 64k.
24301
24302 @item -mcmodel=medium
24303 @opindex mcmodel=medium
24304 Generate PowerPC64 code for the medium model: The TOC and other static
24305 data may be up to a total of 4G in size. This is the default for 64-bit
24306 Linux.
24307
24308 @item -mcmodel=large
24309 @opindex mcmodel=large
24310 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24311 in size. Other data and code is only limited by the 64-bit address
24312 space.
24313
24314 @item -maltivec
24315 @itemx -mno-altivec
24316 @opindex maltivec
24317 @opindex mno-altivec
24318 Generate code that uses (does not use) AltiVec instructions, and also
24319 enable the use of built-in functions that allow more direct access to
24320 the AltiVec instruction set. You may also need to set
24321 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24322 enhancements.
24323
24324 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24325 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24326 match array element order corresponding to the endianness of the
24327 target. That is, element zero identifies the leftmost element in a
24328 vector register when targeting a big-endian platform, and identifies
24329 the rightmost element in a vector register when targeting a
24330 little-endian platform.
24331
24332 @item -mvrsave
24333 @itemx -mno-vrsave
24334 @opindex mvrsave
24335 @opindex mno-vrsave
24336 Generate VRSAVE instructions when generating AltiVec code.
24337
24338 @item -msecure-plt
24339 @opindex msecure-plt
24340 Generate code that allows @command{ld} and @command{ld.so}
24341 to build executables and shared
24342 libraries with non-executable @code{.plt} and @code{.got} sections.
24343 This is a PowerPC
24344 32-bit SYSV ABI option.
24345
24346 @item -mbss-plt
24347 @opindex mbss-plt
24348 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24349 fills in, and
24350 requires @code{.plt} and @code{.got}
24351 sections that are both writable and executable.
24352 This is a PowerPC 32-bit SYSV ABI option.
24353
24354 @item -misel
24355 @itemx -mno-isel
24356 @opindex misel
24357 @opindex mno-isel
24358 This switch enables or disables the generation of ISEL instructions.
24359
24360 @item -mvsx
24361 @itemx -mno-vsx
24362 @opindex mvsx
24363 @opindex mno-vsx
24364 Generate code that uses (does not use) vector/scalar (VSX)
24365 instructions, and also enable the use of built-in functions that allow
24366 more direct access to the VSX instruction set.
24367
24368 @item -mcrypto
24369 @itemx -mno-crypto
24370 @opindex mcrypto
24371 @opindex mno-crypto
24372 Enable the use (disable) of the built-in functions that allow direct
24373 access to the cryptographic instructions that were added in version
24374 2.07 of the PowerPC ISA.
24375
24376 @item -mhtm
24377 @itemx -mno-htm
24378 @opindex mhtm
24379 @opindex mno-htm
24380 Enable (disable) the use of the built-in functions that allow direct
24381 access to the Hardware Transactional Memory (HTM) instructions that
24382 were added in version 2.07 of the PowerPC ISA.
24383
24384 @item -mpower8-fusion
24385 @itemx -mno-power8-fusion
24386 @opindex mpower8-fusion
24387 @opindex mno-power8-fusion
24388 Generate code that keeps (does not keeps) some integer operations
24389 adjacent so that the instructions can be fused together on power8 and
24390 later processors.
24391
24392 @item -mpower8-vector
24393 @itemx -mno-power8-vector
24394 @opindex mpower8-vector
24395 @opindex mno-power8-vector
24396 Generate code that uses (does not use) the vector and scalar
24397 instructions that were added in version 2.07 of the PowerPC ISA. Also
24398 enable the use of built-in functions that allow more direct access to
24399 the vector instructions.
24400
24401 @item -mquad-memory
24402 @itemx -mno-quad-memory
24403 @opindex mquad-memory
24404 @opindex mno-quad-memory
24405 Generate code that uses (does not use) the non-atomic quad word memory
24406 instructions. The @option{-mquad-memory} option requires use of
24407 64-bit mode.
24408
24409 @item -mquad-memory-atomic
24410 @itemx -mno-quad-memory-atomic
24411 @opindex mquad-memory-atomic
24412 @opindex mno-quad-memory-atomic
24413 Generate code that uses (does not use) the atomic quad word memory
24414 instructions. The @option{-mquad-memory-atomic} option requires use of
24415 64-bit mode.
24416
24417 @item -mfloat128
24418 @itemx -mno-float128
24419 @opindex mfloat128
24420 @opindex mno-float128
24421 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24422 and use either software emulation for IEEE 128-bit floating point or
24423 hardware instructions.
24424
24425 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24426 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24427 use the IEEE 128-bit floating point support. The IEEE 128-bit
24428 floating point support only works on PowerPC Linux systems.
24429
24430 The default for @option{-mfloat128} is enabled on PowerPC Linux
24431 systems using the VSX instruction set, and disabled on other systems.
24432
24433 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24434 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24435 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24436 floating point instructions. Otherwise, if you do not specify to
24437 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24438 system, IEEE 128-bit floating point will be done with software
24439 emulation.
24440
24441 @item -mfloat128-hardware
24442 @itemx -mno-float128-hardware
24443 @opindex mfloat128-hardware
24444 @opindex mno-float128-hardware
24445 Enable/disable using ISA 3.0 hardware instructions to support the
24446 @var{__float128} data type.
24447
24448 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24449 Linux systems using the ISA 3.0 instruction set, and disabled on other
24450 systems.
24451
24452 @item -m32
24453 @itemx -m64
24454 @opindex m32
24455 @opindex m64
24456 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24457 targets (including GNU/Linux). The 32-bit environment sets int, long
24458 and pointer to 32 bits and generates code that runs on any PowerPC
24459 variant. The 64-bit environment sets int to 32 bits and long and
24460 pointer to 64 bits, and generates code for PowerPC64, as for
24461 @option{-mpowerpc64}.
24462
24463 @item -mfull-toc
24464 @itemx -mno-fp-in-toc
24465 @itemx -mno-sum-in-toc
24466 @itemx -mminimal-toc
24467 @opindex mfull-toc
24468 @opindex mno-fp-in-toc
24469 @opindex mno-sum-in-toc
24470 @opindex mminimal-toc
24471 Modify generation of the TOC (Table Of Contents), which is created for
24472 every executable file. The @option{-mfull-toc} option is selected by
24473 default. In that case, GCC allocates at least one TOC entry for
24474 each unique non-automatic variable reference in your program. GCC
24475 also places floating-point constants in the TOC@. However, only
24476 16,384 entries are available in the TOC@.
24477
24478 If you receive a linker error message that saying you have overflowed
24479 the available TOC space, you can reduce the amount of TOC space used
24480 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24481 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24482 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24483 generate code to calculate the sum of an address and a constant at
24484 run time instead of putting that sum into the TOC@. You may specify one
24485 or both of these options. Each causes GCC to produce very slightly
24486 slower and larger code at the expense of conserving TOC space.
24487
24488 If you still run out of space in the TOC even when you specify both of
24489 these options, specify @option{-mminimal-toc} instead. This option causes
24490 GCC to make only one TOC entry for every file. When you specify this
24491 option, GCC produces code that is slower and larger but which
24492 uses extremely little TOC space. You may wish to use this option
24493 only on files that contain less frequently-executed code.
24494
24495 @item -maix64
24496 @itemx -maix32
24497 @opindex maix64
24498 @opindex maix32
24499 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24500 @code{long} type, and the infrastructure needed to support them.
24501 Specifying @option{-maix64} implies @option{-mpowerpc64},
24502 while @option{-maix32} disables the 64-bit ABI and
24503 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24504
24505 @item -mxl-compat
24506 @itemx -mno-xl-compat
24507 @opindex mxl-compat
24508 @opindex mno-xl-compat
24509 Produce code that conforms more closely to IBM XL compiler semantics
24510 when using AIX-compatible ABI@. Pass floating-point arguments to
24511 prototyped functions beyond the register save area (RSA) on the stack
24512 in addition to argument FPRs. Do not assume that most significant
24513 double in 128-bit long double value is properly rounded when comparing
24514 values and converting to double. Use XL symbol names for long double
24515 support routines.
24516
24517 The AIX calling convention was extended but not initially documented to
24518 handle an obscure K&R C case of calling a function that takes the
24519 address of its arguments with fewer arguments than declared. IBM XL
24520 compilers access floating-point arguments that do not fit in the
24521 RSA from the stack when a subroutine is compiled without
24522 optimization. Because always storing floating-point arguments on the
24523 stack is inefficient and rarely needed, this option is not enabled by
24524 default and only is necessary when calling subroutines compiled by IBM
24525 XL compilers without optimization.
24526
24527 @item -mpe
24528 @opindex mpe
24529 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24530 application written to use message passing with special startup code to
24531 enable the application to run. The system must have PE installed in the
24532 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24533 must be overridden with the @option{-specs=} option to specify the
24534 appropriate directory location. The Parallel Environment does not
24535 support threads, so the @option{-mpe} option and the @option{-pthread}
24536 option are incompatible.
24537
24538 @item -malign-natural
24539 @itemx -malign-power
24540 @opindex malign-natural
24541 @opindex malign-power
24542 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24543 @option{-malign-natural} overrides the ABI-defined alignment of larger
24544 types, such as floating-point doubles, on their natural size-based boundary.
24545 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24546 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24547
24548 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24549 is not supported.
24550
24551 @item -msoft-float
24552 @itemx -mhard-float
24553 @opindex msoft-float
24554 @opindex mhard-float
24555 Generate code that does not use (uses) the floating-point register set.
24556 Software floating-point emulation is provided if you use the
24557 @option{-msoft-float} option, and pass the option to GCC when linking.
24558
24559 @item -mmultiple
24560 @itemx -mno-multiple
24561 @opindex mmultiple
24562 @opindex mno-multiple
24563 Generate code that uses (does not use) the load multiple word
24564 instructions and the store multiple word instructions. These
24565 instructions are generated by default on POWER systems, and not
24566 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24567 PowerPC systems, since those instructions do not work when the
24568 processor is in little-endian mode. The exceptions are PPC740 and
24569 PPC750 which permit these instructions in little-endian mode.
24570
24571 @item -mupdate
24572 @itemx -mno-update
24573 @opindex mupdate
24574 @opindex mno-update
24575 Generate code that uses (does not use) the load or store instructions
24576 that update the base register to the address of the calculated memory
24577 location. These instructions are generated by default. If you use
24578 @option{-mno-update}, there is a small window between the time that the
24579 stack pointer is updated and the address of the previous frame is
24580 stored, which means code that walks the stack frame across interrupts or
24581 signals may get corrupted data.
24582
24583 @item -mavoid-indexed-addresses
24584 @itemx -mno-avoid-indexed-addresses
24585 @opindex mavoid-indexed-addresses
24586 @opindex mno-avoid-indexed-addresses
24587 Generate code that tries to avoid (not avoid) the use of indexed load
24588 or store instructions. These instructions can incur a performance
24589 penalty on Power6 processors in certain situations, such as when
24590 stepping through large arrays that cross a 16M boundary. This option
24591 is enabled by default when targeting Power6 and disabled otherwise.
24592
24593 @item -mfused-madd
24594 @itemx -mno-fused-madd
24595 @opindex mfused-madd
24596 @opindex mno-fused-madd
24597 Generate code that uses (does not use) the floating-point multiply and
24598 accumulate instructions. These instructions are generated by default
24599 if hardware floating point is used. The machine-dependent
24600 @option{-mfused-madd} option is now mapped to the machine-independent
24601 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24602 mapped to @option{-ffp-contract=off}.
24603
24604 @item -mmulhw
24605 @itemx -mno-mulhw
24606 @opindex mmulhw
24607 @opindex mno-mulhw
24608 Generate code that uses (does not use) the half-word multiply and
24609 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24610 These instructions are generated by default when targeting those
24611 processors.
24612
24613 @item -mdlmzb
24614 @itemx -mno-dlmzb
24615 @opindex mdlmzb
24616 @opindex mno-dlmzb
24617 Generate code that uses (does not use) the string-search @samp{dlmzb}
24618 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24619 generated by default when targeting those processors.
24620
24621 @item -mno-bit-align
24622 @itemx -mbit-align
24623 @opindex mno-bit-align
24624 @opindex mbit-align
24625 On System V.4 and embedded PowerPC systems do not (do) force structures
24626 and unions that contain bit-fields to be aligned to the base type of the
24627 bit-field.
24628
24629 For example, by default a structure containing nothing but 8
24630 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24631 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24632 the structure is aligned to a 1-byte boundary and is 1 byte in
24633 size.
24634
24635 @item -mno-strict-align
24636 @itemx -mstrict-align
24637 @opindex mno-strict-align
24638 @opindex mstrict-align
24639 On System V.4 and embedded PowerPC systems do not (do) assume that
24640 unaligned memory references are handled by the system.
24641
24642 @item -mrelocatable
24643 @itemx -mno-relocatable
24644 @opindex mrelocatable
24645 @opindex mno-relocatable
24646 Generate code that allows (does not allow) a static executable to be
24647 relocated to a different address at run time. A simple embedded
24648 PowerPC system loader should relocate the entire contents of
24649 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24650 a table of 32-bit addresses generated by this option. For this to
24651 work, all objects linked together must be compiled with
24652 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24653 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24654
24655 @item -mrelocatable-lib
24656 @itemx -mno-relocatable-lib
24657 @opindex mrelocatable-lib
24658 @opindex mno-relocatable-lib
24659 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24660 @code{.fixup} section to allow static executables to be relocated at
24661 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24662 alignment of @option{-mrelocatable}. Objects compiled with
24663 @option{-mrelocatable-lib} may be linked with objects compiled with
24664 any combination of the @option{-mrelocatable} options.
24665
24666 @item -mno-toc
24667 @itemx -mtoc
24668 @opindex mno-toc
24669 @opindex mtoc
24670 On System V.4 and embedded PowerPC systems do not (do) assume that
24671 register 2 contains a pointer to a global area pointing to the addresses
24672 used in the program.
24673
24674 @item -mlittle
24675 @itemx -mlittle-endian
24676 @opindex mlittle
24677 @opindex mlittle-endian
24678 On System V.4 and embedded PowerPC systems compile code for the
24679 processor in little-endian mode. The @option{-mlittle-endian} option is
24680 the same as @option{-mlittle}.
24681
24682 @item -mbig
24683 @itemx -mbig-endian
24684 @opindex mbig
24685 @opindex mbig-endian
24686 On System V.4 and embedded PowerPC systems compile code for the
24687 processor in big-endian mode. The @option{-mbig-endian} option is
24688 the same as @option{-mbig}.
24689
24690 @item -mdynamic-no-pic
24691 @opindex mdynamic-no-pic
24692 On Darwin and Mac OS X systems, compile code so that it is not
24693 relocatable, but that its external references are relocatable. The
24694 resulting code is suitable for applications, but not shared
24695 libraries.
24696
24697 @item -msingle-pic-base
24698 @opindex msingle-pic-base
24699 Treat the register used for PIC addressing as read-only, rather than
24700 loading it in the prologue for each function. The runtime system is
24701 responsible for initializing this register with an appropriate value
24702 before execution begins.
24703
24704 @item -mprioritize-restricted-insns=@var{priority}
24705 @opindex mprioritize-restricted-insns
24706 This option controls the priority that is assigned to
24707 dispatch-slot restricted instructions during the second scheduling
24708 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24709 or @samp{2} to assign no, highest, or second-highest (respectively)
24710 priority to dispatch-slot restricted
24711 instructions.
24712
24713 @item -msched-costly-dep=@var{dependence_type}
24714 @opindex msched-costly-dep
24715 This option controls which dependences are considered costly
24716 by the target during instruction scheduling. The argument
24717 @var{dependence_type} takes one of the following values:
24718
24719 @table @asis
24720 @item @samp{no}
24721 No dependence is costly.
24722
24723 @item @samp{all}
24724 All dependences are costly.
24725
24726 @item @samp{true_store_to_load}
24727 A true dependence from store to load is costly.
24728
24729 @item @samp{store_to_load}
24730 Any dependence from store to load is costly.
24731
24732 @item @var{number}
24733 Any dependence for which the latency is greater than or equal to
24734 @var{number} is costly.
24735 @end table
24736
24737 @item -minsert-sched-nops=@var{scheme}
24738 @opindex minsert-sched-nops
24739 This option controls which NOP insertion scheme is used during
24740 the second scheduling pass. The argument @var{scheme} takes one of the
24741 following values:
24742
24743 @table @asis
24744 @item @samp{no}
24745 Don't insert NOPs.
24746
24747 @item @samp{pad}
24748 Pad with NOPs any dispatch group that has vacant issue slots,
24749 according to the scheduler's grouping.
24750
24751 @item @samp{regroup_exact}
24752 Insert NOPs to force costly dependent insns into
24753 separate groups. Insert exactly as many NOPs as needed to force an insn
24754 to a new group, according to the estimated processor grouping.
24755
24756 @item @var{number}
24757 Insert NOPs to force costly dependent insns into
24758 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24759 @end table
24760
24761 @item -mcall-sysv
24762 @opindex mcall-sysv
24763 On System V.4 and embedded PowerPC systems compile code using calling
24764 conventions that adhere to the March 1995 draft of the System V
24765 Application Binary Interface, PowerPC processor supplement. This is the
24766 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24767
24768 @item -mcall-sysv-eabi
24769 @itemx -mcall-eabi
24770 @opindex mcall-sysv-eabi
24771 @opindex mcall-eabi
24772 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24773
24774 @item -mcall-sysv-noeabi
24775 @opindex mcall-sysv-noeabi
24776 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24777
24778 @item -mcall-aixdesc
24779 @opindex m
24780 On System V.4 and embedded PowerPC systems compile code for the AIX
24781 operating system.
24782
24783 @item -mcall-linux
24784 @opindex mcall-linux
24785 On System V.4 and embedded PowerPC systems compile code for the
24786 Linux-based GNU system.
24787
24788 @item -mcall-freebsd
24789 @opindex mcall-freebsd
24790 On System V.4 and embedded PowerPC systems compile code for the
24791 FreeBSD operating system.
24792
24793 @item -mcall-netbsd
24794 @opindex mcall-netbsd
24795 On System V.4 and embedded PowerPC systems compile code for the
24796 NetBSD operating system.
24797
24798 @item -mcall-openbsd
24799 @opindex mcall-netbsd
24800 On System V.4 and embedded PowerPC systems compile code for the
24801 OpenBSD operating system.
24802
24803 @item -mtraceback=@var{traceback_type}
24804 @opindex mtraceback
24805 Select the type of traceback table. Valid values for @var{traceback_type}
24806 are @samp{full}, @samp{part}, and @samp{no}.
24807
24808 @item -maix-struct-return
24809 @opindex maix-struct-return
24810 Return all structures in memory (as specified by the AIX ABI)@.
24811
24812 @item -msvr4-struct-return
24813 @opindex msvr4-struct-return
24814 Return structures smaller than 8 bytes in registers (as specified by the
24815 SVR4 ABI)@.
24816
24817 @item -mabi=@var{abi-type}
24818 @opindex mabi
24819 Extend the current ABI with a particular extension, or remove such extension.
24820 Valid values are @samp{altivec}, @samp{no-altivec},
24821 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24822 @samp{elfv1}, @samp{elfv2}@.
24823
24824 @item -mabi=ibmlongdouble
24825 @opindex mabi=ibmlongdouble
24826 Change the current ABI to use IBM extended-precision long double.
24827 This is not likely to work if your system defaults to using IEEE
24828 extended-precision long double. If you change the long double type
24829 from IEEE extended-precision, the compiler will issue a warning unless
24830 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24831 to be enabled.
24832
24833 @item -mabi=ieeelongdouble
24834 @opindex mabi=ieeelongdouble
24835 Change the current ABI to use IEEE extended-precision long double.
24836 This is not likely to work if your system defaults to using IBM
24837 extended-precision long double. If you change the long double type
24838 from IBM extended-precision, the compiler will issue a warning unless
24839 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24840 to be enabled.
24841
24842 @item -mabi=elfv1
24843 @opindex mabi=elfv1
24844 Change the current ABI to use the ELFv1 ABI.
24845 This is the default ABI for big-endian PowerPC 64-bit Linux.
24846 Overriding the default ABI requires special system support and is
24847 likely to fail in spectacular ways.
24848
24849 @item -mabi=elfv2
24850 @opindex mabi=elfv2
24851 Change the current ABI to use the ELFv2 ABI.
24852 This is the default ABI for little-endian PowerPC 64-bit Linux.
24853 Overriding the default ABI requires special system support and is
24854 likely to fail in spectacular ways.
24855
24856 @item -mgnu-attribute
24857 @itemx -mno-gnu-attribute
24858 @opindex mgnu-attribute
24859 @opindex mno-gnu-attribute
24860 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24861 .gnu.attributes section that specify ABI variations in function
24862 parameters or return values.
24863
24864 @item -mprototype
24865 @itemx -mno-prototype
24866 @opindex mprototype
24867 @opindex mno-prototype
24868 On System V.4 and embedded PowerPC systems assume that all calls to
24869 variable argument functions are properly prototyped. Otherwise, the
24870 compiler must insert an instruction before every non-prototyped call to
24871 set or clear bit 6 of the condition code register (@code{CR}) to
24872 indicate whether floating-point values are passed in the floating-point
24873 registers in case the function takes variable arguments. With
24874 @option{-mprototype}, only calls to prototyped variable argument functions
24875 set or clear the bit.
24876
24877 @item -msim
24878 @opindex msim
24879 On embedded PowerPC systems, assume that the startup module is called
24880 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24881 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24882 configurations.
24883
24884 @item -mmvme
24885 @opindex mmvme
24886 On embedded PowerPC systems, assume that the startup module is called
24887 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24888 @file{libc.a}.
24889
24890 @item -mads
24891 @opindex mads
24892 On embedded PowerPC systems, assume that the startup module is called
24893 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24894 @file{libc.a}.
24895
24896 @item -myellowknife
24897 @opindex myellowknife
24898 On embedded PowerPC systems, assume that the startup module is called
24899 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24900 @file{libc.a}.
24901
24902 @item -mvxworks
24903 @opindex mvxworks
24904 On System V.4 and embedded PowerPC systems, specify that you are
24905 compiling for a VxWorks system.
24906
24907 @item -memb
24908 @opindex memb
24909 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24910 header to indicate that @samp{eabi} extended relocations are used.
24911
24912 @item -meabi
24913 @itemx -mno-eabi
24914 @opindex meabi
24915 @opindex mno-eabi
24916 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24917 Embedded Applications Binary Interface (EABI), which is a set of
24918 modifications to the System V.4 specifications. Selecting @option{-meabi}
24919 means that the stack is aligned to an 8-byte boundary, a function
24920 @code{__eabi} is called from @code{main} to set up the EABI
24921 environment, and the @option{-msdata} option can use both @code{r2} and
24922 @code{r13} to point to two separate small data areas. Selecting
24923 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24924 no EABI initialization function is called from @code{main}, and the
24925 @option{-msdata} option only uses @code{r13} to point to a single
24926 small data area. The @option{-meabi} option is on by default if you
24927 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24928
24929 @item -msdata=eabi
24930 @opindex msdata=eabi
24931 On System V.4 and embedded PowerPC systems, put small initialized
24932 @code{const} global and static data in the @code{.sdata2} section, which
24933 is pointed to by register @code{r2}. Put small initialized
24934 non-@code{const} global and static data in the @code{.sdata} section,
24935 which is pointed to by register @code{r13}. Put small uninitialized
24936 global and static data in the @code{.sbss} section, which is adjacent to
24937 the @code{.sdata} section. The @option{-msdata=eabi} option is
24938 incompatible with the @option{-mrelocatable} option. The
24939 @option{-msdata=eabi} option also sets the @option{-memb} option.
24940
24941 @item -msdata=sysv
24942 @opindex msdata=sysv
24943 On System V.4 and embedded PowerPC systems, put small global and static
24944 data in the @code{.sdata} section, which is pointed to by register
24945 @code{r13}. Put small uninitialized global and static data in the
24946 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24947 The @option{-msdata=sysv} option is incompatible with the
24948 @option{-mrelocatable} option.
24949
24950 @item -msdata=default
24951 @itemx -msdata
24952 @opindex msdata=default
24953 @opindex msdata
24954 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24955 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24956 same as @option{-msdata=sysv}.
24957
24958 @item -msdata=data
24959 @opindex msdata=data
24960 On System V.4 and embedded PowerPC systems, put small global
24961 data in the @code{.sdata} section. Put small uninitialized global
24962 data in the @code{.sbss} section. Do not use register @code{r13}
24963 to address small data however. This is the default behavior unless
24964 other @option{-msdata} options are used.
24965
24966 @item -msdata=none
24967 @itemx -mno-sdata
24968 @opindex msdata=none
24969 @opindex mno-sdata
24970 On embedded PowerPC systems, put all initialized global and static data
24971 in the @code{.data} section, and all uninitialized data in the
24972 @code{.bss} section.
24973
24974 @item -mreadonly-in-sdata
24975 @opindex mreadonly-in-sdata
24976 @opindex mno-readonly-in-sdata
24977 Put read-only objects in the @code{.sdata} section as well. This is the
24978 default.
24979
24980 @item -mblock-move-inline-limit=@var{num}
24981 @opindex mblock-move-inline-limit
24982 Inline all block moves (such as calls to @code{memcpy} or structure
24983 copies) less than or equal to @var{num} bytes. The minimum value for
24984 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24985 targets. The default value is target-specific.
24986
24987 @item -mblock-compare-inline-limit=@var{num}
24988 @opindex mblock-compare-inline-limit
24989 Generate non-looping inline code for all block compares (such as calls
24990 to @code{memcmp} or structure compares) less than or equal to @var{num}
24991 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24992 block compare is disabled. The default value is target-specific.
24993
24994 @item -mblock-compare-inline-loop-limit=@var{num}
24995 @opindex mblock-compare-inline-loop-limit
24996 Generate an inline expansion using loop code for all block compares that
24997 are less than or equal to @var{num} bytes, but greater than the limit
24998 for non-loop inline block compare expansion. If the block length is not
24999 constant, at most @var{num} bytes will be compared before @code{memcmp}
25000 is called to compare the remainder of the block. The default value is
25001 target-specific.
25002
25003 @item -mstring-compare-inline-limit=@var{num}
25004 @opindex mstring-compare-inline-limit
25005 Compare at most @var{num} string bytes with inline code.
25006 If the difference or end of string is not found at the
25007 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25008 take care of the rest of the comparison. The default is 64 bytes.
25009
25010 @item -G @var{num}
25011 @opindex G
25012 @cindex smaller data references (PowerPC)
25013 @cindex .sdata/.sdata2 references (PowerPC)
25014 On embedded PowerPC systems, put global and static items less than or
25015 equal to @var{num} bytes into the small data or BSS sections instead of
25016 the normal data or BSS section. By default, @var{num} is 8. The
25017 @option{-G @var{num}} switch is also passed to the linker.
25018 All modules should be compiled with the same @option{-G @var{num}} value.
25019
25020 @item -mregnames
25021 @itemx -mno-regnames
25022 @opindex mregnames
25023 @opindex mno-regnames
25024 On System V.4 and embedded PowerPC systems do (do not) emit register
25025 names in the assembly language output using symbolic forms.
25026
25027 @item -mlongcall
25028 @itemx -mno-longcall
25029 @opindex mlongcall
25030 @opindex mno-longcall
25031 By default assume that all calls are far away so that a longer and more
25032 expensive calling sequence is required. This is required for calls
25033 farther than 32 megabytes (33,554,432 bytes) from the current location.
25034 A short call is generated if the compiler knows
25035 the call cannot be that far away. This setting can be overridden by
25036 the @code{shortcall} function attribute, or by @code{#pragma
25037 longcall(0)}.
25038
25039 Some linkers are capable of detecting out-of-range calls and generating
25040 glue code on the fly. On these systems, long calls are unnecessary and
25041 generate slower code. As of this writing, the AIX linker can do this,
25042 as can the GNU linker for PowerPC/64. It is planned to add this feature
25043 to the GNU linker for 32-bit PowerPC systems as well.
25044
25045 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25046 GCC can generate long calls using an inline PLT call sequence (see
25047 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25048 ELFv1 (big-endian) do not support inline PLT calls.
25049
25050 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25051 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25052 addresses represent the callee and the branch island. The
25053 Darwin/PPC linker prefers the first address and generates a @code{bl
25054 callee} if the PPC @code{bl} instruction reaches the callee directly;
25055 otherwise, the linker generates @code{bl L42} to call the branch
25056 island. The branch island is appended to the body of the
25057 calling function; it computes the full 32-bit address of the callee
25058 and jumps to it.
25059
25060 On Mach-O (Darwin) systems, this option directs the compiler emit to
25061 the glue for every direct call, and the Darwin linker decides whether
25062 to use or discard it.
25063
25064 In the future, GCC may ignore all longcall specifications
25065 when the linker is known to generate glue.
25066
25067 @item -mpltseq
25068 @itemx -mno-pltseq
25069 @opindex mpltseq
25070 @opindex mno-pltseq
25071 Implement (do not implement) -fno-plt and long calls using an inline
25072 PLT call sequence that supports lazy linking and long calls to
25073 functions in dlopen'd shared libraries. Inline PLT calls are only
25074 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25075 linkers, and are enabled by default if the support is detected when
25076 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25077 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25078 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25079 linked together.
25080
25081 @item -mtls-markers
25082 @itemx -mno-tls-markers
25083 @opindex mtls-markers
25084 @opindex mno-tls-markers
25085 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25086 specifying the function argument. The relocation allows the linker to
25087 reliably associate function call with argument setup instructions for
25088 TLS optimization, which in turn allows GCC to better schedule the
25089 sequence.
25090
25091 @item -mrecip
25092 @itemx -mno-recip
25093 @opindex mrecip
25094 This option enables use of the reciprocal estimate and
25095 reciprocal square root estimate instructions with additional
25096 Newton-Raphson steps to increase precision instead of doing a divide or
25097 square root and divide for floating-point arguments. You should use
25098 the @option{-ffast-math} option when using @option{-mrecip} (or at
25099 least @option{-funsafe-math-optimizations},
25100 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25101 @option{-fno-trapping-math}). Note that while the throughput of the
25102 sequence is generally higher than the throughput of the non-reciprocal
25103 instruction, the precision of the sequence can be decreased by up to 2
25104 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25105 roots.
25106
25107 @item -mrecip=@var{opt}
25108 @opindex mrecip=opt
25109 This option controls which reciprocal estimate instructions
25110 may be used. @var{opt} is a comma-separated list of options, which may
25111 be preceded by a @code{!} to invert the option:
25112
25113 @table @samp
25114
25115 @item all
25116 Enable all estimate instructions.
25117
25118 @item default
25119 Enable the default instructions, equivalent to @option{-mrecip}.
25120
25121 @item none
25122 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25123
25124 @item div
25125 Enable the reciprocal approximation instructions for both
25126 single and double precision.
25127
25128 @item divf
25129 Enable the single-precision reciprocal approximation instructions.
25130
25131 @item divd
25132 Enable the double-precision reciprocal approximation instructions.
25133
25134 @item rsqrt
25135 Enable the reciprocal square root approximation instructions for both
25136 single and double precision.
25137
25138 @item rsqrtf
25139 Enable the single-precision reciprocal square root approximation instructions.
25140
25141 @item rsqrtd
25142 Enable the double-precision reciprocal square root approximation instructions.
25143
25144 @end table
25145
25146 So, for example, @option{-mrecip=all,!rsqrtd} enables
25147 all of the reciprocal estimate instructions, except for the
25148 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25149 which handle the double-precision reciprocal square root calculations.
25150
25151 @item -mrecip-precision
25152 @itemx -mno-recip-precision
25153 @opindex mrecip-precision
25154 Assume (do not assume) that the reciprocal estimate instructions
25155 provide higher-precision estimates than is mandated by the PowerPC
25156 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25157 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25158 The double-precision square root estimate instructions are not generated by
25159 default on low-precision machines, since they do not provide an
25160 estimate that converges after three steps.
25161
25162 @item -mveclibabi=@var{type}
25163 @opindex mveclibabi
25164 Specifies the ABI type to use for vectorizing intrinsics using an
25165 external library. The only type supported at present is @samp{mass},
25166 which specifies to use IBM's Mathematical Acceleration Subsystem
25167 (MASS) libraries for vectorizing intrinsics using external libraries.
25168 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25169 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25170 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25171 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25172 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25173 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25174 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25175 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25176 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25177 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25178 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25179 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25180 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25181 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25182 for power7. Both @option{-ftree-vectorize} and
25183 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25184 libraries must be specified at link time.
25185
25186 @item -mfriz
25187 @itemx -mno-friz
25188 @opindex mfriz
25189 Generate (do not generate) the @code{friz} instruction when the
25190 @option{-funsafe-math-optimizations} option is used to optimize
25191 rounding of floating-point values to 64-bit integer and back to floating
25192 point. The @code{friz} instruction does not return the same value if
25193 the floating-point number is too large to fit in an integer.
25194
25195 @item -mpointers-to-nested-functions
25196 @itemx -mno-pointers-to-nested-functions
25197 @opindex mpointers-to-nested-functions
25198 Generate (do not generate) code to load up the static chain register
25199 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25200 systems where a function pointer points to a 3-word descriptor giving
25201 the function address, TOC value to be loaded in register @code{r2}, and
25202 static chain value to be loaded in register @code{r11}. The
25203 @option{-mpointers-to-nested-functions} is on by default. You cannot
25204 call through pointers to nested functions or pointers
25205 to functions compiled in other languages that use the static chain if
25206 you use @option{-mno-pointers-to-nested-functions}.
25207
25208 @item -msave-toc-indirect
25209 @itemx -mno-save-toc-indirect
25210 @opindex msave-toc-indirect
25211 Generate (do not generate) code to save the TOC value in the reserved
25212 stack location in the function prologue if the function calls through
25213 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25214 saved in the prologue, it is saved just before the call through the
25215 pointer. The @option{-mno-save-toc-indirect} option is the default.
25216
25217 @item -mcompat-align-parm
25218 @itemx -mno-compat-align-parm
25219 @opindex mcompat-align-parm
25220 Generate (do not generate) code to pass structure parameters with a
25221 maximum alignment of 64 bits, for compatibility with older versions
25222 of GCC.
25223
25224 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25225 structure parameter on a 128-bit boundary when that structure contained
25226 a member requiring 128-bit alignment. This is corrected in more
25227 recent versions of GCC. This option may be used to generate code
25228 that is compatible with functions compiled with older versions of
25229 GCC.
25230
25231 The @option{-mno-compat-align-parm} option is the default.
25232
25233 @item -mstack-protector-guard=@var{guard}
25234 @itemx -mstack-protector-guard-reg=@var{reg}
25235 @itemx -mstack-protector-guard-offset=@var{offset}
25236 @itemx -mstack-protector-guard-symbol=@var{symbol}
25237 @opindex mstack-protector-guard
25238 @opindex mstack-protector-guard-reg
25239 @opindex mstack-protector-guard-offset
25240 @opindex mstack-protector-guard-symbol
25241 Generate stack protection code using canary at @var{guard}. Supported
25242 locations are @samp{global} for global canary or @samp{tls} for per-thread
25243 canary in the TLS block (the default with GNU libc version 2.4 or later).
25244
25245 With the latter choice the options
25246 @option{-mstack-protector-guard-reg=@var{reg}} and
25247 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25248 which register to use as base register for reading the canary, and from what
25249 offset from that base register. The default for those is as specified in the
25250 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25251 the offset with a symbol reference to a canary in the TLS block.
25252
25253 @item -mpcrel
25254 @itemx -mno-pcrel
25255 @opindex mpcrel
25256 @opindex mno-pcrel
25257 Generate (do not generate) pc-relative addressing when the option
25258 @option{-mcpu=future} is used.
25259 @end table
25260
25261 @node RX Options
25262 @subsection RX Options
25263 @cindex RX Options
25264
25265 These command-line options are defined for RX targets:
25266
25267 @table @gcctabopt
25268 @item -m64bit-doubles
25269 @itemx -m32bit-doubles
25270 @opindex m64bit-doubles
25271 @opindex m32bit-doubles
25272 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25273 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25274 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25275 works on 32-bit values, which is why the default is
25276 @option{-m32bit-doubles}.
25277
25278 @item -fpu
25279 @itemx -nofpu
25280 @opindex fpu
25281 @opindex nofpu
25282 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25283 floating-point hardware. The default is enabled for the RX600
25284 series and disabled for the RX200 series.
25285
25286 Floating-point instructions are only generated for 32-bit floating-point
25287 values, however, so the FPU hardware is not used for doubles if the
25288 @option{-m64bit-doubles} option is used.
25289
25290 @emph{Note} If the @option{-fpu} option is enabled then
25291 @option{-funsafe-math-optimizations} is also enabled automatically.
25292 This is because the RX FPU instructions are themselves unsafe.
25293
25294 @item -mcpu=@var{name}
25295 @opindex mcpu
25296 Selects the type of RX CPU to be targeted. Currently three types are
25297 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25298 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25299
25300 The only difference between @samp{RX600} and @samp{RX610} is that the
25301 @samp{RX610} does not support the @code{MVTIPL} instruction.
25302
25303 The @samp{RX200} series does not have a hardware floating-point unit
25304 and so @option{-nofpu} is enabled by default when this type is
25305 selected.
25306
25307 @item -mbig-endian-data
25308 @itemx -mlittle-endian-data
25309 @opindex mbig-endian-data
25310 @opindex mlittle-endian-data
25311 Store data (but not code) in the big-endian format. The default is
25312 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25313 format.
25314
25315 @item -msmall-data-limit=@var{N}
25316 @opindex msmall-data-limit
25317 Specifies the maximum size in bytes of global and static variables
25318 which can be placed into the small data area. Using the small data
25319 area can lead to smaller and faster code, but the size of area is
25320 limited and it is up to the programmer to ensure that the area does
25321 not overflow. Also when the small data area is used one of the RX's
25322 registers (usually @code{r13}) is reserved for use pointing to this
25323 area, so it is no longer available for use by the compiler. This
25324 could result in slower and/or larger code if variables are pushed onto
25325 the stack instead of being held in this register.
25326
25327 Note, common variables (variables that have not been initialized) and
25328 constants are not placed into the small data area as they are assigned
25329 to other sections in the output executable.
25330
25331 The default value is zero, which disables this feature. Note, this
25332 feature is not enabled by default with higher optimization levels
25333 (@option{-O2} etc) because of the potentially detrimental effects of
25334 reserving a register. It is up to the programmer to experiment and
25335 discover whether this feature is of benefit to their program. See the
25336 description of the @option{-mpid} option for a description of how the
25337 actual register to hold the small data area pointer is chosen.
25338
25339 @item -msim
25340 @itemx -mno-sim
25341 @opindex msim
25342 @opindex mno-sim
25343 Use the simulator runtime. The default is to use the libgloss
25344 board-specific runtime.
25345
25346 @item -mas100-syntax
25347 @itemx -mno-as100-syntax
25348 @opindex mas100-syntax
25349 @opindex mno-as100-syntax
25350 When generating assembler output use a syntax that is compatible with
25351 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25352 assembler, but it has some restrictions so it is not generated by default.
25353
25354 @item -mmax-constant-size=@var{N}
25355 @opindex mmax-constant-size
25356 Specifies the maximum size, in bytes, of a constant that can be used as
25357 an operand in a RX instruction. Although the RX instruction set does
25358 allow constants of up to 4 bytes in length to be used in instructions,
25359 a longer value equates to a longer instruction. Thus in some
25360 circumstances it can be beneficial to restrict the size of constants
25361 that are used in instructions. Constants that are too big are instead
25362 placed into a constant pool and referenced via register indirection.
25363
25364 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25365 or 4 means that constants of any size are allowed.
25366
25367 @item -mrelax
25368 @opindex mrelax
25369 Enable linker relaxation. Linker relaxation is a process whereby the
25370 linker attempts to reduce the size of a program by finding shorter
25371 versions of various instructions. Disabled by default.
25372
25373 @item -mint-register=@var{N}
25374 @opindex mint-register
25375 Specify the number of registers to reserve for fast interrupt handler
25376 functions. The value @var{N} can be between 0 and 4. A value of 1
25377 means that register @code{r13} is reserved for the exclusive use
25378 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25379 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25380 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25381 A value of 0, the default, does not reserve any registers.
25382
25383 @item -msave-acc-in-interrupts
25384 @opindex msave-acc-in-interrupts
25385 Specifies that interrupt handler functions should preserve the
25386 accumulator register. This is only necessary if normal code might use
25387 the accumulator register, for example because it performs 64-bit
25388 multiplications. The default is to ignore the accumulator as this
25389 makes the interrupt handlers faster.
25390
25391 @item -mpid
25392 @itemx -mno-pid
25393 @opindex mpid
25394 @opindex mno-pid
25395 Enables the generation of position independent data. When enabled any
25396 access to constant data is done via an offset from a base address
25397 held in a register. This allows the location of constant data to be
25398 determined at run time without requiring the executable to be
25399 relocated, which is a benefit to embedded applications with tight
25400 memory constraints. Data that can be modified is not affected by this
25401 option.
25402
25403 Note, using this feature reserves a register, usually @code{r13}, for
25404 the constant data base address. This can result in slower and/or
25405 larger code, especially in complicated functions.
25406
25407 The actual register chosen to hold the constant data base address
25408 depends upon whether the @option{-msmall-data-limit} and/or the
25409 @option{-mint-register} command-line options are enabled. Starting
25410 with register @code{r13} and proceeding downwards, registers are
25411 allocated first to satisfy the requirements of @option{-mint-register},
25412 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25413 is possible for the small data area register to be @code{r8} if both
25414 @option{-mint-register=4} and @option{-mpid} are specified on the
25415 command line.
25416
25417 By default this feature is not enabled. The default can be restored
25418 via the @option{-mno-pid} command-line option.
25419
25420 @item -mno-warn-multiple-fast-interrupts
25421 @itemx -mwarn-multiple-fast-interrupts
25422 @opindex mno-warn-multiple-fast-interrupts
25423 @opindex mwarn-multiple-fast-interrupts
25424 Prevents GCC from issuing a warning message if it finds more than one
25425 fast interrupt handler when it is compiling a file. The default is to
25426 issue a warning for each extra fast interrupt handler found, as the RX
25427 only supports one such interrupt.
25428
25429 @item -mallow-string-insns
25430 @itemx -mno-allow-string-insns
25431 @opindex mallow-string-insns
25432 @opindex mno-allow-string-insns
25433 Enables or disables the use of the string manipulation instructions
25434 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25435 @code{SWHILE} and also the @code{RMPA} instruction. These
25436 instructions may prefetch data, which is not safe to do if accessing
25437 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25438 for more information).
25439
25440 The default is to allow these instructions, but it is not possible for
25441 GCC to reliably detect all circumstances where a string instruction
25442 might be used to access an I/O register, so their use cannot be
25443 disabled automatically. Instead it is reliant upon the programmer to
25444 use the @option{-mno-allow-string-insns} option if their program
25445 accesses I/O space.
25446
25447 When the instructions are enabled GCC defines the C preprocessor
25448 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25449 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25450
25451 @item -mjsr
25452 @itemx -mno-jsr
25453 @opindex mjsr
25454 @opindex mno-jsr
25455 Use only (or not only) @code{JSR} instructions to access functions.
25456 This option can be used when code size exceeds the range of @code{BSR}
25457 instructions. Note that @option{-mno-jsr} does not mean to not use
25458 @code{JSR} but instead means that any type of branch may be used.
25459 @end table
25460
25461 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25462 has special significance to the RX port when used with the
25463 @code{interrupt} function attribute. This attribute indicates a
25464 function intended to process fast interrupts. GCC ensures
25465 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25466 and/or @code{r13} and only provided that the normal use of the
25467 corresponding registers have been restricted via the
25468 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25469 options.
25470
25471 @node S/390 and zSeries Options
25472 @subsection S/390 and zSeries Options
25473 @cindex S/390 and zSeries Options
25474
25475 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25476
25477 @table @gcctabopt
25478 @item -mhard-float
25479 @itemx -msoft-float
25480 @opindex mhard-float
25481 @opindex msoft-float
25482 Use (do not use) the hardware floating-point instructions and registers
25483 for floating-point operations. When @option{-msoft-float} is specified,
25484 functions in @file{libgcc.a} are used to perform floating-point
25485 operations. When @option{-mhard-float} is specified, the compiler
25486 generates IEEE floating-point instructions. This is the default.
25487
25488 @item -mhard-dfp
25489 @itemx -mno-hard-dfp
25490 @opindex mhard-dfp
25491 @opindex mno-hard-dfp
25492 Use (do not use) the hardware decimal-floating-point instructions for
25493 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25494 specified, functions in @file{libgcc.a} are used to perform
25495 decimal-floating-point operations. When @option{-mhard-dfp} is
25496 specified, the compiler generates decimal-floating-point hardware
25497 instructions. This is the default for @option{-march=z9-ec} or higher.
25498
25499 @item -mlong-double-64
25500 @itemx -mlong-double-128
25501 @opindex mlong-double-64
25502 @opindex mlong-double-128
25503 These switches control the size of @code{long double} type. A size
25504 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25505 type. This is the default.
25506
25507 @item -mbackchain
25508 @itemx -mno-backchain
25509 @opindex mbackchain
25510 @opindex mno-backchain
25511 Store (do not store) the address of the caller's frame as backchain pointer
25512 into the callee's stack frame.
25513 A backchain may be needed to allow debugging using tools that do not understand
25514 DWARF call frame information.
25515 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25516 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25517 the backchain is placed into the topmost word of the 96/160 byte register
25518 save area.
25519
25520 In general, code compiled with @option{-mbackchain} is call-compatible with
25521 code compiled with @option{-mmo-backchain}; however, use of the backchain
25522 for debugging purposes usually requires that the whole binary is built with
25523 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25524 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25525 to build a linux kernel use @option{-msoft-float}.
25526
25527 The default is to not maintain the backchain.
25528
25529 @item -mpacked-stack
25530 @itemx -mno-packed-stack
25531 @opindex mpacked-stack
25532 @opindex mno-packed-stack
25533 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25534 specified, the compiler uses the all fields of the 96/160 byte register save
25535 area only for their default purpose; unused fields still take up stack space.
25536 When @option{-mpacked-stack} is specified, register save slots are densely
25537 packed at the top of the register save area; unused space is reused for other
25538 purposes, allowing for more efficient use of the available stack space.
25539 However, when @option{-mbackchain} is also in effect, the topmost word of
25540 the save area is always used to store the backchain, and the return address
25541 register is always saved two words below the backchain.
25542
25543 As long as the stack frame backchain is not used, code generated with
25544 @option{-mpacked-stack} is call-compatible with code generated with
25545 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25546 S/390 or zSeries generated code that uses the stack frame backchain at run
25547 time, not just for debugging purposes. Such code is not call-compatible
25548 with code compiled with @option{-mpacked-stack}. Also, note that the
25549 combination of @option{-mbackchain},
25550 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25551 to build a linux kernel use @option{-msoft-float}.
25552
25553 The default is to not use the packed stack layout.
25554
25555 @item -msmall-exec
25556 @itemx -mno-small-exec
25557 @opindex msmall-exec
25558 @opindex mno-small-exec
25559 Generate (or do not generate) code using the @code{bras} instruction
25560 to do subroutine calls.
25561 This only works reliably if the total executable size does not
25562 exceed 64k. The default is to use the @code{basr} instruction instead,
25563 which does not have this limitation.
25564
25565 @item -m64
25566 @itemx -m31
25567 @opindex m64
25568 @opindex m31
25569 When @option{-m31} is specified, generate code compliant to the
25570 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25571 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25572 particular to generate 64-bit instructions. For the @samp{s390}
25573 targets, the default is @option{-m31}, while the @samp{s390x}
25574 targets default to @option{-m64}.
25575
25576 @item -mzarch
25577 @itemx -mesa
25578 @opindex mzarch
25579 @opindex mesa
25580 When @option{-mzarch} is specified, generate code using the
25581 instructions available on z/Architecture.
25582 When @option{-mesa} is specified, generate code using the
25583 instructions available on ESA/390. Note that @option{-mesa} is
25584 not possible with @option{-m64}.
25585 When generating code compliant to the GNU/Linux for S/390 ABI,
25586 the default is @option{-mesa}. When generating code compliant
25587 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25588
25589 @item -mhtm
25590 @itemx -mno-htm
25591 @opindex mhtm
25592 @opindex mno-htm
25593 The @option{-mhtm} option enables a set of builtins making use of
25594 instructions available with the transactional execution facility
25595 introduced with the IBM zEnterprise EC12 machine generation
25596 @ref{S/390 System z Built-in Functions}.
25597 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25598
25599 @item -mvx
25600 @itemx -mno-vx
25601 @opindex mvx
25602 @opindex mno-vx
25603 When @option{-mvx} is specified, generate code using the instructions
25604 available with the vector extension facility introduced with the IBM
25605 z13 machine generation.
25606 This option changes the ABI for some vector type values with regard to
25607 alignment and calling conventions. In case vector type values are
25608 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25609 command will be added to mark the resulting binary with the ABI used.
25610 @option{-mvx} is enabled by default when using @option{-march=z13}.
25611
25612 @item -mzvector
25613 @itemx -mno-zvector
25614 @opindex mzvector
25615 @opindex mno-zvector
25616 The @option{-mzvector} option enables vector language extensions and
25617 builtins using instructions available with the vector extension
25618 facility introduced with the IBM z13 machine generation.
25619 This option adds support for @samp{vector} to be used as a keyword to
25620 define vector type variables and arguments. @samp{vector} is only
25621 available when GNU extensions are enabled. It will not be expanded
25622 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25623 In addition to the GCC low-level builtins @option{-mzvector} enables
25624 a set of builtins added for compatibility with AltiVec-style
25625 implementations like Power and Cell. In order to make use of these
25626 builtins the header file @file{vecintrin.h} needs to be included.
25627 @option{-mzvector} is disabled by default.
25628
25629 @item -mmvcle
25630 @itemx -mno-mvcle
25631 @opindex mmvcle
25632 @opindex mno-mvcle
25633 Generate (or do not generate) code using the @code{mvcle} instruction
25634 to perform block moves. When @option{-mno-mvcle} is specified,
25635 use a @code{mvc} loop instead. This is the default unless optimizing for
25636 size.
25637
25638 @item -mdebug
25639 @itemx -mno-debug
25640 @opindex mdebug
25641 @opindex mno-debug
25642 Print (or do not print) additional debug information when compiling.
25643 The default is to not print debug information.
25644
25645 @item -march=@var{cpu-type}
25646 @opindex march
25647 Generate code that runs on @var{cpu-type}, which is the name of a
25648 system representing a certain processor type. Possible values for
25649 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25650 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25651 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25652 @samp{z14}/@samp{arch12}, and @samp{native}.
25653
25654 The default is @option{-march=z900}.
25655
25656 Specifying @samp{native} as cpu type can be used to select the best
25657 architecture option for the host processor.
25658 @option{-march=native} has no effect if GCC does not recognize the
25659 processor.
25660
25661 @item -mtune=@var{cpu-type}
25662 @opindex mtune
25663 Tune to @var{cpu-type} everything applicable about the generated code,
25664 except for the ABI and the set of available instructions.
25665 The list of @var{cpu-type} values is the same as for @option{-march}.
25666 The default is the value used for @option{-march}.
25667
25668 @item -mtpf-trace
25669 @itemx -mno-tpf-trace
25670 @opindex mtpf-trace
25671 @opindex mno-tpf-trace
25672 Generate code that adds (does not add) in TPF OS specific branches to trace
25673 routines in the operating system. This option is off by default, even
25674 when compiling for the TPF OS@.
25675
25676 @item -mfused-madd
25677 @itemx -mno-fused-madd
25678 @opindex mfused-madd
25679 @opindex mno-fused-madd
25680 Generate code that uses (does not use) the floating-point multiply and
25681 accumulate instructions. These instructions are generated by default if
25682 hardware floating point is used.
25683
25684 @item -mwarn-framesize=@var{framesize}
25685 @opindex mwarn-framesize
25686 Emit a warning if the current function exceeds the given frame size. Because
25687 this is a compile-time check it doesn't need to be a real problem when the program
25688 runs. It is intended to identify functions that most probably cause
25689 a stack overflow. It is useful to be used in an environment with limited stack
25690 size e.g.@: the linux kernel.
25691
25692 @item -mwarn-dynamicstack
25693 @opindex mwarn-dynamicstack
25694 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25695 arrays. This is generally a bad idea with a limited stack size.
25696
25697 @item -mstack-guard=@var{stack-guard}
25698 @itemx -mstack-size=@var{stack-size}
25699 @opindex mstack-guard
25700 @opindex mstack-size
25701 If these options are provided the S/390 back end emits additional instructions in
25702 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25703 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25704 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25705 the frame size of the compiled function is chosen.
25706 These options are intended to be used to help debugging stack overflow problems.
25707 The additionally emitted code causes only little overhead and hence can also be
25708 used in production-like systems without greater performance degradation. The given
25709 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25710 @var{stack-guard} without exceeding 64k.
25711 In order to be efficient the extra code makes the assumption that the stack starts
25712 at an address aligned to the value given by @var{stack-size}.
25713 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25714
25715 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25716 @opindex mhotpatch
25717 If the hotpatch option is enabled, a ``hot-patching'' function
25718 prologue is generated for all functions in the compilation unit.
25719 The funtion label is prepended with the given number of two-byte
25720 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25721 the label, 2 * @var{post-halfwords} bytes are appended, using the
25722 largest NOP like instructions the architecture allows (maximum
25723 1000000).
25724
25725 If both arguments are zero, hotpatching is disabled.
25726
25727 This option can be overridden for individual functions with the
25728 @code{hotpatch} attribute.
25729 @end table
25730
25731 @node Score Options
25732 @subsection Score Options
25733 @cindex Score Options
25734
25735 These options are defined for Score implementations:
25736
25737 @table @gcctabopt
25738 @item -meb
25739 @opindex meb
25740 Compile code for big-endian mode. This is the default.
25741
25742 @item -mel
25743 @opindex mel
25744 Compile code for little-endian mode.
25745
25746 @item -mnhwloop
25747 @opindex mnhwloop
25748 Disable generation of @code{bcnz} instructions.
25749
25750 @item -muls
25751 @opindex muls
25752 Enable generation of unaligned load and store instructions.
25753
25754 @item -mmac
25755 @opindex mmac
25756 Enable the use of multiply-accumulate instructions. Disabled by default.
25757
25758 @item -mscore5
25759 @opindex mscore5
25760 Specify the SCORE5 as the target architecture.
25761
25762 @item -mscore5u
25763 @opindex mscore5u
25764 Specify the SCORE5U of the target architecture.
25765
25766 @item -mscore7
25767 @opindex mscore7
25768 Specify the SCORE7 as the target architecture. This is the default.
25769
25770 @item -mscore7d
25771 @opindex mscore7d
25772 Specify the SCORE7D as the target architecture.
25773 @end table
25774
25775 @node SH Options
25776 @subsection SH Options
25777
25778 These @samp{-m} options are defined for the SH implementations:
25779
25780 @table @gcctabopt
25781 @item -m1
25782 @opindex m1
25783 Generate code for the SH1.
25784
25785 @item -m2
25786 @opindex m2
25787 Generate code for the SH2.
25788
25789 @item -m2e
25790 Generate code for the SH2e.
25791
25792 @item -m2a-nofpu
25793 @opindex m2a-nofpu
25794 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25795 that the floating-point unit is not used.
25796
25797 @item -m2a-single-only
25798 @opindex m2a-single-only
25799 Generate code for the SH2a-FPU, in such a way that no double-precision
25800 floating-point operations are used.
25801
25802 @item -m2a-single
25803 @opindex m2a-single
25804 Generate code for the SH2a-FPU assuming the floating-point unit is in
25805 single-precision mode by default.
25806
25807 @item -m2a
25808 @opindex m2a
25809 Generate code for the SH2a-FPU assuming the floating-point unit is in
25810 double-precision mode by default.
25811
25812 @item -m3
25813 @opindex m3
25814 Generate code for the SH3.
25815
25816 @item -m3e
25817 @opindex m3e
25818 Generate code for the SH3e.
25819
25820 @item -m4-nofpu
25821 @opindex m4-nofpu
25822 Generate code for the SH4 without a floating-point unit.
25823
25824 @item -m4-single-only
25825 @opindex m4-single-only
25826 Generate code for the SH4 with a floating-point unit that only
25827 supports single-precision arithmetic.
25828
25829 @item -m4-single
25830 @opindex m4-single
25831 Generate code for the SH4 assuming the floating-point unit is in
25832 single-precision mode by default.
25833
25834 @item -m4
25835 @opindex m4
25836 Generate code for the SH4.
25837
25838 @item -m4-100
25839 @opindex m4-100
25840 Generate code for SH4-100.
25841
25842 @item -m4-100-nofpu
25843 @opindex m4-100-nofpu
25844 Generate code for SH4-100 in such a way that the
25845 floating-point unit is not used.
25846
25847 @item -m4-100-single
25848 @opindex m4-100-single
25849 Generate code for SH4-100 assuming the floating-point unit is in
25850 single-precision mode by default.
25851
25852 @item -m4-100-single-only
25853 @opindex m4-100-single-only
25854 Generate code for SH4-100 in such a way that no double-precision
25855 floating-point operations are used.
25856
25857 @item -m4-200
25858 @opindex m4-200
25859 Generate code for SH4-200.
25860
25861 @item -m4-200-nofpu
25862 @opindex m4-200-nofpu
25863 Generate code for SH4-200 without in such a way that the
25864 floating-point unit is not used.
25865
25866 @item -m4-200-single
25867 @opindex m4-200-single
25868 Generate code for SH4-200 assuming the floating-point unit is in
25869 single-precision mode by default.
25870
25871 @item -m4-200-single-only
25872 @opindex m4-200-single-only
25873 Generate code for SH4-200 in such a way that no double-precision
25874 floating-point operations are used.
25875
25876 @item -m4-300
25877 @opindex m4-300
25878 Generate code for SH4-300.
25879
25880 @item -m4-300-nofpu
25881 @opindex m4-300-nofpu
25882 Generate code for SH4-300 without in such a way that the
25883 floating-point unit is not used.
25884
25885 @item -m4-300-single
25886 @opindex m4-300-single
25887 Generate code for SH4-300 in such a way that no double-precision
25888 floating-point operations are used.
25889
25890 @item -m4-300-single-only
25891 @opindex m4-300-single-only
25892 Generate code for SH4-300 in such a way that no double-precision
25893 floating-point operations are used.
25894
25895 @item -m4-340
25896 @opindex m4-340
25897 Generate code for SH4-340 (no MMU, no FPU).
25898
25899 @item -m4-500
25900 @opindex m4-500
25901 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25902 assembler.
25903
25904 @item -m4a-nofpu
25905 @opindex m4a-nofpu
25906 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25907 floating-point unit is not used.
25908
25909 @item -m4a-single-only
25910 @opindex m4a-single-only
25911 Generate code for the SH4a, in such a way that no double-precision
25912 floating-point operations are used.
25913
25914 @item -m4a-single
25915 @opindex m4a-single
25916 Generate code for the SH4a assuming the floating-point unit is in
25917 single-precision mode by default.
25918
25919 @item -m4a
25920 @opindex m4a
25921 Generate code for the SH4a.
25922
25923 @item -m4al
25924 @opindex m4al
25925 Same as @option{-m4a-nofpu}, except that it implicitly passes
25926 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25927 instructions at the moment.
25928
25929 @item -mb
25930 @opindex mb
25931 Compile code for the processor in big-endian mode.
25932
25933 @item -ml
25934 @opindex ml
25935 Compile code for the processor in little-endian mode.
25936
25937 @item -mdalign
25938 @opindex mdalign
25939 Align doubles at 64-bit boundaries. Note that this changes the calling
25940 conventions, and thus some functions from the standard C library do
25941 not work unless you recompile it first with @option{-mdalign}.
25942
25943 @item -mrelax
25944 @opindex mrelax
25945 Shorten some address references at link time, when possible; uses the
25946 linker option @option{-relax}.
25947
25948 @item -mbigtable
25949 @opindex mbigtable
25950 Use 32-bit offsets in @code{switch} tables. The default is to use
25951 16-bit offsets.
25952
25953 @item -mbitops
25954 @opindex mbitops
25955 Enable the use of bit manipulation instructions on SH2A.
25956
25957 @item -mfmovd
25958 @opindex mfmovd
25959 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25960 alignment constraints.
25961
25962 @item -mrenesas
25963 @opindex mrenesas
25964 Comply with the calling conventions defined by Renesas.
25965
25966 @item -mno-renesas
25967 @opindex mno-renesas
25968 Comply with the calling conventions defined for GCC before the Renesas
25969 conventions were available. This option is the default for all
25970 targets of the SH toolchain.
25971
25972 @item -mnomacsave
25973 @opindex mnomacsave
25974 Mark the @code{MAC} register as call-clobbered, even if
25975 @option{-mrenesas} is given.
25976
25977 @item -mieee
25978 @itemx -mno-ieee
25979 @opindex mieee
25980 @opindex mno-ieee
25981 Control the IEEE compliance of floating-point comparisons, which affects the
25982 handling of cases where the result of a comparison is unordered. By default
25983 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25984 enabled @option{-mno-ieee} is implicitly set, which results in faster
25985 floating-point greater-equal and less-equal comparisons. The implicit settings
25986 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25987
25988 @item -minline-ic_invalidate
25989 @opindex minline-ic_invalidate
25990 Inline code to invalidate instruction cache entries after setting up
25991 nested function trampolines.
25992 This option has no effect if @option{-musermode} is in effect and the selected
25993 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25994 instruction.
25995 If the selected code generation option does not allow the use of the @code{icbi}
25996 instruction, and @option{-musermode} is not in effect, the inlined code
25997 manipulates the instruction cache address array directly with an associative
25998 write. This not only requires privileged mode at run time, but it also
25999 fails if the cache line had been mapped via the TLB and has become unmapped.
26000
26001 @item -misize
26002 @opindex misize
26003 Dump instruction size and location in the assembly code.
26004
26005 @item -mpadstruct
26006 @opindex mpadstruct
26007 This option is deprecated. It pads structures to multiple of 4 bytes,
26008 which is incompatible with the SH ABI@.
26009
26010 @item -matomic-model=@var{model}
26011 @opindex matomic-model=@var{model}
26012 Sets the model of atomic operations and additional parameters as a comma
26013 separated list. For details on the atomic built-in functions see
26014 @ref{__atomic Builtins}. The following models and parameters are supported:
26015
26016 @table @samp
26017
26018 @item none
26019 Disable compiler generated atomic sequences and emit library calls for atomic
26020 operations. This is the default if the target is not @code{sh*-*-linux*}.
26021
26022 @item soft-gusa
26023 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26024 built-in functions. The generated atomic sequences require additional support
26025 from the interrupt/exception handling code of the system and are only suitable
26026 for SH3* and SH4* single-core systems. This option is enabled by default when
26027 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26028 this option also partially utilizes the hardware atomic instructions
26029 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26030 @samp{strict} is specified.
26031
26032 @item soft-tcb
26033 Generate software atomic sequences that use a variable in the thread control
26034 block. This is a variation of the gUSA sequences which can also be used on
26035 SH1* and SH2* targets. The generated atomic sequences require additional
26036 support from the interrupt/exception handling code of the system and are only
26037 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26038 parameter has to be specified as well.
26039
26040 @item soft-imask
26041 Generate software atomic sequences that temporarily disable interrupts by
26042 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26043 in privileged mode and is only suitable for single-core systems. Additional
26044 support from the interrupt/exception handling code of the system is not
26045 required. This model is enabled by default when the target is
26046 @code{sh*-*-linux*} and SH1* or SH2*.
26047
26048 @item hard-llcs
26049 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26050 instructions only. This is only available on SH4A and is suitable for
26051 multi-core systems. Since the hardware instructions support only 32 bit atomic
26052 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26053 Code compiled with this option is also compatible with other software
26054 atomic model interrupt/exception handling systems if executed on an SH4A
26055 system. Additional support from the interrupt/exception handling code of the
26056 system is not required for this model.
26057
26058 @item gbr-offset=
26059 This parameter specifies the offset in bytes of the variable in the thread
26060 control block structure that should be used by the generated atomic sequences
26061 when the @samp{soft-tcb} model has been selected. For other models this
26062 parameter is ignored. The specified value must be an integer multiple of four
26063 and in the range 0-1020.
26064
26065 @item strict
26066 This parameter prevents mixed usage of multiple atomic models, even if they
26067 are compatible, and makes the compiler generate atomic sequences of the
26068 specified model only.
26069
26070 @end table
26071
26072 @item -mtas
26073 @opindex mtas
26074 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26075 Notice that depending on the particular hardware and software configuration
26076 this can degrade overall performance due to the operand cache line flushes
26077 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26078 processors the @code{tas.b} instruction must be used with caution since it
26079 can result in data corruption for certain cache configurations.
26080
26081 @item -mprefergot
26082 @opindex mprefergot
26083 When generating position-independent code, emit function calls using
26084 the Global Offset Table instead of the Procedure Linkage Table.
26085
26086 @item -musermode
26087 @itemx -mno-usermode
26088 @opindex musermode
26089 @opindex mno-usermode
26090 Don't allow (allow) the compiler generating privileged mode code. Specifying
26091 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26092 inlined code would not work in user mode. @option{-musermode} is the default
26093 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26094 @option{-musermode} has no effect, since there is no user mode.
26095
26096 @item -multcost=@var{number}
26097 @opindex multcost=@var{number}
26098 Set the cost to assume for a multiply insn.
26099
26100 @item -mdiv=@var{strategy}
26101 @opindex mdiv=@var{strategy}
26102 Set the division strategy to be used for integer division operations.
26103 @var{strategy} can be one of:
26104
26105 @table @samp
26106
26107 @item call-div1
26108 Calls a library function that uses the single-step division instruction
26109 @code{div1} to perform the operation. Division by zero calculates an
26110 unspecified result and does not trap. This is the default except for SH4,
26111 SH2A and SHcompact.
26112
26113 @item call-fp
26114 Calls a library function that performs the operation in double precision
26115 floating point. Division by zero causes a floating-point exception. This is
26116 the default for SHcompact with FPU. Specifying this for targets that do not
26117 have a double precision FPU defaults to @code{call-div1}.
26118
26119 @item call-table
26120 Calls a library function that uses a lookup table for small divisors and
26121 the @code{div1} instruction with case distinction for larger divisors. Division
26122 by zero calculates an unspecified result and does not trap. This is the default
26123 for SH4. Specifying this for targets that do not have dynamic shift
26124 instructions defaults to @code{call-div1}.
26125
26126 @end table
26127
26128 When a division strategy has not been specified the default strategy is
26129 selected based on the current target. For SH2A the default strategy is to
26130 use the @code{divs} and @code{divu} instructions instead of library function
26131 calls.
26132
26133 @item -maccumulate-outgoing-args
26134 @opindex maccumulate-outgoing-args
26135 Reserve space once for outgoing arguments in the function prologue rather
26136 than around each call. Generally beneficial for performance and size. Also
26137 needed for unwinding to avoid changing the stack frame around conditional code.
26138
26139 @item -mdivsi3_libfunc=@var{name}
26140 @opindex mdivsi3_libfunc=@var{name}
26141 Set the name of the library function used for 32-bit signed division to
26142 @var{name}.
26143 This only affects the name used in the @samp{call} division strategies, and
26144 the compiler still expects the same sets of input/output/clobbered registers as
26145 if this option were not present.
26146
26147 @item -mfixed-range=@var{register-range}
26148 @opindex mfixed-range
26149 Generate code treating the given register range as fixed registers.
26150 A fixed register is one that the register allocator cannot use. This is
26151 useful when compiling kernel code. A register range is specified as
26152 two registers separated by a dash. Multiple register ranges can be
26153 specified separated by a comma.
26154
26155 @item -mbranch-cost=@var{num}
26156 @opindex mbranch-cost=@var{num}
26157 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26158 make the compiler try to generate more branch-free code if possible.
26159 If not specified the value is selected depending on the processor type that
26160 is being compiled for.
26161
26162 @item -mzdcbranch
26163 @itemx -mno-zdcbranch
26164 @opindex mzdcbranch
26165 @opindex mno-zdcbranch
26166 Assume (do not assume) that zero displacement conditional branch instructions
26167 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26168 compiler prefers zero displacement branch code sequences. This is
26169 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26170 disabled by specifying @option{-mno-zdcbranch}.
26171
26172 @item -mcbranch-force-delay-slot
26173 @opindex mcbranch-force-delay-slot
26174 Force the usage of delay slots for conditional branches, which stuffs the delay
26175 slot with a @code{nop} if a suitable instruction cannot be found. By default
26176 this option is disabled. It can be enabled to work around hardware bugs as
26177 found in the original SH7055.
26178
26179 @item -mfused-madd
26180 @itemx -mno-fused-madd
26181 @opindex mfused-madd
26182 @opindex mno-fused-madd
26183 Generate code that uses (does not use) the floating-point multiply and
26184 accumulate instructions. These instructions are generated by default
26185 if hardware floating point is used. The machine-dependent
26186 @option{-mfused-madd} option is now mapped to the machine-independent
26187 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26188 mapped to @option{-ffp-contract=off}.
26189
26190 @item -mfsca
26191 @itemx -mno-fsca
26192 @opindex mfsca
26193 @opindex mno-fsca
26194 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26195 and cosine approximations. The option @option{-mfsca} must be used in
26196 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26197 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26198 approximations even if @option{-funsafe-math-optimizations} is in effect.
26199
26200 @item -mfsrra
26201 @itemx -mno-fsrra
26202 @opindex mfsrra
26203 @opindex mno-fsrra
26204 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26205 reciprocal square root approximations. The option @option{-mfsrra} must be used
26206 in combination with @option{-funsafe-math-optimizations} and
26207 @option{-ffinite-math-only}. It is enabled by default when generating code for
26208 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26209 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26210 in effect.
26211
26212 @item -mpretend-cmove
26213 @opindex mpretend-cmove
26214 Prefer zero-displacement conditional branches for conditional move instruction
26215 patterns. This can result in faster code on the SH4 processor.
26216
26217 @item -mfdpic
26218 @opindex fdpic
26219 Generate code using the FDPIC ABI.
26220
26221 @end table
26222
26223 @node Solaris 2 Options
26224 @subsection Solaris 2 Options
26225 @cindex Solaris 2 options
26226
26227 These @samp{-m} options are supported on Solaris 2:
26228
26229 @table @gcctabopt
26230 @item -mclear-hwcap
26231 @opindex mclear-hwcap
26232 @option{-mclear-hwcap} tells the compiler to remove the hardware
26233 capabilities generated by the Solaris assembler. This is only necessary
26234 when object files use ISA extensions not supported by the current
26235 machine, but check at runtime whether or not to use them.
26236
26237 @item -mimpure-text
26238 @opindex mimpure-text
26239 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26240 the compiler to not pass @option{-z text} to the linker when linking a
26241 shared object. Using this option, you can link position-dependent
26242 code into a shared object.
26243
26244 @option{-mimpure-text} suppresses the ``relocations remain against
26245 allocatable but non-writable sections'' linker error message.
26246 However, the necessary relocations trigger copy-on-write, and the
26247 shared object is not actually shared across processes. Instead of
26248 using @option{-mimpure-text}, you should compile all source code with
26249 @option{-fpic} or @option{-fPIC}.
26250
26251 @end table
26252
26253 These switches are supported in addition to the above on Solaris 2:
26254
26255 @table @gcctabopt
26256 @item -pthreads
26257 @opindex pthreads
26258 This is a synonym for @option{-pthread}.
26259 @end table
26260
26261 @node SPARC Options
26262 @subsection SPARC Options
26263 @cindex SPARC options
26264
26265 These @samp{-m} options are supported on the SPARC:
26266
26267 @table @gcctabopt
26268 @item -mno-app-regs
26269 @itemx -mapp-regs
26270 @opindex mno-app-regs
26271 @opindex mapp-regs
26272 Specify @option{-mapp-regs} to generate output using the global registers
26273 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26274 global register 1, each global register 2 through 4 is then treated as an
26275 allocable register that is clobbered by function calls. This is the default.
26276
26277 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26278 specify @option{-mno-app-regs}. You should compile libraries and system
26279 software with this option.
26280
26281 @item -mflat
26282 @itemx -mno-flat
26283 @opindex mflat
26284 @opindex mno-flat
26285 With @option{-mflat}, the compiler does not generate save/restore instructions
26286 and uses a ``flat'' or single register window model. This model is compatible
26287 with the regular register window model. The local registers and the input
26288 registers (0--5) are still treated as ``call-saved'' registers and are
26289 saved on the stack as needed.
26290
26291 With @option{-mno-flat} (the default), the compiler generates save/restore
26292 instructions (except for leaf functions). This is the normal operating mode.
26293
26294 @item -mfpu
26295 @itemx -mhard-float
26296 @opindex mfpu
26297 @opindex mhard-float
26298 Generate output containing floating-point instructions. This is the
26299 default.
26300
26301 @item -mno-fpu
26302 @itemx -msoft-float
26303 @opindex mno-fpu
26304 @opindex msoft-float
26305 Generate output containing library calls for floating point.
26306 @strong{Warning:} the requisite libraries are not available for all SPARC
26307 targets. Normally the facilities of the machine's usual C compiler are
26308 used, but this cannot be done directly in cross-compilation. You must make
26309 your own arrangements to provide suitable library functions for
26310 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26311 @samp{sparclite-*-*} do provide software floating-point support.
26312
26313 @option{-msoft-float} changes the calling convention in the output file;
26314 therefore, it is only useful if you compile @emph{all} of a program with
26315 this option. In particular, you need to compile @file{libgcc.a}, the
26316 library that comes with GCC, with @option{-msoft-float} in order for
26317 this to work.
26318
26319 @item -mhard-quad-float
26320 @opindex mhard-quad-float
26321 Generate output containing quad-word (long double) floating-point
26322 instructions.
26323
26324 @item -msoft-quad-float
26325 @opindex msoft-quad-float
26326 Generate output containing library calls for quad-word (long double)
26327 floating-point instructions. The functions called are those specified
26328 in the SPARC ABI@. This is the default.
26329
26330 As of this writing, there are no SPARC implementations that have hardware
26331 support for the quad-word floating-point instructions. They all invoke
26332 a trap handler for one of these instructions, and then the trap handler
26333 emulates the effect of the instruction. Because of the trap handler overhead,
26334 this is much slower than calling the ABI library routines. Thus the
26335 @option{-msoft-quad-float} option is the default.
26336
26337 @item -mno-unaligned-doubles
26338 @itemx -munaligned-doubles
26339 @opindex mno-unaligned-doubles
26340 @opindex munaligned-doubles
26341 Assume that doubles have 8-byte alignment. This is the default.
26342
26343 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26344 alignment only if they are contained in another type, or if they have an
26345 absolute address. Otherwise, it assumes they have 4-byte alignment.
26346 Specifying this option avoids some rare compatibility problems with code
26347 generated by other compilers. It is not the default because it results
26348 in a performance loss, especially for floating-point code.
26349
26350 @item -muser-mode
26351 @itemx -mno-user-mode
26352 @opindex muser-mode
26353 @opindex mno-user-mode
26354 Do not generate code that can only run in supervisor mode. This is relevant
26355 only for the @code{casa} instruction emitted for the LEON3 processor. This
26356 is the default.
26357
26358 @item -mfaster-structs
26359 @itemx -mno-faster-structs
26360 @opindex mfaster-structs
26361 @opindex mno-faster-structs
26362 With @option{-mfaster-structs}, the compiler assumes that structures
26363 should have 8-byte alignment. This enables the use of pairs of
26364 @code{ldd} and @code{std} instructions for copies in structure
26365 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26366 However, the use of this changed alignment directly violates the SPARC
26367 ABI@. Thus, it's intended only for use on targets where the developer
26368 acknowledges that their resulting code is not directly in line with
26369 the rules of the ABI@.
26370
26371 @item -mstd-struct-return
26372 @itemx -mno-std-struct-return
26373 @opindex mstd-struct-return
26374 @opindex mno-std-struct-return
26375 With @option{-mstd-struct-return}, the compiler generates checking code
26376 in functions returning structures or unions to detect size mismatches
26377 between the two sides of function calls, as per the 32-bit ABI@.
26378
26379 The default is @option{-mno-std-struct-return}. This option has no effect
26380 in 64-bit mode.
26381
26382 @item -mlra
26383 @itemx -mno-lra
26384 @opindex mlra
26385 @opindex mno-lra
26386 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26387 so @option{-mno-lra} needs to be passed to get old Reload.
26388
26389 @item -mcpu=@var{cpu_type}
26390 @opindex mcpu
26391 Set the instruction set, register set, and instruction scheduling parameters
26392 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26393 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26394 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26395 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26396 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26397 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26398
26399 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26400 which selects the best architecture option for the host processor.
26401 @option{-mcpu=native} has no effect if GCC does not recognize
26402 the processor.
26403
26404 Default instruction scheduling parameters are used for values that select
26405 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26406 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26407
26408 Here is a list of each supported architecture and their supported
26409 implementations.
26410
26411 @table @asis
26412 @item v7
26413 cypress, leon3v7
26414
26415 @item v8
26416 supersparc, hypersparc, leon, leon3
26417
26418 @item sparclite
26419 f930, f934, sparclite86x
26420
26421 @item sparclet
26422 tsc701
26423
26424 @item v9
26425 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26426 niagara7, m8
26427 @end table
26428
26429 By default (unless configured otherwise), GCC generates code for the V7
26430 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26431 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26432 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26433 SPARCStation 1, 2, IPX etc.
26434
26435 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26436 architecture. The only difference from V7 code is that the compiler emits
26437 the integer multiply and integer divide instructions which exist in SPARC-V8
26438 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26439 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26440 2000 series.
26441
26442 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26443 the SPARC architecture. This adds the integer multiply, integer divide step
26444 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26445 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26446 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26447 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26448 MB86934 chip, which is the more recent SPARClite with FPU@.
26449
26450 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26451 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26452 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26453 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26454 optimizes it for the TEMIC SPARClet chip.
26455
26456 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26457 architecture. This adds 64-bit integer and floating-point move instructions,
26458 3 additional floating-point condition code registers and conditional move
26459 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26460 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26461 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26462 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26463 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26464 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26465 additionally optimizes it for Sun UltraSPARC T2 chips. With
26466 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26467 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26468 additionally optimizes it for Sun UltraSPARC T4 chips. With
26469 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26470 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26471 additionally optimizes it for Oracle M8 chips.
26472
26473 @item -mtune=@var{cpu_type}
26474 @opindex mtune
26475 Set the instruction scheduling parameters for machine type
26476 @var{cpu_type}, but do not set the instruction set or register set that the
26477 option @option{-mcpu=@var{cpu_type}} does.
26478
26479 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26480 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26481 that select a particular CPU implementation. Those are
26482 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26483 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26484 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26485 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26486 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26487 and GNU/Linux toolchains, @samp{native} can also be used.
26488
26489 @item -mv8plus
26490 @itemx -mno-v8plus
26491 @opindex mv8plus
26492 @opindex mno-v8plus
26493 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26494 difference from the V8 ABI is that the global and out registers are
26495 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26496 mode for all SPARC-V9 processors.
26497
26498 @item -mvis
26499 @itemx -mno-vis
26500 @opindex mvis
26501 @opindex mno-vis
26502 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26503 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26504
26505 @item -mvis2
26506 @itemx -mno-vis2
26507 @opindex mvis2
26508 @opindex mno-vis2
26509 With @option{-mvis2}, GCC generates code that takes advantage of
26510 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26511 default is @option{-mvis2} when targeting a cpu that supports such
26512 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26513 also sets @option{-mvis}.
26514
26515 @item -mvis3
26516 @itemx -mno-vis3
26517 @opindex mvis3
26518 @opindex mno-vis3
26519 With @option{-mvis3}, GCC generates code that takes advantage of
26520 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26521 default is @option{-mvis3} when targeting a cpu that supports such
26522 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26523 also sets @option{-mvis2} and @option{-mvis}.
26524
26525 @item -mvis4
26526 @itemx -mno-vis4
26527 @opindex mvis4
26528 @opindex mno-vis4
26529 With @option{-mvis4}, GCC generates code that takes advantage of
26530 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26531 default is @option{-mvis4} when targeting a cpu that supports such
26532 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26533 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26534
26535 @item -mvis4b
26536 @itemx -mno-vis4b
26537 @opindex mvis4b
26538 @opindex mno-vis4b
26539 With @option{-mvis4b}, GCC generates code that takes advantage of
26540 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26541 the additional VIS instructions introduced in the Oracle SPARC
26542 Architecture 2017. The default is @option{-mvis4b} when targeting a
26543 cpu that supports such instructions, such as m8 and later. Setting
26544 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26545 @option{-mvis2} and @option{-mvis}.
26546
26547 @item -mcbcond
26548 @itemx -mno-cbcond
26549 @opindex mcbcond
26550 @opindex mno-cbcond
26551 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26552 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26553 when targeting a CPU that supports such instructions, such as Niagara-4 and
26554 later.
26555
26556 @item -mfmaf
26557 @itemx -mno-fmaf
26558 @opindex mfmaf
26559 @opindex mno-fmaf
26560 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26561 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26562 when targeting a CPU that supports such instructions, such as Niagara-3 and
26563 later.
26564
26565 @item -mfsmuld
26566 @itemx -mno-fsmuld
26567 @opindex mfsmuld
26568 @opindex mno-fsmuld
26569 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26570 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26571 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26572 or V9 with FPU except @option{-mcpu=leon}.
26573
26574 @item -mpopc
26575 @itemx -mno-popc
26576 @opindex mpopc
26577 @opindex mno-popc
26578 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26579 Population Count instruction. The default is @option{-mpopc}
26580 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26581 later.
26582
26583 @item -msubxc
26584 @itemx -mno-subxc
26585 @opindex msubxc
26586 @opindex mno-subxc
26587 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26588 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26589 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26590 later.
26591
26592 @item -mfix-at697f
26593 @opindex mfix-at697f
26594 Enable the documented workaround for the single erratum of the Atmel AT697F
26595 processor (which corresponds to erratum #13 of the AT697E processor).
26596
26597 @item -mfix-ut699
26598 @opindex mfix-ut699
26599 Enable the documented workarounds for the floating-point errata and the data
26600 cache nullify errata of the UT699 processor.
26601
26602 @item -mfix-ut700
26603 @opindex mfix-ut700
26604 Enable the documented workaround for the back-to-back store errata of
26605 the UT699E/UT700 processor.
26606
26607 @item -mfix-gr712rc
26608 @opindex mfix-gr712rc
26609 Enable the documented workaround for the back-to-back store errata of
26610 the GR712RC processor.
26611 @end table
26612
26613 These @samp{-m} options are supported in addition to the above
26614 on SPARC-V9 processors in 64-bit environments:
26615
26616 @table @gcctabopt
26617 @item -m32
26618 @itemx -m64
26619 @opindex m32
26620 @opindex m64
26621 Generate code for a 32-bit or 64-bit environment.
26622 The 32-bit environment sets int, long and pointer to 32 bits.
26623 The 64-bit environment sets int to 32 bits and long and pointer
26624 to 64 bits.
26625
26626 @item -mcmodel=@var{which}
26627 @opindex mcmodel
26628 Set the code model to one of
26629
26630 @table @samp
26631 @item medlow
26632 The Medium/Low code model: 64-bit addresses, programs
26633 must be linked in the low 32 bits of memory. Programs can be statically
26634 or dynamically linked.
26635
26636 @item medmid
26637 The Medium/Middle code model: 64-bit addresses, programs
26638 must be linked in the low 44 bits of memory, the text and data segments must
26639 be less than 2GB in size and the data segment must be located within 2GB of
26640 the text segment.
26641
26642 @item medany
26643 The Medium/Anywhere code model: 64-bit addresses, programs
26644 may be linked anywhere in memory, the text and data segments must be less
26645 than 2GB in size and the data segment must be located within 2GB of the
26646 text segment.
26647
26648 @item embmedany
26649 The Medium/Anywhere code model for embedded systems:
26650 64-bit addresses, the text and data segments must be less than 2GB in
26651 size, both starting anywhere in memory (determined at link time). The
26652 global register %g4 points to the base of the data segment. Programs
26653 are statically linked and PIC is not supported.
26654 @end table
26655
26656 @item -mmemory-model=@var{mem-model}
26657 @opindex mmemory-model
26658 Set the memory model in force on the processor to one of
26659
26660 @table @samp
26661 @item default
26662 The default memory model for the processor and operating system.
26663
26664 @item rmo
26665 Relaxed Memory Order
26666
26667 @item pso
26668 Partial Store Order
26669
26670 @item tso
26671 Total Store Order
26672
26673 @item sc
26674 Sequential Consistency
26675 @end table
26676
26677 These memory models are formally defined in Appendix D of the SPARC-V9
26678 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26679
26680 @item -mstack-bias
26681 @itemx -mno-stack-bias
26682 @opindex mstack-bias
26683 @opindex mno-stack-bias
26684 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26685 frame pointer if present, are offset by @minus{}2047 which must be added back
26686 when making stack frame references. This is the default in 64-bit mode.
26687 Otherwise, assume no such offset is present.
26688 @end table
26689
26690 @node SPU Options
26691 @subsection SPU Options
26692 @cindex SPU options
26693
26694 These @samp{-m} options are supported on the SPU:
26695
26696 @table @gcctabopt
26697 @item -mwarn-reloc
26698 @itemx -merror-reloc
26699 @opindex mwarn-reloc
26700 @opindex merror-reloc
26701
26702 The loader for SPU does not handle dynamic relocations. By default, GCC
26703 gives an error when it generates code that requires a dynamic
26704 relocation. @option{-mno-error-reloc} disables the error,
26705 @option{-mwarn-reloc} generates a warning instead.
26706
26707 @item -msafe-dma
26708 @itemx -munsafe-dma
26709 @opindex msafe-dma
26710 @opindex munsafe-dma
26711
26712 Instructions that initiate or test completion of DMA must not be
26713 reordered with respect to loads and stores of the memory that is being
26714 accessed.
26715 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26716 memory accesses, but that can lead to inefficient code in places where the
26717 memory is known to not change. Rather than mark the memory as volatile,
26718 you can use @option{-msafe-dma} to tell the compiler to treat
26719 the DMA instructions as potentially affecting all memory.
26720
26721 @item -mbranch-hints
26722 @opindex mbranch-hints
26723
26724 By default, GCC generates a branch hint instruction to avoid
26725 pipeline stalls for always-taken or probably-taken branches. A hint
26726 is not generated closer than 8 instructions away from its branch.
26727 There is little reason to disable them, except for debugging purposes,
26728 or to make an object a little bit smaller.
26729
26730 @item -msmall-mem
26731 @itemx -mlarge-mem
26732 @opindex msmall-mem
26733 @opindex mlarge-mem
26734
26735 By default, GCC generates code assuming that addresses are never larger
26736 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26737 a full 32-bit address.
26738
26739 @item -mstdmain
26740 @opindex mstdmain
26741
26742 By default, GCC links against startup code that assumes the SPU-style
26743 main function interface (which has an unconventional parameter list).
26744 With @option{-mstdmain}, GCC links your program against startup
26745 code that assumes a C99-style interface to @code{main}, including a
26746 local copy of @code{argv} strings.
26747
26748 @item -mfixed-range=@var{register-range}
26749 @opindex mfixed-range
26750 Generate code treating the given register range as fixed registers.
26751 A fixed register is one that the register allocator cannot use. This is
26752 useful when compiling kernel code. A register range is specified as
26753 two registers separated by a dash. Multiple register ranges can be
26754 specified separated by a comma.
26755
26756 @item -mea32
26757 @itemx -mea64
26758 @opindex mea32
26759 @opindex mea64
26760 Compile code assuming that pointers to the PPU address space accessed
26761 via the @code{__ea} named address space qualifier are either 32 or 64
26762 bits wide. The default is 32 bits. As this is an ABI-changing option,
26763 all object code in an executable must be compiled with the same setting.
26764
26765 @item -maddress-space-conversion
26766 @itemx -mno-address-space-conversion
26767 @opindex maddress-space-conversion
26768 @opindex mno-address-space-conversion
26769 Allow/disallow treating the @code{__ea} address space as superset
26770 of the generic address space. This enables explicit type casts
26771 between @code{__ea} and generic pointer as well as implicit
26772 conversions of generic pointers to @code{__ea} pointers. The
26773 default is to allow address space pointer conversions.
26774
26775 @item -mcache-size=@var{cache-size}
26776 @opindex mcache-size
26777 This option controls the version of libgcc that the compiler links to an
26778 executable and selects a software-managed cache for accessing variables
26779 in the @code{__ea} address space with a particular cache size. Possible
26780 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26781 and @samp{128}. The default cache size is 64KB.
26782
26783 @item -matomic-updates
26784 @itemx -mno-atomic-updates
26785 @opindex matomic-updates
26786 @opindex mno-atomic-updates
26787 This option controls the version of libgcc that the compiler links to an
26788 executable and selects whether atomic updates to the software-managed
26789 cache of PPU-side variables are used. If you use atomic updates, changes
26790 to a PPU variable from SPU code using the @code{__ea} named address space
26791 qualifier do not interfere with changes to other PPU variables residing
26792 in the same cache line from PPU code. If you do not use atomic updates,
26793 such interference may occur; however, writing back cache lines is
26794 more efficient. The default behavior is to use atomic updates.
26795
26796 @item -mdual-nops
26797 @itemx -mdual-nops=@var{n}
26798 @opindex mdual-nops
26799 By default, GCC inserts NOPs to increase dual issue when it expects
26800 it to increase performance. @var{n} can be a value from 0 to 10. A
26801 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26802 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26803
26804 @item -mhint-max-nops=@var{n}
26805 @opindex mhint-max-nops
26806 Maximum number of NOPs to insert for a branch hint. A branch hint must
26807 be at least 8 instructions away from the branch it is affecting. GCC
26808 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26809 generate the branch hint.
26810
26811 @item -mhint-max-distance=@var{n}
26812 @opindex mhint-max-distance
26813 The encoding of the branch hint instruction limits the hint to be within
26814 256 instructions of the branch it is affecting. By default, GCC makes
26815 sure it is within 125.
26816
26817 @item -msafe-hints
26818 @opindex msafe-hints
26819 Work around a hardware bug that causes the SPU to stall indefinitely.
26820 By default, GCC inserts the @code{hbrp} instruction to make sure
26821 this stall won't happen.
26822
26823 @end table
26824
26825 @node System V Options
26826 @subsection Options for System V
26827
26828 These additional options are available on System V Release 4 for
26829 compatibility with other compilers on those systems:
26830
26831 @table @gcctabopt
26832 @item -G
26833 @opindex G
26834 Create a shared object.
26835 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26836
26837 @item -Qy
26838 @opindex Qy
26839 Identify the versions of each tool used by the compiler, in a
26840 @code{.ident} assembler directive in the output.
26841
26842 @item -Qn
26843 @opindex Qn
26844 Refrain from adding @code{.ident} directives to the output file (this is
26845 the default).
26846
26847 @item -YP,@var{dirs}
26848 @opindex YP
26849 Search the directories @var{dirs}, and no others, for libraries
26850 specified with @option{-l}.
26851
26852 @item -Ym,@var{dir}
26853 @opindex Ym
26854 Look in the directory @var{dir} to find the M4 preprocessor.
26855 The assembler uses this option.
26856 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26857 @c the generic assembler that comes with Solaris takes just -Ym.
26858 @end table
26859
26860 @node TILE-Gx Options
26861 @subsection TILE-Gx Options
26862 @cindex TILE-Gx options
26863
26864 These @samp{-m} options are supported on the TILE-Gx:
26865
26866 @table @gcctabopt
26867 @item -mcmodel=small
26868 @opindex mcmodel=small
26869 Generate code for the small model. The distance for direct calls is
26870 limited to 500M in either direction. PC-relative addresses are 32
26871 bits. Absolute addresses support the full address range.
26872
26873 @item -mcmodel=large
26874 @opindex mcmodel=large
26875 Generate code for the large model. There is no limitation on call
26876 distance, pc-relative addresses, or absolute addresses.
26877
26878 @item -mcpu=@var{name}
26879 @opindex mcpu
26880 Selects the type of CPU to be targeted. Currently the only supported
26881 type is @samp{tilegx}.
26882
26883 @item -m32
26884 @itemx -m64
26885 @opindex m32
26886 @opindex m64
26887 Generate code for a 32-bit or 64-bit environment. The 32-bit
26888 environment sets int, long, and pointer to 32 bits. The 64-bit
26889 environment sets int to 32 bits and long and pointer to 64 bits.
26890
26891 @item -mbig-endian
26892 @itemx -mlittle-endian
26893 @opindex mbig-endian
26894 @opindex mlittle-endian
26895 Generate code in big/little endian mode, respectively.
26896 @end table
26897
26898 @node TILEPro Options
26899 @subsection TILEPro Options
26900 @cindex TILEPro options
26901
26902 These @samp{-m} options are supported on the TILEPro:
26903
26904 @table @gcctabopt
26905 @item -mcpu=@var{name}
26906 @opindex mcpu
26907 Selects the type of CPU to be targeted. Currently the only supported
26908 type is @samp{tilepro}.
26909
26910 @item -m32
26911 @opindex m32
26912 Generate code for a 32-bit environment, which sets int, long, and
26913 pointer to 32 bits. This is the only supported behavior so the flag
26914 is essentially ignored.
26915 @end table
26916
26917 @node V850 Options
26918 @subsection V850 Options
26919 @cindex V850 Options
26920
26921 These @samp{-m} options are defined for V850 implementations:
26922
26923 @table @gcctabopt
26924 @item -mlong-calls
26925 @itemx -mno-long-calls
26926 @opindex mlong-calls
26927 @opindex mno-long-calls
26928 Treat all calls as being far away (near). If calls are assumed to be
26929 far away, the compiler always loads the function's address into a
26930 register, and calls indirect through the pointer.
26931
26932 @item -mno-ep
26933 @itemx -mep
26934 @opindex mno-ep
26935 @opindex mep
26936 Do not optimize (do optimize) basic blocks that use the same index
26937 pointer 4 or more times to copy pointer into the @code{ep} register, and
26938 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26939 option is on by default if you optimize.
26940
26941 @item -mno-prolog-function
26942 @itemx -mprolog-function
26943 @opindex mno-prolog-function
26944 @opindex mprolog-function
26945 Do not use (do use) external functions to save and restore registers
26946 at the prologue and epilogue of a function. The external functions
26947 are slower, but use less code space if more than one function saves
26948 the same number of registers. The @option{-mprolog-function} option
26949 is on by default if you optimize.
26950
26951 @item -mspace
26952 @opindex mspace
26953 Try to make the code as small as possible. At present, this just turns
26954 on the @option{-mep} and @option{-mprolog-function} options.
26955
26956 @item -mtda=@var{n}
26957 @opindex mtda
26958 Put static or global variables whose size is @var{n} bytes or less into
26959 the tiny data area that register @code{ep} points to. The tiny data
26960 area can hold up to 256 bytes in total (128 bytes for byte references).
26961
26962 @item -msda=@var{n}
26963 @opindex msda
26964 Put static or global variables whose size is @var{n} bytes or less into
26965 the small data area that register @code{gp} points to. The small data
26966 area can hold up to 64 kilobytes.
26967
26968 @item -mzda=@var{n}
26969 @opindex mzda
26970 Put static or global variables whose size is @var{n} bytes or less into
26971 the first 32 kilobytes of memory.
26972
26973 @item -mv850
26974 @opindex mv850
26975 Specify that the target processor is the V850.
26976
26977 @item -mv850e3v5
26978 @opindex mv850e3v5
26979 Specify that the target processor is the V850E3V5. The preprocessor
26980 constant @code{__v850e3v5__} is defined if this option is used.
26981
26982 @item -mv850e2v4
26983 @opindex mv850e2v4
26984 Specify that the target processor is the V850E3V5. This is an alias for
26985 the @option{-mv850e3v5} option.
26986
26987 @item -mv850e2v3
26988 @opindex mv850e2v3
26989 Specify that the target processor is the V850E2V3. The preprocessor
26990 constant @code{__v850e2v3__} is defined if this option is used.
26991
26992 @item -mv850e2
26993 @opindex mv850e2
26994 Specify that the target processor is the V850E2. The preprocessor
26995 constant @code{__v850e2__} is defined if this option is used.
26996
26997 @item -mv850e1
26998 @opindex mv850e1
26999 Specify that the target processor is the V850E1. The preprocessor
27000 constants @code{__v850e1__} and @code{__v850e__} are defined if
27001 this option is used.
27002
27003 @item -mv850es
27004 @opindex mv850es
27005 Specify that the target processor is the V850ES. This is an alias for
27006 the @option{-mv850e1} option.
27007
27008 @item -mv850e
27009 @opindex mv850e
27010 Specify that the target processor is the V850E@. The preprocessor
27011 constant @code{__v850e__} is defined if this option is used.
27012
27013 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27014 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27015 are defined then a default target processor is chosen and the
27016 relevant @samp{__v850*__} preprocessor constant is defined.
27017
27018 The preprocessor constants @code{__v850} and @code{__v851__} are always
27019 defined, regardless of which processor variant is the target.
27020
27021 @item -mdisable-callt
27022 @itemx -mno-disable-callt
27023 @opindex mdisable-callt
27024 @opindex mno-disable-callt
27025 This option suppresses generation of the @code{CALLT} instruction for the
27026 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27027 architecture.
27028
27029 This option is enabled by default when the RH850 ABI is
27030 in use (see @option{-mrh850-abi}), and disabled by default when the
27031 GCC ABI is in use. If @code{CALLT} instructions are being generated
27032 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27033
27034 @item -mrelax
27035 @itemx -mno-relax
27036 @opindex mrelax
27037 @opindex mno-relax
27038 Pass on (or do not pass on) the @option{-mrelax} command-line option
27039 to the assembler.
27040
27041 @item -mlong-jumps
27042 @itemx -mno-long-jumps
27043 @opindex mlong-jumps
27044 @opindex mno-long-jumps
27045 Disable (or re-enable) the generation of PC-relative jump instructions.
27046
27047 @item -msoft-float
27048 @itemx -mhard-float
27049 @opindex msoft-float
27050 @opindex mhard-float
27051 Disable (or re-enable) the generation of hardware floating point
27052 instructions. This option is only significant when the target
27053 architecture is @samp{V850E2V3} or higher. If hardware floating point
27054 instructions are being generated then the C preprocessor symbol
27055 @code{__FPU_OK__} is defined, otherwise the symbol
27056 @code{__NO_FPU__} is defined.
27057
27058 @item -mloop
27059 @opindex mloop
27060 Enables the use of the e3v5 LOOP instruction. The use of this
27061 instruction is not enabled by default when the e3v5 architecture is
27062 selected because its use is still experimental.
27063
27064 @item -mrh850-abi
27065 @itemx -mghs
27066 @opindex mrh850-abi
27067 @opindex mghs
27068 Enables support for the RH850 version of the V850 ABI. This is the
27069 default. With this version of the ABI the following rules apply:
27070
27071 @itemize
27072 @item
27073 Integer sized structures and unions are returned via a memory pointer
27074 rather than a register.
27075
27076 @item
27077 Large structures and unions (more than 8 bytes in size) are passed by
27078 value.
27079
27080 @item
27081 Functions are aligned to 16-bit boundaries.
27082
27083 @item
27084 The @option{-m8byte-align} command-line option is supported.
27085
27086 @item
27087 The @option{-mdisable-callt} command-line option is enabled by
27088 default. The @option{-mno-disable-callt} command-line option is not
27089 supported.
27090 @end itemize
27091
27092 When this version of the ABI is enabled the C preprocessor symbol
27093 @code{__V850_RH850_ABI__} is defined.
27094
27095 @item -mgcc-abi
27096 @opindex mgcc-abi
27097 Enables support for the old GCC version of the V850 ABI. With this
27098 version of the ABI the following rules apply:
27099
27100 @itemize
27101 @item
27102 Integer sized structures and unions are returned in register @code{r10}.
27103
27104 @item
27105 Large structures and unions (more than 8 bytes in size) are passed by
27106 reference.
27107
27108 @item
27109 Functions are aligned to 32-bit boundaries, unless optimizing for
27110 size.
27111
27112 @item
27113 The @option{-m8byte-align} command-line option is not supported.
27114
27115 @item
27116 The @option{-mdisable-callt} command-line option is supported but not
27117 enabled by default.
27118 @end itemize
27119
27120 When this version of the ABI is enabled the C preprocessor symbol
27121 @code{__V850_GCC_ABI__} is defined.
27122
27123 @item -m8byte-align
27124 @itemx -mno-8byte-align
27125 @opindex m8byte-align
27126 @opindex mno-8byte-align
27127 Enables support for @code{double} and @code{long long} types to be
27128 aligned on 8-byte boundaries. The default is to restrict the
27129 alignment of all objects to at most 4-bytes. When
27130 @option{-m8byte-align} is in effect the C preprocessor symbol
27131 @code{__V850_8BYTE_ALIGN__} is defined.
27132
27133 @item -mbig-switch
27134 @opindex mbig-switch
27135 Generate code suitable for big switch tables. Use this option only if
27136 the assembler/linker complain about out of range branches within a switch
27137 table.
27138
27139 @item -mapp-regs
27140 @opindex mapp-regs
27141 This option causes r2 and r5 to be used in the code generated by
27142 the compiler. This setting is the default.
27143
27144 @item -mno-app-regs
27145 @opindex mno-app-regs
27146 This option causes r2 and r5 to be treated as fixed registers.
27147
27148 @end table
27149
27150 @node VAX Options
27151 @subsection VAX Options
27152 @cindex VAX options
27153
27154 These @samp{-m} options are defined for the VAX:
27155
27156 @table @gcctabopt
27157 @item -munix
27158 @opindex munix
27159 Do not output certain jump instructions (@code{aobleq} and so on)
27160 that the Unix assembler for the VAX cannot handle across long
27161 ranges.
27162
27163 @item -mgnu
27164 @opindex mgnu
27165 Do output those jump instructions, on the assumption that the
27166 GNU assembler is being used.
27167
27168 @item -mg
27169 @opindex mg
27170 Output code for G-format floating-point numbers instead of D-format.
27171 @end table
27172
27173 @node Visium Options
27174 @subsection Visium Options
27175 @cindex Visium options
27176
27177 @table @gcctabopt
27178
27179 @item -mdebug
27180 @opindex mdebug
27181 A program which performs file I/O and is destined to run on an MCM target
27182 should be linked with this option. It causes the libraries libc.a and
27183 libdebug.a to be linked. The program should be run on the target under
27184 the control of the GDB remote debugging stub.
27185
27186 @item -msim
27187 @opindex msim
27188 A program which performs file I/O and is destined to run on the simulator
27189 should be linked with option. This causes libraries libc.a and libsim.a to
27190 be linked.
27191
27192 @item -mfpu
27193 @itemx -mhard-float
27194 @opindex mfpu
27195 @opindex mhard-float
27196 Generate code containing floating-point instructions. This is the
27197 default.
27198
27199 @item -mno-fpu
27200 @itemx -msoft-float
27201 @opindex mno-fpu
27202 @opindex msoft-float
27203 Generate code containing library calls for floating-point.
27204
27205 @option{-msoft-float} changes the calling convention in the output file;
27206 therefore, it is only useful if you compile @emph{all} of a program with
27207 this option. In particular, you need to compile @file{libgcc.a}, the
27208 library that comes with GCC, with @option{-msoft-float} in order for
27209 this to work.
27210
27211 @item -mcpu=@var{cpu_type}
27212 @opindex mcpu
27213 Set the instruction set, register set, and instruction scheduling parameters
27214 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27215 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27216
27217 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27218
27219 By default (unless configured otherwise), GCC generates code for the GR5
27220 variant of the Visium architecture.
27221
27222 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27223 architecture. The only difference from GR5 code is that the compiler will
27224 generate block move instructions.
27225
27226 @item -mtune=@var{cpu_type}
27227 @opindex mtune
27228 Set the instruction scheduling parameters for machine type @var{cpu_type},
27229 but do not set the instruction set or register set that the option
27230 @option{-mcpu=@var{cpu_type}} would.
27231
27232 @item -msv-mode
27233 @opindex msv-mode
27234 Generate code for the supervisor mode, where there are no restrictions on
27235 the access to general registers. This is the default.
27236
27237 @item -muser-mode
27238 @opindex muser-mode
27239 Generate code for the user mode, where the access to some general registers
27240 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27241 mode; on the GR6, only registers r29 to r31 are affected.
27242 @end table
27243
27244 @node VMS Options
27245 @subsection VMS Options
27246
27247 These @samp{-m} options are defined for the VMS implementations:
27248
27249 @table @gcctabopt
27250 @item -mvms-return-codes
27251 @opindex mvms-return-codes
27252 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27253 condition (e.g.@: error) codes.
27254
27255 @item -mdebug-main=@var{prefix}
27256 @opindex mdebug-main=@var{prefix}
27257 Flag the first routine whose name starts with @var{prefix} as the main
27258 routine for the debugger.
27259
27260 @item -mmalloc64
27261 @opindex mmalloc64
27262 Default to 64-bit memory allocation routines.
27263
27264 @item -mpointer-size=@var{size}
27265 @opindex mpointer-size=@var{size}
27266 Set the default size of pointers. Possible options for @var{size} are
27267 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27268 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27269 The later option disables @code{pragma pointer_size}.
27270 @end table
27271
27272 @node VxWorks Options
27273 @subsection VxWorks Options
27274 @cindex VxWorks Options
27275
27276 The options in this section are defined for all VxWorks targets.
27277 Options specific to the target hardware are listed with the other
27278 options for that target.
27279
27280 @table @gcctabopt
27281 @item -mrtp
27282 @opindex mrtp
27283 GCC can generate code for both VxWorks kernels and real time processes
27284 (RTPs). This option switches from the former to the latter. It also
27285 defines the preprocessor macro @code{__RTP__}.
27286
27287 @item -non-static
27288 @opindex non-static
27289 Link an RTP executable against shared libraries rather than static
27290 libraries. The options @option{-static} and @option{-shared} can
27291 also be used for RTPs (@pxref{Link Options}); @option{-static}
27292 is the default.
27293
27294 @item -Bstatic
27295 @itemx -Bdynamic
27296 @opindex Bstatic
27297 @opindex Bdynamic
27298 These options are passed down to the linker. They are defined for
27299 compatibility with Diab.
27300
27301 @item -Xbind-lazy
27302 @opindex Xbind-lazy
27303 Enable lazy binding of function calls. This option is equivalent to
27304 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27305
27306 @item -Xbind-now
27307 @opindex Xbind-now
27308 Disable lazy binding of function calls. This option is the default and
27309 is defined for compatibility with Diab.
27310 @end table
27311
27312 @node x86 Options
27313 @subsection x86 Options
27314 @cindex x86 Options
27315
27316 These @samp{-m} options are defined for the x86 family of computers.
27317
27318 @table @gcctabopt
27319
27320 @item -march=@var{cpu-type}
27321 @opindex march
27322 Generate instructions for the machine type @var{cpu-type}. In contrast to
27323 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27324 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27325 to generate code that may not run at all on processors other than the one
27326 indicated. Specifying @option{-march=@var{cpu-type}} implies
27327 @option{-mtune=@var{cpu-type}}.
27328
27329 The choices for @var{cpu-type} are:
27330
27331 @table @samp
27332 @item native
27333 This selects the CPU to generate code for at compilation time by determining
27334 the processor type of the compiling machine. Using @option{-march=native}
27335 enables all instruction subsets supported by the local machine (hence
27336 the result might not run on different machines). Using @option{-mtune=native}
27337 produces code optimized for the local machine under the constraints
27338 of the selected instruction set.
27339
27340 @item x86-64
27341 A generic CPU with 64-bit extensions.
27342
27343 @item i386
27344 Original Intel i386 CPU@.
27345
27346 @item i486
27347 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27348
27349 @item i586
27350 @itemx pentium
27351 Intel Pentium CPU with no MMX support.
27352
27353 @item lakemont
27354 Intel Lakemont MCU, based on Intel Pentium CPU.
27355
27356 @item pentium-mmx
27357 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27358
27359 @item pentiumpro
27360 Intel Pentium Pro CPU@.
27361
27362 @item i686
27363 When used with @option{-march}, the Pentium Pro
27364 instruction set is used, so the code runs on all i686 family chips.
27365 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27366
27367 @item pentium2
27368 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27369 support.
27370
27371 @item pentium3
27372 @itemx pentium3m
27373 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27374 set support.
27375
27376 @item pentium-m
27377 Intel Pentium M; low-power version of Intel Pentium III CPU
27378 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27379
27380 @item pentium4
27381 @itemx pentium4m
27382 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27383
27384 @item prescott
27385 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27386 set support.
27387
27388 @item nocona
27389 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27390 SSE2 and SSE3 instruction set support.
27391
27392 @item core2
27393 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27394 instruction set support.
27395
27396 @item nehalem
27397 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27398 SSE4.1, SSE4.2 and POPCNT instruction set support.
27399
27400 @item westmere
27401 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27402 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27403
27404 @item sandybridge
27405 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27406 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27407
27408 @item ivybridge
27409 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27410 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27411 instruction set support.
27412
27413 @item haswell
27414 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27415 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27416 BMI, BMI2 and F16C instruction set support.
27417
27418 @item broadwell
27419 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27420 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27421 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27422
27423 @item skylake
27424 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27425 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27426 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27427 XSAVES instruction set support.
27428
27429 @item bonnell
27430 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27431 instruction set support.
27432
27433 @item silvermont
27434 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27435 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27436
27437 @item goldmont
27438 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27439 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27440 instruction set support.
27441
27442 @item goldmont-plus
27443 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27444 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27445 PTWRITE, RDPID, SGX and UMIP instruction set support.
27446
27447 @item tremont
27448 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27449 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27450 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27451
27452 @item knl
27453 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27454 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27455 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27456 AVX512CD instruction set support.
27457
27458 @item knm
27459 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27460 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27461 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27462 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27463
27464 @item skylake-avx512
27465 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27466 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27467 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27468 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27469
27470 @item cannonlake
27471 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27472 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27473 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27474 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27475 AVX512IFMA, SHA and UMIP instruction set support.
27476
27477 @item icelake-client
27478 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27479 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27480 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27481 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27482 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27483 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27484
27485 @item icelake-server
27486 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27487 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27488 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27489 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27490 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27491 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27492 set support.
27493
27494 @item cascadelake
27495 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27496 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27497 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27498 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27499
27500 @item k6
27501 AMD K6 CPU with MMX instruction set support.
27502
27503 @item k6-2
27504 @itemx k6-3
27505 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27506
27507 @item athlon
27508 @itemx athlon-tbird
27509 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27510 support.
27511
27512 @item athlon-4
27513 @itemx athlon-xp
27514 @itemx athlon-mp
27515 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27516 instruction set support.
27517
27518 @item k8
27519 @itemx opteron
27520 @itemx athlon64
27521 @itemx athlon-fx
27522 Processors based on the AMD K8 core with x86-64 instruction set support,
27523 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27524 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27525 instruction set extensions.)
27526
27527 @item k8-sse3
27528 @itemx opteron-sse3
27529 @itemx athlon64-sse3
27530 Improved versions of AMD K8 cores with SSE3 instruction set support.
27531
27532 @item amdfam10
27533 @itemx barcelona
27534 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27535 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27536 instruction set extensions.)
27537
27538 @item bdver1
27539 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27540 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27541 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27542 @item bdver2
27543 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27544 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27545 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27546 extensions.)
27547 @item bdver3
27548 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27549 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27550 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27551 64-bit instruction set extensions.
27552 @item bdver4
27553 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27554 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27555 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27556 SSE4.2, ABM and 64-bit instruction set extensions.
27557
27558 @item znver1
27559 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27560 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27561 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27562 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27563 instruction set extensions.
27564 @item znver2
27565 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27566 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27567 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27568 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27569 instruction set extensions.)
27570
27571
27572 @item btver1
27573 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27574 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27575 instruction set extensions.)
27576
27577 @item btver2
27578 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27579 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27580 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27581
27582 @item winchip-c6
27583 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27584 set support.
27585
27586 @item winchip2
27587 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27588 instruction set support.
27589
27590 @item c3
27591 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27592 (No scheduling is implemented for this chip.)
27593
27594 @item c3-2
27595 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27596 (No scheduling is implemented for this chip.)
27597
27598 @item c7
27599 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27600 (No scheduling is implemented for this chip.)
27601
27602 @item samuel-2
27603 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27604 (No scheduling is implemented for this chip.)
27605
27606 @item nehemiah
27607 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27608 (No scheduling is implemented for this chip.)
27609
27610 @item esther
27611 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27612 (No scheduling is implemented for this chip.)
27613
27614 @item eden-x2
27615 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27616 (No scheduling is implemented for this chip.)
27617
27618 @item eden-x4
27619 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27620 AVX and AVX2 instruction set support.
27621 (No scheduling is implemented for this chip.)
27622
27623 @item nano
27624 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27625 instruction set support.
27626 (No scheduling is implemented for this chip.)
27627
27628 @item nano-1000
27629 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27630 instruction set support.
27631 (No scheduling is implemented for this chip.)
27632
27633 @item nano-2000
27634 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27635 instruction set support.
27636 (No scheduling is implemented for this chip.)
27637
27638 @item nano-3000
27639 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27640 instruction set support.
27641 (No scheduling is implemented for this chip.)
27642
27643 @item nano-x2
27644 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27645 instruction set support.
27646 (No scheduling is implemented for this chip.)
27647
27648 @item nano-x4
27649 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27650 instruction set support.
27651 (No scheduling is implemented for this chip.)
27652
27653 @item geode
27654 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27655 @end table
27656
27657 @item -mtune=@var{cpu-type}
27658 @opindex mtune
27659 Tune to @var{cpu-type} everything applicable about the generated code, except
27660 for the ABI and the set of available instructions.
27661 While picking a specific @var{cpu-type} schedules things appropriately
27662 for that particular chip, the compiler does not generate any code that
27663 cannot run on the default machine type unless you use a
27664 @option{-march=@var{cpu-type}} option.
27665 For example, if GCC is configured for i686-pc-linux-gnu
27666 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27667 but still runs on i686 machines.
27668
27669 The choices for @var{cpu-type} are the same as for @option{-march}.
27670 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27671
27672 @table @samp
27673 @item generic
27674 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27675 If you know the CPU on which your code will run, then you should use
27676 the corresponding @option{-mtune} or @option{-march} option instead of
27677 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27678 of your application will have, then you should use this option.
27679
27680 As new processors are deployed in the marketplace, the behavior of this
27681 option will change. Therefore, if you upgrade to a newer version of
27682 GCC, code generation controlled by this option will change to reflect
27683 the processors
27684 that are most common at the time that version of GCC is released.
27685
27686 There is no @option{-march=generic} option because @option{-march}
27687 indicates the instruction set the compiler can use, and there is no
27688 generic instruction set applicable to all processors. In contrast,
27689 @option{-mtune} indicates the processor (or, in this case, collection of
27690 processors) for which the code is optimized.
27691
27692 @item intel
27693 Produce code optimized for the most current Intel processors, which are
27694 Haswell and Silvermont for this version of GCC. If you know the CPU
27695 on which your code will run, then you should use the corresponding
27696 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27697 But, if you want your application performs better on both Haswell and
27698 Silvermont, then you should use this option.
27699
27700 As new Intel processors are deployed in the marketplace, the behavior of
27701 this option will change. Therefore, if you upgrade to a newer version of
27702 GCC, code generation controlled by this option will change to reflect
27703 the most current Intel processors at the time that version of GCC is
27704 released.
27705
27706 There is no @option{-march=intel} option because @option{-march} indicates
27707 the instruction set the compiler can use, and there is no common
27708 instruction set applicable to all processors. In contrast,
27709 @option{-mtune} indicates the processor (or, in this case, collection of
27710 processors) for which the code is optimized.
27711 @end table
27712
27713 @item -mcpu=@var{cpu-type}
27714 @opindex mcpu
27715 A deprecated synonym for @option{-mtune}.
27716
27717 @item -mfpmath=@var{unit}
27718 @opindex mfpmath
27719 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27720 for @var{unit} are:
27721
27722 @table @samp
27723 @item 387
27724 Use the standard 387 floating-point coprocessor present on the majority of chips and
27725 emulated otherwise. Code compiled with this option runs almost everywhere.
27726 The temporary results are computed in 80-bit precision instead of the precision
27727 specified by the type, resulting in slightly different results compared to most
27728 of other chips. See @option{-ffloat-store} for more detailed description.
27729
27730 This is the default choice for non-Darwin x86-32 targets.
27731
27732 @item sse
27733 Use scalar floating-point instructions present in the SSE instruction set.
27734 This instruction set is supported by Pentium III and newer chips,
27735 and in the AMD line
27736 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27737 instruction set supports only single-precision arithmetic, thus the double and
27738 extended-precision arithmetic are still done using 387. A later version, present
27739 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27740 arithmetic too.
27741
27742 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27743 or @option{-msse2} switches to enable SSE extensions and make this option
27744 effective. For the x86-64 compiler, these extensions are enabled by default.
27745
27746 The resulting code should be considerably faster in the majority of cases and avoid
27747 the numerical instability problems of 387 code, but may break some existing
27748 code that expects temporaries to be 80 bits.
27749
27750 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27751 and the default choice for x86-32 targets with the SSE2 instruction set
27752 when @option{-ffast-math} is enabled.
27753
27754 @item sse,387
27755 @itemx sse+387
27756 @itemx both
27757 Attempt to utilize both instruction sets at once. This effectively doubles the
27758 amount of available registers, and on chips with separate execution units for
27759 387 and SSE the execution resources too. Use this option with care, as it is
27760 still experimental, because the GCC register allocator does not model separate
27761 functional units well, resulting in unstable performance.
27762 @end table
27763
27764 @item -masm=@var{dialect}
27765 @opindex masm=@var{dialect}
27766 Output assembly instructions using selected @var{dialect}. Also affects
27767 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27768 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27769 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27770 not support @samp{intel}.
27771
27772 @item -mieee-fp
27773 @itemx -mno-ieee-fp
27774 @opindex mieee-fp
27775 @opindex mno-ieee-fp
27776 Control whether or not the compiler uses IEEE floating-point
27777 comparisons. These correctly handle the case where the result of a
27778 comparison is unordered.
27779
27780 @item -m80387
27781 @itemx -mhard-float
27782 @opindex 80387
27783 @opindex mhard-float
27784 Generate output containing 80387 instructions for floating point.
27785
27786 @item -mno-80387
27787 @itemx -msoft-float
27788 @opindex no-80387
27789 @opindex msoft-float
27790 Generate output containing library calls for floating point.
27791
27792 @strong{Warning:} the requisite libraries are not part of GCC@.
27793 Normally the facilities of the machine's usual C compiler are used, but
27794 this cannot be done directly in cross-compilation. You must make your
27795 own arrangements to provide suitable library functions for
27796 cross-compilation.
27797
27798 On machines where a function returns floating-point results in the 80387
27799 register stack, some floating-point opcodes may be emitted even if
27800 @option{-msoft-float} is used.
27801
27802 @item -mno-fp-ret-in-387
27803 @opindex mno-fp-ret-in-387
27804 @opindex mfp-ret-in-387
27805 Do not use the FPU registers for return values of functions.
27806
27807 The usual calling convention has functions return values of types
27808 @code{float} and @code{double} in an FPU register, even if there
27809 is no FPU@. The idea is that the operating system should emulate
27810 an FPU@.
27811
27812 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27813 in ordinary CPU registers instead.
27814
27815 @item -mno-fancy-math-387
27816 @opindex mno-fancy-math-387
27817 @opindex mfancy-math-387
27818 Some 387 emulators do not support the @code{sin}, @code{cos} and
27819 @code{sqrt} instructions for the 387. Specify this option to avoid
27820 generating those instructions.
27821 This option is overridden when @option{-march}
27822 indicates that the target CPU always has an FPU and so the
27823 instruction does not need emulation. These
27824 instructions are not generated unless you also use the
27825 @option{-funsafe-math-optimizations} switch.
27826
27827 @item -malign-double
27828 @itemx -mno-align-double
27829 @opindex malign-double
27830 @opindex mno-align-double
27831 Control whether GCC aligns @code{double}, @code{long double}, and
27832 @code{long long} variables on a two-word boundary or a one-word
27833 boundary. Aligning @code{double} variables on a two-word boundary
27834 produces code that runs somewhat faster on a Pentium at the
27835 expense of more memory.
27836
27837 On x86-64, @option{-malign-double} is enabled by default.
27838
27839 @strong{Warning:} if you use the @option{-malign-double} switch,
27840 structures containing the above types are aligned differently than
27841 the published application binary interface specifications for the x86-32
27842 and are not binary compatible with structures in code compiled
27843 without that switch.
27844
27845 @item -m96bit-long-double
27846 @itemx -m128bit-long-double
27847 @opindex m96bit-long-double
27848 @opindex m128bit-long-double
27849 These switches control the size of @code{long double} type. The x86-32
27850 application binary interface specifies the size to be 96 bits,
27851 so @option{-m96bit-long-double} is the default in 32-bit mode.
27852
27853 Modern architectures (Pentium and newer) prefer @code{long double}
27854 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27855 conforming to the ABI, this is not possible. So specifying
27856 @option{-m128bit-long-double} aligns @code{long double}
27857 to a 16-byte boundary by padding the @code{long double} with an additional
27858 32-bit zero.
27859
27860 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27861 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27862
27863 Notice that neither of these options enable any extra precision over the x87
27864 standard of 80 bits for a @code{long double}.
27865
27866 @strong{Warning:} if you override the default value for your target ABI, this
27867 changes the size of
27868 structures and arrays containing @code{long double} variables,
27869 as well as modifying the function calling convention for functions taking
27870 @code{long double}. Hence they are not binary-compatible
27871 with code compiled without that switch.
27872
27873 @item -mlong-double-64
27874 @itemx -mlong-double-80
27875 @itemx -mlong-double-128
27876 @opindex mlong-double-64
27877 @opindex mlong-double-80
27878 @opindex mlong-double-128
27879 These switches control the size of @code{long double} type. A size
27880 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27881 type. This is the default for 32-bit Bionic C library. A size
27882 of 128 bits makes the @code{long double} type equivalent to the
27883 @code{__float128} type. This is the default for 64-bit Bionic C library.
27884
27885 @strong{Warning:} if you override the default value for your target ABI, this
27886 changes the size of
27887 structures and arrays containing @code{long double} variables,
27888 as well as modifying the function calling convention for functions taking
27889 @code{long double}. Hence they are not binary-compatible
27890 with code compiled without that switch.
27891
27892 @item -malign-data=@var{type}
27893 @opindex malign-data
27894 Control how GCC aligns variables. Supported values for @var{type} are
27895 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27896 and earlier, @samp{abi} uses alignment value as specified by the
27897 psABI, and @samp{cacheline} uses increased alignment value to match
27898 the cache line size. @samp{compat} is the default.
27899
27900 @item -mlarge-data-threshold=@var{threshold}
27901 @opindex mlarge-data-threshold
27902 When @option{-mcmodel=medium} is specified, data objects larger than
27903 @var{threshold} are placed in the large data section. This value must be the
27904 same across all objects linked into the binary, and defaults to 65535.
27905
27906 @item -mrtd
27907 @opindex mrtd
27908 Use a different function-calling convention, in which functions that
27909 take a fixed number of arguments return with the @code{ret @var{num}}
27910 instruction, which pops their arguments while returning. This saves one
27911 instruction in the caller since there is no need to pop the arguments
27912 there.
27913
27914 You can specify that an individual function is called with this calling
27915 sequence with the function attribute @code{stdcall}. You can also
27916 override the @option{-mrtd} option by using the function attribute
27917 @code{cdecl}. @xref{Function Attributes}.
27918
27919 @strong{Warning:} this calling convention is incompatible with the one
27920 normally used on Unix, so you cannot use it if you need to call
27921 libraries compiled with the Unix compiler.
27922
27923 Also, you must provide function prototypes for all functions that
27924 take variable numbers of arguments (including @code{printf});
27925 otherwise incorrect code is generated for calls to those
27926 functions.
27927
27928 In addition, seriously incorrect code results if you call a
27929 function with too many arguments. (Normally, extra arguments are
27930 harmlessly ignored.)
27931
27932 @item -mregparm=@var{num}
27933 @opindex mregparm
27934 Control how many registers are used to pass integer arguments. By
27935 default, no registers are used to pass arguments, and at most 3
27936 registers can be used. You can control this behavior for a specific
27937 function by using the function attribute @code{regparm}.
27938 @xref{Function Attributes}.
27939
27940 @strong{Warning:} if you use this switch, and
27941 @var{num} is nonzero, then you must build all modules with the same
27942 value, including any libraries. This includes the system libraries and
27943 startup modules.
27944
27945 @item -msseregparm
27946 @opindex msseregparm
27947 Use SSE register passing conventions for float and double arguments
27948 and return values. You can control this behavior for a specific
27949 function by using the function attribute @code{sseregparm}.
27950 @xref{Function Attributes}.
27951
27952 @strong{Warning:} if you use this switch then you must build all
27953 modules with the same value, including any libraries. This includes
27954 the system libraries and startup modules.
27955
27956 @item -mvect8-ret-in-mem
27957 @opindex mvect8-ret-in-mem
27958 Return 8-byte vectors in memory instead of MMX registers. This is the
27959 default on VxWorks to match the ABI of the Sun Studio compilers until
27960 version 12. @emph{Only} use this option if you need to remain
27961 compatible with existing code produced by those previous compiler
27962 versions or older versions of GCC@.
27963
27964 @item -mpc32
27965 @itemx -mpc64
27966 @itemx -mpc80
27967 @opindex mpc32
27968 @opindex mpc64
27969 @opindex mpc80
27970
27971 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27972 is specified, the significands of results of floating-point operations are
27973 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27974 significands of results of floating-point operations to 53 bits (double
27975 precision) and @option{-mpc80} rounds the significands of results of
27976 floating-point operations to 64 bits (extended double precision), which is
27977 the default. When this option is used, floating-point operations in higher
27978 precisions are not available to the programmer without setting the FPU
27979 control word explicitly.
27980
27981 Setting the rounding of floating-point operations to less than the default
27982 80 bits can speed some programs by 2% or more. Note that some mathematical
27983 libraries assume that extended-precision (80-bit) floating-point operations
27984 are enabled by default; routines in such libraries could suffer significant
27985 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27986 when this option is used to set the precision to less than extended precision.
27987
27988 @item -mstackrealign
27989 @opindex mstackrealign
27990 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27991 option generates an alternate prologue and epilogue that realigns the
27992 run-time stack if necessary. This supports mixing legacy codes that keep
27993 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27994 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27995 applicable to individual functions.
27996
27997 @item -mpreferred-stack-boundary=@var{num}
27998 @opindex mpreferred-stack-boundary
27999 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28000 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28001 the default is 4 (16 bytes or 128 bits).
28002
28003 @strong{Warning:} When generating code for the x86-64 architecture with
28004 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28005 used to keep the stack boundary aligned to 8 byte boundary. Since
28006 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28007 intended to be used in controlled environment where stack space is
28008 important limitation. This option leads to wrong code when functions
28009 compiled with 16 byte stack alignment (such as functions from a standard
28010 library) are called with misaligned stack. In this case, SSE
28011 instructions may lead to misaligned memory access traps. In addition,
28012 variable arguments are handled incorrectly for 16 byte aligned
28013 objects (including x87 long double and __int128), leading to wrong
28014 results. You must build all modules with
28015 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28016 includes the system libraries and startup modules.
28017
28018 @item -mincoming-stack-boundary=@var{num}
28019 @opindex mincoming-stack-boundary
28020 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28021 boundary. If @option{-mincoming-stack-boundary} is not specified,
28022 the one specified by @option{-mpreferred-stack-boundary} is used.
28023
28024 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28025 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28026 suffer significant run time performance penalties. On Pentium III, the
28027 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28028 properly if it is not 16-byte aligned.
28029
28030 To ensure proper alignment of this values on the stack, the stack boundary
28031 must be as aligned as that required by any value stored on the stack.
28032 Further, every function must be generated such that it keeps the stack
28033 aligned. Thus calling a function compiled with a higher preferred
28034 stack boundary from a function compiled with a lower preferred stack
28035 boundary most likely misaligns the stack. It is recommended that
28036 libraries that use callbacks always use the default setting.
28037
28038 This extra alignment does consume extra stack space, and generally
28039 increases code size. Code that is sensitive to stack space usage, such
28040 as embedded systems and operating system kernels, may want to reduce the
28041 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28042
28043 @need 200
28044 @item -mmmx
28045 @opindex mmmx
28046 @need 200
28047 @itemx -msse
28048 @opindex msse
28049 @need 200
28050 @itemx -msse2
28051 @opindex msse2
28052 @need 200
28053 @itemx -msse3
28054 @opindex msse3
28055 @need 200
28056 @itemx -mssse3
28057 @opindex mssse3
28058 @need 200
28059 @itemx -msse4
28060 @opindex msse4
28061 @need 200
28062 @itemx -msse4a
28063 @opindex msse4a
28064 @need 200
28065 @itemx -msse4.1
28066 @opindex msse4.1
28067 @need 200
28068 @itemx -msse4.2
28069 @opindex msse4.2
28070 @need 200
28071 @itemx -mavx
28072 @opindex mavx
28073 @need 200
28074 @itemx -mavx2
28075 @opindex mavx2
28076 @need 200
28077 @itemx -mavx512f
28078 @opindex mavx512f
28079 @need 200
28080 @itemx -mavx512pf
28081 @opindex mavx512pf
28082 @need 200
28083 @itemx -mavx512er
28084 @opindex mavx512er
28085 @need 200
28086 @itemx -mavx512cd
28087 @opindex mavx512cd
28088 @need 200
28089 @itemx -mavx512vl
28090 @opindex mavx512vl
28091 @need 200
28092 @itemx -mavx512bw
28093 @opindex mavx512bw
28094 @need 200
28095 @itemx -mavx512dq
28096 @opindex mavx512dq
28097 @need 200
28098 @itemx -mavx512ifma
28099 @opindex mavx512ifma
28100 @need 200
28101 @itemx -mavx512vbmi
28102 @opindex mavx512vbmi
28103 @need 200
28104 @itemx -msha
28105 @opindex msha
28106 @need 200
28107 @itemx -maes
28108 @opindex maes
28109 @need 200
28110 @itemx -mpclmul
28111 @opindex mpclmul
28112 @need 200
28113 @itemx -mclflushopt
28114 @opindex mclflushopt
28115 @need 200
28116 @itemx -mclwb
28117 @opindex mclwb
28118 @need 200
28119 @itemx -mfsgsbase
28120 @opindex mfsgsbase
28121 @need 200
28122 @itemx -mptwrite
28123 @opindex mptwrite
28124 @need 200
28125 @itemx -mrdrnd
28126 @opindex mrdrnd
28127 @need 200
28128 @itemx -mf16c
28129 @opindex mf16c
28130 @need 200
28131 @itemx -mfma
28132 @opindex mfma
28133 @need 200
28134 @itemx -mpconfig
28135 @opindex mpconfig
28136 @need 200
28137 @itemx -mwbnoinvd
28138 @opindex mwbnoinvd
28139 @need 200
28140 @itemx -mfma4
28141 @opindex mfma4
28142 @need 200
28143 @itemx -mprfchw
28144 @opindex mprfchw
28145 @need 200
28146 @itemx -mrdpid
28147 @opindex mrdpid
28148 @need 200
28149 @itemx -mprefetchwt1
28150 @opindex mprefetchwt1
28151 @need 200
28152 @itemx -mrdseed
28153 @opindex mrdseed
28154 @need 200
28155 @itemx -msgx
28156 @opindex msgx
28157 @need 200
28158 @itemx -mxop
28159 @opindex mxop
28160 @need 200
28161 @itemx -mlwp
28162 @opindex mlwp
28163 @need 200
28164 @itemx -m3dnow
28165 @opindex m3dnow
28166 @need 200
28167 @itemx -m3dnowa
28168 @opindex m3dnowa
28169 @need 200
28170 @itemx -mpopcnt
28171 @opindex mpopcnt
28172 @need 200
28173 @itemx -mabm
28174 @opindex mabm
28175 @need 200
28176 @itemx -madx
28177 @opindex madx
28178 @need 200
28179 @itemx -mbmi
28180 @opindex mbmi
28181 @need 200
28182 @itemx -mbmi2
28183 @opindex mbmi2
28184 @need 200
28185 @itemx -mlzcnt
28186 @opindex mlzcnt
28187 @need 200
28188 @itemx -mfxsr
28189 @opindex mfxsr
28190 @need 200
28191 @itemx -mxsave
28192 @opindex mxsave
28193 @need 200
28194 @itemx -mxsaveopt
28195 @opindex mxsaveopt
28196 @need 200
28197 @itemx -mxsavec
28198 @opindex mxsavec
28199 @need 200
28200 @itemx -mxsaves
28201 @opindex mxsaves
28202 @need 200
28203 @itemx -mrtm
28204 @opindex mrtm
28205 @need 200
28206 @itemx -mhle
28207 @opindex mhle
28208 @need 200
28209 @itemx -mtbm
28210 @opindex mtbm
28211 @need 200
28212 @itemx -mmwaitx
28213 @opindex mmwaitx
28214 @need 200
28215 @itemx -mclzero
28216 @opindex mclzero
28217 @need 200
28218 @itemx -mpku
28219 @opindex mpku
28220 @need 200
28221 @itemx -mavx512vbmi2
28222 @opindex mavx512vbmi2
28223 @need 200
28224 @itemx -mavx512bf16
28225 @opindex mavx512bf16
28226 @need 200
28227 @itemx -mgfni
28228 @opindex mgfni
28229 @need 200
28230 @itemx -mvaes
28231 @opindex mvaes
28232 @need 200
28233 @itemx -mwaitpkg
28234 @opindex mwaitpkg
28235 @need 200
28236 @itemx -mvpclmulqdq
28237 @opindex mvpclmulqdq
28238 @need 200
28239 @itemx -mavx512bitalg
28240 @opindex mavx512bitalg
28241 @need 200
28242 @itemx -mmovdiri
28243 @opindex mmovdiri
28244 @need 200
28245 @itemx -mmovdir64b
28246 @opindex mmovdir64b
28247 @need 200
28248 @itemx -menqcmd
28249 @opindex menqcmd
28250 @need 200
28251 @itemx -mavx512vpopcntdq
28252 @opindex mavx512vpopcntdq
28253 @need 200
28254 @itemx -mavx512vp2intersect
28255 @opindex mavx512vp2intersect
28256 @need 200
28257 @itemx -mavx5124fmaps
28258 @opindex mavx5124fmaps
28259 @need 200
28260 @itemx -mavx512vnni
28261 @opindex mavx512vnni
28262 @need 200
28263 @itemx -mavx5124vnniw
28264 @opindex mavx5124vnniw
28265 @need 200
28266 @itemx -mcldemote
28267 @opindex mcldemote
28268 These switches enable the use of instructions in the MMX, SSE,
28269 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28270 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28271 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28272 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28273 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28274 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28275 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28276 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28277 extended instruction sets. Each has a corresponding @option{-mno-} option to
28278 disable use of these instructions.
28279
28280 These extensions are also available as built-in functions: see
28281 @ref{x86 Built-in Functions}, for details of the functions enabled and
28282 disabled by these switches.
28283
28284 To generate SSE/SSE2 instructions automatically from floating-point
28285 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28286
28287 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28288 generates new AVX instructions or AVX equivalence for all SSEx instructions
28289 when needed.
28290
28291 These options enable GCC to use these extended instructions in
28292 generated code, even without @option{-mfpmath=sse}. Applications that
28293 perform run-time CPU detection must compile separate files for each
28294 supported architecture, using the appropriate flags. In particular,
28295 the file containing the CPU detection code should be compiled without
28296 these options.
28297
28298 @item -mdump-tune-features
28299 @opindex mdump-tune-features
28300 This option instructs GCC to dump the names of the x86 performance
28301 tuning features and default settings. The names can be used in
28302 @option{-mtune-ctrl=@var{feature-list}}.
28303
28304 @item -mtune-ctrl=@var{feature-list}
28305 @opindex mtune-ctrl=@var{feature-list}
28306 This option is used to do fine grain control of x86 code generation features.
28307 @var{feature-list} is a comma separated list of @var{feature} names. See also
28308 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28309 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28310 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28311 developers. Using it may lead to code paths not covered by testing and can
28312 potentially result in compiler ICEs or runtime errors.
28313
28314 @item -mno-default
28315 @opindex mno-default
28316 This option instructs GCC to turn off all tunable features. See also
28317 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28318
28319 @item -mcld
28320 @opindex mcld
28321 This option instructs GCC to emit a @code{cld} instruction in the prologue
28322 of functions that use string instructions. String instructions depend on
28323 the DF flag to select between autoincrement or autodecrement mode. While the
28324 ABI specifies the DF flag to be cleared on function entry, some operating
28325 systems violate this specification by not clearing the DF flag in their
28326 exception dispatchers. The exception handler can be invoked with the DF flag
28327 set, which leads to wrong direction mode when string instructions are used.
28328 This option can be enabled by default on 32-bit x86 targets by configuring
28329 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28330 instructions can be suppressed with the @option{-mno-cld} compiler option
28331 in this case.
28332
28333 @item -mvzeroupper
28334 @opindex mvzeroupper
28335 This option instructs GCC to emit a @code{vzeroupper} instruction
28336 before a transfer of control flow out of the function to minimize
28337 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28338 intrinsics.
28339
28340 @item -mprefer-avx128
28341 @opindex mprefer-avx128
28342 This option instructs GCC to use 128-bit AVX instructions instead of
28343 256-bit AVX instructions in the auto-vectorizer.
28344
28345 @item -mprefer-vector-width=@var{opt}
28346 @opindex mprefer-vector-width
28347 This option instructs GCC to use @var{opt}-bit vector width in instructions
28348 instead of default on the selected platform.
28349
28350 @table @samp
28351 @item none
28352 No extra limitations applied to GCC other than defined by the selected platform.
28353
28354 @item 128
28355 Prefer 128-bit vector width for instructions.
28356
28357 @item 256
28358 Prefer 256-bit vector width for instructions.
28359
28360 @item 512
28361 Prefer 512-bit vector width for instructions.
28362 @end table
28363
28364 @item -mcx16
28365 @opindex mcx16
28366 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28367 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28368 objects. This is useful for atomic updates of data structures exceeding one
28369 machine word in size. The compiler uses this instruction to implement
28370 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28371 128-bit integers, a library call is always used.
28372
28373 @item -msahf
28374 @opindex msahf
28375 This option enables generation of @code{SAHF} instructions in 64-bit code.
28376 Early Intel Pentium 4 CPUs with Intel 64 support,
28377 prior to the introduction of Pentium 4 G1 step in December 2005,
28378 lacked the @code{LAHF} and @code{SAHF} instructions
28379 which are supported by AMD64.
28380 These are load and store instructions, respectively, for certain status flags.
28381 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28382 @code{drem}, and @code{remainder} built-in functions;
28383 see @ref{Other Builtins} for details.
28384
28385 @item -mmovbe
28386 @opindex mmovbe
28387 This option enables use of the @code{movbe} instruction to implement
28388 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28389
28390 @item -mshstk
28391 @opindex mshstk
28392 The @option{-mshstk} option enables shadow stack built-in functions
28393 from x86 Control-flow Enforcement Technology (CET).
28394
28395 @item -mcrc32
28396 @opindex mcrc32
28397 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28398 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28399 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28400
28401 @item -mrecip
28402 @opindex mrecip
28403 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28404 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28405 with an additional Newton-Raphson step
28406 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28407 (and their vectorized
28408 variants) for single-precision floating-point arguments. These instructions
28409 are generated only when @option{-funsafe-math-optimizations} is enabled
28410 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28411 Note that while the throughput of the sequence is higher than the throughput
28412 of the non-reciprocal instruction, the precision of the sequence can be
28413 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28414
28415 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28416 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28417 combination), and doesn't need @option{-mrecip}.
28418
28419 Also note that GCC emits the above sequence with additional Newton-Raphson step
28420 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28421 already with @option{-ffast-math} (or the above option combination), and
28422 doesn't need @option{-mrecip}.
28423
28424 @item -mrecip=@var{opt}
28425 @opindex mrecip=opt
28426 This option controls which reciprocal estimate instructions
28427 may be used. @var{opt} is a comma-separated list of options, which may
28428 be preceded by a @samp{!} to invert the option:
28429
28430 @table @samp
28431 @item all
28432 Enable all estimate instructions.
28433
28434 @item default
28435 Enable the default instructions, equivalent to @option{-mrecip}.
28436
28437 @item none
28438 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28439
28440 @item div
28441 Enable the approximation for scalar division.
28442
28443 @item vec-div
28444 Enable the approximation for vectorized division.
28445
28446 @item sqrt
28447 Enable the approximation for scalar square root.
28448
28449 @item vec-sqrt
28450 Enable the approximation for vectorized square root.
28451 @end table
28452
28453 So, for example, @option{-mrecip=all,!sqrt} enables
28454 all of the reciprocal approximations, except for square root.
28455
28456 @item -mveclibabi=@var{type}
28457 @opindex mveclibabi
28458 Specifies the ABI type to use for vectorizing intrinsics using an
28459 external library. Supported values for @var{type} are @samp{svml}
28460 for the Intel short
28461 vector math library and @samp{acml} for the AMD math core library.
28462 To use this option, both @option{-ftree-vectorize} and
28463 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28464 ABI-compatible library must be specified at link time.
28465
28466 GCC currently emits calls to @code{vmldExp2},
28467 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28468 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28469 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28470 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28471 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28472 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28473 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28474 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28475 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28476 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28477 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28478 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28479 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28480 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28481 when @option{-mveclibabi=acml} is used.
28482
28483 @item -mabi=@var{name}
28484 @opindex mabi
28485 Generate code for the specified calling convention. Permissible values
28486 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28487 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28488 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28489 You can control this behavior for specific functions by
28490 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28491 @xref{Function Attributes}.
28492
28493 @item -mforce-indirect-call
28494 @opindex mforce-indirect-call
28495 Force all calls to functions to be indirect. This is useful
28496 when using Intel Processor Trace where it generates more precise timing
28497 information for function calls.
28498
28499 @item -mmanual-endbr
28500 @opindex mmanual-endbr
28501 Insert ENDBR instruction at function entry only via the @code{cf_check}
28502 function attribute. This is useful when used with the option
28503 @option{-fcf-protection=branch} to control ENDBR insertion at the
28504 function entry.
28505
28506 @item -mcall-ms2sysv-xlogues
28507 @opindex mcall-ms2sysv-xlogues
28508 @opindex mno-call-ms2sysv-xlogues
28509 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28510 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28511 default, the code for saving and restoring these registers is emitted inline,
28512 resulting in fairly lengthy prologues and epilogues. Using
28513 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28514 use stubs in the static portion of libgcc to perform these saves and restores,
28515 thus reducing function size at the cost of a few extra instructions.
28516
28517 @item -mtls-dialect=@var{type}
28518 @opindex mtls-dialect
28519 Generate code to access thread-local storage using the @samp{gnu} or
28520 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28521 @samp{gnu2} is more efficient, but it may add compile- and run-time
28522 requirements that cannot be satisfied on all systems.
28523
28524 @item -mpush-args
28525 @itemx -mno-push-args
28526 @opindex mpush-args
28527 @opindex mno-push-args
28528 Use PUSH operations to store outgoing parameters. This method is shorter
28529 and usually equally fast as method using SUB/MOV operations and is enabled
28530 by default. In some cases disabling it may improve performance because of
28531 improved scheduling and reduced dependencies.
28532
28533 @item -maccumulate-outgoing-args
28534 @opindex maccumulate-outgoing-args
28535 If enabled, the maximum amount of space required for outgoing arguments is
28536 computed in the function prologue. This is faster on most modern CPUs
28537 because of reduced dependencies, improved scheduling and reduced stack usage
28538 when the preferred stack boundary is not equal to 2. The drawback is a notable
28539 increase in code size. This switch implies @option{-mno-push-args}.
28540
28541 @item -mthreads
28542 @opindex mthreads
28543 Support thread-safe exception handling on MinGW. Programs that rely
28544 on thread-safe exception handling must compile and link all code with the
28545 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28546 @option{-D_MT}; when linking, it links in a special thread helper library
28547 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28548
28549 @item -mms-bitfields
28550 @itemx -mno-ms-bitfields
28551 @opindex mms-bitfields
28552 @opindex mno-ms-bitfields
28553
28554 Enable/disable bit-field layout compatible with the native Microsoft
28555 Windows compiler.
28556
28557 If @code{packed} is used on a structure, or if bit-fields are used,
28558 it may be that the Microsoft ABI lays out the structure differently
28559 than the way GCC normally does. Particularly when moving packed
28560 data between functions compiled with GCC and the native Microsoft compiler
28561 (either via function call or as data in a file), it may be necessary to access
28562 either format.
28563
28564 This option is enabled by default for Microsoft Windows
28565 targets. This behavior can also be controlled locally by use of variable
28566 or type attributes. For more information, see @ref{x86 Variable Attributes}
28567 and @ref{x86 Type Attributes}.
28568
28569 The Microsoft structure layout algorithm is fairly simple with the exception
28570 of the bit-field packing.
28571 The padding and alignment of members of structures and whether a bit-field
28572 can straddle a storage-unit boundary are determine by these rules:
28573
28574 @enumerate
28575 @item Structure members are stored sequentially in the order in which they are
28576 declared: the first member has the lowest memory address and the last member
28577 the highest.
28578
28579 @item Every data object has an alignment requirement. The alignment requirement
28580 for all data except structures, unions, and arrays is either the size of the
28581 object or the current packing size (specified with either the
28582 @code{aligned} attribute or the @code{pack} pragma),
28583 whichever is less. For structures, unions, and arrays,
28584 the alignment requirement is the largest alignment requirement of its members.
28585 Every object is allocated an offset so that:
28586
28587 @smallexample
28588 offset % alignment_requirement == 0
28589 @end smallexample
28590
28591 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28592 unit if the integral types are the same size and if the next bit-field fits
28593 into the current allocation unit without crossing the boundary imposed by the
28594 common alignment requirements of the bit-fields.
28595 @end enumerate
28596
28597 MSVC interprets zero-length bit-fields in the following ways:
28598
28599 @enumerate
28600 @item If a zero-length bit-field is inserted between two bit-fields that
28601 are normally coalesced, the bit-fields are not coalesced.
28602
28603 For example:
28604
28605 @smallexample
28606 struct
28607 @{
28608 unsigned long bf_1 : 12;
28609 unsigned long : 0;
28610 unsigned long bf_2 : 12;
28611 @} t1;
28612 @end smallexample
28613
28614 @noindent
28615 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28616 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28617
28618 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28619 alignment of the zero-length bit-field is greater than the member that follows it,
28620 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28621
28622 For example:
28623
28624 @smallexample
28625 struct
28626 @{
28627 char foo : 4;
28628 short : 0;
28629 char bar;
28630 @} t2;
28631
28632 struct
28633 @{
28634 char foo : 4;
28635 short : 0;
28636 double bar;
28637 @} t3;
28638 @end smallexample
28639
28640 @noindent
28641 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28642 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28643 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28644 of the structure.
28645
28646 Taking this into account, it is important to note the following:
28647
28648 @enumerate
28649 @item If a zero-length bit-field follows a normal bit-field, the type of the
28650 zero-length bit-field may affect the alignment of the structure as whole. For
28651 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28652 normal bit-field, and is of type short.
28653
28654 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28655 still affect the alignment of the structure:
28656
28657 @smallexample
28658 struct
28659 @{
28660 char foo : 6;
28661 long : 0;
28662 @} t4;
28663 @end smallexample
28664
28665 @noindent
28666 Here, @code{t4} takes up 4 bytes.
28667 @end enumerate
28668
28669 @item Zero-length bit-fields following non-bit-field members are ignored:
28670
28671 @smallexample
28672 struct
28673 @{
28674 char foo;
28675 long : 0;
28676 char bar;
28677 @} t5;
28678 @end smallexample
28679
28680 @noindent
28681 Here, @code{t5} takes up 2 bytes.
28682 @end enumerate
28683
28684
28685 @item -mno-align-stringops
28686 @opindex mno-align-stringops
28687 @opindex malign-stringops
28688 Do not align the destination of inlined string operations. This switch reduces
28689 code size and improves performance in case the destination is already aligned,
28690 but GCC doesn't know about it.
28691
28692 @item -minline-all-stringops
28693 @opindex minline-all-stringops
28694 By default GCC inlines string operations only when the destination is
28695 known to be aligned to least a 4-byte boundary.
28696 This enables more inlining and increases code
28697 size, but may improve performance of code that depends on fast
28698 @code{memcpy} and @code{memset} for short lengths.
28699 The option enables inline expansion of @code{strlen} for all
28700 pointer alignments.
28701
28702 @item -minline-stringops-dynamically
28703 @opindex minline-stringops-dynamically
28704 For string operations of unknown size, use run-time checks with
28705 inline code for small blocks and a library call for large blocks.
28706
28707 @item -mstringop-strategy=@var{alg}
28708 @opindex mstringop-strategy=@var{alg}
28709 Override the internal decision heuristic for the particular algorithm to use
28710 for inlining string operations. The allowed values for @var{alg} are:
28711
28712 @table @samp
28713 @item rep_byte
28714 @itemx rep_4byte
28715 @itemx rep_8byte
28716 Expand using i386 @code{rep} prefix of the specified size.
28717
28718 @item byte_loop
28719 @itemx loop
28720 @itemx unrolled_loop
28721 Expand into an inline loop.
28722
28723 @item libcall
28724 Always use a library call.
28725 @end table
28726
28727 @item -mmemcpy-strategy=@var{strategy}
28728 @opindex mmemcpy-strategy=@var{strategy}
28729 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28730 should be inlined and what inline algorithm to use when the expected size
28731 of the copy operation is known. @var{strategy}
28732 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28733 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28734 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28735 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28736 in the list must be specified in increasing order. The minimal byte size for
28737 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28738 preceding range.
28739
28740 @item -mmemset-strategy=@var{strategy}
28741 @opindex mmemset-strategy=@var{strategy}
28742 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28743 @code{__builtin_memset} expansion.
28744
28745 @item -momit-leaf-frame-pointer
28746 @opindex momit-leaf-frame-pointer
28747 Don't keep the frame pointer in a register for leaf functions. This
28748 avoids the instructions to save, set up, and restore frame pointers and
28749 makes an extra register available in leaf functions. The option
28750 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28751 which might make debugging harder.
28752
28753 @item -mtls-direct-seg-refs
28754 @itemx -mno-tls-direct-seg-refs
28755 @opindex mtls-direct-seg-refs
28756 Controls whether TLS variables may be accessed with offsets from the
28757 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28758 or whether the thread base pointer must be added. Whether or not this
28759 is valid depends on the operating system, and whether it maps the
28760 segment to cover the entire TLS area.
28761
28762 For systems that use the GNU C Library, the default is on.
28763
28764 @item -msse2avx
28765 @itemx -mno-sse2avx
28766 @opindex msse2avx
28767 Specify that the assembler should encode SSE instructions with VEX
28768 prefix. The option @option{-mavx} turns this on by default.
28769
28770 @item -mfentry
28771 @itemx -mno-fentry
28772 @opindex mfentry
28773 If profiling is active (@option{-pg}), put the profiling
28774 counter call before the prologue.
28775 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28776 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28777
28778 @item -mrecord-mcount
28779 @itemx -mno-record-mcount
28780 @opindex mrecord-mcount
28781 If profiling is active (@option{-pg}), generate a __mcount_loc section
28782 that contains pointers to each profiling call. This is useful for
28783 automatically patching and out calls.
28784
28785 @item -mnop-mcount
28786 @itemx -mno-nop-mcount
28787 @opindex mnop-mcount
28788 If profiling is active (@option{-pg}), generate the calls to
28789 the profiling functions as NOPs. This is useful when they
28790 should be patched in later dynamically. This is likely only
28791 useful together with @option{-mrecord-mcount}.
28792
28793 @item -minstrument-return=@var{type}
28794 @opindex minstrument-return
28795 Instrument function exit in -pg -mfentry instrumented functions with
28796 call to specified function. This only instruments true returns ending
28797 with ret, but not sibling calls ending with jump. Valid types
28798 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28799 or @var{nop5} to generate a 5 byte nop.
28800
28801 @item -mrecord-return
28802 @itemx -mno-record-return
28803 @opindex mrecord-return
28804 Generate a __return_loc section pointing to all return instrumentation code.
28805
28806 @item -mfentry-name=@var{name}
28807 @opindex mfentry-name
28808 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28809
28810 @item -mfentry-section=@var{name}
28811 @opindex mfentry-section
28812 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28813
28814 @item -mskip-rax-setup
28815 @itemx -mno-skip-rax-setup
28816 @opindex mskip-rax-setup
28817 When generating code for the x86-64 architecture with SSE extensions
28818 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28819 register when there are no variable arguments passed in vector registers.
28820
28821 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28822 saving vector registers on stack when passing variable arguments, the
28823 impacts of this option are callees may waste some stack space,
28824 misbehave or jump to a random location. GCC 4.4 or newer don't have
28825 those issues, regardless the RAX register value.
28826
28827 @item -m8bit-idiv
28828 @itemx -mno-8bit-idiv
28829 @opindex m8bit-idiv
28830 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28831 much faster than 32-bit/64-bit integer divide. This option generates a
28832 run-time check. If both dividend and divisor are within range of 0
28833 to 255, 8-bit unsigned integer divide is used instead of
28834 32-bit/64-bit integer divide.
28835
28836 @item -mavx256-split-unaligned-load
28837 @itemx -mavx256-split-unaligned-store
28838 @opindex mavx256-split-unaligned-load
28839 @opindex mavx256-split-unaligned-store
28840 Split 32-byte AVX unaligned load and store.
28841
28842 @item -mstack-protector-guard=@var{guard}
28843 @itemx -mstack-protector-guard-reg=@var{reg}
28844 @itemx -mstack-protector-guard-offset=@var{offset}
28845 @opindex mstack-protector-guard
28846 @opindex mstack-protector-guard-reg
28847 @opindex mstack-protector-guard-offset
28848 Generate stack protection code using canary at @var{guard}. Supported
28849 locations are @samp{global} for global canary or @samp{tls} for per-thread
28850 canary in the TLS block (the default). This option has effect only when
28851 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28852
28853 With the latter choice the options
28854 @option{-mstack-protector-guard-reg=@var{reg}} and
28855 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28856 which segment register (@code{%fs} or @code{%gs}) to use as base register
28857 for reading the canary, and from what offset from that base register.
28858 The default for those is as specified in the relevant ABI.
28859
28860 @item -mgeneral-regs-only
28861 @opindex mgeneral-regs-only
28862 Generate code that uses only the general-purpose registers. This
28863 prevents the compiler from using floating-point, vector, mask and bound
28864 registers.
28865
28866 @item -mindirect-branch=@var{choice}
28867 @opindex mindirect-branch
28868 Convert indirect call and jump with @var{choice}. The default is
28869 @samp{keep}, which keeps indirect call and jump unmodified.
28870 @samp{thunk} converts indirect call and jump to call and return thunk.
28871 @samp{thunk-inline} converts indirect call and jump to inlined call
28872 and return thunk. @samp{thunk-extern} converts indirect call and jump
28873 to external call and return thunk provided in a separate object file.
28874 You can control this behavior for a specific function by using the
28875 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28876
28877 Note that @option{-mcmodel=large} is incompatible with
28878 @option{-mindirect-branch=thunk} and
28879 @option{-mindirect-branch=thunk-extern} since the thunk function may
28880 not be reachable in the large code model.
28881
28882 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28883 @option{-fcf-protection=branch} since the external thunk cannot be modified
28884 to disable control-flow check.
28885
28886 @item -mfunction-return=@var{choice}
28887 @opindex mfunction-return
28888 Convert function return with @var{choice}. The default is @samp{keep},
28889 which keeps function return unmodified. @samp{thunk} converts function
28890 return to call and return thunk. @samp{thunk-inline} converts function
28891 return to inlined call and return thunk. @samp{thunk-extern} converts
28892 function return to external call and return thunk provided in a separate
28893 object file. You can control this behavior for a specific function by
28894 using the function attribute @code{function_return}.
28895 @xref{Function Attributes}.
28896
28897 Note that @option{-mcmodel=large} is incompatible with
28898 @option{-mfunction-return=thunk} and
28899 @option{-mfunction-return=thunk-extern} since the thunk function may
28900 not be reachable in the large code model.
28901
28902
28903 @item -mindirect-branch-register
28904 @opindex mindirect-branch-register
28905 Force indirect call and jump via register.
28906
28907 @end table
28908
28909 These @samp{-m} switches are supported in addition to the above
28910 on x86-64 processors in 64-bit environments.
28911
28912 @table @gcctabopt
28913 @item -m32
28914 @itemx -m64
28915 @itemx -mx32
28916 @itemx -m16
28917 @itemx -miamcu
28918 @opindex m32
28919 @opindex m64
28920 @opindex mx32
28921 @opindex m16
28922 @opindex miamcu
28923 Generate code for a 16-bit, 32-bit or 64-bit environment.
28924 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28925 to 32 bits, and
28926 generates code that runs on any i386 system.
28927
28928 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28929 types to 64 bits, and generates code for the x86-64 architecture.
28930 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28931 and @option{-mdynamic-no-pic} options.
28932
28933 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28934 to 32 bits, and
28935 generates code for the x86-64 architecture.
28936
28937 The @option{-m16} option is the same as @option{-m32}, except for that
28938 it outputs the @code{.code16gcc} assembly directive at the beginning of
28939 the assembly output so that the binary can run in 16-bit mode.
28940
28941 The @option{-miamcu} option generates code which conforms to Intel MCU
28942 psABI. It requires the @option{-m32} option to be turned on.
28943
28944 @item -mno-red-zone
28945 @opindex mno-red-zone
28946 @opindex mred-zone
28947 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28948 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28949 stack pointer that is not modified by signal or interrupt handlers
28950 and therefore can be used for temporary data without adjusting the stack
28951 pointer. The flag @option{-mno-red-zone} disables this red zone.
28952
28953 @item -mcmodel=small
28954 @opindex mcmodel=small
28955 Generate code for the small code model: the program and its symbols must
28956 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28957 Programs can be statically or dynamically linked. This is the default
28958 code model.
28959
28960 @item -mcmodel=kernel
28961 @opindex mcmodel=kernel
28962 Generate code for the kernel code model. The kernel runs in the
28963 negative 2 GB of the address space.
28964 This model has to be used for Linux kernel code.
28965
28966 @item -mcmodel=medium
28967 @opindex mcmodel=medium
28968 Generate code for the medium model: the program is linked in the lower 2
28969 GB of the address space. Small symbols are also placed there. Symbols
28970 with sizes larger than @option{-mlarge-data-threshold} are put into
28971 large data or BSS sections and can be located above 2GB. Programs can
28972 be statically or dynamically linked.
28973
28974 @item -mcmodel=large
28975 @opindex mcmodel=large
28976 Generate code for the large model. This model makes no assumptions
28977 about addresses and sizes of sections.
28978
28979 @item -maddress-mode=long
28980 @opindex maddress-mode=long
28981 Generate code for long address mode. This is only supported for 64-bit
28982 and x32 environments. It is the default address mode for 64-bit
28983 environments.
28984
28985 @item -maddress-mode=short
28986 @opindex maddress-mode=short
28987 Generate code for short address mode. This is only supported for 32-bit
28988 and x32 environments. It is the default address mode for 32-bit and
28989 x32 environments.
28990 @end table
28991
28992 @node x86 Windows Options
28993 @subsection x86 Windows Options
28994 @cindex x86 Windows Options
28995 @cindex Windows Options for x86
28996
28997 These additional options are available for Microsoft Windows targets:
28998
28999 @table @gcctabopt
29000 @item -mconsole
29001 @opindex mconsole
29002 This option
29003 specifies that a console application is to be generated, by
29004 instructing the linker to set the PE header subsystem type
29005 required for console applications.
29006 This option is available for Cygwin and MinGW targets and is
29007 enabled by default on those targets.
29008
29009 @item -mdll
29010 @opindex mdll
29011 This option is available for Cygwin and MinGW targets. It
29012 specifies that a DLL---a dynamic link library---is to be
29013 generated, enabling the selection of the required runtime
29014 startup object and entry point.
29015
29016 @item -mnop-fun-dllimport
29017 @opindex mnop-fun-dllimport
29018 This option is available for Cygwin and MinGW targets. It
29019 specifies that the @code{dllimport} attribute should be ignored.
29020
29021 @item -mthread
29022 @opindex mthread
29023 This option is available for MinGW targets. It specifies
29024 that MinGW-specific thread support is to be used.
29025
29026 @item -municode
29027 @opindex municode
29028 This option is available for MinGW-w64 targets. It causes
29029 the @code{UNICODE} preprocessor macro to be predefined, and
29030 chooses Unicode-capable runtime startup code.
29031
29032 @item -mwin32
29033 @opindex mwin32
29034 This option is available for Cygwin and MinGW targets. It
29035 specifies that the typical Microsoft Windows predefined macros are to
29036 be set in the pre-processor, but does not influence the choice
29037 of runtime library/startup code.
29038
29039 @item -mwindows
29040 @opindex mwindows
29041 This option is available for Cygwin and MinGW targets. It
29042 specifies that a GUI application is to be generated by
29043 instructing the linker to set the PE header subsystem type
29044 appropriately.
29045
29046 @item -fno-set-stack-executable
29047 @opindex fno-set-stack-executable
29048 @opindex fset-stack-executable
29049 This option is available for MinGW targets. It specifies that
29050 the executable flag for the stack used by nested functions isn't
29051 set. This is necessary for binaries running in kernel mode of
29052 Microsoft Windows, as there the User32 API, which is used to set executable
29053 privileges, isn't available.
29054
29055 @item -fwritable-relocated-rdata
29056 @opindex fno-writable-relocated-rdata
29057 @opindex fwritable-relocated-rdata
29058 This option is available for MinGW and Cygwin targets. It specifies
29059 that relocated-data in read-only section is put into the @code{.data}
29060 section. This is a necessary for older runtimes not supporting
29061 modification of @code{.rdata} sections for pseudo-relocation.
29062
29063 @item -mpe-aligned-commons
29064 @opindex mpe-aligned-commons
29065 This option is available for Cygwin and MinGW targets. It
29066 specifies that the GNU extension to the PE file format that
29067 permits the correct alignment of COMMON variables should be
29068 used when generating code. It is enabled by default if
29069 GCC detects that the target assembler found during configuration
29070 supports the feature.
29071 @end table
29072
29073 See also under @ref{x86 Options} for standard options.
29074
29075 @node Xstormy16 Options
29076 @subsection Xstormy16 Options
29077 @cindex Xstormy16 Options
29078
29079 These options are defined for Xstormy16:
29080
29081 @table @gcctabopt
29082 @item -msim
29083 @opindex msim
29084 Choose startup files and linker script suitable for the simulator.
29085 @end table
29086
29087 @node Xtensa Options
29088 @subsection Xtensa Options
29089 @cindex Xtensa Options
29090
29091 These options are supported for Xtensa targets:
29092
29093 @table @gcctabopt
29094 @item -mconst16
29095 @itemx -mno-const16
29096 @opindex mconst16
29097 @opindex mno-const16
29098 Enable or disable use of @code{CONST16} instructions for loading
29099 constant values. The @code{CONST16} instruction is currently not a
29100 standard option from Tensilica. When enabled, @code{CONST16}
29101 instructions are always used in place of the standard @code{L32R}
29102 instructions. The use of @code{CONST16} is enabled by default only if
29103 the @code{L32R} instruction is not available.
29104
29105 @item -mfused-madd
29106 @itemx -mno-fused-madd
29107 @opindex mfused-madd
29108 @opindex mno-fused-madd
29109 Enable or disable use of fused multiply/add and multiply/subtract
29110 instructions in the floating-point option. This has no effect if the
29111 floating-point option is not also enabled. Disabling fused multiply/add
29112 and multiply/subtract instructions forces the compiler to use separate
29113 instructions for the multiply and add/subtract operations. This may be
29114 desirable in some cases where strict IEEE 754-compliant results are
29115 required: the fused multiply add/subtract instructions do not round the
29116 intermediate result, thereby producing results with @emph{more} bits of
29117 precision than specified by the IEEE standard. Disabling fused multiply
29118 add/subtract instructions also ensures that the program output is not
29119 sensitive to the compiler's ability to combine multiply and add/subtract
29120 operations.
29121
29122 @item -mserialize-volatile
29123 @itemx -mno-serialize-volatile
29124 @opindex mserialize-volatile
29125 @opindex mno-serialize-volatile
29126 When this option is enabled, GCC inserts @code{MEMW} instructions before
29127 @code{volatile} memory references to guarantee sequential consistency.
29128 The default is @option{-mserialize-volatile}. Use
29129 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29130
29131 @item -mforce-no-pic
29132 @opindex mforce-no-pic
29133 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29134 position-independent code (PIC), this option disables PIC for compiling
29135 kernel code.
29136
29137 @item -mtext-section-literals
29138 @itemx -mno-text-section-literals
29139 @opindex mtext-section-literals
29140 @opindex mno-text-section-literals
29141 These options control the treatment of literal pools. The default is
29142 @option{-mno-text-section-literals}, which places literals in a separate
29143 section in the output file. This allows the literal pool to be placed
29144 in a data RAM/ROM, and it also allows the linker to combine literal
29145 pools from separate object files to remove redundant literals and
29146 improve code size. With @option{-mtext-section-literals}, the literals
29147 are interspersed in the text section in order to keep them as close as
29148 possible to their references. This may be necessary for large assembly
29149 files. Literals for each function are placed right before that function.
29150
29151 @item -mauto-litpools
29152 @itemx -mno-auto-litpools
29153 @opindex mauto-litpools
29154 @opindex mno-auto-litpools
29155 These options control the treatment of literal pools. The default is
29156 @option{-mno-auto-litpools}, which places literals in a separate
29157 section in the output file unless @option{-mtext-section-literals} is
29158 used. With @option{-mauto-litpools} the literals are interspersed in
29159 the text section by the assembler. Compiler does not produce explicit
29160 @code{.literal} directives and loads literals into registers with
29161 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29162 do relaxation and place literals as necessary. This option allows
29163 assembler to create several literal pools per function and assemble
29164 very big functions, which may not be possible with
29165 @option{-mtext-section-literals}.
29166
29167 @item -mtarget-align
29168 @itemx -mno-target-align
29169 @opindex mtarget-align
29170 @opindex mno-target-align
29171 When this option is enabled, GCC instructs the assembler to
29172 automatically align instructions to reduce branch penalties at the
29173 expense of some code density. The assembler attempts to widen density
29174 instructions to align branch targets and the instructions following call
29175 instructions. If there are not enough preceding safe density
29176 instructions to align a target, no widening is performed. The
29177 default is @option{-mtarget-align}. These options do not affect the
29178 treatment of auto-aligned instructions like @code{LOOP}, which the
29179 assembler always aligns, either by widening density instructions or
29180 by inserting NOP instructions.
29181
29182 @item -mlongcalls
29183 @itemx -mno-longcalls
29184 @opindex mlongcalls
29185 @opindex mno-longcalls
29186 When this option is enabled, GCC instructs the assembler to translate
29187 direct calls to indirect calls unless it can determine that the target
29188 of a direct call is in the range allowed by the call instruction. This
29189 translation typically occurs for calls to functions in other source
29190 files. Specifically, the assembler translates a direct @code{CALL}
29191 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29192 The default is @option{-mno-longcalls}. This option should be used in
29193 programs where the call target can potentially be out of range. This
29194 option is implemented in the assembler, not the compiler, so the
29195 assembly code generated by GCC still shows direct call
29196 instructions---look at the disassembled object code to see the actual
29197 instructions. Note that the assembler uses an indirect call for
29198 every cross-file call, not just those that really are out of range.
29199 @end table
29200
29201 @node zSeries Options
29202 @subsection zSeries Options
29203 @cindex zSeries options
29204
29205 These are listed under @xref{S/390 and zSeries Options}.
29206
29207
29208 @c man end
29209
29210 @node Spec Files
29211 @section Specifying Subprocesses and the Switches to Pass to Them
29212 @cindex Spec Files
29213
29214 @command{gcc} is a driver program. It performs its job by invoking a
29215 sequence of other programs to do the work of compiling, assembling and
29216 linking. GCC interprets its command-line parameters and uses these to
29217 deduce which programs it should invoke, and which command-line options
29218 it ought to place on their command lines. This behavior is controlled
29219 by @dfn{spec strings}. In most cases there is one spec string for each
29220 program that GCC can invoke, but a few programs have multiple spec
29221 strings to control their behavior. The spec strings built into GCC can
29222 be overridden by using the @option{-specs=} command-line switch to specify
29223 a spec file.
29224
29225 @dfn{Spec files} are plain-text files that are used to construct spec
29226 strings. They consist of a sequence of directives separated by blank
29227 lines. The type of directive is determined by the first non-whitespace
29228 character on the line, which can be one of the following:
29229
29230 @table @code
29231 @item %@var{command}
29232 Issues a @var{command} to the spec file processor. The commands that can
29233 appear here are:
29234
29235 @table @code
29236 @item %include <@var{file}>
29237 @cindex @code{%include}
29238 Search for @var{file} and insert its text at the current point in the
29239 specs file.
29240
29241 @item %include_noerr <@var{file}>
29242 @cindex @code{%include_noerr}
29243 Just like @samp{%include}, but do not generate an error message if the include
29244 file cannot be found.
29245
29246 @item %rename @var{old_name} @var{new_name}
29247 @cindex @code{%rename}
29248 Rename the spec string @var{old_name} to @var{new_name}.
29249
29250 @end table
29251
29252 @item *[@var{spec_name}]:
29253 This tells the compiler to create, override or delete the named spec
29254 string. All lines after this directive up to the next directive or
29255 blank line are considered to be the text for the spec string. If this
29256 results in an empty string then the spec is deleted. (Or, if the
29257 spec did not exist, then nothing happens.) Otherwise, if the spec
29258 does not currently exist a new spec is created. If the spec does
29259 exist then its contents are overridden by the text of this
29260 directive, unless the first character of that text is the @samp{+}
29261 character, in which case the text is appended to the spec.
29262
29263 @item [@var{suffix}]:
29264 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29265 and up to the next directive or blank line are considered to make up the
29266 spec string for the indicated suffix. When the compiler encounters an
29267 input file with the named suffix, it processes the spec string in
29268 order to work out how to compile that file. For example:
29269
29270 @smallexample
29271 .ZZ:
29272 z-compile -input %i
29273 @end smallexample
29274
29275 This says that any input file whose name ends in @samp{.ZZ} should be
29276 passed to the program @samp{z-compile}, which should be invoked with the
29277 command-line switch @option{-input} and with the result of performing the
29278 @samp{%i} substitution. (See below.)
29279
29280 As an alternative to providing a spec string, the text following a
29281 suffix directive can be one of the following:
29282
29283 @table @code
29284 @item @@@var{language}
29285 This says that the suffix is an alias for a known @var{language}. This is
29286 similar to using the @option{-x} command-line switch to GCC to specify a
29287 language explicitly. For example:
29288
29289 @smallexample
29290 .ZZ:
29291 @@c++
29292 @end smallexample
29293
29294 Says that .ZZ files are, in fact, C++ source files.
29295
29296 @item #@var{name}
29297 This causes an error messages saying:
29298
29299 @smallexample
29300 @var{name} compiler not installed on this system.
29301 @end smallexample
29302 @end table
29303
29304 GCC already has an extensive list of suffixes built into it.
29305 This directive adds an entry to the end of the list of suffixes, but
29306 since the list is searched from the end backwards, it is effectively
29307 possible to override earlier entries using this technique.
29308
29309 @end table
29310
29311 GCC has the following spec strings built into it. Spec files can
29312 override these strings or create their own. Note that individual
29313 targets can also add their own spec strings to this list.
29314
29315 @smallexample
29316 asm Options to pass to the assembler
29317 asm_final Options to pass to the assembler post-processor
29318 cpp Options to pass to the C preprocessor
29319 cc1 Options to pass to the C compiler
29320 cc1plus Options to pass to the C++ compiler
29321 endfile Object files to include at the end of the link
29322 link Options to pass to the linker
29323 lib Libraries to include on the command line to the linker
29324 libgcc Decides which GCC support library to pass to the linker
29325 linker Sets the name of the linker
29326 predefines Defines to be passed to the C preprocessor
29327 signed_char Defines to pass to CPP to say whether @code{char} is signed
29328 by default
29329 startfile Object files to include at the start of the link
29330 @end smallexample
29331
29332 Here is a small example of a spec file:
29333
29334 @smallexample
29335 %rename lib old_lib
29336
29337 *lib:
29338 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29339 @end smallexample
29340
29341 This example renames the spec called @samp{lib} to @samp{old_lib} and
29342 then overrides the previous definition of @samp{lib} with a new one.
29343 The new definition adds in some extra command-line options before
29344 including the text of the old definition.
29345
29346 @dfn{Spec strings} are a list of command-line options to be passed to their
29347 corresponding program. In addition, the spec strings can contain
29348 @samp{%}-prefixed sequences to substitute variable text or to
29349 conditionally insert text into the command line. Using these constructs
29350 it is possible to generate quite complex command lines.
29351
29352 Here is a table of all defined @samp{%}-sequences for spec
29353 strings. Note that spaces are not generated automatically around the
29354 results of expanding these sequences. Therefore you can concatenate them
29355 together or combine them with constant text in a single argument.
29356
29357 @table @code
29358 @item %%
29359 Substitute one @samp{%} into the program name or argument.
29360
29361 @item %i
29362 Substitute the name of the input file being processed.
29363
29364 @item %b
29365 Substitute the basename of the input file being processed.
29366 This is the substring up to (and not including) the last period
29367 and not including the directory.
29368
29369 @item %B
29370 This is the same as @samp{%b}, but include the file suffix (text after
29371 the last period).
29372
29373 @item %d
29374 Marks the argument containing or following the @samp{%d} as a
29375 temporary file name, so that that file is deleted if GCC exits
29376 successfully. Unlike @samp{%g}, this contributes no text to the
29377 argument.
29378
29379 @item %g@var{suffix}
29380 Substitute a file name that has suffix @var{suffix} and is chosen
29381 once per compilation, and mark the argument in the same way as
29382 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29383 name is now chosen in a way that is hard to predict even when previously
29384 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29385 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29386 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29387 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29388 was simply substituted with a file name chosen once per compilation,
29389 without regard to any appended suffix (which was therefore treated
29390 just like ordinary text), making such attacks more likely to succeed.
29391
29392 @item %u@var{suffix}
29393 Like @samp{%g}, but generates a new temporary file name
29394 each time it appears instead of once per compilation.
29395
29396 @item %U@var{suffix}
29397 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29398 new one if there is no such last file name. In the absence of any
29399 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29400 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29401 involves the generation of two distinct file names, one
29402 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29403 simply substituted with a file name chosen for the previous @samp{%u},
29404 without regard to any appended suffix.
29405
29406 @item %j@var{suffix}
29407 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29408 writable, and if @option{-save-temps} is not used;
29409 otherwise, substitute the name
29410 of a temporary file, just like @samp{%u}. This temporary file is not
29411 meant for communication between processes, but rather as a junk
29412 disposal mechanism.
29413
29414 @item %|@var{suffix}
29415 @itemx %m@var{suffix}
29416 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29417 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29418 all. These are the two most common ways to instruct a program that it
29419 should read from standard input or write to standard output. If you
29420 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29421 construct: see for example @file{gcc/fortran/lang-specs.h}.
29422
29423 @item %.@var{SUFFIX}
29424 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29425 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29426 terminated by the next space or %.
29427
29428 @item %w
29429 Marks the argument containing or following the @samp{%w} as the
29430 designated output file of this compilation. This puts the argument
29431 into the sequence of arguments that @samp{%o} substitutes.
29432
29433 @item %o
29434 Substitutes the names of all the output files, with spaces
29435 automatically placed around them. You should write spaces
29436 around the @samp{%o} as well or the results are undefined.
29437 @samp{%o} is for use in the specs for running the linker.
29438 Input files whose names have no recognized suffix are not compiled
29439 at all, but they are included among the output files, so they are
29440 linked.
29441
29442 @item %O
29443 Substitutes the suffix for object files. Note that this is
29444 handled specially when it immediately follows @samp{%g, %u, or %U},
29445 because of the need for those to form complete file names. The
29446 handling is such that @samp{%O} is treated exactly as if it had already
29447 been substituted, except that @samp{%g, %u, and %U} do not currently
29448 support additional @var{suffix} characters following @samp{%O} as they do
29449 following, for example, @samp{.o}.
29450
29451 @item %p
29452 Substitutes the standard macro predefinitions for the
29453 current target machine. Use this when running @command{cpp}.
29454
29455 @item %P
29456 Like @samp{%p}, but puts @samp{__} before and after the name of each
29457 predefined macro, except for macros that start with @samp{__} or with
29458 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29459 C@.
29460
29461 @item %I
29462 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29463 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29464 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29465 and @option{-imultilib} as necessary.
29466
29467 @item %s
29468 Current argument is the name of a library or startup file of some sort.
29469 Search for that file in a standard list of directories and substitute
29470 the full name found. The current working directory is included in the
29471 list of directories scanned.
29472
29473 @item %T
29474 Current argument is the name of a linker script. Search for that file
29475 in the current list of directories to scan for libraries. If the file
29476 is located insert a @option{--script} option into the command line
29477 followed by the full path name found. If the file is not found then
29478 generate an error message. Note: the current working directory is not
29479 searched.
29480
29481 @item %e@var{str}
29482 Print @var{str} as an error message. @var{str} is terminated by a newline.
29483 Use this when inconsistent options are detected.
29484
29485 @item %(@var{name})
29486 Substitute the contents of spec string @var{name} at this point.
29487
29488 @item %x@{@var{option}@}
29489 Accumulate an option for @samp{%X}.
29490
29491 @item %X
29492 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29493 spec string.
29494
29495 @item %Y
29496 Output the accumulated assembler options specified by @option{-Wa}.
29497
29498 @item %Z
29499 Output the accumulated preprocessor options specified by @option{-Wp}.
29500
29501 @item %a
29502 Process the @code{asm} spec. This is used to compute the
29503 switches to be passed to the assembler.
29504
29505 @item %A
29506 Process the @code{asm_final} spec. This is a spec string for
29507 passing switches to an assembler post-processor, if such a program is
29508 needed.
29509
29510 @item %l
29511 Process the @code{link} spec. This is the spec for computing the
29512 command line passed to the linker. Typically it makes use of the
29513 @samp{%L %G %S %D and %E} sequences.
29514
29515 @item %D
29516 Dump out a @option{-L} option for each directory that GCC believes might
29517 contain startup files. If the target supports multilibs then the
29518 current multilib directory is prepended to each of these paths.
29519
29520 @item %L
29521 Process the @code{lib} spec. This is a spec string for deciding which
29522 libraries are included on the command line to the linker.
29523
29524 @item %G
29525 Process the @code{libgcc} spec. This is a spec string for deciding
29526 which GCC support library is included on the command line to the linker.
29527
29528 @item %S
29529 Process the @code{startfile} spec. This is a spec for deciding which
29530 object files are the first ones passed to the linker. Typically
29531 this might be a file named @file{crt0.o}.
29532
29533 @item %E
29534 Process the @code{endfile} spec. This is a spec string that specifies
29535 the last object files that are passed to the linker.
29536
29537 @item %C
29538 Process the @code{cpp} spec. This is used to construct the arguments
29539 to be passed to the C preprocessor.
29540
29541 @item %1
29542 Process the @code{cc1} spec. This is used to construct the options to be
29543 passed to the actual C compiler (@command{cc1}).
29544
29545 @item %2
29546 Process the @code{cc1plus} spec. This is used to construct the options to be
29547 passed to the actual C++ compiler (@command{cc1plus}).
29548
29549 @item %*
29550 Substitute the variable part of a matched option. See below.
29551 Note that each comma in the substituted string is replaced by
29552 a single space.
29553
29554 @item %<S
29555 Remove all occurrences of @code{-S} from the command line. Note---this
29556 command is position dependent. @samp{%} commands in the spec string
29557 before this one see @code{-S}, @samp{%} commands in the spec string
29558 after this one do not.
29559
29560 @item %:@var{function}(@var{args})
29561 Call the named function @var{function}, passing it @var{args}.
29562 @var{args} is first processed as a nested spec string, then split
29563 into an argument vector in the usual fashion. The function returns
29564 a string which is processed as if it had appeared literally as part
29565 of the current spec.
29566
29567 The following built-in spec functions are provided:
29568
29569 @table @code
29570 @item @code{getenv}
29571 The @code{getenv} spec function takes two arguments: an environment
29572 variable name and a string. If the environment variable is not
29573 defined, a fatal error is issued. Otherwise, the return value is the
29574 value of the environment variable concatenated with the string. For
29575 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29576
29577 @smallexample
29578 %:getenv(TOPDIR /include)
29579 @end smallexample
29580
29581 expands to @file{/path/to/top/include}.
29582
29583 @item @code{if-exists}
29584 The @code{if-exists} spec function takes one argument, an absolute
29585 pathname to a file. If the file exists, @code{if-exists} returns the
29586 pathname. Here is a small example of its usage:
29587
29588 @smallexample
29589 *startfile:
29590 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29591 @end smallexample
29592
29593 @item @code{if-exists-else}
29594 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29595 spec function, except that it takes two arguments. The first argument is
29596 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29597 returns the pathname. If it does not exist, it returns the second argument.
29598 This way, @code{if-exists-else} can be used to select one file or another,
29599 based on the existence of the first. Here is a small example of its usage:
29600
29601 @smallexample
29602 *startfile:
29603 crt0%O%s %:if-exists(crti%O%s) \
29604 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29605 @end smallexample
29606
29607 @item @code{replace-outfile}
29608 The @code{replace-outfile} spec function takes two arguments. It looks for the
29609 first argument in the outfiles array and replaces it with the second argument. Here
29610 is a small example of its usage:
29611
29612 @smallexample
29613 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29614 @end smallexample
29615
29616 @item @code{remove-outfile}
29617 The @code{remove-outfile} spec function takes one argument. It looks for the
29618 first argument in the outfiles array and removes it. Here is a small example
29619 its usage:
29620
29621 @smallexample
29622 %:remove-outfile(-lm)
29623 @end smallexample
29624
29625 @item @code{pass-through-libs}
29626 The @code{pass-through-libs} spec function takes any number of arguments. It
29627 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29628 assumes are the names of linker input library archive files) and returns a
29629 result containing all the found arguments each prepended by
29630 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29631 intended to be passed to the LTO linker plugin.
29632
29633 @smallexample
29634 %:pass-through-libs(%G %L %G)
29635 @end smallexample
29636
29637 @item @code{print-asm-header}
29638 The @code{print-asm-header} function takes no arguments and simply
29639 prints a banner like:
29640
29641 @smallexample
29642 Assembler options
29643 =================
29644
29645 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29646 @end smallexample
29647
29648 It is used to separate compiler options from assembler options
29649 in the @option{--target-help} output.
29650 @end table
29651
29652 @item %@{S@}
29653 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29654 If that switch is not specified, this substitutes nothing. Note that
29655 the leading dash is omitted when specifying this option, and it is
29656 automatically inserted if the substitution is performed. Thus the spec
29657 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29658 and outputs the command-line option @option{-foo}.
29659
29660 @item %W@{S@}
29661 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29662 deleted on failure.
29663
29664 @item %@{S*@}
29665 Substitutes all the switches specified to GCC whose names start
29666 with @code{-S}, but which also take an argument. This is used for
29667 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29668 GCC considers @option{-o foo} as being
29669 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29670 text, including the space. Thus two arguments are generated.
29671
29672 @item %@{S*&T*@}
29673 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29674 (the order of @code{S} and @code{T} in the spec is not significant).
29675 There can be any number of ampersand-separated variables; for each the
29676 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29677
29678 @item %@{S:X@}
29679 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29680
29681 @item %@{!S:X@}
29682 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29683
29684 @item %@{S*:X@}
29685 Substitutes @code{X} if one or more switches whose names start with
29686 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29687 once, no matter how many such switches appeared. However, if @code{%*}
29688 appears somewhere in @code{X}, then @code{X} is substituted once
29689 for each matching switch, with the @code{%*} replaced by the part of
29690 that switch matching the @code{*}.
29691
29692 If @code{%*} appears as the last part of a spec sequence then a space
29693 is added after the end of the last substitution. If there is more
29694 text in the sequence, however, then a space is not generated. This
29695 allows the @code{%*} substitution to be used as part of a larger
29696 string. For example, a spec string like this:
29697
29698 @smallexample
29699 %@{mcu=*:--script=%*/memory.ld@}
29700 @end smallexample
29701
29702 @noindent
29703 when matching an option like @option{-mcu=newchip} produces:
29704
29705 @smallexample
29706 --script=newchip/memory.ld
29707 @end smallexample
29708
29709 @item %@{.S:X@}
29710 Substitutes @code{X}, if processing a file with suffix @code{S}.
29711
29712 @item %@{!.S:X@}
29713 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29714
29715 @item %@{,S:X@}
29716 Substitutes @code{X}, if processing a file for language @code{S}.
29717
29718 @item %@{!,S:X@}
29719 Substitutes @code{X}, if not processing a file for language @code{S}.
29720
29721 @item %@{S|P:X@}
29722 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29723 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29724 @code{*} sequences as well, although they have a stronger binding than
29725 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29726 alternatives must be starred, and only the first matching alternative
29727 is substituted.
29728
29729 For example, a spec string like this:
29730
29731 @smallexample
29732 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29733 @end smallexample
29734
29735 @noindent
29736 outputs the following command-line options from the following input
29737 command-line options:
29738
29739 @smallexample
29740 fred.c -foo -baz
29741 jim.d -bar -boggle
29742 -d fred.c -foo -baz -boggle
29743 -d jim.d -bar -baz -boggle
29744 @end smallexample
29745
29746 @item %@{S:X; T:Y; :D@}
29747
29748 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29749 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29750 be as many clauses as you need. This may be combined with @code{.},
29751 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29752
29753
29754 @end table
29755
29756 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29757 or similar construct can use a backslash to ignore the special meaning
29758 of the character following it, thus allowing literal matching of a
29759 character that is otherwise specially treated. For example,
29760 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29761 @option{-std=iso9899:1999} option is given.
29762
29763 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29764 construct may contain other nested @samp{%} constructs or spaces, or
29765 even newlines. They are processed as usual, as described above.
29766 Trailing white space in @code{X} is ignored. White space may also
29767 appear anywhere on the left side of the colon in these constructs,
29768 except between @code{.} or @code{*} and the corresponding word.
29769
29770 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29771 handled specifically in these constructs. If another value of
29772 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29773 @option{-W} switch is found later in the command line, the earlier
29774 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29775 just one letter, which passes all matching options.
29776
29777 The character @samp{|} at the beginning of the predicate text is used to
29778 indicate that a command should be piped to the following command, but
29779 only if @option{-pipe} is specified.
29780
29781 It is built into GCC which switches take arguments and which do not.
29782 (You might think it would be useful to generalize this to allow each
29783 compiler's spec to say which switches take arguments. But this cannot
29784 be done in a consistent fashion. GCC cannot even decide which input
29785 files have been specified without knowing which switches take arguments,
29786 and it must know which input files to compile in order to tell which
29787 compilers to run).
29788
29789 GCC also knows implicitly that arguments starting in @option{-l} are to be
29790 treated as compiler output files, and passed to the linker in their
29791 proper position among the other output files.
29792
29793 @node Environment Variables
29794 @section Environment Variables Affecting GCC
29795 @cindex environment variables
29796
29797 @c man begin ENVIRONMENT
29798 This section describes several environment variables that affect how GCC
29799 operates. Some of them work by specifying directories or prefixes to use
29800 when searching for various kinds of files. Some are used to specify other
29801 aspects of the compilation environment.
29802
29803 Note that you can also specify places to search using options such as
29804 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29805 take precedence over places specified using environment variables, which
29806 in turn take precedence over those specified by the configuration of GCC@.
29807 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29808 GNU Compiler Collection (GCC) Internals}.
29809
29810 @table @env
29811 @item LANG
29812 @itemx LC_CTYPE
29813 @c @itemx LC_COLLATE
29814 @itemx LC_MESSAGES
29815 @c @itemx LC_MONETARY
29816 @c @itemx LC_NUMERIC
29817 @c @itemx LC_TIME
29818 @itemx LC_ALL
29819 @findex LANG
29820 @findex LC_CTYPE
29821 @c @findex LC_COLLATE
29822 @findex LC_MESSAGES
29823 @c @findex LC_MONETARY
29824 @c @findex LC_NUMERIC
29825 @c @findex LC_TIME
29826 @findex LC_ALL
29827 @cindex locale
29828 These environment variables control the way that GCC uses
29829 localization information which allows GCC to work with different
29830 national conventions. GCC inspects the locale categories
29831 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29832 so. These locale categories can be set to any value supported by your
29833 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29834 Kingdom encoded in UTF-8.
29835
29836 The @env{LC_CTYPE} environment variable specifies character
29837 classification. GCC uses it to determine the character boundaries in
29838 a string; this is needed for some multibyte encodings that contain quote
29839 and escape characters that are otherwise interpreted as a string
29840 end or escape.
29841
29842 The @env{LC_MESSAGES} environment variable specifies the language to
29843 use in diagnostic messages.
29844
29845 If the @env{LC_ALL} environment variable is set, it overrides the value
29846 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29847 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29848 environment variable. If none of these variables are set, GCC
29849 defaults to traditional C English behavior.
29850
29851 @item TMPDIR
29852 @findex TMPDIR
29853 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29854 files. GCC uses temporary files to hold the output of one stage of
29855 compilation which is to be used as input to the next stage: for example,
29856 the output of the preprocessor, which is the input to the compiler
29857 proper.
29858
29859 @item GCC_COMPARE_DEBUG
29860 @findex GCC_COMPARE_DEBUG
29861 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29862 @option{-fcompare-debug} to the compiler driver. See the documentation
29863 of this option for more details.
29864
29865 @item GCC_EXEC_PREFIX
29866 @findex GCC_EXEC_PREFIX
29867 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29868 names of the subprograms executed by the compiler. No slash is added
29869 when this prefix is combined with the name of a subprogram, but you can
29870 specify a prefix that ends with a slash if you wish.
29871
29872 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29873 an appropriate prefix to use based on the pathname it is invoked with.
29874
29875 If GCC cannot find the subprogram using the specified prefix, it
29876 tries looking in the usual places for the subprogram.
29877
29878 The default value of @env{GCC_EXEC_PREFIX} is
29879 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29880 the installed compiler. In many cases @var{prefix} is the value
29881 of @code{prefix} when you ran the @file{configure} script.
29882
29883 Other prefixes specified with @option{-B} take precedence over this prefix.
29884
29885 This prefix is also used for finding files such as @file{crt0.o} that are
29886 used for linking.
29887
29888 In addition, the prefix is used in an unusual way in finding the
29889 directories to search for header files. For each of the standard
29890 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29891 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29892 replacing that beginning with the specified prefix to produce an
29893 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29894 @file{foo/bar} just before it searches the standard directory
29895 @file{/usr/local/lib/bar}.
29896 If a standard directory begins with the configured
29897 @var{prefix} then the value of @var{prefix} is replaced by
29898 @env{GCC_EXEC_PREFIX} when looking for header files.
29899
29900 @item COMPILER_PATH
29901 @findex COMPILER_PATH
29902 The value of @env{COMPILER_PATH} is a colon-separated list of
29903 directories, much like @env{PATH}. GCC tries the directories thus
29904 specified when searching for subprograms, if it cannot find the
29905 subprograms using @env{GCC_EXEC_PREFIX}.
29906
29907 @item LIBRARY_PATH
29908 @findex LIBRARY_PATH
29909 The value of @env{LIBRARY_PATH} is a colon-separated list of
29910 directories, much like @env{PATH}. When configured as a native compiler,
29911 GCC tries the directories thus specified when searching for special
29912 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29913 using GCC also uses these directories when searching for ordinary
29914 libraries for the @option{-l} option (but directories specified with
29915 @option{-L} come first).
29916
29917 @item LANG
29918 @findex LANG
29919 @cindex locale definition
29920 This variable is used to pass locale information to the compiler. One way in
29921 which this information is used is to determine the character set to be used
29922 when character literals, string literals and comments are parsed in C and C++.
29923 When the compiler is configured to allow multibyte characters,
29924 the following values for @env{LANG} are recognized:
29925
29926 @table @samp
29927 @item C-JIS
29928 Recognize JIS characters.
29929 @item C-SJIS
29930 Recognize SJIS characters.
29931 @item C-EUCJP
29932 Recognize EUCJP characters.
29933 @end table
29934
29935 If @env{LANG} is not defined, or if it has some other value, then the
29936 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29937 recognize and translate multibyte characters.
29938 @end table
29939
29940 @noindent
29941 Some additional environment variables affect the behavior of the
29942 preprocessor.
29943
29944 @include cppenv.texi
29945
29946 @c man end
29947
29948 @node Precompiled Headers
29949 @section Using Precompiled Headers
29950 @cindex precompiled headers
29951 @cindex speed of compilation
29952
29953 Often large projects have many header files that are included in every
29954 source file. The time the compiler takes to process these header files
29955 over and over again can account for nearly all of the time required to
29956 build the project. To make builds faster, GCC allows you to
29957 @dfn{precompile} a header file.
29958
29959 To create a precompiled header file, simply compile it as you would any
29960 other file, if necessary using the @option{-x} option to make the driver
29961 treat it as a C or C++ header file. You may want to use a
29962 tool like @command{make} to keep the precompiled header up-to-date when
29963 the headers it contains change.
29964
29965 A precompiled header file is searched for when @code{#include} is
29966 seen in the compilation. As it searches for the included file
29967 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29968 compiler looks for a precompiled header in each directory just before it
29969 looks for the include file in that directory. The name searched for is
29970 the name specified in the @code{#include} with @samp{.gch} appended. If
29971 the precompiled header file cannot be used, it is ignored.
29972
29973 For instance, if you have @code{#include "all.h"}, and you have
29974 @file{all.h.gch} in the same directory as @file{all.h}, then the
29975 precompiled header file is used if possible, and the original
29976 header is used otherwise.
29977
29978 Alternatively, you might decide to put the precompiled header file in a
29979 directory and use @option{-I} to ensure that directory is searched
29980 before (or instead of) the directory containing the original header.
29981 Then, if you want to check that the precompiled header file is always
29982 used, you can put a file of the same name as the original header in this
29983 directory containing an @code{#error} command.
29984
29985 This also works with @option{-include}. So yet another way to use
29986 precompiled headers, good for projects not designed with precompiled
29987 header files in mind, is to simply take most of the header files used by
29988 a project, include them from another header file, precompile that header
29989 file, and @option{-include} the precompiled header. If the header files
29990 have guards against multiple inclusion, they are skipped because
29991 they've already been included (in the precompiled header).
29992
29993 If you need to precompile the same header file for different
29994 languages, targets, or compiler options, you can instead make a
29995 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29996 header in the directory, perhaps using @option{-o}. It doesn't matter
29997 what you call the files in the directory; every precompiled header in
29998 the directory is considered. The first precompiled header
29999 encountered in the directory that is valid for this compilation is
30000 used; they're searched in no particular order.
30001
30002 There are many other possibilities, limited only by your imagination,
30003 good sense, and the constraints of your build system.
30004
30005 A precompiled header file can be used only when these conditions apply:
30006
30007 @itemize
30008 @item
30009 Only one precompiled header can be used in a particular compilation.
30010
30011 @item
30012 A precompiled header cannot be used once the first C token is seen. You
30013 can have preprocessor directives before a precompiled header; you cannot
30014 include a precompiled header from inside another header.
30015
30016 @item
30017 The precompiled header file must be produced for the same language as
30018 the current compilation. You cannot use a C precompiled header for a C++
30019 compilation.
30020
30021 @item
30022 The precompiled header file must have been produced by the same compiler
30023 binary as the current compilation is using.
30024
30025 @item
30026 Any macros defined before the precompiled header is included must
30027 either be defined in the same way as when the precompiled header was
30028 generated, or must not affect the precompiled header, which usually
30029 means that they don't appear in the precompiled header at all.
30030
30031 The @option{-D} option is one way to define a macro before a
30032 precompiled header is included; using a @code{#define} can also do it.
30033 There are also some options that define macros implicitly, like
30034 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30035 defined this way.
30036
30037 @item If debugging information is output when using the precompiled
30038 header, using @option{-g} or similar, the same kind of debugging information
30039 must have been output when building the precompiled header. However,
30040 a precompiled header built using @option{-g} can be used in a compilation
30041 when no debugging information is being output.
30042
30043 @item The same @option{-m} options must generally be used when building
30044 and using the precompiled header. @xref{Submodel Options},
30045 for any cases where this rule is relaxed.
30046
30047 @item Each of the following options must be the same when building and using
30048 the precompiled header:
30049
30050 @gccoptlist{-fexceptions}
30051
30052 @item
30053 Some other command-line options starting with @option{-f},
30054 @option{-p}, or @option{-O} must be defined in the same way as when
30055 the precompiled header was generated. At present, it's not clear
30056 which options are safe to change and which are not; the safest choice
30057 is to use exactly the same options when generating and using the
30058 precompiled header. The following are known to be safe:
30059
30060 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30061 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30062 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30063 -pedantic-errors}
30064
30065 @end itemize
30066
30067 For all of these except the last, the compiler automatically
30068 ignores the precompiled header if the conditions aren't met. If you
30069 find an option combination that doesn't work and doesn't cause the
30070 precompiled header to be ignored, please consider filing a bug report,
30071 see @ref{Bugs}.
30072
30073 If you do use differing options when generating and using the
30074 precompiled header, the actual behavior is a mixture of the
30075 behavior for the options. For instance, if you use @option{-g} to
30076 generate the precompiled header but not when using it, you may or may
30077 not get debugging information for routines in the precompiled header.