]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Instrument only selected files (PR gcov-profile/87442).
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2018 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-2018 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 -fopenacc -fopenmp -fopenmp-simd @gol
201 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
202 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
203 -fsigned-bitfields -fsigned-char @gol
204 -funsigned-bitfields -funsigned-char}
205
206 @item C++ Language Options
207 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
208 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
209 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
210 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
211 -fno-elide-constructors @gol
212 -fno-enforce-eh-specs @gol
213 -fno-gnu-keywords @gol
214 -fno-implicit-templates @gol
215 -fno-implicit-inline-templates @gol
216 -fno-implement-inlines -fms-extensions @gol
217 -fnew-inheriting-ctors @gol
218 -fnew-ttp-matching @gol
219 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
220 -fno-optional-diags -fpermissive @gol
221 -fno-pretty-templates @gol
222 -frepo -fno-rtti -fsized-deallocation @gol
223 -ftemplate-backtrace-limit=@var{n} @gol
224 -ftemplate-depth=@var{n} @gol
225 -fno-threadsafe-statics -fuse-cxa-atexit @gol
226 -fno-weak -nostdinc++ @gol
227 -fvisibility-inlines-hidden @gol
228 -fvisibility-ms-compat @gol
229 -fext-numeric-literals @gol
230 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
231 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wliteral-suffix @gol
232 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
233 -Wnamespaces -Wnarrowing @gol
234 -Wpessimizing-move -Wredundant-move @gol
235 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
236 -Wnon-virtual-dtor -Wreorder -Wregister @gol
237 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
238 -Wno-non-template-friend -Wold-style-cast @gol
239 -Woverloaded-virtual -Wno-pmf-conversions @gol
240 -Wno-class-conversion -Wno-terminate @gol
241 -Wsign-promo -Wvirtual-inheritance}
242
243 @item Objective-C and Objective-C++ Language Options
244 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
245 Objective-C and Objective-C++ Dialects}.
246 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
247 -fgnu-runtime -fnext-runtime @gol
248 -fno-nil-receivers @gol
249 -fobjc-abi-version=@var{n} @gol
250 -fobjc-call-cxx-cdtors @gol
251 -fobjc-direct-dispatch @gol
252 -fobjc-exceptions @gol
253 -fobjc-gc @gol
254 -fobjc-nilcheck @gol
255 -fobjc-std=objc1 @gol
256 -fno-local-ivars @gol
257 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
258 -freplace-objc-classes @gol
259 -fzero-link @gol
260 -gen-decls @gol
261 -Wassign-intercept @gol
262 -Wno-protocol -Wselector @gol
263 -Wstrict-selector-match @gol
264 -Wundeclared-selector}
265
266 @item Diagnostic Message Formatting Options
267 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
268 @gccoptlist{-fmessage-length=@var{n} @gol
269 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
270 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
271 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
272 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
273 -fdiagnostics-minimum-margin-width=@var{width} @gol
274 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
275 -fdiagnostics-show-template-tree -fno-elide-type @gol
276 -fno-show-column}
277
278 @item Warning Options
279 @xref{Warning Options,,Options to Request or Suppress Warnings}.
280 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
281 -pedantic-errors @gol
282 -w -Wextra -Wall -Waddress -Waggregate-return -Waligned-new @gol
283 -Walloc-zero -Walloc-size-larger-than=@var{byte-size}
284 -Walloca -Walloca-larger-than=@var{byte-size} @gol
285 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
286 -Wno-attributes -Wno-attribute-alias @gol
287 -Wbool-compare -Wbool-operation @gol
288 -Wno-builtin-declaration-mismatch @gol
289 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
290 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
291 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
292 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
293 -Wclobbered -Wcomment -Wconditionally-supported @gol
294 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
295 -Wdelete-incomplete @gol
296 -Wno-attribute-warning @gol
297 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
298 -Wdisabled-optimization @gol
299 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
300 -Wno-div-by-zero -Wdouble-promotion @gol
301 -Wduplicated-branches -Wduplicated-cond @gol
302 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
303 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
304 -Wfloat-equal -Wformat -Wformat=2 @gol
305 -Wno-format-contains-nul -Wno-format-extra-args @gol
306 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
307 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
308 -Wformat-y2k -Wframe-address @gol
309 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
310 -Wjump-misses-init @gol
311 -Wif-not-aligned @gol
312 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
313 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
314 -Wimplicit-function-declaration -Wimplicit-int @gol
315 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
316 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
317 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
318 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
319 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
320 -Wmisleading-indentation -Wno-missing-attributes -Wmissing-braces @gol
321 -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-profile @gol
322 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
323 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
324 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
325 -Woverride-init-side-effects -Woverlength-strings @gol
326 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
327 -Wparentheses -Wno-pedantic-ms-format @gol
328 -Wplacement-new -Wplacement-new=@var{n} @gol
329 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
330 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
331 -Wrestrict -Wno-return-local-addr @gol
332 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
333 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
334 -Wshift-overflow -Wshift-overflow=@var{n} @gol
335 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
336 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
337 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
338 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
339 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
340 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
341 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
342 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
343 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
344 -Wmissing-format-attribute -Wsubobject-linkage @gol
345 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
346 -Wswitch-unreachable -Wsync-nand @gol
347 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
348 -Wtype-limits -Wundef @gol
349 -Wuninitialized -Wunknown-pragmas @gol
350 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
351 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
352 -Wunused-parameter -Wno-unused-result @gol
353 -Wunused-value -Wunused-variable @gol
354 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
355 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
356 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
357 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
358 -Wwrite-strings @gol
359 -Wzero-as-null-pointer-constant -Whsa}
360
361 @item C and Objective-C-only Warning Options
362 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
363 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
364 -Wold-style-declaration -Wold-style-definition @gol
365 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
366 -Wdeclaration-after-statement -Wpointer-sign}
367
368 @item Debugging Options
369 @xref{Debugging Options,,Options for Debugging Your Program}.
370 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
371 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
372 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
373 -gas-loc-support -gno-as-loc-support @gol
374 -gas-locview-support -gno-as-locview-support @gol
375 -gcolumn-info -gno-column-info @gol
376 -gstatement-frontiers -gno-statement-frontiers @gol
377 -gvariable-location-views -gno-variable-location-views @gol
378 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
379 -ginline-points -gno-inline-points @gol
380 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
381 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
382 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
383 -fno-eliminate-unused-debug-types @gol
384 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
385 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
386 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
387 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
388 -fvar-tracking -fvar-tracking-assignments}
389
390 @item Optimization Options
391 @xref{Optimize Options,,Options that Control Optimization}.
392 @gccoptlist{-faggressive-loop-optimizations @gol
393 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
394 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
395 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
396 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
397 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
398 -fauto-inc-dec -fbranch-probabilities @gol
399 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
400 -fbtr-bb-exclusive -fcaller-saves @gol
401 -fcombine-stack-adjustments -fconserve-stack @gol
402 -fcompare-elim -fcprop-registers -fcrossjumping @gol
403 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
404 -fcx-limited-range @gol
405 -fdata-sections -fdce -fdelayed-branch @gol
406 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
407 -fdevirtualize-at-ltrans -fdse @gol
408 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
409 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
410 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
411 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
412 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
413 -fif-conversion2 -findirect-inlining @gol
414 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
415 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
416 -fipa-bit-cp -fipa-vrp @gol
417 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-reference-addressable @gol
418 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
419 -fira-region=@var{region} -fira-hoist-pressure @gol
420 -fira-loop-pressure -fno-ira-share-save-slots @gol
421 -fno-ira-share-spill-slots @gol
422 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
423 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
424 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
425 -floop-block -floop-interchange -floop-strip-mine @gol
426 -floop-unroll-and-jam -floop-nest-optimize @gol
427 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
428 -flto-partition=@var{alg} -fmerge-all-constants @gol
429 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
430 -fmove-loop-invariants -fno-branch-count-reg @gol
431 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
432 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
433 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
434 -fno-sched-spec -fno-signed-zeros @gol
435 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
436 -fomit-frame-pointer -foptimize-sibling-calls @gol
437 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
438 -fprefetch-loop-arrays @gol
439 -fprofile-correction @gol
440 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
441 -fprofile-reorder-functions @gol
442 -freciprocal-math -free -frename-registers -freorder-blocks @gol
443 -freorder-blocks-algorithm=@var{algorithm} @gol
444 -freorder-blocks-and-partition -freorder-functions @gol
445 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
446 -frounding-math -fsave-optimization-record @gol
447 -fsched2-use-superblocks -fsched-pressure @gol
448 -fsched-spec-load -fsched-spec-load-dangerous @gol
449 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
450 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
451 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
452 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
453 -fschedule-fusion @gol
454 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
455 -fselective-scheduling -fselective-scheduling2 @gol
456 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
457 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
458 -fsignaling-nans @gol
459 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
460 -fsplit-paths @gol
461 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
462 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
463 -fthread-jumps -ftracer -ftree-bit-ccp @gol
464 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
465 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
466 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
467 -ftree-loop-if-convert -ftree-loop-im @gol
468 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
469 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
470 -ftree-loop-vectorize @gol
471 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
472 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
473 -ftree-switch-conversion -ftree-tail-merge @gol
474 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
475 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
476 -funsafe-math-optimizations -funswitch-loops @gol
477 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
478 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
479 --param @var{name}=@var{value}
480 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
481
482 @item Program Instrumentation Options
483 @xref{Instrumentation Options,,Program Instrumentation Options}.
484 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
485 -fprofile-abs-path @gol
486 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
487 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
488 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
489 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
490 -fsanitize-undefined-trap-on-error -fbounds-check @gol
491 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
492 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
493 -fstack-protector-explicit -fstack-check @gol
494 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
495 -fno-stack-limit -fsplit-stack @gol
496 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
497 -fvtv-counts -fvtv-debug @gol
498 -finstrument-functions @gol
499 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
500 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
501
502 @item Preprocessor Options
503 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
504 @gccoptlist{-A@var{question}=@var{answer} @gol
505 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
506 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
507 -dD -dI -dM -dN -dU @gol
508 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
509 -fexec-charset=@var{charset} -fextended-identifiers @gol
510 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
511 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
512 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
513 -fwide-exec-charset=@var{charset} -fworking-directory @gol
514 -H -imacros @var{file} -include @var{file} @gol
515 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
516 -no-integrated-cpp -P -pthread -remap @gol
517 -traditional -traditional-cpp -trigraphs @gol
518 -U@var{macro} -undef @gol
519 -Wp,@var{option} -Xpreprocessor @var{option}}
520
521 @item Assembler Options
522 @xref{Assembler Options,,Passing Options to the Assembler}.
523 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
524
525 @item Linker Options
526 @xref{Link Options,,Options for Linking}.
527 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
528 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
529 -e @var{entry} --entry=@var{entry} @gol
530 -pie -pthread -r -rdynamic @gol
531 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
532 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
533 -shared -shared-libgcc -symbolic @gol
534 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
535 -u @var{symbol} -z @var{keyword}}
536
537 @item Directory Options
538 @xref{Directory Options,,Options for Directory Search}.
539 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
540 -idirafter @var{dir} @gol
541 -imacros @var{file} -imultilib @var{dir} @gol
542 -iplugindir=@var{dir} -iprefix @var{file} @gol
543 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
544 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
545 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
546 -nostdinc -nostdinc++ --sysroot=@var{dir}}
547
548 @item Code Generation Options
549 @xref{Code Gen Options,,Options for Code Generation Conventions}.
550 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
551 -ffixed-@var{reg} -fexceptions @gol
552 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
553 -fasynchronous-unwind-tables @gol
554 -fno-gnu-unique @gol
555 -finhibit-size-directive -fno-common -fno-ident @gol
556 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
557 -fno-jump-tables @gol
558 -frecord-gcc-switches @gol
559 -freg-struct-return -fshort-enums -fshort-wchar @gol
560 -fverbose-asm -fpack-struct[=@var{n}] @gol
561 -fleading-underscore -ftls-model=@var{model} @gol
562 -fstack-reuse=@var{reuse_level} @gol
563 -ftrampolines -ftrapv -fwrapv @gol
564 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
565 -fstrict-volatile-bitfields -fsync-libcalls}
566
567 @item Developer Options
568 @xref{Developer Options,,GCC Developer Options}.
569 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
570 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
571 -fdbg-cnt=@var{counter-value-list} @gol
572 -fdisable-ipa-@var{pass_name} @gol
573 -fdisable-rtl-@var{pass_name} @gol
574 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
575 -fdisable-tree-@var{pass_name} @gol
576 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
577 -fdump-debug -fdump-earlydebug @gol
578 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
579 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
580 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
581 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
582 -fdump-lang-all @gol
583 -fdump-lang-@var{switch} @gol
584 -fdump-lang-@var{switch}-@var{options} @gol
585 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
586 -fdump-passes @gol
587 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
588 -fdump-statistics @gol
589 -fdump-tree-all @gol
590 -fdump-tree-@var{switch} @gol
591 -fdump-tree-@var{switch}-@var{options} @gol
592 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
593 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
594 -fenable-@var{kind}-@var{pass} @gol
595 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
596 -fira-verbose=@var{n} @gol
597 -flto-report -flto-report-wpa -fmem-report-wpa @gol
598 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
599 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
600 -fprofile-report @gol
601 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
602 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
603 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
604 -fvar-tracking-assignments-toggle -gtoggle @gol
605 -print-file-name=@var{library} -print-libgcc-file-name @gol
606 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
607 -print-prog-name=@var{program} -print-search-dirs -Q @gol
608 -print-sysroot -print-sysroot-headers-suffix @gol
609 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
610
611 @item Machine-Dependent Options
612 @xref{Submodel Options,,Machine-Dependent Options}.
613 @c This list is ordered alphanumerically by subsection name.
614 @c Try and put the significant identifier (CPU or system) first,
615 @c so users have a clue at guessing where the ones they want will be.
616
617 @emph{AArch64 Options}
618 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
619 -mgeneral-regs-only @gol
620 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
621 -mstrict-align -mno-strict-align @gol
622 -momit-leaf-frame-pointer @gol
623 -mtls-dialect=desc -mtls-dialect=traditional @gol
624 -mtls-size=@var{size} @gol
625 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
626 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
627 -mpc-relative-literal-loads @gol
628 -msign-return-address=@var{scope} @gol
629 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
630 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
631
632 @emph{Adapteva Epiphany Options}
633 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
634 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
635 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
636 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
637 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
638 -msplit-vecmove-early -m1reg-@var{reg}}
639
640 @emph{ARC Options}
641 @gccoptlist{-mbarrel-shifter -mjli-always @gol
642 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
643 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
644 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
645 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
646 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
647 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
648 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
649 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
650 -mvolatile-cache -mtp-regno=@var{regno} @gol
651 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
652 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
653 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
654 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
655 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
656 -mtune=@var{cpu} -mmultcost=@var{num} @gol
657 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
658 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
659
660 @emph{ARM Options}
661 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
662 -mabi=@var{name} @gol
663 -mapcs-stack-check -mno-apcs-stack-check @gol
664 -mapcs-reentrant -mno-apcs-reentrant @gol
665 -msched-prolog -mno-sched-prolog @gol
666 -mlittle-endian -mbig-endian @gol
667 -mbe8 -mbe32 @gol
668 -mfloat-abi=@var{name} @gol
669 -mfp16-format=@var{name}
670 -mthumb-interwork -mno-thumb-interwork @gol
671 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
672 -mtune=@var{name} -mprint-tune-info @gol
673 -mstructure-size-boundary=@var{n} @gol
674 -mabort-on-noreturn @gol
675 -mlong-calls -mno-long-calls @gol
676 -msingle-pic-base -mno-single-pic-base @gol
677 -mpic-register=@var{reg} @gol
678 -mnop-fun-dllimport @gol
679 -mpoke-function-name @gol
680 -mthumb -marm -mflip-thumb @gol
681 -mtpcs-frame -mtpcs-leaf-frame @gol
682 -mcaller-super-interworking -mcallee-super-interworking @gol
683 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
684 -mword-relocations @gol
685 -mfix-cortex-m3-ldrd @gol
686 -munaligned-access @gol
687 -mneon-for-64bits @gol
688 -mslow-flash-data @gol
689 -masm-syntax-unified @gol
690 -mrestrict-it @gol
691 -mverbose-cost-dump @gol
692 -mpure-code @gol
693 -mcmse}
694
695 @emph{AVR Options}
696 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
697 -mbranch-cost=@var{cost} @gol
698 -mcall-prologues -mgas-isr-prologues -mint8 @gol
699 -mn_flash=@var{size} -mno-interrupts @gol
700 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
701 -mfract-convert-truncate @gol
702 -mshort-calls -nodevicelib @gol
703 -Waddr-space-convert -Wmisspelled-isr}
704
705 @emph{Blackfin Options}
706 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
707 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
708 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
709 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
710 -mno-id-shared-library -mshared-library-id=@var{n} @gol
711 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
712 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
713 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
714 -micplb}
715
716 @emph{C6X Options}
717 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
718 -msim -msdata=@var{sdata-type}}
719
720 @emph{CRIS Options}
721 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
722 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
723 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
724 -mstack-align -mdata-align -mconst-align @gol
725 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
726 -melf -maout -melinux -mlinux -sim -sim2 @gol
727 -mmul-bug-workaround -mno-mul-bug-workaround}
728
729 @emph{CR16 Options}
730 @gccoptlist{-mmac @gol
731 -mcr16cplus -mcr16c @gol
732 -msim -mint32 -mbit-ops
733 -mdata-model=@var{model}}
734
735 @emph{C-SKY Options}
736 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
737 -mbig-endian -EB -mlittle-endian -EL @gol
738 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
739 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
740 -mdsp -medsp -mvdsp @gol
741 -mdiv -msmart -mhigh-registers -manchor @gol
742 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
743 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
744
745 @emph{Darwin Options}
746 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
747 -arch_only -bind_at_load -bundle -bundle_loader @gol
748 -client_name -compatibility_version -current_version @gol
749 -dead_strip @gol
750 -dependency-file -dylib_file -dylinker_install_name @gol
751 -dynamic -dynamiclib -exported_symbols_list @gol
752 -filelist -flat_namespace -force_cpusubtype_ALL @gol
753 -force_flat_namespace -headerpad_max_install_names @gol
754 -iframework @gol
755 -image_base -init -install_name -keep_private_externs @gol
756 -multi_module -multiply_defined -multiply_defined_unused @gol
757 -noall_load -no_dead_strip_inits_and_terms @gol
758 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
759 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
760 -private_bundle -read_only_relocs -sectalign @gol
761 -sectobjectsymbols -whyload -seg1addr @gol
762 -sectcreate -sectobjectsymbols -sectorder @gol
763 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
764 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
765 -segprot -segs_read_only_addr -segs_read_write_addr @gol
766 -single_module -static -sub_library -sub_umbrella @gol
767 -twolevel_namespace -umbrella -undefined @gol
768 -unexported_symbols_list -weak_reference_mismatches @gol
769 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
770 -mkernel -mone-byte-bool}
771
772 @emph{DEC Alpha Options}
773 @gccoptlist{-mno-fp-regs -msoft-float @gol
774 -mieee -mieee-with-inexact -mieee-conformant @gol
775 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
776 -mtrap-precision=@var{mode} -mbuild-constants @gol
777 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
778 -mbwx -mmax -mfix -mcix @gol
779 -mfloat-vax -mfloat-ieee @gol
780 -mexplicit-relocs -msmall-data -mlarge-data @gol
781 -msmall-text -mlarge-text @gol
782 -mmemory-latency=@var{time}}
783
784 @emph{FR30 Options}
785 @gccoptlist{-msmall-model -mno-lsim}
786
787 @emph{FT32 Options}
788 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
789
790 @emph{FRV Options}
791 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
792 -mhard-float -msoft-float @gol
793 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
794 -mdouble -mno-double @gol
795 -mmedia -mno-media -mmuladd -mno-muladd @gol
796 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
797 -mlinked-fp -mlong-calls -malign-labels @gol
798 -mlibrary-pic -macc-4 -macc-8 @gol
799 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
800 -moptimize-membar -mno-optimize-membar @gol
801 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
802 -mvliw-branch -mno-vliw-branch @gol
803 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
804 -mno-nested-cond-exec -mtomcat-stats @gol
805 -mTLS -mtls @gol
806 -mcpu=@var{cpu}}
807
808 @emph{GNU/Linux Options}
809 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
810 -tno-android-cc -tno-android-ld}
811
812 @emph{H8/300 Options}
813 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
814
815 @emph{HPPA Options}
816 @gccoptlist{-march=@var{architecture-type} @gol
817 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
818 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
819 -mfixed-range=@var{register-range} @gol
820 -mjump-in-delay -mlinker-opt -mlong-calls @gol
821 -mlong-load-store -mno-disable-fpregs @gol
822 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
823 -mno-jump-in-delay -mno-long-load-store @gol
824 -mno-portable-runtime -mno-soft-float @gol
825 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
826 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
827 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
828 -munix=@var{unix-std} -nolibdld -static -threads}
829
830 @emph{IA-64 Options}
831 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
832 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
833 -mconstant-gp -mauto-pic -mfused-madd @gol
834 -minline-float-divide-min-latency @gol
835 -minline-float-divide-max-throughput @gol
836 -mno-inline-float-divide @gol
837 -minline-int-divide-min-latency @gol
838 -minline-int-divide-max-throughput @gol
839 -mno-inline-int-divide @gol
840 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
841 -mno-inline-sqrt @gol
842 -mdwarf2-asm -mearly-stop-bits @gol
843 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
844 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
845 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
846 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
847 -msched-spec-ldc -msched-spec-control-ldc @gol
848 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
849 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
850 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
851 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
852
853 @emph{LM32 Options}
854 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
855 -msign-extend-enabled -muser-enabled}
856
857 @emph{M32R/D Options}
858 @gccoptlist{-m32r2 -m32rx -m32r @gol
859 -mdebug @gol
860 -malign-loops -mno-align-loops @gol
861 -missue-rate=@var{number} @gol
862 -mbranch-cost=@var{number} @gol
863 -mmodel=@var{code-size-model-type} @gol
864 -msdata=@var{sdata-type} @gol
865 -mno-flush-func -mflush-func=@var{name} @gol
866 -mno-flush-trap -mflush-trap=@var{number} @gol
867 -G @var{num}}
868
869 @emph{M32C Options}
870 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
871
872 @emph{M680x0 Options}
873 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
874 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
875 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
876 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
877 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
878 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
879 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
880 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
881 -mxgot -mno-xgot -mlong-jump-table-offsets}
882
883 @emph{MCore Options}
884 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
885 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
886 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
887 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
888 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
889
890 @emph{MeP Options}
891 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
892 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
893 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
894 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
895 -mtiny=@var{n}}
896
897 @emph{MicroBlaze Options}
898 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
899 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
900 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
901 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
902 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
903 -mpic-data-is-text-relative}
904
905 @emph{MIPS Options}
906 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
907 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
908 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
909 -mips16 -mno-mips16 -mflip-mips16 @gol
910 -minterlink-compressed -mno-interlink-compressed @gol
911 -minterlink-mips16 -mno-interlink-mips16 @gol
912 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
913 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
914 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
915 -mno-float -msingle-float -mdouble-float @gol
916 -modd-spreg -mno-odd-spreg @gol
917 -mabs=@var{mode} -mnan=@var{encoding} @gol
918 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
919 -mmcu -mmno-mcu @gol
920 -meva -mno-eva @gol
921 -mvirt -mno-virt @gol
922 -mxpa -mno-xpa @gol
923 -mcrc -mno-crc @gol
924 -mginv -mno-ginv @gol
925 -mmicromips -mno-micromips @gol
926 -mmsa -mno-msa @gol
927 -mloongson-mmi -mno-loongson-mmi @gol
928 -mloongson-ext -mno-loongson-ext @gol
929 -mloongson-ext2 -mno-loongson-ext2 @gol
930 -mfpu=@var{fpu-type} @gol
931 -msmartmips -mno-smartmips @gol
932 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
933 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
934 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
935 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
936 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
937 -membedded-data -mno-embedded-data @gol
938 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
939 -mcode-readable=@var{setting} @gol
940 -msplit-addresses -mno-split-addresses @gol
941 -mexplicit-relocs -mno-explicit-relocs @gol
942 -mcheck-zero-division -mno-check-zero-division @gol
943 -mdivide-traps -mdivide-breaks @gol
944 -mload-store-pairs -mno-load-store-pairs @gol
945 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
946 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
947 -mfix-24k -mno-fix-24k @gol
948 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
949 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
950 -mfix-vr4120 -mno-fix-vr4120 @gol
951 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
952 -mflush-func=@var{func} -mno-flush-func @gol
953 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
954 -mcompact-branches=@var{policy} @gol
955 -mfp-exceptions -mno-fp-exceptions @gol
956 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
957 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
958 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
959 -mframe-header-opt -mno-frame-header-opt}
960
961 @emph{MMIX Options}
962 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
963 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
964 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
965 -mno-base-addresses -msingle-exit -mno-single-exit}
966
967 @emph{MN10300 Options}
968 @gccoptlist{-mmult-bug -mno-mult-bug @gol
969 -mno-am33 -mam33 -mam33-2 -mam34 @gol
970 -mtune=@var{cpu-type} @gol
971 -mreturn-pointer-on-d0 @gol
972 -mno-crt0 -mrelax -mliw -msetlb}
973
974 @emph{Moxie Options}
975 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
976
977 @emph{MSP430 Options}
978 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
979 -mwarn-mcu @gol
980 -mcode-region= -mdata-region= @gol
981 -msilicon-errata= -msilicon-errata-warn= @gol
982 -mhwmult= -minrt}
983
984 @emph{NDS32 Options}
985 @gccoptlist{-mbig-endian -mlittle-endian @gol
986 -mreduced-regs -mfull-regs @gol
987 -mcmov -mno-cmov @gol
988 -mext-perf -mno-ext-perf @gol
989 -mext-perf2 -mno-ext-perf2 @gol
990 -mext-string -mno-ext-string @gol
991 -mv3push -mno-v3push @gol
992 -m16bit -mno-16bit @gol
993 -misr-vector-size=@var{num} @gol
994 -mcache-block-size=@var{num} @gol
995 -march=@var{arch} @gol
996 -mcmodel=@var{code-model} @gol
997 -mctor-dtor -mrelax}
998
999 @emph{Nios II Options}
1000 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1001 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1002 -mel -meb @gol
1003 -mno-bypass-cache -mbypass-cache @gol
1004 -mno-cache-volatile -mcache-volatile @gol
1005 -mno-fast-sw-div -mfast-sw-div @gol
1006 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1007 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1008 -mcustom-fpu-cfg=@var{name} @gol
1009 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1010 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1011
1012 @emph{Nvidia PTX Options}
1013 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1014
1015 @emph{OpenRISC Options}
1016 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1017 -msoft-mul -msoft-div @gol
1018 -mcmov -mror -msext -msfimm -mshftimm}
1019
1020 @emph{PDP-11 Options}
1021 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1022 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1023 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1024
1025 @emph{picoChip Options}
1026 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1027 -msymbol-as-address -mno-inefficient-warnings}
1028
1029 @emph{PowerPC Options}
1030 See RS/6000 and PowerPC Options.
1031
1032 @emph{PowerPC SPE Options}
1033 @gccoptlist{-mcpu=@var{cpu-type} @gol
1034 -mtune=@var{cpu-type} @gol
1035 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1036 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1037 -m32 -mxl-compat -mno-xl-compat @gol
1038 -malign-power -malign-natural @gol
1039 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1040 -msingle-float -mdouble-float @gol
1041 -mupdate -mno-update @gol
1042 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1043 -mstrict-align -mno-strict-align -mrelocatable @gol
1044 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1045 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1046 -msingle-pic-base @gol
1047 -mprioritize-restricted-insns=@var{priority} @gol
1048 -msched-costly-dep=@var{dependence_type} @gol
1049 -minsert-sched-nops=@var{scheme} @gol
1050 -mcall-sysv -mcall-netbsd @gol
1051 -maix-struct-return -msvr4-struct-return @gol
1052 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1053 -mblock-move-inline-limit=@var{num} @gol
1054 -misel -mno-isel @gol
1055 -misel=yes -misel=no @gol
1056 -mspe -mno-spe @gol
1057 -mspe=yes -mspe=no @gol
1058 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1059 -mprototype -mno-prototype @gol
1060 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1061 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1062 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1063 -mno-recip-precision @gol
1064 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1065 -msave-toc-indirect -mno-save-toc-indirect @gol
1066 -mcompat-align-parm -mno-compat-align-parm @gol
1067 -mfloat128 -mno-float128 @gol
1068 -mgnu-attribute -mno-gnu-attribute @gol
1069 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1070 -mstack-protector-guard-offset=@var{offset}}
1071
1072 @emph{RISC-V Options}
1073 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1074 -mplt -mno-plt @gol
1075 -mabi=@var{ABI-string} @gol
1076 -mfdiv -mno-fdiv @gol
1077 -mdiv -mno-div @gol
1078 -march=@var{ISA-string} @gol
1079 -mtune=@var{processor-string} @gol
1080 -mpreferred-stack-boundary=@var{num} @gol
1081 -msmall-data-limit=@var{N-bytes} @gol
1082 -msave-restore -mno-save-restore @gol
1083 -mstrict-align -mno-strict-align @gol
1084 -mcmodel=medlow -mcmodel=medany @gol
1085 -mexplicit-relocs -mno-explicit-relocs @gol
1086 -mrelax -mno-relax @gol}
1087
1088 @emph{RL78 Options}
1089 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1090 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1091 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1092
1093 @emph{RS/6000 and PowerPC Options}
1094 @gccoptlist{-mcpu=@var{cpu-type} @gol
1095 -mtune=@var{cpu-type} @gol
1096 -mcmodel=@var{code-model} @gol
1097 -mpowerpc64 @gol
1098 -maltivec -mno-altivec @gol
1099 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1100 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1101 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1102 -mfprnd -mno-fprnd @gol
1103 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1104 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1105 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1106 -malign-power -malign-natural @gol
1107 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1108 -mupdate -mno-update @gol
1109 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1110 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1111 -mstrict-align -mno-strict-align -mrelocatable @gol
1112 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1113 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1114 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1115 -mprioritize-restricted-insns=@var{priority} @gol
1116 -msched-costly-dep=@var{dependence_type} @gol
1117 -minsert-sched-nops=@var{scheme} @gol
1118 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1119 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1120 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1121 -mtraceback=@var{traceback_type} @gol
1122 -maix-struct-return -msvr4-struct-return @gol
1123 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1124 -mblock-move-inline-limit=@var{num} @gol
1125 -mblock-compare-inline-limit=@var{num} @gol
1126 -mblock-compare-inline-loop-limit=@var{num} @gol
1127 -mstring-compare-inline-limit=@var{num} @gol
1128 -misel -mno-isel @gol
1129 -mvrsave -mno-vrsave @gol
1130 -mmulhw -mno-mulhw @gol
1131 -mdlmzb -mno-dlmzb @gol
1132 -mprototype -mno-prototype @gol
1133 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1134 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1135 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1136 -mno-recip-precision @gol
1137 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1138 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1139 -msave-toc-indirect -mno-save-toc-indirect @gol
1140 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1141 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1142 -mquad-memory -mno-quad-memory @gol
1143 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1144 -mcompat-align-parm -mno-compat-align-parm @gol
1145 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1146 -mgnu-attribute -mno-gnu-attribute @gol
1147 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1148 -mstack-protector-guard-offset=@var{offset}}
1149
1150 @emph{RX Options}
1151 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1152 -mcpu=@gol
1153 -mbig-endian-data -mlittle-endian-data @gol
1154 -msmall-data @gol
1155 -msim -mno-sim@gol
1156 -mas100-syntax -mno-as100-syntax@gol
1157 -mrelax@gol
1158 -mmax-constant-size=@gol
1159 -mint-register=@gol
1160 -mpid@gol
1161 -mallow-string-insns -mno-allow-string-insns@gol
1162 -mjsr@gol
1163 -mno-warn-multiple-fast-interrupts@gol
1164 -msave-acc-in-interrupts}
1165
1166 @emph{S/390 and zSeries Options}
1167 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1168 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1169 -mlong-double-64 -mlong-double-128 @gol
1170 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1171 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1172 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1173 -mhtm -mvx -mzvector @gol
1174 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1175 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1176 -mhotpatch=@var{halfwords},@var{halfwords}}
1177
1178 @emph{Score Options}
1179 @gccoptlist{-meb -mel @gol
1180 -mnhwloop @gol
1181 -muls @gol
1182 -mmac @gol
1183 -mscore5 -mscore5u -mscore7 -mscore7d}
1184
1185 @emph{SH Options}
1186 @gccoptlist{-m1 -m2 -m2e @gol
1187 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1188 -m3 -m3e @gol
1189 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1190 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1191 -mb -ml -mdalign -mrelax @gol
1192 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1193 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1194 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1195 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1196 -maccumulate-outgoing-args @gol
1197 -matomic-model=@var{atomic-model} @gol
1198 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1199 -mcbranch-force-delay-slot @gol
1200 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1201 -mpretend-cmove -mtas}
1202
1203 @emph{Solaris 2 Options}
1204 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1205 -pthreads}
1206
1207 @emph{SPARC Options}
1208 @gccoptlist{-mcpu=@var{cpu-type} @gol
1209 -mtune=@var{cpu-type} @gol
1210 -mcmodel=@var{code-model} @gol
1211 -mmemory-model=@var{mem-model} @gol
1212 -m32 -m64 -mapp-regs -mno-app-regs @gol
1213 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1214 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1215 -mhard-quad-float -msoft-quad-float @gol
1216 -mstack-bias -mno-stack-bias @gol
1217 -mstd-struct-return -mno-std-struct-return @gol
1218 -munaligned-doubles -mno-unaligned-doubles @gol
1219 -muser-mode -mno-user-mode @gol
1220 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1221 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1222 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1223 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1224 -mpopc -mno-popc -msubxc -mno-subxc @gol
1225 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1226 -mlra -mno-lra}
1227
1228 @emph{SPU Options}
1229 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1230 -msafe-dma -munsafe-dma @gol
1231 -mbranch-hints @gol
1232 -msmall-mem -mlarge-mem -mstdmain @gol
1233 -mfixed-range=@var{register-range} @gol
1234 -mea32 -mea64 @gol
1235 -maddress-space-conversion -mno-address-space-conversion @gol
1236 -mcache-size=@var{cache-size} @gol
1237 -matomic-updates -mno-atomic-updates}
1238
1239 @emph{System V Options}
1240 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1241
1242 @emph{TILE-Gx Options}
1243 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1244 -mcmodel=@var{code-model}}
1245
1246 @emph{TILEPro Options}
1247 @gccoptlist{-mcpu=@var{cpu} -m32}
1248
1249 @emph{V850 Options}
1250 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1251 -mprolog-function -mno-prolog-function -mspace @gol
1252 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1253 -mapp-regs -mno-app-regs @gol
1254 -mdisable-callt -mno-disable-callt @gol
1255 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1256 -mv850e -mv850 -mv850e3v5 @gol
1257 -mloop @gol
1258 -mrelax @gol
1259 -mlong-jumps @gol
1260 -msoft-float @gol
1261 -mhard-float @gol
1262 -mgcc-abi @gol
1263 -mrh850-abi @gol
1264 -mbig-switch}
1265
1266 @emph{VAX Options}
1267 @gccoptlist{-mg -mgnu -munix}
1268
1269 @emph{Visium Options}
1270 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1271 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1272
1273 @emph{VMS Options}
1274 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1275 -mpointer-size=@var{size}}
1276
1277 @emph{VxWorks Options}
1278 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1279 -Xbind-lazy -Xbind-now}
1280
1281 @emph{x86 Options}
1282 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1283 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1284 -mfpmath=@var{unit} @gol
1285 -masm=@var{dialect} -mno-fancy-math-387 @gol
1286 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1287 -mno-wide-multiply -mrtd -malign-double @gol
1288 -mpreferred-stack-boundary=@var{num} @gol
1289 -mincoming-stack-boundary=@var{num} @gol
1290 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1291 -mrecip -mrecip=@var{opt} @gol
1292 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1293 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1294 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1295 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1296 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite @gol
1297 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1298 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1299 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1300 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1301 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1302 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1303 -mcldemote @gol
1304 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1305 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1306 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1307 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1308 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1309 -mregparm=@var{num} -msseregparm @gol
1310 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1311 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1312 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1313 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1314 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1315 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1316 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1317 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1318 -mstack-protector-guard-reg=@var{reg} @gol
1319 -mstack-protector-guard-offset=@var{offset} @gol
1320 -mstack-protector-guard-symbol=@var{symbol} @gol
1321 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1322 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1323 -mindirect-branch-register}
1324
1325 @emph{x86 Windows Options}
1326 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1327 -mnop-fun-dllimport -mthread @gol
1328 -municode -mwin32 -mwindows -fno-set-stack-executable}
1329
1330 @emph{Xstormy16 Options}
1331 @gccoptlist{-msim}
1332
1333 @emph{Xtensa Options}
1334 @gccoptlist{-mconst16 -mno-const16 @gol
1335 -mfused-madd -mno-fused-madd @gol
1336 -mforce-no-pic @gol
1337 -mserialize-volatile -mno-serialize-volatile @gol
1338 -mtext-section-literals -mno-text-section-literals @gol
1339 -mauto-litpools -mno-auto-litpools @gol
1340 -mtarget-align -mno-target-align @gol
1341 -mlongcalls -mno-longcalls}
1342
1343 @emph{zSeries Options}
1344 See S/390 and zSeries Options.
1345 @end table
1346
1347
1348 @node Overall Options
1349 @section Options Controlling the Kind of Output
1350
1351 Compilation can involve up to four stages: preprocessing, compilation
1352 proper, assembly and linking, always in that order. GCC is capable of
1353 preprocessing and compiling several files either into several
1354 assembler input files, or into one assembler input file; then each
1355 assembler input file produces an object file, and linking combines all
1356 the object files (those newly compiled, and those specified as input)
1357 into an executable file.
1358
1359 @cindex file name suffix
1360 For any given input file, the file name suffix determines what kind of
1361 compilation is done:
1362
1363 @table @gcctabopt
1364 @item @var{file}.c
1365 C source code that must be preprocessed.
1366
1367 @item @var{file}.i
1368 C source code that should not be preprocessed.
1369
1370 @item @var{file}.ii
1371 C++ source code that should not be preprocessed.
1372
1373 @item @var{file}.m
1374 Objective-C source code. Note that you must link with the @file{libobjc}
1375 library to make an Objective-C program work.
1376
1377 @item @var{file}.mi
1378 Objective-C source code that should not be preprocessed.
1379
1380 @item @var{file}.mm
1381 @itemx @var{file}.M
1382 Objective-C++ source code. Note that you must link with the @file{libobjc}
1383 library to make an Objective-C++ program work. Note that @samp{.M} refers
1384 to a literal capital M@.
1385
1386 @item @var{file}.mii
1387 Objective-C++ source code that should not be preprocessed.
1388
1389 @item @var{file}.h
1390 C, C++, Objective-C or Objective-C++ header file to be turned into a
1391 precompiled header (default), or C, C++ header file to be turned into an
1392 Ada spec (via the @option{-fdump-ada-spec} switch).
1393
1394 @item @var{file}.cc
1395 @itemx @var{file}.cp
1396 @itemx @var{file}.cxx
1397 @itemx @var{file}.cpp
1398 @itemx @var{file}.CPP
1399 @itemx @var{file}.c++
1400 @itemx @var{file}.C
1401 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1402 the last two letters must both be literally @samp{x}. Likewise,
1403 @samp{.C} refers to a literal capital C@.
1404
1405 @item @var{file}.mm
1406 @itemx @var{file}.M
1407 Objective-C++ source code that must be preprocessed.
1408
1409 @item @var{file}.mii
1410 Objective-C++ source code that should not be preprocessed.
1411
1412 @item @var{file}.hh
1413 @itemx @var{file}.H
1414 @itemx @var{file}.hp
1415 @itemx @var{file}.hxx
1416 @itemx @var{file}.hpp
1417 @itemx @var{file}.HPP
1418 @itemx @var{file}.h++
1419 @itemx @var{file}.tcc
1420 C++ header file to be turned into a precompiled header or Ada spec.
1421
1422 @item @var{file}.f
1423 @itemx @var{file}.for
1424 @itemx @var{file}.ftn
1425 Fixed form Fortran source code that should not be preprocessed.
1426
1427 @item @var{file}.F
1428 @itemx @var{file}.FOR
1429 @itemx @var{file}.fpp
1430 @itemx @var{file}.FPP
1431 @itemx @var{file}.FTN
1432 Fixed form Fortran source code that must be preprocessed (with the traditional
1433 preprocessor).
1434
1435 @item @var{file}.f90
1436 @itemx @var{file}.f95
1437 @itemx @var{file}.f03
1438 @itemx @var{file}.f08
1439 Free form Fortran source code that should not be preprocessed.
1440
1441 @item @var{file}.F90
1442 @itemx @var{file}.F95
1443 @itemx @var{file}.F03
1444 @itemx @var{file}.F08
1445 Free form Fortran source code that must be preprocessed (with the
1446 traditional preprocessor).
1447
1448 @item @var{file}.go
1449 Go source code.
1450
1451 @item @var{file}.brig
1452 BRIG files (binary representation of HSAIL).
1453
1454 @item @var{file}.d
1455 D source code.
1456
1457 @item @var{file}.di
1458 D interface file.
1459
1460 @item @var{file}.dd
1461 D documentation code (Ddoc).
1462
1463 @item @var{file}.ads
1464 Ada source code file that contains a library unit declaration (a
1465 declaration of a package, subprogram, or generic, or a generic
1466 instantiation), or a library unit renaming declaration (a package,
1467 generic, or subprogram renaming declaration). Such files are also
1468 called @dfn{specs}.
1469
1470 @item @var{file}.adb
1471 Ada source code file containing a library unit body (a subprogram or
1472 package body). Such files are also called @dfn{bodies}.
1473
1474 @c GCC also knows about some suffixes for languages not yet included:
1475 @c Ratfor:
1476 @c @var{file}.r
1477
1478 @item @var{file}.s
1479 Assembler code.
1480
1481 @item @var{file}.S
1482 @itemx @var{file}.sx
1483 Assembler code that must be preprocessed.
1484
1485 @item @var{other}
1486 An object file to be fed straight into linking.
1487 Any file name with no recognized suffix is treated this way.
1488 @end table
1489
1490 @opindex x
1491 You can specify the input language explicitly with the @option{-x} option:
1492
1493 @table @gcctabopt
1494 @item -x @var{language}
1495 Specify explicitly the @var{language} for the following input files
1496 (rather than letting the compiler choose a default based on the file
1497 name suffix). This option applies to all following input files until
1498 the next @option{-x} option. Possible values for @var{language} are:
1499 @smallexample
1500 c c-header cpp-output
1501 c++ c++-header c++-cpp-output
1502 objective-c objective-c-header objective-c-cpp-output
1503 objective-c++ objective-c++-header objective-c++-cpp-output
1504 assembler assembler-with-cpp
1505 ada
1506 d
1507 f77 f77-cpp-input f95 f95-cpp-input
1508 go
1509 brig
1510 @end smallexample
1511
1512 @item -x none
1513 Turn off any specification of a language, so that subsequent files are
1514 handled according to their file name suffixes (as they are if @option{-x}
1515 has not been used at all).
1516 @end table
1517
1518 If you only want some of the stages of compilation, you can use
1519 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1520 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1521 @command{gcc} is to stop. Note that some combinations (for example,
1522 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1523
1524 @table @gcctabopt
1525 @item -c
1526 @opindex c
1527 Compile or assemble the source files, but do not link. The linking
1528 stage simply is not done. The ultimate output is in the form of an
1529 object file for each source file.
1530
1531 By default, the object file name for a source file is made by replacing
1532 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1533
1534 Unrecognized input files, not requiring compilation or assembly, are
1535 ignored.
1536
1537 @item -S
1538 @opindex S
1539 Stop after the stage of compilation proper; do not assemble. The output
1540 is in the form of an assembler code file for each non-assembler input
1541 file specified.
1542
1543 By default, the assembler file name for a source file is made by
1544 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1545
1546 Input files that don't require compilation are ignored.
1547
1548 @item -E
1549 @opindex E
1550 Stop after the preprocessing stage; do not run the compiler proper. The
1551 output is in the form of preprocessed source code, which is sent to the
1552 standard output.
1553
1554 Input files that don't require preprocessing are ignored.
1555
1556 @cindex output file option
1557 @item -o @var{file}
1558 @opindex o
1559 Place output in file @var{file}. This applies to whatever
1560 sort of output is being produced, whether it be an executable file,
1561 an object file, an assembler file or preprocessed C code.
1562
1563 If @option{-o} is not specified, the default is to put an executable
1564 file in @file{a.out}, the object file for
1565 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1566 assembler file in @file{@var{source}.s}, a precompiled header file in
1567 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1568 standard output.
1569
1570 @item -v
1571 @opindex v
1572 Print (on standard error output) the commands executed to run the stages
1573 of compilation. Also print the version number of the compiler driver
1574 program and of the preprocessor and the compiler proper.
1575
1576 @item -###
1577 @opindex ###
1578 Like @option{-v} except the commands are not executed and arguments
1579 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1580 This is useful for shell scripts to capture the driver-generated command lines.
1581
1582 @item --help
1583 @opindex help
1584 Print (on the standard output) a description of the command-line options
1585 understood by @command{gcc}. If the @option{-v} option is also specified
1586 then @option{--help} is also passed on to the various processes
1587 invoked by @command{gcc}, so that they can display the command-line options
1588 they accept. If the @option{-Wextra} option has also been specified
1589 (prior to the @option{--help} option), then command-line options that
1590 have no documentation associated with them are also displayed.
1591
1592 @item --target-help
1593 @opindex target-help
1594 Print (on the standard output) a description of target-specific command-line
1595 options for each tool. For some targets extra target-specific
1596 information may also be printed.
1597
1598 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1599 Print (on the standard output) a description of the command-line
1600 options understood by the compiler that fit into all specified classes
1601 and qualifiers. These are the supported classes:
1602
1603 @table @asis
1604 @item @samp{optimizers}
1605 Display all of the optimization options supported by the
1606 compiler.
1607
1608 @item @samp{warnings}
1609 Display all of the options controlling warning messages
1610 produced by the compiler.
1611
1612 @item @samp{target}
1613 Display target-specific options. Unlike the
1614 @option{--target-help} option however, target-specific options of the
1615 linker and assembler are not displayed. This is because those
1616 tools do not currently support the extended @option{--help=} syntax.
1617
1618 @item @samp{params}
1619 Display the values recognized by the @option{--param}
1620 option.
1621
1622 @item @var{language}
1623 Display the options supported for @var{language}, where
1624 @var{language} is the name of one of the languages supported in this
1625 version of GCC@.
1626
1627 @item @samp{common}
1628 Display the options that are common to all languages.
1629 @end table
1630
1631 These are the supported qualifiers:
1632
1633 @table @asis
1634 @item @samp{undocumented}
1635 Display only those options that are undocumented.
1636
1637 @item @samp{joined}
1638 Display options taking an argument that appears after an equal
1639 sign in the same continuous piece of text, such as:
1640 @samp{--help=target}.
1641
1642 @item @samp{separate}
1643 Display options taking an argument that appears as a separate word
1644 following the original option, such as: @samp{-o output-file}.
1645 @end table
1646
1647 Thus for example to display all the undocumented target-specific
1648 switches supported by the compiler, use:
1649
1650 @smallexample
1651 --help=target,undocumented
1652 @end smallexample
1653
1654 The sense of a qualifier can be inverted by prefixing it with the
1655 @samp{^} character, so for example to display all binary warning
1656 options (i.e., ones that are either on or off and that do not take an
1657 argument) that have a description, use:
1658
1659 @smallexample
1660 --help=warnings,^joined,^undocumented
1661 @end smallexample
1662
1663 The argument to @option{--help=} should not consist solely of inverted
1664 qualifiers.
1665
1666 Combining several classes is possible, although this usually
1667 restricts the output so much that there is nothing to display. One
1668 case where it does work, however, is when one of the classes is
1669 @var{target}. For example, to display all the target-specific
1670 optimization options, use:
1671
1672 @smallexample
1673 --help=target,optimizers
1674 @end smallexample
1675
1676 The @option{--help=} option can be repeated on the command line. Each
1677 successive use displays its requested class of options, skipping
1678 those that have already been displayed.
1679
1680 If the @option{-Q} option appears on the command line before the
1681 @option{--help=} option, then the descriptive text displayed by
1682 @option{--help=} is changed. Instead of describing the displayed
1683 options, an indication is given as to whether the option is enabled,
1684 disabled or set to a specific value (assuming that the compiler
1685 knows this at the point where the @option{--help=} option is used).
1686
1687 Here is a truncated example from the ARM port of @command{gcc}:
1688
1689 @smallexample
1690 % gcc -Q -mabi=2 --help=target -c
1691 The following options are target specific:
1692 -mabi= 2
1693 -mabort-on-noreturn [disabled]
1694 -mapcs [disabled]
1695 @end smallexample
1696
1697 The output is sensitive to the effects of previous command-line
1698 options, so for example it is possible to find out which optimizations
1699 are enabled at @option{-O2} by using:
1700
1701 @smallexample
1702 -Q -O2 --help=optimizers
1703 @end smallexample
1704
1705 Alternatively you can discover which binary optimizations are enabled
1706 by @option{-O3} by using:
1707
1708 @smallexample
1709 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1710 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1711 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1712 @end smallexample
1713
1714 @item --version
1715 @opindex version
1716 Display the version number and copyrights of the invoked GCC@.
1717
1718 @item -pass-exit-codes
1719 @opindex pass-exit-codes
1720 Normally the @command{gcc} program exits with the code of 1 if any
1721 phase of the compiler returns a non-success return code. If you specify
1722 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1723 the numerically highest error produced by any phase returning an error
1724 indication. The C, C++, and Fortran front ends return 4 if an internal
1725 compiler error is encountered.
1726
1727 @item -pipe
1728 @opindex pipe
1729 Use pipes rather than temporary files for communication between the
1730 various stages of compilation. This fails to work on some systems where
1731 the assembler is unable to read from a pipe; but the GNU assembler has
1732 no trouble.
1733
1734 @item -specs=@var{file}
1735 @opindex specs
1736 Process @var{file} after the compiler reads in the standard @file{specs}
1737 file, in order to override the defaults which the @command{gcc} driver
1738 program uses when determining what switches to pass to @command{cc1},
1739 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1740 @option{-specs=@var{file}} can be specified on the command line, and they
1741 are processed in order, from left to right. @xref{Spec Files}, for
1742 information about the format of the @var{file}.
1743
1744 @item -wrapper
1745 @opindex wrapper
1746 Invoke all subcommands under a wrapper program. The name of the
1747 wrapper program and its parameters are passed as a comma separated
1748 list.
1749
1750 @smallexample
1751 gcc -c t.c -wrapper gdb,--args
1752 @end smallexample
1753
1754 @noindent
1755 This invokes all subprograms of @command{gcc} under
1756 @samp{gdb --args}, thus the invocation of @command{cc1} is
1757 @samp{gdb --args cc1 @dots{}}.
1758
1759 @item -ffile-prefix-map=@var{old}=@var{new}
1760 @opindex ffile-prefix-map
1761 When compiling files residing in directory @file{@var{old}}, record
1762 any references to them in the result of the compilation as if the
1763 files resided in directory @file{@var{new}} instead. Specifying this
1764 option is equivalent to specifying all the individual
1765 @option{-f*-prefix-map} options. This can be used to make reproducible
1766 builds that are location independent. See also
1767 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1768
1769 @item -fplugin=@var{name}.so
1770 @opindex fplugin
1771 Load the plugin code in file @var{name}.so, assumed to be a
1772 shared object to be dlopen'd by the compiler. The base name of
1773 the shared object file is used to identify the plugin for the
1774 purposes of argument parsing (See
1775 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1776 Each plugin should define the callback functions specified in the
1777 Plugins API.
1778
1779 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1780 @opindex fplugin-arg
1781 Define an argument called @var{key} with a value of @var{value}
1782 for the plugin called @var{name}.
1783
1784 @item -fdump-ada-spec@r{[}-slim@r{]}
1785 @opindex fdump-ada-spec
1786 For C and C++ source and include files, generate corresponding Ada specs.
1787 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1788 GNAT User's Guide}, which provides detailed documentation on this feature.
1789
1790 @item -fada-spec-parent=@var{unit}
1791 @opindex fada-spec-parent
1792 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1793 Ada specs as child units of parent @var{unit}.
1794
1795 @item -fdump-go-spec=@var{file}
1796 @opindex fdump-go-spec
1797 For input files in any language, generate corresponding Go
1798 declarations in @var{file}. This generates Go @code{const},
1799 @code{type}, @code{var}, and @code{func} declarations which may be a
1800 useful way to start writing a Go interface to code written in some
1801 other language.
1802
1803 @include @value{srcdir}/../libiberty/at-file.texi
1804 @end table
1805
1806 @node Invoking G++
1807 @section Compiling C++ Programs
1808
1809 @cindex suffixes for C++ source
1810 @cindex C++ source file suffixes
1811 C++ source files conventionally use one of the suffixes @samp{.C},
1812 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1813 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1814 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1815 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1816 files with these names and compiles them as C++ programs even if you
1817 call the compiler the same way as for compiling C programs (usually
1818 with the name @command{gcc}).
1819
1820 @findex g++
1821 @findex c++
1822 However, the use of @command{gcc} does not add the C++ library.
1823 @command{g++} is a program that calls GCC and automatically specifies linking
1824 against the C++ library. It treats @samp{.c},
1825 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1826 files unless @option{-x} is used. This program is also useful when
1827 precompiling a C header file with a @samp{.h} extension for use in C++
1828 compilations. On many systems, @command{g++} is also installed with
1829 the name @command{c++}.
1830
1831 @cindex invoking @command{g++}
1832 When you compile C++ programs, you may specify many of the same
1833 command-line options that you use for compiling programs in any
1834 language; or command-line options meaningful for C and related
1835 languages; or options that are meaningful only for C++ programs.
1836 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1837 explanations of options for languages related to C@.
1838 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1839 explanations of options that are meaningful only for C++ programs.
1840
1841 @node C Dialect Options
1842 @section Options Controlling C Dialect
1843 @cindex dialect options
1844 @cindex language dialect options
1845 @cindex options, dialect
1846
1847 The following options control the dialect of C (or languages derived
1848 from C, such as C++, Objective-C and Objective-C++) that the compiler
1849 accepts:
1850
1851 @table @gcctabopt
1852 @cindex ANSI support
1853 @cindex ISO support
1854 @item -ansi
1855 @opindex ansi
1856 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1857 equivalent to @option{-std=c++98}.
1858
1859 This turns off certain features of GCC that are incompatible with ISO
1860 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1861 such as the @code{asm} and @code{typeof} keywords, and
1862 predefined macros such as @code{unix} and @code{vax} that identify the
1863 type of system you are using. It also enables the undesirable and
1864 rarely used ISO trigraph feature. For the C compiler,
1865 it disables recognition of C++ style @samp{//} comments as well as
1866 the @code{inline} keyword.
1867
1868 The alternate keywords @code{__asm__}, @code{__extension__},
1869 @code{__inline__} and @code{__typeof__} continue to work despite
1870 @option{-ansi}. You would not want to use them in an ISO C program, of
1871 course, but it is useful to put them in header files that might be included
1872 in compilations done with @option{-ansi}. Alternate predefined macros
1873 such as @code{__unix__} and @code{__vax__} are also available, with or
1874 without @option{-ansi}.
1875
1876 The @option{-ansi} option does not cause non-ISO programs to be
1877 rejected gratuitously. For that, @option{-Wpedantic} is required in
1878 addition to @option{-ansi}. @xref{Warning Options}.
1879
1880 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1881 option is used. Some header files may notice this macro and refrain
1882 from declaring certain functions or defining certain macros that the
1883 ISO standard doesn't call for; this is to avoid interfering with any
1884 programs that might use these names for other things.
1885
1886 Functions that are normally built in but do not have semantics
1887 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1888 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1889 built-in functions provided by GCC}, for details of the functions
1890 affected.
1891
1892 @item -std=
1893 @opindex std
1894 Determine the language standard. @xref{Standards,,Language Standards
1895 Supported by GCC}, for details of these standard versions. This option
1896 is currently only supported when compiling C or C++.
1897
1898 The compiler can accept several base standards, such as @samp{c90} or
1899 @samp{c++98}, and GNU dialects of those standards, such as
1900 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1901 compiler accepts all programs following that standard plus those
1902 using GNU extensions that do not contradict it. For example,
1903 @option{-std=c90} turns off certain features of GCC that are
1904 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1905 keywords, but not other GNU extensions that do not have a meaning in
1906 ISO C90, such as omitting the middle term of a @code{?:}
1907 expression. On the other hand, when a GNU dialect of a standard is
1908 specified, all features supported by the compiler are enabled, even when
1909 those features change the meaning of the base standard. As a result, some
1910 strict-conforming programs may be rejected. The particular standard
1911 is used by @option{-Wpedantic} to identify which features are GNU
1912 extensions given that version of the standard. For example
1913 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1914 comments, while @option{-std=gnu99 -Wpedantic} does not.
1915
1916 A value for this option must be provided; possible values are
1917
1918 @table @samp
1919 @item c90
1920 @itemx c89
1921 @itemx iso9899:1990
1922 Support all ISO C90 programs (certain GNU extensions that conflict
1923 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1924
1925 @item iso9899:199409
1926 ISO C90 as modified in amendment 1.
1927
1928 @item c99
1929 @itemx c9x
1930 @itemx iso9899:1999
1931 @itemx iso9899:199x
1932 ISO C99. This standard is substantially completely supported, modulo
1933 bugs and floating-point issues
1934 (mainly but not entirely relating to optional C99 features from
1935 Annexes F and G). See
1936 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1937 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1938
1939 @item c11
1940 @itemx c1x
1941 @itemx iso9899:2011
1942 ISO C11, the 2011 revision of the ISO C standard. This standard is
1943 substantially completely supported, modulo bugs, floating-point issues
1944 (mainly but not entirely relating to optional C11 features from
1945 Annexes F and G) and the optional Annexes K (Bounds-checking
1946 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1947
1948 @item c17
1949 @itemx c18
1950 @itemx iso9899:2017
1951 @itemx iso9899:2018
1952 ISO C17, the 2017 revision of the ISO C standard
1953 (published in 2018). This standard is
1954 same as C11 except for corrections of defects (all of which are also
1955 applied with @option{-std=c11}) and a new value of
1956 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1957
1958 @item c2x
1959 The next version of the ISO C standard, still under development. The
1960 support for this version is experimental and incomplete.
1961
1962 @item gnu90
1963 @itemx gnu89
1964 GNU dialect of ISO C90 (including some C99 features).
1965
1966 @item gnu99
1967 @itemx gnu9x
1968 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1969
1970 @item gnu11
1971 @itemx gnu1x
1972 GNU dialect of ISO C11.
1973 The name @samp{gnu1x} is deprecated.
1974
1975 @item gnu17
1976 @itemx gnu18
1977 GNU dialect of ISO C17. This is the default for C code.
1978
1979 @item gnu2x
1980 The next version of the ISO C standard, still under development, plus
1981 GNU extensions. The support for this version is experimental and
1982 incomplete.
1983
1984 @item c++98
1985 @itemx c++03
1986 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1987 additional defect reports. Same as @option{-ansi} for C++ code.
1988
1989 @item gnu++98
1990 @itemx gnu++03
1991 GNU dialect of @option{-std=c++98}.
1992
1993 @item c++11
1994 @itemx c++0x
1995 The 2011 ISO C++ standard plus amendments.
1996 The name @samp{c++0x} is deprecated.
1997
1998 @item gnu++11
1999 @itemx gnu++0x
2000 GNU dialect of @option{-std=c++11}.
2001 The name @samp{gnu++0x} is deprecated.
2002
2003 @item c++14
2004 @itemx c++1y
2005 The 2014 ISO C++ standard plus amendments.
2006 The name @samp{c++1y} is deprecated.
2007
2008 @item gnu++14
2009 @itemx gnu++1y
2010 GNU dialect of @option{-std=c++14}.
2011 This is the default for C++ code.
2012 The name @samp{gnu++1y} is deprecated.
2013
2014 @item c++17
2015 @itemx c++1z
2016 The 2017 ISO C++ standard plus amendments.
2017 The name @samp{c++1z} is deprecated.
2018
2019 @item gnu++17
2020 @itemx gnu++1z
2021 GNU dialect of @option{-std=c++17}.
2022 The name @samp{gnu++1z} is deprecated.
2023
2024 @item c++2a
2025 The next revision of the ISO C++ standard, tentatively planned for
2026 2020. Support is highly experimental, and will almost certainly
2027 change in incompatible ways in future releases.
2028
2029 @item gnu++2a
2030 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2031 and will almost certainly change in incompatible ways in future
2032 releases.
2033 @end table
2034
2035 @item -fgnu89-inline
2036 @opindex fgnu89-inline
2037 The option @option{-fgnu89-inline} tells GCC to use the traditional
2038 GNU semantics for @code{inline} functions when in C99 mode.
2039 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2040 Using this option is roughly equivalent to adding the
2041 @code{gnu_inline} function attribute to all inline functions
2042 (@pxref{Function Attributes}).
2043
2044 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2045 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2046 specifies the default behavior).
2047 This option is not supported in @option{-std=c90} or
2048 @option{-std=gnu90} mode.
2049
2050 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2051 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2052 in effect for @code{inline} functions. @xref{Common Predefined
2053 Macros,,,cpp,The C Preprocessor}.
2054
2055 @item -fpermitted-flt-eval-methods=@var{style}
2056 @opindex fpermitted-flt-eval-methods
2057 @opindex fpermitted-flt-eval-methods=c11
2058 @opindex fpermitted-flt-eval-methods=ts-18661-3
2059 ISO/IEC TS 18661-3 defines new permissible values for
2060 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2061 a semantic type that is an interchange or extended format should be
2062 evaluated to the precision and range of that type. These new values are
2063 a superset of those permitted under C99/C11, which does not specify the
2064 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2065 conforming to C11 may not have been written expecting the possibility of
2066 the new values.
2067
2068 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2069 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2070 or the extended set of values specified in ISO/IEC TS 18661-3.
2071
2072 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2073
2074 The default when in a standards compliant mode (@option{-std=c11} or similar)
2075 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2076 dialect (@option{-std=gnu11} or similar) is
2077 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2078
2079 @item -aux-info @var{filename}
2080 @opindex aux-info
2081 Output to the given filename prototyped declarations for all functions
2082 declared and/or defined in a translation unit, including those in header
2083 files. This option is silently ignored in any language other than C@.
2084
2085 Besides declarations, the file indicates, in comments, the origin of
2086 each declaration (source file and line), whether the declaration was
2087 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2088 @samp{O} for old, respectively, in the first character after the line
2089 number and the colon), and whether it came from a declaration or a
2090 definition (@samp{C} or @samp{F}, respectively, in the following
2091 character). In the case of function definitions, a K&R-style list of
2092 arguments followed by their declarations is also provided, inside
2093 comments, after the declaration.
2094
2095 @item -fallow-parameterless-variadic-functions
2096 @opindex fallow-parameterless-variadic-functions
2097 Accept variadic functions without named parameters.
2098
2099 Although it is possible to define such a function, this is not very
2100 useful as it is not possible to read the arguments. This is only
2101 supported for C as this construct is allowed by C++.
2102
2103 @item -fno-asm
2104 @opindex fno-asm
2105 @opindex fasm
2106 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2107 keyword, so that code can use these words as identifiers. You can use
2108 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2109 instead. @option{-ansi} implies @option{-fno-asm}.
2110
2111 In C++, this switch only affects the @code{typeof} keyword, since
2112 @code{asm} and @code{inline} are standard keywords. You may want to
2113 use the @option{-fno-gnu-keywords} flag instead, which has the same
2114 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2115 switch only affects the @code{asm} and @code{typeof} keywords, since
2116 @code{inline} is a standard keyword in ISO C99.
2117
2118 @item -fno-builtin
2119 @itemx -fno-builtin-@var{function}
2120 @opindex fno-builtin
2121 @opindex fbuiltin
2122 @cindex built-in functions
2123 Don't recognize built-in functions that do not begin with
2124 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2125 functions provided by GCC}, for details of the functions affected,
2126 including those which are not built-in functions when @option{-ansi} or
2127 @option{-std} options for strict ISO C conformance are used because they
2128 do not have an ISO standard meaning.
2129
2130 GCC normally generates special code to handle certain built-in functions
2131 more efficiently; for instance, calls to @code{alloca} may become single
2132 instructions which adjust the stack directly, and calls to @code{memcpy}
2133 may become inline copy loops. The resulting code is often both smaller
2134 and faster, but since the function calls no longer appear as such, you
2135 cannot set a breakpoint on those calls, nor can you change the behavior
2136 of the functions by linking with a different library. In addition,
2137 when a function is recognized as a built-in function, GCC may use
2138 information about that function to warn about problems with calls to
2139 that function, or to generate more efficient code, even if the
2140 resulting code still contains calls to that function. For example,
2141 warnings are given with @option{-Wformat} for bad calls to
2142 @code{printf} when @code{printf} is built in and @code{strlen} is
2143 known not to modify global memory.
2144
2145 With the @option{-fno-builtin-@var{function}} option
2146 only the built-in function @var{function} is
2147 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2148 function is named that is not built-in in this version of GCC, this
2149 option is ignored. There is no corresponding
2150 @option{-fbuiltin-@var{function}} option; if you wish to enable
2151 built-in functions selectively when using @option{-fno-builtin} or
2152 @option{-ffreestanding}, you may define macros such as:
2153
2154 @smallexample
2155 #define abs(n) __builtin_abs ((n))
2156 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2157 @end smallexample
2158
2159 @item -fgimple
2160 @opindex fgimple
2161
2162 Enable parsing of function definitions marked with @code{__GIMPLE}.
2163 This is an experimental feature that allows unit testing of GIMPLE
2164 passes.
2165
2166 @item -fhosted
2167 @opindex fhosted
2168 @cindex hosted environment
2169
2170 Assert that compilation targets a hosted environment. This implies
2171 @option{-fbuiltin}. A hosted environment is one in which the
2172 entire standard library is available, and in which @code{main} has a return
2173 type of @code{int}. Examples are nearly everything except a kernel.
2174 This is equivalent to @option{-fno-freestanding}.
2175
2176 @item -ffreestanding
2177 @opindex ffreestanding
2178 @cindex hosted environment
2179
2180 Assert that compilation targets a freestanding environment. This
2181 implies @option{-fno-builtin}. A freestanding environment
2182 is one in which the standard library may not exist, and program startup may
2183 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2184 This is equivalent to @option{-fno-hosted}.
2185
2186 @xref{Standards,,Language Standards Supported by GCC}, for details of
2187 freestanding and hosted environments.
2188
2189 @item -fopenacc
2190 @opindex fopenacc
2191 @cindex OpenACC accelerator programming
2192 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2193 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2194 compiler generates accelerated code according to the OpenACC Application
2195 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2196 implies @option{-pthread}, and thus is only supported on targets that
2197 have support for @option{-pthread}.
2198
2199 @item -fopenacc-dim=@var{geom}
2200 @opindex fopenacc-dim
2201 @cindex OpenACC accelerator programming
2202 Specify default compute dimensions for parallel offload regions that do
2203 not explicitly specify. The @var{geom} value is a triple of
2204 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2205 can be omitted, to use a target-specific default value.
2206
2207 @item -fopenmp
2208 @opindex fopenmp
2209 @cindex OpenMP parallel
2210 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2211 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2212 compiler generates parallel code according to the OpenMP Application
2213 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2214 implies @option{-pthread}, and thus is only supported on targets that
2215 have support for @option{-pthread}. @option{-fopenmp} implies
2216 @option{-fopenmp-simd}.
2217
2218 @item -fopenmp-simd
2219 @opindex fopenmp-simd
2220 @cindex OpenMP SIMD
2221 @cindex SIMD
2222 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2223 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2224 are ignored.
2225
2226 @item -fgnu-tm
2227 @opindex fgnu-tm
2228 When the option @option{-fgnu-tm} is specified, the compiler
2229 generates code for the Linux variant of Intel's current Transactional
2230 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2231 an experimental feature whose interface may change in future versions
2232 of GCC, as the official specification changes. Please note that not
2233 all architectures are supported for this feature.
2234
2235 For more information on GCC's support for transactional memory,
2236 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2237 Transactional Memory Library}.
2238
2239 Note that the transactional memory feature is not supported with
2240 non-call exceptions (@option{-fnon-call-exceptions}).
2241
2242 @item -fms-extensions
2243 @opindex fms-extensions
2244 Accept some non-standard constructs used in Microsoft header files.
2245
2246 In C++ code, this allows member names in structures to be similar
2247 to previous types declarations.
2248
2249 @smallexample
2250 typedef int UOW;
2251 struct ABC @{
2252 UOW UOW;
2253 @};
2254 @end smallexample
2255
2256 Some cases of unnamed fields in structures and unions are only
2257 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2258 fields within structs/unions}, for details.
2259
2260 Note that this option is off for all targets but x86
2261 targets using ms-abi.
2262
2263 @item -fplan9-extensions
2264 @opindex fplan9-extensions
2265 Accept some non-standard constructs used in Plan 9 code.
2266
2267 This enables @option{-fms-extensions}, permits passing pointers to
2268 structures with anonymous fields to functions that expect pointers to
2269 elements of the type of the field, and permits referring to anonymous
2270 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2271 struct/union fields within structs/unions}, for details. This is only
2272 supported for C, not C++.
2273
2274 @item -fcond-mismatch
2275 @opindex fcond-mismatch
2276 Allow conditional expressions with mismatched types in the second and
2277 third arguments. The value of such an expression is void. This option
2278 is not supported for C++.
2279
2280 @item -flax-vector-conversions
2281 @opindex flax-vector-conversions
2282 Allow implicit conversions between vectors with differing numbers of
2283 elements and/or incompatible element types. This option should not be
2284 used for new code.
2285
2286 @item -funsigned-char
2287 @opindex funsigned-char
2288 Let the type @code{char} be unsigned, like @code{unsigned char}.
2289
2290 Each kind of machine has a default for what @code{char} should
2291 be. It is either like @code{unsigned char} by default or like
2292 @code{signed char} by default.
2293
2294 Ideally, a portable program should always use @code{signed char} or
2295 @code{unsigned char} when it depends on the signedness of an object.
2296 But many programs have been written to use plain @code{char} and
2297 expect it to be signed, or expect it to be unsigned, depending on the
2298 machines they were written for. This option, and its inverse, let you
2299 make such a program work with the opposite default.
2300
2301 The type @code{char} is always a distinct type from each of
2302 @code{signed char} or @code{unsigned char}, even though its behavior
2303 is always just like one of those two.
2304
2305 @item -fsigned-char
2306 @opindex fsigned-char
2307 Let the type @code{char} be signed, like @code{signed char}.
2308
2309 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2310 the negative form of @option{-funsigned-char}. Likewise, the option
2311 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2312
2313 @item -fsigned-bitfields
2314 @itemx -funsigned-bitfields
2315 @itemx -fno-signed-bitfields
2316 @itemx -fno-unsigned-bitfields
2317 @opindex fsigned-bitfields
2318 @opindex funsigned-bitfields
2319 @opindex fno-signed-bitfields
2320 @opindex fno-unsigned-bitfields
2321 These options control whether a bit-field is signed or unsigned, when the
2322 declaration does not use either @code{signed} or @code{unsigned}. By
2323 default, such a bit-field is signed, because this is consistent: the
2324 basic integer types such as @code{int} are signed types.
2325
2326 @item -fsso-struct=@var{endianness}
2327 @opindex fsso-struct
2328 Set the default scalar storage order of structures and unions to the
2329 specified endianness. The accepted values are @samp{big-endian},
2330 @samp{little-endian} and @samp{native} for the native endianness of
2331 the target (the default). This option is not supported for C++.
2332
2333 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2334 code that is not binary compatible with code generated without it if the
2335 specified endianness is not the native endianness of the target.
2336 @end table
2337
2338 @node C++ Dialect Options
2339 @section Options Controlling C++ Dialect
2340
2341 @cindex compiler options, C++
2342 @cindex C++ options, command-line
2343 @cindex options, C++
2344 This section describes the command-line options that are only meaningful
2345 for C++ programs. You can also use most of the GNU compiler options
2346 regardless of what language your program is in. For example, you
2347 might compile a file @file{firstClass.C} like this:
2348
2349 @smallexample
2350 g++ -g -fstrict-enums -O -c firstClass.C
2351 @end smallexample
2352
2353 @noindent
2354 In this example, only @option{-fstrict-enums} is an option meant
2355 only for C++ programs; you can use the other options with any
2356 language supported by GCC@.
2357
2358 Some options for compiling C programs, such as @option{-std}, are also
2359 relevant for C++ programs.
2360 @xref{C Dialect Options,,Options Controlling C Dialect}.
2361
2362 Here is a list of options that are @emph{only} for compiling C++ programs:
2363
2364 @table @gcctabopt
2365
2366 @item -fabi-version=@var{n}
2367 @opindex fabi-version
2368 Use version @var{n} of the C++ ABI@. The default is version 0.
2369
2370 Version 0 refers to the version conforming most closely to
2371 the C++ ABI specification. Therefore, the ABI obtained using version 0
2372 will change in different versions of G++ as ABI bugs are fixed.
2373
2374 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2375
2376 Version 2 is the version of the C++ ABI that first appeared in G++
2377 3.4, and was the default through G++ 4.9.
2378
2379 Version 3 corrects an error in mangling a constant address as a
2380 template argument.
2381
2382 Version 4, which first appeared in G++ 4.5, implements a standard
2383 mangling for vector types.
2384
2385 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2386 attribute const/volatile on function pointer types, decltype of a
2387 plain decl, and use of a function parameter in the declaration of
2388 another parameter.
2389
2390 Version 6, which first appeared in G++ 4.7, corrects the promotion
2391 behavior of C++11 scoped enums and the mangling of template argument
2392 packs, const/static_cast, prefix ++ and --, and a class scope function
2393 used as a template argument.
2394
2395 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2396 builtin type and corrects the mangling of lambdas in default argument
2397 scope.
2398
2399 Version 8, which first appeared in G++ 4.9, corrects the substitution
2400 behavior of function types with function-cv-qualifiers.
2401
2402 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2403 @code{nullptr_t}.
2404
2405 Version 10, which first appeared in G++ 6.1, adds mangling of
2406 attributes that affect type identity, such as ia32 calling convention
2407 attributes (e.g.@: @samp{stdcall}).
2408
2409 Version 11, which first appeared in G++ 7, corrects the mangling of
2410 sizeof... expressions and operator names. For multiple entities with
2411 the same name within a function, that are declared in different scopes,
2412 the mangling now changes starting with the twelfth occurrence. It also
2413 implies @option{-fnew-inheriting-ctors}.
2414
2415 Version 12, which first appeared in G++ 8, corrects the calling
2416 conventions for empty classes on the x86_64 target and for classes
2417 with only deleted copy/move constructors. It accidentally changes the
2418 calling convention for classes with a deleted copy constructor and a
2419 trivial move constructor.
2420
2421 Version 13, which first appeared in G++ 8.2, fixes the accidental
2422 change in version 12.
2423
2424 See also @option{-Wabi}.
2425
2426 @item -fabi-compat-version=@var{n}
2427 @opindex fabi-compat-version
2428 On targets that support strong aliases, G++
2429 works around mangling changes by creating an alias with the correct
2430 mangled name when defining a symbol with an incorrect mangled name.
2431 This switch specifies which ABI version to use for the alias.
2432
2433 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2434 compatibility). If another ABI version is explicitly selected, this
2435 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2436 use @option{-fabi-compat-version=2}.
2437
2438 If this option is not provided but @option{-Wabi=@var{n}} is, that
2439 version is used for compatibility aliases. If this option is provided
2440 along with @option{-Wabi} (without the version), the version from this
2441 option is used for the warning.
2442
2443 @item -fno-access-control
2444 @opindex fno-access-control
2445 @opindex faccess-control
2446 Turn off all access checking. This switch is mainly useful for working
2447 around bugs in the access control code.
2448
2449 @item -faligned-new
2450 @opindex faligned-new
2451 Enable support for C++17 @code{new} of types that require more
2452 alignment than @code{void* ::operator new(std::size_t)} provides. A
2453 numeric argument such as @code{-faligned-new=32} can be used to
2454 specify how much alignment (in bytes) is provided by that function,
2455 but few users will need to override the default of
2456 @code{alignof(std::max_align_t)}.
2457
2458 This flag is enabled by default for @option{-std=c++17}.
2459
2460 @item -fcheck-new
2461 @opindex fcheck-new
2462 Check that the pointer returned by @code{operator new} is non-null
2463 before attempting to modify the storage allocated. This check is
2464 normally unnecessary because the C++ standard specifies that
2465 @code{operator new} only returns @code{0} if it is declared
2466 @code{throw()}, in which case the compiler always checks the
2467 return value even without this option. In all other cases, when
2468 @code{operator new} has a non-empty exception specification, memory
2469 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2470 @samp{new (nothrow)}.
2471
2472 @item -fconcepts
2473 @opindex fconcepts
2474 Enable support for the C++ Extensions for Concepts Technical
2475 Specification, ISO 19217 (2015), which allows code like
2476
2477 @smallexample
2478 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2479 template <Addable T> T add (T a, T b) @{ return a + b; @}
2480 @end smallexample
2481
2482 @item -fconstexpr-depth=@var{n}
2483 @opindex fconstexpr-depth
2484 Set the maximum nested evaluation depth for C++11 constexpr functions
2485 to @var{n}. A limit is needed to detect endless recursion during
2486 constant expression evaluation. The minimum specified by the standard
2487 is 512.
2488
2489 @item -fconstexpr-loop-limit=@var{n}
2490 @opindex fconstexpr-loop-limit
2491 Set the maximum number of iterations for a loop in C++14 constexpr functions
2492 to @var{n}. A limit is needed to detect infinite loops during
2493 constant expression evaluation. The default is 262144 (1<<18).
2494
2495 @item -fdeduce-init-list
2496 @opindex fdeduce-init-list
2497 Enable deduction of a template type parameter as
2498 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2499
2500 @smallexample
2501 template <class T> auto forward(T t) -> decltype (realfn (t))
2502 @{
2503 return realfn (t);
2504 @}
2505
2506 void f()
2507 @{
2508 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2509 @}
2510 @end smallexample
2511
2512 This deduction was implemented as a possible extension to the
2513 originally proposed semantics for the C++11 standard, but was not part
2514 of the final standard, so it is disabled by default. This option is
2515 deprecated, and may be removed in a future version of G++.
2516
2517 @item -fno-elide-constructors
2518 @opindex fno-elide-constructors
2519 @opindex felide-constructors
2520 The C++ standard allows an implementation to omit creating a temporary
2521 that is only used to initialize another object of the same type.
2522 Specifying this option disables that optimization, and forces G++ to
2523 call the copy constructor in all cases. This option also causes G++
2524 to call trivial member functions which otherwise would be expanded inline.
2525
2526 In C++17, the compiler is required to omit these temporaries, but this
2527 option still affects trivial member functions.
2528
2529 @item -fno-enforce-eh-specs
2530 @opindex fno-enforce-eh-specs
2531 @opindex fenforce-eh-specs
2532 Don't generate code to check for violation of exception specifications
2533 at run time. This option violates the C++ standard, but may be useful
2534 for reducing code size in production builds, much like defining
2535 @code{NDEBUG}. This does not give user code permission to throw
2536 exceptions in violation of the exception specifications; the compiler
2537 still optimizes based on the specifications, so throwing an
2538 unexpected exception results in undefined behavior at run time.
2539
2540 @item -fextern-tls-init
2541 @itemx -fno-extern-tls-init
2542 @opindex fextern-tls-init
2543 @opindex fno-extern-tls-init
2544 The C++11 and OpenMP standards allow @code{thread_local} and
2545 @code{threadprivate} variables to have dynamic (runtime)
2546 initialization. To support this, any use of such a variable goes
2547 through a wrapper function that performs any necessary initialization.
2548 When the use and definition of the variable are in the same
2549 translation unit, this overhead can be optimized away, but when the
2550 use is in a different translation unit there is significant overhead
2551 even if the variable doesn't actually need dynamic initialization. If
2552 the programmer can be sure that no use of the variable in a
2553 non-defining TU needs to trigger dynamic initialization (either
2554 because the variable is statically initialized, or a use of the
2555 variable in the defining TU will be executed before any uses in
2556 another TU), they can avoid this overhead with the
2557 @option{-fno-extern-tls-init} option.
2558
2559 On targets that support symbol aliases, the default is
2560 @option{-fextern-tls-init}. On targets that do not support symbol
2561 aliases, the default is @option{-fno-extern-tls-init}.
2562
2563 @item -fno-gnu-keywords
2564 @opindex fno-gnu-keywords
2565 @opindex fgnu-keywords
2566 Do not recognize @code{typeof} as a keyword, so that code can use this
2567 word as an identifier. You can use the keyword @code{__typeof__} instead.
2568 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2569 @option{-std=c++98}, @option{-std=c++11}, etc.
2570
2571 @item -fno-implicit-templates
2572 @opindex fno-implicit-templates
2573 @opindex fimplicit-templates
2574 Never emit code for non-inline templates that are instantiated
2575 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2576 @xref{Template Instantiation}, for more information.
2577
2578 @item -fno-implicit-inline-templates
2579 @opindex fno-implicit-inline-templates
2580 @opindex fimplicit-inline-templates
2581 Don't emit code for implicit instantiations of inline templates, either.
2582 The default is to handle inlines differently so that compiles with and
2583 without optimization need the same set of explicit instantiations.
2584
2585 @item -fno-implement-inlines
2586 @opindex fno-implement-inlines
2587 @opindex fimplement-inlines
2588 To save space, do not emit out-of-line copies of inline functions
2589 controlled by @code{#pragma implementation}. This causes linker
2590 errors if these functions are not inlined everywhere they are called.
2591
2592 @item -fms-extensions
2593 @opindex fms-extensions
2594 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2595 int and getting a pointer to member function via non-standard syntax.
2596
2597 @item -fnew-inheriting-ctors
2598 @opindex fnew-inheriting-ctors
2599 Enable the P0136 adjustment to the semantics of C++11 constructor
2600 inheritance. This is part of C++17 but also considered to be a Defect
2601 Report against C++11 and C++14. This flag is enabled by default
2602 unless @option{-fabi-version=10} or lower is specified.
2603
2604 @item -fnew-ttp-matching
2605 @opindex fnew-ttp-matching
2606 Enable the P0522 resolution to Core issue 150, template template
2607 parameters and default arguments: this allows a template with default
2608 template arguments as an argument for a template template parameter
2609 with fewer template parameters. This flag is enabled by default for
2610 @option{-std=c++17}.
2611
2612 @item -fno-nonansi-builtins
2613 @opindex fno-nonansi-builtins
2614 @opindex fnonansi-builtins
2615 Disable built-in declarations of functions that are not mandated by
2616 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2617 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2618
2619 @item -fnothrow-opt
2620 @opindex fnothrow-opt
2621 Treat a @code{throw()} exception specification as if it were a
2622 @code{noexcept} specification to reduce or eliminate the text size
2623 overhead relative to a function with no exception specification. If
2624 the function has local variables of types with non-trivial
2625 destructors, the exception specification actually makes the
2626 function smaller because the EH cleanups for those variables can be
2627 optimized away. The semantic effect is that an exception thrown out of
2628 a function with such an exception specification results in a call
2629 to @code{terminate} rather than @code{unexpected}.
2630
2631 @item -fno-operator-names
2632 @opindex fno-operator-names
2633 @opindex foperator-names
2634 Do not treat the operator name keywords @code{and}, @code{bitand},
2635 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2636 synonyms as keywords.
2637
2638 @item -fno-optional-diags
2639 @opindex fno-optional-diags
2640 @opindex foptional-diags
2641 Disable diagnostics that the standard says a compiler does not need to
2642 issue. Currently, the only such diagnostic issued by G++ is the one for
2643 a name having multiple meanings within a class.
2644
2645 @item -fpermissive
2646 @opindex fpermissive
2647 Downgrade some diagnostics about nonconformant code from errors to
2648 warnings. Thus, using @option{-fpermissive} allows some
2649 nonconforming code to compile.
2650
2651 @item -fno-pretty-templates
2652 @opindex fno-pretty-templates
2653 @opindex fpretty-templates
2654 When an error message refers to a specialization of a function
2655 template, the compiler normally prints the signature of the
2656 template followed by the template arguments and any typedefs or
2657 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2658 rather than @code{void f(int)}) so that it's clear which template is
2659 involved. When an error message refers to a specialization of a class
2660 template, the compiler omits any template arguments that match
2661 the default template arguments for that template. If either of these
2662 behaviors make it harder to understand the error message rather than
2663 easier, you can use @option{-fno-pretty-templates} to disable them.
2664
2665 @item -frepo
2666 @opindex frepo
2667 Enable automatic template instantiation at link time. This option also
2668 implies @option{-fno-implicit-templates}. @xref{Template
2669 Instantiation}, for more information.
2670
2671 @item -fno-rtti
2672 @opindex fno-rtti
2673 @opindex frtti
2674 Disable generation of information about every class with virtual
2675 functions for use by the C++ run-time type identification features
2676 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2677 of the language, you can save some space by using this flag. Note that
2678 exception handling uses the same information, but G++ generates it as
2679 needed. The @code{dynamic_cast} operator can still be used for casts that
2680 do not require run-time type information, i.e.@: casts to @code{void *} or to
2681 unambiguous base classes.
2682
2683 Mixing code compiled with @option{-frtti} with that compiled with
2684 @option{-fno-rtti} may not work. For example, programs may
2685 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2686 for a class compiled with @option{-frtti}.
2687
2688 @item -fsized-deallocation
2689 @opindex fsized-deallocation
2690 Enable the built-in global declarations
2691 @smallexample
2692 void operator delete (void *, std::size_t) noexcept;
2693 void operator delete[] (void *, std::size_t) noexcept;
2694 @end smallexample
2695 as introduced in C++14. This is useful for user-defined replacement
2696 deallocation functions that, for example, use the size of the object
2697 to make deallocation faster. Enabled by default under
2698 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2699 warns about places that might want to add a definition.
2700
2701 @item -fstrict-enums
2702 @opindex fstrict-enums
2703 Allow the compiler to optimize using the assumption that a value of
2704 enumerated type can only be one of the values of the enumeration (as
2705 defined in the C++ standard; basically, a value that can be
2706 represented in the minimum number of bits needed to represent all the
2707 enumerators). This assumption may not be valid if the program uses a
2708 cast to convert an arbitrary integer value to the enumerated type.
2709
2710 @item -fstrong-eval-order
2711 @opindex fstrong-eval-order
2712 Evaluate member access, array subscripting, and shift expressions in
2713 left-to-right order, and evaluate assignment in right-to-left order,
2714 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2715 @option{-fstrong-eval-order=some} enables just the ordering of member
2716 access and shift expressions, and is the default without
2717 @option{-std=c++17}.
2718
2719 @item -ftemplate-backtrace-limit=@var{n}
2720 @opindex ftemplate-backtrace-limit
2721 Set the maximum number of template instantiation notes for a single
2722 warning or error to @var{n}. The default value is 10.
2723
2724 @item -ftemplate-depth=@var{n}
2725 @opindex ftemplate-depth
2726 Set the maximum instantiation depth for template classes to @var{n}.
2727 A limit on the template instantiation depth is needed to detect
2728 endless recursions during template class instantiation. ANSI/ISO C++
2729 conforming programs must not rely on a maximum depth greater than 17
2730 (changed to 1024 in C++11). The default value is 900, as the compiler
2731 can run out of stack space before hitting 1024 in some situations.
2732
2733 @item -fno-threadsafe-statics
2734 @opindex fno-threadsafe-statics
2735 @opindex fthreadsafe-statics
2736 Do not emit the extra code to use the routines specified in the C++
2737 ABI for thread-safe initialization of local statics. You can use this
2738 option to reduce code size slightly in code that doesn't need to be
2739 thread-safe.
2740
2741 @item -fuse-cxa-atexit
2742 @opindex fuse-cxa-atexit
2743 Register destructors for objects with static storage duration with the
2744 @code{__cxa_atexit} function rather than the @code{atexit} function.
2745 This option is required for fully standards-compliant handling of static
2746 destructors, but only works if your C library supports
2747 @code{__cxa_atexit}.
2748
2749 @item -fno-use-cxa-get-exception-ptr
2750 @opindex fno-use-cxa-get-exception-ptr
2751 @opindex fuse-cxa-get-exception-ptr
2752 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2753 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2754 if the runtime routine is not available.
2755
2756 @item -fvisibility-inlines-hidden
2757 @opindex fvisibility-inlines-hidden
2758 This switch declares that the user does not attempt to compare
2759 pointers to inline functions or methods where the addresses of the two functions
2760 are taken in different shared objects.
2761
2762 The effect of this is that GCC may, effectively, mark inline methods with
2763 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2764 appear in the export table of a DSO and do not require a PLT indirection
2765 when used within the DSO@. Enabling this option can have a dramatic effect
2766 on load and link times of a DSO as it massively reduces the size of the
2767 dynamic export table when the library makes heavy use of templates.
2768
2769 The behavior of this switch is not quite the same as marking the
2770 methods as hidden directly, because it does not affect static variables
2771 local to the function or cause the compiler to deduce that
2772 the function is defined in only one shared object.
2773
2774 You may mark a method as having a visibility explicitly to negate the
2775 effect of the switch for that method. For example, if you do want to
2776 compare pointers to a particular inline method, you might mark it as
2777 having default visibility. Marking the enclosing class with explicit
2778 visibility has no effect.
2779
2780 Explicitly instantiated inline methods are unaffected by this option
2781 as their linkage might otherwise cross a shared library boundary.
2782 @xref{Template Instantiation}.
2783
2784 @item -fvisibility-ms-compat
2785 @opindex fvisibility-ms-compat
2786 This flag attempts to use visibility settings to make GCC's C++
2787 linkage model compatible with that of Microsoft Visual Studio.
2788
2789 The flag makes these changes to GCC's linkage model:
2790
2791 @enumerate
2792 @item
2793 It sets the default visibility to @code{hidden}, like
2794 @option{-fvisibility=hidden}.
2795
2796 @item
2797 Types, but not their members, are not hidden by default.
2798
2799 @item
2800 The One Definition Rule is relaxed for types without explicit
2801 visibility specifications that are defined in more than one
2802 shared object: those declarations are permitted if they are
2803 permitted when this option is not used.
2804 @end enumerate
2805
2806 In new code it is better to use @option{-fvisibility=hidden} and
2807 export those classes that are intended to be externally visible.
2808 Unfortunately it is possible for code to rely, perhaps accidentally,
2809 on the Visual Studio behavior.
2810
2811 Among the consequences of these changes are that static data members
2812 of the same type with the same name but defined in different shared
2813 objects are different, so changing one does not change the other;
2814 and that pointers to function members defined in different shared
2815 objects may not compare equal. When this flag is given, it is a
2816 violation of the ODR to define types with the same name differently.
2817
2818 @item -fno-weak
2819 @opindex fno-weak
2820 @opindex fweak
2821 Do not use weak symbol support, even if it is provided by the linker.
2822 By default, G++ uses weak symbols if they are available. This
2823 option exists only for testing, and should not be used by end-users;
2824 it results in inferior code and has no benefits. This option may
2825 be removed in a future release of G++.
2826
2827 @item -nostdinc++
2828 @opindex nostdinc++
2829 Do not search for header files in the standard directories specific to
2830 C++, but do still search the other standard directories. (This option
2831 is used when building the C++ library.)
2832 @end table
2833
2834 In addition, these optimization, warning, and code generation options
2835 have meanings only for C++ programs:
2836
2837 @table @gcctabopt
2838 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2839 @opindex Wabi
2840 @opindex Wno-abi
2841 Warn when G++ it generates code that is probably not compatible with
2842 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2843 ABI with each major release, normally @option{-Wabi} will warn only if
2844 there is a check added later in a release series for an ABI issue
2845 discovered since the initial release. @option{-Wabi} will warn about
2846 more things if an older ABI version is selected (with
2847 @option{-fabi-version=@var{n}}).
2848
2849 @option{-Wabi} can also be used with an explicit version number to
2850 warn about compatibility with a particular @option{-fabi-version}
2851 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2852 @option{-fabi-version=2}.
2853
2854 If an explicit version number is provided and
2855 @option{-fabi-compat-version} is not specified, the version number
2856 from this option is used for compatibility aliases. If no explicit
2857 version number is provided with this option, but
2858 @option{-fabi-compat-version} is specified, that version number is
2859 used for ABI warnings.
2860
2861 Although an effort has been made to warn about
2862 all such cases, there are probably some cases that are not warned about,
2863 even though G++ is generating incompatible code. There may also be
2864 cases where warnings are emitted even though the code that is generated
2865 is compatible.
2866
2867 You should rewrite your code to avoid these warnings if you are
2868 concerned about the fact that code generated by G++ may not be binary
2869 compatible with code generated by other compilers.
2870
2871 Known incompatibilities in @option{-fabi-version=2} (which was the
2872 default from GCC 3.4 to 4.9) include:
2873
2874 @itemize @bullet
2875
2876 @item
2877 A template with a non-type template parameter of reference type was
2878 mangled incorrectly:
2879 @smallexample
2880 extern int N;
2881 template <int &> struct S @{@};
2882 void n (S<N>) @{2@}
2883 @end smallexample
2884
2885 This was fixed in @option{-fabi-version=3}.
2886
2887 @item
2888 SIMD vector types declared using @code{__attribute ((vector_size))} were
2889 mangled in a non-standard way that does not allow for overloading of
2890 functions taking vectors of different sizes.
2891
2892 The mangling was changed in @option{-fabi-version=4}.
2893
2894 @item
2895 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2896 qualifiers, and @code{decltype} of a plain declaration was folded away.
2897
2898 These mangling issues were fixed in @option{-fabi-version=5}.
2899
2900 @item
2901 Scoped enumerators passed as arguments to a variadic function are
2902 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2903 On most targets this does not actually affect the parameter passing
2904 ABI, as there is no way to pass an argument smaller than @code{int}.
2905
2906 Also, the ABI changed the mangling of template argument packs,
2907 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2908 a class scope function used as a template argument.
2909
2910 These issues were corrected in @option{-fabi-version=6}.
2911
2912 @item
2913 Lambdas in default argument scope were mangled incorrectly, and the
2914 ABI changed the mangling of @code{nullptr_t}.
2915
2916 These issues were corrected in @option{-fabi-version=7}.
2917
2918 @item
2919 When mangling a function type with function-cv-qualifiers, the
2920 un-qualified function type was incorrectly treated as a substitution
2921 candidate.
2922
2923 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2924
2925 @item
2926 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2927 unaligned accesses. Note that this did not affect the ABI of a
2928 function with a @code{nullptr_t} parameter, as parameters have a
2929 minimum alignment.
2930
2931 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2932
2933 @item
2934 Target-specific attributes that affect the identity of a type, such as
2935 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2936 did not affect the mangled name, leading to name collisions when
2937 function pointers were used as template arguments.
2938
2939 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2940
2941 @end itemize
2942
2943 It also warns about psABI-related changes. The known psABI changes at this
2944 point include:
2945
2946 @itemize @bullet
2947
2948 @item
2949 For SysV/x86-64, unions with @code{long double} members are
2950 passed in memory as specified in psABI. For example:
2951
2952 @smallexample
2953 union U @{
2954 long double ld;
2955 int i;
2956 @};
2957 @end smallexample
2958
2959 @noindent
2960 @code{union U} is always passed in memory.
2961
2962 @end itemize
2963
2964 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2965 @opindex Wabi-tag
2966 @opindex Wabi-tag
2967 Warn when a type with an ABI tag is used in a context that does not
2968 have that ABI tag. See @ref{C++ Attributes} for more information
2969 about ABI tags.
2970
2971 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2972 @opindex Wctor-dtor-privacy
2973 @opindex Wno-ctor-dtor-privacy
2974 Warn when a class seems unusable because all the constructors or
2975 destructors in that class are private, and it has neither friends nor
2976 public static member functions. Also warn if there are no non-private
2977 methods, and there's at least one private member function that isn't
2978 a constructor or destructor.
2979
2980 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2981 @opindex Wdelete-non-virtual-dtor
2982 @opindex Wno-delete-non-virtual-dtor
2983 Warn when @code{delete} is used to destroy an instance of a class that
2984 has virtual functions and non-virtual destructor. It is unsafe to delete
2985 an instance of a derived class through a pointer to a base class if the
2986 base class does not have a virtual destructor. This warning is enabled
2987 by @option{-Wall}.
2988
2989 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2990 @opindex Wdeprecated-copy
2991 @opindex Wno-deprecated-copy
2992 Warn that the implicit declaration of a copy constructor or copy
2993 assignment operator is deprecated if the class has a user-provided
2994 copy constructor, copy assignment operator, or destructor, in C++11
2995 and up. This warning is enabled by @option{-Wall}.
2996
2997 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2998 @opindex Winit-list-lifetime
2999 @opindex Wno-init-list-lifetime
3000 Do not warn about uses of @code{std::initializer_list} that are likely
3001 to result in dangling pointers. Since the underlying array for an
3002 @code{initializer_list} is handled like a normal C++ temporary object,
3003 it is easy to inadvertently keep a pointer to the array past the end
3004 of the array's lifetime. For example:
3005
3006 @itemize @bullet
3007 @item
3008 If a function returns a temporary @code{initializer_list}, or a local
3009 @code{initializer_list} variable, the array's lifetime ends at the end
3010 of the return statement, so the value returned has a dangling pointer.
3011
3012 @item
3013 If a new-expression creates an @code{initializer_list}, the array only
3014 lives until the end of the enclosing full-expression, so the
3015 @code{initializer_list} in the heap has a dangling pointer.
3016
3017 @item
3018 When an @code{initializer_list} variable is assigned from a
3019 brace-enclosed initializer list, the temporary array created for the
3020 right side of the assignment only lives until the end of the
3021 full-expression, so at the next statement the @code{initializer_list}
3022 variable has a dangling pointer.
3023
3024 @smallexample
3025 // li's initial underlying array lives as long as li
3026 std::initializer_list<int> li = @{ 1,2,3 @};
3027 // assignment changes li to point to a temporary array
3028 li = @{ 4, 5 @};
3029 // now the temporary is gone and li has a dangling pointer
3030 int i = li.begin()[0] // undefined behavior
3031 @end smallexample
3032
3033 @item
3034 When a list constructor stores the @code{begin} pointer from the
3035 @code{initializer_list} argument, this doesn't extend the lifetime of
3036 the array, so if a class variable is constructed from a temporary
3037 @code{initializer_list}, the pointer is left dangling by the end of
3038 the variable declaration statement.
3039
3040 @end itemize
3041
3042 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3043 @opindex Wliteral-suffix
3044 @opindex Wno-literal-suffix
3045 Warn when a string or character literal is followed by a ud-suffix which does
3046 not begin with an underscore. As a conforming extension, GCC treats such
3047 suffixes as separate preprocessing tokens in order to maintain backwards
3048 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3049 For example:
3050
3051 @smallexample
3052 #define __STDC_FORMAT_MACROS
3053 #include <inttypes.h>
3054 #include <stdio.h>
3055
3056 int main() @{
3057 int64_t i64 = 123;
3058 printf("My int64: %" PRId64"\n", i64);
3059 @}
3060 @end smallexample
3061
3062 In this case, @code{PRId64} is treated as a separate preprocessing token.
3063
3064 Additionally, warn when a user-defined literal operator is declared with
3065 a literal suffix identifier that doesn't begin with an underscore. Literal
3066 suffix identifiers that don't begin with an underscore are reserved for
3067 future standardization.
3068
3069 This warning is enabled by default.
3070
3071 @item -Wlto-type-mismatch
3072 @opindex Wlto-type-mismatch
3073 @opindex Wno-lto-type-mismatch
3074
3075 During the link-time optimization warn about type mismatches in
3076 global declarations from different compilation units.
3077 Requires @option{-flto} to be enabled. Enabled by default.
3078
3079 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3080 @opindex Wnarrowing
3081 @opindex Wno-narrowing
3082 For C++11 and later standards, narrowing conversions are diagnosed by default,
3083 as required by the standard. A narrowing conversion from a constant produces
3084 an error, and a narrowing conversion from a non-constant produces a warning,
3085 but @option{-Wno-narrowing} suppresses the diagnostic.
3086 Note that this does not affect the meaning of well-formed code;
3087 narrowing conversions are still considered ill-formed in SFINAE contexts.
3088
3089 With @option{-Wnarrowing} in C++98, warn when a narrowing
3090 conversion prohibited by C++11 occurs within
3091 @samp{@{ @}}, e.g.
3092
3093 @smallexample
3094 int i = @{ 2.2 @}; // error: narrowing from double to int
3095 @end smallexample
3096
3097 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3098
3099 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3100 @opindex Wnoexcept
3101 @opindex Wno-noexcept
3102 Warn when a noexcept-expression evaluates to false because of a call
3103 to a function that does not have a non-throwing exception
3104 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3105 the compiler to never throw an exception.
3106
3107 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3108 @opindex Wnoexcept-type
3109 @opindex Wno-noexcept-type
3110 Warn if the C++17 feature making @code{noexcept} part of a function
3111 type changes the mangled name of a symbol relative to C++14. Enabled
3112 by @option{-Wabi} and @option{-Wc++17-compat}.
3113
3114 As an example:
3115
3116 @smallexample
3117 template <class T> void f(T t) @{ t(); @};
3118 void g() noexcept;
3119 void h() @{ f(g); @}
3120 @end smallexample
3121
3122 @noindent
3123 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3124 C++17 it calls @code{f<void(*)()noexcept>}.
3125
3126 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3127 @opindex Wclass-memaccess
3128 @opindex Wno-class-memaccess
3129 Warn when the destination of a call to a raw memory function such as
3130 @code{memset} or @code{memcpy} is an object of class type, and when writing
3131 into such an object might bypass the class non-trivial or deleted constructor
3132 or copy assignment, violate const-correctness or encapsulation, or corrupt
3133 virtual table pointers. Modifying the representation of such objects may
3134 violate invariants maintained by member functions of the class. For example,
3135 the call to @code{memset} below is undefined because it modifies a non-trivial
3136 class object and is, therefore, diagnosed. The safe way to either initialize
3137 or clear the storage of objects of such types is by using the appropriate
3138 constructor or assignment operator, if one is available.
3139 @smallexample
3140 std::string str = "abc";
3141 memset (&str, 0, sizeof str);
3142 @end smallexample
3143 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3144 Explicitly casting the pointer to the class object to @code{void *} or
3145 to a type that can be safely accessed by the raw memory function suppresses
3146 the warning.
3147
3148 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3149 @opindex Wnon-virtual-dtor
3150 @opindex Wno-non-virtual-dtor
3151 Warn when a class has virtual functions and an accessible non-virtual
3152 destructor itself or in an accessible polymorphic base class, in which
3153 case it is possible but unsafe to delete an instance of a derived
3154 class through a pointer to the class itself or base class. This
3155 warning is automatically enabled if @option{-Weffc++} is specified.
3156
3157 @item -Wregister @r{(C++ and Objective-C++ only)}
3158 @opindex Wregister
3159 @opindex Wno-register
3160 Warn on uses of the @code{register} storage class specifier, except
3161 when it is part of the GNU @ref{Explicit Register Variables} extension.
3162 The use of the @code{register} keyword as storage class specifier has
3163 been deprecated in C++11 and removed in C++17.
3164 Enabled by default with @option{-std=c++17}.
3165
3166 @item -Wreorder @r{(C++ and Objective-C++ only)}
3167 @opindex Wreorder
3168 @opindex Wno-reorder
3169 @cindex reordering, warning
3170 @cindex warning for reordering of member initializers
3171 Warn when the order of member initializers given in the code does not
3172 match the order in which they must be executed. For instance:
3173
3174 @smallexample
3175 struct A @{
3176 int i;
3177 int j;
3178 A(): j (0), i (1) @{ @}
3179 @};
3180 @end smallexample
3181
3182 @noindent
3183 The compiler rearranges the member initializers for @code{i}
3184 and @code{j} to match the declaration order of the members, emitting
3185 a warning to that effect. This warning is enabled by @option{-Wall}.
3186
3187 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3188 @opindex Wpessimizing-move
3189 @opindex Wno-pessimizing-move
3190 This warning warns when a call to @code{std::move} prevents copy
3191 elision. A typical scenario when copy elision can occur is when returning in
3192 a function with a class return type, when the expression being returned is the
3193 name of a non-volatile automatic object, and is not a function parameter, and
3194 has the same type as the function return type.
3195
3196 @smallexample
3197 struct T @{
3198 @dots{}
3199 @};
3200 T fn()
3201 @{
3202 T t;
3203 @dots{}
3204 return std::move (t);
3205 @}
3206 @end smallexample
3207
3208 But in this example, the @code{std::move} call prevents copy elision.
3209
3210 This warning is enabled by @option{-Wall}.
3211
3212 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3213 @opindex Wredundant-move
3214 @opindex Wno-redundant-move
3215 This warning warns about redundant calls to @code{std::move}; that is, when
3216 a move operation would have been performed even without the @code{std::move}
3217 call. This happens because the compiler is forced to treat the object as if
3218 it were an rvalue in certain situations such as returning a local variable,
3219 where copy elision isn't applicable. Consider:
3220
3221 @smallexample
3222 struct T @{
3223 @dots{}
3224 @};
3225 T fn(T t)
3226 @{
3227 @dots{}
3228 return std::move (t);
3229 @}
3230 @end smallexample
3231
3232 Here, the @code{std::move} call is redundant. Because G++ implements Core
3233 Issue 1579, another example is:
3234
3235 @smallexample
3236 struct T @{ // convertible to U
3237 @dots{}
3238 @};
3239 struct U @{
3240 @dots{}
3241 @};
3242 U fn()
3243 @{
3244 T t;
3245 @dots{}
3246 return std::move (t);
3247 @}
3248 @end smallexample
3249 In this example, copy elision isn't applicable because the type of the
3250 expression being returned and the function return type differ, yet G++
3251 treats the return value as if it were designated by an rvalue.
3252
3253 This warning is enabled by @option{-Wextra}.
3254
3255 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3256 @opindex fext-numeric-literals
3257 @opindex fno-ext-numeric-literals
3258 Accept imaginary, fixed-point, or machine-defined
3259 literal number suffixes as GNU extensions.
3260 When this option is turned off these suffixes are treated
3261 as C++11 user-defined literal numeric suffixes.
3262 This is on by default for all pre-C++11 dialects and all GNU dialects:
3263 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3264 @option{-std=gnu++14}.
3265 This option is off by default
3266 for ISO C++11 onwards (@option{-std=c++11}, ...).
3267 @end table
3268
3269 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3270
3271 @table @gcctabopt
3272 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3273 @opindex Weffc++
3274 @opindex Wno-effc++
3275 Warn about violations of the following style guidelines from Scott Meyers'
3276 @cite{Effective C++} series of books:
3277
3278 @itemize @bullet
3279 @item
3280 Define a copy constructor and an assignment operator for classes
3281 with dynamically-allocated memory.
3282
3283 @item
3284 Prefer initialization to assignment in constructors.
3285
3286 @item
3287 Have @code{operator=} return a reference to @code{*this}.
3288
3289 @item
3290 Don't try to return a reference when you must return an object.
3291
3292 @item
3293 Distinguish between prefix and postfix forms of increment and
3294 decrement operators.
3295
3296 @item
3297 Never overload @code{&&}, @code{||}, or @code{,}.
3298
3299 @end itemize
3300
3301 This option also enables @option{-Wnon-virtual-dtor}, which is also
3302 one of the effective C++ recommendations. However, the check is
3303 extended to warn about the lack of virtual destructor in accessible
3304 non-polymorphic bases classes too.
3305
3306 When selecting this option, be aware that the standard library
3307 headers do not obey all of these guidelines; use @samp{grep -v}
3308 to filter out those warnings.
3309
3310 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3311 @opindex Wstrict-null-sentinel
3312 @opindex Wno-strict-null-sentinel
3313 Warn about the use of an uncasted @code{NULL} as sentinel. When
3314 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3315 to @code{__null}. Although it is a null pointer constant rather than a
3316 null pointer, it is guaranteed to be of the same size as a pointer.
3317 But this use is not portable across different compilers.
3318
3319 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3320 @opindex Wno-non-template-friend
3321 @opindex Wnon-template-friend
3322 Disable warnings when non-template friend functions are declared
3323 within a template. In very old versions of GCC that predate implementation
3324 of the ISO standard, declarations such as
3325 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3326 could be interpreted as a particular specialization of a template
3327 function; the warning exists to diagnose compatibility problems,
3328 and is enabled by default.
3329
3330 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3331 @opindex Wold-style-cast
3332 @opindex Wno-old-style-cast
3333 Warn if an old-style (C-style) cast to a non-void type is used within
3334 a C++ program. The new-style casts (@code{dynamic_cast},
3335 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3336 less vulnerable to unintended effects and much easier to search for.
3337
3338 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3339 @opindex Woverloaded-virtual
3340 @opindex Wno-overloaded-virtual
3341 @cindex overloaded virtual function, warning
3342 @cindex warning for overloaded virtual function
3343 Warn when a function declaration hides virtual functions from a
3344 base class. For example, in:
3345
3346 @smallexample
3347 struct A @{
3348 virtual void f();
3349 @};
3350
3351 struct B: public A @{
3352 void f(int);
3353 @};
3354 @end smallexample
3355
3356 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3357 like:
3358
3359 @smallexample
3360 B* b;
3361 b->f();
3362 @end smallexample
3363
3364 @noindent
3365 fails to compile.
3366
3367 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3368 @opindex Wno-pmf-conversions
3369 @opindex Wpmf-conversions
3370 Disable the diagnostic for converting a bound pointer to member function
3371 to a plain pointer.
3372
3373 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3374 @opindex Wsign-promo
3375 @opindex Wno-sign-promo
3376 Warn when overload resolution chooses a promotion from unsigned or
3377 enumerated type to a signed type, over a conversion to an unsigned type of
3378 the same size. Previous versions of G++ tried to preserve
3379 unsignedness, but the standard mandates the current behavior.
3380
3381 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3382 @opindex Wtemplates
3383 @opindex Wno-templates
3384 Warn when a primary template declaration is encountered. Some coding
3385 rules disallow templates, and this may be used to enforce that rule.
3386 The warning is inactive inside a system header file, such as the STL, so
3387 one can still use the STL. One may also instantiate or specialize
3388 templates.
3389
3390 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3391 @opindex Wmultiple-inheritance
3392 @opindex Wno-multiple-inheritance
3393 Warn when a class is defined with multiple direct base classes. Some
3394 coding rules disallow multiple inheritance, and this may be used to
3395 enforce that rule. The warning is inactive inside a system header file,
3396 such as the STL, so one can still use the STL. One may also define
3397 classes that indirectly use multiple inheritance.
3398
3399 @item -Wvirtual-inheritance
3400 @opindex Wvirtual-inheritance
3401 @opindex Wno-virtual-inheritance
3402 Warn when a class is defined with a virtual direct base class. Some
3403 coding rules disallow multiple inheritance, and this may be used to
3404 enforce that rule. The warning is inactive inside a system header file,
3405 such as the STL, so one can still use the STL. One may also define
3406 classes that indirectly use virtual inheritance.
3407
3408 @item -Wnamespaces
3409 @opindex Wnamespaces
3410 @opindex Wno-namespaces
3411 Warn when a namespace definition is opened. Some coding rules disallow
3412 namespaces, and this may be used to enforce that rule. The warning is
3413 inactive inside a system header file, such as the STL, so one can still
3414 use the STL. One may also use using directives and qualified names.
3415
3416 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3417 @opindex Wterminate
3418 @opindex Wno-terminate
3419 Disable the warning about a throw-expression that will immediately
3420 result in a call to @code{terminate}.
3421
3422 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3423 @opindex Wno-class-conversion
3424 @opindex Wclass-conversion
3425 Disable the warning about the case when a conversion function converts an
3426 object to the same type, to a base class of that type, or to void; such
3427 a conversion function will never be called.
3428 @end table
3429
3430 @node Objective-C and Objective-C++ Dialect Options
3431 @section Options Controlling Objective-C and Objective-C++ Dialects
3432
3433 @cindex compiler options, Objective-C and Objective-C++
3434 @cindex Objective-C and Objective-C++ options, command-line
3435 @cindex options, Objective-C and Objective-C++
3436 (NOTE: This manual does not describe the Objective-C and Objective-C++
3437 languages themselves. @xref{Standards,,Language Standards
3438 Supported by GCC}, for references.)
3439
3440 This section describes the command-line options that are only meaningful
3441 for Objective-C and Objective-C++ programs. You can also use most of
3442 the language-independent GNU compiler options.
3443 For example, you might compile a file @file{some_class.m} like this:
3444
3445 @smallexample
3446 gcc -g -fgnu-runtime -O -c some_class.m
3447 @end smallexample
3448
3449 @noindent
3450 In this example, @option{-fgnu-runtime} is an option meant only for
3451 Objective-C and Objective-C++ programs; you can use the other options with
3452 any language supported by GCC@.
3453
3454 Note that since Objective-C is an extension of the C language, Objective-C
3455 compilations may also use options specific to the C front-end (e.g.,
3456 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3457 C++-specific options (e.g., @option{-Wabi}).
3458
3459 Here is a list of options that are @emph{only} for compiling Objective-C
3460 and Objective-C++ programs:
3461
3462 @table @gcctabopt
3463 @item -fconstant-string-class=@var{class-name}
3464 @opindex fconstant-string-class
3465 Use @var{class-name} as the name of the class to instantiate for each
3466 literal string specified with the syntax @code{@@"@dots{}"}. The default
3467 class name is @code{NXConstantString} if the GNU runtime is being used, and
3468 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3469 @option{-fconstant-cfstrings} option, if also present, overrides the
3470 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3471 to be laid out as constant CoreFoundation strings.
3472
3473 @item -fgnu-runtime
3474 @opindex fgnu-runtime
3475 Generate object code compatible with the standard GNU Objective-C
3476 runtime. This is the default for most types of systems.
3477
3478 @item -fnext-runtime
3479 @opindex fnext-runtime
3480 Generate output compatible with the NeXT runtime. This is the default
3481 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3482 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3483 used.
3484
3485 @item -fno-nil-receivers
3486 @opindex fno-nil-receivers
3487 @opindex fnil-receivers
3488 Assume that all Objective-C message dispatches (@code{[receiver
3489 message:arg]}) in this translation unit ensure that the receiver is
3490 not @code{nil}. This allows for more efficient entry points in the
3491 runtime to be used. This option is only available in conjunction with
3492 the NeXT runtime and ABI version 0 or 1.
3493
3494 @item -fobjc-abi-version=@var{n}
3495 @opindex fobjc-abi-version
3496 Use version @var{n} of the Objective-C ABI for the selected runtime.
3497 This option is currently supported only for the NeXT runtime. In that
3498 case, Version 0 is the traditional (32-bit) ABI without support for
3499 properties and other Objective-C 2.0 additions. Version 1 is the
3500 traditional (32-bit) ABI with support for properties and other
3501 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3502 nothing is specified, the default is Version 0 on 32-bit target
3503 machines, and Version 2 on 64-bit target machines.
3504
3505 @item -fobjc-call-cxx-cdtors
3506 @opindex fobjc-call-cxx-cdtors
3507 For each Objective-C class, check if any of its instance variables is a
3508 C++ object with a non-trivial default constructor. If so, synthesize a
3509 special @code{- (id) .cxx_construct} instance method which runs
3510 non-trivial default constructors on any such instance variables, in order,
3511 and then return @code{self}. Similarly, check if any instance variable
3512 is a C++ object with a non-trivial destructor, and if so, synthesize a
3513 special @code{- (void) .cxx_destruct} method which runs
3514 all such default destructors, in reverse order.
3515
3516 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3517 methods thusly generated only operate on instance variables
3518 declared in the current Objective-C class, and not those inherited
3519 from superclasses. It is the responsibility of the Objective-C
3520 runtime to invoke all such methods in an object's inheritance
3521 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3522 by the runtime immediately after a new object instance is allocated;
3523 the @code{- (void) .cxx_destruct} methods are invoked immediately
3524 before the runtime deallocates an object instance.
3525
3526 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3527 support for invoking the @code{- (id) .cxx_construct} and
3528 @code{- (void) .cxx_destruct} methods.
3529
3530 @item -fobjc-direct-dispatch
3531 @opindex fobjc-direct-dispatch
3532 Allow fast jumps to the message dispatcher. On Darwin this is
3533 accomplished via the comm page.
3534
3535 @item -fobjc-exceptions
3536 @opindex fobjc-exceptions
3537 Enable syntactic support for structured exception handling in
3538 Objective-C, similar to what is offered by C++. This option
3539 is required to use the Objective-C keywords @code{@@try},
3540 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3541 @code{@@synchronized}. This option is available with both the GNU
3542 runtime and the NeXT runtime (but not available in conjunction with
3543 the NeXT runtime on Mac OS X 10.2 and earlier).
3544
3545 @item -fobjc-gc
3546 @opindex fobjc-gc
3547 Enable garbage collection (GC) in Objective-C and Objective-C++
3548 programs. This option is only available with the NeXT runtime; the
3549 GNU runtime has a different garbage collection implementation that
3550 does not require special compiler flags.
3551
3552 @item -fobjc-nilcheck
3553 @opindex fobjc-nilcheck
3554 For the NeXT runtime with version 2 of the ABI, check for a nil
3555 receiver in method invocations before doing the actual method call.
3556 This is the default and can be disabled using
3557 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3558 checked for nil in this way no matter what this flag is set to.
3559 Currently this flag does nothing when the GNU runtime, or an older
3560 version of the NeXT runtime ABI, is used.
3561
3562 @item -fobjc-std=objc1
3563 @opindex fobjc-std
3564 Conform to the language syntax of Objective-C 1.0, the language
3565 recognized by GCC 4.0. This only affects the Objective-C additions to
3566 the C/C++ language; it does not affect conformance to C/C++ standards,
3567 which is controlled by the separate C/C++ dialect option flags. When
3568 this option is used with the Objective-C or Objective-C++ compiler,
3569 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3570 This is useful if you need to make sure that your Objective-C code can
3571 be compiled with older versions of GCC@.
3572
3573 @item -freplace-objc-classes
3574 @opindex freplace-objc-classes
3575 Emit a special marker instructing @command{ld(1)} not to statically link in
3576 the resulting object file, and allow @command{dyld(1)} to load it in at
3577 run time instead. This is used in conjunction with the Fix-and-Continue
3578 debugging mode, where the object file in question may be recompiled and
3579 dynamically reloaded in the course of program execution, without the need
3580 to restart the program itself. Currently, Fix-and-Continue functionality
3581 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3582 and later.
3583
3584 @item -fzero-link
3585 @opindex fzero-link
3586 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3587 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3588 compile time) with static class references that get initialized at load time,
3589 which improves run-time performance. Specifying the @option{-fzero-link} flag
3590 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3591 to be retained. This is useful in Zero-Link debugging mode, since it allows
3592 for individual class implementations to be modified during program execution.
3593 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3594 regardless of command-line options.
3595
3596 @item -fno-local-ivars
3597 @opindex fno-local-ivars
3598 @opindex flocal-ivars
3599 By default instance variables in Objective-C can be accessed as if
3600 they were local variables from within the methods of the class they're
3601 declared in. This can lead to shadowing between instance variables
3602 and other variables declared either locally inside a class method or
3603 globally with the same name. Specifying the @option{-fno-local-ivars}
3604 flag disables this behavior thus avoiding variable shadowing issues.
3605
3606 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3607 @opindex fivar-visibility
3608 Set the default instance variable visibility to the specified option
3609 so that instance variables declared outside the scope of any access
3610 modifier directives default to the specified visibility.
3611
3612 @item -gen-decls
3613 @opindex gen-decls
3614 Dump interface declarations for all classes seen in the source file to a
3615 file named @file{@var{sourcename}.decl}.
3616
3617 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3618 @opindex Wassign-intercept
3619 @opindex Wno-assign-intercept
3620 Warn whenever an Objective-C assignment is being intercepted by the
3621 garbage collector.
3622
3623 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3624 @opindex Wno-protocol
3625 @opindex Wprotocol
3626 If a class is declared to implement a protocol, a warning is issued for
3627 every method in the protocol that is not implemented by the class. The
3628 default behavior is to issue a warning for every method not explicitly
3629 implemented in the class, even if a method implementation is inherited
3630 from the superclass. If you use the @option{-Wno-protocol} option, then
3631 methods inherited from the superclass are considered to be implemented,
3632 and no warning is issued for them.
3633
3634 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3635 @opindex Wselector
3636 @opindex Wno-selector
3637 Warn if multiple methods of different types for the same selector are
3638 found during compilation. The check is performed on the list of methods
3639 in the final stage of compilation. Additionally, a check is performed
3640 for each selector appearing in a @code{@@selector(@dots{})}
3641 expression, and a corresponding method for that selector has been found
3642 during compilation. Because these checks scan the method table only at
3643 the end of compilation, these warnings are not produced if the final
3644 stage of compilation is not reached, for example because an error is
3645 found during compilation, or because the @option{-fsyntax-only} option is
3646 being used.
3647
3648 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3649 @opindex Wstrict-selector-match
3650 @opindex Wno-strict-selector-match
3651 Warn if multiple methods with differing argument and/or return types are
3652 found for a given selector when attempting to send a message using this
3653 selector to a receiver of type @code{id} or @code{Class}. When this flag
3654 is off (which is the default behavior), the compiler omits such warnings
3655 if any differences found are confined to types that share the same size
3656 and alignment.
3657
3658 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3659 @opindex Wundeclared-selector
3660 @opindex Wno-undeclared-selector
3661 Warn if a @code{@@selector(@dots{})} expression referring to an
3662 undeclared selector is found. A selector is considered undeclared if no
3663 method with that name has been declared before the
3664 @code{@@selector(@dots{})} expression, either explicitly in an
3665 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3666 an @code{@@implementation} section. This option always performs its
3667 checks as soon as a @code{@@selector(@dots{})} expression is found,
3668 while @option{-Wselector} only performs its checks in the final stage of
3669 compilation. This also enforces the coding style convention
3670 that methods and selectors must be declared before being used.
3671
3672 @item -print-objc-runtime-info
3673 @opindex print-objc-runtime-info
3674 Generate C header describing the largest structure that is passed by
3675 value, if any.
3676
3677 @end table
3678
3679 @node Diagnostic Message Formatting Options
3680 @section Options to Control Diagnostic Messages Formatting
3681 @cindex options to control diagnostics formatting
3682 @cindex diagnostic messages
3683 @cindex message formatting
3684
3685 Traditionally, diagnostic messages have been formatted irrespective of
3686 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3687 options described below
3688 to control the formatting algorithm for diagnostic messages,
3689 e.g.@: how many characters per line, how often source location
3690 information should be reported. Note that some language front ends may not
3691 honor these options.
3692
3693 @table @gcctabopt
3694 @item -fmessage-length=@var{n}
3695 @opindex fmessage-length
3696 Try to format error messages so that they fit on lines of about
3697 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3698 done; each error message appears on a single line. This is the
3699 default for all front ends.
3700
3701 Note - this option also affects the display of the @samp{#error} and
3702 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3703 function/type/variable attribute. It does not however affect the
3704 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3705
3706 @item -fdiagnostics-show-location=once
3707 @opindex fdiagnostics-show-location
3708 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3709 reporter to emit source location information @emph{once}; that is, in
3710 case the message is too long to fit on a single physical line and has to
3711 be wrapped, the source location won't be emitted (as prefix) again,
3712 over and over, in subsequent continuation lines. This is the default
3713 behavior.
3714
3715 @item -fdiagnostics-show-location=every-line
3716 Only meaningful in line-wrapping mode. Instructs the diagnostic
3717 messages reporter to emit the same source location information (as
3718 prefix) for physical lines that result from the process of breaking
3719 a message which is too long to fit on a single line.
3720
3721 @item -fdiagnostics-color[=@var{WHEN}]
3722 @itemx -fno-diagnostics-color
3723 @opindex fdiagnostics-color
3724 @cindex highlight, color
3725 @vindex GCC_COLORS @r{environment variable}
3726 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3727 or @samp{auto}. The default depends on how the compiler has been configured,
3728 it can be any of the above @var{WHEN} options or also @samp{never}
3729 if @env{GCC_COLORS} environment variable isn't present in the environment,
3730 and @samp{auto} otherwise.
3731 @samp{auto} means to use color only when the standard error is a terminal.
3732 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3733 aliases for @option{-fdiagnostics-color=always} and
3734 @option{-fdiagnostics-color=never}, respectively.
3735
3736 The colors are defined by the environment variable @env{GCC_COLORS}.
3737 Its value is a colon-separated list of capabilities and Select Graphic
3738 Rendition (SGR) substrings. SGR commands are interpreted by the
3739 terminal or terminal emulator. (See the section in the documentation
3740 of your text terminal for permitted values and their meanings as
3741 character attributes.) These substring values are integers in decimal
3742 representation and can be concatenated with semicolons.
3743 Common values to concatenate include
3744 @samp{1} for bold,
3745 @samp{4} for underline,
3746 @samp{5} for blink,
3747 @samp{7} for inverse,
3748 @samp{39} for default foreground color,
3749 @samp{30} to @samp{37} for foreground colors,
3750 @samp{90} to @samp{97} for 16-color mode foreground colors,
3751 @samp{38;5;0} to @samp{38;5;255}
3752 for 88-color and 256-color modes foreground colors,
3753 @samp{49} for default background color,
3754 @samp{40} to @samp{47} for background colors,
3755 @samp{100} to @samp{107} for 16-color mode background colors,
3756 and @samp{48;5;0} to @samp{48;5;255}
3757 for 88-color and 256-color modes background colors.
3758
3759 The default @env{GCC_COLORS} is
3760 @smallexample
3761 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3762 quote=01:fixit-insert=32:fixit-delete=31:\
3763 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3764 type-diff=01;32
3765 @end smallexample
3766 @noindent
3767 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3768 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3769 @samp{01} is bold, and @samp{31} is red.
3770 Setting @env{GCC_COLORS} to the empty string disables colors.
3771 Supported capabilities are as follows.
3772
3773 @table @code
3774 @item error=
3775 @vindex error GCC_COLORS @r{capability}
3776 SGR substring for error: markers.
3777
3778 @item warning=
3779 @vindex warning GCC_COLORS @r{capability}
3780 SGR substring for warning: markers.
3781
3782 @item note=
3783 @vindex note GCC_COLORS @r{capability}
3784 SGR substring for note: markers.
3785
3786 @item range1=
3787 @vindex range1 GCC_COLORS @r{capability}
3788 SGR substring for first additional range.
3789
3790 @item range2=
3791 @vindex range2 GCC_COLORS @r{capability}
3792 SGR substring for second additional range.
3793
3794 @item locus=
3795 @vindex locus GCC_COLORS @r{capability}
3796 SGR substring for location information, @samp{file:line} or
3797 @samp{file:line:column} etc.
3798
3799 @item quote=
3800 @vindex quote GCC_COLORS @r{capability}
3801 SGR substring for information printed within quotes.
3802
3803 @item fixit-insert=
3804 @vindex fixit-insert GCC_COLORS @r{capability}
3805 SGR substring for fix-it hints suggesting text to
3806 be inserted or replaced.
3807
3808 @item fixit-delete=
3809 @vindex fixit-delete GCC_COLORS @r{capability}
3810 SGR substring for fix-it hints suggesting text to
3811 be deleted.
3812
3813 @item diff-filename=
3814 @vindex diff-filename GCC_COLORS @r{capability}
3815 SGR substring for filename headers within generated patches.
3816
3817 @item diff-hunk=
3818 @vindex diff-hunk GCC_COLORS @r{capability}
3819 SGR substring for the starts of hunks within generated patches.
3820
3821 @item diff-delete=
3822 @vindex diff-delete GCC_COLORS @r{capability}
3823 SGR substring for deleted lines within generated patches.
3824
3825 @item diff-insert=
3826 @vindex diff-insert GCC_COLORS @r{capability}
3827 SGR substring for inserted lines within generated patches.
3828
3829 @item type-diff=
3830 @vindex type-diff GCC_COLORS @r{capability}
3831 SGR substring for highlighting mismatching types within template
3832 arguments in the C++ frontend.
3833 @end table
3834
3835 @item -fno-diagnostics-show-option
3836 @opindex fno-diagnostics-show-option
3837 @opindex fdiagnostics-show-option
3838 By default, each diagnostic emitted includes text indicating the
3839 command-line option that directly controls the diagnostic (if such an
3840 option is known to the diagnostic machinery). Specifying the
3841 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3842
3843 @item -fno-diagnostics-show-caret
3844 @opindex fno-diagnostics-show-caret
3845 @opindex fdiagnostics-show-caret
3846 By default, each diagnostic emitted includes the original source line
3847 and a caret @samp{^} indicating the column. This option suppresses this
3848 information. The source line is truncated to @var{n} characters, if
3849 the @option{-fmessage-length=n} option is given. When the output is done
3850 to the terminal, the width is limited to the width given by the
3851 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3852
3853 @item -fno-diagnostics-show-labels
3854 @opindex fno-diagnostics-show-labels
3855 @opindex fdiagnostics-show-labels
3856 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3857 diagnostics can label ranges of source code with pertinent information, such
3858 as the types of expressions:
3859
3860 @smallexample
3861 printf ("foo %s bar", long_i + long_j);
3862 ~^ ~~~~~~~~~~~~~~~
3863 | |
3864 char * long int
3865 @end smallexample
3866
3867 This option suppresses the printing of these labels (in the example above,
3868 the vertical bars and the ``char *'' and ``long int'' text).
3869
3870 @item -fno-diagnostics-show-line-numbers
3871 @opindex fno-diagnostics-show-line-numbers
3872 @opindex fdiagnostics-show-line-numbers
3873 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3874 a left margin is printed, showing line numbers. This option suppresses this
3875 left margin.
3876
3877 @item -fdiagnostics-minimum-margin-width=@var{width}
3878 @opindex fdiagnostics-minimum-margin-width
3879 This option controls the minimum width of the left margin printed by
3880 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3881
3882 @item -fdiagnostics-parseable-fixits
3883 @opindex fdiagnostics-parseable-fixits
3884 Emit fix-it hints in a machine-parseable format, suitable for consumption
3885 by IDEs. For each fix-it, a line will be printed after the relevant
3886 diagnostic, starting with the string ``fix-it:''. For example:
3887
3888 @smallexample
3889 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3890 @end smallexample
3891
3892 The location is expressed as a half-open range, expressed as a count of
3893 bytes, starting at byte 1 for the initial column. In the above example,
3894 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3895 given string:
3896
3897 @smallexample
3898 00000000011111111112222222222
3899 12345678901234567890123456789
3900 gtk_widget_showall (dlg);
3901 ^^^^^^^^^^^^^^^^^^
3902 gtk_widget_show_all
3903 @end smallexample
3904
3905 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3906 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3907 (e.g. vertical tab as ``\013'').
3908
3909 An empty replacement string indicates that the given range is to be removed.
3910 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3911 be inserted at the given position.
3912
3913 @item -fdiagnostics-generate-patch
3914 @opindex fdiagnostics-generate-patch
3915 Print fix-it hints to stderr in unified diff format, after any diagnostics
3916 are printed. For example:
3917
3918 @smallexample
3919 --- test.c
3920 +++ test.c
3921 @@ -42,5 +42,5 @@
3922
3923 void show_cb(GtkDialog *dlg)
3924 @{
3925 - gtk_widget_showall(dlg);
3926 + gtk_widget_show_all(dlg);
3927 @}
3928
3929 @end smallexample
3930
3931 The diff may or may not be colorized, following the same rules
3932 as for diagnostics (see @option{-fdiagnostics-color}).
3933
3934 @item -fdiagnostics-show-template-tree
3935 @opindex fdiagnostics-show-template-tree
3936
3937 In the C++ frontend, when printing diagnostics showing mismatching
3938 template types, such as:
3939
3940 @smallexample
3941 could not convert 'std::map<int, std::vector<double> >()'
3942 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3943 @end smallexample
3944
3945 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3946 tree-like structure showing the common and differing parts of the types,
3947 such as:
3948
3949 @smallexample
3950 map<
3951 [...],
3952 vector<
3953 [double != float]>>
3954 @end smallexample
3955
3956 The parts that differ are highlighted with color (``double'' and
3957 ``float'' in this case).
3958
3959 @item -fno-elide-type
3960 @opindex fno-elide-type
3961 @opindex felide-type
3962 By default when the C++ frontend prints diagnostics showing mismatching
3963 template types, common parts of the types are printed as ``[...]'' to
3964 simplify the error message. For example:
3965
3966 @smallexample
3967 could not convert 'std::map<int, std::vector<double> >()'
3968 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3969 @end smallexample
3970
3971 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3972 This flag also affects the output of the
3973 @option{-fdiagnostics-show-template-tree} flag.
3974
3975 @item -fno-show-column
3976 @opindex fno-show-column
3977 @opindex fshow-column
3978 Do not print column numbers in diagnostics. This may be necessary if
3979 diagnostics are being scanned by a program that does not understand the
3980 column numbers, such as @command{dejagnu}.
3981
3982 @end table
3983
3984 @node Warning Options
3985 @section Options to Request or Suppress Warnings
3986 @cindex options to control warnings
3987 @cindex warning messages
3988 @cindex messages, warning
3989 @cindex suppressing warnings
3990
3991 Warnings are diagnostic messages that report constructions that
3992 are not inherently erroneous but that are risky or suggest there
3993 may have been an error.
3994
3995 The following language-independent options do not enable specific
3996 warnings but control the kinds of diagnostics produced by GCC@.
3997
3998 @table @gcctabopt
3999 @cindex syntax checking
4000 @item -fsyntax-only
4001 @opindex fsyntax-only
4002 Check the code for syntax errors, but don't do anything beyond that.
4003
4004 @item -fmax-errors=@var{n}
4005 @opindex fmax-errors
4006 Limits the maximum number of error messages to @var{n}, at which point
4007 GCC bails out rather than attempting to continue processing the source
4008 code. If @var{n} is 0 (the default), there is no limit on the number
4009 of error messages produced. If @option{-Wfatal-errors} is also
4010 specified, then @option{-Wfatal-errors} takes precedence over this
4011 option.
4012
4013 @item -w
4014 @opindex w
4015 Inhibit all warning messages.
4016
4017 @item -Werror
4018 @opindex Werror
4019 @opindex Wno-error
4020 Make all warnings into errors.
4021
4022 @item -Werror=
4023 @opindex Werror=
4024 @opindex Wno-error=
4025 Make the specified warning into an error. The specifier for a warning
4026 is appended; for example @option{-Werror=switch} turns the warnings
4027 controlled by @option{-Wswitch} into errors. This switch takes a
4028 negative form, to be used to negate @option{-Werror} for specific
4029 warnings; for example @option{-Wno-error=switch} makes
4030 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4031 is in effect.
4032
4033 The warning message for each controllable warning includes the
4034 option that controls the warning. That option can then be used with
4035 @option{-Werror=} and @option{-Wno-error=} as described above.
4036 (Printing of the option in the warning message can be disabled using the
4037 @option{-fno-diagnostics-show-option} flag.)
4038
4039 Note that specifying @option{-Werror=}@var{foo} automatically implies
4040 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4041 imply anything.
4042
4043 @item -Wfatal-errors
4044 @opindex Wfatal-errors
4045 @opindex Wno-fatal-errors
4046 This option causes the compiler to abort compilation on the first error
4047 occurred rather than trying to keep going and printing further error
4048 messages.
4049
4050 @end table
4051
4052 You can request many specific warnings with options beginning with
4053 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4054 implicit declarations. Each of these specific warning options also
4055 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4056 example, @option{-Wno-implicit}. This manual lists only one of the
4057 two forms, whichever is not the default. For further
4058 language-specific options also refer to @ref{C++ Dialect Options} and
4059 @ref{Objective-C and Objective-C++ Dialect Options}.
4060
4061 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4062 options, such as @option{-Wunused}, which may turn on further options,
4063 such as @option{-Wunused-value}. The combined effect of positive and
4064 negative forms is that more specific options have priority over less
4065 specific ones, independently of their position in the command-line. For
4066 options of the same specificity, the last one takes effect. Options
4067 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4068 as if they appeared at the end of the command-line.
4069
4070 When an unrecognized warning option is requested (e.g.,
4071 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4072 that the option is not recognized. However, if the @option{-Wno-} form
4073 is used, the behavior is slightly different: no diagnostic is
4074 produced for @option{-Wno-unknown-warning} unless other diagnostics
4075 are being produced. This allows the use of new @option{-Wno-} options
4076 with old compilers, but if something goes wrong, the compiler
4077 warns that an unrecognized option is present.
4078
4079 @table @gcctabopt
4080 @item -Wpedantic
4081 @itemx -pedantic
4082 @opindex pedantic
4083 @opindex Wpedantic
4084 @opindex Wno-pedantic
4085 Issue all the warnings demanded by strict ISO C and ISO C++;
4086 reject all programs that use forbidden extensions, and some other
4087 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4088 version of the ISO C standard specified by any @option{-std} option used.
4089
4090 Valid ISO C and ISO C++ programs should compile properly with or without
4091 this option (though a rare few require @option{-ansi} or a
4092 @option{-std} option specifying the required version of ISO C)@. However,
4093 without this option, certain GNU extensions and traditional C and C++
4094 features are supported as well. With this option, they are rejected.
4095
4096 @option{-Wpedantic} does not cause warning messages for use of the
4097 alternate keywords whose names begin and end with @samp{__}. Pedantic
4098 warnings are also disabled in the expression that follows
4099 @code{__extension__}. However, only system header files should use
4100 these escape routes; application programs should avoid them.
4101 @xref{Alternate Keywords}.
4102
4103 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4104 C conformance. They soon find that it does not do quite what they want:
4105 it finds some non-ISO practices, but not all---only those for which
4106 ISO C @emph{requires} a diagnostic, and some others for which
4107 diagnostics have been added.
4108
4109 A feature to report any failure to conform to ISO C might be useful in
4110 some instances, but would require considerable additional work and would
4111 be quite different from @option{-Wpedantic}. We don't have plans to
4112 support such a feature in the near future.
4113
4114 Where the standard specified with @option{-std} represents a GNU
4115 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4116 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4117 extended dialect is based. Warnings from @option{-Wpedantic} are given
4118 where they are required by the base standard. (It does not make sense
4119 for such warnings to be given only for features not in the specified GNU
4120 C dialect, since by definition the GNU dialects of C include all
4121 features the compiler supports with the given option, and there would be
4122 nothing to warn about.)
4123
4124 @item -pedantic-errors
4125 @opindex pedantic-errors
4126 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4127 requires a diagnostic, in some cases where there is undefined behavior
4128 at compile-time and in some other cases that do not prevent compilation
4129 of programs that are valid according to the standard. This is not
4130 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4131 by this option and not enabled by the latter and vice versa.
4132
4133 @item -Wall
4134 @opindex Wall
4135 @opindex Wno-all
4136 This enables all the warnings about constructions that some users
4137 consider questionable, and that are easy to avoid (or modify to
4138 prevent the warning), even in conjunction with macros. This also
4139 enables some language-specific warnings described in @ref{C++ Dialect
4140 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4141
4142 @option{-Wall} turns on the following warning flags:
4143
4144 @gccoptlist{-Waddress @gol
4145 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4146 -Wbool-compare @gol
4147 -Wbool-operation @gol
4148 -Wc++11-compat -Wc++14-compat @gol
4149 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4150 -Wchar-subscripts @gol
4151 -Wcomment @gol
4152 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4153 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4154 -Wformat @gol
4155 -Wint-in-bool-context @gol
4156 -Wimplicit @r{(C and Objective-C only)} @gol
4157 -Wimplicit-int @r{(C and Objective-C only)} @gol
4158 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4159 -Winit-self @r{(only for C++)} @gol
4160 -Wlogical-not-parentheses @gol
4161 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4162 -Wmaybe-uninitialized @gol
4163 -Wmemset-elt-size @gol
4164 -Wmemset-transposed-args @gol
4165 -Wmisleading-indentation @r{(only for C/C++)} @gol
4166 -Wmissing-attributes @gol
4167 -Wmissing-braces @r{(only for C/ObjC)} @gol
4168 -Wmultistatement-macros @gol
4169 -Wnarrowing @r{(only for C++)} @gol
4170 -Wnonnull @gol
4171 -Wnonnull-compare @gol
4172 -Wopenmp-simd @gol
4173 -Wparentheses @gol
4174 -Wpessimizing-move @r{(only for C++)} @gol
4175 -Wpointer-sign @gol
4176 -Wreorder @gol
4177 -Wrestrict @gol
4178 -Wreturn-type @gol
4179 -Wsequence-point @gol
4180 -Wsign-compare @r{(only in C++)} @gol
4181 -Wsizeof-pointer-div @gol
4182 -Wsizeof-pointer-memaccess @gol
4183 -Wstrict-aliasing @gol
4184 -Wstrict-overflow=1 @gol
4185 -Wswitch @gol
4186 -Wtautological-compare @gol
4187 -Wtrigraphs @gol
4188 -Wuninitialized @gol
4189 -Wunknown-pragmas @gol
4190 -Wunused-function @gol
4191 -Wunused-label @gol
4192 -Wunused-value @gol
4193 -Wunused-variable @gol
4194 -Wvolatile-register-var @gol
4195 }
4196
4197 Note that some warning flags are not implied by @option{-Wall}. Some of
4198 them warn about constructions that users generally do not consider
4199 questionable, but which occasionally you might wish to check for;
4200 others warn about constructions that are necessary or hard to avoid in
4201 some cases, and there is no simple way to modify the code to suppress
4202 the warning. Some of them are enabled by @option{-Wextra} but many of
4203 them must be enabled individually.
4204
4205 @item -Wextra
4206 @opindex W
4207 @opindex Wextra
4208 @opindex Wno-extra
4209 This enables some extra warning flags that are not enabled by
4210 @option{-Wall}. (This option used to be called @option{-W}. The older
4211 name is still supported, but the newer name is more descriptive.)
4212
4213 @gccoptlist{-Wclobbered @gol
4214 -Wcast-function-type @gol
4215 -Wempty-body @gol
4216 -Wignored-qualifiers @gol
4217 -Wimplicit-fallthrough=3 @gol
4218 -Wmissing-field-initializers @gol
4219 -Wmissing-parameter-type @r{(C only)} @gol
4220 -Wold-style-declaration @r{(C only)} @gol
4221 -Woverride-init @gol
4222 -Wsign-compare @r{(C only)} @gol
4223 -Wredundant-move @r{(only for C++)} @gol
4224 -Wtype-limits @gol
4225 -Wuninitialized @gol
4226 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4227 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4228 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4229 }
4230
4231 The option @option{-Wextra} also prints warning messages for the
4232 following cases:
4233
4234 @itemize @bullet
4235
4236 @item
4237 A pointer is compared against integer zero with @code{<}, @code{<=},
4238 @code{>}, or @code{>=}.
4239
4240 @item
4241 (C++ only) An enumerator and a non-enumerator both appear in a
4242 conditional expression.
4243
4244 @item
4245 (C++ only) Ambiguous virtual bases.
4246
4247 @item
4248 (C++ only) Subscripting an array that has been declared @code{register}.
4249
4250 @item
4251 (C++ only) Taking the address of a variable that has been declared
4252 @code{register}.
4253
4254 @item
4255 (C++ only) A base class is not initialized in the copy constructor
4256 of a derived class.
4257
4258 @end itemize
4259
4260 @item -Wchar-subscripts
4261 @opindex Wchar-subscripts
4262 @opindex Wno-char-subscripts
4263 Warn if an array subscript has type @code{char}. This is a common cause
4264 of error, as programmers often forget that this type is signed on some
4265 machines.
4266 This warning is enabled by @option{-Wall}.
4267
4268 @item -Wchkp
4269 @opindex Wchkp
4270 @opindex Wno-chkp
4271 Warn about an invalid memory access that is found by Pointer Bounds Checker
4272 (@option{-fcheck-pointer-bounds}).
4273
4274 @item -Wno-coverage-mismatch
4275 @opindex Wno-coverage-mismatch
4276 @opindex Wcoverage-mismatch
4277 Warn if feedback profiles do not match when using the
4278 @option{-fprofile-use} option.
4279 If a source file is changed between compiling with @option{-fprofile-generate}
4280 and with @option{-fprofile-use}, the files with the profile feedback can fail
4281 to match the source file and GCC cannot use the profile feedback
4282 information. By default, this warning is enabled and is treated as an
4283 error. @option{-Wno-coverage-mismatch} can be used to disable the
4284 warning or @option{-Wno-error=coverage-mismatch} can be used to
4285 disable the error. Disabling the error for this warning can result in
4286 poorly optimized code and is useful only in the
4287 case of very minor changes such as bug fixes to an existing code-base.
4288 Completely disabling the warning is not recommended.
4289
4290 @item -Wno-cpp
4291 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4292
4293 Suppress warning messages emitted by @code{#warning} directives.
4294
4295 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4296 @opindex Wdouble-promotion
4297 @opindex Wno-double-promotion
4298 Give a warning when a value of type @code{float} is implicitly
4299 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4300 floating-point unit implement @code{float} in hardware, but emulate
4301 @code{double} in software. On such a machine, doing computations
4302 using @code{double} values is much more expensive because of the
4303 overhead required for software emulation.
4304
4305 It is easy to accidentally do computations with @code{double} because
4306 floating-point literals are implicitly of type @code{double}. For
4307 example, in:
4308 @smallexample
4309 @group
4310 float area(float radius)
4311 @{
4312 return 3.14159 * radius * radius;
4313 @}
4314 @end group
4315 @end smallexample
4316 the compiler performs the entire computation with @code{double}
4317 because the floating-point literal is a @code{double}.
4318
4319 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4320 @opindex Wduplicate-decl-specifier
4321 @opindex Wno-duplicate-decl-specifier
4322 Warn if a declaration has duplicate @code{const}, @code{volatile},
4323 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4324 @option{-Wall}.
4325
4326 @item -Wformat
4327 @itemx -Wformat=@var{n}
4328 @opindex Wformat
4329 @opindex Wno-format
4330 @opindex ffreestanding
4331 @opindex fno-builtin
4332 @opindex Wformat=
4333 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4334 the arguments supplied have types appropriate to the format string
4335 specified, and that the conversions specified in the format string make
4336 sense. This includes standard functions, and others specified by format
4337 attributes (@pxref{Function Attributes}), in the @code{printf},
4338 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4339 not in the C standard) families (or other target-specific families).
4340 Which functions are checked without format attributes having been
4341 specified depends on the standard version selected, and such checks of
4342 functions without the attribute specified are disabled by
4343 @option{-ffreestanding} or @option{-fno-builtin}.
4344
4345 The formats are checked against the format features supported by GNU
4346 libc version 2.2. These include all ISO C90 and C99 features, as well
4347 as features from the Single Unix Specification and some BSD and GNU
4348 extensions. Other library implementations may not support all these
4349 features; GCC does not support warning about features that go beyond a
4350 particular library's limitations. However, if @option{-Wpedantic} is used
4351 with @option{-Wformat}, warnings are given about format features not
4352 in the selected standard version (but not for @code{strfmon} formats,
4353 since those are not in any version of the C standard). @xref{C Dialect
4354 Options,,Options Controlling C Dialect}.
4355
4356 @table @gcctabopt
4357 @item -Wformat=1
4358 @itemx -Wformat
4359 @opindex Wformat
4360 @opindex Wformat=1
4361 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4362 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4363 @option{-Wformat} also checks for null format arguments for several
4364 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4365 aspects of this level of format checking can be disabled by the
4366 options: @option{-Wno-format-contains-nul},
4367 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4368 @option{-Wformat} is enabled by @option{-Wall}.
4369
4370 @item -Wno-format-contains-nul
4371 @opindex Wno-format-contains-nul
4372 @opindex Wformat-contains-nul
4373 If @option{-Wformat} is specified, do not warn about format strings that
4374 contain NUL bytes.
4375
4376 @item -Wno-format-extra-args
4377 @opindex Wno-format-extra-args
4378 @opindex Wformat-extra-args
4379 If @option{-Wformat} is specified, do not warn about excess arguments to a
4380 @code{printf} or @code{scanf} format function. The C standard specifies
4381 that such arguments are ignored.
4382
4383 Where the unused arguments lie between used arguments that are
4384 specified with @samp{$} operand number specifications, normally
4385 warnings are still given, since the implementation could not know what
4386 type to pass to @code{va_arg} to skip the unused arguments. However,
4387 in the case of @code{scanf} formats, this option suppresses the
4388 warning if the unused arguments are all pointers, since the Single
4389 Unix Specification says that such unused arguments are allowed.
4390
4391 @item -Wformat-overflow
4392 @itemx -Wformat-overflow=@var{level}
4393 @opindex Wformat-overflow
4394 @opindex Wno-format-overflow
4395 Warn about calls to formatted input/output functions such as @code{sprintf}
4396 and @code{vsprintf} that might overflow the destination buffer. When the
4397 exact number of bytes written by a format directive cannot be determined
4398 at compile-time it is estimated based on heuristics that depend on the
4399 @var{level} argument and on optimization. While enabling optimization
4400 will in most cases improve the accuracy of the warning, it may also
4401 result in false positives.
4402
4403 @table @gcctabopt
4404 @item -Wformat-overflow
4405 @itemx -Wformat-overflow=1
4406 @opindex Wformat-overflow
4407 @opindex Wno-format-overflow
4408 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4409 employs a conservative approach that warns only about calls that most
4410 likely overflow the buffer. At this level, numeric arguments to format
4411 directives with unknown values are assumed to have the value of one, and
4412 strings of unknown length to be empty. Numeric arguments that are known
4413 to be bounded to a subrange of their type, or string arguments whose output
4414 is bounded either by their directive's precision or by a finite set of
4415 string literals, are assumed to take on the value within the range that
4416 results in the most bytes on output. For example, the call to @code{sprintf}
4417 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4418 the terminating NUL character (@code{'\0'}) appended by the function
4419 to the destination buffer will be written past its end. Increasing
4420 the size of the buffer by a single byte is sufficient to avoid the
4421 warning, though it may not be sufficient to avoid the overflow.
4422
4423 @smallexample
4424 void f (int a, int b)
4425 @{
4426 char buf [13];
4427 sprintf (buf, "a = %i, b = %i\n", a, b);
4428 @}
4429 @end smallexample
4430
4431 @item -Wformat-overflow=2
4432 Level @var{2} warns also about calls that might overflow the destination
4433 buffer given an argument of sufficient length or magnitude. At level
4434 @var{2}, unknown numeric arguments are assumed to have the minimum
4435 representable value for signed types with a precision greater than 1, and
4436 the maximum representable value otherwise. Unknown string arguments whose
4437 length cannot be assumed to be bounded either by the directive's precision,
4438 or by a finite set of string literals they may evaluate to, or the character
4439 array they may point to, are assumed to be 1 character long.
4440
4441 At level @var{2}, the call in the example above is again diagnosed, but
4442 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4443 @code{%i} directive will write some of its digits beyond the end of
4444 the destination buffer. To make the call safe regardless of the values
4445 of the two variables, the size of the destination buffer must be increased
4446 to at least 34 bytes. GCC includes the minimum size of the buffer in
4447 an informational note following the warning.
4448
4449 An alternative to increasing the size of the destination buffer is to
4450 constrain the range of formatted values. The maximum length of string
4451 arguments can be bounded by specifying the precision in the format
4452 directive. When numeric arguments of format directives can be assumed
4453 to be bounded by less than the precision of their type, choosing
4454 an appropriate length modifier to the format specifier will reduce
4455 the required buffer size. For example, if @var{a} and @var{b} in the
4456 example above can be assumed to be within the precision of
4457 the @code{short int} type then using either the @code{%hi} format
4458 directive or casting the argument to @code{short} reduces the maximum
4459 required size of the buffer to 24 bytes.
4460
4461 @smallexample
4462 void f (int a, int b)
4463 @{
4464 char buf [23];
4465 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4466 @}
4467 @end smallexample
4468 @end table
4469
4470 @item -Wno-format-zero-length
4471 @opindex Wno-format-zero-length
4472 @opindex Wformat-zero-length
4473 If @option{-Wformat} is specified, do not warn about zero-length formats.
4474 The C standard specifies that zero-length formats are allowed.
4475
4476
4477 @item -Wformat=2
4478 @opindex Wformat=2
4479 Enable @option{-Wformat} plus additional format checks. Currently
4480 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4481 -Wformat-y2k}.
4482
4483 @item -Wformat-nonliteral
4484 @opindex Wformat-nonliteral
4485 @opindex Wno-format-nonliteral
4486 If @option{-Wformat} is specified, also warn if the format string is not a
4487 string literal and so cannot be checked, unless the format function
4488 takes its format arguments as a @code{va_list}.
4489
4490 @item -Wformat-security
4491 @opindex Wformat-security
4492 @opindex Wno-format-security
4493 If @option{-Wformat} is specified, also warn about uses of format
4494 functions that represent possible security problems. At present, this
4495 warns about calls to @code{printf} and @code{scanf} functions where the
4496 format string is not a string literal and there are no format arguments,
4497 as in @code{printf (foo);}. This may be a security hole if the format
4498 string came from untrusted input and contains @samp{%n}. (This is
4499 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4500 in future warnings may be added to @option{-Wformat-security} that are not
4501 included in @option{-Wformat-nonliteral}.)
4502
4503 @item -Wformat-signedness
4504 @opindex Wformat-signedness
4505 @opindex Wno-format-signedness
4506 If @option{-Wformat} is specified, also warn if the format string
4507 requires an unsigned argument and the argument is signed and vice versa.
4508
4509 @item -Wformat-truncation
4510 @itemx -Wformat-truncation=@var{level}
4511 @opindex Wformat-truncation
4512 @opindex Wno-format-truncation
4513 Warn about calls to formatted input/output functions such as @code{snprintf}
4514 and @code{vsnprintf} that might result in output truncation. When the exact
4515 number of bytes written by a format directive cannot be determined at
4516 compile-time it is estimated based on heuristics that depend on
4517 the @var{level} argument and on optimization. While enabling optimization
4518 will in most cases improve the accuracy of the warning, it may also result
4519 in false positives. Except as noted otherwise, the option uses the same
4520 logic @option{-Wformat-overflow}.
4521
4522 @table @gcctabopt
4523 @item -Wformat-truncation
4524 @itemx -Wformat-truncation=1
4525 @opindex Wformat-truncation
4526 @opindex Wno-format-truncation
4527 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4528 employs a conservative approach that warns only about calls to bounded
4529 functions whose return value is unused and that will most likely result
4530 in output truncation.
4531
4532 @item -Wformat-truncation=2
4533 Level @var{2} warns also about calls to bounded functions whose return
4534 value is used and that might result in truncation given an argument of
4535 sufficient length or magnitude.
4536 @end table
4537
4538 @item -Wformat-y2k
4539 @opindex Wformat-y2k
4540 @opindex Wno-format-y2k
4541 If @option{-Wformat} is specified, also warn about @code{strftime}
4542 formats that may yield only a two-digit year.
4543 @end table
4544
4545 @item -Wnonnull
4546 @opindex Wnonnull
4547 @opindex Wno-nonnull
4548 Warn about passing a null pointer for arguments marked as
4549 requiring a non-null value by the @code{nonnull} function attribute.
4550
4551 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4552 can be disabled with the @option{-Wno-nonnull} option.
4553
4554 @item -Wnonnull-compare
4555 @opindex Wnonnull-compare
4556 @opindex Wno-nonnull-compare
4557 Warn when comparing an argument marked with the @code{nonnull}
4558 function attribute against null inside the function.
4559
4560 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4561 can be disabled with the @option{-Wno-nonnull-compare} option.
4562
4563 @item -Wnull-dereference
4564 @opindex Wnull-dereference
4565 @opindex Wno-null-dereference
4566 Warn if the compiler detects paths that trigger erroneous or
4567 undefined behavior due to dereferencing a null pointer. This option
4568 is only active when @option{-fdelete-null-pointer-checks} is active,
4569 which is enabled by optimizations in most targets. The precision of
4570 the warnings depends on the optimization options used.
4571
4572 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4573 @opindex Winit-self
4574 @opindex Wno-init-self
4575 Warn about uninitialized variables that are initialized with themselves.
4576 Note this option can only be used with the @option{-Wuninitialized} option.
4577
4578 For example, GCC warns about @code{i} being uninitialized in the
4579 following snippet only when @option{-Winit-self} has been specified:
4580 @smallexample
4581 @group
4582 int f()
4583 @{
4584 int i = i;
4585 return i;
4586 @}
4587 @end group
4588 @end smallexample
4589
4590 This warning is enabled by @option{-Wall} in C++.
4591
4592 @item -Wimplicit-int @r{(C and Objective-C only)}
4593 @opindex Wimplicit-int
4594 @opindex Wno-implicit-int
4595 Warn when a declaration does not specify a type.
4596 This warning is enabled by @option{-Wall}.
4597
4598 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4599 @opindex Wimplicit-function-declaration
4600 @opindex Wno-implicit-function-declaration
4601 Give a warning whenever a function is used before being declared. In
4602 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4603 enabled by default and it is made into an error by
4604 @option{-pedantic-errors}. This warning is also enabled by
4605 @option{-Wall}.
4606
4607 @item -Wimplicit @r{(C and Objective-C only)}
4608 @opindex Wimplicit
4609 @opindex Wno-implicit
4610 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4611 This warning is enabled by @option{-Wall}.
4612
4613 @item -Wimplicit-fallthrough
4614 @opindex Wimplicit-fallthrough
4615 @opindex Wno-implicit-fallthrough
4616 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4617 and @option{-Wno-implicit-fallthrough} is the same as
4618 @option{-Wimplicit-fallthrough=0}.
4619
4620 @item -Wimplicit-fallthrough=@var{n}
4621 @opindex Wimplicit-fallthrough=
4622 Warn when a switch case falls through. For example:
4623
4624 @smallexample
4625 @group
4626 switch (cond)
4627 @{
4628 case 1:
4629 a = 1;
4630 break;
4631 case 2:
4632 a = 2;
4633 case 3:
4634 a = 3;
4635 break;
4636 @}
4637 @end group
4638 @end smallexample
4639
4640 This warning does not warn when the last statement of a case cannot
4641 fall through, e.g. when there is a return statement or a call to function
4642 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4643 also takes into account control flow statements, such as ifs, and only
4644 warns when appropriate. E.g.@:
4645
4646 @smallexample
4647 @group
4648 switch (cond)
4649 @{
4650 case 1:
4651 if (i > 3) @{
4652 bar (5);
4653 break;
4654 @} else if (i < 1) @{
4655 bar (0);
4656 @} else
4657 return;
4658 default:
4659 @dots{}
4660 @}
4661 @end group
4662 @end smallexample
4663
4664 Since there are occasions where a switch case fall through is desirable,
4665 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4666 to be used along with a null statement to suppress this warning that
4667 would normally occur:
4668
4669 @smallexample
4670 @group
4671 switch (cond)
4672 @{
4673 case 1:
4674 bar (0);
4675 __attribute__ ((fallthrough));
4676 default:
4677 @dots{}
4678 @}
4679 @end group
4680 @end smallexample
4681
4682 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4683 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4684 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4685 Instead of these attributes, it is also possible to add a fallthrough comment
4686 to silence the warning. The whole body of the C or C++ style comment should
4687 match the given regular expressions listed below. The option argument @var{n}
4688 specifies what kind of comments are accepted:
4689
4690 @itemize @bullet
4691
4692 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4693
4694 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4695 expression, any comment is used as fallthrough comment.
4696
4697 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4698 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4699
4700 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4701 following regular expressions:
4702
4703 @itemize @bullet
4704
4705 @item @code{-fallthrough}
4706
4707 @item @code{@@fallthrough@@}
4708
4709 @item @code{lint -fallthrough[ \t]*}
4710
4711 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4712
4713 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4714
4715 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4716
4717 @end itemize
4718
4719 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4720 following regular expressions:
4721
4722 @itemize @bullet
4723
4724 @item @code{-fallthrough}
4725
4726 @item @code{@@fallthrough@@}
4727
4728 @item @code{lint -fallthrough[ \t]*}
4729
4730 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4731
4732 @end itemize
4733
4734 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4735 fallthrough comments, only attributes disable the warning.
4736
4737 @end itemize
4738
4739 The comment needs to be followed after optional whitespace and other comments
4740 by @code{case} or @code{default} keywords or by a user label that precedes some
4741 @code{case} or @code{default} label.
4742
4743 @smallexample
4744 @group
4745 switch (cond)
4746 @{
4747 case 1:
4748 bar (0);
4749 /* FALLTHRU */
4750 default:
4751 @dots{}
4752 @}
4753 @end group
4754 @end smallexample
4755
4756 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4757
4758 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4759 @opindex Wif-not-aligned
4760 @opindex Wno-if-not-aligned
4761 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4762 should be issued. This is enabled by default.
4763 Use @option{-Wno-if-not-aligned} to disable it.
4764
4765 @item -Wignored-qualifiers @r{(C and C++ only)}
4766 @opindex Wignored-qualifiers
4767 @opindex Wno-ignored-qualifiers
4768 Warn if the return type of a function has a type qualifier
4769 such as @code{const}. For ISO C such a type qualifier has no effect,
4770 since the value returned by a function is not an lvalue.
4771 For C++, the warning is only emitted for scalar types or @code{void}.
4772 ISO C prohibits qualified @code{void} return types on function
4773 definitions, so such return types always receive a warning
4774 even without this option.
4775
4776 This warning is also enabled by @option{-Wextra}.
4777
4778 @item -Wignored-attributes @r{(C and C++ only)}
4779 @opindex Wignored-attributes
4780 @opindex Wno-ignored-attributes
4781 Warn when an attribute is ignored. This is different from the
4782 @option{-Wattributes} option in that it warns whenever the compiler decides
4783 to drop an attribute, not that the attribute is either unknown, used in a
4784 wrong place, etc. This warning is enabled by default.
4785
4786 @item -Wmain
4787 @opindex Wmain
4788 @opindex Wno-main
4789 Warn if the type of @code{main} is suspicious. @code{main} should be
4790 a function with external linkage, returning int, taking either zero
4791 arguments, two, or three arguments of appropriate types. This warning
4792 is enabled by default in C++ and is enabled by either @option{-Wall}
4793 or @option{-Wpedantic}.
4794
4795 @item -Wmisleading-indentation @r{(C and C++ only)}
4796 @opindex Wmisleading-indentation
4797 @opindex Wno-misleading-indentation
4798 Warn when the indentation of the code does not reflect the block structure.
4799 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4800 @code{for} clauses with a guarded statement that does not use braces,
4801 followed by an unguarded statement with the same indentation.
4802
4803 In the following example, the call to ``bar'' is misleadingly indented as
4804 if it were guarded by the ``if'' conditional.
4805
4806 @smallexample
4807 if (some_condition ())
4808 foo ();
4809 bar (); /* Gotcha: this is not guarded by the "if". */
4810 @end smallexample
4811
4812 In the case of mixed tabs and spaces, the warning uses the
4813 @option{-ftabstop=} option to determine if the statements line up
4814 (defaulting to 8).
4815
4816 The warning is not issued for code involving multiline preprocessor logic
4817 such as the following example.
4818
4819 @smallexample
4820 if (flagA)
4821 foo (0);
4822 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4823 if (flagB)
4824 #endif
4825 foo (1);
4826 @end smallexample
4827
4828 The warning is not issued after a @code{#line} directive, since this
4829 typically indicates autogenerated code, and no assumptions can be made
4830 about the layout of the file that the directive references.
4831
4832 This warning is enabled by @option{-Wall} in C and C++.
4833
4834 @item -Wno-missing-attributes
4835 @opindex Wmissing-attributes
4836 @opindex Wno-missing-attributes
4837 Warn when a declaration of a function is missing one or more attributes
4838 that a related function is declared with and whose absence may adversely
4839 affect the correctness or efficiency of generated code. For example,
4840 the warning is issued for declarations of aliases that use attributes
4841 to specify less restrictive requirements than those of their targets.
4842 This typically represents a potential optimization oportunity rather
4843 than a hidden bug. The @option{-Wattribute-alias} option controls warnings
4844 issued for mismatches between declarations of aliases and their targets
4845 that might be indicative of code generation bugs.
4846 Attributes considered include @code{alloc_align}, @code{alloc_size},
4847 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
4848 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
4849 @code{returns_nonnull}, and @code{returns_twice}.
4850
4851 In C++, the warning is issued when an explicit specialization of a primary
4852 template declared with attribute @code{alloc_align}, @code{alloc_size},
4853 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4854 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4855 @code{error}, and @code{warning} suppress the warning.
4856 (@pxref{Function Attributes}).
4857
4858 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4859
4860 For example, since the declaration of the primary function template
4861 below makes use of both attribute @code{malloc} and @code{alloc_size}
4862 the declaration of the explicit specialization of the template is
4863 diagnosed because it is missing one of the attributes.
4864
4865 @smallexample
4866 template <class T>
4867 T* __attribute__ ((malloc, alloc_size (1)))
4868 allocate (size_t);
4869
4870 template <>
4871 void* __attribute__ ((malloc)) // missing alloc_size
4872 allocate<void> (size_t);
4873 @end smallexample
4874
4875 @item -Wmissing-braces
4876 @opindex Wmissing-braces
4877 @opindex Wno-missing-braces
4878 Warn if an aggregate or union initializer is not fully bracketed. In
4879 the following example, the initializer for @code{a} is not fully
4880 bracketed, but that for @code{b} is fully bracketed. This warning is
4881 enabled by @option{-Wall} in C.
4882
4883 @smallexample
4884 int a[2][2] = @{ 0, 1, 2, 3 @};
4885 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4886 @end smallexample
4887
4888 This warning is enabled by @option{-Wall}.
4889
4890 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4891 @opindex Wmissing-include-dirs
4892 @opindex Wno-missing-include-dirs
4893 Warn if a user-supplied include directory does not exist.
4894
4895 @item -Wmissing-profile
4896 @opindex Wmissing-profile
4897 @opindex Wno-missing-profile
4898 Warn if feedback profiles are missing when using the
4899 @option{-fprofile-use} option.
4900 This option diagnoses those cases where a new function or a new file is added
4901 to the user code between compiling with @option{-fprofile-generate} and with
4902 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
4903 profile feedback data files do not contain any profile feedback information for
4904 the newly added function or file respectively. Also, in the case when profile
4905 count data (.gcda) files are removed, GCC cannot use any profile feedback
4906 information. In all these cases, warnings are issued to inform the user that a
4907 profile generation step is due. @option{-Wno-missing-profile} can be used to
4908 disable the warning. Ignoring the warning can result in poorly optimized code.
4909 Completely disabling the warning is not recommended and should be done only
4910 when non-existent profile data is justified.
4911
4912 @item -Wmultistatement-macros
4913 @opindex Wmultistatement-macros
4914 @opindex Wno-multistatement-macros
4915 Warn about unsafe multiple statement macros that appear to be guarded
4916 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4917 @code{while}, in which only the first statement is actually guarded after
4918 the macro is expanded.
4919
4920 For example:
4921
4922 @smallexample
4923 #define DOIT x++; y++
4924 if (c)
4925 DOIT;
4926 @end smallexample
4927
4928 will increment @code{y} unconditionally, not just when @code{c} holds.
4929 The can usually be fixed by wrapping the macro in a do-while loop:
4930 @smallexample
4931 #define DOIT do @{ x++; y++; @} while (0)
4932 if (c)
4933 DOIT;
4934 @end smallexample
4935
4936 This warning is enabled by @option{-Wall} in C and C++.
4937
4938 @item -Wparentheses
4939 @opindex Wparentheses
4940 @opindex Wno-parentheses
4941 Warn if parentheses are omitted in certain contexts, such
4942 as when there is an assignment in a context where a truth value
4943 is expected, or when operators are nested whose precedence people
4944 often get confused about.
4945
4946 Also warn if a comparison like @code{x<=y<=z} appears; this is
4947 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4948 interpretation from that of ordinary mathematical notation.
4949
4950 Also warn for dangerous uses of the GNU extension to
4951 @code{?:} with omitted middle operand. When the condition
4952 in the @code{?}: operator is a boolean expression, the omitted value is
4953 always 1. Often programmers expect it to be a value computed
4954 inside the conditional expression instead.
4955
4956 For C++ this also warns for some cases of unnecessary parentheses in
4957 declarations, which can indicate an attempt at a function call instead
4958 of a declaration:
4959 @smallexample
4960 @{
4961 // Declares a local variable called mymutex.
4962 std::unique_lock<std::mutex> (mymutex);
4963 // User meant std::unique_lock<std::mutex> lock (mymutex);
4964 @}
4965 @end smallexample
4966
4967 This warning is enabled by @option{-Wall}.
4968
4969 @item -Wsequence-point
4970 @opindex Wsequence-point
4971 @opindex Wno-sequence-point
4972 Warn about code that may have undefined semantics because of violations
4973 of sequence point rules in the C and C++ standards.
4974
4975 The C and C++ standards define the order in which expressions in a C/C++
4976 program are evaluated in terms of @dfn{sequence points}, which represent
4977 a partial ordering between the execution of parts of the program: those
4978 executed before the sequence point, and those executed after it. These
4979 occur after the evaluation of a full expression (one which is not part
4980 of a larger expression), after the evaluation of the first operand of a
4981 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4982 function is called (but after the evaluation of its arguments and the
4983 expression denoting the called function), and in certain other places.
4984 Other than as expressed by the sequence point rules, the order of
4985 evaluation of subexpressions of an expression is not specified. All
4986 these rules describe only a partial order rather than a total order,
4987 since, for example, if two functions are called within one expression
4988 with no sequence point between them, the order in which the functions
4989 are called is not specified. However, the standards committee have
4990 ruled that function calls do not overlap.
4991
4992 It is not specified when between sequence points modifications to the
4993 values of objects take effect. Programs whose behavior depends on this
4994 have undefined behavior; the C and C++ standards specify that ``Between
4995 the previous and next sequence point an object shall have its stored
4996 value modified at most once by the evaluation of an expression.
4997 Furthermore, the prior value shall be read only to determine the value
4998 to be stored.''. If a program breaks these rules, the results on any
4999 particular implementation are entirely unpredictable.
5000
5001 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5002 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5003 diagnosed by this option, and it may give an occasional false positive
5004 result, but in general it has been found fairly effective at detecting
5005 this sort of problem in programs.
5006
5007 The C++17 standard will define the order of evaluation of operands in
5008 more cases: in particular it requires that the right-hand side of an
5009 assignment be evaluated before the left-hand side, so the above
5010 examples are no longer undefined. But this warning will still warn
5011 about them, to help people avoid writing code that is undefined in C
5012 and earlier revisions of C++.
5013
5014 The standard is worded confusingly, therefore there is some debate
5015 over the precise meaning of the sequence point rules in subtle cases.
5016 Links to discussions of the problem, including proposed formal
5017 definitions, may be found on the GCC readings page, at
5018 @uref{http://gcc.gnu.org/@/readings.html}.
5019
5020 This warning is enabled by @option{-Wall} for C and C++.
5021
5022 @item -Wno-return-local-addr
5023 @opindex Wno-return-local-addr
5024 @opindex Wreturn-local-addr
5025 Do not warn about returning a pointer (or in C++, a reference) to a
5026 variable that goes out of scope after the function returns.
5027
5028 @item -Wreturn-type
5029 @opindex Wreturn-type
5030 @opindex Wno-return-type
5031 Warn whenever a function is defined with a return type that defaults
5032 to @code{int}. Also warn about any @code{return} statement with no
5033 return value in a function whose return type is not @code{void}
5034 (falling off the end of the function body is considered returning
5035 without a value).
5036
5037 For C only, warn about a @code{return} statement with an expression in a
5038 function whose return type is @code{void}, unless the expression type is
5039 also @code{void}. As a GNU extension, the latter case is accepted
5040 without a warning unless @option{-Wpedantic} is used.
5041
5042 For C++, a function without return type always produces a diagnostic
5043 message, even when @option{-Wno-return-type} is specified. The only
5044 exceptions are @code{main} and functions defined in system headers.
5045
5046 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
5047
5048 @item -Wshift-count-negative
5049 @opindex Wshift-count-negative
5050 @opindex Wno-shift-count-negative
5051 Warn if shift count is negative. This warning is enabled by default.
5052
5053 @item -Wshift-count-overflow
5054 @opindex Wshift-count-overflow
5055 @opindex Wno-shift-count-overflow
5056 Warn if shift count >= width of type. This warning is enabled by default.
5057
5058 @item -Wshift-negative-value
5059 @opindex Wshift-negative-value
5060 @opindex Wno-shift-negative-value
5061 Warn if left shifting a negative value. This warning is enabled by
5062 @option{-Wextra} in C99 and C++11 modes (and newer).
5063
5064 @item -Wshift-overflow
5065 @itemx -Wshift-overflow=@var{n}
5066 @opindex Wshift-overflow
5067 @opindex Wno-shift-overflow
5068 Warn about left shift overflows. This warning is enabled by
5069 default in C99 and C++11 modes (and newer).
5070
5071 @table @gcctabopt
5072 @item -Wshift-overflow=1
5073 This is the warning level of @option{-Wshift-overflow} and is enabled
5074 by default in C99 and C++11 modes (and newer). This warning level does
5075 not warn about left-shifting 1 into the sign bit. (However, in C, such
5076 an overflow is still rejected in contexts where an integer constant expression
5077 is required.)
5078
5079 @item -Wshift-overflow=2
5080 This warning level also warns about left-shifting 1 into the sign bit,
5081 unless C++14 mode is active.
5082 @end table
5083
5084 @item -Wswitch
5085 @opindex Wswitch
5086 @opindex Wno-switch
5087 Warn whenever a @code{switch} statement has an index of enumerated type
5088 and lacks a @code{case} for one or more of the named codes of that
5089 enumeration. (The presence of a @code{default} label prevents this
5090 warning.) @code{case} labels outside the enumeration range also
5091 provoke warnings when this option is used (even if there is a
5092 @code{default} label).
5093 This warning is enabled by @option{-Wall}.
5094
5095 @item -Wswitch-default
5096 @opindex Wswitch-default
5097 @opindex Wno-switch-default
5098 Warn whenever a @code{switch} statement does not have a @code{default}
5099 case.
5100
5101 @item -Wswitch-enum
5102 @opindex Wswitch-enum
5103 @opindex Wno-switch-enum
5104 Warn whenever a @code{switch} statement has an index of enumerated type
5105 and lacks a @code{case} for one or more of the named codes of that
5106 enumeration. @code{case} labels outside the enumeration range also
5107 provoke warnings when this option is used. The only difference
5108 between @option{-Wswitch} and this option is that this option gives a
5109 warning about an omitted enumeration code even if there is a
5110 @code{default} label.
5111
5112 @item -Wswitch-bool
5113 @opindex Wswitch-bool
5114 @opindex Wno-switch-bool
5115 Warn whenever a @code{switch} statement has an index of boolean type
5116 and the case values are outside the range of a boolean type.
5117 It is possible to suppress this warning by casting the controlling
5118 expression to a type other than @code{bool}. For example:
5119 @smallexample
5120 @group
5121 switch ((int) (a == 4))
5122 @{
5123 @dots{}
5124 @}
5125 @end group
5126 @end smallexample
5127 This warning is enabled by default for C and C++ programs.
5128
5129 @item -Wswitch-unreachable
5130 @opindex Wswitch-unreachable
5131 @opindex Wno-switch-unreachable
5132 Warn whenever a @code{switch} statement contains statements between the
5133 controlling expression and the first case label, which will never be
5134 executed. For example:
5135 @smallexample
5136 @group
5137 switch (cond)
5138 @{
5139 i = 15;
5140 @dots{}
5141 case 5:
5142 @dots{}
5143 @}
5144 @end group
5145 @end smallexample
5146 @option{-Wswitch-unreachable} does not warn if the statement between the
5147 controlling expression and the first case label is just a declaration:
5148 @smallexample
5149 @group
5150 switch (cond)
5151 @{
5152 int i;
5153 @dots{}
5154 case 5:
5155 i = 5;
5156 @dots{}
5157 @}
5158 @end group
5159 @end smallexample
5160 This warning is enabled by default for C and C++ programs.
5161
5162 @item -Wsync-nand @r{(C and C++ only)}
5163 @opindex Wsync-nand
5164 @opindex Wno-sync-nand
5165 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5166 built-in functions are used. These functions changed semantics in GCC 4.4.
5167
5168 @item -Wunused-but-set-parameter
5169 @opindex Wunused-but-set-parameter
5170 @opindex Wno-unused-but-set-parameter
5171 Warn whenever a function parameter is assigned to, but otherwise unused
5172 (aside from its declaration).
5173
5174 To suppress this warning use the @code{unused} attribute
5175 (@pxref{Variable Attributes}).
5176
5177 This warning is also enabled by @option{-Wunused} together with
5178 @option{-Wextra}.
5179
5180 @item -Wunused-but-set-variable
5181 @opindex Wunused-but-set-variable
5182 @opindex Wno-unused-but-set-variable
5183 Warn whenever a local variable is assigned to, but otherwise unused
5184 (aside from its declaration).
5185 This warning is enabled by @option{-Wall}.
5186
5187 To suppress this warning use the @code{unused} attribute
5188 (@pxref{Variable Attributes}).
5189
5190 This warning is also enabled by @option{-Wunused}, which is enabled
5191 by @option{-Wall}.
5192
5193 @item -Wunused-function
5194 @opindex Wunused-function
5195 @opindex Wno-unused-function
5196 Warn whenever a static function is declared but not defined or a
5197 non-inline static function is unused.
5198 This warning is enabled by @option{-Wall}.
5199
5200 @item -Wunused-label
5201 @opindex Wunused-label
5202 @opindex Wno-unused-label
5203 Warn whenever a label is declared but not used.
5204 This warning is enabled by @option{-Wall}.
5205
5206 To suppress this warning use the @code{unused} attribute
5207 (@pxref{Variable Attributes}).
5208
5209 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5210 @opindex Wunused-local-typedefs
5211 @opindex Wno-unused-local-typedefs
5212 Warn when a typedef locally defined in a function is not used.
5213 This warning is enabled by @option{-Wall}.
5214
5215 @item -Wunused-parameter
5216 @opindex Wunused-parameter
5217 @opindex Wno-unused-parameter
5218 Warn whenever a function parameter is unused aside from its declaration.
5219
5220 To suppress this warning use the @code{unused} attribute
5221 (@pxref{Variable Attributes}).
5222
5223 @item -Wno-unused-result
5224 @opindex Wunused-result
5225 @opindex Wno-unused-result
5226 Do not warn if a caller of a function marked with attribute
5227 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5228 its return value. The default is @option{-Wunused-result}.
5229
5230 @item -Wunused-variable
5231 @opindex Wunused-variable
5232 @opindex Wno-unused-variable
5233 Warn whenever a local or static variable is unused aside from its
5234 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5235 but not for C++. This warning is enabled by @option{-Wall}.
5236
5237 To suppress this warning use the @code{unused} attribute
5238 (@pxref{Variable Attributes}).
5239
5240 @item -Wunused-const-variable
5241 @itemx -Wunused-const-variable=@var{n}
5242 @opindex Wunused-const-variable
5243 @opindex Wno-unused-const-variable
5244 Warn whenever a constant static variable is unused aside from its declaration.
5245 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5246 for C, but not for C++. In C this declares variable storage, but in C++ this
5247 is not an error since const variables take the place of @code{#define}s.
5248
5249 To suppress this warning use the @code{unused} attribute
5250 (@pxref{Variable Attributes}).
5251
5252 @table @gcctabopt
5253 @item -Wunused-const-variable=1
5254 This is the warning level that is enabled by @option{-Wunused-variable} for
5255 C. It warns only about unused static const variables defined in the main
5256 compilation unit, but not about static const variables declared in any
5257 header included.
5258
5259 @item -Wunused-const-variable=2
5260 This warning level also warns for unused constant static variables in
5261 headers (excluding system headers). This is the warning level of
5262 @option{-Wunused-const-variable} and must be explicitly requested since
5263 in C++ this isn't an error and in C it might be harder to clean up all
5264 headers included.
5265 @end table
5266
5267 @item -Wunused-value
5268 @opindex Wunused-value
5269 @opindex Wno-unused-value
5270 Warn whenever a statement computes a result that is explicitly not
5271 used. To suppress this warning cast the unused expression to
5272 @code{void}. This includes an expression-statement or the left-hand
5273 side of a comma expression that contains no side effects. For example,
5274 an expression such as @code{x[i,j]} causes a warning, while
5275 @code{x[(void)i,j]} does not.
5276
5277 This warning is enabled by @option{-Wall}.
5278
5279 @item -Wunused
5280 @opindex Wunused
5281 @opindex Wno-unused
5282 All the above @option{-Wunused} options combined.
5283
5284 In order to get a warning about an unused function parameter, you must
5285 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5286 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5287
5288 @item -Wuninitialized
5289 @opindex Wuninitialized
5290 @opindex Wno-uninitialized
5291 Warn if an automatic variable is used without first being initialized
5292 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5293 warn if a non-static reference or non-static @code{const} member
5294 appears in a class without constructors.
5295
5296 If you want to warn about code that uses the uninitialized value of the
5297 variable in its own initializer, use the @option{-Winit-self} option.
5298
5299 These warnings occur for individual uninitialized or clobbered
5300 elements of structure, union or array variables as well as for
5301 variables that are uninitialized or clobbered as a whole. They do
5302 not occur for variables or elements declared @code{volatile}. Because
5303 these warnings depend on optimization, the exact variables or elements
5304 for which there are warnings depends on the precise optimization
5305 options and version of GCC used.
5306
5307 Note that there may be no warning about a variable that is used only
5308 to compute a value that itself is never used, because such
5309 computations may be deleted by data flow analysis before the warnings
5310 are printed.
5311
5312 @item -Winvalid-memory-model
5313 @opindex Winvalid-memory-model
5314 @opindex Wno-invalid-memory-model
5315 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5316 and the C11 atomic generic functions with a memory consistency argument
5317 that is either invalid for the operation or outside the range of values
5318 of the @code{memory_order} enumeration. For example, since the
5319 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5320 defined for the relaxed, release, and sequentially consistent memory
5321 orders the following code is diagnosed:
5322
5323 @smallexample
5324 void store (int *i)
5325 @{
5326 __atomic_store_n (i, 0, memory_order_consume);
5327 @}
5328 @end smallexample
5329
5330 @option{-Winvalid-memory-model} is enabled by default.
5331
5332 @item -Wmaybe-uninitialized
5333 @opindex Wmaybe-uninitialized
5334 @opindex Wno-maybe-uninitialized
5335 For an automatic (i.e.@: local) variable, if there exists a path from the
5336 function entry to a use of the variable that is initialized, but there exist
5337 some other paths for which the variable is not initialized, the compiler
5338 emits a warning if it cannot prove the uninitialized paths are not
5339 executed at run time.
5340
5341 These warnings are only possible in optimizing compilation, because otherwise
5342 GCC does not keep track of the state of variables.
5343
5344 These warnings are made optional because GCC may not be able to determine when
5345 the code is correct in spite of appearing to have an error. Here is one
5346 example of how this can happen:
5347
5348 @smallexample
5349 @group
5350 @{
5351 int x;
5352 switch (y)
5353 @{
5354 case 1: x = 1;
5355 break;
5356 case 2: x = 4;
5357 break;
5358 case 3: x = 5;
5359 @}
5360 foo (x);
5361 @}
5362 @end group
5363 @end smallexample
5364
5365 @noindent
5366 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5367 always initialized, but GCC doesn't know this. To suppress the
5368 warning, you need to provide a default case with assert(0) or
5369 similar code.
5370
5371 @cindex @code{longjmp} warnings
5372 This option also warns when a non-volatile automatic variable might be
5373 changed by a call to @code{longjmp}.
5374 The compiler sees only the calls to @code{setjmp}. It cannot know
5375 where @code{longjmp} will be called; in fact, a signal handler could
5376 call it at any point in the code. As a result, you may get a warning
5377 even when there is in fact no problem because @code{longjmp} cannot
5378 in fact be called at the place that would cause a problem.
5379
5380 Some spurious warnings can be avoided if you declare all the functions
5381 you use that never return as @code{noreturn}. @xref{Function
5382 Attributes}.
5383
5384 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5385
5386 @item -Wunknown-pragmas
5387 @opindex Wunknown-pragmas
5388 @opindex Wno-unknown-pragmas
5389 @cindex warning for unknown pragmas
5390 @cindex unknown pragmas, warning
5391 @cindex pragmas, warning of unknown
5392 Warn when a @code{#pragma} directive is encountered that is not understood by
5393 GCC@. If this command-line option is used, warnings are even issued
5394 for unknown pragmas in system header files. This is not the case if
5395 the warnings are only enabled by the @option{-Wall} command-line option.
5396
5397 @item -Wno-pragmas
5398 @opindex Wno-pragmas
5399 @opindex Wpragmas
5400 Do not warn about misuses of pragmas, such as incorrect parameters,
5401 invalid syntax, or conflicts between pragmas. See also
5402 @option{-Wunknown-pragmas}.
5403
5404 @item -Wno-prio-ctor-dtor
5405 @opindex Wno-prio-ctor-dtor
5406 @opindex Wprio-ctor-dtor
5407 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5408 The use of constructor and destructor attributes allow you to assign a
5409 priority to the constructor/destructor to control its order of execution
5410 before @code{main} is called or after it returns. The priority values must be
5411 greater than 100 as the compiler reserves priority values between 0--100 for
5412 the implementation.
5413
5414 @item -Wstrict-aliasing
5415 @opindex Wstrict-aliasing
5416 @opindex Wno-strict-aliasing
5417 This option is only active when @option{-fstrict-aliasing} is active.
5418 It warns about code that might break the strict aliasing rules that the
5419 compiler is using for optimization. The warning does not catch all
5420 cases, but does attempt to catch the more common pitfalls. It is
5421 included in @option{-Wall}.
5422 It is equivalent to @option{-Wstrict-aliasing=3}
5423
5424 @item -Wstrict-aliasing=n
5425 @opindex Wstrict-aliasing=n
5426 This option is only active when @option{-fstrict-aliasing} is active.
5427 It warns about code that might break the strict aliasing rules that the
5428 compiler is using for optimization.
5429 Higher levels correspond to higher accuracy (fewer false positives).
5430 Higher levels also correspond to more effort, similar to the way @option{-O}
5431 works.
5432 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5433
5434 Level 1: Most aggressive, quick, least accurate.
5435 Possibly useful when higher levels
5436 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5437 false negatives. However, it has many false positives.
5438 Warns for all pointer conversions between possibly incompatible types,
5439 even if never dereferenced. Runs in the front end only.
5440
5441 Level 2: Aggressive, quick, not too precise.
5442 May still have many false positives (not as many as level 1 though),
5443 and few false negatives (but possibly more than level 1).
5444 Unlike level 1, it only warns when an address is taken. Warns about
5445 incomplete types. Runs in the front end only.
5446
5447 Level 3 (default for @option{-Wstrict-aliasing}):
5448 Should have very few false positives and few false
5449 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5450 Takes care of the common pun+dereference pattern in the front end:
5451 @code{*(int*)&some_float}.
5452 If optimization is enabled, it also runs in the back end, where it deals
5453 with multiple statement cases using flow-sensitive points-to information.
5454 Only warns when the converted pointer is dereferenced.
5455 Does not warn about incomplete types.
5456
5457 @item -Wstrict-overflow
5458 @itemx -Wstrict-overflow=@var{n}
5459 @opindex Wstrict-overflow
5460 @opindex Wno-strict-overflow
5461 This option is only active when signed overflow is undefined.
5462 It warns about cases where the compiler optimizes based on the
5463 assumption that signed overflow does not occur. Note that it does not
5464 warn about all cases where the code might overflow: it only warns
5465 about cases where the compiler implements some optimization. Thus
5466 this warning depends on the optimization level.
5467
5468 An optimization that assumes that signed overflow does not occur is
5469 perfectly safe if the values of the variables involved are such that
5470 overflow never does, in fact, occur. Therefore this warning can
5471 easily give a false positive: a warning about code that is not
5472 actually a problem. To help focus on important issues, several
5473 warning levels are defined. No warnings are issued for the use of
5474 undefined signed overflow when estimating how many iterations a loop
5475 requires, in particular when determining whether a loop will be
5476 executed at all.
5477
5478 @table @gcctabopt
5479 @item -Wstrict-overflow=1
5480 Warn about cases that are both questionable and easy to avoid. For
5481 example the compiler simplifies
5482 @code{x + 1 > x} to @code{1}. This level of
5483 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5484 are not, and must be explicitly requested.
5485
5486 @item -Wstrict-overflow=2
5487 Also warn about other cases where a comparison is simplified to a
5488 constant. For example: @code{abs (x) >= 0}. This can only be
5489 simplified when signed integer overflow is undefined, because
5490 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5491 zero. @option{-Wstrict-overflow} (with no level) is the same as
5492 @option{-Wstrict-overflow=2}.
5493
5494 @item -Wstrict-overflow=3
5495 Also warn about other cases where a comparison is simplified. For
5496 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5497
5498 @item -Wstrict-overflow=4
5499 Also warn about other simplifications not covered by the above cases.
5500 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5501
5502 @item -Wstrict-overflow=5
5503 Also warn about cases where the compiler reduces the magnitude of a
5504 constant involved in a comparison. For example: @code{x + 2 > y} is
5505 simplified to @code{x + 1 >= y}. This is reported only at the
5506 highest warning level because this simplification applies to many
5507 comparisons, so this warning level gives a very large number of
5508 false positives.
5509 @end table
5510
5511 @item -Wstringop-overflow
5512 @itemx -Wstringop-overflow=@var{type}
5513 @opindex Wstringop-overflow
5514 @opindex Wno-stringop-overflow
5515 Warn for calls to string manipulation functions such as @code{memcpy} and
5516 @code{strcpy} that are determined to overflow the destination buffer. The
5517 optional argument is one greater than the type of Object Size Checking to
5518 perform to determine the size of the destination. @xref{Object Size Checking}.
5519 The argument is meaningful only for functions that operate on character arrays
5520 but not for raw memory functions like @code{memcpy} which always make use
5521 of Object Size type-0. The option also warns for calls that specify a size
5522 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5523 The option produces the best results with optimization enabled but can detect
5524 a small subset of simple buffer overflows even without optimization in
5525 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5526 correspond to the standard functions. In any case, the option warns about
5527 just a subset of buffer overflows detected by the corresponding overflow
5528 checking built-ins. For example, the option will issue a warning for
5529 the @code{strcpy} call below because it copies at least 5 characters
5530 (the string @code{"blue"} including the terminating NUL) into the buffer
5531 of size 4.
5532
5533 @smallexample
5534 enum Color @{ blue, purple, yellow @};
5535 const char* f (enum Color clr)
5536 @{
5537 static char buf [4];
5538 const char *str;
5539 switch (clr)
5540 @{
5541 case blue: str = "blue"; break;
5542 case purple: str = "purple"; break;
5543 case yellow: str = "yellow"; break;
5544 @}
5545
5546 return strcpy (buf, str); // warning here
5547 @}
5548 @end smallexample
5549
5550 Option @option{-Wstringop-overflow=2} is enabled by default.
5551
5552 @table @gcctabopt
5553 @item -Wstringop-overflow
5554 @itemx -Wstringop-overflow=1
5555 @opindex Wstringop-overflow
5556 @opindex Wno-stringop-overflow
5557 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5558 to determine the sizes of destination objects. This is the default setting
5559 of the option. At this setting the option will not warn for writes past
5560 the end of subobjects of larger objects accessed by pointers unless the
5561 size of the largest surrounding object is known. When the destination may
5562 be one of several objects it is assumed to be the largest one of them. On
5563 Linux systems, when optimization is enabled at this setting the option warns
5564 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5565 a non-zero value.
5566
5567 @item -Wstringop-overflow=2
5568 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5569 to determine the sizes of destination objects. At this setting the option
5570 will warn about overflows when writing to members of the largest complete
5571 objects whose exact size is known. It will, however, not warn for excessive
5572 writes to the same members of unknown objects referenced by pointers since
5573 they may point to arrays containing unknown numbers of elements.
5574
5575 @item -Wstringop-overflow=3
5576 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5577 to determine the sizes of destination objects. At this setting the option
5578 warns about overflowing the smallest object or data member. This is the
5579 most restrictive setting of the option that may result in warnings for safe
5580 code.
5581
5582 @item -Wstringop-overflow=4
5583 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5584 to determine the sizes of destination objects. At this setting the option
5585 will warn about overflowing any data members, and when the destination is
5586 one of several objects it uses the size of the largest of them to decide
5587 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5588 setting of the option may result in warnings for benign code.
5589 @end table
5590
5591 @item -Wstringop-truncation
5592 @opindex Wstringop-truncation
5593 @opindex Wno-stringop-truncation
5594 Warn for calls to bounded string manipulation functions such as @code{strncat},
5595 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5596 or leave the destination unchanged.
5597
5598 In the following example, the call to @code{strncat} specifies a bound that
5599 is less than the length of the source string. As a result, the copy of
5600 the source will be truncated and so the call is diagnosed. To avoid the
5601 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5602
5603 @smallexample
5604 void append (char *buf, size_t bufsize)
5605 @{
5606 strncat (buf, ".txt", 3);
5607 @}
5608 @end smallexample
5609
5610 As another example, the following call to @code{strncpy} results in copying
5611 to @code{d} just the characters preceding the terminating NUL, without
5612 appending the NUL to the end. Assuming the result of @code{strncpy} is
5613 necessarily a NUL-terminated string is a common mistake, and so the call
5614 is diagnosed. To avoid the warning when the result is not expected to be
5615 NUL-terminated, call @code{memcpy} instead.
5616
5617 @smallexample
5618 void copy (char *d, const char *s)
5619 @{
5620 strncpy (d, s, strlen (s));
5621 @}
5622 @end smallexample
5623
5624 In the following example, the call to @code{strncpy} specifies the size
5625 of the destination buffer as the bound. If the length of the source
5626 string is equal to or greater than this size the result of the copy will
5627 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5628 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5629 element of the buffer to @code{NUL}.
5630
5631 @smallexample
5632 void copy (const char *s)
5633 @{
5634 char buf[80];
5635 strncpy (buf, s, sizeof buf);
5636 @dots{}
5637 @}
5638 @end smallexample
5639
5640 In situations where a character array is intended to store a sequence
5641 of bytes with no terminating @code{NUL} such an array may be annotated
5642 with attribute @code{nonstring} to avoid this warning. Such arrays,
5643 however, are not suitable arguments to functions that expect
5644 @code{NUL}-terminated strings. To help detect accidental misuses of
5645 such arrays GCC issues warnings unless it can prove that the use is
5646 safe. @xref{Common Variable Attributes}.
5647
5648 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5649 @opindex Wsuggest-attribute=
5650 @opindex Wno-suggest-attribute=
5651 Warn for cases where adding an attribute may be beneficial. The
5652 attributes currently supported are listed below.
5653
5654 @table @gcctabopt
5655 @item -Wsuggest-attribute=pure
5656 @itemx -Wsuggest-attribute=const
5657 @itemx -Wsuggest-attribute=noreturn
5658 @itemx -Wsuggest-attribute=malloc
5659 @opindex Wsuggest-attribute=pure
5660 @opindex Wno-suggest-attribute=pure
5661 @opindex Wsuggest-attribute=const
5662 @opindex Wno-suggest-attribute=const
5663 @opindex Wsuggest-attribute=noreturn
5664 @opindex Wno-suggest-attribute=noreturn
5665 @opindex Wsuggest-attribute=malloc
5666 @opindex Wno-suggest-attribute=malloc
5667
5668 Warn about functions that might be candidates for attributes
5669 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5670 only warns for functions visible in other compilation units or (in the case of
5671 @code{pure} and @code{const}) if it cannot prove that the function returns
5672 normally. A function returns normally if it doesn't contain an infinite loop or
5673 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5674 requires option @option{-fipa-pure-const}, which is enabled by default at
5675 @option{-O} and higher. Higher optimization levels improve the accuracy
5676 of the analysis.
5677
5678 @item -Wsuggest-attribute=format
5679 @itemx -Wmissing-format-attribute
5680 @opindex Wsuggest-attribute=format
5681 @opindex Wmissing-format-attribute
5682 @opindex Wno-suggest-attribute=format
5683 @opindex Wno-missing-format-attribute
5684 @opindex Wformat
5685 @opindex Wno-format
5686
5687 Warn about function pointers that might be candidates for @code{format}
5688 attributes. Note these are only possible candidates, not absolute ones.
5689 GCC guesses that function pointers with @code{format} attributes that
5690 are used in assignment, initialization, parameter passing or return
5691 statements should have a corresponding @code{format} attribute in the
5692 resulting type. I.e.@: the left-hand side of the assignment or
5693 initialization, the type of the parameter variable, or the return type
5694 of the containing function respectively should also have a @code{format}
5695 attribute to avoid the warning.
5696
5697 GCC also warns about function definitions that might be
5698 candidates for @code{format} attributes. Again, these are only
5699 possible candidates. GCC guesses that @code{format} attributes
5700 might be appropriate for any function that calls a function like
5701 @code{vprintf} or @code{vscanf}, but this might not always be the
5702 case, and some functions for which @code{format} attributes are
5703 appropriate may not be detected.
5704
5705 @item -Wsuggest-attribute=cold
5706 @opindex Wsuggest-attribute=cold
5707 @opindex Wno-suggest-attribute=cold
5708
5709 Warn about functions that might be candidates for @code{cold} attribute. This
5710 is based on static detection and generally will only warn about functions which
5711 always leads to a call to another @code{cold} function such as wrappers of
5712 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5713 @end table
5714
5715 @item -Wsuggest-final-types
5716 @opindex Wno-suggest-final-types
5717 @opindex Wsuggest-final-types
5718 Warn about types with virtual methods where code quality would be improved
5719 if the type were declared with the C++11 @code{final} specifier,
5720 or, if possible,
5721 declared in an anonymous namespace. This allows GCC to more aggressively
5722 devirtualize the polymorphic calls. This warning is more effective with link
5723 time optimization, where the information about the class hierarchy graph is
5724 more complete.
5725
5726 @item -Wsuggest-final-methods
5727 @opindex Wno-suggest-final-methods
5728 @opindex Wsuggest-final-methods
5729 Warn about virtual methods where code quality would be improved if the method
5730 were declared with the C++11 @code{final} specifier,
5731 or, if possible, its type were
5732 declared in an anonymous namespace or with the @code{final} specifier.
5733 This warning is
5734 more effective with link-time optimization, where the information about the
5735 class hierarchy graph is more complete. It is recommended to first consider
5736 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5737 annotations.
5738
5739 @item -Wsuggest-override
5740 Warn about overriding virtual functions that are not marked with the override
5741 keyword.
5742
5743 @item -Walloc-zero
5744 @opindex Wno-alloc-zero
5745 @opindex Walloc-zero
5746 Warn about calls to allocation functions decorated with attribute
5747 @code{alloc_size} that specify zero bytes, including those to the built-in
5748 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5749 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5750 when called with a zero size differs among implementations (and in the case
5751 of @code{realloc} has been deprecated) relying on it may result in subtle
5752 portability bugs and should be avoided.
5753
5754 @item -Walloc-size-larger-than=@var{byte-size}
5755 @opindex Walloc-size-larger-than=
5756 @opindex Wno-alloc-size-larger-than
5757 Warn about calls to functions decorated with attribute @code{alloc_size}
5758 that attempt to allocate objects larger than the specified number of bytes,
5759 or where the result of the size computation in an integer type with infinite
5760 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5761 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5762 Warnings controlled by the option can be disabled either by specifying
5763 @var{byte-size} of @samp{SIZE_MAX} or more or by
5764 @option{-Wno-alloc-size-larger-than}.
5765 @xref{Function Attributes}.
5766
5767 @item -Wno-alloc-size-larger-than
5768 @opindex Wno-alloc-size-larger-than
5769 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5770 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5771 larger.
5772
5773 @item -Walloca
5774 @opindex Wno-alloca
5775 @opindex Walloca
5776 This option warns on all uses of @code{alloca} in the source.
5777
5778 @item -Walloca-larger-than=@var{byte-size}
5779 @opindex Walloca-larger-than=
5780 @opindex Wno-alloca-larger-than
5781 This option warns on calls to @code{alloca} with an integer argument whose
5782 value is either zero, or that is not bounded by a controlling predicate
5783 that limits its value to at most @var{byte-size}. It also warns for calls
5784 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5785 types are considered unbounded even if they appear to be constrained to
5786 the expected range.
5787
5788 For example, a bounded case of @code{alloca} could be:
5789
5790 @smallexample
5791 void func (size_t n)
5792 @{
5793 void *p;
5794 if (n <= 1000)
5795 p = alloca (n);
5796 else
5797 p = malloc (n);
5798 f (p);
5799 @}
5800 @end smallexample
5801
5802 In the above example, passing @code{-Walloca-larger-than=1000} would not
5803 issue a warning because the call to @code{alloca} is known to be at most
5804 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5805 the compiler would emit a warning.
5806
5807 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5808 controlling predicate constraining its integer argument. For example:
5809
5810 @smallexample
5811 void func ()
5812 @{
5813 void *p = alloca (n);
5814 f (p);
5815 @}
5816 @end smallexample
5817
5818 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5819 a warning, but this time because of the lack of bounds checking.
5820
5821 Note, that even seemingly correct code involving signed integers could
5822 cause a warning:
5823
5824 @smallexample
5825 void func (signed int n)
5826 @{
5827 if (n < 500)
5828 @{
5829 p = alloca (n);
5830 f (p);
5831 @}
5832 @}
5833 @end smallexample
5834
5835 In the above example, @var{n} could be negative, causing a larger than
5836 expected argument to be implicitly cast into the @code{alloca} call.
5837
5838 This option also warns when @code{alloca} is used in a loop.
5839
5840 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
5841 but is usually only effective when @option{-ftree-vrp} is active (default
5842 for @option{-O2} and above).
5843
5844 See also @option{-Wvla-larger-than=}@samp{byte-size}.
5845
5846 @item -Wno-alloca-larger-than
5847 @opindex Wno-alloca-larger-than
5848 Disable @option{-Walloca-larger-than=} warnings. The option is
5849 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
5850
5851 @item -Warray-bounds
5852 @itemx -Warray-bounds=@var{n}
5853 @opindex Wno-array-bounds
5854 @opindex Warray-bounds
5855 This option is only active when @option{-ftree-vrp} is active
5856 (default for @option{-O2} and above). It warns about subscripts to arrays
5857 that are always out of bounds. This warning is enabled by @option{-Wall}.
5858
5859 @table @gcctabopt
5860 @item -Warray-bounds=1
5861 This is the warning level of @option{-Warray-bounds} and is enabled
5862 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5863
5864 @item -Warray-bounds=2
5865 This warning level also warns about out of bounds access for
5866 arrays at the end of a struct and for arrays accessed through
5867 pointers. This warning level may give a larger number of
5868 false positives and is deactivated by default.
5869 @end table
5870
5871 @item -Wattribute-alias=@var{n}
5872 @itemx -Wno-attribute-alias
5873 @opindex -Wattribute-alias
5874 @opindex -Wno-attribute-alias
5875 Warn about declarations using the @code{alias} and similar attributes whose
5876 target is incompatible with the type of the alias.
5877 @xref{Function Attributes,,Declaring Attributes of Functions}.
5878 The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
5879
5880 @table @gcctabopt
5881 @item -Wattribute-alias=1
5882 The default warning level of the @option{-Wattribute-alias} option diagnoses
5883 incompatibilities between the type of the alias declaration and that of its
5884 target. Such incompatibilities are typically indicative of bugs.
5885
5886 @item -Wattribute-alias=2
5887 At this level @option{-Wattribute-alias} also diagnoses mismatches between
5888 the set of attributes of the alias declaration and the attributes applied
5889 to its target. Although in some cases such mismatches may indicate bugs,
5890 in other cases they may be benign and could be resolved simply by adding
5891 the missing attribute to the target.
5892 @end table
5893
5894 @item -Wbool-compare
5895 @opindex Wno-bool-compare
5896 @opindex Wbool-compare
5897 Warn about boolean expression compared with an integer value different from
5898 @code{true}/@code{false}. For instance, the following comparison is
5899 always false:
5900 @smallexample
5901 int n = 5;
5902 @dots{}
5903 if ((n > 1) == 2) @{ @dots{} @}
5904 @end smallexample
5905 This warning is enabled by @option{-Wall}.
5906
5907 @item -Wbool-operation
5908 @opindex Wno-bool-operation
5909 @opindex Wbool-operation
5910 Warn about suspicious operations on expressions of a boolean type. For
5911 instance, bitwise negation of a boolean is very likely a bug in the program.
5912 For C, this warning also warns about incrementing or decrementing a boolean,
5913 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5914 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5915
5916 This warning is enabled by @option{-Wall}.
5917
5918 @item -Wduplicated-branches
5919 @opindex Wno-duplicated-branches
5920 @opindex Wduplicated-branches
5921 Warn when an if-else has identical branches. This warning detects cases like
5922 @smallexample
5923 if (p != NULL)
5924 return 0;
5925 else
5926 return 0;
5927 @end smallexample
5928 It doesn't warn when both branches contain just a null statement. This warning
5929 also warn for conditional operators:
5930 @smallexample
5931 int i = x ? *p : *p;
5932 @end smallexample
5933
5934 @item -Wduplicated-cond
5935 @opindex Wno-duplicated-cond
5936 @opindex Wduplicated-cond
5937 Warn about duplicated conditions in an if-else-if chain. For instance,
5938 warn for the following code:
5939 @smallexample
5940 if (p->q != NULL) @{ @dots{} @}
5941 else if (p->q != NULL) @{ @dots{} @}
5942 @end smallexample
5943
5944 @item -Wframe-address
5945 @opindex Wno-frame-address
5946 @opindex Wframe-address
5947 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5948 is called with an argument greater than 0. Such calls may return indeterminate
5949 values or crash the program. The warning is included in @option{-Wall}.
5950
5951 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5952 @opindex Wno-discarded-qualifiers
5953 @opindex Wdiscarded-qualifiers
5954 Do not warn if type qualifiers on pointers are being discarded.
5955 Typically, the compiler warns if a @code{const char *} variable is
5956 passed to a function that takes a @code{char *} parameter. This option
5957 can be used to suppress such a warning.
5958
5959 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5960 @opindex Wno-discarded-array-qualifiers
5961 @opindex Wdiscarded-array-qualifiers
5962 Do not warn if type qualifiers on arrays which are pointer targets
5963 are being discarded. Typically, the compiler warns if a
5964 @code{const int (*)[]} variable is passed to a function that
5965 takes a @code{int (*)[]} parameter. This option can be used to
5966 suppress such a warning.
5967
5968 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5969 @opindex Wno-incompatible-pointer-types
5970 @opindex Wincompatible-pointer-types
5971 Do not warn when there is a conversion between pointers that have incompatible
5972 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5973 which warns for pointer argument passing or assignment with different
5974 signedness.
5975
5976 @item -Wno-int-conversion @r{(C and Objective-C only)}
5977 @opindex Wno-int-conversion
5978 @opindex Wint-conversion
5979 Do not warn about incompatible integer to pointer and pointer to integer
5980 conversions. This warning is about implicit conversions; for explicit
5981 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5982 @option{-Wno-pointer-to-int-cast} may be used.
5983
5984 @item -Wno-div-by-zero
5985 @opindex Wno-div-by-zero
5986 @opindex Wdiv-by-zero
5987 Do not warn about compile-time integer division by zero. Floating-point
5988 division by zero is not warned about, as it can be a legitimate way of
5989 obtaining infinities and NaNs.
5990
5991 @item -Wsystem-headers
5992 @opindex Wsystem-headers
5993 @opindex Wno-system-headers
5994 @cindex warnings from system headers
5995 @cindex system headers, warnings from
5996 Print warning messages for constructs found in system header files.
5997 Warnings from system headers are normally suppressed, on the assumption
5998 that they usually do not indicate real problems and would only make the
5999 compiler output harder to read. Using this command-line option tells
6000 GCC to emit warnings from system headers as if they occurred in user
6001 code. However, note that using @option{-Wall} in conjunction with this
6002 option does @emph{not} warn about unknown pragmas in system
6003 headers---for that, @option{-Wunknown-pragmas} must also be used.
6004
6005 @item -Wtautological-compare
6006 @opindex Wtautological-compare
6007 @opindex Wno-tautological-compare
6008 Warn if a self-comparison always evaluates to true or false. This
6009 warning detects various mistakes such as:
6010 @smallexample
6011 int i = 1;
6012 @dots{}
6013 if (i > i) @{ @dots{} @}
6014 @end smallexample
6015
6016 This warning also warns about bitwise comparisons that always evaluate
6017 to true or false, for instance:
6018 @smallexample
6019 if ((a & 16) == 10) @{ @dots{} @}
6020 @end smallexample
6021 will always be false.
6022
6023 This warning is enabled by @option{-Wall}.
6024
6025 @item -Wtrampolines
6026 @opindex Wtrampolines
6027 @opindex Wno-trampolines
6028 Warn about trampolines generated for pointers to nested functions.
6029 A trampoline is a small piece of data or code that is created at run
6030 time on the stack when the address of a nested function is taken, and is
6031 used to call the nested function indirectly. For some targets, it is
6032 made up of data only and thus requires no special treatment. But, for
6033 most targets, it is made up of code and thus requires the stack to be
6034 made executable in order for the program to work properly.
6035
6036 @item -Wfloat-equal
6037 @opindex Wfloat-equal
6038 @opindex Wno-float-equal
6039 Warn if floating-point values are used in equality comparisons.
6040
6041 The idea behind this is that sometimes it is convenient (for the
6042 programmer) to consider floating-point values as approximations to
6043 infinitely precise real numbers. If you are doing this, then you need
6044 to compute (by analyzing the code, or in some other way) the maximum or
6045 likely maximum error that the computation introduces, and allow for it
6046 when performing comparisons (and when producing output, but that's a
6047 different problem). In particular, instead of testing for equality, you
6048 should check to see whether the two values have ranges that overlap; and
6049 this is done with the relational operators, so equality comparisons are
6050 probably mistaken.
6051
6052 @item -Wtraditional @r{(C and Objective-C only)}
6053 @opindex Wtraditional
6054 @opindex Wno-traditional
6055 Warn about certain constructs that behave differently in traditional and
6056 ISO C@. Also warn about ISO C constructs that have no traditional C
6057 equivalent, and/or problematic constructs that should be avoided.
6058
6059 @itemize @bullet
6060 @item
6061 Macro parameters that appear within string literals in the macro body.
6062 In traditional C macro replacement takes place within string literals,
6063 but in ISO C it does not.
6064
6065 @item
6066 In traditional C, some preprocessor directives did not exist.
6067 Traditional preprocessors only considered a line to be a directive
6068 if the @samp{#} appeared in column 1 on the line. Therefore
6069 @option{-Wtraditional} warns about directives that traditional C
6070 understands but ignores because the @samp{#} does not appear as the
6071 first character on the line. It also suggests you hide directives like
6072 @code{#pragma} not understood by traditional C by indenting them. Some
6073 traditional implementations do not recognize @code{#elif}, so this option
6074 suggests avoiding it altogether.
6075
6076 @item
6077 A function-like macro that appears without arguments.
6078
6079 @item
6080 The unary plus operator.
6081
6082 @item
6083 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6084 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6085 constants.) Note, these suffixes appear in macros defined in the system
6086 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6087 Use of these macros in user code might normally lead to spurious
6088 warnings, however GCC's integrated preprocessor has enough context to
6089 avoid warning in these cases.
6090
6091 @item
6092 A function declared external in one block and then used after the end of
6093 the block.
6094
6095 @item
6096 A @code{switch} statement has an operand of type @code{long}.
6097
6098 @item
6099 A non-@code{static} function declaration follows a @code{static} one.
6100 This construct is not accepted by some traditional C compilers.
6101
6102 @item
6103 The ISO type of an integer constant has a different width or
6104 signedness from its traditional type. This warning is only issued if
6105 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6106 typically represent bit patterns, are not warned about.
6107
6108 @item
6109 Usage of ISO string concatenation is detected.
6110
6111 @item
6112 Initialization of automatic aggregates.
6113
6114 @item
6115 Identifier conflicts with labels. Traditional C lacks a separate
6116 namespace for labels.
6117
6118 @item
6119 Initialization of unions. If the initializer is zero, the warning is
6120 omitted. This is done under the assumption that the zero initializer in
6121 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6122 initializer warnings and relies on default initialization to zero in the
6123 traditional C case.
6124
6125 @item
6126 Conversions by prototypes between fixed/floating-point values and vice
6127 versa. The absence of these prototypes when compiling with traditional
6128 C causes serious problems. This is a subset of the possible
6129 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6130
6131 @item
6132 Use of ISO C style function definitions. This warning intentionally is
6133 @emph{not} issued for prototype declarations or variadic functions
6134 because these ISO C features appear in your code when using
6135 libiberty's traditional C compatibility macros, @code{PARAMS} and
6136 @code{VPARAMS}. This warning is also bypassed for nested functions
6137 because that feature is already a GCC extension and thus not relevant to
6138 traditional C compatibility.
6139 @end itemize
6140
6141 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6142 @opindex Wtraditional-conversion
6143 @opindex Wno-traditional-conversion
6144 Warn if a prototype causes a type conversion that is different from what
6145 would happen to the same argument in the absence of a prototype. This
6146 includes conversions of fixed point to floating and vice versa, and
6147 conversions changing the width or signedness of a fixed-point argument
6148 except when the same as the default promotion.
6149
6150 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6151 @opindex Wdeclaration-after-statement
6152 @opindex Wno-declaration-after-statement
6153 Warn when a declaration is found after a statement in a block. This
6154 construct, known from C++, was introduced with ISO C99 and is by default
6155 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6156
6157 @item -Wshadow
6158 @opindex Wshadow
6159 @opindex Wno-shadow
6160 Warn whenever a local variable or type declaration shadows another
6161 variable, parameter, type, class member (in C++), or instance variable
6162 (in Objective-C) or whenever a built-in function is shadowed. Note
6163 that in C++, the compiler warns if a local variable shadows an
6164 explicit typedef, but not if it shadows a struct/class/enum.
6165 Same as @option{-Wshadow=global}.
6166
6167 @item -Wno-shadow-ivar @r{(Objective-C only)}
6168 @opindex Wno-shadow-ivar
6169 @opindex Wshadow-ivar
6170 Do not warn whenever a local variable shadows an instance variable in an
6171 Objective-C method.
6172
6173 @item -Wshadow=global
6174 @opindex Wshadow=local
6175 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6176
6177 @item -Wshadow=local
6178 @opindex Wshadow=local
6179 Warn when a local variable shadows another local variable or parameter.
6180 This warning is enabled by @option{-Wshadow=global}.
6181
6182 @item -Wshadow=compatible-local
6183 @opindex Wshadow=compatible-local
6184 Warn when a local variable shadows another local variable or parameter
6185 whose type is compatible with that of the shadowing variable. In C++,
6186 type compatibility here means the type of the shadowing variable can be
6187 converted to that of the shadowed variable. The creation of this flag
6188 (in addition to @option{-Wshadow=local}) is based on the idea that when
6189 a local variable shadows another one of incompatible type, it is most
6190 likely intentional, not a bug or typo, as shown in the following example:
6191
6192 @smallexample
6193 @group
6194 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6195 @{
6196 for (int i = 0; i < N; ++i)
6197 @{
6198 ...
6199 @}
6200 ...
6201 @}
6202 @end group
6203 @end smallexample
6204
6205 Since the two variable @code{i} in the example above have incompatible types,
6206 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6207 Because their types are incompatible, if a programmer accidentally uses one
6208 in place of the other, type checking will catch that and emit an error or
6209 warning. So not warning (about shadowing) in this case will not lead to
6210 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6211 possibly reduce the number of warnings triggered by intentional shadowing.
6212
6213 This warning is enabled by @option{-Wshadow=local}.
6214
6215 @item -Wlarger-than=@var{byte-size}
6216 @opindex Wlarger-than=
6217 @opindex Wlarger-than-@var{byte-size}
6218 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6219 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6220 Warnings controlled by the option can be disabled either by specifying
6221 @var{byte-size} of @samp{SIZE_MAX} or more or by
6222 @option{-Wno-larger-than}.
6223
6224 @item -Wno-larger-than
6225 @opindex Wno-larger-than
6226 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6227 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6228
6229 @item -Wframe-larger-than=@var{byte-size}
6230 @opindex Wframe-larger-than=
6231 @opindex Wno-frame-larger-than
6232 Warn if the size of a function frame exceeds @var{byte-size}.
6233 The computation done to determine the stack frame size is approximate
6234 and not conservative.
6235 The actual requirements may be somewhat greater than @var{byte-size}
6236 even if you do not get a warning. In addition, any space allocated
6237 via @code{alloca}, variable-length arrays, or related constructs
6238 is not included by the compiler when determining
6239 whether or not to issue a warning.
6240 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6241 Warnings controlled by the option can be disabled either by specifying
6242 @var{byte-size} of @samp{SIZE_MAX} or more or by
6243 @option{-Wno-frame-larger-than}.
6244
6245 @item -Wno-frame-larger-than
6246 @opindex Wno-frame-larger-than
6247 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6248 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6249
6250 @item -Wno-free-nonheap-object
6251 @opindex Wno-free-nonheap-object
6252 @opindex Wfree-nonheap-object
6253 Do not warn when attempting to free an object that was not allocated
6254 on the heap.
6255
6256 @item -Wstack-usage=@var{byte-size}
6257 @opindex Wstack-usage
6258 @opindex Wno-stack-usage
6259 Warn if the stack usage of a function might exceed @var{byte-size}.
6260 The computation done to determine the stack usage is conservative.
6261 Any space allocated via @code{alloca}, variable-length arrays, or related
6262 constructs is included by the compiler when determining whether or not to
6263 issue a warning.
6264
6265 The message is in keeping with the output of @option{-fstack-usage}.
6266
6267 @itemize
6268 @item
6269 If the stack usage is fully static but exceeds the specified amount, it's:
6270
6271 @smallexample
6272 warning: stack usage is 1120 bytes
6273 @end smallexample
6274 @item
6275 If the stack usage is (partly) dynamic but bounded, it's:
6276
6277 @smallexample
6278 warning: stack usage might be 1648 bytes
6279 @end smallexample
6280 @item
6281 If the stack usage is (partly) dynamic and not bounded, it's:
6282
6283 @smallexample
6284 warning: stack usage might be unbounded
6285 @end smallexample
6286 @end itemize
6287
6288 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6289 Warnings controlled by the option can be disabled either by specifying
6290 @var{byte-size} of @samp{SIZE_MAX} or more or by
6291 @option{-Wno-stack-usage}.
6292
6293 @item -Wno-stack-usage
6294 @opindex Wno-stack-usage
6295 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6296 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6297
6298 @item -Wunsafe-loop-optimizations
6299 @opindex Wunsafe-loop-optimizations
6300 @opindex Wno-unsafe-loop-optimizations
6301 Warn if the loop cannot be optimized because the compiler cannot
6302 assume anything on the bounds of the loop indices. With
6303 @option{-funsafe-loop-optimizations} warn if the compiler makes
6304 such assumptions.
6305
6306 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6307 @opindex Wno-pedantic-ms-format
6308 @opindex Wpedantic-ms-format
6309 When used in combination with @option{-Wformat}
6310 and @option{-pedantic} without GNU extensions, this option
6311 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6312 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6313 which depend on the MS runtime.
6314
6315 @item -Waligned-new
6316 @opindex Waligned-new
6317 @opindex Wno-aligned-new
6318 Warn about a new-expression of a type that requires greater alignment
6319 than the @code{alignof(std::max_align_t)} but uses an allocation
6320 function without an explicit alignment parameter. This option is
6321 enabled by @option{-Wall}.
6322
6323 Normally this only warns about global allocation functions, but
6324 @option{-Waligned-new=all} also warns about class member allocation
6325 functions.
6326
6327 @item -Wplacement-new
6328 @itemx -Wplacement-new=@var{n}
6329 @opindex Wplacement-new
6330 @opindex Wno-placement-new
6331 Warn about placement new expressions with undefined behavior, such as
6332 constructing an object in a buffer that is smaller than the type of
6333 the object. For example, the placement new expression below is diagnosed
6334 because it attempts to construct an array of 64 integers in a buffer only
6335 64 bytes large.
6336 @smallexample
6337 char buf [64];
6338 new (buf) int[64];
6339 @end smallexample
6340 This warning is enabled by default.
6341
6342 @table @gcctabopt
6343 @item -Wplacement-new=1
6344 This is the default warning level of @option{-Wplacement-new}. At this
6345 level the warning is not issued for some strictly undefined constructs that
6346 GCC allows as extensions for compatibility with legacy code. For example,
6347 the following @code{new} expression is not diagnosed at this level even
6348 though it has undefined behavior according to the C++ standard because
6349 it writes past the end of the one-element array.
6350 @smallexample
6351 struct S @{ int n, a[1]; @};
6352 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6353 new (s->a)int [32]();
6354 @end smallexample
6355
6356 @item -Wplacement-new=2
6357 At this level, in addition to diagnosing all the same constructs as at level
6358 1, a diagnostic is also issued for placement new expressions that construct
6359 an object in the last member of structure whose type is an array of a single
6360 element and whose size is less than the size of the object being constructed.
6361 While the previous example would be diagnosed, the following construct makes
6362 use of the flexible member array extension to avoid the warning at level 2.
6363 @smallexample
6364 struct S @{ int n, a[]; @};
6365 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6366 new (s->a)int [32]();
6367 @end smallexample
6368
6369 @end table
6370
6371 @item -Wpointer-arith
6372 @opindex Wpointer-arith
6373 @opindex Wno-pointer-arith
6374 Warn about anything that depends on the ``size of'' a function type or
6375 of @code{void}. GNU C assigns these types a size of 1, for
6376 convenience in calculations with @code{void *} pointers and pointers
6377 to functions. In C++, warn also when an arithmetic operation involves
6378 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6379
6380 @item -Wpointer-compare
6381 @opindex Wpointer-compare
6382 @opindex Wno-pointer-compare
6383 Warn if a pointer is compared with a zero character constant. This usually
6384 means that the pointer was meant to be dereferenced. For example:
6385
6386 @smallexample
6387 const char *p = foo ();
6388 if (p == '\0')
6389 return 42;
6390 @end smallexample
6391
6392 Note that the code above is invalid in C++11.
6393
6394 This warning is enabled by default.
6395
6396 @item -Wtype-limits
6397 @opindex Wtype-limits
6398 @opindex Wno-type-limits
6399 Warn if a comparison is always true or always false due to the limited
6400 range of the data type, but do not warn for constant expressions. For
6401 example, warn if an unsigned variable is compared against zero with
6402 @code{<} or @code{>=}. This warning is also enabled by
6403 @option{-Wextra}.
6404
6405 @item -Wabsolute-value @r{(C and Objective-C only)}
6406 @opindex Wabsolute-value
6407 @opindex Wno-absolute-value
6408 Warn when a wrong absolute value function seems to be used or when it
6409 does not have any effect because its argument is an unsigned type.
6410 This warning be suppressed with an explicit type cast and it is also
6411 enabled by @option{-Wextra}.
6412
6413 @include cppwarnopts.texi
6414
6415 @item -Wbad-function-cast @r{(C and Objective-C only)}
6416 @opindex Wbad-function-cast
6417 @opindex Wno-bad-function-cast
6418 Warn when a function call is cast to a non-matching type.
6419 For example, warn if a call to a function returning an integer type
6420 is cast to a pointer type.
6421
6422 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6423 @opindex Wc90-c99-compat
6424 @opindex Wno-c90-c99-compat
6425 Warn about features not present in ISO C90, but present in ISO C99.
6426 For instance, warn about use of variable length arrays, @code{long long}
6427 type, @code{bool} type, compound literals, designated initializers, and so
6428 on. This option is independent of the standards mode. Warnings are disabled
6429 in the expression that follows @code{__extension__}.
6430
6431 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6432 @opindex Wc99-c11-compat
6433 @opindex Wno-c99-c11-compat
6434 Warn about features not present in ISO C99, but present in ISO C11.
6435 For instance, warn about use of anonymous structures and unions,
6436 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6437 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6438 and so on. This option is independent of the standards mode. Warnings are
6439 disabled in the expression that follows @code{__extension__}.
6440
6441 @item -Wc++-compat @r{(C and Objective-C only)}
6442 @opindex Wc++-compat
6443 @opindex Wno-c++-compat
6444 Warn about ISO C constructs that are outside of the common subset of
6445 ISO C and ISO C++, e.g.@: request for implicit conversion from
6446 @code{void *} to a pointer to non-@code{void} type.
6447
6448 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6449 @opindex Wc++11-compat
6450 @opindex Wno-c++11-compat
6451 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6452 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6453 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6454 enabled by @option{-Wall}.
6455
6456 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6457 @opindex Wc++14-compat
6458 @opindex Wno-c++14-compat
6459 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6460 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6461
6462 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6463 @opindex Wc++17-compat
6464 @opindex Wno-c++17-compat
6465 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6466 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6467
6468 @item -Wcast-qual
6469 @opindex Wcast-qual
6470 @opindex Wno-cast-qual
6471 Warn whenever a pointer is cast so as to remove a type qualifier from
6472 the target type. For example, warn if a @code{const char *} is cast
6473 to an ordinary @code{char *}.
6474
6475 Also warn when making a cast that introduces a type qualifier in an
6476 unsafe way. For example, casting @code{char **} to @code{const char **}
6477 is unsafe, as in this example:
6478
6479 @smallexample
6480 /* p is char ** value. */
6481 const char **q = (const char **) p;
6482 /* Assignment of readonly string to const char * is OK. */
6483 *q = "string";
6484 /* Now char** pointer points to read-only memory. */
6485 **p = 'b';
6486 @end smallexample
6487
6488 @item -Wcast-align
6489 @opindex Wcast-align
6490 @opindex Wno-cast-align
6491 Warn whenever a pointer is cast such that the required alignment of the
6492 target is increased. For example, warn if a @code{char *} is cast to
6493 an @code{int *} on machines where integers can only be accessed at
6494 two- or four-byte boundaries.
6495
6496 @item -Wcast-align=strict
6497 @opindex Wcast-align=strict
6498 Warn whenever a pointer is cast such that the required alignment of the
6499 target is increased. For example, warn if a @code{char *} is cast to
6500 an @code{int *} regardless of the target machine.
6501
6502 @item -Wcast-function-type
6503 @opindex Wcast-function-type
6504 @opindex Wno-cast-function-type
6505 Warn when a function pointer is cast to an incompatible function pointer.
6506 In a cast involving function types with a variable argument list only
6507 the types of initial arguments that are provided are considered.
6508 Any parameter of pointer-type matches any other pointer-type. Any benign
6509 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6510 on ILP32 targets. Likewise type qualifiers are ignored. The function
6511 type @code{void (*) (void)} is special and matches everything, which can
6512 be used to suppress this warning.
6513 In a cast involving pointer to member types this warning warns whenever
6514 the type cast is changing the pointer to member type.
6515 This warning is enabled by @option{-Wextra}.
6516
6517 @item -Wwrite-strings
6518 @opindex Wwrite-strings
6519 @opindex Wno-write-strings
6520 When compiling C, give string constants the type @code{const
6521 char[@var{length}]} so that copying the address of one into a
6522 non-@code{const} @code{char *} pointer produces a warning. These
6523 warnings help you find at compile time code that can try to write
6524 into a string constant, but only if you have been very careful about
6525 using @code{const} in declarations and prototypes. Otherwise, it is
6526 just a nuisance. This is why we did not make @option{-Wall} request
6527 these warnings.
6528
6529 When compiling C++, warn about the deprecated conversion from string
6530 literals to @code{char *}. This warning is enabled by default for C++
6531 programs.
6532
6533 @item -Wcatch-value
6534 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6535 @opindex Wcatch-value
6536 @opindex Wno-catch-value
6537 Warn about catch handlers that do not catch via reference.
6538 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6539 warn about polymorphic class types that are caught by value.
6540 With @option{-Wcatch-value=2} warn about all class types that are caught
6541 by value. With @option{-Wcatch-value=3} warn about all types that are
6542 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6543
6544 @item -Wclobbered
6545 @opindex Wclobbered
6546 @opindex Wno-clobbered
6547 Warn for variables that might be changed by @code{longjmp} or
6548 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6549
6550 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6551 @opindex Wconditionally-supported
6552 @opindex Wno-conditionally-supported
6553 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6554
6555 @item -Wconversion
6556 @opindex Wconversion
6557 @opindex Wno-conversion
6558 Warn for implicit conversions that may alter a value. This includes
6559 conversions between real and integer, like @code{abs (x)} when
6560 @code{x} is @code{double}; conversions between signed and unsigned,
6561 like @code{unsigned ui = -1}; and conversions to smaller types, like
6562 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6563 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6564 changed by the conversion like in @code{abs (2.0)}. Warnings about
6565 conversions between signed and unsigned integers can be disabled by
6566 using @option{-Wno-sign-conversion}.
6567
6568 For C++, also warn for confusing overload resolution for user-defined
6569 conversions; and conversions that never use a type conversion
6570 operator: conversions to @code{void}, the same type, a base class or a
6571 reference to them. Warnings about conversions between signed and
6572 unsigned integers are disabled by default in C++ unless
6573 @option{-Wsign-conversion} is explicitly enabled.
6574
6575 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6576 @opindex Wconversion-null
6577 @opindex Wno-conversion-null
6578 Do not warn for conversions between @code{NULL} and non-pointer
6579 types. @option{-Wconversion-null} is enabled by default.
6580
6581 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6582 @opindex Wzero-as-null-pointer-constant
6583 @opindex Wno-zero-as-null-pointer-constant
6584 Warn when a literal @samp{0} is used as null pointer constant. This can
6585 be useful to facilitate the conversion to @code{nullptr} in C++11.
6586
6587 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6588 @opindex Wsubobject-linkage
6589 @opindex Wno-subobject-linkage
6590 Warn if a class type has a base or a field whose type uses the anonymous
6591 namespace or depends on a type with no linkage. If a type A depends on
6592 a type B with no or internal linkage, defining it in multiple
6593 translation units would be an ODR violation because the meaning of B
6594 is different in each translation unit. If A only appears in a single
6595 translation unit, the best way to silence the warning is to give it
6596 internal linkage by putting it in an anonymous namespace as well. The
6597 compiler doesn't give this warning for types defined in the main .C
6598 file, as those are unlikely to have multiple definitions.
6599 @option{-Wsubobject-linkage} is enabled by default.
6600
6601 @item -Wdangling-else
6602 @opindex Wdangling-else
6603 @opindex Wno-dangling-else
6604 Warn about constructions where there may be confusion to which
6605 @code{if} statement an @code{else} branch belongs. Here is an example of
6606 such a case:
6607
6608 @smallexample
6609 @group
6610 @{
6611 if (a)
6612 if (b)
6613 foo ();
6614 else
6615 bar ();
6616 @}
6617 @end group
6618 @end smallexample
6619
6620 In C/C++, every @code{else} branch belongs to the innermost possible
6621 @code{if} statement, which in this example is @code{if (b)}. This is
6622 often not what the programmer expected, as illustrated in the above
6623 example by indentation the programmer chose. When there is the
6624 potential for this confusion, GCC issues a warning when this flag
6625 is specified. To eliminate the warning, add explicit braces around
6626 the innermost @code{if} statement so there is no way the @code{else}
6627 can belong to the enclosing @code{if}. The resulting code
6628 looks like this:
6629
6630 @smallexample
6631 @group
6632 @{
6633 if (a)
6634 @{
6635 if (b)
6636 foo ();
6637 else
6638 bar ();
6639 @}
6640 @}
6641 @end group
6642 @end smallexample
6643
6644 This warning is enabled by @option{-Wparentheses}.
6645
6646 @item -Wdate-time
6647 @opindex Wdate-time
6648 @opindex Wno-date-time
6649 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6650 are encountered as they might prevent bit-wise-identical reproducible
6651 compilations.
6652
6653 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6654 @opindex Wdelete-incomplete
6655 @opindex Wno-delete-incomplete
6656 Warn when deleting a pointer to incomplete type, which may cause
6657 undefined behavior at runtime. This warning is enabled by default.
6658
6659 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6660 @opindex Wuseless-cast
6661 @opindex Wno-useless-cast
6662 Warn when an expression is casted to its own type.
6663
6664 @item -Wempty-body
6665 @opindex Wempty-body
6666 @opindex Wno-empty-body
6667 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6668 while} statement. This warning is also enabled by @option{-Wextra}.
6669
6670 @item -Wenum-compare
6671 @opindex Wenum-compare
6672 @opindex Wno-enum-compare
6673 Warn about a comparison between values of different enumerated types.
6674 In C++ enumerated type mismatches in conditional expressions are also
6675 diagnosed and the warning is enabled by default. In C this warning is
6676 enabled by @option{-Wall}.
6677
6678 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6679 @opindex Wextra-semi
6680 @opindex Wno-extra-semi
6681 Warn about redundant semicolon after in-class function definition.
6682
6683 @item -Wjump-misses-init @r{(C, Objective-C only)}
6684 @opindex Wjump-misses-init
6685 @opindex Wno-jump-misses-init
6686 Warn if a @code{goto} statement or a @code{switch} statement jumps
6687 forward across the initialization of a variable, or jumps backward to a
6688 label after the variable has been initialized. This only warns about
6689 variables that are initialized when they are declared. This warning is
6690 only supported for C and Objective-C; in C++ this sort of branch is an
6691 error in any case.
6692
6693 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6694 can be disabled with the @option{-Wno-jump-misses-init} option.
6695
6696 @item -Wsign-compare
6697 @opindex Wsign-compare
6698 @opindex Wno-sign-compare
6699 @cindex warning for comparison of signed and unsigned values
6700 @cindex comparison of signed and unsigned values, warning
6701 @cindex signed and unsigned values, comparison warning
6702 Warn when a comparison between signed and unsigned values could produce
6703 an incorrect result when the signed value is converted to unsigned.
6704 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6705 also enabled by @option{-Wextra}.
6706
6707 @item -Wsign-conversion
6708 @opindex Wsign-conversion
6709 @opindex Wno-sign-conversion
6710 Warn for implicit conversions that may change the sign of an integer
6711 value, like assigning a signed integer expression to an unsigned
6712 integer variable. An explicit cast silences the warning. In C, this
6713 option is enabled also by @option{-Wconversion}.
6714
6715 @item -Wfloat-conversion
6716 @opindex Wfloat-conversion
6717 @opindex Wno-float-conversion
6718 Warn for implicit conversions that reduce the precision of a real value.
6719 This includes conversions from real to integer, and from higher precision
6720 real to lower precision real values. This option is also enabled by
6721 @option{-Wconversion}.
6722
6723 @item -Wno-scalar-storage-order
6724 @opindex Wno-scalar-storage-order
6725 @opindex Wscalar-storage-order
6726 Do not warn on suspicious constructs involving reverse scalar storage order.
6727
6728 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6729 @opindex Wsized-deallocation
6730 @opindex Wno-sized-deallocation
6731 Warn about a definition of an unsized deallocation function
6732 @smallexample
6733 void operator delete (void *) noexcept;
6734 void operator delete[] (void *) noexcept;
6735 @end smallexample
6736 without a definition of the corresponding sized deallocation function
6737 @smallexample
6738 void operator delete (void *, std::size_t) noexcept;
6739 void operator delete[] (void *, std::size_t) noexcept;
6740 @end smallexample
6741 or vice versa. Enabled by @option{-Wextra} along with
6742 @option{-fsized-deallocation}.
6743
6744 @item -Wsizeof-pointer-div
6745 @opindex Wsizeof-pointer-div
6746 @opindex Wno-sizeof-pointer-div
6747 Warn for suspicious divisions of two sizeof expressions that divide
6748 the pointer size by the element size, which is the usual way to compute
6749 the array size but won't work out correctly with pointers. This warning
6750 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6751 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6752
6753 @item -Wsizeof-pointer-memaccess
6754 @opindex Wsizeof-pointer-memaccess
6755 @opindex Wno-sizeof-pointer-memaccess
6756 Warn for suspicious length parameters to certain string and memory built-in
6757 functions if the argument uses @code{sizeof}. This warning triggers for
6758 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6759 an array, but a pointer, and suggests a possible fix, or about
6760 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6761 also warns about calls to bounded string copy functions like @code{strncat}
6762 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6763 the source array. For example, in the following function the call to
6764 @code{strncat} specifies the size of the source string as the bound. That
6765 is almost certainly a mistake and so the call is diagnosed.
6766 @smallexample
6767 void make_file (const char *name)
6768 @{
6769 char path[PATH_MAX];
6770 strncpy (path, name, sizeof path - 1);
6771 strncat (path, ".text", sizeof ".text");
6772 @dots{}
6773 @}
6774 @end smallexample
6775
6776 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6777
6778 @item -Wsizeof-array-argument
6779 @opindex Wsizeof-array-argument
6780 @opindex Wno-sizeof-array-argument
6781 Warn when the @code{sizeof} operator is applied to a parameter that is
6782 declared as an array in a function definition. This warning is enabled by
6783 default for C and C++ programs.
6784
6785 @item -Wmemset-elt-size
6786 @opindex Wmemset-elt-size
6787 @opindex Wno-memset-elt-size
6788 Warn for suspicious calls to the @code{memset} built-in function, if the
6789 first argument references an array, and the third argument is a number
6790 equal to the number of elements, but not equal to the size of the array
6791 in memory. This indicates that the user has omitted a multiplication by
6792 the element size. This warning is enabled by @option{-Wall}.
6793
6794 @item -Wmemset-transposed-args
6795 @opindex Wmemset-transposed-args
6796 @opindex Wno-memset-transposed-args
6797 Warn for suspicious calls to the @code{memset} built-in function, if the
6798 second argument is not zero and the third argument is zero. This warns e.g.@:
6799 about @code{memset (buf, sizeof buf, 0)} where most probably
6800 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6801 is only emitted if the third argument is literal zero. If it is some
6802 expression that is folded to zero, a cast of zero to some type, etc.,
6803 it is far less likely that the user has mistakenly exchanged the arguments
6804 and no warning is emitted. This warning is enabled by @option{-Wall}.
6805
6806 @item -Waddress
6807 @opindex Waddress
6808 @opindex Wno-address
6809 Warn about suspicious uses of memory addresses. These include using
6810 the address of a function in a conditional expression, such as
6811 @code{void func(void); if (func)}, and comparisons against the memory
6812 address of a string literal, such as @code{if (x == "abc")}. Such
6813 uses typically indicate a programmer error: the address of a function
6814 always evaluates to true, so their use in a conditional usually
6815 indicate that the programmer forgot the parentheses in a function
6816 call; and comparisons against string literals result in unspecified
6817 behavior and are not portable in C, so they usually indicate that the
6818 programmer intended to use @code{strcmp}. This warning is enabled by
6819 @option{-Wall}.
6820
6821 @item -Wlogical-op
6822 @opindex Wlogical-op
6823 @opindex Wno-logical-op
6824 Warn about suspicious uses of logical operators in expressions.
6825 This includes using logical operators in contexts where a
6826 bit-wise operator is likely to be expected. Also warns when
6827 the operands of a logical operator are the same:
6828 @smallexample
6829 extern int a;
6830 if (a < 0 && a < 0) @{ @dots{} @}
6831 @end smallexample
6832
6833 @item -Wlogical-not-parentheses
6834 @opindex Wlogical-not-parentheses
6835 @opindex Wno-logical-not-parentheses
6836 Warn about logical not used on the left hand side operand of a comparison.
6837 This option does not warn if the right operand is considered to be a boolean
6838 expression. Its purpose is to detect suspicious code like the following:
6839 @smallexample
6840 int a;
6841 @dots{}
6842 if (!a > 1) @{ @dots{} @}
6843 @end smallexample
6844
6845 It is possible to suppress the warning by wrapping the LHS into
6846 parentheses:
6847 @smallexample
6848 if ((!a) > 1) @{ @dots{} @}
6849 @end smallexample
6850
6851 This warning is enabled by @option{-Wall}.
6852
6853 @item -Waggregate-return
6854 @opindex Waggregate-return
6855 @opindex Wno-aggregate-return
6856 Warn if any functions that return structures or unions are defined or
6857 called. (In languages where you can return an array, this also elicits
6858 a warning.)
6859
6860 @item -Wno-aggressive-loop-optimizations
6861 @opindex Wno-aggressive-loop-optimizations
6862 @opindex Waggressive-loop-optimizations
6863 Warn if in a loop with constant number of iterations the compiler detects
6864 undefined behavior in some statement during one or more of the iterations.
6865
6866 @item -Wno-attributes
6867 @opindex Wno-attributes
6868 @opindex Wattributes
6869 Do not warn if an unexpected @code{__attribute__} is used, such as
6870 unrecognized attributes, function attributes applied to variables,
6871 etc. This does not stop errors for incorrect use of supported
6872 attributes.
6873
6874 @item -Wno-builtin-declaration-mismatch
6875 @opindex Wno-builtin-declaration-mismatch
6876 @opindex Wbuiltin-declaration-mismatch
6877 Warn if a built-in function is declared with the wrong signature or
6878 as non-function.
6879 This warning is enabled by default.
6880
6881 @item -Wno-builtin-macro-redefined
6882 @opindex Wno-builtin-macro-redefined
6883 @opindex Wbuiltin-macro-redefined
6884 Do not warn if certain built-in macros are redefined. This suppresses
6885 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6886 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6887
6888 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6889 @opindex Wstrict-prototypes
6890 @opindex Wno-strict-prototypes
6891 Warn if a function is declared or defined without specifying the
6892 argument types. (An old-style function definition is permitted without
6893 a warning if preceded by a declaration that specifies the argument
6894 types.)
6895
6896 @item -Wold-style-declaration @r{(C and Objective-C only)}
6897 @opindex Wold-style-declaration
6898 @opindex Wno-old-style-declaration
6899 Warn for obsolescent usages, according to the C Standard, in a
6900 declaration. For example, warn if storage-class specifiers like
6901 @code{static} are not the first things in a declaration. This warning
6902 is also enabled by @option{-Wextra}.
6903
6904 @item -Wold-style-definition @r{(C and Objective-C only)}
6905 @opindex Wold-style-definition
6906 @opindex Wno-old-style-definition
6907 Warn if an old-style function definition is used. A warning is given
6908 even if there is a previous prototype.
6909
6910 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6911 @opindex Wmissing-parameter-type
6912 @opindex Wno-missing-parameter-type
6913 A function parameter is declared without a type specifier in K&R-style
6914 functions:
6915
6916 @smallexample
6917 void foo(bar) @{ @}
6918 @end smallexample
6919
6920 This warning is also enabled by @option{-Wextra}.
6921
6922 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6923 @opindex Wmissing-prototypes
6924 @opindex Wno-missing-prototypes
6925 Warn if a global function is defined without a previous prototype
6926 declaration. This warning is issued even if the definition itself
6927 provides a prototype. Use this option to detect global functions
6928 that do not have a matching prototype declaration in a header file.
6929 This option is not valid for C++ because all function declarations
6930 provide prototypes and a non-matching declaration declares an
6931 overload rather than conflict with an earlier declaration.
6932 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6933
6934 @item -Wmissing-declarations
6935 @opindex Wmissing-declarations
6936 @opindex Wno-missing-declarations
6937 Warn if a global function is defined without a previous declaration.
6938 Do so even if the definition itself provides a prototype.
6939 Use this option to detect global functions that are not declared in
6940 header files. In C, no warnings are issued for functions with previous
6941 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6942 missing prototypes. In C++, no warnings are issued for function templates,
6943 or for inline functions, or for functions in anonymous namespaces.
6944
6945 @item -Wmissing-field-initializers
6946 @opindex Wmissing-field-initializers
6947 @opindex Wno-missing-field-initializers
6948 @opindex W
6949 @opindex Wextra
6950 @opindex Wno-extra
6951 Warn if a structure's initializer has some fields missing. For
6952 example, the following code causes such a warning, because
6953 @code{x.h} is implicitly zero:
6954
6955 @smallexample
6956 struct s @{ int f, g, h; @};
6957 struct s x = @{ 3, 4 @};
6958 @end smallexample
6959
6960 This option does not warn about designated initializers, so the following
6961 modification does not trigger a warning:
6962
6963 @smallexample
6964 struct s @{ int f, g, h; @};
6965 struct s x = @{ .f = 3, .g = 4 @};
6966 @end smallexample
6967
6968 In C this option does not warn about the universal zero initializer
6969 @samp{@{ 0 @}}:
6970
6971 @smallexample
6972 struct s @{ int f, g, h; @};
6973 struct s x = @{ 0 @};
6974 @end smallexample
6975
6976 Likewise, in C++ this option does not warn about the empty @{ @}
6977 initializer, for example:
6978
6979 @smallexample
6980 struct s @{ int f, g, h; @};
6981 s x = @{ @};
6982 @end smallexample
6983
6984 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6985 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6986
6987 @item -Wno-multichar
6988 @opindex Wno-multichar
6989 @opindex Wmultichar
6990 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6991 Usually they indicate a typo in the user's code, as they have
6992 implementation-defined values, and should not be used in portable code.
6993
6994 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6995 @opindex Wnormalized=
6996 @opindex Wnormalized
6997 @opindex Wno-normalized
6998 @cindex NFC
6999 @cindex NFKC
7000 @cindex character set, input normalization
7001 In ISO C and ISO C++, two identifiers are different if they are
7002 different sequences of characters. However, sometimes when characters
7003 outside the basic ASCII character set are used, you can have two
7004 different character sequences that look the same. To avoid confusion,
7005 the ISO 10646 standard sets out some @dfn{normalization rules} which
7006 when applied ensure that two sequences that look the same are turned into
7007 the same sequence. GCC can warn you if you are using identifiers that
7008 have not been normalized; this option controls that warning.
7009
7010 There are four levels of warning supported by GCC@. The default is
7011 @option{-Wnormalized=nfc}, which warns about any identifier that is
7012 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7013 recommended form for most uses. It is equivalent to
7014 @option{-Wnormalized}.
7015
7016 Unfortunately, there are some characters allowed in identifiers by
7017 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7018 identifiers. That is, there's no way to use these symbols in portable
7019 ISO C or C++ and have all your identifiers in NFC@.
7020 @option{-Wnormalized=id} suppresses the warning for these characters.
7021 It is hoped that future versions of the standards involved will correct
7022 this, which is why this option is not the default.
7023
7024 You can switch the warning off for all characters by writing
7025 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7026 only do this if you are using some other normalization scheme (like
7027 ``D''), because otherwise you can easily create bugs that are
7028 literally impossible to see.
7029
7030 Some characters in ISO 10646 have distinct meanings but look identical
7031 in some fonts or display methodologies, especially once formatting has
7032 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7033 LETTER N'', displays just like a regular @code{n} that has been
7034 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7035 normalization scheme to convert all these into a standard form as
7036 well, and GCC warns if your code is not in NFKC if you use
7037 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7038 about every identifier that contains the letter O because it might be
7039 confused with the digit 0, and so is not the default, but may be
7040 useful as a local coding convention if the programming environment
7041 cannot be fixed to display these characters distinctly.
7042
7043 @item -Wno-attribute-warning
7044 @opindex Wno-attribute-warning
7045 @opindex Wattribute-warning
7046 Do not warn about usage of functions (@pxref{Function Attributes})
7047 declared with @code{warning} attribute. By default, this warning is
7048 enabled. @option{-Wno-attribute-warning} can be used to disable the
7049 warning or @option{-Wno-error=attribute-warning} can be used to
7050 disable the error when compiled with @option{-Werror} flag.
7051
7052 @item -Wno-deprecated
7053 @opindex Wno-deprecated
7054 @opindex Wdeprecated
7055 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7056
7057 @item -Wno-deprecated-declarations
7058 @opindex Wno-deprecated-declarations
7059 @opindex Wdeprecated-declarations
7060 Do not warn about uses of functions (@pxref{Function Attributes}),
7061 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7062 Attributes}) marked as deprecated by using the @code{deprecated}
7063 attribute.
7064
7065 @item -Wno-overflow
7066 @opindex Wno-overflow
7067 @opindex Woverflow
7068 Do not warn about compile-time overflow in constant expressions.
7069
7070 @item -Wno-odr
7071 @opindex Wno-odr
7072 @opindex Wodr
7073 Warn about One Definition Rule violations during link-time optimization.
7074 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7075
7076 @item -Wopenmp-simd
7077 @opindex Wopenmp-simd
7078 @opindex Wno-openmp-simd
7079 Warn if the vectorizer cost model overrides the OpenMP
7080 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7081 option can be used to relax the cost model.
7082
7083 @item -Woverride-init @r{(C and Objective-C only)}
7084 @opindex Woverride-init
7085 @opindex Wno-override-init
7086 @opindex W
7087 @opindex Wextra
7088 @opindex Wno-extra
7089 Warn if an initialized field without side effects is overridden when
7090 using designated initializers (@pxref{Designated Inits, , Designated
7091 Initializers}).
7092
7093 This warning is included in @option{-Wextra}. To get other
7094 @option{-Wextra} warnings without this one, use @option{-Wextra
7095 -Wno-override-init}.
7096
7097 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7098 @opindex Woverride-init-side-effects
7099 @opindex Wno-override-init-side-effects
7100 Warn if an initialized field with side effects is overridden when
7101 using designated initializers (@pxref{Designated Inits, , Designated
7102 Initializers}). This warning is enabled by default.
7103
7104 @item -Wpacked
7105 @opindex Wpacked
7106 @opindex Wno-packed
7107 Warn if a structure is given the packed attribute, but the packed
7108 attribute has no effect on the layout or size of the structure.
7109 Such structures may be mis-aligned for little benefit. For
7110 instance, in this code, the variable @code{f.x} in @code{struct bar}
7111 is misaligned even though @code{struct bar} does not itself
7112 have the packed attribute:
7113
7114 @smallexample
7115 @group
7116 struct foo @{
7117 int x;
7118 char a, b, c, d;
7119 @} __attribute__((packed));
7120 struct bar @{
7121 char z;
7122 struct foo f;
7123 @};
7124 @end group
7125 @end smallexample
7126
7127 @item -Wpacked-bitfield-compat
7128 @opindex Wpacked-bitfield-compat
7129 @opindex Wno-packed-bitfield-compat
7130 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7131 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7132 the change can lead to differences in the structure layout. GCC
7133 informs you when the offset of such a field has changed in GCC 4.4.
7134 For example there is no longer a 4-bit padding between field @code{a}
7135 and @code{b} in this structure:
7136
7137 @smallexample
7138 struct foo
7139 @{
7140 char a:4;
7141 char b:8;
7142 @} __attribute__ ((packed));
7143 @end smallexample
7144
7145 This warning is enabled by default. Use
7146 @option{-Wno-packed-bitfield-compat} to disable this warning.
7147
7148 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7149 @opindex Wpacked-not-aligned
7150 @opindex Wno-packed-not-aligned
7151 Warn if a structure field with explicitly specified alignment in a
7152 packed struct or union is misaligned. For example, a warning will
7153 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7154 'struct S' is less than 8}, in this code:
7155
7156 @smallexample
7157 @group
7158 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7159 struct __attribute__ ((packed)) S @{
7160 struct S8 s8;
7161 @};
7162 @end group
7163 @end smallexample
7164
7165 This warning is enabled by @option{-Wall}.
7166
7167 @item -Wpadded
7168 @opindex Wpadded
7169 @opindex Wno-padded
7170 Warn if padding is included in a structure, either to align an element
7171 of the structure or to align the whole structure. Sometimes when this
7172 happens it is possible to rearrange the fields of the structure to
7173 reduce the padding and so make the structure smaller.
7174
7175 @item -Wredundant-decls
7176 @opindex Wredundant-decls
7177 @opindex Wno-redundant-decls
7178 Warn if anything is declared more than once in the same scope, even in
7179 cases where multiple declaration is valid and changes nothing.
7180
7181 @item -Wno-restrict
7182 @opindex Wrestrict
7183 @opindex Wno-restrict
7184 Warn when an object referenced by a @code{restrict}-qualified parameter
7185 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7186 argument, or when copies between such objects overlap. For example,
7187 the call to the @code{strcpy} function below attempts to truncate the string
7188 by replacing its initial characters with the last four. However, because
7189 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7190 the call is diagnosed.
7191
7192 @smallexample
7193 void foo (void)
7194 @{
7195 char a[] = "abcd1234";
7196 strcpy (a, a + 4);
7197 @dots{}
7198 @}
7199 @end smallexample
7200 The @option{-Wrestrict} option detects some instances of simple overlap
7201 even without optimization but works best at @option{-O2} and above. It
7202 is included in @option{-Wall}.
7203
7204 @item -Wnested-externs @r{(C and Objective-C only)}
7205 @opindex Wnested-externs
7206 @opindex Wno-nested-externs
7207 Warn if an @code{extern} declaration is encountered within a function.
7208
7209 @item -Wno-inherited-variadic-ctor
7210 @opindex Winherited-variadic-ctor
7211 @opindex Wno-inherited-variadic-ctor
7212 Suppress warnings about use of C++11 inheriting constructors when the
7213 base class inherited from has a C variadic constructor; the warning is
7214 on by default because the ellipsis is not inherited.
7215
7216 @item -Winline
7217 @opindex Winline
7218 @opindex Wno-inline
7219 Warn if a function that is declared as inline cannot be inlined.
7220 Even with this option, the compiler does not warn about failures to
7221 inline functions declared in system headers.
7222
7223 The compiler uses a variety of heuristics to determine whether or not
7224 to inline a function. For example, the compiler takes into account
7225 the size of the function being inlined and the amount of inlining
7226 that has already been done in the current function. Therefore,
7227 seemingly insignificant changes in the source program can cause the
7228 warnings produced by @option{-Winline} to appear or disappear.
7229
7230 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7231 @opindex Wno-invalid-offsetof
7232 @opindex Winvalid-offsetof
7233 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7234 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7235 to a non-standard-layout type is undefined. In existing C++ implementations,
7236 however, @code{offsetof} typically gives meaningful results.
7237 This flag is for users who are aware that they are
7238 writing nonportable code and who have deliberately chosen to ignore the
7239 warning about it.
7240
7241 The restrictions on @code{offsetof} may be relaxed in a future version
7242 of the C++ standard.
7243
7244 @item -Wint-in-bool-context
7245 @opindex Wint-in-bool-context
7246 @opindex Wno-int-in-bool-context
7247 Warn for suspicious use of integer values where boolean values are expected,
7248 such as conditional expressions (?:) using non-boolean integer constants in
7249 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7250 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7251 for all kinds of multiplications regardless of the data type.
7252 This warning is enabled by @option{-Wall}.
7253
7254 @item -Wno-int-to-pointer-cast
7255 @opindex Wno-int-to-pointer-cast
7256 @opindex Wint-to-pointer-cast
7257 Suppress warnings from casts to pointer type of an integer of a
7258 different size. In C++, casting to a pointer type of smaller size is
7259 an error. @option{Wint-to-pointer-cast} is enabled by default.
7260
7261
7262 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7263 @opindex Wno-pointer-to-int-cast
7264 @opindex Wpointer-to-int-cast
7265 Suppress warnings from casts from a pointer to an integer type of a
7266 different size.
7267
7268 @item -Winvalid-pch
7269 @opindex Winvalid-pch
7270 @opindex Wno-invalid-pch
7271 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7272 the search path but cannot be used.
7273
7274 @item -Wlong-long
7275 @opindex Wlong-long
7276 @opindex Wno-long-long
7277 Warn if @code{long long} type is used. This is enabled by either
7278 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7279 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7280
7281 @item -Wvariadic-macros
7282 @opindex Wvariadic-macros
7283 @opindex Wno-variadic-macros
7284 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7285 alternate syntax is used in ISO C99 mode. This is enabled by either
7286 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7287 messages, use @option{-Wno-variadic-macros}.
7288
7289 @item -Wvarargs
7290 @opindex Wvarargs
7291 @opindex Wno-varargs
7292 Warn upon questionable usage of the macros used to handle variable
7293 arguments like @code{va_start}. This is default. To inhibit the
7294 warning messages, use @option{-Wno-varargs}.
7295
7296 @item -Wvector-operation-performance
7297 @opindex Wvector-operation-performance
7298 @opindex Wno-vector-operation-performance
7299 Warn if vector operation is not implemented via SIMD capabilities of the
7300 architecture. Mainly useful for the performance tuning.
7301 Vector operation can be implemented @code{piecewise}, which means that the
7302 scalar operation is performed on every vector element;
7303 @code{in parallel}, which means that the vector operation is implemented
7304 using scalars of wider type, which normally is more performance efficient;
7305 and @code{as a single scalar}, which means that vector fits into a
7306 scalar type.
7307
7308 @item -Wno-virtual-move-assign
7309 @opindex Wvirtual-move-assign
7310 @opindex Wno-virtual-move-assign
7311 Suppress warnings about inheriting from a virtual base with a
7312 non-trivial C++11 move assignment operator. This is dangerous because
7313 if the virtual base is reachable along more than one path, it is
7314 moved multiple times, which can mean both objects end up in the
7315 moved-from state. If the move assignment operator is written to avoid
7316 moving from a moved-from object, this warning can be disabled.
7317
7318 @item -Wvla
7319 @opindex Wvla
7320 @opindex Wno-vla
7321 Warn if a variable-length array is used in the code.
7322 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7323 the variable-length array.
7324
7325 @item -Wvla-larger-than=@var{byte-size}
7326 @opindex Wvla-larger-than=
7327 @opindex Wno-vla-larger-than
7328 If this option is used, the compiler will warn for declarations of
7329 variable-length arrays whose size is either unbounded, or bounded
7330 by an argument that allows the array size to exceed @var{byte-size}
7331 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7332 works, but with variable-length arrays.
7333
7334 Note that GCC may optimize small variable-length arrays of a known
7335 value into plain arrays, so this warning may not get triggered for
7336 such arrays.
7337
7338 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7339 is typically only effective when @option{-ftree-vrp} is active (default
7340 for @option{-O2} and above).
7341
7342 See also @option{-Walloca-larger-than=@var{byte-size}}.
7343
7344 @item -Wno-vla-larger-than
7345 @opindex Wno-vla-larger-than
7346 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7347 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7348
7349 @item -Wvolatile-register-var
7350 @opindex Wvolatile-register-var
7351 @opindex Wno-volatile-register-var
7352 Warn if a register variable is declared volatile. The volatile
7353 modifier does not inhibit all optimizations that may eliminate reads
7354 and/or writes to register variables. This warning is enabled by
7355 @option{-Wall}.
7356
7357 @item -Wdisabled-optimization
7358 @opindex Wdisabled-optimization
7359 @opindex Wno-disabled-optimization
7360 Warn if a requested optimization pass is disabled. This warning does
7361 not generally indicate that there is anything wrong with your code; it
7362 merely indicates that GCC's optimizers are unable to handle the code
7363 effectively. Often, the problem is that your code is too big or too
7364 complex; GCC refuses to optimize programs when the optimization
7365 itself is likely to take inordinate amounts of time.
7366
7367 @item -Wpointer-sign @r{(C and Objective-C only)}
7368 @opindex Wpointer-sign
7369 @opindex Wno-pointer-sign
7370 Warn for pointer argument passing or assignment with different signedness.
7371 This option is only supported for C and Objective-C@. It is implied by
7372 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7373 @option{-Wno-pointer-sign}.
7374
7375 @item -Wstack-protector
7376 @opindex Wstack-protector
7377 @opindex Wno-stack-protector
7378 This option is only active when @option{-fstack-protector} is active. It
7379 warns about functions that are not protected against stack smashing.
7380
7381 @item -Woverlength-strings
7382 @opindex Woverlength-strings
7383 @opindex Wno-overlength-strings
7384 Warn about string constants that are longer than the ``minimum
7385 maximum'' length specified in the C standard. Modern compilers
7386 generally allow string constants that are much longer than the
7387 standard's minimum limit, but very portable programs should avoid
7388 using longer strings.
7389
7390 The limit applies @emph{after} string constant concatenation, and does
7391 not count the trailing NUL@. In C90, the limit was 509 characters; in
7392 C99, it was raised to 4095. C++98 does not specify a normative
7393 minimum maximum, so we do not diagnose overlength strings in C++@.
7394
7395 This option is implied by @option{-Wpedantic}, and can be disabled with
7396 @option{-Wno-overlength-strings}.
7397
7398 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7399 @opindex Wunsuffixed-float-constants
7400 @opindex Wno-unsuffixed-float-constants
7401
7402 Issue a warning for any floating constant that does not have
7403 a suffix. When used together with @option{-Wsystem-headers} it
7404 warns about such constants in system header files. This can be useful
7405 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7406 from the decimal floating-point extension to C99.
7407
7408 @item -Wno-designated-init @r{(C and Objective-C only)}
7409 Suppress warnings when a positional initializer is used to initialize
7410 a structure that has been marked with the @code{designated_init}
7411 attribute.
7412
7413 @item -Whsa
7414 Issue a warning when HSAIL cannot be emitted for the compiled function or
7415 OpenMP construct.
7416
7417 @end table
7418
7419 @node Debugging Options
7420 @section Options for Debugging Your Program
7421 @cindex options, debugging
7422 @cindex debugging information options
7423
7424 To tell GCC to emit extra information for use by a debugger, in almost
7425 all cases you need only to add @option{-g} to your other options.
7426
7427 GCC allows you to use @option{-g} with
7428 @option{-O}. The shortcuts taken by optimized code may occasionally
7429 be surprising: some variables you declared may not exist
7430 at all; flow of control may briefly move where you did not expect it;
7431 some statements may not be executed because they compute constant
7432 results or their values are already at hand; some statements may
7433 execute in different places because they have been moved out of loops.
7434 Nevertheless it is possible to debug optimized output. This makes
7435 it reasonable to use the optimizer for programs that might have bugs.
7436
7437 If you are not using some other optimization option, consider
7438 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7439 With no @option{-O} option at all, some compiler passes that collect
7440 information useful for debugging do not run at all, so that
7441 @option{-Og} may result in a better debugging experience.
7442
7443 @table @gcctabopt
7444 @item -g
7445 @opindex g
7446 Produce debugging information in the operating system's native format
7447 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7448 information.
7449
7450 On most systems that use stabs format, @option{-g} enables use of extra
7451 debugging information that only GDB can use; this extra information
7452 makes debugging work better in GDB but probably makes other debuggers
7453 crash or
7454 refuse to read the program. If you want to control for certain whether
7455 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7456 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7457
7458 @item -ggdb
7459 @opindex ggdb
7460 Produce debugging information for use by GDB@. This means to use the
7461 most expressive format available (DWARF, stabs, or the native format
7462 if neither of those are supported), including GDB extensions if at all
7463 possible.
7464
7465 @item -gdwarf
7466 @itemx -gdwarf-@var{version}
7467 @opindex gdwarf
7468 Produce debugging information in DWARF format (if that is supported).
7469 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7470 for most targets is 4. DWARF Version 5 is only experimental.
7471
7472 Note that with DWARF Version 2, some ports require and always
7473 use some non-conflicting DWARF 3 extensions in the unwind tables.
7474
7475 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7476 for maximum benefit.
7477
7478 GCC no longer supports DWARF Version 1, which is substantially
7479 different than Version 2 and later. For historical reasons, some
7480 other DWARF-related options such as
7481 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7482 in their names, but apply to all currently-supported versions of DWARF.
7483
7484 @item -gstabs
7485 @opindex gstabs
7486 Produce debugging information in stabs format (if that is supported),
7487 without GDB extensions. This is the format used by DBX on most BSD
7488 systems. On MIPS, Alpha and System V Release 4 systems this option
7489 produces stabs debugging output that is not understood by DBX@.
7490 On System V Release 4 systems this option requires the GNU assembler.
7491
7492 @item -gstabs+
7493 @opindex gstabs+
7494 Produce debugging information in stabs format (if that is supported),
7495 using GNU extensions understood only by the GNU debugger (GDB)@. The
7496 use of these extensions is likely to make other debuggers crash or
7497 refuse to read the program.
7498
7499 @item -gxcoff
7500 @opindex gxcoff
7501 Produce debugging information in XCOFF format (if that is supported).
7502 This is the format used by the DBX debugger on IBM RS/6000 systems.
7503
7504 @item -gxcoff+
7505 @opindex gxcoff+
7506 Produce debugging information in XCOFF format (if that is supported),
7507 using GNU extensions understood only by the GNU debugger (GDB)@. The
7508 use of these extensions is likely to make other debuggers crash or
7509 refuse to read the program, and may cause assemblers other than the GNU
7510 assembler (GAS) to fail with an error.
7511
7512 @item -gvms
7513 @opindex gvms
7514 Produce debugging information in Alpha/VMS debug format (if that is
7515 supported). This is the format used by DEBUG on Alpha/VMS systems.
7516
7517 @item -g@var{level}
7518 @itemx -ggdb@var{level}
7519 @itemx -gstabs@var{level}
7520 @itemx -gxcoff@var{level}
7521 @itemx -gvms@var{level}
7522 Request debugging information and also use @var{level} to specify how
7523 much information. The default level is 2.
7524
7525 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7526 @option{-g}.
7527
7528 Level 1 produces minimal information, enough for making backtraces in
7529 parts of the program that you don't plan to debug. This includes
7530 descriptions of functions and external variables, and line number
7531 tables, but no information about local variables.
7532
7533 Level 3 includes extra information, such as all the macro definitions
7534 present in the program. Some debuggers support macro expansion when
7535 you use @option{-g3}.
7536
7537 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7538 confusion with @option{-gdwarf-@var{level}}.
7539 Instead use an additional @option{-g@var{level}} option to change the
7540 debug level for DWARF.
7541
7542 @item -feliminate-unused-debug-symbols
7543 @opindex feliminate-unused-debug-symbols
7544 Produce debugging information in stabs format (if that is supported),
7545 for only symbols that are actually used.
7546
7547 @item -femit-class-debug-always
7548 @opindex femit-class-debug-always
7549 Instead of emitting debugging information for a C++ class in only one
7550 object file, emit it in all object files using the class. This option
7551 should be used only with debuggers that are unable to handle the way GCC
7552 normally emits debugging information for classes because using this
7553 option increases the size of debugging information by as much as a
7554 factor of two.
7555
7556 @item -fno-merge-debug-strings
7557 @opindex fmerge-debug-strings
7558 @opindex fno-merge-debug-strings
7559 Direct the linker to not merge together strings in the debugging
7560 information that are identical in different object files. Merging is
7561 not supported by all assemblers or linkers. Merging decreases the size
7562 of the debug information in the output file at the cost of increasing
7563 link processing time. Merging is enabled by default.
7564
7565 @item -fdebug-prefix-map=@var{old}=@var{new}
7566 @opindex fdebug-prefix-map
7567 When compiling files residing in directory @file{@var{old}}, record
7568 debugging information describing them as if the files resided in
7569 directory @file{@var{new}} instead. This can be used to replace a
7570 build-time path with an install-time path in the debug info. It can
7571 also be used to change an absolute path to a relative path by using
7572 @file{.} for @var{new}. This can give more reproducible builds, which
7573 are location independent, but may require an extra command to tell GDB
7574 where to find the source files. See also @option{-ffile-prefix-map}.
7575
7576 @item -fvar-tracking
7577 @opindex fvar-tracking
7578 Run variable tracking pass. It computes where variables are stored at each
7579 position in code. Better debugging information is then generated
7580 (if the debugging information format supports this information).
7581
7582 It is enabled by default when compiling with optimization (@option{-Os},
7583 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7584 the debug info format supports it.
7585
7586 @item -fvar-tracking-assignments
7587 @opindex fvar-tracking-assignments
7588 @opindex fno-var-tracking-assignments
7589 Annotate assignments to user variables early in the compilation and
7590 attempt to carry the annotations over throughout the compilation all the
7591 way to the end, in an attempt to improve debug information while
7592 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7593
7594 It can be enabled even if var-tracking is disabled, in which case
7595 annotations are created and maintained, but discarded at the end.
7596 By default, this flag is enabled together with @option{-fvar-tracking},
7597 except when selective scheduling is enabled.
7598
7599 @item -gsplit-dwarf
7600 @opindex gsplit-dwarf
7601 Separate as much DWARF debugging information as possible into a
7602 separate output file with the extension @file{.dwo}. This option allows
7603 the build system to avoid linking files with debug information. To
7604 be useful, this option requires a debugger capable of reading @file{.dwo}
7605 files.
7606
7607 @item -gdescribe-dies
7608 @opindex gdescribe-dies
7609 Add description attributes to some DWARF DIEs that have no name attribute,
7610 such as artificial variables, external references and call site
7611 parameter DIEs.
7612
7613 @item -gpubnames
7614 @opindex gpubnames
7615 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7616
7617 @item -ggnu-pubnames
7618 @opindex ggnu-pubnames
7619 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7620 suitable for conversion into a GDB@ index. This option is only useful
7621 with a linker that can produce GDB@ index version 7.
7622
7623 @item -fdebug-types-section
7624 @opindex fdebug-types-section
7625 @opindex fno-debug-types-section
7626 When using DWARF Version 4 or higher, type DIEs can be put into
7627 their own @code{.debug_types} section instead of making them part of the
7628 @code{.debug_info} section. It is more efficient to put them in a separate
7629 comdat section since the linker can then remove duplicates.
7630 But not all DWARF consumers support @code{.debug_types} sections yet
7631 and on some objects @code{.debug_types} produces larger instead of smaller
7632 debugging information.
7633
7634 @item -grecord-gcc-switches
7635 @itemx -gno-record-gcc-switches
7636 @opindex grecord-gcc-switches
7637 @opindex gno-record-gcc-switches
7638 This switch causes the command-line options used to invoke the
7639 compiler that may affect code generation to be appended to the
7640 DW_AT_producer attribute in DWARF debugging information. The options
7641 are concatenated with spaces separating them from each other and from
7642 the compiler version.
7643 It is enabled by default.
7644 See also @option{-frecord-gcc-switches} for another
7645 way of storing compiler options into the object file.
7646
7647 @item -gstrict-dwarf
7648 @opindex gstrict-dwarf
7649 Disallow using extensions of later DWARF standard version than selected
7650 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7651 DWARF extensions from later standard versions is allowed.
7652
7653 @item -gno-strict-dwarf
7654 @opindex gno-strict-dwarf
7655 Allow using extensions of later DWARF standard version than selected with
7656 @option{-gdwarf-@var{version}}.
7657
7658 @item -gas-loc-support
7659 @opindex gas-loc-support
7660 Inform the compiler that the assembler supports @code{.loc} directives.
7661 It may then use them for the assembler to generate DWARF2+ line number
7662 tables.
7663
7664 This is generally desirable, because assembler-generated line-number
7665 tables are a lot more compact than those the compiler can generate
7666 itself.
7667
7668 This option will be enabled by default if, at GCC configure time, the
7669 assembler was found to support such directives.
7670
7671 @item -gno-as-loc-support
7672 @opindex gno-as-loc-support
7673 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7674 line number tables are to be generated.
7675
7676 @item gas-locview-support
7677 @opindex gas-locview-support
7678 Inform the compiler that the assembler supports @code{view} assignment
7679 and reset assertion checking in @code{.loc} directives.
7680
7681 This option will be enabled by default if, at GCC configure time, the
7682 assembler was found to support them.
7683
7684 @item gno-as-locview-support
7685 Force GCC to assign view numbers internally, if
7686 @option{-gvariable-location-views} are explicitly requested.
7687
7688 @item -gcolumn-info
7689 @itemx -gno-column-info
7690 @opindex gcolumn-info
7691 @opindex gno-column-info
7692 Emit location column information into DWARF debugging information, rather
7693 than just file and line.
7694 This option is enabled by default.
7695
7696 @item -gstatement-frontiers
7697 @itemx -gno-statement-frontiers
7698 @opindex gstatement-frontiers
7699 @opindex gno-statement-frontiers
7700 This option causes GCC to create markers in the internal representation
7701 at the beginning of statements, and to keep them roughly in place
7702 throughout compilation, using them to guide the output of @code{is_stmt}
7703 markers in the line number table. This is enabled by default when
7704 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7705 @dots{}), and outputting DWARF 2 debug information at the normal level.
7706
7707 @item -gvariable-location-views
7708 @itemx -gvariable-location-views=incompat5
7709 @itemx -gno-variable-location-views
7710 @opindex gvariable-location-views
7711 @opindex gvariable-location-views=incompat5
7712 @opindex gno-variable-location-views
7713 Augment variable location lists with progressive view numbers implied
7714 from the line number table. This enables debug information consumers to
7715 inspect state at certain points of the program, even if no instructions
7716 associated with the corresponding source locations are present at that
7717 point. If the assembler lacks support for view numbers in line number
7718 tables, this will cause the compiler to emit the line number table,
7719 which generally makes them somewhat less compact. The augmented line
7720 number tables and location lists are fully backward-compatible, so they
7721 can be consumed by debug information consumers that are not aware of
7722 these augmentations, but they won't derive any benefit from them either.
7723
7724 This is enabled by default when outputting DWARF 2 debug information at
7725 the normal level, as long as there is assembler support,
7726 @option{-fvar-tracking-assignments} is enabled and
7727 @option{-gstrict-dwarf} is not. When assembler support is not
7728 available, this may still be enabled, but it will force GCC to output
7729 internal line number tables, and if
7730 @option{-ginternal-reset-location-views} is not enabled, that will most
7731 certainly lead to silently mismatching location views.
7732
7733 There is a proposed representation for view numbers that is not backward
7734 compatible with the location list format introduced in DWARF 5, that can
7735 be enabled with @option{-gvariable-location-views=incompat5}. This
7736 option may be removed in the future, is only provided as a reference
7737 implementation of the proposed representation. Debug information
7738 consumers are not expected to support this extended format, and they
7739 would be rendered unable to decode location lists using it.
7740
7741 @item -ginternal-reset-location-views
7742 @itemx -gnointernal-reset-location-views
7743 @opindex ginternal-reset-location-views
7744 @opindex gno-internal-reset-location-views
7745 Attempt to determine location views that can be omitted from location
7746 view lists. This requires the compiler to have very accurate insn
7747 length estimates, which isn't always the case, and it may cause
7748 incorrect view lists to be generated silently when using an assembler
7749 that does not support location view lists. The GNU assembler will flag
7750 any such error as a @code{view number mismatch}. This is only enabled
7751 on ports that define a reliable estimation function.
7752
7753 @item -ginline-points
7754 @itemx -gno-inline-points
7755 @opindex ginline-points
7756 @opindex gno-inline-points
7757 Generate extended debug information for inlined functions. Location
7758 view tracking markers are inserted at inlined entry points, so that
7759 address and view numbers can be computed and output in debug
7760 information. This can be enabled independently of location views, in
7761 which case the view numbers won't be output, but it can only be enabled
7762 along with statement frontiers, and it is only enabled by default if
7763 location views are enabled.
7764
7765 @item -gz@r{[}=@var{type}@r{]}
7766 @opindex gz
7767 Produce compressed debug sections in DWARF format, if that is supported.
7768 If @var{type} is not given, the default type depends on the capabilities
7769 of the assembler and linker used. @var{type} may be one of
7770 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7771 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7772 compression in traditional GNU format). If the linker doesn't support
7773 writing compressed debug sections, the option is rejected. Otherwise,
7774 if the assembler does not support them, @option{-gz} is silently ignored
7775 when producing object files.
7776
7777 @item -femit-struct-debug-baseonly
7778 @opindex femit-struct-debug-baseonly
7779 Emit debug information for struct-like types
7780 only when the base name of the compilation source file
7781 matches the base name of file in which the struct is defined.
7782
7783 This option substantially reduces the size of debugging information,
7784 but at significant potential loss in type information to the debugger.
7785 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7786 See @option{-femit-struct-debug-detailed} for more detailed control.
7787
7788 This option works only with DWARF debug output.
7789
7790 @item -femit-struct-debug-reduced
7791 @opindex femit-struct-debug-reduced
7792 Emit debug information for struct-like types
7793 only when the base name of the compilation source file
7794 matches the base name of file in which the type is defined,
7795 unless the struct is a template or defined in a system header.
7796
7797 This option significantly reduces the size of debugging information,
7798 with some potential loss in type information to the debugger.
7799 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7800 See @option{-femit-struct-debug-detailed} for more detailed control.
7801
7802 This option works only with DWARF debug output.
7803
7804 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7805 @opindex femit-struct-debug-detailed
7806 Specify the struct-like types
7807 for which the compiler generates debug information.
7808 The intent is to reduce duplicate struct debug information
7809 between different object files within the same program.
7810
7811 This option is a detailed version of
7812 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7813 which serves for most needs.
7814
7815 A specification has the syntax@*
7816 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7817
7818 The optional first word limits the specification to
7819 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7820 A struct type is used directly when it is the type of a variable, member.
7821 Indirect uses arise through pointers to structs.
7822 That is, when use of an incomplete struct is valid, the use is indirect.
7823 An example is
7824 @samp{struct one direct; struct two * indirect;}.
7825
7826 The optional second word limits the specification to
7827 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7828 Generic structs are a bit complicated to explain.
7829 For C++, these are non-explicit specializations of template classes,
7830 or non-template classes within the above.
7831 Other programming languages have generics,
7832 but @option{-femit-struct-debug-detailed} does not yet implement them.
7833
7834 The third word specifies the source files for those
7835 structs for which the compiler should emit debug information.
7836 The values @samp{none} and @samp{any} have the normal meaning.
7837 The value @samp{base} means that
7838 the base of name of the file in which the type declaration appears
7839 must match the base of the name of the main compilation file.
7840 In practice, this means that when compiling @file{foo.c}, debug information
7841 is generated for types declared in that file and @file{foo.h},
7842 but not other header files.
7843 The value @samp{sys} means those types satisfying @samp{base}
7844 or declared in system or compiler headers.
7845
7846 You may need to experiment to determine the best settings for your application.
7847
7848 The default is @option{-femit-struct-debug-detailed=all}.
7849
7850 This option works only with DWARF debug output.
7851
7852 @item -fno-dwarf2-cfi-asm
7853 @opindex fdwarf2-cfi-asm
7854 @opindex fno-dwarf2-cfi-asm
7855 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7856 instead of using GAS @code{.cfi_*} directives.
7857
7858 @item -fno-eliminate-unused-debug-types
7859 @opindex feliminate-unused-debug-types
7860 @opindex fno-eliminate-unused-debug-types
7861 Normally, when producing DWARF output, GCC avoids producing debug symbol
7862 output for types that are nowhere used in the source file being compiled.
7863 Sometimes it is useful to have GCC emit debugging
7864 information for all types declared in a compilation
7865 unit, regardless of whether or not they are actually used
7866 in that compilation unit, for example
7867 if, in the debugger, you want to cast a value to a type that is
7868 not actually used in your program (but is declared). More often,
7869 however, this results in a significant amount of wasted space.
7870 @end table
7871
7872 @node Optimize Options
7873 @section Options That Control Optimization
7874 @cindex optimize options
7875 @cindex options, optimization
7876
7877 These options control various sorts of optimizations.
7878
7879 Without any optimization option, the compiler's goal is to reduce the
7880 cost of compilation and to make debugging produce the expected
7881 results. Statements are independent: if you stop the program with a
7882 breakpoint between statements, you can then assign a new value to any
7883 variable or change the program counter to any other statement in the
7884 function and get exactly the results you expect from the source
7885 code.
7886
7887 Turning on optimization flags makes the compiler attempt to improve
7888 the performance and/or code size at the expense of compilation time
7889 and possibly the ability to debug the program.
7890
7891 The compiler performs optimization based on the knowledge it has of the
7892 program. Compiling multiple files at once to a single output file mode allows
7893 the compiler to use information gained from all of the files when compiling
7894 each of them.
7895
7896 Not all optimizations are controlled directly by a flag. Only
7897 optimizations that have a flag are listed in this section.
7898
7899 Most optimizations are only enabled if an @option{-O} level is set on
7900 the command line. Otherwise they are disabled, even if individual
7901 optimization flags are specified.
7902
7903 Depending on the target and how GCC was configured, a slightly different
7904 set of optimizations may be enabled at each @option{-O} level than
7905 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7906 to find out the exact set of optimizations that are enabled at each level.
7907 @xref{Overall Options}, for examples.
7908
7909 @table @gcctabopt
7910 @item -O
7911 @itemx -O1
7912 @opindex O
7913 @opindex O1
7914 Optimize. Optimizing compilation takes somewhat more time, and a lot
7915 more memory for a large function.
7916
7917 With @option{-O}, the compiler tries to reduce code size and execution
7918 time, without performing any optimizations that take a great deal of
7919 compilation time.
7920
7921 @option{-O} turns on the following optimization flags:
7922 @gccoptlist{
7923 -fauto-inc-dec @gol
7924 -fbranch-count-reg @gol
7925 -fcombine-stack-adjustments @gol
7926 -fcompare-elim @gol
7927 -fcprop-registers @gol
7928 -fdce @gol
7929 -fdefer-pop @gol
7930 -fdelayed-branch @gol
7931 -fdse @gol
7932 -fforward-propagate @gol
7933 -fguess-branch-probability @gol
7934 -fif-conversion2 @gol
7935 -fif-conversion @gol
7936 -finline-functions-called-once @gol
7937 -fipa-pure-const @gol
7938 -fipa-profile @gol
7939 -fipa-reference @gol
7940 -fipa-reference-addressable @gol
7941 -fmerge-constants @gol
7942 -fmove-loop-invariants @gol
7943 -fomit-frame-pointer @gol
7944 -freorder-blocks @gol
7945 -fshrink-wrap @gol
7946 -fshrink-wrap-separate @gol
7947 -fsplit-wide-types @gol
7948 -fssa-backprop @gol
7949 -fssa-phiopt @gol
7950 -ftree-bit-ccp @gol
7951 -ftree-ccp @gol
7952 -ftree-ch @gol
7953 -ftree-coalesce-vars @gol
7954 -ftree-copy-prop @gol
7955 -ftree-dce @gol
7956 -ftree-dominator-opts @gol
7957 -ftree-dse @gol
7958 -ftree-forwprop @gol
7959 -ftree-fre @gol
7960 -ftree-phiprop @gol
7961 -ftree-scev-cprop @gol
7962 -ftree-sink @gol
7963 -ftree-slsr @gol
7964 -ftree-sra @gol
7965 -ftree-pta @gol
7966 -ftree-ter @gol
7967 -funit-at-a-time}
7968
7969 @item -O2
7970 @opindex O2
7971 Optimize even more. GCC performs nearly all supported optimizations
7972 that do not involve a space-speed tradeoff.
7973 As compared to @option{-O}, this option increases both compilation time
7974 and the performance of the generated code.
7975
7976 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7977 also turns on the following optimization flags:
7978 @gccoptlist{-fthread-jumps @gol
7979 -falign-functions -falign-jumps @gol
7980 -falign-loops -falign-labels @gol
7981 -fcaller-saves @gol
7982 -fcrossjumping @gol
7983 -fcse-follow-jumps -fcse-skip-blocks @gol
7984 -fdelete-null-pointer-checks @gol
7985 -fdevirtualize -fdevirtualize-speculatively @gol
7986 -fexpensive-optimizations @gol
7987 -fgcse -fgcse-lm @gol
7988 -fhoist-adjacent-loads @gol
7989 -finline-small-functions @gol
7990 -findirect-inlining @gol
7991 -fipa-cp @gol
7992 -fipa-bit-cp @gol
7993 -fipa-vrp @gol
7994 -fipa-sra @gol
7995 -fipa-icf @gol
7996 -fisolate-erroneous-paths-dereference @gol
7997 -flra-remat @gol
7998 -foptimize-sibling-calls @gol
7999 -foptimize-strlen @gol
8000 -fpartial-inlining @gol
8001 -fpeephole2 @gol
8002 -freorder-blocks-algorithm=stc @gol
8003 -freorder-blocks-and-partition -freorder-functions @gol
8004 -frerun-cse-after-loop @gol
8005 -fsched-interblock -fsched-spec @gol
8006 -fschedule-insns -fschedule-insns2 @gol
8007 -fstore-merging @gol
8008 -fstrict-aliasing @gol
8009 -ftree-builtin-call-dce @gol
8010 -ftree-switch-conversion -ftree-tail-merge @gol
8011 -fcode-hoisting @gol
8012 -ftree-pre @gol
8013 -ftree-vrp @gol
8014 -fipa-ra}
8015
8016 Please note the warning under @option{-fgcse} about
8017 invoking @option{-O2} on programs that use computed gotos.
8018
8019 @item -O3
8020 @opindex O3
8021 Optimize yet more. @option{-O3} turns on all optimizations specified
8022 by @option{-O2} and also turns on the following optimization flags:
8023 @gccoptlist{-finline-functions @gol
8024 -funswitch-loops @gol
8025 -fpredictive-commoning @gol
8026 -fgcse-after-reload @gol
8027 -ftree-loop-vectorize @gol
8028 -ftree-loop-distribution @gol
8029 -ftree-loop-distribute-patterns @gol
8030 -floop-interchange @gol
8031 -floop-unroll-and-jam @gol
8032 -fsplit-paths @gol
8033 -ftree-slp-vectorize @gol
8034 -fvect-cost-model @gol
8035 -ftree-partial-pre @gol
8036 -fpeel-loops @gol
8037 -fipa-cp-clone}
8038
8039 @item -O0
8040 @opindex O0
8041 Reduce compilation time and make debugging produce the expected
8042 results. This is the default.
8043
8044 @item -Os
8045 @opindex Os
8046 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
8047 do not typically increase code size. It also performs further
8048 optimizations designed to reduce code size.
8049
8050 @option{-Os} disables the following optimization flags:
8051 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
8052 -falign-labels -fprefetch-loop-arrays}
8053
8054 @item -Ofast
8055 @opindex Ofast
8056 Disregard strict standards compliance. @option{-Ofast} enables all
8057 @option{-O3} optimizations. It also enables optimizations that are not
8058 valid for all standard-compliant programs.
8059 It turns on @option{-ffast-math} and the Fortran-specific
8060 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8061 specified, and @option{-fno-protect-parens}.
8062
8063 @item -Og
8064 @opindex Og
8065 Optimize debugging experience. @option{-Og} enables optimizations
8066 that do not interfere with debugging. It should be the optimization
8067 level of choice for the standard edit-compile-debug cycle, offering
8068 a reasonable level of optimization while maintaining fast compilation
8069 and a good debugging experience.
8070 @end table
8071
8072 If you use multiple @option{-O} options, with or without level numbers,
8073 the last such option is the one that is effective.
8074
8075 Options of the form @option{-f@var{flag}} specify machine-independent
8076 flags. Most flags have both positive and negative forms; the negative
8077 form of @option{-ffoo} is @option{-fno-foo}. In the table
8078 below, only one of the forms is listed---the one you typically
8079 use. You can figure out the other form by either removing @samp{no-}
8080 or adding it.
8081
8082 The following options control specific optimizations. They are either
8083 activated by @option{-O} options or are related to ones that are. You
8084 can use the following flags in the rare cases when ``fine-tuning'' of
8085 optimizations to be performed is desired.
8086
8087 @table @gcctabopt
8088 @item -fno-defer-pop
8089 @opindex fno-defer-pop
8090 @opindex fdefer-pop
8091 For machines that must pop arguments after a function call, always pop
8092 the arguments as soon as each function returns.
8093 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8094 this allows the compiler to let arguments accumulate on the stack for several
8095 function calls and pop them all at once.
8096
8097 @item -fforward-propagate
8098 @opindex fforward-propagate
8099 Perform a forward propagation pass on RTL@. The pass tries to combine two
8100 instructions and checks if the result can be simplified. If loop unrolling
8101 is active, two passes are performed and the second is scheduled after
8102 loop unrolling.
8103
8104 This option is enabled by default at optimization levels @option{-O},
8105 @option{-O2}, @option{-O3}, @option{-Os}.
8106
8107 @item -ffp-contract=@var{style}
8108 @opindex ffp-contract
8109 @option{-ffp-contract=off} disables floating-point expression contraction.
8110 @option{-ffp-contract=fast} enables floating-point expression contraction
8111 such as forming of fused multiply-add operations if the target has
8112 native support for them.
8113 @option{-ffp-contract=on} enables floating-point expression contraction
8114 if allowed by the language standard. This is currently not implemented
8115 and treated equal to @option{-ffp-contract=off}.
8116
8117 The default is @option{-ffp-contract=fast}.
8118
8119 @item -fomit-frame-pointer
8120 @opindex fomit-frame-pointer
8121 Omit the frame pointer in functions that don't need one. This avoids the
8122 instructions to save, set up and restore the frame pointer; on many targets
8123 it also makes an extra register available.
8124
8125 On some targets this flag has no effect because the standard calling sequence
8126 always uses a frame pointer, so it cannot be omitted.
8127
8128 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8129 is used in all functions. Several targets always omit the frame pointer in
8130 leaf functions.
8131
8132 Enabled by default at @option{-O} and higher.
8133
8134 @item -foptimize-sibling-calls
8135 @opindex foptimize-sibling-calls
8136 Optimize sibling and tail recursive calls.
8137
8138 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8139
8140 @item -foptimize-strlen
8141 @opindex foptimize-strlen
8142 Optimize various standard C string functions (e.g.@: @code{strlen},
8143 @code{strchr} or @code{strcpy}) and
8144 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8145
8146 Enabled at levels @option{-O2}, @option{-O3}.
8147
8148 @item -fno-inline
8149 @opindex fno-inline
8150 @opindex finline
8151 Do not expand any functions inline apart from those marked with
8152 the @code{always_inline} attribute. This is the default when not
8153 optimizing.
8154
8155 Single functions can be exempted from inlining by marking them
8156 with the @code{noinline} attribute.
8157
8158 @item -finline-small-functions
8159 @opindex finline-small-functions
8160 Integrate functions into their callers when their body is smaller than expected
8161 function call code (so overall size of program gets smaller). The compiler
8162 heuristically decides which functions are simple enough to be worth integrating
8163 in this way. This inlining applies to all functions, even those not declared
8164 inline.
8165
8166 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8167
8168 @item -findirect-inlining
8169 @opindex findirect-inlining
8170 Inline also indirect calls that are discovered to be known at compile
8171 time thanks to previous inlining. This option has any effect only
8172 when inlining itself is turned on by the @option{-finline-functions}
8173 or @option{-finline-small-functions} options.
8174
8175 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8176
8177 @item -finline-functions
8178 @opindex finline-functions
8179 Consider all functions for inlining, even if they are not declared inline.
8180 The compiler heuristically decides which functions are worth integrating
8181 in this way.
8182
8183 If all calls to a given function are integrated, and the function is
8184 declared @code{static}, then the function is normally not output as
8185 assembler code in its own right.
8186
8187 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8188
8189 @item -finline-functions-called-once
8190 @opindex finline-functions-called-once
8191 Consider all @code{static} functions called once for inlining into their
8192 caller even if they are not marked @code{inline}. If a call to a given
8193 function is integrated, then the function is not output as assembler code
8194 in its own right.
8195
8196 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
8197
8198 @item -fearly-inlining
8199 @opindex fearly-inlining
8200 Inline functions marked by @code{always_inline} and functions whose body seems
8201 smaller than the function call overhead early before doing
8202 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8203 makes profiling significantly cheaper and usually inlining faster on programs
8204 having large chains of nested wrapper functions.
8205
8206 Enabled by default.
8207
8208 @item -fipa-sra
8209 @opindex fipa-sra
8210 Perform interprocedural scalar replacement of aggregates, removal of
8211 unused parameters and replacement of parameters passed by reference
8212 by parameters passed by value.
8213
8214 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8215
8216 @item -finline-limit=@var{n}
8217 @opindex finline-limit
8218 By default, GCC limits the size of functions that can be inlined. This flag
8219 allows coarse control of this limit. @var{n} is the size of functions that
8220 can be inlined in number of pseudo instructions.
8221
8222 Inlining is actually controlled by a number of parameters, which may be
8223 specified individually by using @option{--param @var{name}=@var{value}}.
8224 The @option{-finline-limit=@var{n}} option sets some of these parameters
8225 as follows:
8226
8227 @table @gcctabopt
8228 @item max-inline-insns-single
8229 is set to @var{n}/2.
8230 @item max-inline-insns-auto
8231 is set to @var{n}/2.
8232 @end table
8233
8234 See below for a documentation of the individual
8235 parameters controlling inlining and for the defaults of these parameters.
8236
8237 @emph{Note:} there may be no value to @option{-finline-limit} that results
8238 in default behavior.
8239
8240 @emph{Note:} pseudo instruction represents, in this particular context, an
8241 abstract measurement of function's size. In no way does it represent a count
8242 of assembly instructions and as such its exact meaning might change from one
8243 release to an another.
8244
8245 @item -fno-keep-inline-dllexport
8246 @opindex fno-keep-inline-dllexport
8247 @opindex fkeep-inline-dllexport
8248 This is a more fine-grained version of @option{-fkeep-inline-functions},
8249 which applies only to functions that are declared using the @code{dllexport}
8250 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8251 Functions}.
8252
8253 @item -fkeep-inline-functions
8254 @opindex fkeep-inline-functions
8255 In C, emit @code{static} functions that are declared @code{inline}
8256 into the object file, even if the function has been inlined into all
8257 of its callers. This switch does not affect functions using the
8258 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8259 inline functions into the object file.
8260
8261 @item -fkeep-static-functions
8262 @opindex fkeep-static-functions
8263 Emit @code{static} functions into the object file, even if the function
8264 is never used.
8265
8266 @item -fkeep-static-consts
8267 @opindex fkeep-static-consts
8268 Emit variables declared @code{static const} when optimization isn't turned
8269 on, even if the variables aren't referenced.
8270
8271 GCC enables this option by default. If you want to force the compiler to
8272 check if a variable is referenced, regardless of whether or not
8273 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8274
8275 @item -fmerge-constants
8276 @opindex fmerge-constants
8277 Attempt to merge identical constants (string constants and floating-point
8278 constants) across compilation units.
8279
8280 This option is the default for optimized compilation if the assembler and
8281 linker support it. Use @option{-fno-merge-constants} to inhibit this
8282 behavior.
8283
8284 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8285
8286 @item -fmerge-all-constants
8287 @opindex fmerge-all-constants
8288 Attempt to merge identical constants and identical variables.
8289
8290 This option implies @option{-fmerge-constants}. In addition to
8291 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8292 arrays or initialized constant variables with integral or floating-point
8293 types. Languages like C or C++ require each variable, including multiple
8294 instances of the same variable in recursive calls, to have distinct locations,
8295 so using this option results in non-conforming
8296 behavior.
8297
8298 @item -fmodulo-sched
8299 @opindex fmodulo-sched
8300 Perform swing modulo scheduling immediately before the first scheduling
8301 pass. This pass looks at innermost loops and reorders their
8302 instructions by overlapping different iterations.
8303
8304 @item -fmodulo-sched-allow-regmoves
8305 @opindex fmodulo-sched-allow-regmoves
8306 Perform more aggressive SMS-based modulo scheduling with register moves
8307 allowed. By setting this flag certain anti-dependences edges are
8308 deleted, which triggers the generation of reg-moves based on the
8309 life-range analysis. This option is effective only with
8310 @option{-fmodulo-sched} enabled.
8311
8312 @item -fno-branch-count-reg
8313 @opindex fno-branch-count-reg
8314 @opindex fbranch-count-reg
8315 Disable the optimization pass that scans for opportunities to use
8316 ``decrement and branch'' instructions on a count register instead of
8317 instruction sequences that decrement a register, compare it against zero, and
8318 then branch based upon the result. This option is only meaningful on
8319 architectures that support such instructions, which include x86, PowerPC,
8320 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8321 doesn't remove the decrement and branch instructions from the generated
8322 instruction stream introduced by other optimization passes.
8323
8324 The default is @option{-fbranch-count-reg} at @option{-O1} and higher.
8325
8326 @item -fno-function-cse
8327 @opindex fno-function-cse
8328 @opindex ffunction-cse
8329 Do not put function addresses in registers; make each instruction that
8330 calls a constant function contain the function's address explicitly.
8331
8332 This option results in less efficient code, but some strange hacks
8333 that alter the assembler output may be confused by the optimizations
8334 performed when this option is not used.
8335
8336 The default is @option{-ffunction-cse}
8337
8338 @item -fno-zero-initialized-in-bss
8339 @opindex fno-zero-initialized-in-bss
8340 @opindex fzero-initialized-in-bss
8341 If the target supports a BSS section, GCC by default puts variables that
8342 are initialized to zero into BSS@. This can save space in the resulting
8343 code.
8344
8345 This option turns off this behavior because some programs explicitly
8346 rely on variables going to the data section---e.g., so that the
8347 resulting executable can find the beginning of that section and/or make
8348 assumptions based on that.
8349
8350 The default is @option{-fzero-initialized-in-bss}.
8351
8352 @item -fthread-jumps
8353 @opindex fthread-jumps
8354 Perform optimizations that check to see if a jump branches to a
8355 location where another comparison subsumed by the first is found. If
8356 so, the first branch is redirected to either the destination of the
8357 second branch or a point immediately following it, depending on whether
8358 the condition is known to be true or false.
8359
8360 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8361
8362 @item -fsplit-wide-types
8363 @opindex fsplit-wide-types
8364 When using a type that occupies multiple registers, such as @code{long
8365 long} on a 32-bit system, split the registers apart and allocate them
8366 independently. This normally generates better code for those types,
8367 but may make debugging more difficult.
8368
8369 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8370 @option{-Os}.
8371
8372 @item -fcse-follow-jumps
8373 @opindex fcse-follow-jumps
8374 In common subexpression elimination (CSE), scan through jump instructions
8375 when the target of the jump is not reached by any other path. For
8376 example, when CSE encounters an @code{if} statement with an
8377 @code{else} clause, CSE follows the jump when the condition
8378 tested is false.
8379
8380 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8381
8382 @item -fcse-skip-blocks
8383 @opindex fcse-skip-blocks
8384 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8385 follow jumps that conditionally skip over blocks. When CSE
8386 encounters a simple @code{if} statement with no else clause,
8387 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8388 body of the @code{if}.
8389
8390 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8391
8392 @item -frerun-cse-after-loop
8393 @opindex frerun-cse-after-loop
8394 Re-run common subexpression elimination after loop optimizations are
8395 performed.
8396
8397 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8398
8399 @item -fgcse
8400 @opindex fgcse
8401 Perform a global common subexpression elimination pass.
8402 This pass also performs global constant and copy propagation.
8403
8404 @emph{Note:} When compiling a program using computed gotos, a GCC
8405 extension, you may get better run-time performance if you disable
8406 the global common subexpression elimination pass by adding
8407 @option{-fno-gcse} to the command line.
8408
8409 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8410
8411 @item -fgcse-lm
8412 @opindex fgcse-lm
8413 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8414 attempts to move loads that are only killed by stores into themselves. This
8415 allows a loop containing a load/store sequence to be changed to a load outside
8416 the loop, and a copy/store within the loop.
8417
8418 Enabled by default when @option{-fgcse} is enabled.
8419
8420 @item -fgcse-sm
8421 @opindex fgcse-sm
8422 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8423 global common subexpression elimination. This pass attempts to move
8424 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8425 loops containing a load/store sequence can be changed to a load before
8426 the loop and a store after the loop.
8427
8428 Not enabled at any optimization level.
8429
8430 @item -fgcse-las
8431 @opindex fgcse-las
8432 When @option{-fgcse-las} is enabled, the global common subexpression
8433 elimination pass eliminates redundant loads that come after stores to the
8434 same memory location (both partial and full redundancies).
8435
8436 Not enabled at any optimization level.
8437
8438 @item -fgcse-after-reload
8439 @opindex fgcse-after-reload
8440 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8441 pass is performed after reload. The purpose of this pass is to clean up
8442 redundant spilling.
8443
8444 @item -faggressive-loop-optimizations
8445 @opindex faggressive-loop-optimizations
8446 This option tells the loop optimizer to use language constraints to
8447 derive bounds for the number of iterations of a loop. This assumes that
8448 loop code does not invoke undefined behavior by for example causing signed
8449 integer overflows or out-of-bound array accesses. The bounds for the
8450 number of iterations of a loop are used to guide loop unrolling and peeling
8451 and loop exit test optimizations.
8452 This option is enabled by default.
8453
8454 @item -funconstrained-commons
8455 @opindex funconstrained-commons
8456 This option tells the compiler that variables declared in common blocks
8457 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8458 prevents certain optimizations that depend on knowing the array bounds.
8459
8460 @item -fcrossjumping
8461 @opindex fcrossjumping
8462 Perform cross-jumping transformation.
8463 This transformation unifies equivalent code and saves code size. The
8464 resulting code may or may not perform better than without cross-jumping.
8465
8466 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8467
8468 @item -fauto-inc-dec
8469 @opindex fauto-inc-dec
8470 Combine increments or decrements of addresses with memory accesses.
8471 This pass is always skipped on architectures that do not have
8472 instructions to support this. Enabled by default at @option{-O} and
8473 higher on architectures that support this.
8474
8475 @item -fdce
8476 @opindex fdce
8477 Perform dead code elimination (DCE) on RTL@.
8478 Enabled by default at @option{-O} and higher.
8479
8480 @item -fdse
8481 @opindex fdse
8482 Perform dead store elimination (DSE) on RTL@.
8483 Enabled by default at @option{-O} and higher.
8484
8485 @item -fif-conversion
8486 @opindex fif-conversion
8487 Attempt to transform conditional jumps into branch-less equivalents. This
8488 includes use of conditional moves, min, max, set flags and abs instructions, and
8489 some tricks doable by standard arithmetics. The use of conditional execution
8490 on chips where it is available is controlled by @option{-fif-conversion2}.
8491
8492 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8493
8494 @item -fif-conversion2
8495 @opindex fif-conversion2
8496 Use conditional execution (where available) to transform conditional jumps into
8497 branch-less equivalents.
8498
8499 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8500
8501 @item -fdeclone-ctor-dtor
8502 @opindex fdeclone-ctor-dtor
8503 The C++ ABI requires multiple entry points for constructors and
8504 destructors: one for a base subobject, one for a complete object, and
8505 one for a virtual destructor that calls operator delete afterwards.
8506 For a hierarchy with virtual bases, the base and complete variants are
8507 clones, which means two copies of the function. With this option, the
8508 base and complete variants are changed to be thunks that call a common
8509 implementation.
8510
8511 Enabled by @option{-Os}.
8512
8513 @item -fdelete-null-pointer-checks
8514 @opindex fdelete-null-pointer-checks
8515 Assume that programs cannot safely dereference null pointers, and that
8516 no code or data element resides at address zero.
8517 This option enables simple constant
8518 folding optimizations at all optimization levels. In addition, other
8519 optimization passes in GCC use this flag to control global dataflow
8520 analyses that eliminate useless checks for null pointers; these assume
8521 that a memory access to address zero always results in a trap, so
8522 that if a pointer is checked after it has already been dereferenced,
8523 it cannot be null.
8524
8525 Note however that in some environments this assumption is not true.
8526 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8527 for programs that depend on that behavior.
8528
8529 This option is enabled by default on most targets. On Nios II ELF, it
8530 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8531
8532 Passes that use the dataflow information
8533 are enabled independently at different optimization levels.
8534
8535 @item -fdevirtualize
8536 @opindex fdevirtualize
8537 Attempt to convert calls to virtual functions to direct calls. This
8538 is done both within a procedure and interprocedurally as part of
8539 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8540 propagation (@option{-fipa-cp}).
8541 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8542
8543 @item -fdevirtualize-speculatively
8544 @opindex fdevirtualize-speculatively
8545 Attempt to convert calls to virtual functions to speculative direct calls.
8546 Based on the analysis of the type inheritance graph, determine for a given call
8547 the set of likely targets. If the set is small, preferably of size 1, change
8548 the call into a conditional deciding between direct and indirect calls. The
8549 speculative calls enable more optimizations, such as inlining. When they seem
8550 useless after further optimization, they are converted back into original form.
8551
8552 @item -fdevirtualize-at-ltrans
8553 @opindex fdevirtualize-at-ltrans
8554 Stream extra information needed for aggressive devirtualization when running
8555 the link-time optimizer in local transformation mode.
8556 This option enables more devirtualization but
8557 significantly increases the size of streamed data. For this reason it is
8558 disabled by default.
8559
8560 @item -fexpensive-optimizations
8561 @opindex fexpensive-optimizations
8562 Perform a number of minor optimizations that are relatively expensive.
8563
8564 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8565
8566 @item -free
8567 @opindex free
8568 Attempt to remove redundant extension instructions. This is especially
8569 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8570 registers after writing to their lower 32-bit half.
8571
8572 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8573 @option{-O3}, @option{-Os}.
8574
8575 @item -fno-lifetime-dse
8576 @opindex fno-lifetime-dse
8577 @opindex flifetime-dse
8578 In C++ the value of an object is only affected by changes within its
8579 lifetime: when the constructor begins, the object has an indeterminate
8580 value, and any changes during the lifetime of the object are dead when
8581 the object is destroyed. Normally dead store elimination will take
8582 advantage of this; if your code relies on the value of the object
8583 storage persisting beyond the lifetime of the object, you can use this
8584 flag to disable this optimization. To preserve stores before the
8585 constructor starts (e.g.@: because your operator new clears the object
8586 storage) but still treat the object as dead after the destructor you,
8587 can use @option{-flifetime-dse=1}. The default behavior can be
8588 explicitly selected with @option{-flifetime-dse=2}.
8589 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8590
8591 @item -flive-range-shrinkage
8592 @opindex flive-range-shrinkage
8593 Attempt to decrease register pressure through register live range
8594 shrinkage. This is helpful for fast processors with small or moderate
8595 size register sets.
8596
8597 @item -fira-algorithm=@var{algorithm}
8598 @opindex fira-algorithm
8599 Use the specified coloring algorithm for the integrated register
8600 allocator. The @var{algorithm} argument can be @samp{priority}, which
8601 specifies Chow's priority coloring, or @samp{CB}, which specifies
8602 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8603 for all architectures, but for those targets that do support it, it is
8604 the default because it generates better code.
8605
8606 @item -fira-region=@var{region}
8607 @opindex fira-region
8608 Use specified regions for the integrated register allocator. The
8609 @var{region} argument should be one of the following:
8610
8611 @table @samp
8612
8613 @item all
8614 Use all loops as register allocation regions.
8615 This can give the best results for machines with a small and/or
8616 irregular register set.
8617
8618 @item mixed
8619 Use all loops except for loops with small register pressure
8620 as the regions. This value usually gives
8621 the best results in most cases and for most architectures,
8622 and is enabled by default when compiling with optimization for speed
8623 (@option{-O}, @option{-O2}, @dots{}).
8624
8625 @item one
8626 Use all functions as a single region.
8627 This typically results in the smallest code size, and is enabled by default for
8628 @option{-Os} or @option{-O0}.
8629
8630 @end table
8631
8632 @item -fira-hoist-pressure
8633 @opindex fira-hoist-pressure
8634 Use IRA to evaluate register pressure in the code hoisting pass for
8635 decisions to hoist expressions. This option usually results in smaller
8636 code, but it can slow the compiler down.
8637
8638 This option is enabled at level @option{-Os} for all targets.
8639
8640 @item -fira-loop-pressure
8641 @opindex fira-loop-pressure
8642 Use IRA to evaluate register pressure in loops for decisions to move
8643 loop invariants. This option usually results in generation
8644 of faster and smaller code on machines with large register files (>= 32
8645 registers), but it can slow the compiler down.
8646
8647 This option is enabled at level @option{-O3} for some targets.
8648
8649 @item -fno-ira-share-save-slots
8650 @opindex fno-ira-share-save-slots
8651 @opindex fira-share-save-slots
8652 Disable sharing of stack slots used for saving call-used hard
8653 registers living through a call. Each hard register gets a
8654 separate stack slot, and as a result function stack frames are
8655 larger.
8656
8657 @item -fno-ira-share-spill-slots
8658 @opindex fno-ira-share-spill-slots
8659 @opindex fira-share-spill-slots
8660 Disable sharing of stack slots allocated for pseudo-registers. Each
8661 pseudo-register that does not get a hard register gets a separate
8662 stack slot, and as a result function stack frames are larger.
8663
8664 @item -flra-remat
8665 @opindex flra-remat
8666 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8667 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8668 values if it is profitable.
8669
8670 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8671
8672 @item -fdelayed-branch
8673 @opindex fdelayed-branch
8674 If supported for the target machine, attempt to reorder instructions
8675 to exploit instruction slots available after delayed branch
8676 instructions.
8677
8678 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8679 but not at @option{-Og}.
8680
8681 @item -fschedule-insns
8682 @opindex fschedule-insns
8683 If supported for the target machine, attempt to reorder instructions to
8684 eliminate execution stalls due to required data being unavailable. This
8685 helps machines that have slow floating point or memory load instructions
8686 by allowing other instructions to be issued until the result of the load
8687 or floating-point instruction is required.
8688
8689 Enabled at levels @option{-O2}, @option{-O3}.
8690
8691 @item -fschedule-insns2
8692 @opindex fschedule-insns2
8693 Similar to @option{-fschedule-insns}, but requests an additional pass of
8694 instruction scheduling after register allocation has been done. This is
8695 especially useful on machines with a relatively small number of
8696 registers and where memory load instructions take more than one cycle.
8697
8698 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8699
8700 @item -fno-sched-interblock
8701 @opindex fno-sched-interblock
8702 @opindex fsched-interblock
8703 Disable instruction scheduling across basic blocks, which
8704 is normally enabled when scheduling before register allocation, i.e.@:
8705 with @option{-fschedule-insns} or at @option{-O2} or higher.
8706
8707 @item -fno-sched-spec
8708 @opindex fno-sched-spec
8709 @opindex fsched-spec
8710 Disable speculative motion of non-load instructions, which
8711 is normally enabled when scheduling before register allocation, i.e.@:
8712 with @option{-fschedule-insns} or at @option{-O2} or higher.
8713
8714 @item -fsched-pressure
8715 @opindex fsched-pressure
8716 Enable register pressure sensitive insn scheduling before register
8717 allocation. This only makes sense when scheduling before register
8718 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8719 @option{-O2} or higher. Usage of this option can improve the
8720 generated code and decrease its size by preventing register pressure
8721 increase above the number of available hard registers and subsequent
8722 spills in register allocation.
8723
8724 @item -fsched-spec-load
8725 @opindex fsched-spec-load
8726 Allow speculative motion of some load instructions. This only makes
8727 sense when scheduling before register allocation, i.e.@: with
8728 @option{-fschedule-insns} or at @option{-O2} or higher.
8729
8730 @item -fsched-spec-load-dangerous
8731 @opindex fsched-spec-load-dangerous
8732 Allow speculative motion of more load instructions. This only makes
8733 sense when scheduling before register allocation, i.e.@: with
8734 @option{-fschedule-insns} or at @option{-O2} or higher.
8735
8736 @item -fsched-stalled-insns
8737 @itemx -fsched-stalled-insns=@var{n}
8738 @opindex fsched-stalled-insns
8739 Define how many insns (if any) can be moved prematurely from the queue
8740 of stalled insns into the ready list during the second scheduling pass.
8741 @option{-fno-sched-stalled-insns} means that no insns are moved
8742 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8743 on how many queued insns can be moved prematurely.
8744 @option{-fsched-stalled-insns} without a value is equivalent to
8745 @option{-fsched-stalled-insns=1}.
8746
8747 @item -fsched-stalled-insns-dep
8748 @itemx -fsched-stalled-insns-dep=@var{n}
8749 @opindex fsched-stalled-insns-dep
8750 Define how many insn groups (cycles) are examined for a dependency
8751 on a stalled insn that is a candidate for premature removal from the queue
8752 of stalled insns. This has an effect only during the second scheduling pass,
8753 and only if @option{-fsched-stalled-insns} is used.
8754 @option{-fno-sched-stalled-insns-dep} is equivalent to
8755 @option{-fsched-stalled-insns-dep=0}.
8756 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8757 @option{-fsched-stalled-insns-dep=1}.
8758
8759 @item -fsched2-use-superblocks
8760 @opindex fsched2-use-superblocks
8761 When scheduling after register allocation, use superblock scheduling.
8762 This allows motion across basic block boundaries,
8763 resulting in faster schedules. This option is experimental, as not all machine
8764 descriptions used by GCC model the CPU closely enough to avoid unreliable
8765 results from the algorithm.
8766
8767 This only makes sense when scheduling after register allocation, i.e.@: with
8768 @option{-fschedule-insns2} or at @option{-O2} or higher.
8769
8770 @item -fsched-group-heuristic
8771 @opindex fsched-group-heuristic
8772 Enable the group heuristic in the scheduler. This heuristic favors
8773 the instruction that belongs to a schedule group. This is enabled
8774 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8775 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8776
8777 @item -fsched-critical-path-heuristic
8778 @opindex fsched-critical-path-heuristic
8779 Enable the critical-path heuristic in the scheduler. This heuristic favors
8780 instructions on the critical path. This is enabled by default when
8781 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8782 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8783
8784 @item -fsched-spec-insn-heuristic
8785 @opindex fsched-spec-insn-heuristic
8786 Enable the speculative instruction heuristic in the scheduler. This
8787 heuristic favors speculative instructions with greater dependency weakness.
8788 This is enabled by default when scheduling is enabled, i.e.@:
8789 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8790 or at @option{-O2} or higher.
8791
8792 @item -fsched-rank-heuristic
8793 @opindex fsched-rank-heuristic
8794 Enable the rank heuristic in the scheduler. This heuristic favors
8795 the instruction belonging to a basic block with greater size or frequency.
8796 This is enabled by default when scheduling is enabled, i.e.@:
8797 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8798 at @option{-O2} or higher.
8799
8800 @item -fsched-last-insn-heuristic
8801 @opindex fsched-last-insn-heuristic
8802 Enable the last-instruction heuristic in the scheduler. This heuristic
8803 favors the instruction that is less dependent on the last instruction
8804 scheduled. This is enabled by default when scheduling is enabled,
8805 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8806 at @option{-O2} or higher.
8807
8808 @item -fsched-dep-count-heuristic
8809 @opindex fsched-dep-count-heuristic
8810 Enable the dependent-count heuristic in the scheduler. This heuristic
8811 favors the instruction that has more instructions depending on it.
8812 This is enabled by default when scheduling is enabled, i.e.@:
8813 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8814 at @option{-O2} or higher.
8815
8816 @item -freschedule-modulo-scheduled-loops
8817 @opindex freschedule-modulo-scheduled-loops
8818 Modulo scheduling is performed before traditional scheduling. If a loop
8819 is modulo scheduled, later scheduling passes may change its schedule.
8820 Use this option to control that behavior.
8821
8822 @item -fselective-scheduling
8823 @opindex fselective-scheduling
8824 Schedule instructions using selective scheduling algorithm. Selective
8825 scheduling runs instead of the first scheduler pass.
8826
8827 @item -fselective-scheduling2
8828 @opindex fselective-scheduling2
8829 Schedule instructions using selective scheduling algorithm. Selective
8830 scheduling runs instead of the second scheduler pass.
8831
8832 @item -fsel-sched-pipelining
8833 @opindex fsel-sched-pipelining
8834 Enable software pipelining of innermost loops during selective scheduling.
8835 This option has no effect unless one of @option{-fselective-scheduling} or
8836 @option{-fselective-scheduling2} is turned on.
8837
8838 @item -fsel-sched-pipelining-outer-loops
8839 @opindex fsel-sched-pipelining-outer-loops
8840 When pipelining loops during selective scheduling, also pipeline outer loops.
8841 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8842
8843 @item -fsemantic-interposition
8844 @opindex fsemantic-interposition
8845 Some object formats, like ELF, allow interposing of symbols by the
8846 dynamic linker.
8847 This means that for symbols exported from the DSO, the compiler cannot perform
8848 interprocedural propagation, inlining and other optimizations in anticipation
8849 that the function or variable in question may change. While this feature is
8850 useful, for example, to rewrite memory allocation functions by a debugging
8851 implementation, it is expensive in the terms of code quality.
8852 With @option{-fno-semantic-interposition} the compiler assumes that
8853 if interposition happens for functions the overwriting function will have
8854 precisely the same semantics (and side effects).
8855 Similarly if interposition happens
8856 for variables, the constructor of the variable will be the same. The flag
8857 has no effect for functions explicitly declared inline
8858 (where it is never allowed for interposition to change semantics)
8859 and for symbols explicitly declared weak.
8860
8861 @item -fshrink-wrap
8862 @opindex fshrink-wrap
8863 Emit function prologues only before parts of the function that need it,
8864 rather than at the top of the function. This flag is enabled by default at
8865 @option{-O} and higher.
8866
8867 @item -fshrink-wrap-separate
8868 @opindex fshrink-wrap-separate
8869 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8870 those parts are only executed when needed.
8871 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8872 is also turned on and the target supports this.
8873
8874 @item -fcaller-saves
8875 @opindex fcaller-saves
8876 Enable allocation of values to registers that are clobbered by
8877 function calls, by emitting extra instructions to save and restore the
8878 registers around such calls. Such allocation is done only when it
8879 seems to result in better code.
8880
8881 This option is always enabled by default on certain machines, usually
8882 those which have no call-preserved registers to use instead.
8883
8884 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8885
8886 @item -fcombine-stack-adjustments
8887 @opindex fcombine-stack-adjustments
8888 Tracks stack adjustments (pushes and pops) and stack memory references
8889 and then tries to find ways to combine them.
8890
8891 Enabled by default at @option{-O1} and higher.
8892
8893 @item -fipa-ra
8894 @opindex fipa-ra
8895 Use caller save registers for allocation if those registers are not used by
8896 any called function. In that case it is not necessary to save and restore
8897 them around calls. This is only possible if called functions are part of
8898 same compilation unit as current function and they are compiled before it.
8899
8900 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8901 is disabled if generated code will be instrumented for profiling
8902 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8903 exactly (this happens on targets that do not expose prologues
8904 and epilogues in RTL).
8905
8906 @item -fconserve-stack
8907 @opindex fconserve-stack
8908 Attempt to minimize stack usage. The compiler attempts to use less
8909 stack space, even if that makes the program slower. This option
8910 implies setting the @option{large-stack-frame} parameter to 100
8911 and the @option{large-stack-frame-growth} parameter to 400.
8912
8913 @item -ftree-reassoc
8914 @opindex ftree-reassoc
8915 Perform reassociation on trees. This flag is enabled by default
8916 at @option{-O} and higher.
8917
8918 @item -fcode-hoisting
8919 @opindex fcode-hoisting
8920 Perform code hoisting. Code hoisting tries to move the
8921 evaluation of expressions executed on all paths to the function exit
8922 as early as possible. This is especially useful as a code size
8923 optimization, but it often helps for code speed as well.
8924 This flag is enabled by default at @option{-O2} and higher.
8925
8926 @item -ftree-pre
8927 @opindex ftree-pre
8928 Perform partial redundancy elimination (PRE) on trees. This flag is
8929 enabled by default at @option{-O2} and @option{-O3}.
8930
8931 @item -ftree-partial-pre
8932 @opindex ftree-partial-pre
8933 Make partial redundancy elimination (PRE) more aggressive. This flag is
8934 enabled by default at @option{-O3}.
8935
8936 @item -ftree-forwprop
8937 @opindex ftree-forwprop
8938 Perform forward propagation on trees. This flag is enabled by default
8939 at @option{-O} and higher.
8940
8941 @item -ftree-fre
8942 @opindex ftree-fre
8943 Perform full redundancy elimination (FRE) on trees. The difference
8944 between FRE and PRE is that FRE only considers expressions
8945 that are computed on all paths leading to the redundant computation.
8946 This analysis is faster than PRE, though it exposes fewer redundancies.
8947 This flag is enabled by default at @option{-O} and higher.
8948
8949 @item -ftree-phiprop
8950 @opindex ftree-phiprop
8951 Perform hoisting of loads from conditional pointers on trees. This
8952 pass is enabled by default at @option{-O} and higher.
8953
8954 @item -fhoist-adjacent-loads
8955 @opindex fhoist-adjacent-loads
8956 Speculatively hoist loads from both branches of an if-then-else if the
8957 loads are from adjacent locations in the same structure and the target
8958 architecture has a conditional move instruction. This flag is enabled
8959 by default at @option{-O2} and higher.
8960
8961 @item -ftree-copy-prop
8962 @opindex ftree-copy-prop
8963 Perform copy propagation on trees. This pass eliminates unnecessary
8964 copy operations. This flag is enabled by default at @option{-O} and
8965 higher.
8966
8967 @item -fipa-pure-const
8968 @opindex fipa-pure-const
8969 Discover which functions are pure or constant.
8970 Enabled by default at @option{-O} and higher.
8971
8972 @item -fipa-reference
8973 @opindex fipa-reference
8974 Discover which static variables do not escape the
8975 compilation unit.
8976 Enabled by default at @option{-O} and higher.
8977
8978 @item -fipa-reference-addressable
8979 @opindex fipa-reference-addressable
8980 Discover read-only, write-only and non-addressable static variables.
8981 Enabled by default at @option{-O} and higher.
8982
8983 @item -fipa-stack-alignment
8984 @opindex fipa-stack-alignment
8985 Reduce stack alignment on call sites if possible.
8986 Enabled by default.
8987
8988 @item -fipa-pta
8989 @opindex fipa-pta
8990 Perform interprocedural pointer analysis and interprocedural modification
8991 and reference analysis. This option can cause excessive memory and
8992 compile-time usage on large compilation units. It is not enabled by
8993 default at any optimization level.
8994
8995 @item -fipa-profile
8996 @opindex fipa-profile
8997 Perform interprocedural profile propagation. The functions called only from
8998 cold functions are marked as cold. Also functions executed once (such as
8999 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9000 functions and loop less parts of functions executed once are then optimized for
9001 size.
9002 Enabled by default at @option{-O} and higher.
9003
9004 @item -fipa-cp
9005 @opindex fipa-cp
9006 Perform interprocedural constant propagation.
9007 This optimization analyzes the program to determine when values passed
9008 to functions are constants and then optimizes accordingly.
9009 This optimization can substantially increase performance
9010 if the application has constants passed to functions.
9011 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9012
9013 @item -fipa-cp-clone
9014 @opindex fipa-cp-clone
9015 Perform function cloning to make interprocedural constant propagation stronger.
9016 When enabled, interprocedural constant propagation performs function cloning
9017 when externally visible function can be called with constant arguments.
9018 Because this optimization can create multiple copies of functions,
9019 it may significantly increase code size
9020 (see @option{--param ipcp-unit-growth=@var{value}}).
9021 This flag is enabled by default at @option{-O3}.
9022
9023 @item -fipa-bit-cp
9024 @opindex fipa-bit-cp
9025 When enabled, perform interprocedural bitwise constant
9026 propagation. This flag is enabled by default at @option{-O2}. It
9027 requires that @option{-fipa-cp} is enabled.
9028
9029 @item -fipa-vrp
9030 @opindex fipa-vrp
9031 When enabled, perform interprocedural propagation of value
9032 ranges. This flag is enabled by default at @option{-O2}. It requires
9033 that @option{-fipa-cp} is enabled.
9034
9035 @item -fipa-icf
9036 @opindex fipa-icf
9037 Perform Identical Code Folding for functions and read-only variables.
9038 The optimization reduces code size and may disturb unwind stacks by replacing
9039 a function by equivalent one with a different name. The optimization works
9040 more effectively with link-time optimization enabled.
9041
9042 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
9043 works on different levels and thus the optimizations are not same - there are
9044 equivalences that are found only by GCC and equivalences found only by Gold.
9045
9046 This flag is enabled by default at @option{-O2} and @option{-Os}.
9047
9048 @item -fisolate-erroneous-paths-dereference
9049 @opindex fisolate-erroneous-paths-dereference
9050 Detect paths that trigger erroneous or undefined behavior due to
9051 dereferencing a null pointer. Isolate those paths from the main control
9052 flow and turn the statement with erroneous or undefined behavior into a trap.
9053 This flag is enabled by default at @option{-O2} and higher and depends on
9054 @option{-fdelete-null-pointer-checks} also being enabled.
9055
9056 @item -fisolate-erroneous-paths-attribute
9057 @opindex fisolate-erroneous-paths-attribute
9058 Detect paths that trigger erroneous or undefined behavior due to a null value
9059 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9060 attribute. Isolate those paths from the main control flow and turn the
9061 statement with erroneous or undefined behavior into a trap. This is not
9062 currently enabled, but may be enabled by @option{-O2} in the future.
9063
9064 @item -ftree-sink
9065 @opindex ftree-sink
9066 Perform forward store motion on trees. This flag is
9067 enabled by default at @option{-O} and higher.
9068
9069 @item -ftree-bit-ccp
9070 @opindex ftree-bit-ccp
9071 Perform sparse conditional bit constant propagation on trees and propagate
9072 pointer alignment information.
9073 This pass only operates on local scalar variables and is enabled by default
9074 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
9075
9076 @item -ftree-ccp
9077 @opindex ftree-ccp
9078 Perform sparse conditional constant propagation (CCP) on trees. This
9079 pass only operates on local scalar variables and is enabled by default
9080 at @option{-O} and higher.
9081
9082 @item -fssa-backprop
9083 @opindex fssa-backprop
9084 Propagate information about uses of a value up the definition chain
9085 in order to simplify the definitions. For example, this pass strips
9086 sign operations if the sign of a value never matters. The flag is
9087 enabled by default at @option{-O} and higher.
9088
9089 @item -fssa-phiopt
9090 @opindex fssa-phiopt
9091 Perform pattern matching on SSA PHI nodes to optimize conditional
9092 code. This pass is enabled by default at @option{-O} and higher.
9093
9094 @item -ftree-switch-conversion
9095 @opindex ftree-switch-conversion
9096 Perform conversion of simple initializations in a switch to
9097 initializations from a scalar array. This flag is enabled by default
9098 at @option{-O2} and higher.
9099
9100 @item -ftree-tail-merge
9101 @opindex ftree-tail-merge
9102 Look for identical code sequences. When found, replace one with a jump to the
9103 other. This optimization is known as tail merging or cross jumping. This flag
9104 is enabled by default at @option{-O2} and higher. The compilation time
9105 in this pass can
9106 be limited using @option{max-tail-merge-comparisons} parameter and
9107 @option{max-tail-merge-iterations} parameter.
9108
9109 @item -ftree-dce
9110 @opindex ftree-dce
9111 Perform dead code elimination (DCE) on trees. This flag is enabled by
9112 default at @option{-O} and higher.
9113
9114 @item -ftree-builtin-call-dce
9115 @opindex ftree-builtin-call-dce
9116 Perform conditional dead code elimination (DCE) for calls to built-in functions
9117 that may set @code{errno} but are otherwise free of side effects. This flag is
9118 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9119 specified.
9120
9121 @item -ftree-dominator-opts
9122 @opindex ftree-dominator-opts
9123 Perform a variety of simple scalar cleanups (constant/copy
9124 propagation, redundancy elimination, range propagation and expression
9125 simplification) based on a dominator tree traversal. This also
9126 performs jump threading (to reduce jumps to jumps). This flag is
9127 enabled by default at @option{-O} and higher.
9128
9129 @item -ftree-dse
9130 @opindex ftree-dse
9131 Perform dead store elimination (DSE) on trees. A dead store is a store into
9132 a memory location that is later overwritten by another store without
9133 any intervening loads. In this case the earlier store can be deleted. This
9134 flag is enabled by default at @option{-O} and higher.
9135
9136 @item -ftree-ch
9137 @opindex ftree-ch
9138 Perform loop header copying on trees. This is beneficial since it increases
9139 effectiveness of code motion optimizations. It also saves one jump. This flag
9140 is enabled by default at @option{-O} and higher. It is not enabled
9141 for @option{-Os}, since it usually increases code size.
9142
9143 @item -ftree-loop-optimize
9144 @opindex ftree-loop-optimize
9145 Perform loop optimizations on trees. This flag is enabled by default
9146 at @option{-O} and higher.
9147
9148 @item -ftree-loop-linear
9149 @itemx -floop-strip-mine
9150 @itemx -floop-block
9151 @opindex ftree-loop-linear
9152 @opindex floop-strip-mine
9153 @opindex floop-block
9154 Perform loop nest optimizations. Same as
9155 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9156 to be configured with @option{--with-isl} to enable the Graphite loop
9157 transformation infrastructure.
9158
9159 @item -fgraphite-identity
9160 @opindex fgraphite-identity
9161 Enable the identity transformation for graphite. For every SCoP we generate
9162 the polyhedral representation and transform it back to gimple. Using
9163 @option{-fgraphite-identity} we can check the costs or benefits of the
9164 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9165 are also performed by the code generator isl, like index splitting and
9166 dead code elimination in loops.
9167
9168 @item -floop-nest-optimize
9169 @opindex floop-nest-optimize
9170 Enable the isl based loop nest optimizer. This is a generic loop nest
9171 optimizer based on the Pluto optimization algorithms. It calculates a loop
9172 structure optimized for data-locality and parallelism. This option
9173 is experimental.
9174
9175 @item -floop-parallelize-all
9176 @opindex floop-parallelize-all
9177 Use the Graphite data dependence analysis to identify loops that can
9178 be parallelized. Parallelize all the loops that can be analyzed to
9179 not contain loop carried dependences without checking that it is
9180 profitable to parallelize the loops.
9181
9182 @item -ftree-coalesce-vars
9183 @opindex ftree-coalesce-vars
9184 While transforming the program out of the SSA representation, attempt to
9185 reduce copying by coalescing versions of different user-defined
9186 variables, instead of just compiler temporaries. This may severely
9187 limit the ability to debug an optimized program compiled with
9188 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9189 prevents SSA coalescing of user variables. This option is enabled by
9190 default if optimization is enabled, and it does very little otherwise.
9191
9192 @item -ftree-loop-if-convert
9193 @opindex ftree-loop-if-convert
9194 Attempt to transform conditional jumps in the innermost loops to
9195 branch-less equivalents. The intent is to remove control-flow from
9196 the innermost loops in order to improve the ability of the
9197 vectorization pass to handle these loops. This is enabled by default
9198 if vectorization is enabled.
9199
9200 @item -ftree-loop-distribution
9201 @opindex ftree-loop-distribution
9202 Perform loop distribution. This flag can improve cache performance on
9203 big loop bodies and allow further loop optimizations, like
9204 parallelization or vectorization, to take place. For example, the loop
9205 @smallexample
9206 DO I = 1, N
9207 A(I) = B(I) + C
9208 D(I) = E(I) * F
9209 ENDDO
9210 @end smallexample
9211 is transformed to
9212 @smallexample
9213 DO I = 1, N
9214 A(I) = B(I) + C
9215 ENDDO
9216 DO I = 1, N
9217 D(I) = E(I) * F
9218 ENDDO
9219 @end smallexample
9220
9221 @item -ftree-loop-distribute-patterns
9222 @opindex ftree-loop-distribute-patterns
9223 Perform loop distribution of patterns that can be code generated with
9224 calls to a library. This flag is enabled by default at @option{-O3}.
9225
9226 This pass distributes the initialization loops and generates a call to
9227 memset zero. For example, the loop
9228 @smallexample
9229 DO I = 1, N
9230 A(I) = 0
9231 B(I) = A(I) + I
9232 ENDDO
9233 @end smallexample
9234 is transformed to
9235 @smallexample
9236 DO I = 1, N
9237 A(I) = 0
9238 ENDDO
9239 DO I = 1, N
9240 B(I) = A(I) + I
9241 ENDDO
9242 @end smallexample
9243 and the initialization loop is transformed into a call to memset zero.
9244
9245 @item -floop-interchange
9246 @opindex floop-interchange
9247 Perform loop interchange outside of graphite. This flag can improve cache
9248 performance on loop nest and allow further loop optimizations, like
9249 vectorization, to take place. For example, the loop
9250 @smallexample
9251 for (int i = 0; i < N; i++)
9252 for (int j = 0; j < N; j++)
9253 for (int k = 0; k < N; k++)
9254 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9255 @end smallexample
9256 is transformed to
9257 @smallexample
9258 for (int i = 0; i < N; i++)
9259 for (int k = 0; k < N; k++)
9260 for (int j = 0; j < N; j++)
9261 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9262 @end smallexample
9263 This flag is enabled by default at @option{-O3}.
9264
9265 @item -floop-unroll-and-jam
9266 @opindex floop-unroll-and-jam
9267 Apply unroll and jam transformations on feasible loops. In a loop
9268 nest this unrolls the outer loop by some factor and fuses the resulting
9269 multiple inner loops. This flag is enabled by default at @option{-O3}.
9270
9271 @item -ftree-loop-im
9272 @opindex ftree-loop-im
9273 Perform loop invariant motion on trees. This pass moves only invariants that
9274 are hard to handle at RTL level (function calls, operations that expand to
9275 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9276 operands of conditions that are invariant out of the loop, so that we can use
9277 just trivial invariantness analysis in loop unswitching. The pass also includes
9278 store motion.
9279
9280 @item -ftree-loop-ivcanon
9281 @opindex ftree-loop-ivcanon
9282 Create a canonical counter for number of iterations in loops for which
9283 determining number of iterations requires complicated analysis. Later
9284 optimizations then may determine the number easily. Useful especially
9285 in connection with unrolling.
9286
9287 @item -ftree-scev-cprop
9288 @opindex ftree-scev-cprop
9289 Perform final value replacement. If a variable is modified in a loop
9290 in such a way that its value when exiting the loop can be determined using
9291 only its initial value and the number of loop iterations, replace uses of
9292 the final value by such a computation, provided it is sufficiently cheap.
9293 This reduces data dependencies and may allow further simplifications.
9294 Enabled by default at @option{-O} and higher.
9295
9296 @item -fivopts
9297 @opindex fivopts
9298 Perform induction variable optimizations (strength reduction, induction
9299 variable merging and induction variable elimination) on trees.
9300
9301 @item -ftree-parallelize-loops=n
9302 @opindex ftree-parallelize-loops
9303 Parallelize loops, i.e., split their iteration space to run in n threads.
9304 This is only possible for loops whose iterations are independent
9305 and can be arbitrarily reordered. The optimization is only
9306 profitable on multiprocessor machines, for loops that are CPU-intensive,
9307 rather than constrained e.g.@: by memory bandwidth. This option
9308 implies @option{-pthread}, and thus is only supported on targets
9309 that have support for @option{-pthread}.
9310
9311 @item -ftree-pta
9312 @opindex ftree-pta
9313 Perform function-local points-to analysis on trees. This flag is
9314 enabled by default at @option{-O} and higher.
9315
9316 @item -ftree-sra
9317 @opindex ftree-sra
9318 Perform scalar replacement of aggregates. This pass replaces structure
9319 references with scalars to prevent committing structures to memory too
9320 early. This flag is enabled by default at @option{-O} and higher.
9321
9322 @item -fstore-merging
9323 @opindex fstore-merging
9324 Perform merging of narrow stores to consecutive memory addresses. This pass
9325 merges contiguous stores of immediate values narrower than a word into fewer
9326 wider stores to reduce the number of instructions. This is enabled by default
9327 at @option{-O2} and higher as well as @option{-Os}.
9328
9329 @item -ftree-ter
9330 @opindex ftree-ter
9331 Perform temporary expression replacement during the SSA->normal phase. Single
9332 use/single def temporaries are replaced at their use location with their
9333 defining expression. This results in non-GIMPLE code, but gives the expanders
9334 much more complex trees to work on resulting in better RTL generation. This is
9335 enabled by default at @option{-O} and higher.
9336
9337 @item -ftree-slsr
9338 @opindex ftree-slsr
9339 Perform straight-line strength reduction on trees. This recognizes related
9340 expressions involving multiplications and replaces them by less expensive
9341 calculations when possible. This is enabled by default at @option{-O} and
9342 higher.
9343
9344 @item -ftree-vectorize
9345 @opindex ftree-vectorize
9346 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9347 and @option{-ftree-slp-vectorize} if not explicitly specified.
9348
9349 @item -ftree-loop-vectorize
9350 @opindex ftree-loop-vectorize
9351 Perform loop vectorization on trees. This flag is enabled by default at
9352 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9353
9354 @item -ftree-slp-vectorize
9355 @opindex ftree-slp-vectorize
9356 Perform basic block vectorization on trees. This flag is enabled by default at
9357 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9358
9359 @item -fvect-cost-model=@var{model}
9360 @opindex fvect-cost-model
9361 Alter the cost model used for vectorization. The @var{model} argument
9362 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9363 With the @samp{unlimited} model the vectorized code-path is assumed
9364 to be profitable while with the @samp{dynamic} model a runtime check
9365 guards the vectorized code-path to enable it only for iteration
9366 counts that will likely execute faster than when executing the original
9367 scalar loop. The @samp{cheap} model disables vectorization of
9368 loops where doing so would be cost prohibitive for example due to
9369 required runtime checks for data dependence or alignment but otherwise
9370 is equal to the @samp{dynamic} model.
9371 The default cost model depends on other optimization flags and is
9372 either @samp{dynamic} or @samp{cheap}.
9373
9374 @item -fsimd-cost-model=@var{model}
9375 @opindex fsimd-cost-model
9376 Alter the cost model used for vectorization of loops marked with the OpenMP
9377 simd directive. The @var{model} argument should be one of
9378 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9379 have the same meaning as described in @option{-fvect-cost-model} and by
9380 default a cost model defined with @option{-fvect-cost-model} is used.
9381
9382 @item -ftree-vrp
9383 @opindex ftree-vrp
9384 Perform Value Range Propagation on trees. This is similar to the
9385 constant propagation pass, but instead of values, ranges of values are
9386 propagated. This allows the optimizers to remove unnecessary range
9387 checks like array bound checks and null pointer checks. This is
9388 enabled by default at @option{-O2} and higher. Null pointer check
9389 elimination is only done if @option{-fdelete-null-pointer-checks} is
9390 enabled.
9391
9392 @item -fsplit-paths
9393 @opindex fsplit-paths
9394 Split paths leading to loop backedges. This can improve dead code
9395 elimination and common subexpression elimination. This is enabled by
9396 default at @option{-O2} and above.
9397
9398 @item -fsplit-ivs-in-unroller
9399 @opindex fsplit-ivs-in-unroller
9400 Enables expression of values of induction variables in later iterations
9401 of the unrolled loop using the value in the first iteration. This breaks
9402 long dependency chains, thus improving efficiency of the scheduling passes.
9403
9404 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9405 same effect. However, that is not reliable in cases where the loop body
9406 is more complicated than a single basic block. It also does not work at all
9407 on some architectures due to restrictions in the CSE pass.
9408
9409 This optimization is enabled by default.
9410
9411 @item -fvariable-expansion-in-unroller
9412 @opindex fvariable-expansion-in-unroller
9413 With this option, the compiler creates multiple copies of some
9414 local variables when unrolling a loop, which can result in superior code.
9415
9416 @item -fpartial-inlining
9417 @opindex fpartial-inlining
9418 Inline parts of functions. This option has any effect only
9419 when inlining itself is turned on by the @option{-finline-functions}
9420 or @option{-finline-small-functions} options.
9421
9422 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9423
9424 @item -fpredictive-commoning
9425 @opindex fpredictive-commoning
9426 Perform predictive commoning optimization, i.e., reusing computations
9427 (especially memory loads and stores) performed in previous
9428 iterations of loops.
9429
9430 This option is enabled at level @option{-O3}.
9431
9432 @item -fprefetch-loop-arrays
9433 @opindex fprefetch-loop-arrays
9434 If supported by the target machine, generate instructions to prefetch
9435 memory to improve the performance of loops that access large arrays.
9436
9437 This option may generate better or worse code; results are highly
9438 dependent on the structure of loops within the source code.
9439
9440 Disabled at level @option{-Os}.
9441
9442 @item -fno-printf-return-value
9443 @opindex fno-printf-return-value
9444 @opindex fprintf-return-value
9445 Do not substitute constants for known return value of formatted output
9446 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9447 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9448 transformation allows GCC to optimize or even eliminate branches based
9449 on the known return value of these functions called with arguments that
9450 are either constant, or whose values are known to be in a range that
9451 makes determining the exact return value possible. For example, when
9452 @option{-fprintf-return-value} is in effect, both the branch and the
9453 body of the @code{if} statement (but not the call to @code{snprint})
9454 can be optimized away when @code{i} is a 32-bit or smaller integer
9455 because the return value is guaranteed to be at most 8.
9456
9457 @smallexample
9458 char buf[9];
9459 if (snprintf (buf, "%08x", i) >= sizeof buf)
9460 @dots{}
9461 @end smallexample
9462
9463 The @option{-fprintf-return-value} option relies on other optimizations
9464 and yields best results with @option{-O2} and above. It works in tandem
9465 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9466 options. The @option{-fprintf-return-value} option is enabled by default.
9467
9468 @item -fno-peephole
9469 @itemx -fno-peephole2
9470 @opindex fno-peephole
9471 @opindex fpeephole
9472 @opindex fno-peephole2
9473 @opindex fpeephole2
9474 Disable any machine-specific peephole optimizations. The difference
9475 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9476 are implemented in the compiler; some targets use one, some use the
9477 other, a few use both.
9478
9479 @option{-fpeephole} is enabled by default.
9480 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9481
9482 @item -fno-guess-branch-probability
9483 @opindex fno-guess-branch-probability
9484 @opindex fguess-branch-probability
9485 Do not guess branch probabilities using heuristics.
9486
9487 GCC uses heuristics to guess branch probabilities if they are
9488 not provided by profiling feedback (@option{-fprofile-arcs}). These
9489 heuristics are based on the control flow graph. If some branch probabilities
9490 are specified by @code{__builtin_expect}, then the heuristics are
9491 used to guess branch probabilities for the rest of the control flow graph,
9492 taking the @code{__builtin_expect} info into account. The interactions
9493 between the heuristics and @code{__builtin_expect} can be complex, and in
9494 some cases, it may be useful to disable the heuristics so that the effects
9495 of @code{__builtin_expect} are easier to understand.
9496
9497 It is also possible to specify expected probability of the expression
9498 with @code{__builtin_expect_with_probability} built-in function.
9499
9500 The default is @option{-fguess-branch-probability} at levels
9501 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9502
9503 @item -freorder-blocks
9504 @opindex freorder-blocks
9505 Reorder basic blocks in the compiled function in order to reduce number of
9506 taken branches and improve code locality.
9507
9508 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9509
9510 @item -freorder-blocks-algorithm=@var{algorithm}
9511 @opindex freorder-blocks-algorithm
9512 Use the specified algorithm for basic block reordering. The
9513 @var{algorithm} argument can be @samp{simple}, which does not increase
9514 code size (except sometimes due to secondary effects like alignment),
9515 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9516 put all often executed code together, minimizing the number of branches
9517 executed by making extra copies of code.
9518
9519 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9520 @samp{stc} at levels @option{-O2}, @option{-O3}.
9521
9522 @item -freorder-blocks-and-partition
9523 @opindex freorder-blocks-and-partition
9524 In addition to reordering basic blocks in the compiled function, in order
9525 to reduce number of taken branches, partitions hot and cold basic blocks
9526 into separate sections of the assembly and @file{.o} files, to improve
9527 paging and cache locality performance.
9528
9529 This optimization is automatically turned off in the presence of
9530 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9531 section attribute and on any architecture that does not support named
9532 sections. When @option{-fsplit-stack} is used this option is not
9533 enabled by default (to avoid linker errors), but may be enabled
9534 explicitly (if using a working linker).
9535
9536 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9537
9538 @item -freorder-functions
9539 @opindex freorder-functions
9540 Reorder functions in the object file in order to
9541 improve code locality. This is implemented by using special
9542 subsections @code{.text.hot} for most frequently executed functions and
9543 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9544 the linker so object file format must support named sections and linker must
9545 place them in a reasonable way.
9546
9547 Also profile feedback must be available to make this option effective. See
9548 @option{-fprofile-arcs} for details.
9549
9550 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9551
9552 @item -fstrict-aliasing
9553 @opindex fstrict-aliasing
9554 Allow the compiler to assume the strictest aliasing rules applicable to
9555 the language being compiled. For C (and C++), this activates
9556 optimizations based on the type of expressions. In particular, an
9557 object of one type is assumed never to reside at the same address as an
9558 object of a different type, unless the types are almost the same. For
9559 example, an @code{unsigned int} can alias an @code{int}, but not a
9560 @code{void*} or a @code{double}. A character type may alias any other
9561 type.
9562
9563 @anchor{Type-punning}Pay special attention to code like this:
9564 @smallexample
9565 union a_union @{
9566 int i;
9567 double d;
9568 @};
9569
9570 int f() @{
9571 union a_union t;
9572 t.d = 3.0;
9573 return t.i;
9574 @}
9575 @end smallexample
9576 The practice of reading from a different union member than the one most
9577 recently written to (called ``type-punning'') is common. Even with
9578 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9579 is accessed through the union type. So, the code above works as
9580 expected. @xref{Structures unions enumerations and bit-fields
9581 implementation}. However, this code might not:
9582 @smallexample
9583 int f() @{
9584 union a_union t;
9585 int* ip;
9586 t.d = 3.0;
9587 ip = &t.i;
9588 return *ip;
9589 @}
9590 @end smallexample
9591
9592 Similarly, access by taking the address, casting the resulting pointer
9593 and dereferencing the result has undefined behavior, even if the cast
9594 uses a union type, e.g.:
9595 @smallexample
9596 int f() @{
9597 double d = 3.0;
9598 return ((union a_union *) &d)->i;
9599 @}
9600 @end smallexample
9601
9602 The @option{-fstrict-aliasing} option is enabled at levels
9603 @option{-O2}, @option{-O3}, @option{-Os}.
9604
9605 @item -falign-functions
9606 @itemx -falign-functions=@var{n}
9607 @itemx -falign-functions=@var{n}:@var{m}
9608 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9609 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9610 @opindex falign-functions
9611 Align the start of functions to the next power-of-two greater than
9612 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9613 the first @var{m} bytes of the function can be fetched by the CPU
9614 without crossing an @var{n}-byte alignment boundary.
9615
9616 If @var{m} is not specified, it defaults to @var{n}.
9617
9618 Examples: @option{-falign-functions=32} aligns functions to the next
9619 32-byte boundary, @option{-falign-functions=24} aligns to the next
9620 32-byte boundary only if this can be done by skipping 23 bytes or less,
9621 @option{-falign-functions=32:7} aligns to the next
9622 32-byte boundary only if this can be done by skipping 6 bytes or less.
9623
9624 The second pair of @var{n2}:@var{m2} values allows you to specify
9625 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9626 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9627 otherwise aligns to the next 32-byte boundary if this can be done
9628 by skipping 2 bytes or less.
9629 If @var{m2} is not specified, it defaults to @var{n2}.
9630
9631 Some assemblers only support this flag when @var{n} is a power of two;
9632 in that case, it is rounded up.
9633
9634 @option{-fno-align-functions} and @option{-falign-functions=1} are
9635 equivalent and mean that functions are not aligned.
9636
9637 If @var{n} is not specified or is zero, use a machine-dependent default.
9638 The maximum allowed @var{n} option value is 65536.
9639
9640 Enabled at levels @option{-O2}, @option{-O3}.
9641
9642 @item -flimit-function-alignment
9643 If this option is enabled, the compiler tries to avoid unnecessarily
9644 overaligning functions. It attempts to instruct the assembler to align
9645 by the amount specified by @option{-falign-functions}, but not to
9646 skip more bytes than the size of the function.
9647
9648 @item -falign-labels
9649 @itemx -falign-labels=@var{n}
9650 @itemx -falign-labels=@var{n}:@var{m}
9651 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9652 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9653 @opindex falign-labels
9654 Align all branch targets to a power-of-two boundary.
9655
9656 Parameters of this option are analogous to the @option{-falign-functions} option.
9657 @option{-fno-align-labels} and @option{-falign-labels=1} are
9658 equivalent and mean that labels are not aligned.
9659
9660 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9661 are greater than this value, then their values are used instead.
9662
9663 If @var{n} is not specified or is zero, use a machine-dependent default
9664 which is very likely to be @samp{1}, meaning no alignment.
9665 The maximum allowed @var{n} option value is 65536.
9666
9667 Enabled at levels @option{-O2}, @option{-O3}.
9668
9669 @item -falign-loops
9670 @itemx -falign-loops=@var{n}
9671 @itemx -falign-loops=@var{n}:@var{m}
9672 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9673 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9674 @opindex falign-loops
9675 Align loops to a power-of-two boundary. If the loops are executed
9676 many times, this makes up for any execution of the dummy padding
9677 instructions.
9678
9679 Parameters of this option are analogous to the @option{-falign-functions} option.
9680 @option{-fno-align-loops} and @option{-falign-loops=1} are
9681 equivalent and mean that loops are not aligned.
9682 The maximum allowed @var{n} option value is 65536.
9683
9684 If @var{n} is not specified or is zero, use a machine-dependent default.
9685
9686 Enabled at levels @option{-O2}, @option{-O3}.
9687
9688 @item -falign-jumps
9689 @itemx -falign-jumps=@var{n}
9690 @itemx -falign-jumps=@var{n}:@var{m}
9691 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9692 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9693 @opindex falign-jumps
9694 Align branch targets to a power-of-two boundary, for branch targets
9695 where the targets can only be reached by jumping. In this case,
9696 no dummy operations need be executed.
9697
9698 Parameters of this option are analogous to the @option{-falign-functions} option.
9699 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9700 equivalent and mean that loops are not aligned.
9701
9702 If @var{n} is not specified or is zero, use a machine-dependent default.
9703 The maximum allowed @var{n} option value is 65536.
9704
9705 Enabled at levels @option{-O2}, @option{-O3}.
9706
9707 @item -funit-at-a-time
9708 @opindex funit-at-a-time
9709 This option is left for compatibility reasons. @option{-funit-at-a-time}
9710 has no effect, while @option{-fno-unit-at-a-time} implies
9711 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9712
9713 Enabled by default.
9714
9715 @item -fno-toplevel-reorder
9716 @opindex fno-toplevel-reorder
9717 @opindex ftoplevel-reorder
9718 Do not reorder top-level functions, variables, and @code{asm}
9719 statements. Output them in the same order that they appear in the
9720 input file. When this option is used, unreferenced static variables
9721 are not removed. This option is intended to support existing code
9722 that relies on a particular ordering. For new code, it is better to
9723 use attributes when possible.
9724
9725 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
9726 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
9727 Additionally @option{-fno-toplevel-reorder} implies
9728 @option{-fno-section-anchors}.
9729
9730 @item -fweb
9731 @opindex fweb
9732 Constructs webs as commonly used for register allocation purposes and assign
9733 each web individual pseudo register. This allows the register allocation pass
9734 to operate on pseudos directly, but also strengthens several other optimization
9735 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9736 however, make debugging impossible, since variables no longer stay in a
9737 ``home register''.
9738
9739 Enabled by default with @option{-funroll-loops}.
9740
9741 @item -fwhole-program
9742 @opindex fwhole-program
9743 Assume that the current compilation unit represents the whole program being
9744 compiled. All public functions and variables with the exception of @code{main}
9745 and those merged by attribute @code{externally_visible} become static functions
9746 and in effect are optimized more aggressively by interprocedural optimizers.
9747
9748 This option should not be used in combination with @option{-flto}.
9749 Instead relying on a linker plugin should provide safer and more precise
9750 information.
9751
9752 @item -flto[=@var{n}]
9753 @opindex flto
9754 This option runs the standard link-time optimizer. When invoked
9755 with source code, it generates GIMPLE (one of GCC's internal
9756 representations) and writes it to special ELF sections in the object
9757 file. When the object files are linked together, all the function
9758 bodies are read from these ELF sections and instantiated as if they
9759 had been part of the same translation unit.
9760
9761 To use the link-time optimizer, @option{-flto} and optimization
9762 options should be specified at compile time and during the final link.
9763 It is recommended that you compile all the files participating in the
9764 same link with the same options and also specify those options at
9765 link time.
9766 For example:
9767
9768 @smallexample
9769 gcc -c -O2 -flto foo.c
9770 gcc -c -O2 -flto bar.c
9771 gcc -o myprog -flto -O2 foo.o bar.o
9772 @end smallexample
9773
9774 The first two invocations to GCC save a bytecode representation
9775 of GIMPLE into special ELF sections inside @file{foo.o} and
9776 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9777 @file{foo.o} and @file{bar.o}, merges the two files into a single
9778 internal image, and compiles the result as usual. Since both
9779 @file{foo.o} and @file{bar.o} are merged into a single image, this
9780 causes all the interprocedural analyses and optimizations in GCC to
9781 work across the two files as if they were a single one. This means,
9782 for example, that the inliner is able to inline functions in
9783 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9784
9785 Another (simpler) way to enable link-time optimization is:
9786
9787 @smallexample
9788 gcc -o myprog -flto -O2 foo.c bar.c
9789 @end smallexample
9790
9791 The above generates bytecode for @file{foo.c} and @file{bar.c},
9792 merges them together into a single GIMPLE representation and optimizes
9793 them as usual to produce @file{myprog}.
9794
9795 The only important thing to keep in mind is that to enable link-time
9796 optimizations you need to use the GCC driver to perform the link step.
9797 GCC then automatically performs link-time optimization if any of the
9798 objects involved were compiled with the @option{-flto} command-line option.
9799 You generally
9800 should specify the optimization options to be used for link-time
9801 optimization though GCC tries to be clever at guessing an
9802 optimization level to use from the options used at compile time
9803 if you fail to specify one at link time. You can always override
9804 the automatic decision to do link-time optimization
9805 by passing @option{-fno-lto} to the link command.
9806
9807 To make whole program optimization effective, it is necessary to make
9808 certain whole program assumptions. The compiler needs to know
9809 what functions and variables can be accessed by libraries and runtime
9810 outside of the link-time optimized unit. When supported by the linker,
9811 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9812 to the compiler about used and externally visible symbols. When
9813 the linker plugin is not available, @option{-fwhole-program} should be
9814 used to allow the compiler to make these assumptions, which leads
9815 to more aggressive optimization decisions.
9816
9817 When @option{-fuse-linker-plugin} is not enabled, when a file is
9818 compiled with @option{-flto}, the generated object file is larger than
9819 a regular object file because it contains GIMPLE bytecodes and the usual
9820 final code (see @option{-ffat-lto-objects}. This means that
9821 object files with LTO information can be linked as normal object
9822 files; if @option{-fno-lto} is passed to the linker, no
9823 interprocedural optimizations are applied. Note that when
9824 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9825 but you cannot perform a regular, non-LTO link on them.
9826
9827 Additionally, the optimization flags used to compile individual files
9828 are not necessarily related to those used at link time. For instance,
9829
9830 @smallexample
9831 gcc -c -O0 -ffat-lto-objects -flto foo.c
9832 gcc -c -O0 -ffat-lto-objects -flto bar.c
9833 gcc -o myprog -O3 foo.o bar.o
9834 @end smallexample
9835
9836 This produces individual object files with unoptimized assembler
9837 code, but the resulting binary @file{myprog} is optimized at
9838 @option{-O3}. If, instead, the final binary is generated with
9839 @option{-fno-lto}, then @file{myprog} is not optimized.
9840
9841 When producing the final binary, GCC only
9842 applies link-time optimizations to those files that contain bytecode.
9843 Therefore, you can mix and match object files and libraries with
9844 GIMPLE bytecodes and final object code. GCC automatically selects
9845 which files to optimize in LTO mode and which files to link without
9846 further processing.
9847
9848 There are some code generation flags preserved by GCC when
9849 generating bytecodes, as they need to be used during the final link
9850 stage. Generally options specified at link time override those
9851 specified at compile time.
9852
9853 If you do not specify an optimization level option @option{-O} at
9854 link time, then GCC uses the highest optimization level
9855 used when compiling the object files.
9856
9857 Currently, the following options and their settings are taken from
9858 the first object file that explicitly specifies them:
9859 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9860 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9861 and all the @option{-m} target flags.
9862
9863 Certain ABI-changing flags are required to match in all compilation units,
9864 and trying to override this at link time with a conflicting value
9865 is ignored. This includes options such as @option{-freg-struct-return}
9866 and @option{-fpcc-struct-return}.
9867
9868 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9869 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9870 are passed through to the link stage and merged conservatively for
9871 conflicting translation units. Specifically
9872 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9873 precedence; and for example @option{-ffp-contract=off} takes precedence
9874 over @option{-ffp-contract=fast}. You can override them at link time.
9875
9876 If LTO encounters objects with C linkage declared with incompatible
9877 types in separate translation units to be linked together (undefined
9878 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9879 issued. The behavior is still undefined at run time. Similar
9880 diagnostics may be raised for other languages.
9881
9882 Another feature of LTO is that it is possible to apply interprocedural
9883 optimizations on files written in different languages:
9884
9885 @smallexample
9886 gcc -c -flto foo.c
9887 g++ -c -flto bar.cc
9888 gfortran -c -flto baz.f90
9889 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9890 @end smallexample
9891
9892 Notice that the final link is done with @command{g++} to get the C++
9893 runtime libraries and @option{-lgfortran} is added to get the Fortran
9894 runtime libraries. In general, when mixing languages in LTO mode, you
9895 should use the same link command options as when mixing languages in a
9896 regular (non-LTO) compilation.
9897
9898 If object files containing GIMPLE bytecode are stored in a library archive, say
9899 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9900 are using a linker with plugin support. To create static libraries suitable
9901 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9902 and @command{ranlib};
9903 to show the symbols of object files with GIMPLE bytecode, use
9904 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9905 and @command{nm} have been compiled with plugin support. At link time, use the
9906 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9907 the LTO optimization process:
9908
9909 @smallexample
9910 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9911 @end smallexample
9912
9913 With the linker plugin enabled, the linker extracts the needed
9914 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9915 to make them part of the aggregated GIMPLE image to be optimized.
9916
9917 If you are not using a linker with plugin support and/or do not
9918 enable the linker plugin, then the objects inside @file{libfoo.a}
9919 are extracted and linked as usual, but they do not participate
9920 in the LTO optimization process. In order to make a static library suitable
9921 for both LTO optimization and usual linkage, compile its object files with
9922 @option{-flto} @option{-ffat-lto-objects}.
9923
9924 Link-time optimizations do not require the presence of the whole program to
9925 operate. If the program does not require any symbols to be exported, it is
9926 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9927 the interprocedural optimizers to use more aggressive assumptions which may
9928 lead to improved optimization opportunities.
9929 Use of @option{-fwhole-program} is not needed when linker plugin is
9930 active (see @option{-fuse-linker-plugin}).
9931
9932 The current implementation of LTO makes no
9933 attempt to generate bytecode that is portable between different
9934 types of hosts. The bytecode files are versioned and there is a
9935 strict version check, so bytecode files generated in one version of
9936 GCC do not work with an older or newer version of GCC.
9937
9938 Link-time optimization does not work well with generation of debugging
9939 information on systems other than those using a combination of ELF and
9940 DWARF.
9941
9942 If you specify the optional @var{n}, the optimization and code
9943 generation done at link time is executed in parallel using @var{n}
9944 parallel jobs by utilizing an installed @command{make} program. The
9945 environment variable @env{MAKE} may be used to override the program
9946 used. The default value for @var{n} is 1.
9947
9948 You can also specify @option{-flto=jobserver} to use GNU make's
9949 job server mode to determine the number of parallel jobs. This
9950 is useful when the Makefile calling GCC is already executing in parallel.
9951 You must prepend a @samp{+} to the command recipe in the parent Makefile
9952 for this to work. This option likely only works if @env{MAKE} is
9953 GNU make.
9954
9955 @item -flto-partition=@var{alg}
9956 @opindex flto-partition
9957 Specify the partitioning algorithm used by the link-time optimizer.
9958 The value is either @samp{1to1} to specify a partitioning mirroring
9959 the original source files or @samp{balanced} to specify partitioning
9960 into equally sized chunks (whenever possible) or @samp{max} to create
9961 new partition for every symbol where possible. Specifying @samp{none}
9962 as an algorithm disables partitioning and streaming completely.
9963 The default value is @samp{balanced}. While @samp{1to1} can be used
9964 as an workaround for various code ordering issues, the @samp{max}
9965 partitioning is intended for internal testing only.
9966 The value @samp{one} specifies that exactly one partition should be
9967 used while the value @samp{none} bypasses partitioning and executes
9968 the link-time optimization step directly from the WPA phase.
9969
9970 @item -flto-odr-type-merging
9971 @opindex flto-odr-type-merging
9972 Enable streaming of mangled types names of C++ types and their unification
9973 at link time. This increases size of LTO object files, but enables
9974 diagnostics about One Definition Rule violations.
9975
9976 @item -flto-compression-level=@var{n}
9977 @opindex flto-compression-level
9978 This option specifies the level of compression used for intermediate
9979 language written to LTO object files, and is only meaningful in
9980 conjunction with LTO mode (@option{-flto}). Valid
9981 values are 0 (no compression) to 9 (maximum compression). Values
9982 outside this range are clamped to either 0 or 9. If the option is not
9983 given, a default balanced compression setting is used.
9984
9985 @item -fuse-linker-plugin
9986 @opindex fuse-linker-plugin
9987 Enables the use of a linker plugin during link-time optimization. This
9988 option relies on plugin support in the linker, which is available in gold
9989 or in GNU ld 2.21 or newer.
9990
9991 This option enables the extraction of object files with GIMPLE bytecode out
9992 of library archives. This improves the quality of optimization by exposing
9993 more code to the link-time optimizer. This information specifies what
9994 symbols can be accessed externally (by non-LTO object or during dynamic
9995 linking). Resulting code quality improvements on binaries (and shared
9996 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9997 See @option{-flto} for a description of the effect of this flag and how to
9998 use it.
9999
10000 This option is enabled by default when LTO support in GCC is enabled
10001 and GCC was configured for use with
10002 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10003
10004 @item -ffat-lto-objects
10005 @opindex ffat-lto-objects
10006 Fat LTO objects are object files that contain both the intermediate language
10007 and the object code. This makes them usable for both LTO linking and normal
10008 linking. This option is effective only when compiling with @option{-flto}
10009 and is ignored at link time.
10010
10011 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10012 requires the complete toolchain to be aware of LTO. It requires a linker with
10013 linker plugin support for basic functionality. Additionally,
10014 @command{nm}, @command{ar} and @command{ranlib}
10015 need to support linker plugins to allow a full-featured build environment
10016 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10017 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10018 to these tools. With non fat LTO makefiles need to be modified to use them.
10019
10020 Note that modern binutils provide plugin auto-load mechanism.
10021 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10022 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10023 @command{gcc-ranlib}).
10024
10025 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10026 support.
10027
10028 @item -fcompare-elim
10029 @opindex fcompare-elim
10030 After register allocation and post-register allocation instruction splitting,
10031 identify arithmetic instructions that compute processor flags similar to a
10032 comparison operation based on that arithmetic. If possible, eliminate the
10033 explicit comparison operation.
10034
10035 This pass only applies to certain targets that cannot explicitly represent
10036 the comparison operation before register allocation is complete.
10037
10038 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10039
10040 @item -fcprop-registers
10041 @opindex fcprop-registers
10042 After register allocation and post-register allocation instruction splitting,
10043 perform a copy-propagation pass to try to reduce scheduling dependencies
10044 and occasionally eliminate the copy.
10045
10046 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10047
10048 @item -fprofile-correction
10049 @opindex fprofile-correction
10050 Profiles collected using an instrumented binary for multi-threaded programs may
10051 be inconsistent due to missed counter updates. When this option is specified,
10052 GCC uses heuristics to correct or smooth out such inconsistencies. By
10053 default, GCC emits an error message when an inconsistent profile is detected.
10054
10055 @item -fprofile-use
10056 @itemx -fprofile-use=@var{path}
10057 @opindex fprofile-use
10058 Enable profile feedback-directed optimizations,
10059 and the following optimizations
10060 which are generally profitable only with profile feedback available:
10061 @option{-fbranch-probabilities}, @option{-fvpt},
10062 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
10063 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
10064
10065 Before you can use this option, you must first generate profiling information.
10066 @xref{Instrumentation Options}, for information about the
10067 @option{-fprofile-generate} option.
10068
10069 By default, GCC emits an error message if the feedback profiles do not
10070 match the source code. This error can be turned into a warning by using
10071 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10072 optimized code. Additionally, by default, GCC also emits a warning message if
10073 the feedback profiles do not exist (See @option{-Wmissing-profile}).
10074
10075 If @var{path} is specified, GCC looks at the @var{path} to find
10076 the profile feedback data files. See @option{-fprofile-dir}.
10077
10078 @item -fauto-profile
10079 @itemx -fauto-profile=@var{path}
10080 @opindex fauto-profile
10081 Enable sampling-based feedback-directed optimizations,
10082 and the following optimizations
10083 which are generally profitable only with profile feedback available:
10084 @option{-fbranch-probabilities}, @option{-fvpt},
10085 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
10086 @option{-ftree-vectorize},
10087 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
10088 @option{-fpredictive-commoning}, @option{-funswitch-loops},
10089 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
10090
10091 @var{path} is the name of a file containing AutoFDO profile information.
10092 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10093
10094 Producing an AutoFDO profile data file requires running your program
10095 with the @command{perf} utility on a supported GNU/Linux target system.
10096 For more information, see @uref{https://perf.wiki.kernel.org/}.
10097
10098 E.g.
10099 @smallexample
10100 perf record -e br_inst_retired:near_taken -b -o perf.data \
10101 -- your_program
10102 @end smallexample
10103
10104 Then use the @command{create_gcov} tool to convert the raw profile data
10105 to a format that can be used by GCC.@ You must also supply the
10106 unstripped binary for your program to this tool.
10107 See @uref{https://github.com/google/autofdo}.
10108
10109 E.g.
10110 @smallexample
10111 create_gcov --binary=your_program.unstripped --profile=perf.data \
10112 --gcov=profile.afdo
10113 @end smallexample
10114 @end table
10115
10116 The following options control compiler behavior regarding floating-point
10117 arithmetic. These options trade off between speed and
10118 correctness. All must be specifically enabled.
10119
10120 @table @gcctabopt
10121 @item -ffloat-store
10122 @opindex ffloat-store
10123 Do not store floating-point variables in registers, and inhibit other
10124 options that might change whether a floating-point value is taken from a
10125 register or memory.
10126
10127 @cindex floating-point precision
10128 This option prevents undesirable excess precision on machines such as
10129 the 68000 where the floating registers (of the 68881) keep more
10130 precision than a @code{double} is supposed to have. Similarly for the
10131 x86 architecture. For most programs, the excess precision does only
10132 good, but a few programs rely on the precise definition of IEEE floating
10133 point. Use @option{-ffloat-store} for such programs, after modifying
10134 them to store all pertinent intermediate computations into variables.
10135
10136 @item -fexcess-precision=@var{style}
10137 @opindex fexcess-precision
10138 This option allows further control over excess precision on machines
10139 where floating-point operations occur in a format with more precision or
10140 range than the IEEE standard and interchange floating-point types. By
10141 default, @option{-fexcess-precision=fast} is in effect; this means that
10142 operations may be carried out in a wider precision than the types specified
10143 in the source if that would result in faster code, and it is unpredictable
10144 when rounding to the types specified in the source code takes place.
10145 When compiling C, if @option{-fexcess-precision=standard} is specified then
10146 excess precision follows the rules specified in ISO C99; in particular,
10147 both casts and assignments cause values to be rounded to their
10148 semantic types (whereas @option{-ffloat-store} only affects
10149 assignments). This option is enabled by default for C if a strict
10150 conformance option such as @option{-std=c99} is used.
10151 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10152 regardless of whether a strict conformance option is used.
10153
10154 @opindex mfpmath
10155 @option{-fexcess-precision=standard} is not implemented for languages
10156 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10157 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10158 semantics apply without excess precision, and in the latter, rounding
10159 is unpredictable.
10160
10161 @item -ffast-math
10162 @opindex ffast-math
10163 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10164 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10165 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10166 @option{-fexcess-precision=fast}.
10167
10168 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10169
10170 This option is not turned on by any @option{-O} option besides
10171 @option{-Ofast} since it can result in incorrect output for programs
10172 that depend on an exact implementation of IEEE or ISO rules/specifications
10173 for math functions. It may, however, yield faster code for programs
10174 that do not require the guarantees of these specifications.
10175
10176 @item -fno-math-errno
10177 @opindex fno-math-errno
10178 @opindex fmath-errno
10179 Do not set @code{errno} after calling math functions that are executed
10180 with a single instruction, e.g., @code{sqrt}. A program that relies on
10181 IEEE exceptions for math error handling may want to use this flag
10182 for speed while maintaining IEEE arithmetic compatibility.
10183
10184 This option is not turned on by any @option{-O} option since
10185 it can result in incorrect output for programs that depend on
10186 an exact implementation of IEEE or ISO rules/specifications for
10187 math functions. It may, however, yield faster code for programs
10188 that do not require the guarantees of these specifications.
10189
10190 The default is @option{-fmath-errno}.
10191
10192 On Darwin systems, the math library never sets @code{errno}. There is
10193 therefore no reason for the compiler to consider the possibility that
10194 it might, and @option{-fno-math-errno} is the default.
10195
10196 @item -funsafe-math-optimizations
10197 @opindex funsafe-math-optimizations
10198
10199 Allow optimizations for floating-point arithmetic that (a) assume
10200 that arguments and results are valid and (b) may violate IEEE or
10201 ANSI standards. When used at link time, it may include libraries
10202 or startup files that change the default FPU control word or other
10203 similar optimizations.
10204
10205 This option is not turned on by any @option{-O} option since
10206 it can result in incorrect output for programs that depend on
10207 an exact implementation of IEEE or ISO rules/specifications for
10208 math functions. It may, however, yield faster code for programs
10209 that do not require the guarantees of these specifications.
10210 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10211 @option{-fassociative-math} and @option{-freciprocal-math}.
10212
10213 The default is @option{-fno-unsafe-math-optimizations}.
10214
10215 @item -fassociative-math
10216 @opindex fassociative-math
10217
10218 Allow re-association of operands in series of floating-point operations.
10219 This violates the ISO C and C++ language standard by possibly changing
10220 computation result. NOTE: re-ordering may change the sign of zero as
10221 well as ignore NaNs and inhibit or create underflow or overflow (and
10222 thus cannot be used on code that relies on rounding behavior like
10223 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10224 and thus may not be used when ordered comparisons are required.
10225 This option requires that both @option{-fno-signed-zeros} and
10226 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10227 much sense with @option{-frounding-math}. For Fortran the option
10228 is automatically enabled when both @option{-fno-signed-zeros} and
10229 @option{-fno-trapping-math} are in effect.
10230
10231 The default is @option{-fno-associative-math}.
10232
10233 @item -freciprocal-math
10234 @opindex freciprocal-math
10235
10236 Allow the reciprocal of a value to be used instead of dividing by
10237 the value if this enables optimizations. For example @code{x / y}
10238 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10239 is subject to common subexpression elimination. Note that this loses
10240 precision and increases the number of flops operating on the value.
10241
10242 The default is @option{-fno-reciprocal-math}.
10243
10244 @item -ffinite-math-only
10245 @opindex ffinite-math-only
10246 Allow optimizations for floating-point arithmetic that assume
10247 that arguments and results are not NaNs or +-Infs.
10248
10249 This option is not turned on by any @option{-O} option since
10250 it can result in incorrect output for programs that depend on
10251 an exact implementation of IEEE or ISO rules/specifications for
10252 math functions. It may, however, yield faster code for programs
10253 that do not require the guarantees of these specifications.
10254
10255 The default is @option{-fno-finite-math-only}.
10256
10257 @item -fno-signed-zeros
10258 @opindex fno-signed-zeros
10259 @opindex fsigned-zeros
10260 Allow optimizations for floating-point arithmetic that ignore the
10261 signedness of zero. IEEE arithmetic specifies the behavior of
10262 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10263 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10264 This option implies that the sign of a zero result isn't significant.
10265
10266 The default is @option{-fsigned-zeros}.
10267
10268 @item -fno-trapping-math
10269 @opindex fno-trapping-math
10270 @opindex ftrapping-math
10271 Compile code assuming that floating-point operations cannot generate
10272 user-visible traps. These traps include division by zero, overflow,
10273 underflow, inexact result and invalid operation. This option requires
10274 that @option{-fno-signaling-nans} be in effect. Setting this option may
10275 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10276
10277 This option should never be turned on by any @option{-O} option since
10278 it can result in incorrect output for programs that depend on
10279 an exact implementation of IEEE or ISO rules/specifications for
10280 math functions.
10281
10282 The default is @option{-ftrapping-math}.
10283
10284 @item -frounding-math
10285 @opindex frounding-math
10286 Disable transformations and optimizations that assume default floating-point
10287 rounding behavior. This is round-to-zero for all floating point
10288 to integer conversions, and round-to-nearest for all other arithmetic
10289 truncations. This option should be specified for programs that change
10290 the FP rounding mode dynamically, or that may be executed with a
10291 non-default rounding mode. This option disables constant folding of
10292 floating-point expressions at compile time (which may be affected by
10293 rounding mode) and arithmetic transformations that are unsafe in the
10294 presence of sign-dependent rounding modes.
10295
10296 The default is @option{-fno-rounding-math}.
10297
10298 This option is experimental and does not currently guarantee to
10299 disable all GCC optimizations that are affected by rounding mode.
10300 Future versions of GCC may provide finer control of this setting
10301 using C99's @code{FENV_ACCESS} pragma. This command-line option
10302 will be used to specify the default state for @code{FENV_ACCESS}.
10303
10304 @item -fsignaling-nans
10305 @opindex fsignaling-nans
10306 Compile code assuming that IEEE signaling NaNs may generate user-visible
10307 traps during floating-point operations. Setting this option disables
10308 optimizations that may change the number of exceptions visible with
10309 signaling NaNs. This option implies @option{-ftrapping-math}.
10310
10311 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10312 be defined.
10313
10314 The default is @option{-fno-signaling-nans}.
10315
10316 This option is experimental and does not currently guarantee to
10317 disable all GCC optimizations that affect signaling NaN behavior.
10318
10319 @item -fno-fp-int-builtin-inexact
10320 @opindex fno-fp-int-builtin-inexact
10321 @opindex ffp-int-builtin-inexact
10322 Do not allow the built-in functions @code{ceil}, @code{floor},
10323 @code{round} and @code{trunc}, and their @code{float} and @code{long
10324 double} variants, to generate code that raises the ``inexact''
10325 floating-point exception for noninteger arguments. ISO C99 and C11
10326 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10327 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10328 functions to do so.
10329
10330 The default is @option{-ffp-int-builtin-inexact}, allowing the
10331 exception to be raised. This option does nothing unless
10332 @option{-ftrapping-math} is in effect.
10333
10334 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10335 generate a call to a library function then the ``inexact'' exception
10336 may be raised if the library implementation does not follow TS 18661.
10337
10338 @item -fsingle-precision-constant
10339 @opindex fsingle-precision-constant
10340 Treat floating-point constants as single precision instead of
10341 implicitly converting them to double-precision constants.
10342
10343 @item -fcx-limited-range
10344 @opindex fcx-limited-range
10345 When enabled, this option states that a range reduction step is not
10346 needed when performing complex division. Also, there is no checking
10347 whether the result of a complex multiplication or division is @code{NaN
10348 + I*NaN}, with an attempt to rescue the situation in that case. The
10349 default is @option{-fno-cx-limited-range}, but is enabled by
10350 @option{-ffast-math}.
10351
10352 This option controls the default setting of the ISO C99
10353 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10354 all languages.
10355
10356 @item -fcx-fortran-rules
10357 @opindex fcx-fortran-rules
10358 Complex multiplication and division follow Fortran rules. Range
10359 reduction is done as part of complex division, but there is no checking
10360 whether the result of a complex multiplication or division is @code{NaN
10361 + I*NaN}, with an attempt to rescue the situation in that case.
10362
10363 The default is @option{-fno-cx-fortran-rules}.
10364
10365 @end table
10366
10367 The following options control optimizations that may improve
10368 performance, but are not enabled by any @option{-O} options. This
10369 section includes experimental options that may produce broken code.
10370
10371 @table @gcctabopt
10372 @item -fbranch-probabilities
10373 @opindex fbranch-probabilities
10374 After running a program compiled with @option{-fprofile-arcs}
10375 (@pxref{Instrumentation Options}),
10376 you can compile it a second time using
10377 @option{-fbranch-probabilities}, to improve optimizations based on
10378 the number of times each branch was taken. When a program
10379 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10380 counts to a file called @file{@var{sourcename}.gcda} for each source
10381 file. The information in this data file is very dependent on the
10382 structure of the generated code, so you must use the same source code
10383 and the same optimization options for both compilations.
10384
10385 With @option{-fbranch-probabilities}, GCC puts a
10386 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10387 These can be used to improve optimization. Currently, they are only
10388 used in one place: in @file{reorg.c}, instead of guessing which path a
10389 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10390 exactly determine which path is taken more often.
10391
10392 @item -fprofile-values
10393 @opindex fprofile-values
10394 If combined with @option{-fprofile-arcs}, it adds code so that some
10395 data about values of expressions in the program is gathered.
10396
10397 With @option{-fbranch-probabilities}, it reads back the data gathered
10398 from profiling values of expressions for usage in optimizations.
10399
10400 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10401
10402 @item -fprofile-reorder-functions
10403 @opindex fprofile-reorder-functions
10404 Function reordering based on profile instrumentation collects
10405 first time of execution of a function and orders these functions
10406 in ascending order.
10407
10408 Enabled with @option{-fprofile-use}.
10409
10410 @item -fvpt
10411 @opindex fvpt
10412 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10413 to add code to gather information about values of expressions.
10414
10415 With @option{-fbranch-probabilities}, it reads back the data gathered
10416 and actually performs the optimizations based on them.
10417 Currently the optimizations include specialization of division operations
10418 using the knowledge about the value of the denominator.
10419
10420 @item -frename-registers
10421 @opindex frename-registers
10422 Attempt to avoid false dependencies in scheduled code by making use
10423 of registers left over after register allocation. This optimization
10424 most benefits processors with lots of registers. Depending on the
10425 debug information format adopted by the target, however, it can
10426 make debugging impossible, since variables no longer stay in
10427 a ``home register''.
10428
10429 Enabled by default with @option{-funroll-loops}.
10430
10431 @item -fschedule-fusion
10432 @opindex fschedule-fusion
10433 Performs a target dependent pass over the instruction stream to schedule
10434 instructions of same type together because target machine can execute them
10435 more efficiently if they are adjacent to each other in the instruction flow.
10436
10437 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10438
10439 @item -ftracer
10440 @opindex ftracer
10441 Perform tail duplication to enlarge superblock size. This transformation
10442 simplifies the control flow of the function allowing other optimizations to do
10443 a better job.
10444
10445 Enabled with @option{-fprofile-use}.
10446
10447 @item -funroll-loops
10448 @opindex funroll-loops
10449 Unroll loops whose number of iterations can be determined at compile time or
10450 upon entry to the loop. @option{-funroll-loops} implies
10451 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10452 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10453 a small constant number of iterations). This option makes code larger, and may
10454 or may not make it run faster.
10455
10456 Enabled with @option{-fprofile-use}.
10457
10458 @item -funroll-all-loops
10459 @opindex funroll-all-loops
10460 Unroll all loops, even if their number of iterations is uncertain when
10461 the loop is entered. This usually makes programs run more slowly.
10462 @option{-funroll-all-loops} implies the same options as
10463 @option{-funroll-loops}.
10464
10465 @item -fpeel-loops
10466 @opindex fpeel-loops
10467 Peels loops for which there is enough information that they do not
10468 roll much (from profile feedback or static analysis). It also turns on
10469 complete loop peeling (i.e.@: complete removal of loops with small constant
10470 number of iterations).
10471
10472 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10473
10474 @item -fmove-loop-invariants
10475 @opindex fmove-loop-invariants
10476 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10477 at level @option{-O1}
10478
10479 @item -fsplit-loops
10480 @opindex fsplit-loops
10481 Split a loop into two if it contains a condition that's always true
10482 for one side of the iteration space and false for the other.
10483
10484 @item -funswitch-loops
10485 @opindex funswitch-loops
10486 Move branches with loop invariant conditions out of the loop, with duplicates
10487 of the loop on both branches (modified according to result of the condition).
10488
10489 @item -ffunction-sections
10490 @itemx -fdata-sections
10491 @opindex ffunction-sections
10492 @opindex fdata-sections
10493 Place each function or data item into its own section in the output
10494 file if the target supports arbitrary sections. The name of the
10495 function or the name of the data item determines the section's name
10496 in the output file.
10497
10498 Use these options on systems where the linker can perform optimizations to
10499 improve locality of reference in the instruction space. Most systems using the
10500 ELF object format have linkers with such optimizations. On AIX, the linker
10501 rearranges sections (CSECTs) based on the call graph. The performance impact
10502 varies.
10503
10504 Together with a linker garbage collection (linker @option{--gc-sections}
10505 option) these options may lead to smaller statically-linked executables (after
10506 stripping).
10507
10508 On ELF/DWARF systems these options do not degenerate the quality of the debug
10509 information. There could be issues with other object files/debug info formats.
10510
10511 Only use these options when there are significant benefits from doing so. When
10512 you specify these options, the assembler and linker create larger object and
10513 executable files and are also slower. These options affect code generation.
10514 They prevent optimizations by the compiler and assembler using relative
10515 locations inside a translation unit since the locations are unknown until
10516 link time. An example of such an optimization is relaxing calls to short call
10517 instructions.
10518
10519 @item -fbranch-target-load-optimize
10520 @opindex fbranch-target-load-optimize
10521 Perform branch target register load optimization before prologue / epilogue
10522 threading.
10523 The use of target registers can typically be exposed only during reload,
10524 thus hoisting loads out of loops and doing inter-block scheduling needs
10525 a separate optimization pass.
10526
10527 @item -fbranch-target-load-optimize2
10528 @opindex fbranch-target-load-optimize2
10529 Perform branch target register load optimization after prologue / epilogue
10530 threading.
10531
10532 @item -fbtr-bb-exclusive
10533 @opindex fbtr-bb-exclusive
10534 When performing branch target register load optimization, don't reuse
10535 branch target registers within any basic block.
10536
10537 @item -fstdarg-opt
10538 @opindex fstdarg-opt
10539 Optimize the prologue of variadic argument functions with respect to usage of
10540 those arguments.
10541
10542 @item -fsection-anchors
10543 @opindex fsection-anchors
10544 Try to reduce the number of symbolic address calculations by using
10545 shared ``anchor'' symbols to address nearby objects. This transformation
10546 can help to reduce the number of GOT entries and GOT accesses on some
10547 targets.
10548
10549 For example, the implementation of the following function @code{foo}:
10550
10551 @smallexample
10552 static int a, b, c;
10553 int foo (void) @{ return a + b + c; @}
10554 @end smallexample
10555
10556 @noindent
10557 usually calculates the addresses of all three variables, but if you
10558 compile it with @option{-fsection-anchors}, it accesses the variables
10559 from a common anchor point instead. The effect is similar to the
10560 following pseudocode (which isn't valid C):
10561
10562 @smallexample
10563 int foo (void)
10564 @{
10565 register int *xr = &x;
10566 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10567 @}
10568 @end smallexample
10569
10570 Not all targets support this option.
10571
10572 @item --param @var{name}=@var{value}
10573 @opindex param
10574 In some places, GCC uses various constants to control the amount of
10575 optimization that is done. For example, GCC does not inline functions
10576 that contain more than a certain number of instructions. You can
10577 control some of these constants on the command line using the
10578 @option{--param} option.
10579
10580 The names of specific parameters, and the meaning of the values, are
10581 tied to the internals of the compiler, and are subject to change
10582 without notice in future releases.
10583
10584 In order to get minimal, maximal and default value of a parameter,
10585 one can use @option{--help=param -Q} options.
10586
10587 In each case, the @var{value} is an integer. The allowable choices for
10588 @var{name} are:
10589
10590 @table @gcctabopt
10591 @item predictable-branch-outcome
10592 When branch is predicted to be taken with probability lower than this threshold
10593 (in percent), then it is considered well predictable.
10594
10595 @item max-rtl-if-conversion-insns
10596 RTL if-conversion tries to remove conditional branches around a block and
10597 replace them with conditionally executed instructions. This parameter
10598 gives the maximum number of instructions in a block which should be
10599 considered for if-conversion. The compiler will
10600 also use other heuristics to decide whether if-conversion is likely to be
10601 profitable.
10602
10603 @item max-rtl-if-conversion-predictable-cost
10604 @itemx max-rtl-if-conversion-unpredictable-cost
10605 RTL if-conversion will try to remove conditional branches around a block
10606 and replace them with conditionally executed instructions. These parameters
10607 give the maximum permissible cost for the sequence that would be generated
10608 by if-conversion depending on whether the branch is statically determined
10609 to be predictable or not. The units for this parameter are the same as
10610 those for the GCC internal seq_cost metric. The compiler will try to
10611 provide a reasonable default for this parameter using the BRANCH_COST
10612 target macro.
10613
10614 @item max-crossjump-edges
10615 The maximum number of incoming edges to consider for cross-jumping.
10616 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10617 the number of edges incoming to each block. Increasing values mean
10618 more aggressive optimization, making the compilation time increase with
10619 probably small improvement in executable size.
10620
10621 @item min-crossjump-insns
10622 The minimum number of instructions that must be matched at the end
10623 of two blocks before cross-jumping is performed on them. This
10624 value is ignored in the case where all instructions in the block being
10625 cross-jumped from are matched.
10626
10627 @item max-grow-copy-bb-insns
10628 The maximum code size expansion factor when copying basic blocks
10629 instead of jumping. The expansion is relative to a jump instruction.
10630
10631 @item max-goto-duplication-insns
10632 The maximum number of instructions to duplicate to a block that jumps
10633 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10634 passes, GCC factors computed gotos early in the compilation process,
10635 and unfactors them as late as possible. Only computed jumps at the
10636 end of a basic blocks with no more than max-goto-duplication-insns are
10637 unfactored.
10638
10639 @item max-delay-slot-insn-search
10640 The maximum number of instructions to consider when looking for an
10641 instruction to fill a delay slot. If more than this arbitrary number of
10642 instructions are searched, the time savings from filling the delay slot
10643 are minimal, so stop searching. Increasing values mean more
10644 aggressive optimization, making the compilation time increase with probably
10645 small improvement in execution time.
10646
10647 @item max-delay-slot-live-search
10648 When trying to fill delay slots, the maximum number of instructions to
10649 consider when searching for a block with valid live register
10650 information. Increasing this arbitrarily chosen value means more
10651 aggressive optimization, increasing the compilation time. This parameter
10652 should be removed when the delay slot code is rewritten to maintain the
10653 control-flow graph.
10654
10655 @item max-gcse-memory
10656 The approximate maximum amount of memory that can be allocated in
10657 order to perform the global common subexpression elimination
10658 optimization. If more memory than specified is required, the
10659 optimization is not done.
10660
10661 @item max-gcse-insertion-ratio
10662 If the ratio of expression insertions to deletions is larger than this value
10663 for any expression, then RTL PRE inserts or removes the expression and thus
10664 leaves partially redundant computations in the instruction stream.
10665
10666 @item max-pending-list-length
10667 The maximum number of pending dependencies scheduling allows
10668 before flushing the current state and starting over. Large functions
10669 with few branches or calls can create excessively large lists which
10670 needlessly consume memory and resources.
10671
10672 @item max-modulo-backtrack-attempts
10673 The maximum number of backtrack attempts the scheduler should make
10674 when modulo scheduling a loop. Larger values can exponentially increase
10675 compilation time.
10676
10677 @item max-inline-insns-single
10678 Several parameters control the tree inliner used in GCC@.
10679 This number sets the maximum number of instructions (counted in GCC's
10680 internal representation) in a single function that the tree inliner
10681 considers for inlining. This only affects functions declared
10682 inline and methods implemented in a class declaration (C++).
10683
10684 @item max-inline-insns-auto
10685 When you use @option{-finline-functions} (included in @option{-O3}),
10686 a lot of functions that would otherwise not be considered for inlining
10687 by the compiler are investigated. To those functions, a different
10688 (more restrictive) limit compared to functions declared inline can
10689 be applied.
10690
10691 @item inline-min-speedup
10692 When estimated performance improvement of caller + callee runtime exceeds this
10693 threshold (in percent), the function can be inlined regardless of the limit on
10694 @option{--param max-inline-insns-single} and @option{--param
10695 max-inline-insns-auto}.
10696
10697 @item large-function-insns
10698 The limit specifying really large functions. For functions larger than this
10699 limit after inlining, inlining is constrained by
10700 @option{--param large-function-growth}. This parameter is useful primarily
10701 to avoid extreme compilation time caused by non-linear algorithms used by the
10702 back end.
10703
10704 @item large-function-growth
10705 Specifies maximal growth of large function caused by inlining in percents.
10706 For example, parameter value 100 limits large function growth to 2.0 times
10707 the original size.
10708
10709 @item large-unit-insns
10710 The limit specifying large translation unit. Growth caused by inlining of
10711 units larger than this limit is limited by @option{--param inline-unit-growth}.
10712 For small units this might be too tight.
10713 For example, consider a unit consisting of function A
10714 that is inline and B that just calls A three times. If B is small relative to
10715 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10716 large units consisting of small inlineable functions, however, the overall unit
10717 growth limit is needed to avoid exponential explosion of code size. Thus for
10718 smaller units, the size is increased to @option{--param large-unit-insns}
10719 before applying @option{--param inline-unit-growth}.
10720
10721 @item inline-unit-growth
10722 Specifies maximal overall growth of the compilation unit caused by inlining.
10723 For example, parameter value 20 limits unit growth to 1.2 times the original
10724 size. Cold functions (either marked cold via an attribute or by profile
10725 feedback) are not accounted into the unit size.
10726
10727 @item ipcp-unit-growth
10728 Specifies maximal overall growth of the compilation unit caused by
10729 interprocedural constant propagation. For example, parameter value 10 limits
10730 unit growth to 1.1 times the original size.
10731
10732 @item large-stack-frame
10733 The limit specifying large stack frames. While inlining the algorithm is trying
10734 to not grow past this limit too much.
10735
10736 @item large-stack-frame-growth
10737 Specifies maximal growth of large stack frames caused by inlining in percents.
10738 For example, parameter value 1000 limits large stack frame growth to 11 times
10739 the original size.
10740
10741 @item max-inline-insns-recursive
10742 @itemx max-inline-insns-recursive-auto
10743 Specifies the maximum number of instructions an out-of-line copy of a
10744 self-recursive inline
10745 function can grow into by performing recursive inlining.
10746
10747 @option{--param max-inline-insns-recursive} applies to functions
10748 declared inline.
10749 For functions not declared inline, recursive inlining
10750 happens only when @option{-finline-functions} (included in @option{-O3}) is
10751 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
10752
10753 @item max-inline-recursive-depth
10754 @itemx max-inline-recursive-depth-auto
10755 Specifies the maximum recursion depth used for recursive inlining.
10756
10757 @option{--param max-inline-recursive-depth} applies to functions
10758 declared inline. For functions not declared inline, recursive inlining
10759 happens only when @option{-finline-functions} (included in @option{-O3}) is
10760 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
10761
10762 @item min-inline-recursive-probability
10763 Recursive inlining is profitable only for function having deep recursion
10764 in average and can hurt for function having little recursion depth by
10765 increasing the prologue size or complexity of function body to other
10766 optimizers.
10767
10768 When profile feedback is available (see @option{-fprofile-generate}) the actual
10769 recursion depth can be guessed from the probability that function recurses
10770 via a given call expression. This parameter limits inlining only to call
10771 expressions whose probability exceeds the given threshold (in percents).
10772
10773 @item early-inlining-insns
10774 Specify growth that the early inliner can make. In effect it increases
10775 the amount of inlining for code having a large abstraction penalty.
10776
10777 @item max-early-inliner-iterations
10778 Limit of iterations of the early inliner. This basically bounds
10779 the number of nested indirect calls the early inliner can resolve.
10780 Deeper chains are still handled by late inlining.
10781
10782 @item comdat-sharing-probability
10783 Probability (in percent) that C++ inline function with comdat visibility
10784 are shared across multiple compilation units.
10785
10786 @item profile-func-internal-id
10787 A parameter to control whether to use function internal id in profile
10788 database lookup. If the value is 0, the compiler uses an id that
10789 is based on function assembler name and filename, which makes old profile
10790 data more tolerant to source changes such as function reordering etc.
10791
10792 @item min-vect-loop-bound
10793 The minimum number of iterations under which loops are not vectorized
10794 when @option{-ftree-vectorize} is used. The number of iterations after
10795 vectorization needs to be greater than the value specified by this option
10796 to allow vectorization.
10797
10798 @item gcse-cost-distance-ratio
10799 Scaling factor in calculation of maximum distance an expression
10800 can be moved by GCSE optimizations. This is currently supported only in the
10801 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10802 is with simple expressions, i.e., the expressions that have cost
10803 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10804 hoisting of simple expressions.
10805
10806 @item gcse-unrestricted-cost
10807 Cost, roughly measured as the cost of a single typical machine
10808 instruction, at which GCSE optimizations do not constrain
10809 the distance an expression can travel. This is currently
10810 supported only in the code hoisting pass. The lesser the cost,
10811 the more aggressive code hoisting is. Specifying 0
10812 allows all expressions to travel unrestricted distances.
10813
10814 @item max-hoist-depth
10815 The depth of search in the dominator tree for expressions to hoist.
10816 This is used to avoid quadratic behavior in hoisting algorithm.
10817 The value of 0 does not limit on the search, but may slow down compilation
10818 of huge functions.
10819
10820 @item max-tail-merge-comparisons
10821 The maximum amount of similar bbs to compare a bb with. This is used to
10822 avoid quadratic behavior in tree tail merging.
10823
10824 @item max-tail-merge-iterations
10825 The maximum amount of iterations of the pass over the function. This is used to
10826 limit compilation time in tree tail merging.
10827
10828 @item store-merging-allow-unaligned
10829 Allow the store merging pass to introduce unaligned stores if it is legal to
10830 do so.
10831
10832 @item max-stores-to-merge
10833 The maximum number of stores to attempt to merge into wider stores in the store
10834 merging pass.
10835
10836 @item max-unrolled-insns
10837 The maximum number of instructions that a loop may have to be unrolled.
10838 If a loop is unrolled, this parameter also determines how many times
10839 the loop code is unrolled.
10840
10841 @item max-average-unrolled-insns
10842 The maximum number of instructions biased by probabilities of their execution
10843 that a loop may have to be unrolled. If a loop is unrolled,
10844 this parameter also determines how many times the loop code is unrolled.
10845
10846 @item max-unroll-times
10847 The maximum number of unrollings of a single loop.
10848
10849 @item max-peeled-insns
10850 The maximum number of instructions that a loop may have to be peeled.
10851 If a loop is peeled, this parameter also determines how many times
10852 the loop code is peeled.
10853
10854 @item max-peel-times
10855 The maximum number of peelings of a single loop.
10856
10857 @item max-peel-branches
10858 The maximum number of branches on the hot path through the peeled sequence.
10859
10860 @item max-completely-peeled-insns
10861 The maximum number of insns of a completely peeled loop.
10862
10863 @item max-completely-peel-times
10864 The maximum number of iterations of a loop to be suitable for complete peeling.
10865
10866 @item max-completely-peel-loop-nest-depth
10867 The maximum depth of a loop nest suitable for complete peeling.
10868
10869 @item max-unswitch-insns
10870 The maximum number of insns of an unswitched loop.
10871
10872 @item max-unswitch-level
10873 The maximum number of branches unswitched in a single loop.
10874
10875 @item lim-expensive
10876 The minimum cost of an expensive expression in the loop invariant motion.
10877
10878 @item iv-consider-all-candidates-bound
10879 Bound on number of candidates for induction variables, below which
10880 all candidates are considered for each use in induction variable
10881 optimizations. If there are more candidates than this,
10882 only the most relevant ones are considered to avoid quadratic time complexity.
10883
10884 @item iv-max-considered-uses
10885 The induction variable optimizations give up on loops that contain more
10886 induction variable uses.
10887
10888 @item iv-always-prune-cand-set-bound
10889 If the number of candidates in the set is smaller than this value,
10890 always try to remove unnecessary ivs from the set
10891 when adding a new one.
10892
10893 @item avg-loop-niter
10894 Average number of iterations of a loop.
10895
10896 @item dse-max-object-size
10897 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10898 Larger values may result in larger compilation times.
10899
10900 @item dse-max-alias-queries-per-store
10901 Maximum number of queries into the alias oracle per store.
10902 Larger values result in larger compilation times and may result in more
10903 removed dead stores.
10904
10905 @item scev-max-expr-size
10906 Bound on size of expressions used in the scalar evolutions analyzer.
10907 Large expressions slow the analyzer.
10908
10909 @item scev-max-expr-complexity
10910 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10911 Complex expressions slow the analyzer.
10912
10913 @item max-tree-if-conversion-phi-args
10914 Maximum number of arguments in a PHI supported by TREE if conversion
10915 unless the loop is marked with simd pragma.
10916
10917 @item vect-max-version-for-alignment-checks
10918 The maximum number of run-time checks that can be performed when
10919 doing loop versioning for alignment in the vectorizer.
10920
10921 @item vect-max-version-for-alias-checks
10922 The maximum number of run-time checks that can be performed when
10923 doing loop versioning for alias in the vectorizer.
10924
10925 @item vect-max-peeling-for-alignment
10926 The maximum number of loop peels to enhance access alignment
10927 for vectorizer. Value -1 means no limit.
10928
10929 @item max-iterations-to-track
10930 The maximum number of iterations of a loop the brute-force algorithm
10931 for analysis of the number of iterations of the loop tries to evaluate.
10932
10933 @item hot-bb-count-ws-permille
10934 A basic block profile count is considered hot if it contributes to
10935 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
10936
10937 @item hot-bb-frequency-fraction
10938 Select fraction of the entry block frequency of executions of basic block in
10939 function given basic block needs to have to be considered hot.
10940
10941 @item max-predicted-iterations
10942 The maximum number of loop iterations we predict statically. This is useful
10943 in cases where a function contains a single loop with known bound and
10944 another loop with unknown bound.
10945 The known number of iterations is predicted correctly, while
10946 the unknown number of iterations average to roughly 10. This means that the
10947 loop without bounds appears artificially cold relative to the other one.
10948
10949 @item builtin-expect-probability
10950 Control the probability of the expression having the specified value. This
10951 parameter takes a percentage (i.e.@: 0 ... 100) as input.
10952
10953 @item builtin-string-cmp-inline-length
10954 The maximum length of a constant string for a builtin string cmp call
10955 eligible for inlining.
10956
10957 @item align-threshold
10958
10959 Select fraction of the maximal frequency of executions of a basic block in
10960 a function to align the basic block.
10961
10962 @item align-loop-iterations
10963
10964 A loop expected to iterate at least the selected number of iterations is
10965 aligned.
10966
10967 @item tracer-dynamic-coverage
10968 @itemx tracer-dynamic-coverage-feedback
10969
10970 This value is used to limit superblock formation once the given percentage of
10971 executed instructions is covered. This limits unnecessary code size
10972 expansion.
10973
10974 The @option{tracer-dynamic-coverage-feedback} parameter
10975 is used only when profile
10976 feedback is available. The real profiles (as opposed to statically estimated
10977 ones) are much less balanced allowing the threshold to be larger value.
10978
10979 @item tracer-max-code-growth
10980 Stop tail duplication once code growth has reached given percentage. This is
10981 a rather artificial limit, as most of the duplicates are eliminated later in
10982 cross jumping, so it may be set to much higher values than is the desired code
10983 growth.
10984
10985 @item tracer-min-branch-ratio
10986
10987 Stop reverse growth when the reverse probability of best edge is less than this
10988 threshold (in percent).
10989
10990 @item tracer-min-branch-probability
10991 @itemx tracer-min-branch-probability-feedback
10992
10993 Stop forward growth if the best edge has probability lower than this
10994 threshold.
10995
10996 Similarly to @option{tracer-dynamic-coverage} two parameters are
10997 provided. @option{tracer-min-branch-probability-feedback} is used for
10998 compilation with profile feedback and @option{tracer-min-branch-probability}
10999 compilation without. The value for compilation with profile feedback
11000 needs to be more conservative (higher) in order to make tracer
11001 effective.
11002
11003 @item stack-clash-protection-guard-size
11004 Specify the size of the operating system provided stack guard as
11005 2 raised to @var{num} bytes. Higher values may reduce the
11006 number of explicit probes, but a value larger than the operating system
11007 provided guard will leave code vulnerable to stack clash style attacks.
11008
11009 @item stack-clash-protection-probe-interval
11010 Stack clash protection involves probing stack space as it is allocated. This
11011 param controls the maximum distance between probes into the stack as 2 raised
11012 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11013 larger than the operating system provided guard will leave code vulnerable to
11014 stack clash style attacks.
11015
11016 @item max-cse-path-length
11017
11018 The maximum number of basic blocks on path that CSE considers.
11019
11020 @item max-cse-insns
11021 The maximum number of instructions CSE processes before flushing.
11022
11023 @item ggc-min-expand
11024
11025 GCC uses a garbage collector to manage its own memory allocation. This
11026 parameter specifies the minimum percentage by which the garbage
11027 collector's heap should be allowed to expand between collections.
11028 Tuning this may improve compilation speed; it has no effect on code
11029 generation.
11030
11031 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11032 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11033 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11034 GCC is not able to calculate RAM on a particular platform, the lower
11035 bound of 30% is used. Setting this parameter and
11036 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11037 every opportunity. This is extremely slow, but can be useful for
11038 debugging.
11039
11040 @item ggc-min-heapsize
11041
11042 Minimum size of the garbage collector's heap before it begins bothering
11043 to collect garbage. The first collection occurs after the heap expands
11044 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11045 tuning this may improve compilation speed, and has no effect on code
11046 generation.
11047
11048 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11049 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11050 with a lower bound of 4096 (four megabytes) and an upper bound of
11051 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11052 particular platform, the lower bound is used. Setting this parameter
11053 very large effectively disables garbage collection. Setting this
11054 parameter and @option{ggc-min-expand} to zero causes a full collection
11055 to occur at every opportunity.
11056
11057 @item max-reload-search-insns
11058 The maximum number of instruction reload should look backward for equivalent
11059 register. Increasing values mean more aggressive optimization, making the
11060 compilation time increase with probably slightly better performance.
11061
11062 @item max-cselib-memory-locations
11063 The maximum number of memory locations cselib should take into account.
11064 Increasing values mean more aggressive optimization, making the compilation time
11065 increase with probably slightly better performance.
11066
11067 @item max-sched-ready-insns
11068 The maximum number of instructions ready to be issued the scheduler should
11069 consider at any given time during the first scheduling pass. Increasing
11070 values mean more thorough searches, making the compilation time increase
11071 with probably little benefit.
11072
11073 @item max-sched-region-blocks
11074 The maximum number of blocks in a region to be considered for
11075 interblock scheduling.
11076
11077 @item max-pipeline-region-blocks
11078 The maximum number of blocks in a region to be considered for
11079 pipelining in the selective scheduler.
11080
11081 @item max-sched-region-insns
11082 The maximum number of insns in a region to be considered for
11083 interblock scheduling.
11084
11085 @item max-pipeline-region-insns
11086 The maximum number of insns in a region to be considered for
11087 pipelining in the selective scheduler.
11088
11089 @item min-spec-prob
11090 The minimum probability (in percents) of reaching a source block
11091 for interblock speculative scheduling.
11092
11093 @item max-sched-extend-regions-iters
11094 The maximum number of iterations through CFG to extend regions.
11095 A value of 0 disables region extensions.
11096
11097 @item max-sched-insn-conflict-delay
11098 The maximum conflict delay for an insn to be considered for speculative motion.
11099
11100 @item sched-spec-prob-cutoff
11101 The minimal probability of speculation success (in percents), so that
11102 speculative insns are scheduled.
11103
11104 @item sched-state-edge-prob-cutoff
11105 The minimum probability an edge must have for the scheduler to save its
11106 state across it.
11107
11108 @item sched-mem-true-dep-cost
11109 Minimal distance (in CPU cycles) between store and load targeting same
11110 memory locations.
11111
11112 @item selsched-max-lookahead
11113 The maximum size of the lookahead window of selective scheduling. It is a
11114 depth of search for available instructions.
11115
11116 @item selsched-max-sched-times
11117 The maximum number of times that an instruction is scheduled during
11118 selective scheduling. This is the limit on the number of iterations
11119 through which the instruction may be pipelined.
11120
11121 @item selsched-insns-to-rename
11122 The maximum number of best instructions in the ready list that are considered
11123 for renaming in the selective scheduler.
11124
11125 @item sms-min-sc
11126 The minimum value of stage count that swing modulo scheduler
11127 generates.
11128
11129 @item max-last-value-rtl
11130 The maximum size measured as number of RTLs that can be recorded in an expression
11131 in combiner for a pseudo register as last known value of that register.
11132
11133 @item max-combine-insns
11134 The maximum number of instructions the RTL combiner tries to combine.
11135
11136 @item integer-share-limit
11137 Small integer constants can use a shared data structure, reducing the
11138 compiler's memory usage and increasing its speed. This sets the maximum
11139 value of a shared integer constant.
11140
11141 @item ssp-buffer-size
11142 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11143 protection when @option{-fstack-protection} is used.
11144
11145 @item min-size-for-stack-sharing
11146 The minimum size of variables taking part in stack slot sharing when not
11147 optimizing.
11148
11149 @item max-jump-thread-duplication-stmts
11150 Maximum number of statements allowed in a block that needs to be
11151 duplicated when threading jumps.
11152
11153 @item max-fields-for-field-sensitive
11154 Maximum number of fields in a structure treated in
11155 a field sensitive manner during pointer analysis.
11156
11157 @item prefetch-latency
11158 Estimate on average number of instructions that are executed before
11159 prefetch finishes. The distance prefetched ahead is proportional
11160 to this constant. Increasing this number may also lead to less
11161 streams being prefetched (see @option{simultaneous-prefetches}).
11162
11163 @item simultaneous-prefetches
11164 Maximum number of prefetches that can run at the same time.
11165
11166 @item l1-cache-line-size
11167 The size of cache line in L1 cache, in bytes.
11168
11169 @item l1-cache-size
11170 The size of L1 cache, in kilobytes.
11171
11172 @item l2-cache-size
11173 The size of L2 cache, in kilobytes.
11174
11175 @item prefetch-dynamic-strides
11176 Whether the loop array prefetch pass should issue software prefetch hints
11177 for strides that are non-constant. In some cases this may be
11178 beneficial, though the fact the stride is non-constant may make it
11179 hard to predict when there is clear benefit to issuing these hints.
11180
11181 Set to 1 if the prefetch hints should be issued for non-constant
11182 strides. Set to 0 if prefetch hints should be issued only for strides that
11183 are known to be constant and below @option{prefetch-minimum-stride}.
11184
11185 @item prefetch-minimum-stride
11186 Minimum constant stride, in bytes, to start using prefetch hints for. If
11187 the stride is less than this threshold, prefetch hints will not be issued.
11188
11189 This setting is useful for processors that have hardware prefetchers, in
11190 which case there may be conflicts between the hardware prefetchers and
11191 the software prefetchers. If the hardware prefetchers have a maximum
11192 stride they can handle, it should be used here to improve the use of
11193 software prefetchers.
11194
11195 A value of -1 means we don't have a threshold and therefore
11196 prefetch hints can be issued for any constant stride.
11197
11198 This setting is only useful for strides that are known and constant.
11199
11200 @item loop-interchange-max-num-stmts
11201 The maximum number of stmts in a loop to be interchanged.
11202
11203 @item loop-interchange-stride-ratio
11204 The minimum ratio between stride of two loops for interchange to be profitable.
11205
11206 @item min-insn-to-prefetch-ratio
11207 The minimum ratio between the number of instructions and the
11208 number of prefetches to enable prefetching in a loop.
11209
11210 @item prefetch-min-insn-to-mem-ratio
11211 The minimum ratio between the number of instructions and the
11212 number of memory references to enable prefetching in a loop.
11213
11214 @item use-canonical-types
11215 Whether the compiler should use the ``canonical'' type system.
11216 Should always be 1, which uses a more efficient internal
11217 mechanism for comparing types in C++ and Objective-C++. However, if
11218 bugs in the canonical type system are causing compilation failures,
11219 set this value to 0 to disable canonical types.
11220
11221 @item switch-conversion-max-branch-ratio
11222 Switch initialization conversion refuses to create arrays that are
11223 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11224 branches in the switch.
11225
11226 @item max-partial-antic-length
11227 Maximum length of the partial antic set computed during the tree
11228 partial redundancy elimination optimization (@option{-ftree-pre}) when
11229 optimizing at @option{-O3} and above. For some sorts of source code
11230 the enhanced partial redundancy elimination optimization can run away,
11231 consuming all of the memory available on the host machine. This
11232 parameter sets a limit on the length of the sets that are computed,
11233 which prevents the runaway behavior. Setting a value of 0 for
11234 this parameter allows an unlimited set length.
11235
11236 @item rpo-vn-max-loop-depth
11237 Maximum loop depth that is value-numbered optimistically.
11238 When the limit hits the innermost
11239 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11240 loop nest are value-numbered optimistically and the remaining ones not.
11241
11242 @item sccvn-max-alias-queries-per-access
11243 Maximum number of alias-oracle queries we perform when looking for
11244 redundancies for loads and stores. If this limit is hit the search
11245 is aborted and the load or store is not considered redundant. The
11246 number of queries is algorithmically limited to the number of
11247 stores on all paths from the load to the function entry.
11248
11249 @item ira-max-loops-num
11250 IRA uses regional register allocation by default. If a function
11251 contains more loops than the number given by this parameter, only at most
11252 the given number of the most frequently-executed loops form regions
11253 for regional register allocation.
11254
11255 @item ira-max-conflict-table-size
11256 Although IRA uses a sophisticated algorithm to compress the conflict
11257 table, the table can still require excessive amounts of memory for
11258 huge functions. If the conflict table for a function could be more
11259 than the size in MB given by this parameter, the register allocator
11260 instead uses a faster, simpler, and lower-quality
11261 algorithm that does not require building a pseudo-register conflict table.
11262
11263 @item ira-loop-reserved-regs
11264 IRA can be used to evaluate more accurate register pressure in loops
11265 for decisions to move loop invariants (see @option{-O3}). The number
11266 of available registers reserved for some other purposes is given
11267 by this parameter. Default of the parameter
11268 is the best found from numerous experiments.
11269
11270 @item lra-inheritance-ebb-probability-cutoff
11271 LRA tries to reuse values reloaded in registers in subsequent insns.
11272 This optimization is called inheritance. EBB is used as a region to
11273 do this optimization. The parameter defines a minimal fall-through
11274 edge probability in percentage used to add BB to inheritance EBB in
11275 LRA. The default value was chosen
11276 from numerous runs of SPEC2000 on x86-64.
11277
11278 @item loop-invariant-max-bbs-in-loop
11279 Loop invariant motion can be very expensive, both in compilation time and
11280 in amount of needed compile-time memory, with very large loops. Loops
11281 with more basic blocks than this parameter won't have loop invariant
11282 motion optimization performed on them.
11283
11284 @item loop-max-datarefs-for-datadeps
11285 Building data dependencies is expensive for very large loops. This
11286 parameter limits the number of data references in loops that are
11287 considered for data dependence analysis. These large loops are no
11288 handled by the optimizations using loop data dependencies.
11289
11290 @item max-vartrack-size
11291 Sets a maximum number of hash table slots to use during variable
11292 tracking dataflow analysis of any function. If this limit is exceeded
11293 with variable tracking at assignments enabled, analysis for that
11294 function is retried without it, after removing all debug insns from
11295 the function. If the limit is exceeded even without debug insns, var
11296 tracking analysis is completely disabled for the function. Setting
11297 the parameter to zero makes it unlimited.
11298
11299 @item max-vartrack-expr-depth
11300 Sets a maximum number of recursion levels when attempting to map
11301 variable names or debug temporaries to value expressions. This trades
11302 compilation time for more complete debug information. If this is set too
11303 low, value expressions that are available and could be represented in
11304 debug information may end up not being used; setting this higher may
11305 enable the compiler to find more complex debug expressions, but compile
11306 time and memory use may grow.
11307
11308 @item max-debug-marker-count
11309 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11310 markers) to avoid complexity explosion at inlining or expanding to RTL.
11311 If a function has more such gimple stmts than the set limit, such stmts
11312 will be dropped from the inlined copy of a function, and from its RTL
11313 expansion.
11314
11315 @item min-nondebug-insn-uid
11316 Use uids starting at this parameter for nondebug insns. The range below
11317 the parameter is reserved exclusively for debug insns created by
11318 @option{-fvar-tracking-assignments}, but debug insns may get
11319 (non-overlapping) uids above it if the reserved range is exhausted.
11320
11321 @item ipa-sra-ptr-growth-factor
11322 IPA-SRA replaces a pointer to an aggregate with one or more new
11323 parameters only when their cumulative size is less or equal to
11324 @option{ipa-sra-ptr-growth-factor} times the size of the original
11325 pointer parameter.
11326
11327 @item sra-max-scalarization-size-Ospeed
11328 @itemx sra-max-scalarization-size-Osize
11329 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11330 replace scalar parts of aggregates with uses of independent scalar
11331 variables. These parameters control the maximum size, in storage units,
11332 of aggregate which is considered for replacement when compiling for
11333 speed
11334 (@option{sra-max-scalarization-size-Ospeed}) or size
11335 (@option{sra-max-scalarization-size-Osize}) respectively.
11336
11337 @item tm-max-aggregate-size
11338 When making copies of thread-local variables in a transaction, this
11339 parameter specifies the size in bytes after which variables are
11340 saved with the logging functions as opposed to save/restore code
11341 sequence pairs. This option only applies when using
11342 @option{-fgnu-tm}.
11343
11344 @item graphite-max-nb-scop-params
11345 To avoid exponential effects in the Graphite loop transforms, the
11346 number of parameters in a Static Control Part (SCoP) is bounded.
11347 A value of zero can be used to lift
11348 the bound. A variable whose value is unknown at compilation time and
11349 defined outside a SCoP is a parameter of the SCoP.
11350
11351 @item loop-block-tile-size
11352 Loop blocking or strip mining transforms, enabled with
11353 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11354 loop in the loop nest by a given number of iterations. The strip
11355 length can be changed using the @option{loop-block-tile-size}
11356 parameter.
11357
11358 @item ipa-cp-value-list-size
11359 IPA-CP attempts to track all possible values and types passed to a function's
11360 parameter in order to propagate them and perform devirtualization.
11361 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11362 stores per one formal parameter of a function.
11363
11364 @item ipa-cp-eval-threshold
11365 IPA-CP calculates its own score of cloning profitability heuristics
11366 and performs those cloning opportunities with scores that exceed
11367 @option{ipa-cp-eval-threshold}.
11368
11369 @item ipa-cp-recursion-penalty
11370 Percentage penalty the recursive functions will receive when they
11371 are evaluated for cloning.
11372
11373 @item ipa-cp-single-call-penalty
11374 Percentage penalty functions containing a single call to another
11375 function will receive when they are evaluated for cloning.
11376
11377 @item ipa-max-agg-items
11378 IPA-CP is also capable to propagate a number of scalar values passed
11379 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11380 number of such values per one parameter.
11381
11382 @item ipa-cp-loop-hint-bonus
11383 When IPA-CP determines that a cloning candidate would make the number
11384 of iterations of a loop known, it adds a bonus of
11385 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11386 the candidate.
11387
11388 @item ipa-cp-array-index-hint-bonus
11389 When IPA-CP determines that a cloning candidate would make the index of
11390 an array access known, it adds a bonus of
11391 @option{ipa-cp-array-index-hint-bonus} to the profitability
11392 score of the candidate.
11393
11394 @item ipa-max-aa-steps
11395 During its analysis of function bodies, IPA-CP employs alias analysis
11396 in order to track values pointed to by function parameters. In order
11397 not spend too much time analyzing huge functions, it gives up and
11398 consider all memory clobbered after examining
11399 @option{ipa-max-aa-steps} statements modifying memory.
11400
11401 @item lto-partitions
11402 Specify desired number of partitions produced during WHOPR compilation.
11403 The number of partitions should exceed the number of CPUs used for compilation.
11404
11405 @item lto-min-partition
11406 Size of minimal partition for WHOPR (in estimated instructions).
11407 This prevents expenses of splitting very small programs into too many
11408 partitions.
11409
11410 @item lto-max-partition
11411 Size of max partition for WHOPR (in estimated instructions).
11412 to provide an upper bound for individual size of partition.
11413 Meant to be used only with balanced partitioning.
11414
11415 @item cxx-max-namespaces-for-diagnostic-help
11416 The maximum number of namespaces to consult for suggestions when C++
11417 name lookup fails for an identifier.
11418
11419 @item sink-frequency-threshold
11420 The maximum relative execution frequency (in percents) of the target block
11421 relative to a statement's original block to allow statement sinking of a
11422 statement. Larger numbers result in more aggressive statement sinking.
11423 A small positive adjustment is applied for
11424 statements with memory operands as those are even more profitable so sink.
11425
11426 @item max-stores-to-sink
11427 The maximum number of conditional store pairs that can be sunk. Set to 0
11428 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11429 (@option{-ftree-loop-if-convert}) is disabled.
11430
11431 @item allow-store-data-races
11432 Allow optimizers to introduce new data races on stores.
11433 Set to 1 to allow, otherwise to 0.
11434
11435 @item case-values-threshold
11436 The smallest number of different values for which it is best to use a
11437 jump-table instead of a tree of conditional branches. If the value is
11438 0, use the default for the machine.
11439
11440 @item tree-reassoc-width
11441 Set the maximum number of instructions executed in parallel in
11442 reassociated tree. This parameter overrides target dependent
11443 heuristics used by default if has non zero value.
11444
11445 @item sched-pressure-algorithm
11446 Choose between the two available implementations of
11447 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11448 and is the more likely to prevent instructions from being reordered.
11449 Algorithm 2 was designed to be a compromise between the relatively
11450 conservative approach taken by algorithm 1 and the rather aggressive
11451 approach taken by the default scheduler. It relies more heavily on
11452 having a regular register file and accurate register pressure classes.
11453 See @file{haifa-sched.c} in the GCC sources for more details.
11454
11455 The default choice depends on the target.
11456
11457 @item max-slsr-cand-scan
11458 Set the maximum number of existing candidates that are considered when
11459 seeking a basis for a new straight-line strength reduction candidate.
11460
11461 @item asan-globals
11462 Enable buffer overflow detection for global objects. This kind
11463 of protection is enabled by default if you are using
11464 @option{-fsanitize=address} option.
11465 To disable global objects protection use @option{--param asan-globals=0}.
11466
11467 @item asan-stack
11468 Enable buffer overflow detection for stack objects. This kind of
11469 protection is enabled by default when using @option{-fsanitize=address}.
11470 To disable stack protection use @option{--param asan-stack=0} option.
11471
11472 @item asan-instrument-reads
11473 Enable buffer overflow detection for memory reads. This kind of
11474 protection is enabled by default when using @option{-fsanitize=address}.
11475 To disable memory reads protection use
11476 @option{--param asan-instrument-reads=0}.
11477
11478 @item asan-instrument-writes
11479 Enable buffer overflow detection for memory writes. This kind of
11480 protection is enabled by default when using @option{-fsanitize=address}.
11481 To disable memory writes protection use
11482 @option{--param asan-instrument-writes=0} option.
11483
11484 @item asan-memintrin
11485 Enable detection for built-in functions. This kind of protection
11486 is enabled by default when using @option{-fsanitize=address}.
11487 To disable built-in functions protection use
11488 @option{--param asan-memintrin=0}.
11489
11490 @item asan-use-after-return
11491 Enable detection of use-after-return. This kind of protection
11492 is enabled by default when using the @option{-fsanitize=address} option.
11493 To disable it use @option{--param asan-use-after-return=0}.
11494
11495 Note: By default the check is disabled at run time. To enable it,
11496 add @code{detect_stack_use_after_return=1} to the environment variable
11497 @env{ASAN_OPTIONS}.
11498
11499 @item asan-instrumentation-with-call-threshold
11500 If number of memory accesses in function being instrumented
11501 is greater or equal to this number, use callbacks instead of inline checks.
11502 E.g. to disable inline code use
11503 @option{--param asan-instrumentation-with-call-threshold=0}.
11504
11505 @item use-after-scope-direct-emission-threshold
11506 If the size of a local variable in bytes is smaller or equal to this
11507 number, directly poison (or unpoison) shadow memory instead of using
11508 run-time callbacks.
11509
11510 @item max-fsm-thread-path-insns
11511 Maximum number of instructions to copy when duplicating blocks on a
11512 finite state automaton jump thread path.
11513
11514 @item max-fsm-thread-length
11515 Maximum number of basic blocks on a finite state automaton jump thread
11516 path.
11517
11518 @item max-fsm-thread-paths
11519 Maximum number of new jump thread paths to create for a finite state
11520 automaton.
11521
11522 @item parloops-chunk-size
11523 Chunk size of omp schedule for loops parallelized by parloops.
11524
11525 @item parloops-schedule
11526 Schedule type of omp schedule for loops parallelized by parloops (static,
11527 dynamic, guided, auto, runtime).
11528
11529 @item parloops-min-per-thread
11530 The minimum number of iterations per thread of an innermost parallelized
11531 loop for which the parallelized variant is preferred over the single threaded
11532 one. Note that for a parallelized loop nest the
11533 minimum number of iterations of the outermost loop per thread is two.
11534
11535 @item max-ssa-name-query-depth
11536 Maximum depth of recursion when querying properties of SSA names in things
11537 like fold routines. One level of recursion corresponds to following a
11538 use-def chain.
11539
11540 @item hsa-gen-debug-stores
11541 Enable emission of special debug stores within HSA kernels which are
11542 then read and reported by libgomp plugin. Generation of these stores
11543 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11544 enable it.
11545
11546 @item max-speculative-devirt-maydefs
11547 The maximum number of may-defs we analyze when looking for a must-def
11548 specifying the dynamic type of an object that invokes a virtual call
11549 we may be able to devirtualize speculatively.
11550
11551 @item max-vrp-switch-assertions
11552 The maximum number of assertions to add along the default edge of a switch
11553 statement during VRP.
11554
11555 @item unroll-jam-min-percent
11556 The minimum percentage of memory references that must be optimized
11557 away for the unroll-and-jam transformation to be considered profitable.
11558
11559 @item unroll-jam-max-unroll
11560 The maximum number of times the outer loop should be unrolled by
11561 the unroll-and-jam transformation.
11562
11563 @item max-rtl-if-conversion-unpredictable-cost
11564 Maximum permissible cost for the sequence that would be generated
11565 by the RTL if-conversion pass for a branch that is considered unpredictable.
11566
11567 @item max-variable-expansions-in-unroller
11568 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11569 of times that an individual variable will be expanded during loop unrolling.
11570
11571 @item tracer-min-branch-probability-feedback
11572 Stop forward growth if the probability of best edge is less than
11573 this threshold (in percent). Used when profile feedback is available.
11574
11575 @item partial-inlining-entry-probability
11576 Maximum probability of the entry BB of split region
11577 (in percent relative to entry BB of the function)
11578 to make partial inlining happen.
11579
11580 @item max-tracked-strlens
11581 Maximum number of strings for which strlen optimization pass will
11582 track string lengths.
11583
11584 @item gcse-after-reload-partial-fraction
11585 The threshold ratio for performing partial redundancy
11586 elimination after reload.
11587
11588 @item gcse-after-reload-critical-fraction
11589 The threshold ratio of critical edges execution count that
11590 permit performing redundancy elimination after reload.
11591
11592 @item max-loop-header-insns
11593 The maximum number of insns in loop header duplicated
11594 by the copy loop headers pass.
11595
11596 @item vect-epilogues-nomask
11597 Enable loop epilogue vectorization using smaller vector size.
11598
11599 @item slp-max-insns-in-bb
11600 Maximum number of instructions in basic block to be
11601 considered for SLP vectorization.
11602
11603 @item avoid-fma-max-bits
11604 Maximum number of bits for which we avoid creating FMAs.
11605
11606 @item sms-loop-average-count-threshold
11607 A threshold on the average loop count considered by the swing modulo scheduler.
11608
11609 @item sms-dfa-history
11610 The number of cycles the swing modulo scheduler considers when checking
11611 conflicts using DFA.
11612
11613 @item hot-bb-count-fraction
11614 Select fraction of the maximal count of repetitions of basic block
11615 in program given basic block needs
11616 to have to be considered hot (used in non-LTO mode)
11617
11618 @item max-inline-insns-recursive-auto
11619 The maximum number of instructions non-inline function
11620 can grow to via recursive inlining.
11621
11622 @item graphite-allow-codegen-errors
11623 Whether codegen errors should be ICEs when @option{-fchecking}.
11624
11625 @item sms-max-ii-factor
11626 A factor for tuning the upper bound that swing modulo scheduler
11627 uses for scheduling a loop.
11628
11629 @item lra-max-considered-reload-pseudos
11630 The max number of reload pseudos which are considered during
11631 spilling a non-reload pseudo.
11632
11633 @item max-pow-sqrt-depth
11634 Maximum depth of sqrt chains to use when synthesizing exponentiation
11635 by a real constant.
11636
11637 @item max-dse-active-local-stores
11638 Maximum number of active local stores in RTL dead store elimination.
11639
11640 @item asan-instrument-allocas
11641 Enable asan allocas/VLAs protection.
11642
11643 @item max-iterations-computation-cost
11644 Bound on the cost of an expression to compute the number of iterations.
11645
11646 @item max-isl-operations
11647 Maximum number of isl operations, 0 means unlimited.
11648
11649 @item graphite-max-arrays-per-scop
11650 Maximum number of arrays per scop.
11651
11652 @item max-vartrack-reverse-op-size
11653 Max. size of loc list for which reverse ops should be added.
11654
11655 @item unlikely-bb-count-fraction
11656 The minimum fraction of profile runs a given basic block execution count
11657 must be not to be considered unlikely.
11658
11659 @item tracer-dynamic-coverage-feedback
11660 The percentage of function, weighted by execution frequency,
11661 that must be covered by trace formation.
11662 Used when profile feedback is available.
11663
11664 @item max-inline-recursive-depth-auto
11665 The maximum depth of recursive inlining for non-inline functions.
11666
11667 @item fsm-scale-path-stmts
11668 Scale factor to apply to the number of statements in a threading path
11669 when comparing to the number of (scaled) blocks.
11670
11671 @item fsm-maximum-phi-arguments
11672 Maximum number of arguments a PHI may have before the FSM threader
11673 will not try to thread through its block.
11674
11675 @item uninit-control-dep-attempts
11676 Maximum number of nested calls to search for control dependencies
11677 during uninitialized variable analysis.
11678
11679 @item indir-call-topn-profile
11680 Track top N target addresses in indirect-call profile.
11681
11682 @item max-once-peeled-insns
11683 The maximum number of insns of a peeled loop that rolls only once.
11684
11685 @item sra-max-scalarization-size-Osize
11686 Maximum size, in storage units, of an aggregate
11687 which should be considered for scalarization when compiling for size.
11688
11689 @item fsm-scale-path-blocks
11690 Scale factor to apply to the number of blocks in a threading path
11691 when comparing to the number of (scaled) statements.
11692
11693 @item sched-autopref-queue-depth
11694 Hardware autoprefetcher scheduler model control flag.
11695 Number of lookahead cycles the model looks into; at '
11696 ' only enable instruction sorting heuristic.
11697
11698
11699 @end table
11700 @end table
11701
11702 @node Instrumentation Options
11703 @section Program Instrumentation Options
11704 @cindex instrumentation options
11705 @cindex program instrumentation options
11706 @cindex run-time error checking options
11707 @cindex profiling options
11708 @cindex options, program instrumentation
11709 @cindex options, run-time error checking
11710 @cindex options, profiling
11711
11712 GCC supports a number of command-line options that control adding
11713 run-time instrumentation to the code it normally generates.
11714 For example, one purpose of instrumentation is collect profiling
11715 statistics for use in finding program hot spots, code coverage
11716 analysis, or profile-guided optimizations.
11717 Another class of program instrumentation is adding run-time checking
11718 to detect programming errors like invalid pointer
11719 dereferences or out-of-bounds array accesses, as well as deliberately
11720 hostile attacks such as stack smashing or C++ vtable hijacking.
11721 There is also a general hook which can be used to implement other
11722 forms of tracing or function-level instrumentation for debug or
11723 program analysis purposes.
11724
11725 @table @gcctabopt
11726 @cindex @command{prof}
11727 @item -p
11728 @opindex p
11729 Generate extra code to write profile information suitable for the
11730 analysis program @command{prof}. You must use this option when compiling
11731 the source files you want data about, and you must also use it when
11732 linking.
11733
11734 @cindex @command{gprof}
11735 @item -pg
11736 @opindex pg
11737 Generate extra code to write profile information suitable for the
11738 analysis program @command{gprof}. You must use this option when compiling
11739 the source files you want data about, and you must also use it when
11740 linking.
11741
11742 @item -fprofile-arcs
11743 @opindex fprofile-arcs
11744 Add code so that program flow @dfn{arcs} are instrumented. During
11745 execution the program records how many times each branch and call is
11746 executed and how many times it is taken or returns. On targets that support
11747 constructors with priority support, profiling properly handles constructors,
11748 destructors and C++ constructors (and destructors) of classes which are used
11749 as a type of a global variable.
11750
11751 When the compiled
11752 program exits it saves this data to a file called
11753 @file{@var{auxname}.gcda} for each source file. The data may be used for
11754 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11755 test coverage analysis (@option{-ftest-coverage}). Each object file's
11756 @var{auxname} is generated from the name of the output file, if
11757 explicitly specified and it is not the final executable, otherwise it is
11758 the basename of the source file. In both cases any suffix is removed
11759 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11760 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11761 @xref{Cross-profiling}.
11762
11763 @cindex @command{gcov}
11764 @item --coverage
11765 @opindex coverage
11766
11767 This option is used to compile and link code instrumented for coverage
11768 analysis. The option is a synonym for @option{-fprofile-arcs}
11769 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11770 linking). See the documentation for those options for more details.
11771
11772 @itemize
11773
11774 @item
11775 Compile the source files with @option{-fprofile-arcs} plus optimization
11776 and code generation options. For test coverage analysis, use the
11777 additional @option{-ftest-coverage} option. You do not need to profile
11778 every source file in a program.
11779
11780 @item
11781 Compile the source files additionally with @option{-fprofile-abs-path}
11782 to create absolute path names in the @file{.gcno} files. This allows
11783 @command{gcov} to find the correct sources in projects where compilations
11784 occur with different working directories.
11785
11786 @item
11787 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11788 (the latter implies the former).
11789
11790 @item
11791 Run the program on a representative workload to generate the arc profile
11792 information. This may be repeated any number of times. You can run
11793 concurrent instances of your program, and provided that the file system
11794 supports locking, the data files will be correctly updated. Unless
11795 a strict ISO C dialect option is in effect, @code{fork} calls are
11796 detected and correctly handled without double counting.
11797
11798 @item
11799 For profile-directed optimizations, compile the source files again with
11800 the same optimization and code generation options plus
11801 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11802 Control Optimization}).
11803
11804 @item
11805 For test coverage analysis, use @command{gcov} to produce human readable
11806 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11807 @command{gcov} documentation for further information.
11808
11809 @end itemize
11810
11811 With @option{-fprofile-arcs}, for each function of your program GCC
11812 creates a program flow graph, then finds a spanning tree for the graph.
11813 Only arcs that are not on the spanning tree have to be instrumented: the
11814 compiler adds code to count the number of times that these arcs are
11815 executed. When an arc is the only exit or only entrance to a block, the
11816 instrumentation code can be added to the block; otherwise, a new basic
11817 block must be created to hold the instrumentation code.
11818
11819 @need 2000
11820 @item -ftest-coverage
11821 @opindex ftest-coverage
11822 Produce a notes file that the @command{gcov} code-coverage utility
11823 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11824 show program coverage. Each source file's note file is called
11825 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11826 above for a description of @var{auxname} and instructions on how to
11827 generate test coverage data. Coverage data matches the source files
11828 more closely if you do not optimize.
11829
11830 @item -fprofile-abs-path
11831 @opindex fprofile-abs-path
11832 Automatically convert relative source file names to absolute path names
11833 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11834 sources in projects where compilations occur with different working
11835 directories.
11836
11837 @item -fprofile-dir=@var{path}
11838 @opindex fprofile-dir
11839
11840 Set the directory to search for the profile data files in to @var{path}.
11841 This option affects only the profile data generated by
11842 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11843 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11844 and its related options. Both absolute and relative paths can be used.
11845 By default, GCC uses the current directory as @var{path}, thus the
11846 profile data file appears in the same directory as the object file.
11847 In order to prevent the file name clashing, if the object file name is
11848 not an absolute path, we mangle the absolute path of the
11849 @file{@var{sourcename}.gcda} file and use it as the file name of a
11850 @file{.gcda} file.
11851
11852 When an executable is run in a massive parallel environment, it is recommended
11853 to save profile to different folders. That can be done with variables
11854 in @var{path} that are exported during run-time:
11855
11856 @table @gcctabopt
11857
11858 @item %p
11859 process ID.
11860
11861 @item %q@{VAR@}
11862 value of environment variable @var{VAR}
11863
11864 @end table
11865
11866 @item -fprofile-generate
11867 @itemx -fprofile-generate=@var{path}
11868 @opindex fprofile-generate
11869
11870 Enable options usually used for instrumenting application to produce
11871 profile useful for later recompilation with profile feedback based
11872 optimization. You must use @option{-fprofile-generate} both when
11873 compiling and when linking your program.
11874
11875 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11876
11877 If @var{path} is specified, GCC looks at the @var{path} to find
11878 the profile feedback data files. See @option{-fprofile-dir}.
11879
11880 To optimize the program based on the collected profile information, use
11881 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11882
11883 @item -fprofile-update=@var{method}
11884 @opindex fprofile-update
11885
11886 Alter the update method for an application instrumented for profile
11887 feedback based optimization. The @var{method} argument should be one of
11888 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11889 The first one is useful for single-threaded applications,
11890 while the second one prevents profile corruption by emitting thread-safe code.
11891
11892 @strong{Warning:} When an application does not properly join all threads
11893 (or creates an detached thread), a profile file can be still corrupted.
11894
11895 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11896 when supported by a target, or to @samp{single} otherwise. The GCC driver
11897 automatically selects @samp{prefer-atomic} when @option{-pthread}
11898 is present in the command line.
11899
11900 @item -fprofile-filter-files=@var{regex}
11901 @opindex fprofile-filter-files
11902
11903 Instrument only functions from files where names match
11904 any regular expression (separated by a semi-colon).
11905
11906 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
11907 only @file{main.c} and all C files starting with 'module'.
11908
11909 @item -fprofile-exclude-files=@var{regex}
11910 @opindex fprofile-exclude-files
11911
11912 Instrument only functions from files where names do not match
11913 all the regular expressions (separated by a semi-colon).
11914
11915 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
11916 of all files that are located in @file{/usr/} folder.
11917
11918 @item -fsanitize=address
11919 @opindex fsanitize=address
11920 Enable AddressSanitizer, a fast memory error detector.
11921 Memory access instructions are instrumented to detect
11922 out-of-bounds and use-after-free bugs.
11923 The option enables @option{-fsanitize-address-use-after-scope}.
11924 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11925 more details. The run-time behavior can be influenced using the
11926 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11927 the available options are shown at startup of the instrumented program. See
11928 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11929 for a list of supported options.
11930 The option cannot be combined with @option{-fsanitize=thread}.
11931
11932 @item -fsanitize=kernel-address
11933 @opindex fsanitize=kernel-address
11934 Enable AddressSanitizer for Linux kernel.
11935 See @uref{https://github.com/google/kasan/wiki} for more details.
11936
11937 @item -fsanitize=pointer-compare
11938 @opindex fsanitize=pointer-compare
11939 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11940 The option must be combined with either @option{-fsanitize=kernel-address} or
11941 @option{-fsanitize=address}
11942 The option cannot be combined with @option{-fsanitize=thread}.
11943 Note: By default the check is disabled at run time. To enable it,
11944 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11945 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11946 invalid operation only when both pointers are non-null.
11947
11948 @item -fsanitize=pointer-subtract
11949 @opindex fsanitize=pointer-subtract
11950 Instrument subtraction with pointer operands.
11951 The option must be combined with either @option{-fsanitize=kernel-address} or
11952 @option{-fsanitize=address}
11953 The option cannot be combined with @option{-fsanitize=thread}.
11954 Note: By default the check is disabled at run time. To enable it,
11955 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11956 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11957 invalid operation only when both pointers are non-null.
11958
11959 @item -fsanitize=thread
11960 @opindex fsanitize=thread
11961 Enable ThreadSanitizer, a fast data race detector.
11962 Memory access instructions are instrumented to detect
11963 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11964 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11965 environment variable; see
11966 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11967 supported options.
11968 The option cannot be combined with @option{-fsanitize=address},
11969 @option{-fsanitize=leak}.
11970
11971 Note that sanitized atomic builtins cannot throw exceptions when
11972 operating on invalid memory addresses with non-call exceptions
11973 (@option{-fnon-call-exceptions}).
11974
11975 @item -fsanitize=leak
11976 @opindex fsanitize=leak
11977 Enable LeakSanitizer, a memory leak detector.
11978 This option only matters for linking of executables and
11979 the executable is linked against a library that overrides @code{malloc}
11980 and other allocator functions. See
11981 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11982 details. The run-time behavior can be influenced using the
11983 @env{LSAN_OPTIONS} environment variable.
11984 The option cannot be combined with @option{-fsanitize=thread}.
11985
11986 @item -fsanitize=undefined
11987 @opindex fsanitize=undefined
11988 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11989 Various computations are instrumented to detect undefined behavior
11990 at runtime. Current suboptions are:
11991
11992 @table @gcctabopt
11993
11994 @item -fsanitize=shift
11995 @opindex fsanitize=shift
11996 This option enables checking that the result of a shift operation is
11997 not undefined. Note that what exactly is considered undefined differs
11998 slightly between C and C++, as well as between ISO C90 and C99, etc.
11999 This option has two suboptions, @option{-fsanitize=shift-base} and
12000 @option{-fsanitize=shift-exponent}.
12001
12002 @item -fsanitize=shift-exponent
12003 @opindex fsanitize=shift-exponent
12004 This option enables checking that the second argument of a shift operation
12005 is not negative and is smaller than the precision of the promoted first
12006 argument.
12007
12008 @item -fsanitize=shift-base
12009 @opindex fsanitize=shift-base
12010 If the second argument of a shift operation is within range, check that the
12011 result of a shift operation is not undefined. Note that what exactly is
12012 considered undefined differs slightly between C and C++, as well as between
12013 ISO C90 and C99, etc.
12014
12015 @item -fsanitize=integer-divide-by-zero
12016 @opindex fsanitize=integer-divide-by-zero
12017 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12018
12019 @item -fsanitize=unreachable
12020 @opindex fsanitize=unreachable
12021 With this option, the compiler turns the @code{__builtin_unreachable}
12022 call into a diagnostics message call instead. When reaching the
12023 @code{__builtin_unreachable} call, the behavior is undefined.
12024
12025 @item -fsanitize=vla-bound
12026 @opindex fsanitize=vla-bound
12027 This option instructs the compiler to check that the size of a variable
12028 length array is positive.
12029
12030 @item -fsanitize=null
12031 @opindex fsanitize=null
12032 This option enables pointer checking. Particularly, the application
12033 built with this option turned on will issue an error message when it
12034 tries to dereference a NULL pointer, or if a reference (possibly an
12035 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12036 on an object pointed by a NULL pointer.
12037
12038 @item -fsanitize=return
12039 @opindex fsanitize=return
12040 This option enables return statement checking. Programs
12041 built with this option turned on will issue an error message
12042 when the end of a non-void function is reached without actually
12043 returning a value. This option works in C++ only.
12044
12045 @item -fsanitize=signed-integer-overflow
12046 @opindex fsanitize=signed-integer-overflow
12047 This option enables signed integer overflow checking. We check that
12048 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12049 does not overflow in the signed arithmetics. Note, integer promotion
12050 rules must be taken into account. That is, the following is not an
12051 overflow:
12052 @smallexample
12053 signed char a = SCHAR_MAX;
12054 a++;
12055 @end smallexample
12056
12057 @item -fsanitize=bounds
12058 @opindex fsanitize=bounds
12059 This option enables instrumentation of array bounds. Various out of bounds
12060 accesses are detected. Flexible array members, flexible array member-like
12061 arrays, and initializers of variables with static storage are not instrumented.
12062
12063 @item -fsanitize=bounds-strict
12064 @opindex fsanitize=bounds-strict
12065 This option enables strict instrumentation of array bounds. Most out of bounds
12066 accesses are detected, including flexible array members and flexible array
12067 member-like arrays. Initializers of variables with static storage are not
12068 instrumented.
12069
12070 @item -fsanitize=alignment
12071 @opindex fsanitize=alignment
12072
12073 This option enables checking of alignment of pointers when they are
12074 dereferenced, or when a reference is bound to insufficiently aligned target,
12075 or when a method or constructor is invoked on insufficiently aligned object.
12076
12077 @item -fsanitize=object-size
12078 @opindex fsanitize=object-size
12079 This option enables instrumentation of memory references using the
12080 @code{__builtin_object_size} function. Various out of bounds pointer
12081 accesses are detected.
12082
12083 @item -fsanitize=float-divide-by-zero
12084 @opindex fsanitize=float-divide-by-zero
12085 Detect floating-point division by zero. Unlike other similar options,
12086 @option{-fsanitize=float-divide-by-zero} is not enabled by
12087 @option{-fsanitize=undefined}, since floating-point division by zero can
12088 be a legitimate way of obtaining infinities and NaNs.
12089
12090 @item -fsanitize=float-cast-overflow
12091 @opindex fsanitize=float-cast-overflow
12092 This option enables floating-point type to integer conversion checking.
12093 We check that the result of the conversion does not overflow.
12094 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12095 not enabled by @option{-fsanitize=undefined}.
12096 This option does not work well with @code{FE_INVALID} exceptions enabled.
12097
12098 @item -fsanitize=nonnull-attribute
12099 @opindex fsanitize=nonnull-attribute
12100
12101 This option enables instrumentation of calls, checking whether null values
12102 are not passed to arguments marked as requiring a non-null value by the
12103 @code{nonnull} function attribute.
12104
12105 @item -fsanitize=returns-nonnull-attribute
12106 @opindex fsanitize=returns-nonnull-attribute
12107
12108 This option enables instrumentation of return statements in functions
12109 marked with @code{returns_nonnull} function attribute, to detect returning
12110 of null values from such functions.
12111
12112 @item -fsanitize=bool
12113 @opindex fsanitize=bool
12114
12115 This option enables instrumentation of loads from bool. If a value other
12116 than 0/1 is loaded, a run-time error is issued.
12117
12118 @item -fsanitize=enum
12119 @opindex fsanitize=enum
12120
12121 This option enables instrumentation of loads from an enum type. If
12122 a value outside the range of values for the enum type is loaded,
12123 a run-time error is issued.
12124
12125 @item -fsanitize=vptr
12126 @opindex fsanitize=vptr
12127
12128 This option enables instrumentation of C++ member function calls, member
12129 accesses and some conversions between pointers to base and derived classes,
12130 to verify the referenced object has the correct dynamic type.
12131
12132 @item -fsanitize=pointer-overflow
12133 @opindex fsanitize=pointer-overflow
12134
12135 This option enables instrumentation of pointer arithmetics. If the pointer
12136 arithmetics overflows, a run-time error is issued.
12137
12138 @item -fsanitize=builtin
12139 @opindex fsanitize=builtin
12140
12141 This option enables instrumentation of arguments to selected builtin
12142 functions. If an invalid value is passed to such arguments, a run-time
12143 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12144 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12145 by this option.
12146
12147 @end table
12148
12149 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12150 @option{-fsanitize=undefined} gives a diagnostic message.
12151 This currently works only for the C family of languages.
12152
12153 @item -fno-sanitize=all
12154 @opindex fno-sanitize=all
12155
12156 This option disables all previously enabled sanitizers.
12157 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12158 together.
12159
12160 @item -fasan-shadow-offset=@var{number}
12161 @opindex fasan-shadow-offset
12162 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12163 It is useful for experimenting with different shadow memory layouts in
12164 Kernel AddressSanitizer.
12165
12166 @item -fsanitize-sections=@var{s1},@var{s2},...
12167 @opindex fsanitize-sections
12168 Sanitize global variables in selected user-defined sections. @var{si} may
12169 contain wildcards.
12170
12171 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12172 @opindex fsanitize-recover
12173 @opindex fno-sanitize-recover
12174 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12175 mentioned in comma-separated list of @var{opts}. Enabling this option
12176 for a sanitizer component causes it to attempt to continue
12177 running the program as if no error happened. This means multiple
12178 runtime errors can be reported in a single program run, and the exit
12179 code of the program may indicate success even when errors
12180 have been reported. The @option{-fno-sanitize-recover=} option
12181 can be used to alter
12182 this behavior: only the first detected error is reported
12183 and program then exits with a non-zero exit code.
12184
12185 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12186 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12187 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12188 @option{-fsanitize=bounds-strict},
12189 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12190 For these sanitizers error recovery is turned on by default,
12191 except @option{-fsanitize=address}, for which this feature is experimental.
12192 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12193 accepted, the former enables recovery for all sanitizers that support it,
12194 the latter disables recovery for all sanitizers that support it.
12195
12196 Even if a recovery mode is turned on the compiler side, it needs to be also
12197 enabled on the runtime library side, otherwise the failures are still fatal.
12198 The runtime library defaults to @code{halt_on_error=0} for
12199 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12200 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12201 setting the @code{halt_on_error} flag in the corresponding environment variable.
12202
12203 Syntax without an explicit @var{opts} parameter is deprecated. It is
12204 equivalent to specifying an @var{opts} list of:
12205
12206 @smallexample
12207 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12208 @end smallexample
12209
12210 @item -fsanitize-address-use-after-scope
12211 @opindex fsanitize-address-use-after-scope
12212 Enable sanitization of local variables to detect use-after-scope bugs.
12213 The option sets @option{-fstack-reuse} to @samp{none}.
12214
12215 @item -fsanitize-undefined-trap-on-error
12216 @opindex fsanitize-undefined-trap-on-error
12217 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12218 report undefined behavior using @code{__builtin_trap} rather than
12219 a @code{libubsan} library routine. The advantage of this is that the
12220 @code{libubsan} library is not needed and is not linked in, so this
12221 is usable even in freestanding environments.
12222
12223 @item -fsanitize-coverage=trace-pc
12224 @opindex fsanitize-coverage=trace-pc
12225 Enable coverage-guided fuzzing code instrumentation.
12226 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12227
12228 @item -fsanitize-coverage=trace-cmp
12229 @opindex fsanitize-coverage=trace-cmp
12230 Enable dataflow guided fuzzing code instrumentation.
12231 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12232 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12233 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12234 variable or @code{__sanitizer_cov_trace_const_cmp1},
12235 @code{__sanitizer_cov_trace_const_cmp2},
12236 @code{__sanitizer_cov_trace_const_cmp4} or
12237 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12238 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12239 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12240 @code{__sanitizer_cov_trace_switch} for switch statements.
12241
12242 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12243 @opindex fcf-protection
12244 Enable code instrumentation of control-flow transfers to increase
12245 program security by checking that target addresses of control-flow
12246 transfer instructions (such as indirect function call, function return,
12247 indirect jump) are valid. This prevents diverting the flow of control
12248 to an unexpected target. This is intended to protect against such
12249 threats as Return-oriented Programming (ROP), and similarly
12250 call/jmp-oriented programming (COP/JOP).
12251
12252 The value @code{branch} tells the compiler to implement checking of
12253 validity of control-flow transfer at the point of indirect branch
12254 instructions, i.e.@: call/jmp instructions. The value @code{return}
12255 implements checking of validity at the point of returning from a
12256 function. The value @code{full} is an alias for specifying both
12257 @code{branch} and @code{return}. The value @code{none} turns off
12258 instrumentation.
12259
12260 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12261 used. The first bit of @code{__CET__} is set to 1 for the value
12262 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12263 the @code{return}.
12264
12265 You can also use the @code{nocf_check} attribute to identify
12266 which functions and calls should be skipped from instrumentation
12267 (@pxref{Function Attributes}).
12268
12269 Currently the x86 GNU/Linux target provides an implementation based
12270 on Intel Control-flow Enforcement Technology (CET).
12271
12272 @item -fstack-protector
12273 @opindex fstack-protector
12274 Emit extra code to check for buffer overflows, such as stack smashing
12275 attacks. This is done by adding a guard variable to functions with
12276 vulnerable objects. This includes functions that call @code{alloca}, and
12277 functions with buffers larger than 8 bytes. The guards are initialized
12278 when a function is entered and then checked when the function exits.
12279 If a guard check fails, an error message is printed and the program exits.
12280
12281 @item -fstack-protector-all
12282 @opindex fstack-protector-all
12283 Like @option{-fstack-protector} except that all functions are protected.
12284
12285 @item -fstack-protector-strong
12286 @opindex fstack-protector-strong
12287 Like @option{-fstack-protector} but includes additional functions to
12288 be protected --- those that have local array definitions, or have
12289 references to local frame addresses.
12290
12291 @item -fstack-protector-explicit
12292 @opindex fstack-protector-explicit
12293 Like @option{-fstack-protector} but only protects those functions which
12294 have the @code{stack_protect} attribute.
12295
12296 @item -fstack-check
12297 @opindex fstack-check
12298 Generate code to verify that you do not go beyond the boundary of the
12299 stack. You should specify this flag if you are running in an
12300 environment with multiple threads, but you only rarely need to specify it in
12301 a single-threaded environment since stack overflow is automatically
12302 detected on nearly all systems if there is only one stack.
12303
12304 Note that this switch does not actually cause checking to be done; the
12305 operating system or the language runtime must do that. The switch causes
12306 generation of code to ensure that they see the stack being extended.
12307
12308 You can additionally specify a string parameter: @samp{no} means no
12309 checking, @samp{generic} means force the use of old-style checking,
12310 @samp{specific} means use the best checking method and is equivalent
12311 to bare @option{-fstack-check}.
12312
12313 Old-style checking is a generic mechanism that requires no specific
12314 target support in the compiler but comes with the following drawbacks:
12315
12316 @enumerate
12317 @item
12318 Modified allocation strategy for large objects: they are always
12319 allocated dynamically if their size exceeds a fixed threshold. Note this
12320 may change the semantics of some code.
12321
12322 @item
12323 Fixed limit on the size of the static frame of functions: when it is
12324 topped by a particular function, stack checking is not reliable and
12325 a warning is issued by the compiler.
12326
12327 @item
12328 Inefficiency: because of both the modified allocation strategy and the
12329 generic implementation, code performance is hampered.
12330 @end enumerate
12331
12332 Note that old-style stack checking is also the fallback method for
12333 @samp{specific} if no target support has been added in the compiler.
12334
12335 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12336 and stack overflows. @samp{specific} is an excellent choice when compiling
12337 Ada code. It is not generally sufficient to protect against stack-clash
12338 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12339
12340 @item -fstack-clash-protection
12341 @opindex fstack-clash-protection
12342 Generate code to prevent stack clash style attacks. When this option is
12343 enabled, the compiler will only allocate one page of stack space at a time
12344 and each page is accessed immediately after allocation. Thus, it prevents
12345 allocations from jumping over any stack guard page provided by the
12346 operating system.
12347
12348 Most targets do not fully support stack clash protection. However, on
12349 those targets @option{-fstack-clash-protection} will protect dynamic stack
12350 allocations. @option{-fstack-clash-protection} may also provide limited
12351 protection for static stack allocations if the target supports
12352 @option{-fstack-check=specific}.
12353
12354 @item -fstack-limit-register=@var{reg}
12355 @itemx -fstack-limit-symbol=@var{sym}
12356 @itemx -fno-stack-limit
12357 @opindex fstack-limit-register
12358 @opindex fstack-limit-symbol
12359 @opindex fno-stack-limit
12360 Generate code to ensure that the stack does not grow beyond a certain value,
12361 either the value of a register or the address of a symbol. If a larger
12362 stack is required, a signal is raised at run time. For most targets,
12363 the signal is raised before the stack overruns the boundary, so
12364 it is possible to catch the signal without taking special precautions.
12365
12366 For instance, if the stack starts at absolute address @samp{0x80000000}
12367 and grows downwards, you can use the flags
12368 @option{-fstack-limit-symbol=__stack_limit} and
12369 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12370 of 128KB@. Note that this may only work with the GNU linker.
12371
12372 You can locally override stack limit checking by using the
12373 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12374
12375 @item -fsplit-stack
12376 @opindex fsplit-stack
12377 Generate code to automatically split the stack before it overflows.
12378 The resulting program has a discontiguous stack which can only
12379 overflow if the program is unable to allocate any more memory. This
12380 is most useful when running threaded programs, as it is no longer
12381 necessary to calculate a good stack size to use for each thread. This
12382 is currently only implemented for the x86 targets running
12383 GNU/Linux.
12384
12385 When code compiled with @option{-fsplit-stack} calls code compiled
12386 without @option{-fsplit-stack}, there may not be much stack space
12387 available for the latter code to run. If compiling all code,
12388 including library code, with @option{-fsplit-stack} is not an option,
12389 then the linker can fix up these calls so that the code compiled
12390 without @option{-fsplit-stack} always has a large stack. Support for
12391 this is implemented in the gold linker in GNU binutils release 2.21
12392 and later.
12393
12394 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12395 @opindex fvtable-verify
12396 This option is only available when compiling C++ code.
12397 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12398 feature that verifies at run time, for every virtual call, that
12399 the vtable pointer through which the call is made is valid for the type of
12400 the object, and has not been corrupted or overwritten. If an invalid vtable
12401 pointer is detected at run time, an error is reported and execution of the
12402 program is immediately halted.
12403
12404 This option causes run-time data structures to be built at program startup,
12405 which are used for verifying the vtable pointers.
12406 The options @samp{std} and @samp{preinit}
12407 control the timing of when these data structures are built. In both cases the
12408 data structures are built before execution reaches @code{main}. Using
12409 @option{-fvtable-verify=std} causes the data structures to be built after
12410 shared libraries have been loaded and initialized.
12411 @option{-fvtable-verify=preinit} causes them to be built before shared
12412 libraries have been loaded and initialized.
12413
12414 If this option appears multiple times in the command line with different
12415 values specified, @samp{none} takes highest priority over both @samp{std} and
12416 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12417
12418 @item -fvtv-debug
12419 @opindex fvtv-debug
12420 When used in conjunction with @option{-fvtable-verify=std} or
12421 @option{-fvtable-verify=preinit}, causes debug versions of the
12422 runtime functions for the vtable verification feature to be called.
12423 This flag also causes the compiler to log information about which
12424 vtable pointers it finds for each class.
12425 This information is written to a file named @file{vtv_set_ptr_data.log}
12426 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12427 if that is defined or the current working directory otherwise.
12428
12429 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12430 file, be sure to delete any existing one.
12431
12432 @item -fvtv-counts
12433 @opindex fvtv-counts
12434 This is a debugging flag. When used in conjunction with
12435 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12436 causes the compiler to keep track of the total number of virtual calls
12437 it encounters and the number of verifications it inserts. It also
12438 counts the number of calls to certain run-time library functions
12439 that it inserts and logs this information for each compilation unit.
12440 The compiler writes this information to a file named
12441 @file{vtv_count_data.log} in the directory named by the environment
12442 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12443 directory otherwise. It also counts the size of the vtable pointer sets
12444 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12445 in the same directory.
12446
12447 Note: This feature @emph{appends} data to the log files. To get fresh log
12448 files, be sure to delete any existing ones.
12449
12450 @item -finstrument-functions
12451 @opindex finstrument-functions
12452 Generate instrumentation calls for entry and exit to functions. Just
12453 after function entry and just before function exit, the following
12454 profiling functions are called with the address of the current
12455 function and its call site. (On some platforms,
12456 @code{__builtin_return_address} does not work beyond the current
12457 function, so the call site information may not be available to the
12458 profiling functions otherwise.)
12459
12460 @smallexample
12461 void __cyg_profile_func_enter (void *this_fn,
12462 void *call_site);
12463 void __cyg_profile_func_exit (void *this_fn,
12464 void *call_site);
12465 @end smallexample
12466
12467 The first argument is the address of the start of the current function,
12468 which may be looked up exactly in the symbol table.
12469
12470 This instrumentation is also done for functions expanded inline in other
12471 functions. The profiling calls indicate where, conceptually, the
12472 inline function is entered and exited. This means that addressable
12473 versions of such functions must be available. If all your uses of a
12474 function are expanded inline, this may mean an additional expansion of
12475 code size. If you use @code{extern inline} in your C code, an
12476 addressable version of such functions must be provided. (This is
12477 normally the case anyway, but if you get lucky and the optimizer always
12478 expands the functions inline, you might have gotten away without
12479 providing static copies.)
12480
12481 A function may be given the attribute @code{no_instrument_function}, in
12482 which case this instrumentation is not done. This can be used, for
12483 example, for the profiling functions listed above, high-priority
12484 interrupt routines, and any functions from which the profiling functions
12485 cannot safely be called (perhaps signal handlers, if the profiling
12486 routines generate output or allocate memory).
12487
12488 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12489 @opindex finstrument-functions-exclude-file-list
12490
12491 Set the list of functions that are excluded from instrumentation (see
12492 the description of @option{-finstrument-functions}). If the file that
12493 contains a function definition matches with one of @var{file}, then
12494 that function is not instrumented. The match is done on substrings:
12495 if the @var{file} parameter is a substring of the file name, it is
12496 considered to be a match.
12497
12498 For example:
12499
12500 @smallexample
12501 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12502 @end smallexample
12503
12504 @noindent
12505 excludes any inline function defined in files whose pathnames
12506 contain @file{/bits/stl} or @file{include/sys}.
12507
12508 If, for some reason, you want to include letter @samp{,} in one of
12509 @var{sym}, write @samp{\,}. For example,
12510 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12511 (note the single quote surrounding the option).
12512
12513 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12514 @opindex finstrument-functions-exclude-function-list
12515
12516 This is similar to @option{-finstrument-functions-exclude-file-list},
12517 but this option sets the list of function names to be excluded from
12518 instrumentation. The function name to be matched is its user-visible
12519 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12520 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12521 match is done on substrings: if the @var{sym} parameter is a substring
12522 of the function name, it is considered to be a match. For C99 and C++
12523 extended identifiers, the function name must be given in UTF-8, not
12524 using universal character names.
12525
12526 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12527 @opindex fpatchable-function-entry
12528 Generate @var{N} NOPs right at the beginning
12529 of each function, with the function entry point before the @var{M}th NOP.
12530 If @var{M} is omitted, it defaults to @code{0} so the
12531 function entry points to the address just at the first NOP.
12532 The NOP instructions reserve extra space which can be used to patch in
12533 any desired instrumentation at run time, provided that the code segment
12534 is writable. The amount of space is controllable indirectly via
12535 the number of NOPs; the NOP instruction used corresponds to the instruction
12536 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12537 is target-specific and may also depend on the architecture variant and/or
12538 other compilation options.
12539
12540 For run-time identification, the starting addresses of these areas,
12541 which correspond to their respective function entries minus @var{M},
12542 are additionally collected in the @code{__patchable_function_entries}
12543 section of the resulting binary.
12544
12545 Note that the value of @code{__attribute__ ((patchable_function_entry
12546 (N,M)))} takes precedence over command-line option
12547 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12548 the area size or to remove it completely on a single function.
12549 If @code{N=0}, no pad location is recorded.
12550
12551 The NOP instructions are inserted at---and maybe before, depending on
12552 @var{M}---the function entry address, even before the prologue.
12553
12554 @end table
12555
12556
12557 @node Preprocessor Options
12558 @section Options Controlling the Preprocessor
12559 @cindex preprocessor options
12560 @cindex options, preprocessor
12561
12562 These options control the C preprocessor, which is run on each C source
12563 file before actual compilation.
12564
12565 If you use the @option{-E} option, nothing is done except preprocessing.
12566 Some of these options make sense only together with @option{-E} because
12567 they cause the preprocessor output to be unsuitable for actual
12568 compilation.
12569
12570 In addition to the options listed here, there are a number of options
12571 to control search paths for include files documented in
12572 @ref{Directory Options}.
12573 Options to control preprocessor diagnostics are listed in
12574 @ref{Warning Options}.
12575
12576 @table @gcctabopt
12577 @include cppopts.texi
12578
12579 @item -Wp,@var{option}
12580 @opindex Wp
12581 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12582 and pass @var{option} directly through to the preprocessor. If
12583 @var{option} contains commas, it is split into multiple options at the
12584 commas. However, many options are modified, translated or interpreted
12585 by the compiler driver before being passed to the preprocessor, and
12586 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12587 interface is undocumented and subject to change, so whenever possible
12588 you should avoid using @option{-Wp} and let the driver handle the
12589 options instead.
12590
12591 @item -Xpreprocessor @var{option}
12592 @opindex Xpreprocessor
12593 Pass @var{option} as an option to the preprocessor. You can use this to
12594 supply system-specific preprocessor options that GCC does not
12595 recognize.
12596
12597 If you want to pass an option that takes an argument, you must use
12598 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12599
12600 @item -no-integrated-cpp
12601 @opindex no-integrated-cpp
12602 Perform preprocessing as a separate pass before compilation.
12603 By default, GCC performs preprocessing as an integrated part of
12604 input tokenization and parsing.
12605 If this option is provided, the appropriate language front end
12606 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12607 and Objective-C, respectively) is instead invoked twice,
12608 once for preprocessing only and once for actual compilation
12609 of the preprocessed input.
12610 This option may be useful in conjunction with the @option{-B} or
12611 @option{-wrapper} options to specify an alternate preprocessor or
12612 perform additional processing of the program source between
12613 normal preprocessing and compilation.
12614
12615 @end table
12616
12617 @node Assembler Options
12618 @section Passing Options to the Assembler
12619
12620 @c prevent bad page break with this line
12621 You can pass options to the assembler.
12622
12623 @table @gcctabopt
12624 @item -Wa,@var{option}
12625 @opindex Wa
12626 Pass @var{option} as an option to the assembler. If @var{option}
12627 contains commas, it is split into multiple options at the commas.
12628
12629 @item -Xassembler @var{option}
12630 @opindex Xassembler
12631 Pass @var{option} as an option to the assembler. You can use this to
12632 supply system-specific assembler options that GCC does not
12633 recognize.
12634
12635 If you want to pass an option that takes an argument, you must use
12636 @option{-Xassembler} twice, once for the option and once for the argument.
12637
12638 @end table
12639
12640 @node Link Options
12641 @section Options for Linking
12642 @cindex link options
12643 @cindex options, linking
12644
12645 These options come into play when the compiler links object files into
12646 an executable output file. They are meaningless if the compiler is
12647 not doing a link step.
12648
12649 @table @gcctabopt
12650 @cindex file names
12651 @item @var{object-file-name}
12652 A file name that does not end in a special recognized suffix is
12653 considered to name an object file or library. (Object files are
12654 distinguished from libraries by the linker according to the file
12655 contents.) If linking is done, these object files are used as input
12656 to the linker.
12657
12658 @item -c
12659 @itemx -S
12660 @itemx -E
12661 @opindex c
12662 @opindex S
12663 @opindex E
12664 If any of these options is used, then the linker is not run, and
12665 object file names should not be used as arguments. @xref{Overall
12666 Options}.
12667
12668 @item -flinker-output=@var{type}
12669 @opindex flinker-output
12670 This option controls the code generation of the link time optimizer. By
12671 default the linker output is determined by the linker plugin automatically. For
12672 debugging the compiler and in the case of incremental linking to non-lto object
12673 file is desired, it may be useful to control the type manually.
12674
12675 If @var{type} is @samp{exec} the code generation is configured to produce static
12676 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12677
12678 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12679 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12680 enabled automatically. This makes it possible to build shared libraries without
12681 position independent code on architectures this is possible, i.e.@: on x86.
12682
12683 If @var{type} is @samp{pie} the code generation is configured to produce
12684 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12685 except that @option{-fpie} is not disabled if specified at compilation time.
12686
12687 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12688 done. The sections containing intermediate code for link-time optimization are
12689 merged, pre-optimized, and output to the resulting object file. In addition, if
12690 @option{-ffat-lto-objects} is specified the binary code is produced for future
12691 non-lto linking. The object file produced by incremental linking will be smaller
12692 than a static library produced from the same object files. At link-time the
12693 result of incremental linking will also load faster to compiler than a static
12694 library assuming that majority of objects in the library are used.
12695
12696 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12697 code generation is forced, final binary is produced and the intermediate code
12698 for later link-time optimization is stripped. When multiple object files are
12699 linked together the resulting code will be optimized better than with link time
12700 optimizations disabled (for example, the cross-module inlining will happen),
12701 most of benefits of whole program optimizations are however lost.
12702
12703 During the incremental link (by @option{-r}) the linker plugin will default to
12704 @option{rel}. With current interfaces to GNU Binutils it is however not
12705 possible to link incrementally LTO objects and non-LTO objects into a single
12706 mixed object file. In the case any of object files in incremental link can not
12707 be used for link-time optimization the linker plugin will output warning and
12708 use @samp{nolto-rel}. To maintain the whole program optimization it is
12709 recommended to link such objects into static library instead. Alternatively it
12710 is possible to use H.J. Lu's binutils with support for mixed objects.
12711
12712 @item -fuse-ld=bfd
12713 @opindex fuse-ld=bfd
12714 Use the @command{bfd} linker instead of the default linker.
12715
12716 @item -fuse-ld=gold
12717 @opindex fuse-ld=gold
12718 Use the @command{gold} linker instead of the default linker.
12719
12720 @item -fuse-ld=lld
12721 @opindex fuse-ld=lld
12722 Use the LLVM @command{lld} linker instead of the default linker.
12723
12724 @cindex Libraries
12725 @item -l@var{library}
12726 @itemx -l @var{library}
12727 @opindex l
12728 Search the library named @var{library} when linking. (The second
12729 alternative with the library as a separate argument is only for
12730 POSIX compliance and is not recommended.)
12731
12732 It makes a difference where in the command you write this option; the
12733 linker searches and processes libraries and object files in the order they
12734 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12735 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12736 to functions in @samp{z}, those functions may not be loaded.
12737
12738 The linker searches a standard list of directories for the library,
12739 which is actually a file named @file{lib@var{library}.a}. The linker
12740 then uses this file as if it had been specified precisely by name.
12741
12742 The directories searched include several standard system directories
12743 plus any that you specify with @option{-L}.
12744
12745 Normally the files found this way are library files---archive files
12746 whose members are object files. The linker handles an archive file by
12747 scanning through it for members which define symbols that have so far
12748 been referenced but not defined. But if the file that is found is an
12749 ordinary object file, it is linked in the usual fashion. The only
12750 difference between using an @option{-l} option and specifying a file name
12751 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12752 and searches several directories.
12753
12754 @item -lobjc
12755 @opindex lobjc
12756 You need this special case of the @option{-l} option in order to
12757 link an Objective-C or Objective-C++ program.
12758
12759 @item -nostartfiles
12760 @opindex nostartfiles
12761 Do not use the standard system startup files when linking.
12762 The standard system libraries are used normally, unless @option{-nostdlib},
12763 @option{-nolibc}, or @option{-nodefaultlibs} is used.
12764
12765 @item -nodefaultlibs
12766 @opindex nodefaultlibs
12767 Do not use the standard system libraries when linking.
12768 Only the libraries you specify are passed to the linker, and options
12769 specifying linkage of the system libraries, such as @option{-static-libgcc}
12770 or @option{-shared-libgcc}, are ignored.
12771 The standard startup files are used normally, unless @option{-nostartfiles}
12772 is used.
12773
12774 The compiler may generate calls to @code{memcmp},
12775 @code{memset}, @code{memcpy} and @code{memmove}.
12776 These entries are usually resolved by entries in
12777 libc. These entry points should be supplied through some other
12778 mechanism when this option is specified.
12779
12780 @item -nolibc
12781 @opindex nolibc
12782 Do not use the C library or system libraries tightly coupled with it when
12783 linking. Still link with the startup files, @file{libgcc} or toolchain
12784 provided language support libraries such as @file{libgnat}, @file{libgfortran}
12785 or @file{libstdc++} unless options preventing their inclusion are used as
12786 well. This typically removes @option{-lc} from the link command line, as well
12787 as system libraries that normally go with it and become meaningless when
12788 absence of a C library is assumed, for example @option{-lpthread} or
12789 @option{-lm} in some configurations. This is intended for bare-board
12790 targets when there is indeed no C library available.
12791
12792 @item -nostdlib
12793 @opindex nostdlib
12794 Do not use the standard system startup files or libraries when linking.
12795 No startup files and only the libraries you specify are passed to
12796 the linker, and options specifying linkage of the system libraries, such as
12797 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12798
12799 The compiler may generate calls to @code{memcmp}, @code{memset},
12800 @code{memcpy} and @code{memmove}.
12801 These entries are usually resolved by entries in
12802 libc. These entry points should be supplied through some other
12803 mechanism when this option is specified.
12804
12805 @cindex @option{-lgcc}, use with @option{-nostdlib}
12806 @cindex @option{-nostdlib} and unresolved references
12807 @cindex unresolved references and @option{-nostdlib}
12808 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12809 @cindex @option{-nodefaultlibs} and unresolved references
12810 @cindex unresolved references and @option{-nodefaultlibs}
12811 One of the standard libraries bypassed by @option{-nostdlib} and
12812 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12813 which GCC uses to overcome shortcomings of particular machines, or special
12814 needs for some languages.
12815 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12816 Collection (GCC) Internals},
12817 for more discussion of @file{libgcc.a}.)
12818 In most cases, you need @file{libgcc.a} even when you want to avoid
12819 other standard libraries. In other words, when you specify @option{-nostdlib}
12820 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12821 This ensures that you have no unresolved references to internal GCC
12822 library subroutines.
12823 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12824 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12825 GNU Compiler Collection (GCC) Internals}.)
12826
12827 @item -e @var{entry}
12828 @itemx --entry=@var{entry}
12829 @opindex e
12830 @opindex entry
12831
12832 Specify that the program entry point is @var{entry}. The argument is
12833 interpreted by the linker; the GNU linker accepts either a symbol name
12834 or an address.
12835
12836 @item -pie
12837 @opindex pie
12838 Produce a dynamically linked position independent executable on targets
12839 that support it. For predictable results, you must also specify the same
12840 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12841 or model suboptions) when you specify this linker option.
12842
12843 @item -no-pie
12844 @opindex no-pie
12845 Don't produce a dynamically linked position independent executable.
12846
12847 @item -static-pie
12848 @opindex static-pie
12849 Produce a static position independent executable on targets that support
12850 it. A static position independent executable is similar to a static
12851 executable, but can be loaded at any address without a dynamic linker.
12852 For predictable results, you must also specify the same set of options
12853 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12854 suboptions) when you specify this linker option.
12855
12856 @item -pthread
12857 @opindex pthread
12858 Link with the POSIX threads library. This option is supported on
12859 GNU/Linux targets, most other Unix derivatives, and also on
12860 x86 Cygwin and MinGW targets. On some targets this option also sets
12861 flags for the preprocessor, so it should be used consistently for both
12862 compilation and linking.
12863
12864 @item -r
12865 @opindex r
12866 Produce a relocatable object as output. This is also known as partial
12867 linking.
12868
12869 @item -rdynamic
12870 @opindex rdynamic
12871 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12872 that support it. This instructs the linker to add all symbols, not
12873 only used ones, to the dynamic symbol table. This option is needed
12874 for some uses of @code{dlopen} or to allow obtaining backtraces
12875 from within a program.
12876
12877 @item -s
12878 @opindex s
12879 Remove all symbol table and relocation information from the executable.
12880
12881 @item -static
12882 @opindex static
12883 On systems that support dynamic linking, this overrides @option{-pie}
12884 and prevents linking with the shared libraries. On other systems, this
12885 option has no effect.
12886
12887 @item -shared
12888 @opindex shared
12889 Produce a shared object which can then be linked with other objects to
12890 form an executable. Not all systems support this option. For predictable
12891 results, you must also specify the same set of options used for compilation
12892 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12893 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12894 needs to build supplementary stub code for constructors to work. On
12895 multi-libbed systems, @samp{gcc -shared} must select the correct support
12896 libraries to link against. Failing to supply the correct flags may lead
12897 to subtle defects. Supplying them in cases where they are not necessary
12898 is innocuous.}
12899
12900 @item -shared-libgcc
12901 @itemx -static-libgcc
12902 @opindex shared-libgcc
12903 @opindex static-libgcc
12904 On systems that provide @file{libgcc} as a shared library, these options
12905 force the use of either the shared or static version, respectively.
12906 If no shared version of @file{libgcc} was built when the compiler was
12907 configured, these options have no effect.
12908
12909 There are several situations in which an application should use the
12910 shared @file{libgcc} instead of the static version. The most common
12911 of these is when the application wishes to throw and catch exceptions
12912 across different shared libraries. In that case, each of the libraries
12913 as well as the application itself should use the shared @file{libgcc}.
12914
12915 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
12916 whenever you build a shared library or a main executable, because C++
12917 programs typically use exceptions, so this is the right thing to do.
12918
12919 If, instead, you use the GCC driver to create shared libraries, you may
12920 find that they are not always linked with the shared @file{libgcc}.
12921 If GCC finds, at its configuration time, that you have a non-GNU linker
12922 or a GNU linker that does not support option @option{--eh-frame-hdr},
12923 it links the shared version of @file{libgcc} into shared libraries
12924 by default. Otherwise, it takes advantage of the linker and optimizes
12925 away the linking with the shared version of @file{libgcc}, linking with
12926 the static version of libgcc by default. This allows exceptions to
12927 propagate through such shared libraries, without incurring relocation
12928 costs at library load time.
12929
12930 However, if a library or main executable is supposed to throw or catch
12931 exceptions, you must link it using the G++ driver, or using the option
12932 @option{-shared-libgcc}, such that it is linked with the shared
12933 @file{libgcc}.
12934
12935 @item -static-libasan
12936 @opindex static-libasan
12937 When the @option{-fsanitize=address} option is used to link a program,
12938 the GCC driver automatically links against @option{libasan}. If
12939 @file{libasan} is available as a shared library, and the @option{-static}
12940 option is not used, then this links against the shared version of
12941 @file{libasan}. The @option{-static-libasan} option directs the GCC
12942 driver to link @file{libasan} statically, without necessarily linking
12943 other libraries statically.
12944
12945 @item -static-libtsan
12946 @opindex static-libtsan
12947 When the @option{-fsanitize=thread} option is used to link a program,
12948 the GCC driver automatically links against @option{libtsan}. If
12949 @file{libtsan} is available as a shared library, and the @option{-static}
12950 option is not used, then this links against the shared version of
12951 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12952 driver to link @file{libtsan} statically, without necessarily linking
12953 other libraries statically.
12954
12955 @item -static-liblsan
12956 @opindex static-liblsan
12957 When the @option{-fsanitize=leak} option is used to link a program,
12958 the GCC driver automatically links against @option{liblsan}. If
12959 @file{liblsan} is available as a shared library, and the @option{-static}
12960 option is not used, then this links against the shared version of
12961 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12962 driver to link @file{liblsan} statically, without necessarily linking
12963 other libraries statically.
12964
12965 @item -static-libubsan
12966 @opindex static-libubsan
12967 When the @option{-fsanitize=undefined} option is used to link a program,
12968 the GCC driver automatically links against @option{libubsan}. If
12969 @file{libubsan} is available as a shared library, and the @option{-static}
12970 option is not used, then this links against the shared version of
12971 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12972 driver to link @file{libubsan} statically, without necessarily linking
12973 other libraries statically.
12974
12975 @item -static-libstdc++
12976 @opindex static-libstdc++
12977 When the @command{g++} program is used to link a C++ program, it
12978 normally automatically links against @option{libstdc++}. If
12979 @file{libstdc++} is available as a shared library, and the
12980 @option{-static} option is not used, then this links against the
12981 shared version of @file{libstdc++}. That is normally fine. However, it
12982 is sometimes useful to freeze the version of @file{libstdc++} used by
12983 the program without going all the way to a fully static link. The
12984 @option{-static-libstdc++} option directs the @command{g++} driver to
12985 link @file{libstdc++} statically, without necessarily linking other
12986 libraries statically.
12987
12988 @item -symbolic
12989 @opindex symbolic
12990 Bind references to global symbols when building a shared object. Warn
12991 about any unresolved references (unless overridden by the link editor
12992 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12993 this option.
12994
12995 @item -T @var{script}
12996 @opindex T
12997 @cindex linker script
12998 Use @var{script} as the linker script. This option is supported by most
12999 systems using the GNU linker. On some targets, such as bare-board
13000 targets without an operating system, the @option{-T} option may be required
13001 when linking to avoid references to undefined symbols.
13002
13003 @item -Xlinker @var{option}
13004 @opindex Xlinker
13005 Pass @var{option} as an option to the linker. You can use this to
13006 supply system-specific linker options that GCC does not recognize.
13007
13008 If you want to pass an option that takes a separate argument, you must use
13009 @option{-Xlinker} twice, once for the option and once for the argument.
13010 For example, to pass @option{-assert definitions}, you must write
13011 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13012 @option{-Xlinker "-assert definitions"}, because this passes the entire
13013 string as a single argument, which is not what the linker expects.
13014
13015 When using the GNU linker, it is usually more convenient to pass
13016 arguments to linker options using the @option{@var{option}=@var{value}}
13017 syntax than as separate arguments. For example, you can specify
13018 @option{-Xlinker -Map=output.map} rather than
13019 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13020 this syntax for command-line options.
13021
13022 @item -Wl,@var{option}
13023 @opindex Wl
13024 Pass @var{option} as an option to the linker. If @var{option} contains
13025 commas, it is split into multiple options at the commas. You can use this
13026 syntax to pass an argument to the option.
13027 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13028 linker. When using the GNU linker, you can also get the same effect with
13029 @option{-Wl,-Map=output.map}.
13030
13031 @item -u @var{symbol}
13032 @opindex u
13033 Pretend the symbol @var{symbol} is undefined, to force linking of
13034 library modules to define it. You can use @option{-u} multiple times with
13035 different symbols to force loading of additional library modules.
13036
13037 @item -z @var{keyword}
13038 @opindex z
13039 @option{-z} is passed directly on to the linker along with the keyword
13040 @var{keyword}. See the section in the documentation of your linker for
13041 permitted values and their meanings.
13042 @end table
13043
13044 @node Directory Options
13045 @section Options for Directory Search
13046 @cindex directory options
13047 @cindex options, directory search
13048 @cindex search path
13049
13050 These options specify directories to search for header files, for
13051 libraries and for parts of the compiler:
13052
13053 @table @gcctabopt
13054 @include cppdiropts.texi
13055
13056 @item -iplugindir=@var{dir}
13057 @opindex iplugindir=
13058 Set the directory to search for plugins that are passed
13059 by @option{-fplugin=@var{name}} instead of
13060 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13061 to be used by the user, but only passed by the driver.
13062
13063 @item -L@var{dir}
13064 @opindex L
13065 Add directory @var{dir} to the list of directories to be searched
13066 for @option{-l}.
13067
13068 @item -B@var{prefix}
13069 @opindex B
13070 This option specifies where to find the executables, libraries,
13071 include files, and data files of the compiler itself.
13072
13073 The compiler driver program runs one or more of the subprograms
13074 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13075 @var{prefix} as a prefix for each program it tries to run, both with and
13076 without @samp{@var{machine}/@var{version}/} for the corresponding target
13077 machine and compiler version.
13078
13079 For each subprogram to be run, the compiler driver first tries the
13080 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13081 is not specified, the driver tries two standard prefixes,
13082 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13083 those results in a file name that is found, the unmodified program
13084 name is searched for using the directories specified in your
13085 @env{PATH} environment variable.
13086
13087 The compiler checks to see if the path provided by @option{-B}
13088 refers to a directory, and if necessary it adds a directory
13089 separator character at the end of the path.
13090
13091 @option{-B} prefixes that effectively specify directory names also apply
13092 to libraries in the linker, because the compiler translates these
13093 options into @option{-L} options for the linker. They also apply to
13094 include files in the preprocessor, because the compiler translates these
13095 options into @option{-isystem} options for the preprocessor. In this case,
13096 the compiler appends @samp{include} to the prefix.
13097
13098 The runtime support file @file{libgcc.a} can also be searched for using
13099 the @option{-B} prefix, if needed. If it is not found there, the two
13100 standard prefixes above are tried, and that is all. The file is left
13101 out of the link if it is not found by those means.
13102
13103 Another way to specify a prefix much like the @option{-B} prefix is to use
13104 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13105 Variables}.
13106
13107 As a special kludge, if the path provided by @option{-B} is
13108 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13109 9, then it is replaced by @file{[dir/]include}. This is to help
13110 with boot-strapping the compiler.
13111
13112 @item -no-canonical-prefixes
13113 @opindex no-canonical-prefixes
13114 Do not expand any symbolic links, resolve references to @samp{/../}
13115 or @samp{/./}, or make the path absolute when generating a relative
13116 prefix.
13117
13118 @item --sysroot=@var{dir}
13119 @opindex sysroot
13120 Use @var{dir} as the logical root directory for headers and libraries.
13121 For example, if the compiler normally searches for headers in
13122 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13123 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13124
13125 If you use both this option and the @option{-isysroot} option, then
13126 the @option{--sysroot} option applies to libraries, but the
13127 @option{-isysroot} option applies to header files.
13128
13129 The GNU linker (beginning with version 2.16) has the necessary support
13130 for this option. If your linker does not support this option, the
13131 header file aspect of @option{--sysroot} still works, but the
13132 library aspect does not.
13133
13134 @item --no-sysroot-suffix
13135 @opindex no-sysroot-suffix
13136 For some targets, a suffix is added to the root directory specified
13137 with @option{--sysroot}, depending on the other options used, so that
13138 headers may for example be found in
13139 @file{@var{dir}/@var{suffix}/usr/include} instead of
13140 @file{@var{dir}/usr/include}. This option disables the addition of
13141 such a suffix.
13142
13143 @end table
13144
13145 @node Code Gen Options
13146 @section Options for Code Generation Conventions
13147 @cindex code generation conventions
13148 @cindex options, code generation
13149 @cindex run-time options
13150
13151 These machine-independent options control the interface conventions
13152 used in code generation.
13153
13154 Most of them have both positive and negative forms; the negative form
13155 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13156 one of the forms is listed---the one that is not the default. You
13157 can figure out the other form by either removing @samp{no-} or adding
13158 it.
13159
13160 @table @gcctabopt
13161 @item -fstack-reuse=@var{reuse-level}
13162 @opindex fstack_reuse
13163 This option controls stack space reuse for user declared local/auto variables
13164 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13165 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13166 local variables and temporaries, @samp{named_vars} enables the reuse only for
13167 user defined local variables with names, and @samp{none} disables stack reuse
13168 completely. The default value is @samp{all}. The option is needed when the
13169 program extends the lifetime of a scoped local variable or a compiler generated
13170 temporary beyond the end point defined by the language. When a lifetime of
13171 a variable ends, and if the variable lives in memory, the optimizing compiler
13172 has the freedom to reuse its stack space with other temporaries or scoped
13173 local variables whose live range does not overlap with it. Legacy code extending
13174 local lifetime is likely to break with the stack reuse optimization.
13175
13176 For example,
13177
13178 @smallexample
13179 int *p;
13180 @{
13181 int local1;
13182
13183 p = &local1;
13184 local1 = 10;
13185 ....
13186 @}
13187 @{
13188 int local2;
13189 local2 = 20;
13190 ...
13191 @}
13192
13193 if (*p == 10) // out of scope use of local1
13194 @{
13195
13196 @}
13197 @end smallexample
13198
13199 Another example:
13200 @smallexample
13201
13202 struct A
13203 @{
13204 A(int k) : i(k), j(k) @{ @}
13205 int i;
13206 int j;
13207 @};
13208
13209 A *ap;
13210
13211 void foo(const A& ar)
13212 @{
13213 ap = &ar;
13214 @}
13215
13216 void bar()
13217 @{
13218 foo(A(10)); // temp object's lifetime ends when foo returns
13219
13220 @{
13221 A a(20);
13222 ....
13223 @}
13224 ap->i+= 10; // ap references out of scope temp whose space
13225 // is reused with a. What is the value of ap->i?
13226 @}
13227
13228 @end smallexample
13229
13230 The lifetime of a compiler generated temporary is well defined by the C++
13231 standard. When a lifetime of a temporary ends, and if the temporary lives
13232 in memory, the optimizing compiler has the freedom to reuse its stack
13233 space with other temporaries or scoped local variables whose live range
13234 does not overlap with it. However some of the legacy code relies on
13235 the behavior of older compilers in which temporaries' stack space is
13236 not reused, the aggressive stack reuse can lead to runtime errors. This
13237 option is used to control the temporary stack reuse optimization.
13238
13239 @item -ftrapv
13240 @opindex ftrapv
13241 This option generates traps for signed overflow on addition, subtraction,
13242 multiplication operations.
13243 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13244 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13245 @option{-fwrapv} being effective. Note that only active options override, so
13246 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13247 results in @option{-ftrapv} being effective.
13248
13249 @item -fwrapv
13250 @opindex fwrapv
13251 This option instructs the compiler to assume that signed arithmetic
13252 overflow of addition, subtraction and multiplication wraps around
13253 using twos-complement representation. This flag enables some optimizations
13254 and disables others.
13255 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13256 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13257 @option{-fwrapv} being effective. Note that only active options override, so
13258 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13259 results in @option{-ftrapv} being effective.
13260
13261 @item -fwrapv-pointer
13262 @opindex fwrapv-pointer
13263 This option instructs the compiler to assume that pointer arithmetic
13264 overflow on addition and subtraction wraps around using twos-complement
13265 representation. This flag disables some optimizations which assume
13266 pointer overflow is invalid.
13267
13268 @item -fstrict-overflow
13269 @opindex fstrict-overflow
13270 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13271 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13272
13273 @item -fexceptions
13274 @opindex fexceptions
13275 Enable exception handling. Generates extra code needed to propagate
13276 exceptions. For some targets, this implies GCC generates frame
13277 unwind information for all functions, which can produce significant data
13278 size overhead, although it does not affect execution. If you do not
13279 specify this option, GCC enables it by default for languages like
13280 C++ that normally require exception handling, and disables it for
13281 languages like C that do not normally require it. However, you may need
13282 to enable this option when compiling C code that needs to interoperate
13283 properly with exception handlers written in C++. You may also wish to
13284 disable this option if you are compiling older C++ programs that don't
13285 use exception handling.
13286
13287 @item -fnon-call-exceptions
13288 @opindex fnon-call-exceptions
13289 Generate code that allows trapping instructions to throw exceptions.
13290 Note that this requires platform-specific runtime support that does
13291 not exist everywhere. Moreover, it only allows @emph{trapping}
13292 instructions to throw exceptions, i.e.@: memory references or floating-point
13293 instructions. It does not allow exceptions to be thrown from
13294 arbitrary signal handlers such as @code{SIGALRM}.
13295
13296 @item -fdelete-dead-exceptions
13297 @opindex fdelete-dead-exceptions
13298 Consider that instructions that may throw exceptions but don't otherwise
13299 contribute to the execution of the program can be optimized away.
13300 This option is enabled by default for the Ada front end, as permitted by
13301 the Ada language specification.
13302 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13303
13304 @item -funwind-tables
13305 @opindex funwind-tables
13306 Similar to @option{-fexceptions}, except that it just generates any needed
13307 static data, but does not affect the generated code in any other way.
13308 You normally do not need to enable this option; instead, a language processor
13309 that needs this handling enables it on your behalf.
13310
13311 @item -fasynchronous-unwind-tables
13312 @opindex fasynchronous-unwind-tables
13313 Generate unwind table in DWARF format, if supported by target machine. The
13314 table is exact at each instruction boundary, so it can be used for stack
13315 unwinding from asynchronous events (such as debugger or garbage collector).
13316
13317 @item -fno-gnu-unique
13318 @opindex fno-gnu-unique
13319 @opindex fgnu-unique
13320 On systems with recent GNU assembler and C library, the C++ compiler
13321 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13322 of template static data members and static local variables in inline
13323 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13324 is necessary to avoid problems with a library used by two different
13325 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13326 therefore disagreeing with the other one about the binding of the
13327 symbol. But this causes @code{dlclose} to be ignored for affected
13328 DSOs; if your program relies on reinitialization of a DSO via
13329 @code{dlclose} and @code{dlopen}, you can use
13330 @option{-fno-gnu-unique}.
13331
13332 @item -fpcc-struct-return
13333 @opindex fpcc-struct-return
13334 Return ``short'' @code{struct} and @code{union} values in memory like
13335 longer ones, rather than in registers. This convention is less
13336 efficient, but it has the advantage of allowing intercallability between
13337 GCC-compiled files and files compiled with other compilers, particularly
13338 the Portable C Compiler (pcc).
13339
13340 The precise convention for returning structures in memory depends
13341 on the target configuration macros.
13342
13343 Short structures and unions are those whose size and alignment match
13344 that of some integer type.
13345
13346 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13347 switch is not binary compatible with code compiled with the
13348 @option{-freg-struct-return} switch.
13349 Use it to conform to a non-default application binary interface.
13350
13351 @item -freg-struct-return
13352 @opindex freg-struct-return
13353 Return @code{struct} and @code{union} values in registers when possible.
13354 This is more efficient for small structures than
13355 @option{-fpcc-struct-return}.
13356
13357 If you specify neither @option{-fpcc-struct-return} nor
13358 @option{-freg-struct-return}, GCC defaults to whichever convention is
13359 standard for the target. If there is no standard convention, GCC
13360 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13361 the principal compiler. In those cases, we can choose the standard, and
13362 we chose the more efficient register return alternative.
13363
13364 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13365 switch is not binary compatible with code compiled with the
13366 @option{-fpcc-struct-return} switch.
13367 Use it to conform to a non-default application binary interface.
13368
13369 @item -fshort-enums
13370 @opindex fshort-enums
13371 Allocate to an @code{enum} type only as many bytes as it needs for the
13372 declared range of possible values. Specifically, the @code{enum} type
13373 is equivalent to the smallest integer type that has enough room.
13374
13375 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13376 code that is not binary compatible with code generated without that switch.
13377 Use it to conform to a non-default application binary interface.
13378
13379 @item -fshort-wchar
13380 @opindex fshort-wchar
13381 Override the underlying type for @code{wchar_t} to be @code{short
13382 unsigned int} instead of the default for the target. This option is
13383 useful for building programs to run under WINE@.
13384
13385 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13386 code that is not binary compatible with code generated without that switch.
13387 Use it to conform to a non-default application binary interface.
13388
13389 @item -fno-common
13390 @opindex fno-common
13391 @opindex fcommon
13392 @cindex tentative definitions
13393 In C code, this option controls the placement of global variables
13394 defined without an initializer, known as @dfn{tentative definitions}
13395 in the C standard. Tentative definitions are distinct from declarations
13396 of a variable with the @code{extern} keyword, which do not allocate storage.
13397
13398 Unix C compilers have traditionally allocated storage for
13399 uninitialized global variables in a common block. This allows the
13400 linker to resolve all tentative definitions of the same variable
13401 in different compilation units to the same object, or to a non-tentative
13402 definition.
13403 This is the behavior specified by @option{-fcommon}, and is the default for
13404 GCC on most targets.
13405 On the other hand, this behavior is not required by ISO
13406 C, and on some targets may carry a speed or code size penalty on
13407 variable references.
13408
13409 The @option{-fno-common} option specifies that the compiler should instead
13410 place uninitialized global variables in the BSS section of the object file.
13411 This inhibits the merging of tentative definitions by the linker so
13412 you get a multiple-definition error if the same
13413 variable is defined in more than one compilation unit.
13414 Compiling with @option{-fno-common} is useful on targets for which
13415 it provides better performance, or if you wish to verify that the
13416 program will work on other systems that always treat uninitialized
13417 variable definitions this way.
13418
13419 @item -fno-ident
13420 @opindex fno-ident
13421 @opindex fident
13422 Ignore the @code{#ident} directive.
13423
13424 @item -finhibit-size-directive
13425 @opindex finhibit-size-directive
13426 Don't output a @code{.size} assembler directive, or anything else that
13427 would cause trouble if the function is split in the middle, and the
13428 two halves are placed at locations far apart in memory. This option is
13429 used when compiling @file{crtstuff.c}; you should not need to use it
13430 for anything else.
13431
13432 @item -fverbose-asm
13433 @opindex fverbose-asm
13434 Put extra commentary information in the generated assembly code to
13435 make it more readable. This option is generally only of use to those
13436 who actually need to read the generated assembly code (perhaps while
13437 debugging the compiler itself).
13438
13439 @option{-fno-verbose-asm}, the default, causes the
13440 extra information to be omitted and is useful when comparing two assembler
13441 files.
13442
13443 The added comments include:
13444
13445 @itemize @bullet
13446
13447 @item
13448 information on the compiler version and command-line options,
13449
13450 @item
13451 the source code lines associated with the assembly instructions,
13452 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13453
13454 @item
13455 hints on which high-level expressions correspond to
13456 the various assembly instruction operands.
13457
13458 @end itemize
13459
13460 For example, given this C source file:
13461
13462 @smallexample
13463 int test (int n)
13464 @{
13465 int i;
13466 int total = 0;
13467
13468 for (i = 0; i < n; i++)
13469 total += i * i;
13470
13471 return total;
13472 @}
13473 @end smallexample
13474
13475 compiling to (x86_64) assembly via @option{-S} and emitting the result
13476 direct to stdout via @option{-o} @option{-}
13477
13478 @smallexample
13479 gcc -S test.c -fverbose-asm -Os -o -
13480 @end smallexample
13481
13482 gives output similar to this:
13483
13484 @smallexample
13485 .file "test.c"
13486 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13487 [...snip...]
13488 # options passed:
13489 [...snip...]
13490
13491 .text
13492 .globl test
13493 .type test, @@function
13494 test:
13495 .LFB0:
13496 .cfi_startproc
13497 # test.c:4: int total = 0;
13498 xorl %eax, %eax # <retval>
13499 # test.c:6: for (i = 0; i < n; i++)
13500 xorl %edx, %edx # i
13501 .L2:
13502 # test.c:6: for (i = 0; i < n; i++)
13503 cmpl %edi, %edx # n, i
13504 jge .L5 #,
13505 # test.c:7: total += i * i;
13506 movl %edx, %ecx # i, tmp92
13507 imull %edx, %ecx # i, tmp92
13508 # test.c:6: for (i = 0; i < n; i++)
13509 incl %edx # i
13510 # test.c:7: total += i * i;
13511 addl %ecx, %eax # tmp92, <retval>
13512 jmp .L2 #
13513 .L5:
13514 # test.c:10: @}
13515 ret
13516 .cfi_endproc
13517 .LFE0:
13518 .size test, .-test
13519 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13520 .section .note.GNU-stack,"",@@progbits
13521 @end smallexample
13522
13523 The comments are intended for humans rather than machines and hence the
13524 precise format of the comments is subject to change.
13525
13526 @item -frecord-gcc-switches
13527 @opindex frecord-gcc-switches
13528 This switch causes the command line used to invoke the
13529 compiler to be recorded into the object file that is being created.
13530 This switch is only implemented on some targets and the exact format
13531 of the recording is target and binary file format dependent, but it
13532 usually takes the form of a section containing ASCII text. This
13533 switch is related to the @option{-fverbose-asm} switch, but that
13534 switch only records information in the assembler output file as
13535 comments, so it never reaches the object file.
13536 See also @option{-grecord-gcc-switches} for another
13537 way of storing compiler options into the object file.
13538
13539 @item -fpic
13540 @opindex fpic
13541 @cindex global offset table
13542 @cindex PIC
13543 Generate position-independent code (PIC) suitable for use in a shared
13544 library, if supported for the target machine. Such code accesses all
13545 constant addresses through a global offset table (GOT)@. The dynamic
13546 loader resolves the GOT entries when the program starts (the dynamic
13547 loader is not part of GCC; it is part of the operating system). If
13548 the GOT size for the linked executable exceeds a machine-specific
13549 maximum size, you get an error message from the linker indicating that
13550 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13551 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13552 on the m68k and RS/6000. The x86 has no such limit.)
13553
13554 Position-independent code requires special support, and therefore works
13555 only on certain machines. For the x86, GCC supports PIC for System V
13556 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13557 position-independent.
13558
13559 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13560 are defined to 1.
13561
13562 @item -fPIC
13563 @opindex fPIC
13564 If supported for the target machine, emit position-independent code,
13565 suitable for dynamic linking and avoiding any limit on the size of the
13566 global offset table. This option makes a difference on AArch64, m68k,
13567 PowerPC and SPARC@.
13568
13569 Position-independent code requires special support, and therefore works
13570 only on certain machines.
13571
13572 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13573 are defined to 2.
13574
13575 @item -fpie
13576 @itemx -fPIE
13577 @opindex fpie
13578 @opindex fPIE
13579 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13580 generated position-independent code can be only linked into executables.
13581 Usually these options are used to compile code that will be linked using
13582 the @option{-pie} GCC option.
13583
13584 @option{-fpie} and @option{-fPIE} both define the macros
13585 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13586 for @option{-fpie} and 2 for @option{-fPIE}.
13587
13588 @item -fno-plt
13589 @opindex fno-plt
13590 @opindex fplt
13591 Do not use the PLT for external function calls in position-independent code.
13592 Instead, load the callee address at call sites from the GOT and branch to it.
13593 This leads to more efficient code by eliminating PLT stubs and exposing
13594 GOT loads to optimizations. On architectures such as 32-bit x86 where
13595 PLT stubs expect the GOT pointer in a specific register, this gives more
13596 register allocation freedom to the compiler.
13597 Lazy binding requires use of the PLT;
13598 with @option{-fno-plt} all external symbols are resolved at load time.
13599
13600 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13601 through the PLT for specific external functions.
13602
13603 In position-dependent code, a few targets also convert calls to
13604 functions that are marked to not use the PLT to use the GOT instead.
13605
13606 @item -fno-jump-tables
13607 @opindex fno-jump-tables
13608 @opindex fjump-tables
13609 Do not use jump tables for switch statements even where it would be
13610 more efficient than other code generation strategies. This option is
13611 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13612 building code that forms part of a dynamic linker and cannot
13613 reference the address of a jump table. On some targets, jump tables
13614 do not require a GOT and this option is not needed.
13615
13616 @item -ffixed-@var{reg}
13617 @opindex ffixed
13618 Treat the register named @var{reg} as a fixed register; generated code
13619 should never refer to it (except perhaps as a stack pointer, frame
13620 pointer or in some other fixed role).
13621
13622 @var{reg} must be the name of a register. The register names accepted
13623 are machine-specific and are defined in the @code{REGISTER_NAMES}
13624 macro in the machine description macro file.
13625
13626 This flag does not have a negative form, because it specifies a
13627 three-way choice.
13628
13629 @item -fcall-used-@var{reg}
13630 @opindex fcall-used
13631 Treat the register named @var{reg} as an allocable register that is
13632 clobbered by function calls. It may be allocated for temporaries or
13633 variables that do not live across a call. Functions compiled this way
13634 do not save and restore the register @var{reg}.
13635
13636 It is an error to use this flag with the frame pointer or stack pointer.
13637 Use of this flag for other registers that have fixed pervasive roles in
13638 the machine's execution model produces disastrous results.
13639
13640 This flag does not have a negative form, because it specifies a
13641 three-way choice.
13642
13643 @item -fcall-saved-@var{reg}
13644 @opindex fcall-saved
13645 Treat the register named @var{reg} as an allocable register saved by
13646 functions. It may be allocated even for temporaries or variables that
13647 live across a call. Functions compiled this way save and restore
13648 the register @var{reg} if they use it.
13649
13650 It is an error to use this flag with the frame pointer or stack pointer.
13651 Use of this flag for other registers that have fixed pervasive roles in
13652 the machine's execution model produces disastrous results.
13653
13654 A different sort of disaster results from the use of this flag for
13655 a register in which function values may be returned.
13656
13657 This flag does not have a negative form, because it specifies a
13658 three-way choice.
13659
13660 @item -fpack-struct[=@var{n}]
13661 @opindex fpack-struct
13662 Without a value specified, pack all structure members together without
13663 holes. When a value is specified (which must be a small power of two), pack
13664 structure members according to this value, representing the maximum
13665 alignment (that is, objects with default alignment requirements larger than
13666 this are output potentially unaligned at the next fitting location.
13667
13668 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13669 code that is not binary compatible with code generated without that switch.
13670 Additionally, it makes the code suboptimal.
13671 Use it to conform to a non-default application binary interface.
13672
13673 @item -fleading-underscore
13674 @opindex fleading-underscore
13675 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13676 change the way C symbols are represented in the object file. One use
13677 is to help link with legacy assembly code.
13678
13679 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13680 generate code that is not binary compatible with code generated without that
13681 switch. Use it to conform to a non-default application binary interface.
13682 Not all targets provide complete support for this switch.
13683
13684 @item -ftls-model=@var{model}
13685 @opindex ftls-model
13686 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13687 The @var{model} argument should be one of @samp{global-dynamic},
13688 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13689 Note that the choice is subject to optimization: the compiler may use
13690 a more efficient model for symbols not visible outside of the translation
13691 unit, or if @option{-fpic} is not given on the command line.
13692
13693 The default without @option{-fpic} is @samp{initial-exec}; with
13694 @option{-fpic} the default is @samp{global-dynamic}.
13695
13696 @item -ftrampolines
13697 @opindex ftrampolines
13698 For targets that normally need trampolines for nested functions, always
13699 generate them instead of using descriptors. Otherwise, for targets that
13700 do not need them, like for example HP-PA or IA-64, do nothing.
13701
13702 A trampoline is a small piece of code that is created at run time on the
13703 stack when the address of a nested function is taken, and is used to call
13704 the nested function indirectly. Therefore, it requires the stack to be
13705 made executable in order for the program to work properly.
13706
13707 @option{-fno-trampolines} is enabled by default on a language by language
13708 basis to let the compiler avoid generating them, if it computes that this
13709 is safe, and replace them with descriptors. Descriptors are made up of data
13710 only, but the generated code must be prepared to deal with them. As of this
13711 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13712
13713 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13714 @option{-fno-trampolines} are not binary compatible if nested functions are
13715 present. This option must therefore be used on a program-wide basis and be
13716 manipulated with extreme care.
13717
13718 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13719 @opindex fvisibility
13720 Set the default ELF image symbol visibility to the specified option---all
13721 symbols are marked with this unless overridden within the code.
13722 Using this feature can very substantially improve linking and
13723 load times of shared object libraries, produce more optimized
13724 code, provide near-perfect API export and prevent symbol clashes.
13725 It is @strong{strongly} recommended that you use this in any shared objects
13726 you distribute.
13727
13728 Despite the nomenclature, @samp{default} always means public; i.e.,
13729 available to be linked against from outside the shared object.
13730 @samp{protected} and @samp{internal} are pretty useless in real-world
13731 usage so the only other commonly used option is @samp{hidden}.
13732 The default if @option{-fvisibility} isn't specified is
13733 @samp{default}, i.e., make every symbol public.
13734
13735 A good explanation of the benefits offered by ensuring ELF
13736 symbols have the correct visibility is given by ``How To Write
13737 Shared Libraries'' by Ulrich Drepper (which can be found at
13738 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13739 solution made possible by this option to marking things hidden when
13740 the default is public is to make the default hidden and mark things
13741 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13742 and @code{__attribute__ ((visibility("default")))} instead of
13743 @code{__declspec(dllexport)} you get almost identical semantics with
13744 identical syntax. This is a great boon to those working with
13745 cross-platform projects.
13746
13747 For those adding visibility support to existing code, you may find
13748 @code{#pragma GCC visibility} of use. This works by you enclosing
13749 the declarations you wish to set visibility for with (for example)
13750 @code{#pragma GCC visibility push(hidden)} and
13751 @code{#pragma GCC visibility pop}.
13752 Bear in mind that symbol visibility should be viewed @strong{as
13753 part of the API interface contract} and thus all new code should
13754 always specify visibility when it is not the default; i.e., declarations
13755 only for use within the local DSO should @strong{always} be marked explicitly
13756 as hidden as so to avoid PLT indirection overheads---making this
13757 abundantly clear also aids readability and self-documentation of the code.
13758 Note that due to ISO C++ specification requirements, @code{operator new} and
13759 @code{operator delete} must always be of default visibility.
13760
13761 Be aware that headers from outside your project, in particular system
13762 headers and headers from any other library you use, may not be
13763 expecting to be compiled with visibility other than the default. You
13764 may need to explicitly say @code{#pragma GCC visibility push(default)}
13765 before including any such headers.
13766
13767 @code{extern} declarations are not affected by @option{-fvisibility}, so
13768 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13769 no modifications. However, this means that calls to @code{extern}
13770 functions with no explicit visibility use the PLT, so it is more
13771 effective to use @code{__attribute ((visibility))} and/or
13772 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13773 declarations should be treated as hidden.
13774
13775 Note that @option{-fvisibility} does affect C++ vague linkage
13776 entities. This means that, for instance, an exception class that is
13777 be thrown between DSOs must be explicitly marked with default
13778 visibility so that the @samp{type_info} nodes are unified between
13779 the DSOs.
13780
13781 An overview of these techniques, their benefits and how to use them
13782 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13783
13784 @item -fstrict-volatile-bitfields
13785 @opindex fstrict-volatile-bitfields
13786 This option should be used if accesses to volatile bit-fields (or other
13787 structure fields, although the compiler usually honors those types
13788 anyway) should use a single access of the width of the
13789 field's type, aligned to a natural alignment if possible. For
13790 example, targets with memory-mapped peripheral registers might require
13791 all such accesses to be 16 bits wide; with this flag you can
13792 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13793 is 16 bits on these targets) to force GCC to use 16-bit accesses
13794 instead of, perhaps, a more efficient 32-bit access.
13795
13796 If this option is disabled, the compiler uses the most efficient
13797 instruction. In the previous example, that might be a 32-bit load
13798 instruction, even though that accesses bytes that do not contain
13799 any portion of the bit-field, or memory-mapped registers unrelated to
13800 the one being updated.
13801
13802 In some cases, such as when the @code{packed} attribute is applied to a
13803 structure field, it may not be possible to access the field with a single
13804 read or write that is correctly aligned for the target machine. In this
13805 case GCC falls back to generating multiple accesses rather than code that
13806 will fault or truncate the result at run time.
13807
13808 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13809 not allowed to touch non bit-field members. It is therefore recommended
13810 to define all bits of the field's type as bit-field members.
13811
13812 The default value of this option is determined by the application binary
13813 interface for the target processor.
13814
13815 @item -fsync-libcalls
13816 @opindex fsync-libcalls
13817 This option controls whether any out-of-line instance of the @code{__sync}
13818 family of functions may be used to implement the C++11 @code{__atomic}
13819 family of functions.
13820
13821 The default value of this option is enabled, thus the only useful form
13822 of the option is @option{-fno-sync-libcalls}. This option is used in
13823 the implementation of the @file{libatomic} runtime library.
13824
13825 @end table
13826
13827 @node Developer Options
13828 @section GCC Developer Options
13829 @cindex developer options
13830 @cindex debugging GCC
13831 @cindex debug dump options
13832 @cindex dump options
13833 @cindex compilation statistics
13834
13835 This section describes command-line options that are primarily of
13836 interest to GCC developers, including options to support compiler
13837 testing and investigation of compiler bugs and compile-time
13838 performance problems. This includes options that produce debug dumps
13839 at various points in the compilation; that print statistics such as
13840 memory use and execution time; and that print information about GCC's
13841 configuration, such as where it searches for libraries. You should
13842 rarely need to use any of these options for ordinary compilation and
13843 linking tasks.
13844
13845 Many developer options that cause GCC to dump output to a file take an
13846 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13847 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13848 error.
13849
13850 If @samp{=@var{filename}} is omitted, a default dump file name is
13851 constructed by concatenating the base dump file name, a pass number,
13852 phase letter, and pass name. The base dump file name is the name of
13853 output file produced by the compiler if explicitly specified and not
13854 an executable; otherwise it is the source file name.
13855 The pass number is determined by the order passes are registered with
13856 the compiler's pass manager.
13857 This is generally the same as the order of execution, but passes
13858 registered by plugins, target-specific passes, or passes that are
13859 otherwise registered late are numbered higher than the pass named
13860 @samp{final}, even if they are executed earlier. The phase letter is
13861 one of @samp{i} (inter-procedural analysis), @samp{l}
13862 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13863 The files are created in the directory of the output file.
13864
13865 @table @gcctabopt
13866
13867 @item -d@var{letters}
13868 @itemx -fdump-rtl-@var{pass}
13869 @itemx -fdump-rtl-@var{pass}=@var{filename}
13870 @opindex d
13871 @opindex fdump-rtl-@var{pass}
13872 Says to make debugging dumps during compilation at times specified by
13873 @var{letters}. This is used for debugging the RTL-based passes of the
13874 compiler.
13875
13876 Some @option{-d@var{letters}} switches have different meaning when
13877 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13878 for information about preprocessor-specific dump options.
13879
13880 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13881 @option{-d} option @var{letters}. Here are the possible
13882 letters for use in @var{pass} and @var{letters}, and their meanings:
13883
13884 @table @gcctabopt
13885
13886 @item -fdump-rtl-alignments
13887 @opindex fdump-rtl-alignments
13888 Dump after branch alignments have been computed.
13889
13890 @item -fdump-rtl-asmcons
13891 @opindex fdump-rtl-asmcons
13892 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13893
13894 @item -fdump-rtl-auto_inc_dec
13895 @opindex fdump-rtl-auto_inc_dec
13896 Dump after auto-inc-dec discovery. This pass is only run on
13897 architectures that have auto inc or auto dec instructions.
13898
13899 @item -fdump-rtl-barriers
13900 @opindex fdump-rtl-barriers
13901 Dump after cleaning up the barrier instructions.
13902
13903 @item -fdump-rtl-bbpart
13904 @opindex fdump-rtl-bbpart
13905 Dump after partitioning hot and cold basic blocks.
13906
13907 @item -fdump-rtl-bbro
13908 @opindex fdump-rtl-bbro
13909 Dump after block reordering.
13910
13911 @item -fdump-rtl-btl1
13912 @itemx -fdump-rtl-btl2
13913 @opindex fdump-rtl-btl2
13914 @opindex fdump-rtl-btl2
13915 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13916 after the two branch
13917 target load optimization passes.
13918
13919 @item -fdump-rtl-bypass
13920 @opindex fdump-rtl-bypass
13921 Dump after jump bypassing and control flow optimizations.
13922
13923 @item -fdump-rtl-combine
13924 @opindex fdump-rtl-combine
13925 Dump after the RTL instruction combination pass.
13926
13927 @item -fdump-rtl-compgotos
13928 @opindex fdump-rtl-compgotos
13929 Dump after duplicating the computed gotos.
13930
13931 @item -fdump-rtl-ce1
13932 @itemx -fdump-rtl-ce2
13933 @itemx -fdump-rtl-ce3
13934 @opindex fdump-rtl-ce1
13935 @opindex fdump-rtl-ce2
13936 @opindex fdump-rtl-ce3
13937 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13938 @option{-fdump-rtl-ce3} enable dumping after the three
13939 if conversion passes.
13940
13941 @item -fdump-rtl-cprop_hardreg
13942 @opindex fdump-rtl-cprop_hardreg
13943 Dump after hard register copy propagation.
13944
13945 @item -fdump-rtl-csa
13946 @opindex fdump-rtl-csa
13947 Dump after combining stack adjustments.
13948
13949 @item -fdump-rtl-cse1
13950 @itemx -fdump-rtl-cse2
13951 @opindex fdump-rtl-cse1
13952 @opindex fdump-rtl-cse2
13953 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13954 the two common subexpression elimination passes.
13955
13956 @item -fdump-rtl-dce
13957 @opindex fdump-rtl-dce
13958 Dump after the standalone dead code elimination passes.
13959
13960 @item -fdump-rtl-dbr
13961 @opindex fdump-rtl-dbr
13962 Dump after delayed branch scheduling.
13963
13964 @item -fdump-rtl-dce1
13965 @itemx -fdump-rtl-dce2
13966 @opindex fdump-rtl-dce1
13967 @opindex fdump-rtl-dce2
13968 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13969 the two dead store elimination passes.
13970
13971 @item -fdump-rtl-eh
13972 @opindex fdump-rtl-eh
13973 Dump after finalization of EH handling code.
13974
13975 @item -fdump-rtl-eh_ranges
13976 @opindex fdump-rtl-eh_ranges
13977 Dump after conversion of EH handling range regions.
13978
13979 @item -fdump-rtl-expand
13980 @opindex fdump-rtl-expand
13981 Dump after RTL generation.
13982
13983 @item -fdump-rtl-fwprop1
13984 @itemx -fdump-rtl-fwprop2
13985 @opindex fdump-rtl-fwprop1
13986 @opindex fdump-rtl-fwprop2
13987 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13988 dumping after the two forward propagation passes.
13989
13990 @item -fdump-rtl-gcse1
13991 @itemx -fdump-rtl-gcse2
13992 @opindex fdump-rtl-gcse1
13993 @opindex fdump-rtl-gcse2
13994 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13995 after global common subexpression elimination.
13996
13997 @item -fdump-rtl-init-regs
13998 @opindex fdump-rtl-init-regs
13999 Dump after the initialization of the registers.
14000
14001 @item -fdump-rtl-initvals
14002 @opindex fdump-rtl-initvals
14003 Dump after the computation of the initial value sets.
14004
14005 @item -fdump-rtl-into_cfglayout
14006 @opindex fdump-rtl-into_cfglayout
14007 Dump after converting to cfglayout mode.
14008
14009 @item -fdump-rtl-ira
14010 @opindex fdump-rtl-ira
14011 Dump after iterated register allocation.
14012
14013 @item -fdump-rtl-jump
14014 @opindex fdump-rtl-jump
14015 Dump after the second jump optimization.
14016
14017 @item -fdump-rtl-loop2
14018 @opindex fdump-rtl-loop2
14019 @option{-fdump-rtl-loop2} enables dumping after the rtl
14020 loop optimization passes.
14021
14022 @item -fdump-rtl-mach
14023 @opindex fdump-rtl-mach
14024 Dump after performing the machine dependent reorganization pass, if that
14025 pass exists.
14026
14027 @item -fdump-rtl-mode_sw
14028 @opindex fdump-rtl-mode_sw
14029 Dump after removing redundant mode switches.
14030
14031 @item -fdump-rtl-rnreg
14032 @opindex fdump-rtl-rnreg
14033 Dump after register renumbering.
14034
14035 @item -fdump-rtl-outof_cfglayout
14036 @opindex fdump-rtl-outof_cfglayout
14037 Dump after converting from cfglayout mode.
14038
14039 @item -fdump-rtl-peephole2
14040 @opindex fdump-rtl-peephole2
14041 Dump after the peephole pass.
14042
14043 @item -fdump-rtl-postreload
14044 @opindex fdump-rtl-postreload
14045 Dump after post-reload optimizations.
14046
14047 @item -fdump-rtl-pro_and_epilogue
14048 @opindex fdump-rtl-pro_and_epilogue
14049 Dump after generating the function prologues and epilogues.
14050
14051 @item -fdump-rtl-sched1
14052 @itemx -fdump-rtl-sched2
14053 @opindex fdump-rtl-sched1
14054 @opindex fdump-rtl-sched2
14055 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14056 after the basic block scheduling passes.
14057
14058 @item -fdump-rtl-ree
14059 @opindex fdump-rtl-ree
14060 Dump after sign/zero extension elimination.
14061
14062 @item -fdump-rtl-seqabstr
14063 @opindex fdump-rtl-seqabstr
14064 Dump after common sequence discovery.
14065
14066 @item -fdump-rtl-shorten
14067 @opindex fdump-rtl-shorten
14068 Dump after shortening branches.
14069
14070 @item -fdump-rtl-sibling
14071 @opindex fdump-rtl-sibling
14072 Dump after sibling call optimizations.
14073
14074 @item -fdump-rtl-split1
14075 @itemx -fdump-rtl-split2
14076 @itemx -fdump-rtl-split3
14077 @itemx -fdump-rtl-split4
14078 @itemx -fdump-rtl-split5
14079 @opindex fdump-rtl-split1
14080 @opindex fdump-rtl-split2
14081 @opindex fdump-rtl-split3
14082 @opindex fdump-rtl-split4
14083 @opindex fdump-rtl-split5
14084 These options enable dumping after five rounds of
14085 instruction splitting.
14086
14087 @item -fdump-rtl-sms
14088 @opindex fdump-rtl-sms
14089 Dump after modulo scheduling. This pass is only run on some
14090 architectures.
14091
14092 @item -fdump-rtl-stack
14093 @opindex fdump-rtl-stack
14094 Dump after conversion from GCC's ``flat register file'' registers to the
14095 x87's stack-like registers. This pass is only run on x86 variants.
14096
14097 @item -fdump-rtl-subreg1
14098 @itemx -fdump-rtl-subreg2
14099 @opindex fdump-rtl-subreg1
14100 @opindex fdump-rtl-subreg2
14101 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14102 the two subreg expansion passes.
14103
14104 @item -fdump-rtl-unshare
14105 @opindex fdump-rtl-unshare
14106 Dump after all rtl has been unshared.
14107
14108 @item -fdump-rtl-vartrack
14109 @opindex fdump-rtl-vartrack
14110 Dump after variable tracking.
14111
14112 @item -fdump-rtl-vregs
14113 @opindex fdump-rtl-vregs
14114 Dump after converting virtual registers to hard registers.
14115
14116 @item -fdump-rtl-web
14117 @opindex fdump-rtl-web
14118 Dump after live range splitting.
14119
14120 @item -fdump-rtl-regclass
14121 @itemx -fdump-rtl-subregs_of_mode_init
14122 @itemx -fdump-rtl-subregs_of_mode_finish
14123 @itemx -fdump-rtl-dfinit
14124 @itemx -fdump-rtl-dfinish
14125 @opindex fdump-rtl-regclass
14126 @opindex fdump-rtl-subregs_of_mode_init
14127 @opindex fdump-rtl-subregs_of_mode_finish
14128 @opindex fdump-rtl-dfinit
14129 @opindex fdump-rtl-dfinish
14130 These dumps are defined but always produce empty files.
14131
14132 @item -da
14133 @itemx -fdump-rtl-all
14134 @opindex da
14135 @opindex fdump-rtl-all
14136 Produce all the dumps listed above.
14137
14138 @item -dA
14139 @opindex dA
14140 Annotate the assembler output with miscellaneous debugging information.
14141
14142 @item -dD
14143 @opindex dD
14144 Dump all macro definitions, at the end of preprocessing, in addition to
14145 normal output.
14146
14147 @item -dH
14148 @opindex dH
14149 Produce a core dump whenever an error occurs.
14150
14151 @item -dp
14152 @opindex dp
14153 Annotate the assembler output with a comment indicating which
14154 pattern and alternative is used. The length and cost of each instruction are
14155 also printed.
14156
14157 @item -dP
14158 @opindex dP
14159 Dump the RTL in the assembler output as a comment before each instruction.
14160 Also turns on @option{-dp} annotation.
14161
14162 @item -dx
14163 @opindex dx
14164 Just generate RTL for a function instead of compiling it. Usually used
14165 with @option{-fdump-rtl-expand}.
14166 @end table
14167
14168 @item -fdump-debug
14169 @opindex fdump-debug
14170 Dump debugging information generated during the debug
14171 generation phase.
14172
14173 @item -fdump-earlydebug
14174 @opindex fdump-earlydebug
14175 Dump debugging information generated during the early debug
14176 generation phase.
14177
14178 @item -fdump-noaddr
14179 @opindex fdump-noaddr
14180 When doing debugging dumps, suppress address output. This makes it more
14181 feasible to use diff on debugging dumps for compiler invocations with
14182 different compiler binaries and/or different
14183 text / bss / data / heap / stack / dso start locations.
14184
14185 @item -freport-bug
14186 @opindex freport-bug
14187 Collect and dump debug information into a temporary file if an
14188 internal compiler error (ICE) occurs.
14189
14190 @item -fdump-unnumbered
14191 @opindex fdump-unnumbered
14192 When doing debugging dumps, suppress instruction numbers and address output.
14193 This makes it more feasible to use diff on debugging dumps for compiler
14194 invocations with different options, in particular with and without
14195 @option{-g}.
14196
14197 @item -fdump-unnumbered-links
14198 @opindex fdump-unnumbered-links
14199 When doing debugging dumps (see @option{-d} option above), suppress
14200 instruction numbers for the links to the previous and next instructions
14201 in a sequence.
14202
14203 @item -fdump-ipa-@var{switch}
14204 @itemx -fdump-ipa-@var{switch}-@var{options}
14205 @opindex fdump-ipa
14206 Control the dumping at various stages of inter-procedural analysis
14207 language tree to a file. The file name is generated by appending a
14208 switch specific suffix to the source file name, and the file is created
14209 in the same directory as the output file. The following dumps are
14210 possible:
14211
14212 @table @samp
14213 @item all
14214 Enables all inter-procedural analysis dumps.
14215
14216 @item cgraph
14217 Dumps information about call-graph optimization, unused function removal,
14218 and inlining decisions.
14219
14220 @item inline
14221 Dump after function inlining.
14222
14223 @end table
14224
14225 Additionally, the options @option{-optimized}, @option{-missed},
14226 @option{-note}, and @option{-all} can be provided, with the same meaning
14227 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14228
14229 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14230 information on callsites that were inlined, along with callsites
14231 that were not inlined.
14232
14233 By default, the dump will contain messages about successful
14234 optimizations (equivalent to @option{-optimized}) together with
14235 low-level details about the analysis.
14236
14237 @item -fdump-lang-all
14238 @itemx -fdump-lang-@var{switch}
14239 @itemx -fdump-lang-@var{switch}-@var{options}
14240 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14241 @opindex fdump-lang-all
14242 @opindex fdump-lang
14243 Control the dumping of language-specific information. The @var{options}
14244 and @var{filename} portions behave as described in the
14245 @option{-fdump-tree} option. The following @var{switch} values are
14246 accepted:
14247
14248 @table @samp
14249 @item all
14250
14251 Enable all language-specific dumps.
14252
14253 @item class
14254 Dump class hierarchy information. Virtual table information is emitted
14255 unless '@option{slim}' is specified. This option is applicable to C++ only.
14256
14257 @item raw
14258 Dump the raw internal tree data. This option is applicable to C++ only.
14259
14260 @end table
14261
14262 @item -fdump-passes
14263 @opindex fdump-passes
14264 Print on @file{stderr} the list of optimization passes that are turned
14265 on and off by the current command-line options.
14266
14267 @item -fdump-statistics-@var{option}
14268 @opindex fdump-statistics
14269 Enable and control dumping of pass statistics in a separate file. The
14270 file name is generated by appending a suffix ending in
14271 @samp{.statistics} to the source file name, and the file is created in
14272 the same directory as the output file. If the @samp{-@var{option}}
14273 form is used, @samp{-stats} causes counters to be summed over the
14274 whole compilation unit while @samp{-details} dumps every event as
14275 the passes generate them. The default with no option is to sum
14276 counters for each function compiled.
14277
14278 @item -fdump-tree-all
14279 @itemx -fdump-tree-@var{switch}
14280 @itemx -fdump-tree-@var{switch}-@var{options}
14281 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14282 @opindex fdump-tree-all
14283 @opindex fdump-tree
14284 Control the dumping at various stages of processing the intermediate
14285 language tree to a file. If the @samp{-@var{options}}
14286 form is used, @var{options} is a list of @samp{-} separated options
14287 which control the details of the dump. Not all options are applicable
14288 to all dumps; those that are not meaningful are ignored. The
14289 following options are available
14290
14291 @table @samp
14292 @item address
14293 Print the address of each node. Usually this is not meaningful as it
14294 changes according to the environment and source file. Its primary use
14295 is for tying up a dump file with a debug environment.
14296 @item asmname
14297 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14298 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14299 use working backward from mangled names in the assembly file.
14300 @item slim
14301 When dumping front-end intermediate representations, inhibit dumping
14302 of members of a scope or body of a function merely because that scope
14303 has been reached. Only dump such items when they are directly reachable
14304 by some other path.
14305
14306 When dumping pretty-printed trees, this option inhibits dumping the
14307 bodies of control structures.
14308
14309 When dumping RTL, print the RTL in slim (condensed) form instead of
14310 the default LISP-like representation.
14311 @item raw
14312 Print a raw representation of the tree. By default, trees are
14313 pretty-printed into a C-like representation.
14314 @item details
14315 Enable more detailed dumps (not honored by every dump option). Also
14316 include information from the optimization passes.
14317 @item stats
14318 Enable dumping various statistics about the pass (not honored by every dump
14319 option).
14320 @item blocks
14321 Enable showing basic block boundaries (disabled in raw dumps).
14322 @item graph
14323 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14324 dump a representation of the control flow graph suitable for viewing with
14325 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14326 the file is pretty-printed as a subgraph, so that GraphViz can render them
14327 all in a single plot.
14328
14329 This option currently only works for RTL dumps, and the RTL is always
14330 dumped in slim form.
14331 @item vops
14332 Enable showing virtual operands for every statement.
14333 @item lineno
14334 Enable showing line numbers for statements.
14335 @item uid
14336 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14337 @item verbose
14338 Enable showing the tree dump for each statement.
14339 @item eh
14340 Enable showing the EH region number holding each statement.
14341 @item scev
14342 Enable showing scalar evolution analysis details.
14343 @item optimized
14344 Enable showing optimization information (only available in certain
14345 passes).
14346 @item missed
14347 Enable showing missed optimization information (only available in certain
14348 passes).
14349 @item note
14350 Enable other detailed optimization information (only available in
14351 certain passes).
14352 @item all
14353 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14354 and @option{lineno}.
14355 @item optall
14356 Turn on all optimization options, i.e., @option{optimized},
14357 @option{missed}, and @option{note}.
14358 @end table
14359
14360 To determine what tree dumps are available or find the dump for a pass
14361 of interest follow the steps below.
14362
14363 @enumerate
14364 @item
14365 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14366 look for a code that corresponds to the pass you are interested in.
14367 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14368 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14369 The number at the end distinguishes distinct invocations of the same pass.
14370 @item
14371 To enable the creation of the dump file, append the pass code to
14372 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14373 to enable the dump from the Early Value Range Propagation pass, invoke
14374 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14375 specify the name of the dump file. If you don't specify one, GCC
14376 creates as described below.
14377 @item
14378 Find the pass dump in a file whose name is composed of three components
14379 separated by a period: the name of the source file GCC was invoked to
14380 compile, a numeric suffix indicating the pass number followed by the
14381 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14382 and finally the pass code. For example, the Early VRP pass dump might
14383 be in a file named @file{myfile.c.038t.evrp} in the current working
14384 directory. Note that the numeric codes are not stable and may change
14385 from one version of GCC to another.
14386 @end enumerate
14387
14388 @item -fopt-info
14389 @itemx -fopt-info-@var{options}
14390 @itemx -fopt-info-@var{options}=@var{filename}
14391 @opindex fopt-info
14392 Controls optimization dumps from various optimization passes. If the
14393 @samp{-@var{options}} form is used, @var{options} is a list of
14394 @samp{-} separated option keywords to select the dump details and
14395 optimizations.
14396
14397 The @var{options} can be divided into three groups:
14398 @enumerate
14399 @item
14400 options describing what kinds of messages should be emitted,
14401 @item
14402 options describing the verbosity of the dump, and
14403 @item
14404 options describing which optimizations should be included.
14405 @end enumerate
14406 The options from each group can be freely mixed as they are
14407 non-overlapping. However, in case of any conflicts,
14408 the later options override the earlier options on the command
14409 line.
14410
14411 The following options control which kinds of messages should be emitted:
14412
14413 @table @samp
14414 @item optimized
14415 Print information when an optimization is successfully applied. It is
14416 up to a pass to decide which information is relevant. For example, the
14417 vectorizer passes print the source location of loops which are
14418 successfully vectorized.
14419 @item missed
14420 Print information about missed optimizations. Individual passes
14421 control which information to include in the output.
14422 @item note
14423 Print verbose information about optimizations, such as certain
14424 transformations, more detailed messages about decisions etc.
14425 @item all
14426 Print detailed optimization information. This includes
14427 @samp{optimized}, @samp{missed}, and @samp{note}.
14428 @end table
14429
14430 The following option controls the dump verbosity:
14431
14432 @table @samp
14433 @item internals
14434 By default, only ``high-level'' messages are emitted. This option enables
14435 additional, more detailed, messages, which are likely to only be of interest
14436 to GCC developers.
14437 @end table
14438
14439 One or more of the following option keywords can be used to describe a
14440 group of optimizations:
14441
14442 @table @samp
14443 @item ipa
14444 Enable dumps from all interprocedural optimizations.
14445 @item loop
14446 Enable dumps from all loop optimizations.
14447 @item inline
14448 Enable dumps from all inlining optimizations.
14449 @item omp
14450 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14451 @item vec
14452 Enable dumps from all vectorization optimizations.
14453 @item optall
14454 Enable dumps from all optimizations. This is a superset of
14455 the optimization groups listed above.
14456 @end table
14457
14458 If @var{options} is
14459 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14460 about successful optimizations from all the passes, omitting messages
14461 that are treated as ``internals''.
14462
14463 If the @var{filename} is provided, then the dumps from all the
14464 applicable optimizations are concatenated into the @var{filename}.
14465 Otherwise the dump is output onto @file{stderr}. Though multiple
14466 @option{-fopt-info} options are accepted, only one of them can include
14467 a @var{filename}. If other filenames are provided then all but the
14468 first such option are ignored.
14469
14470 Note that the output @var{filename} is overwritten
14471 in case of multiple translation units. If a combined output from
14472 multiple translation units is desired, @file{stderr} should be used
14473 instead.
14474
14475 In the following example, the optimization info is output to
14476 @file{stderr}:
14477
14478 @smallexample
14479 gcc -O3 -fopt-info
14480 @end smallexample
14481
14482 This example:
14483 @smallexample
14484 gcc -O3 -fopt-info-missed=missed.all
14485 @end smallexample
14486
14487 @noindent
14488 outputs missed optimization report from all the passes into
14489 @file{missed.all}, and this one:
14490
14491 @smallexample
14492 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14493 @end smallexample
14494
14495 @noindent
14496 prints information about missed optimization opportunities from
14497 vectorization passes on @file{stderr}.
14498 Note that @option{-fopt-info-vec-missed} is equivalent to
14499 @option{-fopt-info-missed-vec}. The order of the optimization group
14500 names and message types listed after @option{-fopt-info} does not matter.
14501
14502 As another example,
14503 @smallexample
14504 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14505 @end smallexample
14506
14507 @noindent
14508 outputs information about missed optimizations as well as
14509 optimized locations from all the inlining passes into
14510 @file{inline.txt}.
14511
14512 Finally, consider:
14513
14514 @smallexample
14515 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14516 @end smallexample
14517
14518 @noindent
14519 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14520 in conflict since only one output file is allowed. In this case, only
14521 the first option takes effect and the subsequent options are
14522 ignored. Thus only @file{vec.miss} is produced which contains
14523 dumps from the vectorizer about missed opportunities.
14524
14525 @item -fsave-optimization-record
14526 @opindex fsave-optimization-record
14527 Write a SRCFILE.opt-record.json file detailing what optimizations
14528 were performed, for those optimizations that support @option{-fopt-info}.
14529
14530 This option is experimental and the format of the data within the JSON
14531 file is subject to change.
14532
14533 It is roughly equivalent to a machine-readable version of
14534 @option{-fopt-info-all}, as a collection of messages with source file,
14535 line number and column number, with the following additional data for
14536 each message:
14537
14538 @itemize @bullet
14539
14540 @item
14541 the execution count of the code being optimized, along with metadata about
14542 whether this was from actual profile data, or just an estimate, allowing
14543 consumers to prioritize messages by code hotness,
14544
14545 @item
14546 the function name of the code being optimized, where applicable,
14547
14548 @item
14549 the ``inlining chain'' for the code being optimized, so that when
14550 a function is inlined into several different places (which might
14551 themselves be inlined), the reader can distinguish between the copies,
14552
14553 @item
14554 objects identifying those parts of the message that refer to expressions,
14555 statements or symbol-table nodes, which of these categories they are, and,
14556 when available, their source code location,
14557
14558 @item
14559 the GCC pass that emitted the message, and
14560
14561 @item
14562 the location in GCC's own code from which the message was emitted
14563
14564 @end itemize
14565
14566 Additionally, some messages are logically nested within other
14567 messages, reflecting implementation details of the optimization
14568 passes.
14569
14570 @item -fsched-verbose=@var{n}
14571 @opindex fsched-verbose
14572 On targets that use instruction scheduling, this option controls the
14573 amount of debugging output the scheduler prints to the dump files.
14574
14575 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14576 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14577 For @var{n} greater than one, it also output basic block probabilities,
14578 detailed ready list information and unit/insn info. For @var{n} greater
14579 than two, it includes RTL at abort point, control-flow and regions info.
14580 And for @var{n} over four, @option{-fsched-verbose} also includes
14581 dependence info.
14582
14583
14584
14585 @item -fenable-@var{kind}-@var{pass}
14586 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14587 @opindex fdisable-
14588 @opindex fenable-
14589
14590 This is a set of options that are used to explicitly disable/enable
14591 optimization passes. These options are intended for use for debugging GCC.
14592 Compiler users should use regular options for enabling/disabling
14593 passes instead.
14594
14595 @table @gcctabopt
14596
14597 @item -fdisable-ipa-@var{pass}
14598 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14599 statically invoked in the compiler multiple times, the pass name should be
14600 appended with a sequential number starting from 1.
14601
14602 @item -fdisable-rtl-@var{pass}
14603 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14604 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14605 statically invoked in the compiler multiple times, the pass name should be
14606 appended with a sequential number starting from 1. @var{range-list} is a
14607 comma-separated list of function ranges or assembler names. Each range is a number
14608 pair separated by a colon. The range is inclusive in both ends. If the range
14609 is trivial, the number pair can be simplified as a single number. If the
14610 function's call graph node's @var{uid} falls within one of the specified ranges,
14611 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14612 function header of a dump file, and the pass names can be dumped by using
14613 option @option{-fdump-passes}.
14614
14615 @item -fdisable-tree-@var{pass}
14616 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14617 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14618 option arguments.
14619
14620 @item -fenable-ipa-@var{pass}
14621 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14622 statically invoked in the compiler multiple times, the pass name should be
14623 appended with a sequential number starting from 1.
14624
14625 @item -fenable-rtl-@var{pass}
14626 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14627 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14628 description and examples.
14629
14630 @item -fenable-tree-@var{pass}
14631 @itemx -fenable-tree-@var{pass}=@var{range-list}
14632 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14633 of option arguments.
14634
14635 @end table
14636
14637 Here are some examples showing uses of these options.
14638
14639 @smallexample
14640
14641 # disable ccp1 for all functions
14642 -fdisable-tree-ccp1
14643 # disable complete unroll for function whose cgraph node uid is 1
14644 -fenable-tree-cunroll=1
14645 # disable gcse2 for functions at the following ranges [1,1],
14646 # [300,400], and [400,1000]
14647 # disable gcse2 for functions foo and foo2
14648 -fdisable-rtl-gcse2=foo,foo2
14649 # disable early inlining
14650 -fdisable-tree-einline
14651 # disable ipa inlining
14652 -fdisable-ipa-inline
14653 # enable tree full unroll
14654 -fenable-tree-unroll
14655
14656 @end smallexample
14657
14658 @item -fchecking
14659 @itemx -fchecking=@var{n}
14660 @opindex fchecking
14661 @opindex fno-checking
14662 Enable internal consistency checking. The default depends on
14663 the compiler configuration. @option{-fchecking=2} enables further
14664 internal consistency checking that might affect code generation.
14665
14666 @item -frandom-seed=@var{string}
14667 @opindex frandom-seed
14668 This option provides a seed that GCC uses in place of
14669 random numbers in generating certain symbol names
14670 that have to be different in every compiled file. It is also used to
14671 place unique stamps in coverage data files and the object files that
14672 produce them. You can use the @option{-frandom-seed} option to produce
14673 reproducibly identical object files.
14674
14675 The @var{string} can either be a number (decimal, octal or hex) or an
14676 arbitrary string (in which case it's converted to a number by
14677 computing CRC32).
14678
14679 The @var{string} should be different for every file you compile.
14680
14681 @item -save-temps
14682 @itemx -save-temps=cwd
14683 @opindex save-temps
14684 Store the usual ``temporary'' intermediate files permanently; place them
14685 in the current directory and name them based on the source file. Thus,
14686 compiling @file{foo.c} with @option{-c -save-temps} produces files
14687 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14688 preprocessed @file{foo.i} output file even though the compiler now
14689 normally uses an integrated preprocessor.
14690
14691 When used in combination with the @option{-x} command-line option,
14692 @option{-save-temps} is sensible enough to avoid over writing an
14693 input source file with the same extension as an intermediate file.
14694 The corresponding intermediate file may be obtained by renaming the
14695 source file before using @option{-save-temps}.
14696
14697 If you invoke GCC in parallel, compiling several different source
14698 files that share a common base name in different subdirectories or the
14699 same source file compiled for multiple output destinations, it is
14700 likely that the different parallel compilers will interfere with each
14701 other, and overwrite the temporary files. For instance:
14702
14703 @smallexample
14704 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14705 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14706 @end smallexample
14707
14708 may result in @file{foo.i} and @file{foo.o} being written to
14709 simultaneously by both compilers.
14710
14711 @item -save-temps=obj
14712 @opindex save-temps=obj
14713 Store the usual ``temporary'' intermediate files permanently. If the
14714 @option{-o} option is used, the temporary files are based on the
14715 object file. If the @option{-o} option is not used, the
14716 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14717
14718 For example:
14719
14720 @smallexample
14721 gcc -save-temps=obj -c foo.c
14722 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14723 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14724 @end smallexample
14725
14726 @noindent
14727 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14728 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14729 @file{dir2/yfoobar.o}.
14730
14731 @item -time@r{[}=@var{file}@r{]}
14732 @opindex time
14733 Report the CPU time taken by each subprocess in the compilation
14734 sequence. For C source files, this is the compiler proper and assembler
14735 (plus the linker if linking is done).
14736
14737 Without the specification of an output file, the output looks like this:
14738
14739 @smallexample
14740 # cc1 0.12 0.01
14741 # as 0.00 0.01
14742 @end smallexample
14743
14744 The first number on each line is the ``user time'', that is time spent
14745 executing the program itself. The second number is ``system time'',
14746 time spent executing operating system routines on behalf of the program.
14747 Both numbers are in seconds.
14748
14749 With the specification of an output file, the output is appended to the
14750 named file, and it looks like this:
14751
14752 @smallexample
14753 0.12 0.01 cc1 @var{options}
14754 0.00 0.01 as @var{options}
14755 @end smallexample
14756
14757 The ``user time'' and the ``system time'' are moved before the program
14758 name, and the options passed to the program are displayed, so that one
14759 can later tell what file was being compiled, and with which options.
14760
14761 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14762 @opindex fdump-final-insns
14763 Dump the final internal representation (RTL) to @var{file}. If the
14764 optional argument is omitted (or if @var{file} is @code{.}), the name
14765 of the dump file is determined by appending @code{.gkd} to the
14766 compilation output file name.
14767
14768 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14769 @opindex fcompare-debug
14770 @opindex fno-compare-debug
14771 If no error occurs during compilation, run the compiler a second time,
14772 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14773 passed to the second compilation. Dump the final internal
14774 representation in both compilations, and print an error if they differ.
14775
14776 If the equal sign is omitted, the default @option{-gtoggle} is used.
14777
14778 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14779 and nonzero, implicitly enables @option{-fcompare-debug}. If
14780 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14781 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14782 is used.
14783
14784 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14785 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14786 of the final representation and the second compilation, preventing even
14787 @env{GCC_COMPARE_DEBUG} from taking effect.
14788
14789 To verify full coverage during @option{-fcompare-debug} testing, set
14790 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14791 which GCC rejects as an invalid option in any actual compilation
14792 (rather than preprocessing, assembly or linking). To get just a
14793 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14794 not overridden} will do.
14795
14796 @item -fcompare-debug-second
14797 @opindex fcompare-debug-second
14798 This option is implicitly passed to the compiler for the second
14799 compilation requested by @option{-fcompare-debug}, along with options to
14800 silence warnings, and omitting other options that would cause the compiler
14801 to produce output to files or to standard output as a side effect. Dump
14802 files and preserved temporary files are renamed so as to contain the
14803 @code{.gk} additional extension during the second compilation, to avoid
14804 overwriting those generated by the first.
14805
14806 When this option is passed to the compiler driver, it causes the
14807 @emph{first} compilation to be skipped, which makes it useful for little
14808 other than debugging the compiler proper.
14809
14810 @item -gtoggle
14811 @opindex gtoggle
14812 Turn off generation of debug info, if leaving out this option
14813 generates it, or turn it on at level 2 otherwise. The position of this
14814 argument in the command line does not matter; it takes effect after all
14815 other options are processed, and it does so only once, no matter how
14816 many times it is given. This is mainly intended to be used with
14817 @option{-fcompare-debug}.
14818
14819 @item -fvar-tracking-assignments-toggle
14820 @opindex fvar-tracking-assignments-toggle
14821 @opindex fno-var-tracking-assignments-toggle
14822 Toggle @option{-fvar-tracking-assignments}, in the same way that
14823 @option{-gtoggle} toggles @option{-g}.
14824
14825 @item -Q
14826 @opindex Q
14827 Makes the compiler print out each function name as it is compiled, and
14828 print some statistics about each pass when it finishes.
14829
14830 @item -ftime-report
14831 @opindex ftime-report
14832 Makes the compiler print some statistics about the time consumed by each
14833 pass when it finishes.
14834
14835 @item -ftime-report-details
14836 @opindex ftime-report-details
14837 Record the time consumed by infrastructure parts separately for each pass.
14838
14839 @item -fira-verbose=@var{n}
14840 @opindex fira-verbose
14841 Control the verbosity of the dump file for the integrated register allocator.
14842 The default value is 5. If the value @var{n} is greater or equal to 10,
14843 the dump output is sent to stderr using the same format as @var{n} minus 10.
14844
14845 @item -flto-report
14846 @opindex flto-report
14847 Prints a report with internal details on the workings of the link-time
14848 optimizer. The contents of this report vary from version to version.
14849 It is meant to be useful to GCC developers when processing object
14850 files in LTO mode (via @option{-flto}).
14851
14852 Disabled by default.
14853
14854 @item -flto-report-wpa
14855 @opindex flto-report-wpa
14856 Like @option{-flto-report}, but only print for the WPA phase of Link
14857 Time Optimization.
14858
14859 @item -fmem-report
14860 @opindex fmem-report
14861 Makes the compiler print some statistics about permanent memory
14862 allocation when it finishes.
14863
14864 @item -fmem-report-wpa
14865 @opindex fmem-report-wpa
14866 Makes the compiler print some statistics about permanent memory
14867 allocation for the WPA phase only.
14868
14869 @item -fpre-ipa-mem-report
14870 @opindex fpre-ipa-mem-report
14871 @item -fpost-ipa-mem-report
14872 @opindex fpost-ipa-mem-report
14873 Makes the compiler print some statistics about permanent memory
14874 allocation before or after interprocedural optimization.
14875
14876 @item -fprofile-report
14877 @opindex fprofile-report
14878 Makes the compiler print some statistics about consistency of the
14879 (estimated) profile and effect of individual passes.
14880
14881 @item -fstack-usage
14882 @opindex fstack-usage
14883 Makes the compiler output stack usage information for the program, on a
14884 per-function basis. The filename for the dump is made by appending
14885 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14886 the output file, if explicitly specified and it is not an executable,
14887 otherwise it is the basename of the source file. An entry is made up
14888 of three fields:
14889
14890 @itemize
14891 @item
14892 The name of the function.
14893 @item
14894 A number of bytes.
14895 @item
14896 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14897 @end itemize
14898
14899 The qualifier @code{static} means that the function manipulates the stack
14900 statically: a fixed number of bytes are allocated for the frame on function
14901 entry and released on function exit; no stack adjustments are otherwise made
14902 in the function. The second field is this fixed number of bytes.
14903
14904 The qualifier @code{dynamic} means that the function manipulates the stack
14905 dynamically: in addition to the static allocation described above, stack
14906 adjustments are made in the body of the function, for example to push/pop
14907 arguments around function calls. If the qualifier @code{bounded} is also
14908 present, the amount of these adjustments is bounded at compile time and
14909 the second field is an upper bound of the total amount of stack used by
14910 the function. If it is not present, the amount of these adjustments is
14911 not bounded at compile time and the second field only represents the
14912 bounded part.
14913
14914 @item -fstats
14915 @opindex fstats
14916 Emit statistics about front-end processing at the end of the compilation.
14917 This option is supported only by the C++ front end, and
14918 the information is generally only useful to the G++ development team.
14919
14920 @item -fdbg-cnt-list
14921 @opindex fdbg-cnt-list
14922 Print the name and the counter upper bound for all debug counters.
14923
14924
14925 @item -fdbg-cnt=@var{counter-value-list}
14926 @opindex fdbg-cnt
14927 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14928 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14929 tuples which sets the lower and the upper bound of each debug
14930 counter @var{name}. The @var{lower_bound} is optional and is zero
14931 initialized if not set.
14932 All debug counters have the initial upper bound of @code{UINT_MAX};
14933 thus @code{dbg_cnt} returns true always unless the upper bound
14934 is set by this option.
14935 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14936 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14937 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14938
14939 @item -print-file-name=@var{library}
14940 @opindex print-file-name
14941 Print the full absolute name of the library file @var{library} that
14942 would be used when linking---and don't do anything else. With this
14943 option, GCC does not compile or link anything; it just prints the
14944 file name.
14945
14946 @item -print-multi-directory
14947 @opindex print-multi-directory
14948 Print the directory name corresponding to the multilib selected by any
14949 other switches present in the command line. This directory is supposed
14950 to exist in @env{GCC_EXEC_PREFIX}.
14951
14952 @item -print-multi-lib
14953 @opindex print-multi-lib
14954 Print the mapping from multilib directory names to compiler switches
14955 that enable them. The directory name is separated from the switches by
14956 @samp{;}, and each switch starts with an @samp{@@} instead of the
14957 @samp{-}, without spaces between multiple switches. This is supposed to
14958 ease shell processing.
14959
14960 @item -print-multi-os-directory
14961 @opindex print-multi-os-directory
14962 Print the path to OS libraries for the selected
14963 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14964 present in the @file{lib} subdirectory and no multilibs are used, this is
14965 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14966 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14967 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14968 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14969
14970 @item -print-multiarch
14971 @opindex print-multiarch
14972 Print the path to OS libraries for the selected multiarch,
14973 relative to some @file{lib} subdirectory.
14974
14975 @item -print-prog-name=@var{program}
14976 @opindex print-prog-name
14977 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14978
14979 @item -print-libgcc-file-name
14980 @opindex print-libgcc-file-name
14981 Same as @option{-print-file-name=libgcc.a}.
14982
14983 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14984 but you do want to link with @file{libgcc.a}. You can do:
14985
14986 @smallexample
14987 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14988 @end smallexample
14989
14990 @item -print-search-dirs
14991 @opindex print-search-dirs
14992 Print the name of the configured installation directory and a list of
14993 program and library directories @command{gcc} searches---and don't do anything else.
14994
14995 This is useful when @command{gcc} prints the error message
14996 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14997 To resolve this you either need to put @file{cpp0} and the other compiler
14998 components where @command{gcc} expects to find them, or you can set the environment
14999 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15000 Don't forget the trailing @samp{/}.
15001 @xref{Environment Variables}.
15002
15003 @item -print-sysroot
15004 @opindex print-sysroot
15005 Print the target sysroot directory that is used during
15006 compilation. This is the target sysroot specified either at configure
15007 time or using the @option{--sysroot} option, possibly with an extra
15008 suffix that depends on compilation options. If no target sysroot is
15009 specified, the option prints nothing.
15010
15011 @item -print-sysroot-headers-suffix
15012 @opindex print-sysroot-headers-suffix
15013 Print the suffix added to the target sysroot when searching for
15014 headers, or give an error if the compiler is not configured with such
15015 a suffix---and don't do anything else.
15016
15017 @item -dumpmachine
15018 @opindex dumpmachine
15019 Print the compiler's target machine (for example,
15020 @samp{i686-pc-linux-gnu})---and don't do anything else.
15021
15022 @item -dumpversion
15023 @opindex dumpversion
15024 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15025 anything else. This is the compiler version used in filesystem paths and
15026 specs. Depending on how the compiler has been configured it can be just
15027 a single number (major version), two numbers separated by a dot (major and
15028 minor version) or three numbers separated by dots (major, minor and patchlevel
15029 version).
15030
15031 @item -dumpfullversion
15032 @opindex dumpfullversion
15033 Print the full compiler version---and don't do anything else. The output is
15034 always three numbers separated by dots, major, minor and patchlevel version.
15035
15036 @item -dumpspecs
15037 @opindex dumpspecs
15038 Print the compiler's built-in specs---and don't do anything else. (This
15039 is used when GCC itself is being built.) @xref{Spec Files}.
15040 @end table
15041
15042 @node Submodel Options
15043 @section Machine-Dependent Options
15044 @cindex submodel options
15045 @cindex specifying hardware config
15046 @cindex hardware models and configurations, specifying
15047 @cindex target-dependent options
15048 @cindex machine-dependent options
15049
15050 Each target machine supported by GCC can have its own options---for
15051 example, to allow you to compile for a particular processor variant or
15052 ABI, or to control optimizations specific to that machine. By
15053 convention, the names of machine-specific options start with
15054 @samp{-m}.
15055
15056 Some configurations of the compiler also support additional target-specific
15057 options, usually for compatibility with other compilers on the same
15058 platform.
15059
15060 @c This list is ordered alphanumerically by subsection name.
15061 @c It should be the same order and spelling as these options are listed
15062 @c in Machine Dependent Options
15063
15064 @menu
15065 * AArch64 Options::
15066 * Adapteva Epiphany Options::
15067 * ARC Options::
15068 * ARM Options::
15069 * AVR Options::
15070 * Blackfin Options::
15071 * C6X Options::
15072 * CRIS Options::
15073 * CR16 Options::
15074 * C-SKY Options::
15075 * Darwin Options::
15076 * DEC Alpha Options::
15077 * FR30 Options::
15078 * FT32 Options::
15079 * FRV Options::
15080 * GNU/Linux Options::
15081 * H8/300 Options::
15082 * HPPA Options::
15083 * IA-64 Options::
15084 * LM32 Options::
15085 * M32C Options::
15086 * M32R/D Options::
15087 * M680x0 Options::
15088 * MCore Options::
15089 * MeP Options::
15090 * MicroBlaze Options::
15091 * MIPS Options::
15092 * MMIX Options::
15093 * MN10300 Options::
15094 * Moxie Options::
15095 * MSP430 Options::
15096 * NDS32 Options::
15097 * Nios II Options::
15098 * Nvidia PTX Options::
15099 * OpenRISC Options::
15100 * PDP-11 Options::
15101 * picoChip Options::
15102 * PowerPC Options::
15103 * PowerPC SPE Options::
15104 * RISC-V Options::
15105 * RL78 Options::
15106 * RS/6000 and PowerPC Options::
15107 * RX Options::
15108 * S/390 and zSeries Options::
15109 * Score Options::
15110 * SH Options::
15111 * Solaris 2 Options::
15112 * SPARC Options::
15113 * SPU Options::
15114 * System V Options::
15115 * TILE-Gx Options::
15116 * TILEPro Options::
15117 * V850 Options::
15118 * VAX Options::
15119 * Visium Options::
15120 * VMS Options::
15121 * VxWorks Options::
15122 * x86 Options::
15123 * x86 Windows Options::
15124 * Xstormy16 Options::
15125 * Xtensa Options::
15126 * zSeries Options::
15127 @end menu
15128
15129 @node AArch64 Options
15130 @subsection AArch64 Options
15131 @cindex AArch64 Options
15132
15133 These options are defined for AArch64 implementations:
15134
15135 @table @gcctabopt
15136
15137 @item -mabi=@var{name}
15138 @opindex mabi
15139 Generate code for the specified data model. Permissible values
15140 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15141 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15142 but long int and pointers are 64 bits.
15143
15144 The default depends on the specific target configuration. Note that
15145 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15146 entire program with the same ABI, and link with a compatible set of libraries.
15147
15148 @item -mbig-endian
15149 @opindex mbig-endian
15150 Generate big-endian code. This is the default when GCC is configured for an
15151 @samp{aarch64_be-*-*} target.
15152
15153 @item -mgeneral-regs-only
15154 @opindex mgeneral-regs-only
15155 Generate code which uses only the general-purpose registers. This will prevent
15156 the compiler from using floating-point and Advanced SIMD registers but will not
15157 impose any restrictions on the assembler.
15158
15159 @item -mlittle-endian
15160 @opindex mlittle-endian
15161 Generate little-endian code. This is the default when GCC is configured for an
15162 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15163
15164 @item -mcmodel=tiny
15165 @opindex mcmodel=tiny
15166 Generate code for the tiny code model. The program and its statically defined
15167 symbols must be within 1MB of each other. Programs can be statically or
15168 dynamically linked.
15169
15170 @item -mcmodel=small
15171 @opindex mcmodel=small
15172 Generate code for the small code model. The program and its statically defined
15173 symbols must be within 4GB of each other. Programs can be statically or
15174 dynamically linked. This is the default code model.
15175
15176 @item -mcmodel=large
15177 @opindex mcmodel=large
15178 Generate code for the large code model. This makes no assumptions about
15179 addresses and sizes of sections. Programs can be statically linked only.
15180
15181 @item -mstrict-align
15182 @itemx -mno-strict-align
15183 @opindex mstrict-align
15184 @opindex mno-strict-align
15185 Avoid or allow generating memory accesses that may not be aligned on a natural
15186 object boundary as described in the architecture specification.
15187
15188 @item -momit-leaf-frame-pointer
15189 @itemx -mno-omit-leaf-frame-pointer
15190 @opindex momit-leaf-frame-pointer
15191 @opindex mno-omit-leaf-frame-pointer
15192 Omit or keep the frame pointer in leaf functions. The former behavior is the
15193 default.
15194
15195 @item -mtls-dialect=desc
15196 @opindex mtls-dialect=desc
15197 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15198 of TLS variables. This is the default.
15199
15200 @item -mtls-dialect=traditional
15201 @opindex mtls-dialect=traditional
15202 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15203 of TLS variables.
15204
15205 @item -mtls-size=@var{size}
15206 @opindex mtls-size
15207 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15208 This option requires binutils 2.26 or newer.
15209
15210 @item -mfix-cortex-a53-835769
15211 @itemx -mno-fix-cortex-a53-835769
15212 @opindex mfix-cortex-a53-835769
15213 @opindex mno-fix-cortex-a53-835769
15214 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15215 This involves inserting a NOP instruction between memory instructions and
15216 64-bit integer multiply-accumulate instructions.
15217
15218 @item -mfix-cortex-a53-843419
15219 @itemx -mno-fix-cortex-a53-843419
15220 @opindex mfix-cortex-a53-843419
15221 @opindex mno-fix-cortex-a53-843419
15222 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15223 This erratum workaround is made at link time and this will only pass the
15224 corresponding flag to the linker.
15225
15226 @item -mlow-precision-recip-sqrt
15227 @itemx -mno-low-precision-recip-sqrt
15228 @opindex mlow-precision-recip-sqrt
15229 @opindex mno-low-precision-recip-sqrt
15230 Enable or disable the reciprocal square root approximation.
15231 This option only has an effect if @option{-ffast-math} or
15232 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15233 precision of reciprocal square root results to about 16 bits for
15234 single precision and to 32 bits for double precision.
15235
15236 @item -mlow-precision-sqrt
15237 @itemx -mno-low-precision-sqrt
15238 @opindex mlow-precision-sqrt
15239 @opindex mno-low-precision-sqrt
15240 Enable or disable the square root approximation.
15241 This option only has an effect if @option{-ffast-math} or
15242 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15243 precision of square root results to about 16 bits for
15244 single precision and to 32 bits for double precision.
15245 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15246
15247 @item -mlow-precision-div
15248 @itemx -mno-low-precision-div
15249 @opindex mlow-precision-div
15250 @opindex mno-low-precision-div
15251 Enable or disable the division approximation.
15252 This option only has an effect if @option{-ffast-math} or
15253 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15254 precision of division results to about 16 bits for
15255 single precision and to 32 bits for double precision.
15256
15257 @item -mtrack-speculation
15258 @itemx -mno-track-speculation
15259 Enable or disable generation of additional code to track speculative
15260 execution through conditional branches. The tracking state can then
15261 be used by the compiler when expanding calls to
15262 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15263 sequence to be generated.
15264
15265 @item -march=@var{name}
15266 @opindex march
15267 Specify the name of the target architecture and, optionally, one or
15268 more feature modifiers. This option has the form
15269 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15270
15271 The permissible values for @var{arch} are @samp{armv8-a},
15272 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
15273 or @var{native}.
15274
15275 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15276 support for the ARMv8.4-A architecture extensions.
15277
15278 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15279 support for the ARMv8.3-A architecture extensions.
15280
15281 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15282 support for the ARMv8.2-A architecture extensions.
15283
15284 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15285 support for the ARMv8.1-A architecture extension. In particular, it
15286 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15287
15288 The value @samp{native} is available on native AArch64 GNU/Linux and
15289 causes the compiler to pick the architecture of the host system. This
15290 option has no effect if the compiler is unable to recognize the
15291 architecture of the host system,
15292
15293 The permissible values for @var{feature} are listed in the sub-section
15294 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15295 Feature Modifiers}. Where conflicting feature modifiers are
15296 specified, the right-most feature is used.
15297
15298 GCC uses @var{name} to determine what kind of instructions it can emit
15299 when generating assembly code. If @option{-march} is specified
15300 without either of @option{-mtune} or @option{-mcpu} also being
15301 specified, the code is tuned to perform well across a range of target
15302 processors implementing the target architecture.
15303
15304 @item -mtune=@var{name}
15305 @opindex mtune
15306 Specify the name of the target processor for which GCC should tune the
15307 performance of the code. Permissible values for this option are:
15308 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15309 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15310 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{falkor},
15311 @samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15312 @samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15313 @samp{tsv110}, @samp{thunderxt83}, @samp{thunderx2t99},
15314 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15315 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15316 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15317 @samp{native}.
15318
15319 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15320 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15321 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15322 should tune for a big.LITTLE system.
15323
15324 Additionally on native AArch64 GNU/Linux systems the value
15325 @samp{native} tunes performance to the host system. This option has no effect
15326 if the compiler is unable to recognize the processor of the host system.
15327
15328 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15329 are specified, the code is tuned to perform well across a range
15330 of target processors.
15331
15332 This option cannot be suffixed by feature modifiers.
15333
15334 @item -mcpu=@var{name}
15335 @opindex mcpu
15336 Specify the name of the target processor, optionally suffixed by one
15337 or more feature modifiers. This option has the form
15338 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15339 the permissible values for @var{cpu} are the same as those available
15340 for @option{-mtune}. The permissible values for @var{feature} are
15341 documented in the sub-section on
15342 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15343 Feature Modifiers}. Where conflicting feature modifiers are
15344 specified, the right-most feature is used.
15345
15346 GCC uses @var{name} to determine what kind of instructions it can emit when
15347 generating assembly code (as if by @option{-march}) and to determine
15348 the target processor for which to tune for performance (as if
15349 by @option{-mtune}). Where this option is used in conjunction
15350 with @option{-march} or @option{-mtune}, those options take precedence
15351 over the appropriate part of this option.
15352
15353 @item -moverride=@var{string}
15354 @opindex moverride
15355 Override tuning decisions made by the back-end in response to a
15356 @option{-mtune=} switch. The syntax, semantics, and accepted values
15357 for @var{string} in this option are not guaranteed to be consistent
15358 across releases.
15359
15360 This option is only intended to be useful when developing GCC.
15361
15362 @item -mverbose-cost-dump
15363 @opindex mverbose-cost-dump
15364 Enable verbose cost model dumping in the debug dump files. This option is
15365 provided for use in debugging the compiler.
15366
15367 @item -mpc-relative-literal-loads
15368 @itemx -mno-pc-relative-literal-loads
15369 @opindex mpc-relative-literal-loads
15370 @opindex mno-pc-relative-literal-loads
15371 Enable or disable PC-relative literal loads. With this option literal pools are
15372 accessed using a single instruction and emitted after each function. This
15373 limits the maximum size of functions to 1MB. This is enabled by default for
15374 @option{-mcmodel=tiny}.
15375
15376 @item -msign-return-address=@var{scope}
15377 @opindex msign-return-address
15378 Select the function scope on which return address signing will be applied.
15379 Permissible values are @samp{none}, which disables return address signing,
15380 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15381 functions, and @samp{all}, which enables pointer signing for all functions. The
15382 default value is @samp{none}.
15383
15384 @item -msve-vector-bits=@var{bits}
15385 @opindex msve-vector-bits
15386 Specify the number of bits in an SVE vector register. This option only has
15387 an effect when SVE is enabled.
15388
15389 GCC supports two forms of SVE code generation: ``vector-length
15390 agnostic'' output that works with any size of vector register and
15391 ``vector-length specific'' output that only works when the vector
15392 registers are a particular size. Replacing @var{bits} with
15393 @samp{scalable} selects vector-length agnostic output while
15394 replacing it with a number selects vector-length specific output.
15395 The possible lengths in the latter case are: 128, 256, 512, 1024
15396 and 2048. @samp{scalable} is the default.
15397
15398 At present, @samp{-msve-vector-bits=128} produces the same output
15399 as @samp{-msve-vector-bits=scalable}.
15400
15401 @end table
15402
15403 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15404 @anchor{aarch64-feature-modifiers}
15405 @cindex @option{-march} feature modifiers
15406 @cindex @option{-mcpu} feature modifiers
15407 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15408 the following and their inverses @option{no@var{feature}}:
15409
15410 @table @samp
15411 @item crc
15412 Enable CRC extension. This is on by default for
15413 @option{-march=armv8.1-a}.
15414 @item crypto
15415 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15416 instructions.
15417 @item fp
15418 Enable floating-point instructions. This is on by default for all possible
15419 values for options @option{-march} and @option{-mcpu}.
15420 @item simd
15421 Enable Advanced SIMD instructions. This also enables floating-point
15422 instructions. This is on by default for all possible values for options
15423 @option{-march} and @option{-mcpu}.
15424 @item sve
15425 Enable Scalable Vector Extension instructions. This also enables Advanced
15426 SIMD and floating-point instructions.
15427 @item lse
15428 Enable Large System Extension instructions. This is on by default for
15429 @option{-march=armv8.1-a}.
15430 @item rdma
15431 Enable Round Double Multiply Accumulate instructions. This is on by default
15432 for @option{-march=armv8.1-a}.
15433 @item fp16
15434 Enable FP16 extension. This also enables floating-point instructions.
15435 @item fp16fml
15436 Enable FP16 fmla extension. This also enables FP16 extensions and
15437 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.
15438
15439 @item rcpc
15440 Enable the RcPc extension. This does not change code generation from GCC,
15441 but is passed on to the assembler, enabling inline asm statements to use
15442 instructions from the RcPc extension.
15443 @item dotprod
15444 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15445 @item aes
15446 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15447 SIMD instructions.
15448 @item sha2
15449 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15450 @item sha3
15451 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15452 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15453 @item sm4
15454 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15455 Use of this option with architectures prior to Armv8.2-A is not supported.
15456 @item profile
15457 Enable the Statistical Profiling extension. This option is only to enable the
15458 extension at the assembler level and does not affect code generation.
15459
15460 @end table
15461
15462 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15463 which implies @option{fp}.
15464 Conversely, @option{nofp} implies @option{nosimd}, which implies
15465 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15466
15467 @node Adapteva Epiphany Options
15468 @subsection Adapteva Epiphany Options
15469
15470 These @samp{-m} options are defined for Adapteva Epiphany:
15471
15472 @table @gcctabopt
15473 @item -mhalf-reg-file
15474 @opindex mhalf-reg-file
15475 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15476 That allows code to run on hardware variants that lack these registers.
15477
15478 @item -mprefer-short-insn-regs
15479 @opindex mprefer-short-insn-regs
15480 Preferentially allocate registers that allow short instruction generation.
15481 This can result in increased instruction count, so this may either reduce or
15482 increase overall code size.
15483
15484 @item -mbranch-cost=@var{num}
15485 @opindex mbranch-cost
15486 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15487 This cost is only a heuristic and is not guaranteed to produce
15488 consistent results across releases.
15489
15490 @item -mcmove
15491 @opindex mcmove
15492 Enable the generation of conditional moves.
15493
15494 @item -mnops=@var{num}
15495 @opindex mnops
15496 Emit @var{num} NOPs before every other generated instruction.
15497
15498 @item -mno-soft-cmpsf
15499 @opindex mno-soft-cmpsf
15500 @opindex msoft-cmpsf
15501 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15502 and test the flags. This is faster than a software comparison, but can
15503 get incorrect results in the presence of NaNs, or when two different small
15504 numbers are compared such that their difference is calculated as zero.
15505 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15506 software comparisons.
15507
15508 @item -mstack-offset=@var{num}
15509 @opindex mstack-offset
15510 Set the offset between the top of the stack and the stack pointer.
15511 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15512 can be used by leaf functions without stack allocation.
15513 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15514 Note also that this option changes the ABI; compiling a program with a
15515 different stack offset than the libraries have been compiled with
15516 generally does not work.
15517 This option can be useful if you want to evaluate if a different stack
15518 offset would give you better code, but to actually use a different stack
15519 offset to build working programs, it is recommended to configure the
15520 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15521
15522 @item -mno-round-nearest
15523 @opindex mno-round-nearest
15524 @opindex mround-nearest
15525 Make the scheduler assume that the rounding mode has been set to
15526 truncating. The default is @option{-mround-nearest}.
15527
15528 @item -mlong-calls
15529 @opindex mlong-calls
15530 If not otherwise specified by an attribute, assume all calls might be beyond
15531 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15532 function address into a register before performing a (otherwise direct) call.
15533 This is the default.
15534
15535 @item -mshort-calls
15536 @opindex short-calls
15537 If not otherwise specified by an attribute, assume all direct calls are
15538 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15539 for direct calls. The default is @option{-mlong-calls}.
15540
15541 @item -msmall16
15542 @opindex msmall16
15543 Assume addresses can be loaded as 16-bit unsigned values. This does not
15544 apply to function addresses for which @option{-mlong-calls} semantics
15545 are in effect.
15546
15547 @item -mfp-mode=@var{mode}
15548 @opindex mfp-mode
15549 Set the prevailing mode of the floating-point unit.
15550 This determines the floating-point mode that is provided and expected
15551 at function call and return time. Making this mode match the mode you
15552 predominantly need at function start can make your programs smaller and
15553 faster by avoiding unnecessary mode switches.
15554
15555 @var{mode} can be set to one the following values:
15556
15557 @table @samp
15558 @item caller
15559 Any mode at function entry is valid, and retained or restored when
15560 the function returns, and when it calls other functions.
15561 This mode is useful for compiling libraries or other compilation units
15562 you might want to incorporate into different programs with different
15563 prevailing FPU modes, and the convenience of being able to use a single
15564 object file outweighs the size and speed overhead for any extra
15565 mode switching that might be needed, compared with what would be needed
15566 with a more specific choice of prevailing FPU mode.
15567
15568 @item truncate
15569 This is the mode used for floating-point calculations with
15570 truncating (i.e.@: round towards zero) rounding mode. That includes
15571 conversion from floating point to integer.
15572
15573 @item round-nearest
15574 This is the mode used for floating-point calculations with
15575 round-to-nearest-or-even rounding mode.
15576
15577 @item int
15578 This is the mode used to perform integer calculations in the FPU, e.g.@:
15579 integer multiply, or integer multiply-and-accumulate.
15580 @end table
15581
15582 The default is @option{-mfp-mode=caller}
15583
15584 @item -mno-split-lohi
15585 @itemx -mno-postinc
15586 @itemx -mno-postmodify
15587 @opindex mno-split-lohi
15588 @opindex msplit-lohi
15589 @opindex mno-postinc
15590 @opindex mpostinc
15591 @opindex mno-postmodify
15592 @opindex mpostmodify
15593 Code generation tweaks that disable, respectively, splitting of 32-bit
15594 loads, generation of post-increment addresses, and generation of
15595 post-modify addresses. The defaults are @option{msplit-lohi},
15596 @option{-mpost-inc}, and @option{-mpost-modify}.
15597
15598 @item -mnovect-double
15599 @opindex mno-vect-double
15600 @opindex mvect-double
15601 Change the preferred SIMD mode to SImode. The default is
15602 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15603
15604 @item -max-vect-align=@var{num}
15605 @opindex max-vect-align
15606 The maximum alignment for SIMD vector mode types.
15607 @var{num} may be 4 or 8. The default is 8.
15608 Note that this is an ABI change, even though many library function
15609 interfaces are unaffected if they don't use SIMD vector modes
15610 in places that affect size and/or alignment of relevant types.
15611
15612 @item -msplit-vecmove-early
15613 @opindex msplit-vecmove-early
15614 Split vector moves into single word moves before reload. In theory this
15615 can give better register allocation, but so far the reverse seems to be
15616 generally the case.
15617
15618 @item -m1reg-@var{reg}
15619 @opindex m1reg-
15620 Specify a register to hold the constant @minus{}1, which makes loading small negative
15621 constants and certain bitmasks faster.
15622 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15623 which specify use of that register as a fixed register,
15624 and @samp{none}, which means that no register is used for this
15625 purpose. The default is @option{-m1reg-none}.
15626
15627 @end table
15628
15629 @node ARC Options
15630 @subsection ARC Options
15631 @cindex ARC options
15632
15633 The following options control the architecture variant for which code
15634 is being compiled:
15635
15636 @c architecture variants
15637 @table @gcctabopt
15638
15639 @item -mbarrel-shifter
15640 @opindex mbarrel-shifter
15641 Generate instructions supported by barrel shifter. This is the default
15642 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15643
15644 @item -mjli-always
15645 @opindex mjli-alawys
15646 Force to call a function using jli_s instruction. This option is
15647 valid only for ARCv2 architecture.
15648
15649 @item -mcpu=@var{cpu}
15650 @opindex mcpu
15651 Set architecture type, register usage, and instruction scheduling
15652 parameters for @var{cpu}. There are also shortcut alias options
15653 available for backward compatibility and convenience. Supported
15654 values for @var{cpu} are
15655
15656 @table @samp
15657 @opindex mA6
15658 @opindex mARC600
15659 @item arc600
15660 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15661
15662 @item arc601
15663 @opindex mARC601
15664 Compile for ARC601. Alias: @option{-mARC601}.
15665
15666 @item arc700
15667 @opindex mA7
15668 @opindex mARC700
15669 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15670 This is the default when configured with @option{--with-cpu=arc700}@.
15671
15672 @item arcem
15673 Compile for ARC EM.
15674
15675 @item archs
15676 Compile for ARC HS.
15677
15678 @item em
15679 Compile for ARC EM CPU with no hardware extensions.
15680
15681 @item em4
15682 Compile for ARC EM4 CPU.
15683
15684 @item em4_dmips
15685 Compile for ARC EM4 DMIPS CPU.
15686
15687 @item em4_fpus
15688 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15689 extension.
15690
15691 @item em4_fpuda
15692 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15693 double assist instructions.
15694
15695 @item hs
15696 Compile for ARC HS CPU with no hardware extensions except the atomic
15697 instructions.
15698
15699 @item hs34
15700 Compile for ARC HS34 CPU.
15701
15702 @item hs38
15703 Compile for ARC HS38 CPU.
15704
15705 @item hs38_linux
15706 Compile for ARC HS38 CPU with all hardware extensions on.
15707
15708 @item arc600_norm
15709 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15710
15711 @item arc600_mul32x16
15712 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15713 instructions enabled.
15714
15715 @item arc600_mul64
15716 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15717 instructions enabled.
15718
15719 @item arc601_norm
15720 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15721
15722 @item arc601_mul32x16
15723 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15724 instructions enabled.
15725
15726 @item arc601_mul64
15727 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15728 instructions enabled.
15729
15730 @item nps400
15731 Compile for ARC 700 on NPS400 chip.
15732
15733 @item em_mini
15734 Compile for ARC EM minimalist configuration featuring reduced register
15735 set.
15736
15737 @end table
15738
15739 @item -mdpfp
15740 @opindex mdpfp
15741 @itemx -mdpfp-compact
15742 @opindex mdpfp-compact
15743 Generate double-precision FPX instructions, tuned for the compact
15744 implementation.
15745
15746 @item -mdpfp-fast
15747 @opindex mdpfp-fast
15748 Generate double-precision FPX instructions, tuned for the fast
15749 implementation.
15750
15751 @item -mno-dpfp-lrsr
15752 @opindex mno-dpfp-lrsr
15753 Disable @code{lr} and @code{sr} instructions from using FPX extension
15754 aux registers.
15755
15756 @item -mea
15757 @opindex mea
15758 Generate extended arithmetic instructions. Currently only
15759 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15760 supported. This is always enabled for @option{-mcpu=ARC700}.
15761
15762 @item -mno-mpy
15763 @opindex mno-mpy
15764 @opindex mmpy
15765 Do not generate @code{mpy}-family instructions for ARC700. This option is
15766 deprecated.
15767
15768 @item -mmul32x16
15769 @opindex mmul32x16
15770 Generate 32x16-bit multiply and multiply-accumulate instructions.
15771
15772 @item -mmul64
15773 @opindex mmul64
15774 Generate @code{mul64} and @code{mulu64} instructions.
15775 Only valid for @option{-mcpu=ARC600}.
15776
15777 @item -mnorm
15778 @opindex mnorm
15779 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15780 is in effect.
15781
15782 @item -mspfp
15783 @opindex mspfp
15784 @itemx -mspfp-compact
15785 @opindex mspfp-compact
15786 Generate single-precision FPX instructions, tuned for the compact
15787 implementation.
15788
15789 @item -mspfp-fast
15790 @opindex mspfp-fast
15791 Generate single-precision FPX instructions, tuned for the fast
15792 implementation.
15793
15794 @item -msimd
15795 @opindex msimd
15796 Enable generation of ARC SIMD instructions via target-specific
15797 builtins. Only valid for @option{-mcpu=ARC700}.
15798
15799 @item -msoft-float
15800 @opindex msoft-float
15801 This option ignored; it is provided for compatibility purposes only.
15802 Software floating-point code is emitted by default, and this default
15803 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15804 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15805 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15806
15807 @item -mswap
15808 @opindex mswap
15809 Generate @code{swap} instructions.
15810
15811 @item -matomic
15812 @opindex matomic
15813 This enables use of the locked load/store conditional extension to implement
15814 atomic memory built-in functions. Not available for ARC 6xx or ARC
15815 EM cores.
15816
15817 @item -mdiv-rem
15818 @opindex mdiv-rem
15819 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15820
15821 @item -mcode-density
15822 @opindex mcode-density
15823 Enable code density instructions for ARC EM.
15824 This option is on by default for ARC HS.
15825
15826 @item -mll64
15827 @opindex mll64
15828 Enable double load/store operations for ARC HS cores.
15829
15830 @item -mtp-regno=@var{regno}
15831 @opindex mtp-regno
15832 Specify thread pointer register number.
15833
15834 @item -mmpy-option=@var{multo}
15835 @opindex mmpy-option
15836 Compile ARCv2 code with a multiplier design option. You can specify
15837 the option using either a string or numeric value for @var{multo}.
15838 @samp{wlh1} is the default value. The recognized values are:
15839
15840 @table @samp
15841 @item 0
15842 @itemx none
15843 No multiplier available.
15844
15845 @item 1
15846 @itemx w
15847 16x16 multiplier, fully pipelined.
15848 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15849
15850 @item 2
15851 @itemx wlh1
15852 32x32 multiplier, fully
15853 pipelined (1 stage). The following instructions are additionally
15854 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15855
15856 @item 3
15857 @itemx wlh2
15858 32x32 multiplier, fully pipelined
15859 (2 stages). The following instructions are additionally enabled: @code{mpy},
15860 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15861
15862 @item 4
15863 @itemx wlh3
15864 Two 16x16 multipliers, blocking,
15865 sequential. The following instructions are additionally enabled: @code{mpy},
15866 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15867
15868 @item 5
15869 @itemx wlh4
15870 One 16x16 multiplier, blocking,
15871 sequential. The following instructions are additionally enabled: @code{mpy},
15872 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15873
15874 @item 6
15875 @itemx wlh5
15876 One 32x4 multiplier, blocking,
15877 sequential. The following instructions are additionally enabled: @code{mpy},
15878 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15879
15880 @item 7
15881 @itemx plus_dmpy
15882 ARC HS SIMD support.
15883
15884 @item 8
15885 @itemx plus_macd
15886 ARC HS SIMD support.
15887
15888 @item 9
15889 @itemx plus_qmacw
15890 ARC HS SIMD support.
15891
15892 @end table
15893
15894 This option is only available for ARCv2 cores@.
15895
15896 @item -mfpu=@var{fpu}
15897 @opindex mfpu
15898 Enables support for specific floating-point hardware extensions for ARCv2
15899 cores. Supported values for @var{fpu} are:
15900
15901 @table @samp
15902
15903 @item fpus
15904 Enables support for single-precision floating-point hardware
15905 extensions@.
15906
15907 @item fpud
15908 Enables support for double-precision floating-point hardware
15909 extensions. The single-precision floating-point extension is also
15910 enabled. Not available for ARC EM@.
15911
15912 @item fpuda
15913 Enables support for double-precision floating-point hardware
15914 extensions using double-precision assist instructions. The single-precision
15915 floating-point extension is also enabled. This option is
15916 only available for ARC EM@.
15917
15918 @item fpuda_div
15919 Enables support for double-precision floating-point hardware
15920 extensions using double-precision assist instructions.
15921 The single-precision floating-point, square-root, and divide
15922 extensions are also enabled. This option is
15923 only available for ARC EM@.
15924
15925 @item fpuda_fma
15926 Enables support for double-precision floating-point hardware
15927 extensions using double-precision assist instructions.
15928 The single-precision floating-point and fused multiply and add
15929 hardware extensions are also enabled. This option is
15930 only available for ARC EM@.
15931
15932 @item fpuda_all
15933 Enables support for double-precision floating-point hardware
15934 extensions using double-precision assist instructions.
15935 All single-precision floating-point hardware extensions are also
15936 enabled. This option is only available for ARC EM@.
15937
15938 @item fpus_div
15939 Enables support for single-precision floating-point, square-root and divide
15940 hardware extensions@.
15941
15942 @item fpud_div
15943 Enables support for double-precision floating-point, square-root and divide
15944 hardware extensions. This option
15945 includes option @samp{fpus_div}. Not available for ARC EM@.
15946
15947 @item fpus_fma
15948 Enables support for single-precision floating-point and
15949 fused multiply and add hardware extensions@.
15950
15951 @item fpud_fma
15952 Enables support for double-precision floating-point and
15953 fused multiply and add hardware extensions. This option
15954 includes option @samp{fpus_fma}. Not available for ARC EM@.
15955
15956 @item fpus_all
15957 Enables support for all single-precision floating-point hardware
15958 extensions@.
15959
15960 @item fpud_all
15961 Enables support for all single- and double-precision floating-point
15962 hardware extensions. Not available for ARC EM@.
15963
15964 @end table
15965
15966 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15967 @opindex mirq-ctrl-saved
15968 Specifies general-purposes registers that the processor automatically
15969 saves/restores on interrupt entry and exit. @var{register-range} is
15970 specified as two registers separated by a dash. The register range
15971 always starts with @code{r0}, the upper limit is @code{fp} register.
15972 @var{blink} and @var{lp_count} are optional. This option is only
15973 valid for ARC EM and ARC HS cores.
15974
15975 @item -mrgf-banked-regs=@var{number}
15976 @opindex mrgf-banked-regs
15977 Specifies the number of registers replicated in second register bank
15978 on entry to fast interrupt. Fast interrupts are interrupts with the
15979 highest priority level P0. These interrupts save only PC and STATUS32
15980 registers to avoid memory transactions during interrupt entry and exit
15981 sequences. Use this option when you are using fast interrupts in an
15982 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15983
15984 @item -mlpc-width=@var{width}
15985 @opindex mlpc-width
15986 Specify the width of the @code{lp_count} register. Valid values for
15987 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15988 fixed to 32 bits. If the width is less than 32, the compiler does not
15989 attempt to transform loops in your program to use the zero-delay loop
15990 mechanism unless it is known that the @code{lp_count} register can
15991 hold the required loop-counter value. Depending on the width
15992 specified, the compiler and run-time library might continue to use the
15993 loop mechanism for various needs. This option defines macro
15994 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15995
15996 @item -mrf16
15997 @opindex mrf16
15998 This option instructs the compiler to generate code for a 16-entry
15999 register file. This option defines the @code{__ARC_RF16__}
16000 preprocessor macro.
16001
16002 @item -mbranch-index
16003 @opindex mbranch-index
16004 Enable use of @code{bi} or @code{bih} instructions to implement jump
16005 tables.
16006
16007 @end table
16008
16009 The following options are passed through to the assembler, and also
16010 define preprocessor macro symbols.
16011
16012 @c Flags used by the assembler, but for which we define preprocessor
16013 @c macro symbols as well.
16014 @table @gcctabopt
16015 @item -mdsp-packa
16016 @opindex mdsp-packa
16017 Passed down to the assembler to enable the DSP Pack A extensions.
16018 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16019 deprecated.
16020
16021 @item -mdvbf
16022 @opindex mdvbf
16023 Passed down to the assembler to enable the dual Viterbi butterfly
16024 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16025 option is deprecated.
16026
16027 @c ARC700 4.10 extension instruction
16028 @item -mlock
16029 @opindex mlock
16030 Passed down to the assembler to enable the locked load/store
16031 conditional extension. Also sets the preprocessor symbol
16032 @code{__Xlock}.
16033
16034 @item -mmac-d16
16035 @opindex mmac-d16
16036 Passed down to the assembler. Also sets the preprocessor symbol
16037 @code{__Xxmac_d16}. This option is deprecated.
16038
16039 @item -mmac-24
16040 @opindex mmac-24
16041 Passed down to the assembler. Also sets the preprocessor symbol
16042 @code{__Xxmac_24}. This option is deprecated.
16043
16044 @c ARC700 4.10 extension instruction
16045 @item -mrtsc
16046 @opindex mrtsc
16047 Passed down to the assembler to enable the 64-bit time-stamp counter
16048 extension instruction. Also sets the preprocessor symbol
16049 @code{__Xrtsc}. This option is deprecated.
16050
16051 @c ARC700 4.10 extension instruction
16052 @item -mswape
16053 @opindex mswape
16054 Passed down to the assembler to enable the swap byte ordering
16055 extension instruction. Also sets the preprocessor symbol
16056 @code{__Xswape}.
16057
16058 @item -mtelephony
16059 @opindex mtelephony
16060 Passed down to the assembler to enable dual- and single-operand
16061 instructions for telephony. Also sets the preprocessor symbol
16062 @code{__Xtelephony}. This option is deprecated.
16063
16064 @item -mxy
16065 @opindex mxy
16066 Passed down to the assembler to enable the XY memory extension. Also
16067 sets the preprocessor symbol @code{__Xxy}.
16068
16069 @end table
16070
16071 The following options control how the assembly code is annotated:
16072
16073 @c Assembly annotation options
16074 @table @gcctabopt
16075 @item -misize
16076 @opindex misize
16077 Annotate assembler instructions with estimated addresses.
16078
16079 @item -mannotate-align
16080 @opindex mannotate-align
16081 Explain what alignment considerations lead to the decision to make an
16082 instruction short or long.
16083
16084 @end table
16085
16086 The following options are passed through to the linker:
16087
16088 @c options passed through to the linker
16089 @table @gcctabopt
16090 @item -marclinux
16091 @opindex marclinux
16092 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16093 This option is enabled by default in tool chains built for
16094 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16095 when profiling is not requested.
16096
16097 @item -marclinux_prof
16098 @opindex marclinux_prof
16099 Passed through to the linker, to specify use of the
16100 @code{arclinux_prof} emulation. This option is enabled by default in
16101 tool chains built for @w{@code{arc-linux-uclibc}} and
16102 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16103
16104 @end table
16105
16106 The following options control the semantics of generated code:
16107
16108 @c semantically relevant code generation options
16109 @table @gcctabopt
16110 @item -mlong-calls
16111 @opindex mlong-calls
16112 Generate calls as register indirect calls, thus providing access
16113 to the full 32-bit address range.
16114
16115 @item -mmedium-calls
16116 @opindex mmedium-calls
16117 Don't use less than 25-bit addressing range for calls, which is the
16118 offset available for an unconditional branch-and-link
16119 instruction. Conditional execution of function calls is suppressed, to
16120 allow use of the 25-bit range, rather than the 21-bit range with
16121 conditional branch-and-link. This is the default for tool chains built
16122 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16123
16124 @item -G @var{num}
16125 @opindex G
16126 Put definitions of externally-visible data in a small data section if
16127 that data is no bigger than @var{num} bytes. The default value of
16128 @var{num} is 4 for any ARC configuration, or 8 when we have double
16129 load/store operations.
16130
16131 @item -mno-sdata
16132 @opindex mno-sdata
16133 @opindex msdata
16134 Do not generate sdata references. This is the default for tool chains
16135 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16136 targets.
16137
16138 @item -mvolatile-cache
16139 @opindex mvolatile-cache
16140 Use ordinarily cached memory accesses for volatile references. This is the
16141 default.
16142
16143 @item -mno-volatile-cache
16144 @opindex mno-volatile-cache
16145 @opindex mvolatile-cache
16146 Enable cache bypass for volatile references.
16147
16148 @end table
16149
16150 The following options fine tune code generation:
16151 @c code generation tuning options
16152 @table @gcctabopt
16153 @item -malign-call
16154 @opindex malign-call
16155 Do alignment optimizations for call instructions.
16156
16157 @item -mauto-modify-reg
16158 @opindex mauto-modify-reg
16159 Enable the use of pre/post modify with register displacement.
16160
16161 @item -mbbit-peephole
16162 @opindex mbbit-peephole
16163 Enable bbit peephole2.
16164
16165 @item -mno-brcc
16166 @opindex mno-brcc
16167 This option disables a target-specific pass in @file{arc_reorg} to
16168 generate compare-and-branch (@code{br@var{cc}}) instructions.
16169 It has no effect on
16170 generation of these instructions driven by the combiner pass.
16171
16172 @item -mcase-vector-pcrel
16173 @opindex mcase-vector-pcrel
16174 Use PC-relative switch case tables to enable case table shortening.
16175 This is the default for @option{-Os}.
16176
16177 @item -mcompact-casesi
16178 @opindex mcompact-casesi
16179 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16180 and only available for ARCv1 cores. This option is deprecated.
16181
16182 @item -mno-cond-exec
16183 @opindex mno-cond-exec
16184 Disable the ARCompact-specific pass to generate conditional
16185 execution instructions.
16186
16187 Due to delay slot scheduling and interactions between operand numbers,
16188 literal sizes, instruction lengths, and the support for conditional execution,
16189 the target-independent pass to generate conditional execution is often lacking,
16190 so the ARC port has kept a special pass around that tries to find more
16191 conditional execution generation opportunities after register allocation,
16192 branch shortening, and delay slot scheduling have been done. This pass
16193 generally, but not always, improves performance and code size, at the cost of
16194 extra compilation time, which is why there is an option to switch it off.
16195 If you have a problem with call instructions exceeding their allowable
16196 offset range because they are conditionalized, you should consider using
16197 @option{-mmedium-calls} instead.
16198
16199 @item -mearly-cbranchsi
16200 @opindex mearly-cbranchsi
16201 Enable pre-reload use of the @code{cbranchsi} pattern.
16202
16203 @item -mexpand-adddi
16204 @opindex mexpand-adddi
16205 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16206 @code{add.f}, @code{adc} etc. This option is deprecated.
16207
16208 @item -mindexed-loads
16209 @opindex mindexed-loads
16210 Enable the use of indexed loads. This can be problematic because some
16211 optimizers then assume that indexed stores exist, which is not
16212 the case.
16213
16214 @item -mlra
16215 @opindex mlra
16216 Enable Local Register Allocation. This is still experimental for ARC,
16217 so by default the compiler uses standard reload
16218 (i.e.@: @option{-mno-lra}).
16219
16220 @item -mlra-priority-none
16221 @opindex mlra-priority-none
16222 Don't indicate any priority for target registers.
16223
16224 @item -mlra-priority-compact
16225 @opindex mlra-priority-compact
16226 Indicate target register priority for r0..r3 / r12..r15.
16227
16228 @item -mlra-priority-noncompact
16229 @opindex mlra-priority-noncompact
16230 Reduce target register priority for r0..r3 / r12..r15.
16231
16232 @item -mno-millicode
16233 @opindex mno-millicode
16234 When optimizing for size (using @option{-Os}), prologues and epilogues
16235 that have to save or restore a large number of registers are often
16236 shortened by using call to a special function in libgcc; this is
16237 referred to as a @emph{millicode} call. As these calls can pose
16238 performance issues, and/or cause linking issues when linking in a
16239 nonstandard way, this option is provided to turn off millicode call
16240 generation.
16241
16242 @item -mmixed-code
16243 @opindex mmixed-code
16244 Tweak register allocation to help 16-bit instruction generation.
16245 This generally has the effect of decreasing the average instruction size
16246 while increasing the instruction count.
16247
16248 @item -mq-class
16249 @opindex mq-class
16250 Enable @samp{q} instruction alternatives.
16251 This is the default for @option{-Os}.
16252
16253 @item -mRcq
16254 @opindex mRcq
16255 Enable @samp{Rcq} constraint handling.
16256 Most short code generation depends on this.
16257 This is the default.
16258
16259 @item -mRcw
16260 @opindex mRcw
16261 Enable @samp{Rcw} constraint handling.
16262 Most ccfsm condexec mostly depends on this.
16263 This is the default.
16264
16265 @item -msize-level=@var{level}
16266 @opindex msize-level
16267 Fine-tune size optimization with regards to instruction lengths and alignment.
16268 The recognized values for @var{level} are:
16269 @table @samp
16270 @item 0
16271 No size optimization. This level is deprecated and treated like @samp{1}.
16272
16273 @item 1
16274 Short instructions are used opportunistically.
16275
16276 @item 2
16277 In addition, alignment of loops and of code after barriers are dropped.
16278
16279 @item 3
16280 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16281
16282 @end table
16283
16284 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16285 the behavior when this is not set is equivalent to level @samp{1}.
16286
16287 @item -mtune=@var{cpu}
16288 @opindex mtune
16289 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16290 by @option{-mcpu=}.
16291
16292 Supported values for @var{cpu} are
16293
16294 @table @samp
16295 @item ARC600
16296 Tune for ARC600 CPU.
16297
16298 @item ARC601
16299 Tune for ARC601 CPU.
16300
16301 @item ARC700
16302 Tune for ARC700 CPU with standard multiplier block.
16303
16304 @item ARC700-xmac
16305 Tune for ARC700 CPU with XMAC block.
16306
16307 @item ARC725D
16308 Tune for ARC725D CPU.
16309
16310 @item ARC750D
16311 Tune for ARC750D CPU.
16312
16313 @end table
16314
16315 @item -mmultcost=@var{num}
16316 @opindex mmultcost
16317 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16318 normal instruction.
16319
16320 @item -munalign-prob-threshold=@var{probability}
16321 @opindex munalign-prob-threshold
16322 Set probability threshold for unaligning branches.
16323 When tuning for @samp{ARC700} and optimizing for speed, branches without
16324 filled delay slot are preferably emitted unaligned and long, unless
16325 profiling indicates that the probability for the branch to be taken
16326 is below @var{probability}. @xref{Cross-profiling}.
16327 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16328
16329 @end table
16330
16331 The following options are maintained for backward compatibility, but
16332 are now deprecated and will be removed in a future release:
16333
16334 @c Deprecated options
16335 @table @gcctabopt
16336
16337 @item -margonaut
16338 @opindex margonaut
16339 Obsolete FPX.
16340
16341 @item -mbig-endian
16342 @opindex mbig-endian
16343 @itemx -EB
16344 @opindex EB
16345 Compile code for big-endian targets. Use of these options is now
16346 deprecated. Big-endian code is supported by configuring GCC to build
16347 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16348 for which big endian is the default.
16349
16350 @item -mlittle-endian
16351 @opindex mlittle-endian
16352 @itemx -EL
16353 @opindex EL
16354 Compile code for little-endian targets. Use of these options is now
16355 deprecated. Little-endian code is supported by configuring GCC to build
16356 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16357 for which little endian is the default.
16358
16359 @item -mbarrel_shifter
16360 @opindex mbarrel_shifter
16361 Replaced by @option{-mbarrel-shifter}.
16362
16363 @item -mdpfp_compact
16364 @opindex mdpfp_compact
16365 Replaced by @option{-mdpfp-compact}.
16366
16367 @item -mdpfp_fast
16368 @opindex mdpfp_fast
16369 Replaced by @option{-mdpfp-fast}.
16370
16371 @item -mdsp_packa
16372 @opindex mdsp_packa
16373 Replaced by @option{-mdsp-packa}.
16374
16375 @item -mEA
16376 @opindex mEA
16377 Replaced by @option{-mea}.
16378
16379 @item -mmac_24
16380 @opindex mmac_24
16381 Replaced by @option{-mmac-24}.
16382
16383 @item -mmac_d16
16384 @opindex mmac_d16
16385 Replaced by @option{-mmac-d16}.
16386
16387 @item -mspfp_compact
16388 @opindex mspfp_compact
16389 Replaced by @option{-mspfp-compact}.
16390
16391 @item -mspfp_fast
16392 @opindex mspfp_fast
16393 Replaced by @option{-mspfp-fast}.
16394
16395 @item -mtune=@var{cpu}
16396 @opindex mtune
16397 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16398 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16399 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16400
16401 @item -multcost=@var{num}
16402 @opindex multcost
16403 Replaced by @option{-mmultcost}.
16404
16405 @end table
16406
16407 @node ARM Options
16408 @subsection ARM Options
16409 @cindex ARM options
16410
16411 These @samp{-m} options are defined for the ARM port:
16412
16413 @table @gcctabopt
16414 @item -mabi=@var{name}
16415 @opindex mabi
16416 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16417 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16418
16419 @item -mapcs-frame
16420 @opindex mapcs-frame
16421 Generate a stack frame that is compliant with the ARM Procedure Call
16422 Standard for all functions, even if this is not strictly necessary for
16423 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16424 with this option causes the stack frames not to be generated for
16425 leaf functions. The default is @option{-mno-apcs-frame}.
16426 This option is deprecated.
16427
16428 @item -mapcs
16429 @opindex mapcs
16430 This is a synonym for @option{-mapcs-frame} and is deprecated.
16431
16432 @ignore
16433 @c not currently implemented
16434 @item -mapcs-stack-check
16435 @opindex mapcs-stack-check
16436 Generate code to check the amount of stack space available upon entry to
16437 every function (that actually uses some stack space). If there is
16438 insufficient space available then either the function
16439 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16440 called, depending upon the amount of stack space required. The runtime
16441 system is required to provide these functions. The default is
16442 @option{-mno-apcs-stack-check}, since this produces smaller code.
16443
16444 @c not currently implemented
16445 @item -mapcs-reentrant
16446 @opindex mapcs-reentrant
16447 Generate reentrant, position-independent code. The default is
16448 @option{-mno-apcs-reentrant}.
16449 @end ignore
16450
16451 @item -mthumb-interwork
16452 @opindex mthumb-interwork
16453 Generate code that supports calling between the ARM and Thumb
16454 instruction sets. Without this option, on pre-v5 architectures, the
16455 two instruction sets cannot be reliably used inside one program. The
16456 default is @option{-mno-thumb-interwork}, since slightly larger code
16457 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16458 configurations this option is meaningless.
16459
16460 @item -mno-sched-prolog
16461 @opindex mno-sched-prolog
16462 @opindex msched-prolog
16463 Prevent the reordering of instructions in the function prologue, or the
16464 merging of those instruction with the instructions in the function's
16465 body. This means that all functions start with a recognizable set
16466 of instructions (or in fact one of a choice from a small set of
16467 different function prologues), and this information can be used to
16468 locate the start of functions inside an executable piece of code. The
16469 default is @option{-msched-prolog}.
16470
16471 @item -mfloat-abi=@var{name}
16472 @opindex mfloat-abi
16473 Specifies which floating-point ABI to use. Permissible values
16474 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16475
16476 Specifying @samp{soft} causes GCC to generate output containing
16477 library calls for floating-point operations.
16478 @samp{softfp} allows the generation of code using hardware floating-point
16479 instructions, but still uses the soft-float calling conventions.
16480 @samp{hard} allows generation of floating-point instructions
16481 and uses FPU-specific calling conventions.
16482
16483 The default depends on the specific target configuration. Note that
16484 the hard-float and soft-float ABIs are not link-compatible; you must
16485 compile your entire program with the same ABI, and link with a
16486 compatible set of libraries.
16487
16488 @item -mlittle-endian
16489 @opindex mlittle-endian
16490 Generate code for a processor running in little-endian mode. This is
16491 the default for all standard configurations.
16492
16493 @item -mbig-endian
16494 @opindex mbig-endian
16495 Generate code for a processor running in big-endian mode; the default is
16496 to compile code for a little-endian processor.
16497
16498 @item -mbe8
16499 @itemx -mbe32
16500 @opindex mbe8
16501 When linking a big-endian image select between BE8 and BE32 formats.
16502 The option has no effect for little-endian images and is ignored. The
16503 default is dependent on the selected target architecture. For ARMv6
16504 and later architectures the default is BE8, for older architectures
16505 the default is BE32. BE32 format has been deprecated by ARM.
16506
16507 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16508 @opindex march
16509 This specifies the name of the target ARM architecture. GCC uses this
16510 name to determine what kind of instructions it can emit when generating
16511 assembly code. This option can be used in conjunction with or instead
16512 of the @option{-mcpu=} option.
16513
16514 Permissible names are:
16515 @samp{armv4t},
16516 @samp{armv5t}, @samp{armv5te},
16517 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16518 @samp{armv6z}, @samp{armv6zk},
16519 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16520 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16521 @samp{armv8.4-a},
16522 @samp{armv8.5-a},
16523 @samp{armv7-r},
16524 @samp{armv8-r},
16525 @samp{armv6-m}, @samp{armv6s-m},
16526 @samp{armv7-m}, @samp{armv7e-m},
16527 @samp{armv8-m.base}, @samp{armv8-m.main},
16528 @samp{iwmmxt} and @samp{iwmmxt2}.
16529
16530 Additionally, the following architectures, which lack support for the
16531 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16532
16533 Many of the architectures support extensions. These can be added by
16534 appending @samp{+@var{extension}} to the architecture name. Extension
16535 options are processed in order and capabilities accumulate. An extension
16536 will also enable any necessary base extensions
16537 upon which it depends. For example, the @samp{+crypto} extension
16538 will always enable the @samp{+simd} extension. The exception to the
16539 additive construction is for extensions that are prefixed with
16540 @samp{+no@dots{}}: these extensions disable the specified option and
16541 any other extensions that may depend on the presence of that
16542 extension.
16543
16544 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16545 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16546 entirely disabled by the @samp{+nofp} option that follows it.
16547
16548 Most extension names are generically named, but have an effect that is
16549 dependent upon the architecture to which it is applied. For example,
16550 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16551 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16552 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16553 variant for @samp{armv8-a}.
16554
16555 The table below lists the supported extensions for each architecture.
16556 Architectures not mentioned do not support any extensions.
16557
16558 @table @samp
16559 @item armv5te
16560 @itemx armv6
16561 @itemx armv6j
16562 @itemx armv6k
16563 @itemx armv6kz
16564 @itemx armv6t2
16565 @itemx armv6z
16566 @itemx armv6zk
16567 @table @samp
16568 @item +fp
16569 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16570 used as an alias for this extension.
16571
16572 @item +nofp
16573 Disable the floating-point instructions.
16574 @end table
16575
16576 @item armv7
16577 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16578 @table @samp
16579 @item +fp
16580 The VFPv3 floating-point instructions, with 16 double-precision
16581 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16582 for this extension. Note that floating-point is not supported by the
16583 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16584 ARMv7-R architectures.
16585
16586 @item +nofp
16587 Disable the floating-point instructions.
16588 @end table
16589
16590 @item armv7-a
16591 @table @samp
16592 @item +fp
16593 The VFPv3 floating-point instructions, with 16 double-precision
16594 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16595 for this extension.
16596
16597 @item +simd
16598 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16599 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16600 for this extension.
16601
16602 @item +vfpv3
16603 The VFPv3 floating-point instructions, with 32 double-precision
16604 registers.
16605
16606 @item +vfpv3-d16-fp16
16607 The VFPv3 floating-point instructions, with 16 double-precision
16608 registers and the half-precision floating-point conversion operations.
16609
16610 @item +vfpv3-fp16
16611 The VFPv3 floating-point instructions, with 32 double-precision
16612 registers and the half-precision floating-point conversion operations.
16613
16614 @item +vfpv4-d16
16615 The VFPv4 floating-point instructions, with 16 double-precision
16616 registers.
16617
16618 @item +vfpv4
16619 The VFPv4 floating-point instructions, with 32 double-precision
16620 registers.
16621
16622 @item +neon-fp16
16623 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16624 the half-precision floating-point conversion operations.
16625
16626 @item +neon-vfpv4
16627 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16628
16629 @item +nosimd
16630 Disable the Advanced SIMD instructions (does not disable floating point).
16631
16632 @item +nofp
16633 Disable the floating-point and Advanced SIMD instructions.
16634 @end table
16635
16636 @item armv7ve
16637 The extended version of the ARMv7-A architecture with support for
16638 virtualization.
16639 @table @samp
16640 @item +fp
16641 The VFPv4 floating-point instructions, with 16 double-precision registers.
16642 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16643
16644 @item +simd
16645 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16646 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16647
16648 @item +vfpv3-d16
16649 The VFPv3 floating-point instructions, with 16 double-precision
16650 registers.
16651
16652 @item +vfpv3
16653 The VFPv3 floating-point instructions, with 32 double-precision
16654 registers.
16655
16656 @item +vfpv3-d16-fp16
16657 The VFPv3 floating-point instructions, with 16 double-precision
16658 registers and the half-precision floating-point conversion operations.
16659
16660 @item +vfpv3-fp16
16661 The VFPv3 floating-point instructions, with 32 double-precision
16662 registers and the half-precision floating-point conversion operations.
16663
16664 @item +vfpv4-d16
16665 The VFPv4 floating-point instructions, with 16 double-precision
16666 registers.
16667
16668 @item +vfpv4
16669 The VFPv4 floating-point instructions, with 32 double-precision
16670 registers.
16671
16672 @item +neon
16673 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16674 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16675
16676 @item +neon-fp16
16677 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16678 the half-precision floating-point conversion operations.
16679
16680 @item +nosimd
16681 Disable the Advanced SIMD instructions (does not disable floating point).
16682
16683 @item +nofp
16684 Disable the floating-point and Advanced SIMD instructions.
16685 @end table
16686
16687 @item armv8-a
16688 @table @samp
16689 @item +crc
16690 The Cyclic Redundancy Check (CRC) instructions.
16691 @item +simd
16692 The ARMv8-A Advanced SIMD and floating-point instructions.
16693 @item +crypto
16694 The cryptographic instructions.
16695 @item +nocrypto
16696 Disable the cryptographic instructions.
16697 @item +nofp
16698 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16699 @item +sb
16700 Speculation Barrier Instruction.
16701 @item +predres
16702 Execution and Data Prediction Restriction Instructions.
16703 @end table
16704
16705 @item armv8.1-a
16706 @table @samp
16707 @item +simd
16708 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16709
16710 @item +crypto
16711 The cryptographic instructions. This also enables the Advanced SIMD and
16712 floating-point instructions.
16713
16714 @item +nocrypto
16715 Disable the cryptographic instructions.
16716
16717 @item +nofp
16718 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16719
16720 @item +sb
16721 Speculation Barrier Instruction.
16722
16723 @item +predres
16724 Execution and Data Prediction Restriction Instructions.
16725 @end table
16726
16727 @item armv8.2-a
16728 @itemx armv8.3-a
16729 @table @samp
16730 @item +fp16
16731 The half-precision floating-point data processing instructions.
16732 This also enables the Advanced SIMD and floating-point instructions.
16733
16734 @item +fp16fml
16735 The half-precision floating-point fmla extension. This also enables
16736 the half-precision floating-point extension and Advanced SIMD and
16737 floating-point instructions.
16738
16739 @item +simd
16740 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16741
16742 @item +crypto
16743 The cryptographic instructions. This also enables the Advanced SIMD and
16744 floating-point instructions.
16745
16746 @item +dotprod
16747 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16748
16749 @item +nocrypto
16750 Disable the cryptographic extension.
16751
16752 @item +nofp
16753 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16754
16755 @item +sb
16756 Speculation Barrier Instruction.
16757
16758 @item +predres
16759 Execution and Data Prediction Restriction Instructions.
16760 @end table
16761
16762 @item armv8.4-a
16763 @table @samp
16764 @item +fp16
16765 The half-precision floating-point data processing instructions.
16766 This also enables the Advanced SIMD and floating-point instructions as well
16767 as the Dot Product extension and the half-precision floating-point fmla
16768 extension.
16769
16770 @item +simd
16771 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16772 Dot Product extension.
16773
16774 @item +crypto
16775 The cryptographic instructions. This also enables the Advanced SIMD and
16776 floating-point instructions as well as the Dot Product extension.
16777
16778 @item +nocrypto
16779 Disable the cryptographic extension.
16780
16781 @item +nofp
16782 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16783
16784 @item +sb
16785 Speculation Barrier Instruction.
16786
16787 @item +predres
16788 Execution and Data Prediction Restriction Instructions.
16789 @end table
16790
16791 @item armv8.5-a
16792 @table @samp
16793 @item +fp16
16794 The half-precision floating-point data processing instructions.
16795 This also enables the Advanced SIMD and floating-point instructions as well
16796 as the Dot Product extension and the half-precision floating-point fmla
16797 extension.
16798
16799 @item +simd
16800 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16801 Dot Product extension.
16802
16803 @item +crypto
16804 The cryptographic instructions. This also enables the Advanced SIMD and
16805 floating-point instructions as well as the Dot Product extension.
16806
16807 @item +nocrypto
16808 Disable the cryptographic extension.
16809
16810 @item +nofp
16811 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16812 @end table
16813
16814 @item armv7-r
16815 @table @samp
16816 @item +fp.sp
16817 The single-precision VFPv3 floating-point instructions. The extension
16818 @samp{+vfpv3xd} can be used as an alias for this extension.
16819
16820 @item +fp
16821 The VFPv3 floating-point instructions with 16 double-precision registers.
16822 The extension +vfpv3-d16 can be used as an alias for this extension.
16823
16824 @item +nofp
16825 Disable the floating-point extension.
16826
16827 @item +idiv
16828 The ARM-state integer division instructions.
16829
16830 @item +noidiv
16831 Disable the ARM-state integer division extension.
16832 @end table
16833
16834 @item armv7e-m
16835 @table @samp
16836 @item +fp
16837 The single-precision VFPv4 floating-point instructions.
16838
16839 @item +fpv5
16840 The single-precision FPv5 floating-point instructions.
16841
16842 @item +fp.dp
16843 The single- and double-precision FPv5 floating-point instructions.
16844
16845 @item +nofp
16846 Disable the floating-point extensions.
16847 @end table
16848
16849 @item armv8-m.main
16850 @table @samp
16851 @item +dsp
16852 The DSP instructions.
16853
16854 @item +nodsp
16855 Disable the DSP extension.
16856
16857 @item +fp
16858 The single-precision floating-point instructions.
16859
16860 @item +fp.dp
16861 The single- and double-precision floating-point instructions.
16862
16863 @item +nofp
16864 Disable the floating-point extension.
16865 @end table
16866
16867 @item armv8-r
16868 @table @samp
16869 @item +crc
16870 The Cyclic Redundancy Check (CRC) instructions.
16871 @item +fp.sp
16872 The single-precision FPv5 floating-point instructions.
16873 @item +simd
16874 The ARMv8-A Advanced SIMD and floating-point instructions.
16875 @item +crypto
16876 The cryptographic instructions.
16877 @item +nocrypto
16878 Disable the cryptographic instructions.
16879 @item +nofp
16880 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16881 @end table
16882
16883 @end table
16884
16885 @option{-march=native} causes the compiler to auto-detect the architecture
16886 of the build computer. At present, this feature is only supported on
16887 GNU/Linux, and not all architectures are recognized. If the auto-detect
16888 is unsuccessful the option has no effect.
16889
16890 @item -mtune=@var{name}
16891 @opindex mtune
16892 This option specifies the name of the target ARM processor for
16893 which GCC should tune the performance of the code.
16894 For some ARM implementations better performance can be obtained by using
16895 this option.
16896 Permissible names are: @samp{arm2}, @samp{arm250},
16897 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16898 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16899 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16900 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16901 @samp{arm720},
16902 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16903 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16904 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16905 @samp{strongarm1110},
16906 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16907 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16908 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16909 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16910 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16911 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16912 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16913 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16914 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16915 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16916 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16917 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
16918 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
16919 @samp{cortex-m33},
16920 @samp{cortex-m23},
16921 @samp{cortex-m7},
16922 @samp{cortex-m4},
16923 @samp{cortex-m3},
16924 @samp{cortex-m1},
16925 @samp{cortex-m0},
16926 @samp{cortex-m0plus},
16927 @samp{cortex-m1.small-multiply},
16928 @samp{cortex-m0.small-multiply},
16929 @samp{cortex-m0plus.small-multiply},
16930 @samp{exynos-m1},
16931 @samp{marvell-pj4},
16932 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16933 @samp{fa526}, @samp{fa626},
16934 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16935 @samp{xgene1}.
16936
16937 Additionally, this option can specify that GCC should tune the performance
16938 of the code for a big.LITTLE system. Permissible names are:
16939 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16940 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16941 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16942 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
16943
16944 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16945 performance for a blend of processors within architecture @var{arch}.
16946 The aim is to generate code that run well on the current most popular
16947 processors, balancing between optimizations that benefit some CPUs in the
16948 range, and avoiding performance pitfalls of other CPUs. The effects of
16949 this option may change in future GCC versions as CPU models come and go.
16950
16951 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16952 the extension options do not affect the tuning of the generated code.
16953
16954 @option{-mtune=native} causes the compiler to auto-detect the CPU
16955 of the build computer. At present, this feature is only supported on
16956 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16957 unsuccessful the option has no effect.
16958
16959 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16960 @opindex mcpu
16961 This specifies the name of the target ARM processor. GCC uses this name
16962 to derive the name of the target ARM architecture (as if specified
16963 by @option{-march}) and the ARM processor type for which to tune for
16964 performance (as if specified by @option{-mtune}). Where this option
16965 is used in conjunction with @option{-march} or @option{-mtune},
16966 those options take precedence over the appropriate part of this option.
16967
16968 Many of the supported CPUs implement optional architectural
16969 extensions. Where this is so the architectural extensions are
16970 normally enabled by default. If implementations that lack the
16971 extension exist, then the extension syntax can be used to disable
16972 those extensions that have been omitted. For floating-point and
16973 Advanced SIMD (Neon) instructions, the settings of the options
16974 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16975 floating-point and Advanced SIMD instructions will only be used if
16976 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16977 @option{-mfpu} other than @samp{auto} will override the available
16978 floating-point and SIMD extension instructions.
16979
16980 For example, @samp{cortex-a9} can be found in three major
16981 configurations: integer only, with just a floating-point unit or with
16982 floating-point and Advanced SIMD. The default is to enable all the
16983 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16984 be used to disable just the SIMD or both the SIMD and floating-point
16985 instructions respectively.
16986
16987 Permissible names for this option are the same as those for
16988 @option{-mtune}.
16989
16990 The following extension options are common to the listed CPUs:
16991
16992 @table @samp
16993 @item +nodsp
16994 Disable the DSP instructions on @samp{cortex-m33}.
16995
16996 @item +nofp
16997 Disables the floating-point instructions on @samp{arm9e},
16998 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16999 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17000 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17001 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
17002 Disables the floating-point and SIMD instructions on
17003 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17004 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17005 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17006 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17007 @samp{cortex-a53} and @samp{cortex-a55}.
17008
17009 @item +nofp.dp
17010 Disables the double-precision component of the floating-point instructions
17011 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
17012
17013 @item +nosimd
17014 Disables the SIMD (but not floating-point) instructions on
17015 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17016 and @samp{cortex-a9}.
17017
17018 @item +crypto
17019 Enables the cryptographic instructions on @samp{cortex-a32},
17020 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17021 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17022 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17023 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17024 @samp{cortex-a75.cortex-a55}.
17025 @end table
17026
17027 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17028 VFPv3 with 16 double-precision registers. It supports the following
17029 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
17030 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
17031 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
17032 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
17033 @option{-march=armv7-a}.
17034
17035 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17036 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17037 See @option{-mtune} for more information.
17038
17039 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17040 of the build computer. At present, this feature is only supported on
17041 GNU/Linux, and not all architectures are recognized. If the auto-detect
17042 is unsuccessful the option has no effect.
17043
17044 @item -mfpu=@var{name}
17045 @opindex mfpu
17046 This specifies what floating-point hardware (or hardware emulation) is
17047 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17048 @samp{vfpv3},
17049 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17050 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17051 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17052 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17053 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17054 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17055 is an alias for @samp{vfpv2}.
17056
17057 The setting @samp{auto} is the default and is special. It causes the
17058 compiler to select the floating-point and Advanced SIMD instructions
17059 based on the settings of @option{-mcpu} and @option{-march}.
17060
17061 If the selected floating-point hardware includes the NEON extension
17062 (e.g.@: @option{-mfpu=neon}), note that floating-point
17063 operations are not generated by GCC's auto-vectorization pass unless
17064 @option{-funsafe-math-optimizations} is also specified. This is
17065 because NEON hardware does not fully implement the IEEE 754 standard for
17066 floating-point arithmetic (in particular denormal values are treated as
17067 zero), so the use of NEON instructions may lead to a loss of precision.
17068
17069 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}).
17070
17071 @item -mfp16-format=@var{name}
17072 @opindex mfp16-format
17073 Specify the format of the @code{__fp16} half-precision floating-point type.
17074 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17075 the default is @samp{none}, in which case the @code{__fp16} type is not
17076 defined. @xref{Half-Precision}, for more information.
17077
17078 @item -mstructure-size-boundary=@var{n}
17079 @opindex mstructure-size-boundary
17080 The sizes of all structures and unions are rounded up to a multiple
17081 of the number of bits set by this option. Permissible values are 8, 32
17082 and 64. The default value varies for different toolchains. For the COFF
17083 targeted toolchain the default value is 8. A value of 64 is only allowed
17084 if the underlying ABI supports it.
17085
17086 Specifying a larger number can produce faster, more efficient code, but
17087 can also increase the size of the program. Different values are potentially
17088 incompatible. Code compiled with one value cannot necessarily expect to
17089 work with code or libraries compiled with another value, if they exchange
17090 information using structures or unions.
17091
17092 This option is deprecated.
17093
17094 @item -mabort-on-noreturn
17095 @opindex mabort-on-noreturn
17096 Generate a call to the function @code{abort} at the end of a
17097 @code{noreturn} function. It is executed if the function tries to
17098 return.
17099
17100 @item -mlong-calls
17101 @itemx -mno-long-calls
17102 @opindex mlong-calls
17103 @opindex mno-long-calls
17104 Tells the compiler to perform function calls by first loading the
17105 address of the function into a register and then performing a subroutine
17106 call on this register. This switch is needed if the target function
17107 lies outside of the 64-megabyte addressing range of the offset-based
17108 version of subroutine call instruction.
17109
17110 Even if this switch is enabled, not all function calls are turned
17111 into long calls. The heuristic is that static functions, functions
17112 that have the @code{short_call} attribute, functions that are inside
17113 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17114 definitions have already been compiled within the current compilation
17115 unit are not turned into long calls. The exceptions to this rule are
17116 that weak function definitions, functions with the @code{long_call}
17117 attribute or the @code{section} attribute, and functions that are within
17118 the scope of a @code{#pragma long_calls} directive are always
17119 turned into long calls.
17120
17121 This feature is not enabled by default. Specifying
17122 @option{-mno-long-calls} restores the default behavior, as does
17123 placing the function calls within the scope of a @code{#pragma
17124 long_calls_off} directive. Note these switches have no effect on how
17125 the compiler generates code to handle function calls via function
17126 pointers.
17127
17128 @item -msingle-pic-base
17129 @opindex msingle-pic-base
17130 Treat the register used for PIC addressing as read-only, rather than
17131 loading it in the prologue for each function. The runtime system is
17132 responsible for initializing this register with an appropriate value
17133 before execution begins.
17134
17135 @item -mpic-register=@var{reg}
17136 @opindex mpic-register
17137 Specify the register to be used for PIC addressing.
17138 For standard PIC base case, the default is any suitable register
17139 determined by compiler. For single PIC base case, the default is
17140 @samp{R9} if target is EABI based or stack-checking is enabled,
17141 otherwise the default is @samp{R10}.
17142
17143 @item -mpic-data-is-text-relative
17144 @opindex mpic-data-is-text-relative
17145 Assume that the displacement between the text and data segments is fixed
17146 at static link time. This permits using PC-relative addressing
17147 operations to access data known to be in the data segment. For
17148 non-VxWorks RTP targets, this option is enabled by default. When
17149 disabled on such targets, it will enable @option{-msingle-pic-base} by
17150 default.
17151
17152 @item -mpoke-function-name
17153 @opindex mpoke-function-name
17154 Write the name of each function into the text section, directly
17155 preceding the function prologue. The generated code is similar to this:
17156
17157 @smallexample
17158 t0
17159 .ascii "arm_poke_function_name", 0
17160 .align
17161 t1
17162 .word 0xff000000 + (t1 - t0)
17163 arm_poke_function_name
17164 mov ip, sp
17165 stmfd sp!, @{fp, ip, lr, pc@}
17166 sub fp, ip, #4
17167 @end smallexample
17168
17169 When performing a stack backtrace, code can inspect the value of
17170 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17171 location @code{pc - 12} and the top 8 bits are set, then we know that
17172 there is a function name embedded immediately preceding this location
17173 and has length @code{((pc[-3]) & 0xff000000)}.
17174
17175 @item -mthumb
17176 @itemx -marm
17177 @opindex marm
17178 @opindex mthumb
17179
17180 Select between generating code that executes in ARM and Thumb
17181 states. The default for most configurations is to generate code
17182 that executes in ARM state, but the default can be changed by
17183 configuring GCC with the @option{--with-mode=}@var{state}
17184 configure option.
17185
17186 You can also override the ARM and Thumb mode for each function
17187 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17188 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17189
17190 @item -mflip-thumb
17191 @opindex mflip-thumb
17192 Switch ARM/Thumb modes on alternating functions.
17193 This option is provided for regression testing of mixed Thumb/ARM code
17194 generation, and is not intended for ordinary use in compiling code.
17195
17196 @item -mtpcs-frame
17197 @opindex mtpcs-frame
17198 Generate a stack frame that is compliant with the Thumb Procedure Call
17199 Standard for all non-leaf functions. (A leaf function is one that does
17200 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17201
17202 @item -mtpcs-leaf-frame
17203 @opindex mtpcs-leaf-frame
17204 Generate a stack frame that is compliant with the Thumb Procedure Call
17205 Standard for all leaf functions. (A leaf function is one that does
17206 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17207
17208 @item -mcallee-super-interworking
17209 @opindex mcallee-super-interworking
17210 Gives all externally visible functions in the file being compiled an ARM
17211 instruction set header which switches to Thumb mode before executing the
17212 rest of the function. This allows these functions to be called from
17213 non-interworking code. This option is not valid in AAPCS configurations
17214 because interworking is enabled by default.
17215
17216 @item -mcaller-super-interworking
17217 @opindex mcaller-super-interworking
17218 Allows calls via function pointers (including virtual functions) to
17219 execute correctly regardless of whether the target code has been
17220 compiled for interworking or not. There is a small overhead in the cost
17221 of executing a function pointer if this option is enabled. This option
17222 is not valid in AAPCS configurations because interworking is enabled
17223 by default.
17224
17225 @item -mtp=@var{name}
17226 @opindex mtp
17227 Specify the access model for the thread local storage pointer. The valid
17228 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17229 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17230 (supported in the arm6k architecture), and @samp{auto}, which uses the
17231 best available method for the selected processor. The default setting is
17232 @samp{auto}.
17233
17234 @item -mtls-dialect=@var{dialect}
17235 @opindex mtls-dialect
17236 Specify the dialect to use for accessing thread local storage. Two
17237 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17238 @samp{gnu} dialect selects the original GNU scheme for supporting
17239 local and global dynamic TLS models. The @samp{gnu2} dialect
17240 selects the GNU descriptor scheme, which provides better performance
17241 for shared libraries. The GNU descriptor scheme is compatible with
17242 the original scheme, but does require new assembler, linker and
17243 library support. Initial and local exec TLS models are unaffected by
17244 this option and always use the original scheme.
17245
17246 @item -mword-relocations
17247 @opindex mword-relocations
17248 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17249 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17250 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17251 is specified. This option conflicts with @option{-mslow-flash-data}.
17252
17253 @item -mfix-cortex-m3-ldrd
17254 @opindex mfix-cortex-m3-ldrd
17255 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17256 with overlapping destination and base registers are used. This option avoids
17257 generating these instructions. This option is enabled by default when
17258 @option{-mcpu=cortex-m3} is specified.
17259
17260 @item -munaligned-access
17261 @itemx -mno-unaligned-access
17262 @opindex munaligned-access
17263 @opindex mno-unaligned-access
17264 Enables (or disables) reading and writing of 16- and 32- bit values
17265 from addresses that are not 16- or 32- bit aligned. By default
17266 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17267 ARMv8-M Baseline architectures, and enabled for all other
17268 architectures. If unaligned access is not enabled then words in packed
17269 data structures are accessed a byte at a time.
17270
17271 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17272 generated object file to either true or false, depending upon the
17273 setting of this option. If unaligned access is enabled then the
17274 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17275 defined.
17276
17277 @item -mneon-for-64bits
17278 @opindex mneon-for-64bits
17279 Enables using Neon to handle scalar 64-bits operations. This is
17280 disabled by default since the cost of moving data from core registers
17281 to Neon is high.
17282
17283 @item -mslow-flash-data
17284 @opindex mslow-flash-data
17285 Assume loading data from flash is slower than fetching instruction.
17286 Therefore literal load is minimized for better performance.
17287 This option is only supported when compiling for ARMv7 M-profile and
17288 off by default. It conflicts with @option{-mword-relocations}.
17289
17290 @item -masm-syntax-unified
17291 @opindex masm-syntax-unified
17292 Assume inline assembler is using unified asm syntax. The default is
17293 currently off which implies divided syntax. This option has no impact
17294 on Thumb2. However, this may change in future releases of GCC.
17295 Divided syntax should be considered deprecated.
17296
17297 @item -mrestrict-it
17298 @opindex mrestrict-it
17299 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17300 IT blocks can only contain a single 16-bit instruction from a select
17301 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17302
17303 @item -mprint-tune-info
17304 @opindex mprint-tune-info
17305 Print CPU tuning information as comment in assembler file. This is
17306 an option used only for regression testing of the compiler and not
17307 intended for ordinary use in compiling code. This option is disabled
17308 by default.
17309
17310 @item -mverbose-cost-dump
17311 @opindex mverbose-cost-dump
17312 Enable verbose cost model dumping in the debug dump files. This option is
17313 provided for use in debugging the compiler.
17314
17315 @item -mpure-code
17316 @opindex mpure-code
17317 Do not allow constant data to be placed in code sections.
17318 Additionally, when compiling for ELF object format give all text sections the
17319 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17320 is only available when generating non-pic code for M-profile targets with the
17321 MOVT instruction.
17322
17323 @item -mcmse
17324 @opindex mcmse
17325 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17326 Development Tools Engineering Specification", which can be found on
17327 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17328 @end table
17329
17330 @node AVR Options
17331 @subsection AVR Options
17332 @cindex AVR Options
17333
17334 These options are defined for AVR implementations:
17335
17336 @table @gcctabopt
17337 @item -mmcu=@var{mcu}
17338 @opindex mmcu
17339 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17340
17341 The default for this option is@tie{}@samp{avr2}.
17342
17343 GCC supports the following AVR devices and ISAs:
17344
17345 @include avr-mmcu.texi
17346
17347 @item -mabsdata
17348 @opindex mabsdata
17349
17350 Assume that all data in static storage can be accessed by LDS / STS
17351 instructions. This option has only an effect on reduced Tiny devices like
17352 ATtiny40. See also the @code{absdata}
17353 @ref{AVR Variable Attributes,variable attribute}.
17354
17355 @item -maccumulate-args
17356 @opindex maccumulate-args
17357 Accumulate outgoing function arguments and acquire/release the needed
17358 stack space for outgoing function arguments once in function
17359 prologue/epilogue. Without this option, outgoing arguments are pushed
17360 before calling a function and popped afterwards.
17361
17362 Popping the arguments after the function call can be expensive on
17363 AVR so that accumulating the stack space might lead to smaller
17364 executables because arguments need not be removed from the
17365 stack after such a function call.
17366
17367 This option can lead to reduced code size for functions that perform
17368 several calls to functions that get their arguments on the stack like
17369 calls to printf-like functions.
17370
17371 @item -mbranch-cost=@var{cost}
17372 @opindex mbranch-cost
17373 Set the branch costs for conditional branch instructions to
17374 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17375 integers. The default branch cost is 0.
17376
17377 @item -mcall-prologues
17378 @opindex mcall-prologues
17379 Functions prologues/epilogues are expanded as calls to appropriate
17380 subroutines. Code size is smaller.
17381
17382 @item -mgas-isr-prologues
17383 @opindex mgas-isr-prologues
17384 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17385 instruction supported by GNU Binutils.
17386 If this option is on, the feature can still be disabled for individual
17387 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17388 function attribute. This feature is activated per default
17389 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17390 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17391
17392 @item -mint8
17393 @opindex mint8
17394 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17395 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17396 and @code{long long} is 4 bytes. Please note that this option does not
17397 conform to the C standards, but it results in smaller code
17398 size.
17399
17400 @item -mmain-is-OS_task
17401 @opindex mmain-is-OS_task
17402 Do not save registers in @code{main}. The effect is the same like
17403 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17404 to @code{main}. It is activated per default if optimization is on.
17405
17406 @item -mn-flash=@var{num}
17407 @opindex mn-flash
17408 Assume that the flash memory has a size of
17409 @var{num} times 64@tie{}KiB.
17410
17411 @item -mno-interrupts
17412 @opindex mno-interrupts
17413 Generated code is not compatible with hardware interrupts.
17414 Code size is smaller.
17415
17416 @item -mrelax
17417 @opindex mrelax
17418 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17419 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17420 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17421 the assembler's command line and the @option{--relax} option to the
17422 linker's command line.
17423
17424 Jump relaxing is performed by the linker because jump offsets are not
17425 known before code is located. Therefore, the assembler code generated by the
17426 compiler is the same, but the instructions in the executable may
17427 differ from instructions in the assembler code.
17428
17429 Relaxing must be turned on if linker stubs are needed, see the
17430 section on @code{EIND} and linker stubs below.
17431
17432 @item -mrmw
17433 @opindex mrmw
17434 Assume that the device supports the Read-Modify-Write
17435 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17436
17437 @item -mshort-calls
17438 @opindex mshort-calls
17439
17440 Assume that @code{RJMP} and @code{RCALL} can target the whole
17441 program memory.
17442
17443 This option is used internally for multilib selection. It is
17444 not an optimization option, and you don't need to set it by hand.
17445
17446 @item -msp8
17447 @opindex msp8
17448 Treat the stack pointer register as an 8-bit register,
17449 i.e.@: assume the high byte of the stack pointer is zero.
17450 In general, you don't need to set this option by hand.
17451
17452 This option is used internally by the compiler to select and
17453 build multilibs for architectures @code{avr2} and @code{avr25}.
17454 These architectures mix devices with and without @code{SPH}.
17455 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17456 the compiler driver adds or removes this option from the compiler
17457 proper's command line, because the compiler then knows if the device
17458 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17459 register or not.
17460
17461 @item -mstrict-X
17462 @opindex mstrict-X
17463 Use address register @code{X} in a way proposed by the hardware. This means
17464 that @code{X} is only used in indirect, post-increment or
17465 pre-decrement addressing.
17466
17467 Without this option, the @code{X} register may be used in the same way
17468 as @code{Y} or @code{Z} which then is emulated by additional
17469 instructions.
17470 For example, loading a value with @code{X+const} addressing with a
17471 small non-negative @code{const < 64} to a register @var{Rn} is
17472 performed as
17473
17474 @example
17475 adiw r26, const ; X += const
17476 ld @var{Rn}, X ; @var{Rn} = *X
17477 sbiw r26, const ; X -= const
17478 @end example
17479
17480 @item -mtiny-stack
17481 @opindex mtiny-stack
17482 Only change the lower 8@tie{}bits of the stack pointer.
17483
17484 @item -mfract-convert-truncate
17485 @opindex mfract-convert-truncate
17486 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17487
17488 @item -nodevicelib
17489 @opindex nodevicelib
17490 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17491
17492 @item -Waddr-space-convert
17493 @opindex Waddr-space-convert
17494 @opindex Wno-addr-space-convert
17495 Warn about conversions between address spaces in the case where the
17496 resulting address space is not contained in the incoming address space.
17497
17498 @item -Wmisspelled-isr
17499 @opindex Wmisspelled-isr
17500 @opindex Wno-misspelled-isr
17501 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
17502 Enabled by default.
17503 @end table
17504
17505 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17506 @cindex @code{EIND}
17507 Pointers in the implementation are 16@tie{}bits wide.
17508 The address of a function or label is represented as word address so
17509 that indirect jumps and calls can target any code address in the
17510 range of 64@tie{}Ki words.
17511
17512 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17513 bytes of program memory space, there is a special function register called
17514 @code{EIND} that serves as most significant part of the target address
17515 when @code{EICALL} or @code{EIJMP} instructions are used.
17516
17517 Indirect jumps and calls on these devices are handled as follows by
17518 the compiler and are subject to some limitations:
17519
17520 @itemize @bullet
17521
17522 @item
17523 The compiler never sets @code{EIND}.
17524
17525 @item
17526 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17527 instructions or might read @code{EIND} directly in order to emulate an
17528 indirect call/jump by means of a @code{RET} instruction.
17529
17530 @item
17531 The compiler assumes that @code{EIND} never changes during the startup
17532 code or during the application. In particular, @code{EIND} is not
17533 saved/restored in function or interrupt service routine
17534 prologue/epilogue.
17535
17536 @item
17537 For indirect calls to functions and computed goto, the linker
17538 generates @emph{stubs}. Stubs are jump pads sometimes also called
17539 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17540 The stub contains a direct jump to the desired address.
17541
17542 @item
17543 Linker relaxation must be turned on so that the linker generates
17544 the stubs correctly in all situations. See the compiler option
17545 @option{-mrelax} and the linker option @option{--relax}.
17546 There are corner cases where the linker is supposed to generate stubs
17547 but aborts without relaxation and without a helpful error message.
17548
17549 @item
17550 The default linker script is arranged for code with @code{EIND = 0}.
17551 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17552 linker script has to be used in order to place the sections whose
17553 name start with @code{.trampolines} into the segment where @code{EIND}
17554 points to.
17555
17556 @item
17557 The startup code from libgcc never sets @code{EIND}.
17558 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17559 For the impact of AVR-LibC on @code{EIND}, see the
17560 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17561
17562 @item
17563 It is legitimate for user-specific startup code to set up @code{EIND}
17564 early, for example by means of initialization code located in
17565 section @code{.init3}. Such code runs prior to general startup code
17566 that initializes RAM and calls constructors, but after the bit
17567 of startup code from AVR-LibC that sets @code{EIND} to the segment
17568 where the vector table is located.
17569 @example
17570 #include <avr/io.h>
17571
17572 static void
17573 __attribute__((section(".init3"),naked,used,no_instrument_function))
17574 init3_set_eind (void)
17575 @{
17576 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17577 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17578 @}
17579 @end example
17580
17581 @noindent
17582 The @code{__trampolines_start} symbol is defined in the linker script.
17583
17584 @item
17585 Stubs are generated automatically by the linker if
17586 the following two conditions are met:
17587 @itemize @minus
17588
17589 @item The address of a label is taken by means of the @code{gs} modifier
17590 (short for @emph{generate stubs}) like so:
17591 @example
17592 LDI r24, lo8(gs(@var{func}))
17593 LDI r25, hi8(gs(@var{func}))
17594 @end example
17595 @item The final location of that label is in a code segment
17596 @emph{outside} the segment where the stubs are located.
17597 @end itemize
17598
17599 @item
17600 The compiler emits such @code{gs} modifiers for code labels in the
17601 following situations:
17602 @itemize @minus
17603 @item Taking address of a function or code label.
17604 @item Computed goto.
17605 @item If prologue-save function is used, see @option{-mcall-prologues}
17606 command-line option.
17607 @item Switch/case dispatch tables. If you do not want such dispatch
17608 tables you can specify the @option{-fno-jump-tables} command-line option.
17609 @item C and C++ constructors/destructors called during startup/shutdown.
17610 @item If the tools hit a @code{gs()} modifier explained above.
17611 @end itemize
17612
17613 @item
17614 Jumping to non-symbolic addresses like so is @emph{not} supported:
17615
17616 @example
17617 int main (void)
17618 @{
17619 /* Call function at word address 0x2 */
17620 return ((int(*)(void)) 0x2)();
17621 @}
17622 @end example
17623
17624 Instead, a stub has to be set up, i.e.@: the function has to be called
17625 through a symbol (@code{func_4} in the example):
17626
17627 @example
17628 int main (void)
17629 @{
17630 extern int func_4 (void);
17631
17632 /* Call function at byte address 0x4 */
17633 return func_4();
17634 @}
17635 @end example
17636
17637 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17638 Alternatively, @code{func_4} can be defined in the linker script.
17639 @end itemize
17640
17641 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17642 @cindex @code{RAMPD}
17643 @cindex @code{RAMPX}
17644 @cindex @code{RAMPY}
17645 @cindex @code{RAMPZ}
17646 Some AVR devices support memories larger than the 64@tie{}KiB range
17647 that can be accessed with 16-bit pointers. To access memory locations
17648 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17649 register is used as high part of the address:
17650 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17651 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17652 register, respectively, to get a wide address. Similarly,
17653 @code{RAMPD} is used together with direct addressing.
17654
17655 @itemize
17656 @item
17657 The startup code initializes the @code{RAMP} special function
17658 registers with zero.
17659
17660 @item
17661 If a @ref{AVR Named Address Spaces,named address space} other than
17662 generic or @code{__flash} is used, then @code{RAMPZ} is set
17663 as needed before the operation.
17664
17665 @item
17666 If the device supports RAM larger than 64@tie{}KiB and the compiler
17667 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17668 is reset to zero after the operation.
17669
17670 @item
17671 If the device comes with a specific @code{RAMP} register, the ISR
17672 prologue/epilogue saves/restores that SFR and initializes it with
17673 zero in case the ISR code might (implicitly) use it.
17674
17675 @item
17676 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17677 If you use inline assembler to read from locations outside the
17678 16-bit address range and change one of the @code{RAMP} registers,
17679 you must reset it to zero after the access.
17680
17681 @end itemize
17682
17683 @subsubsection AVR Built-in Macros
17684
17685 GCC defines several built-in macros so that the user code can test
17686 for the presence or absence of features. Almost any of the following
17687 built-in macros are deduced from device capabilities and thus
17688 triggered by the @option{-mmcu=} command-line option.
17689
17690 For even more AVR-specific built-in macros see
17691 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17692
17693 @table @code
17694
17695 @item __AVR_ARCH__
17696 Build-in macro that resolves to a decimal number that identifies the
17697 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17698 Possible values are:
17699
17700 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17701 @code{4}, @code{5}, @code{51}, @code{6}
17702
17703 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17704 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17705
17706 respectively and
17707
17708 @code{100},
17709 @code{102}, @code{103}, @code{104},
17710 @code{105}, @code{106}, @code{107}
17711
17712 for @var{mcu}=@code{avrtiny},
17713 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17714 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17715 If @var{mcu} specifies a device, this built-in macro is set
17716 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17717 defined to @code{4}.
17718
17719 @item __AVR_@var{Device}__
17720 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17721 the device's name. For example, @option{-mmcu=atmega8} defines the
17722 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17723 @code{__AVR_ATtiny261A__}, etc.
17724
17725 The built-in macros' names follow
17726 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17727 the device name as from the AVR user manual. The difference between
17728 @var{Device} in the built-in macro and @var{device} in
17729 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17730
17731 If @var{device} is not a device but only a core architecture like
17732 @samp{avr51}, this macro is not defined.
17733
17734 @item __AVR_DEVICE_NAME__
17735 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17736 the device's name. For example, with @option{-mmcu=atmega8} the macro
17737 is defined to @code{atmega8}.
17738
17739 If @var{device} is not a device but only a core architecture like
17740 @samp{avr51}, this macro is not defined.
17741
17742 @item __AVR_XMEGA__
17743 The device / architecture belongs to the XMEGA family of devices.
17744
17745 @item __AVR_HAVE_ELPM__
17746 The device has the @code{ELPM} instruction.
17747
17748 @item __AVR_HAVE_ELPMX__
17749 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17750 R@var{n},Z+} instructions.
17751
17752 @item __AVR_HAVE_MOVW__
17753 The device has the @code{MOVW} instruction to perform 16-bit
17754 register-register moves.
17755
17756 @item __AVR_HAVE_LPMX__
17757 The device has the @code{LPM R@var{n},Z} and
17758 @code{LPM R@var{n},Z+} instructions.
17759
17760 @item __AVR_HAVE_MUL__
17761 The device has a hardware multiplier.
17762
17763 @item __AVR_HAVE_JMP_CALL__
17764 The device has the @code{JMP} and @code{CALL} instructions.
17765 This is the case for devices with more than 8@tie{}KiB of program
17766 memory.
17767
17768 @item __AVR_HAVE_EIJMP_EICALL__
17769 @itemx __AVR_3_BYTE_PC__
17770 The device has the @code{EIJMP} and @code{EICALL} instructions.
17771 This is the case for devices with more than 128@tie{}KiB of program memory.
17772 This also means that the program counter
17773 (PC) is 3@tie{}bytes wide.
17774
17775 @item __AVR_2_BYTE_PC__
17776 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17777 with up to 128@tie{}KiB of program memory.
17778
17779 @item __AVR_HAVE_8BIT_SP__
17780 @itemx __AVR_HAVE_16BIT_SP__
17781 The stack pointer (SP) register is treated as 8-bit respectively
17782 16-bit register by the compiler.
17783 The definition of these macros is affected by @option{-mtiny-stack}.
17784
17785 @item __AVR_HAVE_SPH__
17786 @itemx __AVR_SP8__
17787 The device has the SPH (high part of stack pointer) special function
17788 register or has an 8-bit stack pointer, respectively.
17789 The definition of these macros is affected by @option{-mmcu=} and
17790 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17791 by @option{-msp8}.
17792
17793 @item __AVR_HAVE_RAMPD__
17794 @itemx __AVR_HAVE_RAMPX__
17795 @itemx __AVR_HAVE_RAMPY__
17796 @itemx __AVR_HAVE_RAMPZ__
17797 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17798 @code{RAMPZ} special function register, respectively.
17799
17800 @item __NO_INTERRUPTS__
17801 This macro reflects the @option{-mno-interrupts} command-line option.
17802
17803 @item __AVR_ERRATA_SKIP__
17804 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17805 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17806 instructions because of a hardware erratum. Skip instructions are
17807 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17808 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17809 set.
17810
17811 @item __AVR_ISA_RMW__
17812 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17813
17814 @item __AVR_SFR_OFFSET__=@var{offset}
17815 Instructions that can address I/O special function registers directly
17816 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17817 address as if addressed by an instruction to access RAM like @code{LD}
17818 or @code{STS}. This offset depends on the device architecture and has
17819 to be subtracted from the RAM address in order to get the
17820 respective I/O@tie{}address.
17821
17822 @item __AVR_SHORT_CALLS__
17823 The @option{-mshort-calls} command line option is set.
17824
17825 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17826 Some devices support reading from flash memory by means of @code{LD*}
17827 instructions. The flash memory is seen in the data address space
17828 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17829 is not defined, this feature is not available. If defined,
17830 the address space is linear and there is no need to put
17831 @code{.rodata} into RAM. This is handled by the default linker
17832 description file, and is currently available for
17833 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17834 there is no need to use address spaces like @code{__flash} or
17835 features like attribute @code{progmem} and @code{pgm_read_*}.
17836
17837 @item __WITH_AVRLIBC__
17838 The compiler is configured to be used together with AVR-Libc.
17839 See the @option{--with-avrlibc} configure option.
17840
17841 @end table
17842
17843 @node Blackfin Options
17844 @subsection Blackfin Options
17845 @cindex Blackfin Options
17846
17847 @table @gcctabopt
17848 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17849 @opindex mcpu=
17850 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17851 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17852 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17853 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17854 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17855 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17856 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17857 @samp{bf561}, @samp{bf592}.
17858
17859 The optional @var{sirevision} specifies the silicon revision of the target
17860 Blackfin processor. Any workarounds available for the targeted silicon revision
17861 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17862 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17863 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17864 hexadecimal digits representing the major and minor numbers in the silicon
17865 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17866 is not defined. If @var{sirevision} is @samp{any}, the
17867 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17868 If this optional @var{sirevision} is not used, GCC assumes the latest known
17869 silicon revision of the targeted Blackfin processor.
17870
17871 GCC defines a preprocessor macro for the specified @var{cpu}.
17872 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17873 provided by libgloss to be linked in if @option{-msim} is not given.
17874
17875 Without this option, @samp{bf532} is used as the processor by default.
17876
17877 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17878 only the preprocessor macro is defined.
17879
17880 @item -msim
17881 @opindex msim
17882 Specifies that the program will be run on the simulator. This causes
17883 the simulator BSP provided by libgloss to be linked in. This option
17884 has effect only for @samp{bfin-elf} toolchain.
17885 Certain other options, such as @option{-mid-shared-library} and
17886 @option{-mfdpic}, imply @option{-msim}.
17887
17888 @item -momit-leaf-frame-pointer
17889 @opindex momit-leaf-frame-pointer
17890 Don't keep the frame pointer in a register for leaf functions. This
17891 avoids the instructions to save, set up and restore frame pointers and
17892 makes an extra register available in leaf functions.
17893
17894 @item -mspecld-anomaly
17895 @opindex mspecld-anomaly
17896 When enabled, the compiler ensures that the generated code does not
17897 contain speculative loads after jump instructions. If this option is used,
17898 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17899
17900 @item -mno-specld-anomaly
17901 @opindex mno-specld-anomaly
17902 @opindex mspecld-anomaly
17903 Don't generate extra code to prevent speculative loads from occurring.
17904
17905 @item -mcsync-anomaly
17906 @opindex mcsync-anomaly
17907 When enabled, the compiler ensures that the generated code does not
17908 contain CSYNC or SSYNC instructions too soon after conditional branches.
17909 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17910
17911 @item -mno-csync-anomaly
17912 @opindex mno-csync-anomaly
17913 @opindex mcsync-anomaly
17914 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17915 occurring too soon after a conditional branch.
17916
17917 @item -mlow64k
17918 @opindex mlow64k
17919 When enabled, the compiler is free to take advantage of the knowledge that
17920 the entire program fits into the low 64k of memory.
17921
17922 @item -mno-low64k
17923 @opindex mno-low64k
17924 Assume that the program is arbitrarily large. This is the default.
17925
17926 @item -mstack-check-l1
17927 @opindex mstack-check-l1
17928 Do stack checking using information placed into L1 scratchpad memory by the
17929 uClinux kernel.
17930
17931 @item -mid-shared-library
17932 @opindex mid-shared-library
17933 Generate code that supports shared libraries via the library ID method.
17934 This allows for execute in place and shared libraries in an environment
17935 without virtual memory management. This option implies @option{-fPIC}.
17936 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17937
17938 @item -mno-id-shared-library
17939 @opindex mno-id-shared-library
17940 @opindex mid-shared-library
17941 Generate code that doesn't assume ID-based shared libraries are being used.
17942 This is the default.
17943
17944 @item -mleaf-id-shared-library
17945 @opindex mleaf-id-shared-library
17946 Generate code that supports shared libraries via the library ID method,
17947 but assumes that this library or executable won't link against any other
17948 ID shared libraries. That allows the compiler to use faster code for jumps
17949 and calls.
17950
17951 @item -mno-leaf-id-shared-library
17952 @opindex mno-leaf-id-shared-library
17953 @opindex mleaf-id-shared-library
17954 Do not assume that the code being compiled won't link against any ID shared
17955 libraries. Slower code is generated for jump and call insns.
17956
17957 @item -mshared-library-id=n
17958 @opindex mshared-library-id
17959 Specifies the identification number of the ID-based shared library being
17960 compiled. Specifying a value of 0 generates more compact code; specifying
17961 other values forces the allocation of that number to the current
17962 library but is no more space- or time-efficient than omitting this option.
17963
17964 @item -msep-data
17965 @opindex msep-data
17966 Generate code that allows the data segment to be located in a different
17967 area of memory from the text segment. This allows for execute in place in
17968 an environment without virtual memory management by eliminating relocations
17969 against the text section.
17970
17971 @item -mno-sep-data
17972 @opindex mno-sep-data
17973 @opindex msep-data
17974 Generate code that assumes that the data segment follows the text segment.
17975 This is the default.
17976
17977 @item -mlong-calls
17978 @itemx -mno-long-calls
17979 @opindex mlong-calls
17980 @opindex mno-long-calls
17981 Tells the compiler to perform function calls by first loading the
17982 address of the function into a register and then performing a subroutine
17983 call on this register. This switch is needed if the target function
17984 lies outside of the 24-bit addressing range of the offset-based
17985 version of subroutine call instruction.
17986
17987 This feature is not enabled by default. Specifying
17988 @option{-mno-long-calls} restores the default behavior. Note these
17989 switches have no effect on how the compiler generates code to handle
17990 function calls via function pointers.
17991
17992 @item -mfast-fp
17993 @opindex mfast-fp
17994 Link with the fast floating-point library. This library relaxes some of
17995 the IEEE floating-point standard's rules for checking inputs against
17996 Not-a-Number (NAN), in the interest of performance.
17997
17998 @item -minline-plt
17999 @opindex minline-plt
18000 Enable inlining of PLT entries in function calls to functions that are
18001 not known to bind locally. It has no effect without @option{-mfdpic}.
18002
18003 @item -mmulticore
18004 @opindex mmulticore
18005 Build a standalone application for multicore Blackfin processors.
18006 This option causes proper start files and link scripts supporting
18007 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18008 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18009
18010 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18011 selects the one-application-per-core programming model. Without
18012 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18013 programming model is used. In this model, the main function of Core B
18014 should be named as @code{coreb_main}.
18015
18016 If this option is not used, the single-core application programming
18017 model is used.
18018
18019 @item -mcorea
18020 @opindex mcorea
18021 Build a standalone application for Core A of BF561 when using
18022 the one-application-per-core programming model. Proper start files
18023 and link scripts are used to support Core A, and the macro
18024 @code{__BFIN_COREA} is defined.
18025 This option can only be used in conjunction with @option{-mmulticore}.
18026
18027 @item -mcoreb
18028 @opindex mcoreb
18029 Build a standalone application for Core B of BF561 when using
18030 the one-application-per-core programming model. Proper start files
18031 and link scripts are used to support Core B, and the macro
18032 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18033 should be used instead of @code{main}.
18034 This option can only be used in conjunction with @option{-mmulticore}.
18035
18036 @item -msdram
18037 @opindex msdram
18038 Build a standalone application for SDRAM. Proper start files and
18039 link scripts are used to put the application into SDRAM, and the macro
18040 @code{__BFIN_SDRAM} is defined.
18041 The loader should initialize SDRAM before loading the application.
18042
18043 @item -micplb
18044 @opindex micplb
18045 Assume that ICPLBs are enabled at run time. This has an effect on certain
18046 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18047 are enabled; for standalone applications the default is off.
18048 @end table
18049
18050 @node C6X Options
18051 @subsection C6X Options
18052 @cindex C6X Options
18053
18054 @table @gcctabopt
18055 @item -march=@var{name}
18056 @opindex march
18057 This specifies the name of the target architecture. GCC uses this
18058 name to determine what kind of instructions it can emit when generating
18059 assembly code. Permissible names are: @samp{c62x},
18060 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18061
18062 @item -mbig-endian
18063 @opindex mbig-endian
18064 Generate code for a big-endian target.
18065
18066 @item -mlittle-endian
18067 @opindex mlittle-endian
18068 Generate code for a little-endian target. This is the default.
18069
18070 @item -msim
18071 @opindex msim
18072 Choose startup files and linker script suitable for the simulator.
18073
18074 @item -msdata=default
18075 @opindex msdata=default
18076 Put small global and static data in the @code{.neardata} section,
18077 which is pointed to by register @code{B14}. Put small uninitialized
18078 global and static data in the @code{.bss} section, which is adjacent
18079 to the @code{.neardata} section. Put small read-only data into the
18080 @code{.rodata} section. The corresponding sections used for large
18081 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18082
18083 @item -msdata=all
18084 @opindex msdata=all
18085 Put all data, not just small objects, into the sections reserved for
18086 small data, and use addressing relative to the @code{B14} register to
18087 access them.
18088
18089 @item -msdata=none
18090 @opindex msdata=none
18091 Make no use of the sections reserved for small data, and use absolute
18092 addresses to access all data. Put all initialized global and static
18093 data in the @code{.fardata} section, and all uninitialized data in the
18094 @code{.far} section. Put all constant data into the @code{.const}
18095 section.
18096 @end table
18097
18098 @node CRIS Options
18099 @subsection CRIS Options
18100 @cindex CRIS Options
18101
18102 These options are defined specifically for the CRIS ports.
18103
18104 @table @gcctabopt
18105 @item -march=@var{architecture-type}
18106 @itemx -mcpu=@var{architecture-type}
18107 @opindex march
18108 @opindex mcpu
18109 Generate code for the specified architecture. The choices for
18110 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18111 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18112 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18113 @samp{v10}.
18114
18115 @item -mtune=@var{architecture-type}
18116 @opindex mtune
18117 Tune to @var{architecture-type} everything applicable about the generated
18118 code, except for the ABI and the set of available instructions. The
18119 choices for @var{architecture-type} are the same as for
18120 @option{-march=@var{architecture-type}}.
18121
18122 @item -mmax-stack-frame=@var{n}
18123 @opindex mmax-stack-frame
18124 Warn when the stack frame of a function exceeds @var{n} bytes.
18125
18126 @item -metrax4
18127 @itemx -metrax100
18128 @opindex metrax4
18129 @opindex metrax100
18130 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18131 @option{-march=v3} and @option{-march=v8} respectively.
18132
18133 @item -mmul-bug-workaround
18134 @itemx -mno-mul-bug-workaround
18135 @opindex mmul-bug-workaround
18136 @opindex mno-mul-bug-workaround
18137 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18138 models where it applies. This option is active by default.
18139
18140 @item -mpdebug
18141 @opindex mpdebug
18142 Enable CRIS-specific verbose debug-related information in the assembly
18143 code. This option also has the effect of turning off the @samp{#NO_APP}
18144 formatted-code indicator to the assembler at the beginning of the
18145 assembly file.
18146
18147 @item -mcc-init
18148 @opindex mcc-init
18149 Do not use condition-code results from previous instruction; always emit
18150 compare and test instructions before use of condition codes.
18151
18152 @item -mno-side-effects
18153 @opindex mno-side-effects
18154 @opindex mside-effects
18155 Do not emit instructions with side effects in addressing modes other than
18156 post-increment.
18157
18158 @item -mstack-align
18159 @itemx -mno-stack-align
18160 @itemx -mdata-align
18161 @itemx -mno-data-align
18162 @itemx -mconst-align
18163 @itemx -mno-const-align
18164 @opindex mstack-align
18165 @opindex mno-stack-align
18166 @opindex mdata-align
18167 @opindex mno-data-align
18168 @opindex mconst-align
18169 @opindex mno-const-align
18170 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18171 stack frame, individual data and constants to be aligned for the maximum
18172 single data access size for the chosen CPU model. The default is to
18173 arrange for 32-bit alignment. ABI details such as structure layout are
18174 not affected by these options.
18175
18176 @item -m32-bit
18177 @itemx -m16-bit
18178 @itemx -m8-bit
18179 @opindex m32-bit
18180 @opindex m16-bit
18181 @opindex m8-bit
18182 Similar to the stack- data- and const-align options above, these options
18183 arrange for stack frame, writable data and constants to all be 32-bit,
18184 16-bit or 8-bit aligned. The default is 32-bit alignment.
18185
18186 @item -mno-prologue-epilogue
18187 @itemx -mprologue-epilogue
18188 @opindex mno-prologue-epilogue
18189 @opindex mprologue-epilogue
18190 With @option{-mno-prologue-epilogue}, the normal function prologue and
18191 epilogue which set up the stack frame are omitted and no return
18192 instructions or return sequences are generated in the code. Use this
18193 option only together with visual inspection of the compiled code: no
18194 warnings or errors are generated when call-saved registers must be saved,
18195 or storage for local variables needs to be allocated.
18196
18197 @item -mno-gotplt
18198 @itemx -mgotplt
18199 @opindex mno-gotplt
18200 @opindex mgotplt
18201 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18202 instruction sequences that load addresses for functions from the PLT part
18203 of the GOT rather than (traditional on other architectures) calls to the
18204 PLT@. The default is @option{-mgotplt}.
18205
18206 @item -melf
18207 @opindex melf
18208 Legacy no-op option only recognized with the cris-axis-elf and
18209 cris-axis-linux-gnu targets.
18210
18211 @item -mlinux
18212 @opindex mlinux
18213 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18214
18215 @item -sim
18216 @opindex sim
18217 This option, recognized for the cris-axis-elf, arranges
18218 to link with input-output functions from a simulator library. Code,
18219 initialized data and zero-initialized data are allocated consecutively.
18220
18221 @item -sim2
18222 @opindex sim2
18223 Like @option{-sim}, but pass linker options to locate initialized data at
18224 0x40000000 and zero-initialized data at 0x80000000.
18225 @end table
18226
18227 @node CR16 Options
18228 @subsection CR16 Options
18229 @cindex CR16 Options
18230
18231 These options are defined specifically for the CR16 ports.
18232
18233 @table @gcctabopt
18234
18235 @item -mmac
18236 @opindex mmac
18237 Enable the use of multiply-accumulate instructions. Disabled by default.
18238
18239 @item -mcr16cplus
18240 @itemx -mcr16c
18241 @opindex mcr16cplus
18242 @opindex mcr16c
18243 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18244 is default.
18245
18246 @item -msim
18247 @opindex msim
18248 Links the library libsim.a which is in compatible with simulator. Applicable
18249 to ELF compiler only.
18250
18251 @item -mint32
18252 @opindex mint32
18253 Choose integer type as 32-bit wide.
18254
18255 @item -mbit-ops
18256 @opindex mbit-ops
18257 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18258
18259 @item -mdata-model=@var{model}
18260 @opindex mdata-model
18261 Choose a data model. The choices for @var{model} are @samp{near},
18262 @samp{far} or @samp{medium}. @samp{medium} is default.
18263 However, @samp{far} is not valid with @option{-mcr16c}, as the
18264 CR16C architecture does not support the far data model.
18265 @end table
18266
18267 @node C-SKY Options
18268 @subsection C-SKY Options
18269 @cindex C-SKY Options
18270
18271 GCC supports these options when compiling for C-SKY V2 processors.
18272
18273 @table @gcctabopt
18274
18275 @item -march=@var{arch}
18276 @opindex march=
18277 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18278 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18279 The default is @samp{ck810}.
18280
18281 @item -mcpu=@var{cpu}
18282 @opindex mcpu=
18283 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18284 @samp{ck801}, @samp{ck801t},
18285 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18286 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18287 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18288 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18289 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18290 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18291 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18292 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18293 @samp{ck803eftr1}, @samp{ck803efhtr1},
18294 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18295 @samp{ck803sef}, @samp{ck803seft},
18296 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18297 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18298 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18299 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18300
18301 @item -mbig-endian
18302 @opindex mbig-endian
18303 @itemx -EB
18304 @opindex EB
18305 @itemx -mlittle-endian
18306 @opindex mlittle-endian
18307 @itemx -EL
18308 @opindex EL
18309
18310 Select big- or little-endian code. The default is little-endian.
18311
18312 @item -mhard-float
18313 @opindex mhard-float
18314 @itemx -msoft-float
18315 @opindex msoft-float
18316
18317 Select hardware or software floating-point implementations.
18318 The default is soft float.
18319
18320 @item -mdouble-float
18321 @itemx -mno-double-float
18322 @opindex mdouble-float
18323 When @option{-mhard-float} is in effect, enable generation of
18324 double-precision float instructions. This is the default except
18325 when compiling for CK803.
18326
18327 @item -mfdivdu
18328 @itemx -mno-fdivdu
18329 @opindex mfdivdu
18330 When @option{-mhard-float} is in effect, enable generation of
18331 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18332 This is the default except when compiling for CK803.
18333
18334 @item -mfpu=@var{fpu}
18335 @opindex mfpu=
18336 Select the floating-point processor. This option can only be used with
18337 @option{-mhard-float}.
18338 Values for @var{fpu} are
18339 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18340 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18341 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18342
18343 @item -melrw
18344 @itemx -mno-elrw
18345 @opindex melrw
18346 Enable the extended @code{lrw} instruction. This option defaults to on
18347 for CK801 and off otherwise.
18348
18349 @item -mistack
18350 @itemx -mno-istack
18351 @opindex mistack
18352 Enable interrupt stack instructions; the default is off.
18353
18354 The @option{-mistack} option is required to handle the
18355 @code{interrupt} and @code{isr} function attributes
18356 (@pxref{C-SKY Function Attributes}).
18357
18358 @item -mmp
18359 @opindex mmp
18360 Enable multiprocessor instructions; the default is off.
18361
18362 @item -mcp
18363 @opindex mcp
18364 Enable coprocessor instructions; the default is off.
18365
18366 @item -mcache
18367 @opindex mcache
18368 Enable coprocessor instructions; the default is off.
18369
18370 @item -msecurity
18371 @opindex msecurity
18372 Enable C-SKY security instructions; the default is off.
18373
18374 @item -mtrust
18375 @opindex mtrust
18376 Enable C-SKY trust instructions; the default is off.
18377
18378 @item -mdsp
18379 @opindex mdsp
18380 @itemx -medsp
18381 @opindex medsp
18382 @itemx -mvdsp
18383 @opindex mvdsp
18384 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18385 All of these options default to off.
18386
18387 @item -mdiv
18388 @itemx -mno-div
18389 @opindex mdiv
18390 Generate divide instructions. Default is off.
18391
18392 @item -msmart
18393 @itemx -mno-smart
18394 @opindex msmart
18395 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18396 use of 16-bit instructions. This option is ignored for CK801 where this
18397 is the required behavior, and it defaults to on for CK802.
18398 For other targets, the default is off.
18399
18400 @item -mhigh-registers
18401 @itemx -mno-high-registers
18402 @opindex mhigh-registers
18403 Generate code using the high registers numbered 16-31. This option
18404 is not supported on CK801, CK802, or CK803, and is enabled by default
18405 for other processors.
18406
18407 @item -manchor
18408 @itemx -mno-anchor
18409 @opindex manchor
18410 Generate code using global anchor symbol addresses.
18411
18412 @item -mpushpop
18413 @itemx -mno-pushpop
18414 @opindex mpushpop
18415 Generate code using @code{push} and @code{pop} instructions. This option
18416 defaults to on.
18417
18418 @item -mmultiple-stld
18419 @itemx -mstm
18420 @itemx -mno-multiple-stld
18421 @itemx -mno-stm
18422 @opindex mmultiple-stld
18423 Generate code using @code{stm} and @code{ldm} instructions. This option
18424 isn't supported on CK801 but is enabled by default on other processors.
18425
18426 @item -mconstpool
18427 @itemx -mno-constpool
18428 @opindex mconstpool
18429 Create constant pools in the compiler instead of deferring it to the
18430 assembler. This option is the default and required for correct code
18431 generation on CK801 and CK802, and is optional on other processors.
18432
18433 @item -mstack-size
18434 @item -mno-stack-size
18435 @opindex mstack-size
18436 Emit @code{.stack_size} directives for each function in the assembly
18437 output. This option defaults to off.
18438
18439 @item -mccrt
18440 @itemx -mno-ccrt
18441 @opindex mccrt
18442 Generate code for the C-SKY compiler runtime instead of libgcc. This
18443 option defaults to off.
18444
18445 @item -mbranch-cost=@var{n}
18446 @opindex mbranch-cost=
18447 Set the branch costs to roughly @code{n} instructions. The default is 1.
18448
18449 @item -msched-prolog
18450 @itemx -mno-sched-prolog
18451 @opindex msched-prolog
18452 Permit scheduling of function prologue and epilogue sequences. Using
18453 this option can result in code that is not compliant with the C-SKY V2 ABI
18454 prologue requirements and that cannot be debugged or backtraced.
18455 It is disabled by default.
18456
18457 @end table
18458
18459 @node Darwin Options
18460 @subsection Darwin Options
18461 @cindex Darwin options
18462
18463 These options are defined for all architectures running the Darwin operating
18464 system.
18465
18466 FSF GCC on Darwin does not create ``fat'' object files; it creates
18467 an object file for the single architecture that GCC was built to
18468 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18469 @option{-arch} options are used; it does so by running the compiler or
18470 linker multiple times and joining the results together with
18471 @file{lipo}.
18472
18473 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18474 @samp{i686}) is determined by the flags that specify the ISA
18475 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18476 @option{-force_cpusubtype_ALL} option can be used to override this.
18477
18478 The Darwin tools vary in their behavior when presented with an ISA
18479 mismatch. The assembler, @file{as}, only permits instructions to
18480 be used that are valid for the subtype of the file it is generating,
18481 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18482 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18483 and prints an error if asked to create a shared library with a less
18484 restrictive subtype than its input files (for instance, trying to put
18485 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18486 for executables, @command{ld}, quietly gives the executable the most
18487 restrictive subtype of any of its input files.
18488
18489 @table @gcctabopt
18490 @item -F@var{dir}
18491 @opindex F
18492 Add the framework directory @var{dir} to the head of the list of
18493 directories to be searched for header files. These directories are
18494 interleaved with those specified by @option{-I} options and are
18495 scanned in a left-to-right order.
18496
18497 A framework directory is a directory with frameworks in it. A
18498 framework is a directory with a @file{Headers} and/or
18499 @file{PrivateHeaders} directory contained directly in it that ends
18500 in @file{.framework}. The name of a framework is the name of this
18501 directory excluding the @file{.framework}. Headers associated with
18502 the framework are found in one of those two directories, with
18503 @file{Headers} being searched first. A subframework is a framework
18504 directory that is in a framework's @file{Frameworks} directory.
18505 Includes of subframework headers can only appear in a header of a
18506 framework that contains the subframework, or in a sibling subframework
18507 header. Two subframeworks are siblings if they occur in the same
18508 framework. A subframework should not have the same name as a
18509 framework; a warning is issued if this is violated. Currently a
18510 subframework cannot have subframeworks; in the future, the mechanism
18511 may be extended to support this. The standard frameworks can be found
18512 in @file{/System/Library/Frameworks} and
18513 @file{/Library/Frameworks}. An example include looks like
18514 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18515 the name of the framework and @file{header.h} is found in the
18516 @file{PrivateHeaders} or @file{Headers} directory.
18517
18518 @item -iframework@var{dir}
18519 @opindex iframework
18520 Like @option{-F} except the directory is a treated as a system
18521 directory. The main difference between this @option{-iframework} and
18522 @option{-F} is that with @option{-iframework} the compiler does not
18523 warn about constructs contained within header files found via
18524 @var{dir}. This option is valid only for the C family of languages.
18525
18526 @item -gused
18527 @opindex gused
18528 Emit debugging information for symbols that are used. For stabs
18529 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18530 This is by default ON@.
18531
18532 @item -gfull
18533 @opindex gfull
18534 Emit debugging information for all symbols and types.
18535
18536 @item -mmacosx-version-min=@var{version}
18537 The earliest version of MacOS X that this executable will run on
18538 is @var{version}. Typical values of @var{version} include @code{10.1},
18539 @code{10.2}, and @code{10.3.9}.
18540
18541 If the compiler was built to use the system's headers by default,
18542 then the default for this option is the system version on which the
18543 compiler is running, otherwise the default is to make choices that
18544 are compatible with as many systems and code bases as possible.
18545
18546 @item -mkernel
18547 @opindex mkernel
18548 Enable kernel development mode. The @option{-mkernel} option sets
18549 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18550 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18551 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18552 applicable. This mode also sets @option{-mno-altivec},
18553 @option{-msoft-float}, @option{-fno-builtin} and
18554 @option{-mlong-branch} for PowerPC targets.
18555
18556 @item -mone-byte-bool
18557 @opindex mone-byte-bool
18558 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18559 By default @code{sizeof(bool)} is @code{4} when compiling for
18560 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18561 option has no effect on x86.
18562
18563 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18564 to generate code that is not binary compatible with code generated
18565 without that switch. Using this switch may require recompiling all
18566 other modules in a program, including system libraries. Use this
18567 switch to conform to a non-default data model.
18568
18569 @item -mfix-and-continue
18570 @itemx -ffix-and-continue
18571 @itemx -findirect-data
18572 @opindex mfix-and-continue
18573 @opindex ffix-and-continue
18574 @opindex findirect-data
18575 Generate code suitable for fast turnaround development, such as to
18576 allow GDB to dynamically load @file{.o} files into already-running
18577 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18578 are provided for backwards compatibility.
18579
18580 @item -all_load
18581 @opindex all_load
18582 Loads all members of static archive libraries.
18583 See man ld(1) for more information.
18584
18585 @item -arch_errors_fatal
18586 @opindex arch_errors_fatal
18587 Cause the errors having to do with files that have the wrong architecture
18588 to be fatal.
18589
18590 @item -bind_at_load
18591 @opindex bind_at_load
18592 Causes the output file to be marked such that the dynamic linker will
18593 bind all undefined references when the file is loaded or launched.
18594
18595 @item -bundle
18596 @opindex bundle
18597 Produce a Mach-o bundle format file.
18598 See man ld(1) for more information.
18599
18600 @item -bundle_loader @var{executable}
18601 @opindex bundle_loader
18602 This option specifies the @var{executable} that will load the build
18603 output file being linked. See man ld(1) for more information.
18604
18605 @item -dynamiclib
18606 @opindex dynamiclib
18607 When passed this option, GCC produces a dynamic library instead of
18608 an executable when linking, using the Darwin @file{libtool} command.
18609
18610 @item -force_cpusubtype_ALL
18611 @opindex force_cpusubtype_ALL
18612 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18613 one controlled by the @option{-mcpu} or @option{-march} option.
18614
18615 @item -allowable_client @var{client_name}
18616 @itemx -client_name
18617 @itemx -compatibility_version
18618 @itemx -current_version
18619 @itemx -dead_strip
18620 @itemx -dependency-file
18621 @itemx -dylib_file
18622 @itemx -dylinker_install_name
18623 @itemx -dynamic
18624 @itemx -exported_symbols_list
18625 @itemx -filelist
18626 @need 800
18627 @itemx -flat_namespace
18628 @itemx -force_flat_namespace
18629 @itemx -headerpad_max_install_names
18630 @itemx -image_base
18631 @itemx -init
18632 @itemx -install_name
18633 @itemx -keep_private_externs
18634 @itemx -multi_module
18635 @itemx -multiply_defined
18636 @itemx -multiply_defined_unused
18637 @need 800
18638 @itemx -noall_load
18639 @itemx -no_dead_strip_inits_and_terms
18640 @itemx -nofixprebinding
18641 @itemx -nomultidefs
18642 @itemx -noprebind
18643 @itemx -noseglinkedit
18644 @itemx -pagezero_size
18645 @itemx -prebind
18646 @itemx -prebind_all_twolevel_modules
18647 @itemx -private_bundle
18648 @need 800
18649 @itemx -read_only_relocs
18650 @itemx -sectalign
18651 @itemx -sectobjectsymbols
18652 @itemx -whyload
18653 @itemx -seg1addr
18654 @itemx -sectcreate
18655 @itemx -sectobjectsymbols
18656 @itemx -sectorder
18657 @itemx -segaddr
18658 @itemx -segs_read_only_addr
18659 @need 800
18660 @itemx -segs_read_write_addr
18661 @itemx -seg_addr_table
18662 @itemx -seg_addr_table_filename
18663 @itemx -seglinkedit
18664 @itemx -segprot
18665 @itemx -segs_read_only_addr
18666 @itemx -segs_read_write_addr
18667 @itemx -single_module
18668 @itemx -static
18669 @itemx -sub_library
18670 @need 800
18671 @itemx -sub_umbrella
18672 @itemx -twolevel_namespace
18673 @itemx -umbrella
18674 @itemx -undefined
18675 @itemx -unexported_symbols_list
18676 @itemx -weak_reference_mismatches
18677 @itemx -whatsloaded
18678 @opindex allowable_client
18679 @opindex client_name
18680 @opindex compatibility_version
18681 @opindex current_version
18682 @opindex dead_strip
18683 @opindex dependency-file
18684 @opindex dylib_file
18685 @opindex dylinker_install_name
18686 @opindex dynamic
18687 @opindex exported_symbols_list
18688 @opindex filelist
18689 @opindex flat_namespace
18690 @opindex force_flat_namespace
18691 @opindex headerpad_max_install_names
18692 @opindex image_base
18693 @opindex init
18694 @opindex install_name
18695 @opindex keep_private_externs
18696 @opindex multi_module
18697 @opindex multiply_defined
18698 @opindex multiply_defined_unused
18699 @opindex noall_load
18700 @opindex no_dead_strip_inits_and_terms
18701 @opindex nofixprebinding
18702 @opindex nomultidefs
18703 @opindex noprebind
18704 @opindex noseglinkedit
18705 @opindex pagezero_size
18706 @opindex prebind
18707 @opindex prebind_all_twolevel_modules
18708 @opindex private_bundle
18709 @opindex read_only_relocs
18710 @opindex sectalign
18711 @opindex sectobjectsymbols
18712 @opindex whyload
18713 @opindex seg1addr
18714 @opindex sectcreate
18715 @opindex sectobjectsymbols
18716 @opindex sectorder
18717 @opindex segaddr
18718 @opindex segs_read_only_addr
18719 @opindex segs_read_write_addr
18720 @opindex seg_addr_table
18721 @opindex seg_addr_table_filename
18722 @opindex seglinkedit
18723 @opindex segprot
18724 @opindex segs_read_only_addr
18725 @opindex segs_read_write_addr
18726 @opindex single_module
18727 @opindex static
18728 @opindex sub_library
18729 @opindex sub_umbrella
18730 @opindex twolevel_namespace
18731 @opindex umbrella
18732 @opindex undefined
18733 @opindex unexported_symbols_list
18734 @opindex weak_reference_mismatches
18735 @opindex whatsloaded
18736 These options are passed to the Darwin linker. The Darwin linker man page
18737 describes them in detail.
18738 @end table
18739
18740 @node DEC Alpha Options
18741 @subsection DEC Alpha Options
18742
18743 These @samp{-m} options are defined for the DEC Alpha implementations:
18744
18745 @table @gcctabopt
18746 @item -mno-soft-float
18747 @itemx -msoft-float
18748 @opindex mno-soft-float
18749 @opindex msoft-float
18750 Use (do not use) the hardware floating-point instructions for
18751 floating-point operations. When @option{-msoft-float} is specified,
18752 functions in @file{libgcc.a} are used to perform floating-point
18753 operations. Unless they are replaced by routines that emulate the
18754 floating-point operations, or compiled in such a way as to call such
18755 emulations routines, these routines issue floating-point
18756 operations. If you are compiling for an Alpha without floating-point
18757 operations, you must ensure that the library is built so as not to call
18758 them.
18759
18760 Note that Alpha implementations without floating-point operations are
18761 required to have floating-point registers.
18762
18763 @item -mfp-reg
18764 @itemx -mno-fp-regs
18765 @opindex mfp-reg
18766 @opindex mno-fp-regs
18767 Generate code that uses (does not use) the floating-point register set.
18768 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
18769 register set is not used, floating-point operands are passed in integer
18770 registers as if they were integers and floating-point results are passed
18771 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
18772 so any function with a floating-point argument or return value called by code
18773 compiled with @option{-mno-fp-regs} must also be compiled with that
18774 option.
18775
18776 A typical use of this option is building a kernel that does not use,
18777 and hence need not save and restore, any floating-point registers.
18778
18779 @item -mieee
18780 @opindex mieee
18781 The Alpha architecture implements floating-point hardware optimized for
18782 maximum performance. It is mostly compliant with the IEEE floating-point
18783 standard. However, for full compliance, software assistance is
18784 required. This option generates code fully IEEE-compliant code
18785 @emph{except} that the @var{inexact-flag} is not maintained (see below).
18786 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
18787 defined during compilation. The resulting code is less efficient but is
18788 able to correctly support denormalized numbers and exceptional IEEE
18789 values such as not-a-number and plus/minus infinity. Other Alpha
18790 compilers call this option @option{-ieee_with_no_inexact}.
18791
18792 @item -mieee-with-inexact
18793 @opindex mieee-with-inexact
18794 This is like @option{-mieee} except the generated code also maintains
18795 the IEEE @var{inexact-flag}. Turning on this option causes the
18796 generated code to implement fully-compliant IEEE math. In addition to
18797 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
18798 macro. On some Alpha implementations the resulting code may execute
18799 significantly slower than the code generated by default. Since there is
18800 very little code that depends on the @var{inexact-flag}, you should
18801 normally not specify this option. Other Alpha compilers call this
18802 option @option{-ieee_with_inexact}.
18803
18804 @item -mfp-trap-mode=@var{trap-mode}
18805 @opindex mfp-trap-mode
18806 This option controls what floating-point related traps are enabled.
18807 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
18808 The trap mode can be set to one of four values:
18809
18810 @table @samp
18811 @item n
18812 This is the default (normal) setting. The only traps that are enabled
18813 are the ones that cannot be disabled in software (e.g., division by zero
18814 trap).
18815
18816 @item u
18817 In addition to the traps enabled by @samp{n}, underflow traps are enabled
18818 as well.
18819
18820 @item su
18821 Like @samp{u}, but the instructions are marked to be safe for software
18822 completion (see Alpha architecture manual for details).
18823
18824 @item sui
18825 Like @samp{su}, but inexact traps are enabled as well.
18826 @end table
18827
18828 @item -mfp-rounding-mode=@var{rounding-mode}
18829 @opindex mfp-rounding-mode
18830 Selects the IEEE rounding mode. Other Alpha compilers call this option
18831 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
18832 of:
18833
18834 @table @samp
18835 @item n
18836 Normal IEEE rounding mode. Floating-point numbers are rounded towards
18837 the nearest machine number or towards the even machine number in case
18838 of a tie.
18839
18840 @item m
18841 Round towards minus infinity.
18842
18843 @item c
18844 Chopped rounding mode. Floating-point numbers are rounded towards zero.
18845
18846 @item d
18847 Dynamic rounding mode. A field in the floating-point control register
18848 (@var{fpcr}, see Alpha architecture reference manual) controls the
18849 rounding mode in effect. The C library initializes this register for
18850 rounding towards plus infinity. Thus, unless your program modifies the
18851 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
18852 @end table
18853
18854 @item -mtrap-precision=@var{trap-precision}
18855 @opindex mtrap-precision
18856 In the Alpha architecture, floating-point traps are imprecise. This
18857 means without software assistance it is impossible to recover from a
18858 floating trap and program execution normally needs to be terminated.
18859 GCC can generate code that can assist operating system trap handlers
18860 in determining the exact location that caused a floating-point trap.
18861 Depending on the requirements of an application, different levels of
18862 precisions can be selected:
18863
18864 @table @samp
18865 @item p
18866 Program precision. This option is the default and means a trap handler
18867 can only identify which program caused a floating-point exception.
18868
18869 @item f
18870 Function precision. The trap handler can determine the function that
18871 caused a floating-point exception.
18872
18873 @item i
18874 Instruction precision. The trap handler can determine the exact
18875 instruction that caused a floating-point exception.
18876 @end table
18877
18878 Other Alpha compilers provide the equivalent options called
18879 @option{-scope_safe} and @option{-resumption_safe}.
18880
18881 @item -mieee-conformant
18882 @opindex mieee-conformant
18883 This option marks the generated code as IEEE conformant. You must not
18884 use this option unless you also specify @option{-mtrap-precision=i} and either
18885 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18886 is to emit the line @samp{.eflag 48} in the function prologue of the
18887 generated assembly file.
18888
18889 @item -mbuild-constants
18890 @opindex mbuild-constants
18891 Normally GCC examines a 32- or 64-bit integer constant to
18892 see if it can construct it from smaller constants in two or three
18893 instructions. If it cannot, it outputs the constant as a literal and
18894 generates code to load it from the data segment at run time.
18895
18896 Use this option to require GCC to construct @emph{all} integer constants
18897 using code, even if it takes more instructions (the maximum is six).
18898
18899 You typically use this option to build a shared library dynamic
18900 loader. Itself a shared library, it must relocate itself in memory
18901 before it can find the variables and constants in its own data segment.
18902
18903 @item -mbwx
18904 @itemx -mno-bwx
18905 @itemx -mcix
18906 @itemx -mno-cix
18907 @itemx -mfix
18908 @itemx -mno-fix
18909 @itemx -mmax
18910 @itemx -mno-max
18911 @opindex mbwx
18912 @opindex mno-bwx
18913 @opindex mcix
18914 @opindex mno-cix
18915 @opindex mfix
18916 @opindex mno-fix
18917 @opindex mmax
18918 @opindex mno-max
18919 Indicate whether GCC should generate code to use the optional BWX,
18920 CIX, FIX and MAX instruction sets. The default is to use the instruction
18921 sets supported by the CPU type specified via @option{-mcpu=} option or that
18922 of the CPU on which GCC was built if none is specified.
18923
18924 @item -mfloat-vax
18925 @itemx -mfloat-ieee
18926 @opindex mfloat-vax
18927 @opindex mfloat-ieee
18928 Generate code that uses (does not use) VAX F and G floating-point
18929 arithmetic instead of IEEE single and double precision.
18930
18931 @item -mexplicit-relocs
18932 @itemx -mno-explicit-relocs
18933 @opindex mexplicit-relocs
18934 @opindex mno-explicit-relocs
18935 Older Alpha assemblers provided no way to generate symbol relocations
18936 except via assembler macros. Use of these macros does not allow
18937 optimal instruction scheduling. GNU binutils as of version 2.12
18938 supports a new syntax that allows the compiler to explicitly mark
18939 which relocations should apply to which instructions. This option
18940 is mostly useful for debugging, as GCC detects the capabilities of
18941 the assembler when it is built and sets the default accordingly.
18942
18943 @item -msmall-data
18944 @itemx -mlarge-data
18945 @opindex msmall-data
18946 @opindex mlarge-data
18947 When @option{-mexplicit-relocs} is in effect, static data is
18948 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18949 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18950 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18951 16-bit relocations off of the @code{$gp} register. This limits the
18952 size of the small data area to 64KB, but allows the variables to be
18953 directly accessed via a single instruction.
18954
18955 The default is @option{-mlarge-data}. With this option the data area
18956 is limited to just below 2GB@. Programs that require more than 2GB of
18957 data must use @code{malloc} or @code{mmap} to allocate the data in the
18958 heap instead of in the program's data segment.
18959
18960 When generating code for shared libraries, @option{-fpic} implies
18961 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18962
18963 @item -msmall-text
18964 @itemx -mlarge-text
18965 @opindex msmall-text
18966 @opindex mlarge-text
18967 When @option{-msmall-text} is used, the compiler assumes that the
18968 code of the entire program (or shared library) fits in 4MB, and is
18969 thus reachable with a branch instruction. When @option{-msmall-data}
18970 is used, the compiler can assume that all local symbols share the
18971 same @code{$gp} value, and thus reduce the number of instructions
18972 required for a function call from 4 to 1.
18973
18974 The default is @option{-mlarge-text}.
18975
18976 @item -mcpu=@var{cpu_type}
18977 @opindex mcpu
18978 Set the instruction set and instruction scheduling parameters for
18979 machine type @var{cpu_type}. You can specify either the @samp{EV}
18980 style name or the corresponding chip number. GCC supports scheduling
18981 parameters for the EV4, EV5 and EV6 family of processors and
18982 chooses the default values for the instruction set from the processor
18983 you specify. If you do not specify a processor type, GCC defaults
18984 to the processor on which the compiler was built.
18985
18986 Supported values for @var{cpu_type} are
18987
18988 @table @samp
18989 @item ev4
18990 @itemx ev45
18991 @itemx 21064
18992 Schedules as an EV4 and has no instruction set extensions.
18993
18994 @item ev5
18995 @itemx 21164
18996 Schedules as an EV5 and has no instruction set extensions.
18997
18998 @item ev56
18999 @itemx 21164a
19000 Schedules as an EV5 and supports the BWX extension.
19001
19002 @item pca56
19003 @itemx 21164pc
19004 @itemx 21164PC
19005 Schedules as an EV5 and supports the BWX and MAX extensions.
19006
19007 @item ev6
19008 @itemx 21264
19009 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19010
19011 @item ev67
19012 @itemx 21264a
19013 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19014 @end table
19015
19016 Native toolchains also support the value @samp{native},
19017 which selects the best architecture option for the host processor.
19018 @option{-mcpu=native} has no effect if GCC does not recognize
19019 the processor.
19020
19021 @item -mtune=@var{cpu_type}
19022 @opindex mtune
19023 Set only the instruction scheduling parameters for machine type
19024 @var{cpu_type}. The instruction set is not changed.
19025
19026 Native toolchains also support the value @samp{native},
19027 which selects the best architecture option for the host processor.
19028 @option{-mtune=native} has no effect if GCC does not recognize
19029 the processor.
19030
19031 @item -mmemory-latency=@var{time}
19032 @opindex mmemory-latency
19033 Sets the latency the scheduler should assume for typical memory
19034 references as seen by the application. This number is highly
19035 dependent on the memory access patterns used by the application
19036 and the size of the external cache on the machine.
19037
19038 Valid options for @var{time} are
19039
19040 @table @samp
19041 @item @var{number}
19042 A decimal number representing clock cycles.
19043
19044 @item L1
19045 @itemx L2
19046 @itemx L3
19047 @itemx main
19048 The compiler contains estimates of the number of clock cycles for
19049 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19050 (also called Dcache, Scache, and Bcache), as well as to main memory.
19051 Note that L3 is only valid for EV5.
19052
19053 @end table
19054 @end table
19055
19056 @node FR30 Options
19057 @subsection FR30 Options
19058 @cindex FR30 Options
19059
19060 These options are defined specifically for the FR30 port.
19061
19062 @table @gcctabopt
19063
19064 @item -msmall-model
19065 @opindex msmall-model
19066 Use the small address space model. This can produce smaller code, but
19067 it does assume that all symbolic values and addresses fit into a
19068 20-bit range.
19069
19070 @item -mno-lsim
19071 @opindex mno-lsim
19072 Assume that runtime support has been provided and so there is no need
19073 to include the simulator library (@file{libsim.a}) on the linker
19074 command line.
19075
19076 @end table
19077
19078 @node FT32 Options
19079 @subsection FT32 Options
19080 @cindex FT32 Options
19081
19082 These options are defined specifically for the FT32 port.
19083
19084 @table @gcctabopt
19085
19086 @item -msim
19087 @opindex msim
19088 Specifies that the program will be run on the simulator. This causes
19089 an alternate runtime startup and library to be linked.
19090 You must not use this option when generating programs that will run on
19091 real hardware; you must provide your own runtime library for whatever
19092 I/O functions are needed.
19093
19094 @item -mlra
19095 @opindex mlra
19096 Enable Local Register Allocation. This is still experimental for FT32,
19097 so by default the compiler uses standard reload.
19098
19099 @item -mnodiv
19100 @opindex mnodiv
19101 Do not use div and mod instructions.
19102
19103 @item -mft32b
19104 @opindex mft32b
19105 Enable use of the extended instructions of the FT32B processor.
19106
19107 @item -mcompress
19108 @opindex mcompress
19109 Compress all code using the Ft32B code compression scheme.
19110
19111 @item -mnopm
19112 @opindex mnopm
19113 Do not generate code that reads program memory.
19114
19115 @end table
19116
19117 @node FRV Options
19118 @subsection FRV Options
19119 @cindex FRV Options
19120
19121 @table @gcctabopt
19122 @item -mgpr-32
19123 @opindex mgpr-32
19124
19125 Only use the first 32 general-purpose registers.
19126
19127 @item -mgpr-64
19128 @opindex mgpr-64
19129
19130 Use all 64 general-purpose registers.
19131
19132 @item -mfpr-32
19133 @opindex mfpr-32
19134
19135 Use only the first 32 floating-point registers.
19136
19137 @item -mfpr-64
19138 @opindex mfpr-64
19139
19140 Use all 64 floating-point registers.
19141
19142 @item -mhard-float
19143 @opindex mhard-float
19144
19145 Use hardware instructions for floating-point operations.
19146
19147 @item -msoft-float
19148 @opindex msoft-float
19149
19150 Use library routines for floating-point operations.
19151
19152 @item -malloc-cc
19153 @opindex malloc-cc
19154
19155 Dynamically allocate condition code registers.
19156
19157 @item -mfixed-cc
19158 @opindex mfixed-cc
19159
19160 Do not try to dynamically allocate condition code registers, only
19161 use @code{icc0} and @code{fcc0}.
19162
19163 @item -mdword
19164 @opindex mdword
19165
19166 Change ABI to use double word insns.
19167
19168 @item -mno-dword
19169 @opindex mno-dword
19170 @opindex mdword
19171
19172 Do not use double word instructions.
19173
19174 @item -mdouble
19175 @opindex mdouble
19176
19177 Use floating-point double instructions.
19178
19179 @item -mno-double
19180 @opindex mno-double
19181
19182 Do not use floating-point double instructions.
19183
19184 @item -mmedia
19185 @opindex mmedia
19186
19187 Use media instructions.
19188
19189 @item -mno-media
19190 @opindex mno-media
19191
19192 Do not use media instructions.
19193
19194 @item -mmuladd
19195 @opindex mmuladd
19196
19197 Use multiply and add/subtract instructions.
19198
19199 @item -mno-muladd
19200 @opindex mno-muladd
19201
19202 Do not use multiply and add/subtract instructions.
19203
19204 @item -mfdpic
19205 @opindex mfdpic
19206
19207 Select the FDPIC ABI, which uses function descriptors to represent
19208 pointers to functions. Without any PIC/PIE-related options, it
19209 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19210 assumes GOT entries and small data are within a 12-bit range from the
19211 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19212 are computed with 32 bits.
19213 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19214
19215 @item -minline-plt
19216 @opindex minline-plt
19217
19218 Enable inlining of PLT entries in function calls to functions that are
19219 not known to bind locally. It has no effect without @option{-mfdpic}.
19220 It's enabled by default if optimizing for speed and compiling for
19221 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19222 optimization option such as @option{-O3} or above is present in the
19223 command line.
19224
19225 @item -mTLS
19226 @opindex mTLS
19227
19228 Assume a large TLS segment when generating thread-local code.
19229
19230 @item -mtls
19231 @opindex mtls
19232
19233 Do not assume a large TLS segment when generating thread-local code.
19234
19235 @item -mgprel-ro
19236 @opindex mgprel-ro
19237
19238 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19239 that is known to be in read-only sections. It's enabled by default,
19240 except for @option{-fpic} or @option{-fpie}: even though it may help
19241 make the global offset table smaller, it trades 1 instruction for 4.
19242 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19243 one of which may be shared by multiple symbols, and it avoids the need
19244 for a GOT entry for the referenced symbol, so it's more likely to be a
19245 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19246
19247 @item -multilib-library-pic
19248 @opindex multilib-library-pic
19249
19250 Link with the (library, not FD) pic libraries. It's implied by
19251 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19252 @option{-fpic} without @option{-mfdpic}. You should never have to use
19253 it explicitly.
19254
19255 @item -mlinked-fp
19256 @opindex mlinked-fp
19257
19258 Follow the EABI requirement of always creating a frame pointer whenever
19259 a stack frame is allocated. This option is enabled by default and can
19260 be disabled with @option{-mno-linked-fp}.
19261
19262 @item -mlong-calls
19263 @opindex mlong-calls
19264
19265 Use indirect addressing to call functions outside the current
19266 compilation unit. This allows the functions to be placed anywhere
19267 within the 32-bit address space.
19268
19269 @item -malign-labels
19270 @opindex malign-labels
19271
19272 Try to align labels to an 8-byte boundary by inserting NOPs into the
19273 previous packet. This option only has an effect when VLIW packing
19274 is enabled. It doesn't create new packets; it merely adds NOPs to
19275 existing ones.
19276
19277 @item -mlibrary-pic
19278 @opindex mlibrary-pic
19279
19280 Generate position-independent EABI code.
19281
19282 @item -macc-4
19283 @opindex macc-4
19284
19285 Use only the first four media accumulator registers.
19286
19287 @item -macc-8
19288 @opindex macc-8
19289
19290 Use all eight media accumulator registers.
19291
19292 @item -mpack
19293 @opindex mpack
19294
19295 Pack VLIW instructions.
19296
19297 @item -mno-pack
19298 @opindex mno-pack
19299
19300 Do not pack VLIW instructions.
19301
19302 @item -mno-eflags
19303 @opindex mno-eflags
19304
19305 Do not mark ABI switches in e_flags.
19306
19307 @item -mcond-move
19308 @opindex mcond-move
19309
19310 Enable the use of conditional-move instructions (default).
19311
19312 This switch is mainly for debugging the compiler and will likely be removed
19313 in a future version.
19314
19315 @item -mno-cond-move
19316 @opindex mno-cond-move
19317
19318 Disable the use of conditional-move instructions.
19319
19320 This switch is mainly for debugging the compiler and will likely be removed
19321 in a future version.
19322
19323 @item -mscc
19324 @opindex mscc
19325
19326 Enable the use of conditional set instructions (default).
19327
19328 This switch is mainly for debugging the compiler and will likely be removed
19329 in a future version.
19330
19331 @item -mno-scc
19332 @opindex mno-scc
19333
19334 Disable the use of conditional set instructions.
19335
19336 This switch is mainly for debugging the compiler and will likely be removed
19337 in a future version.
19338
19339 @item -mcond-exec
19340 @opindex mcond-exec
19341
19342 Enable the use of conditional execution (default).
19343
19344 This switch is mainly for debugging the compiler and will likely be removed
19345 in a future version.
19346
19347 @item -mno-cond-exec
19348 @opindex mno-cond-exec
19349
19350 Disable the use of conditional execution.
19351
19352 This switch is mainly for debugging the compiler and will likely be removed
19353 in a future version.
19354
19355 @item -mvliw-branch
19356 @opindex mvliw-branch
19357
19358 Run a pass to pack branches into VLIW instructions (default).
19359
19360 This switch is mainly for debugging the compiler and will likely be removed
19361 in a future version.
19362
19363 @item -mno-vliw-branch
19364 @opindex mno-vliw-branch
19365
19366 Do not run a pass to pack branches into VLIW instructions.
19367
19368 This switch is mainly for debugging the compiler and will likely be removed
19369 in a future version.
19370
19371 @item -mmulti-cond-exec
19372 @opindex mmulti-cond-exec
19373
19374 Enable optimization of @code{&&} and @code{||} in conditional execution
19375 (default).
19376
19377 This switch is mainly for debugging the compiler and will likely be removed
19378 in a future version.
19379
19380 @item -mno-multi-cond-exec
19381 @opindex mno-multi-cond-exec
19382
19383 Disable optimization of @code{&&} and @code{||} in conditional execution.
19384
19385 This switch is mainly for debugging the compiler and will likely be removed
19386 in a future version.
19387
19388 @item -mnested-cond-exec
19389 @opindex mnested-cond-exec
19390
19391 Enable nested conditional execution optimizations (default).
19392
19393 This switch is mainly for debugging the compiler and will likely be removed
19394 in a future version.
19395
19396 @item -mno-nested-cond-exec
19397 @opindex mno-nested-cond-exec
19398
19399 Disable nested conditional execution optimizations.
19400
19401 This switch is mainly for debugging the compiler and will likely be removed
19402 in a future version.
19403
19404 @item -moptimize-membar
19405 @opindex moptimize-membar
19406
19407 This switch removes redundant @code{membar} instructions from the
19408 compiler-generated code. It is enabled by default.
19409
19410 @item -mno-optimize-membar
19411 @opindex mno-optimize-membar
19412 @opindex moptimize-membar
19413
19414 This switch disables the automatic removal of redundant @code{membar}
19415 instructions from the generated code.
19416
19417 @item -mtomcat-stats
19418 @opindex mtomcat-stats
19419
19420 Cause gas to print out tomcat statistics.
19421
19422 @item -mcpu=@var{cpu}
19423 @opindex mcpu
19424
19425 Select the processor type for which to generate code. Possible values are
19426 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19427 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19428
19429 @end table
19430
19431 @node GNU/Linux Options
19432 @subsection GNU/Linux Options
19433
19434 These @samp{-m} options are defined for GNU/Linux targets:
19435
19436 @table @gcctabopt
19437 @item -mglibc
19438 @opindex mglibc
19439 Use the GNU C library. This is the default except
19440 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19441 @samp{*-*-linux-*android*} targets.
19442
19443 @item -muclibc
19444 @opindex muclibc
19445 Use uClibc C library. This is the default on
19446 @samp{*-*-linux-*uclibc*} targets.
19447
19448 @item -mmusl
19449 @opindex mmusl
19450 Use the musl C library. This is the default on
19451 @samp{*-*-linux-*musl*} targets.
19452
19453 @item -mbionic
19454 @opindex mbionic
19455 Use Bionic C library. This is the default on
19456 @samp{*-*-linux-*android*} targets.
19457
19458 @item -mandroid
19459 @opindex mandroid
19460 Compile code compatible with Android platform. This is the default on
19461 @samp{*-*-linux-*android*} targets.
19462
19463 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19464 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19465 this option makes the GCC driver pass Android-specific options to the linker.
19466 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19467 to be defined.
19468
19469 @item -tno-android-cc
19470 @opindex tno-android-cc
19471 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19472 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19473 @option{-fno-rtti} by default.
19474
19475 @item -tno-android-ld
19476 @opindex tno-android-ld
19477 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19478 linking options to the linker.
19479
19480 @end table
19481
19482 @node H8/300 Options
19483 @subsection H8/300 Options
19484
19485 These @samp{-m} options are defined for the H8/300 implementations:
19486
19487 @table @gcctabopt
19488 @item -mrelax
19489 @opindex mrelax
19490 Shorten some address references at link time, when possible; uses the
19491 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19492 ld, Using ld}, for a fuller description.
19493
19494 @item -mh
19495 @opindex mh
19496 Generate code for the H8/300H@.
19497
19498 @item -ms
19499 @opindex ms
19500 Generate code for the H8S@.
19501
19502 @item -mn
19503 @opindex mn
19504 Generate code for the H8S and H8/300H in the normal mode. This switch
19505 must be used either with @option{-mh} or @option{-ms}.
19506
19507 @item -ms2600
19508 @opindex ms2600
19509 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19510
19511 @item -mexr
19512 @opindex mexr
19513 Extended registers are stored on stack before execution of function
19514 with monitor attribute. Default option is @option{-mexr}.
19515 This option is valid only for H8S targets.
19516
19517 @item -mno-exr
19518 @opindex mno-exr
19519 @opindex mexr
19520 Extended registers are not stored on stack before execution of function
19521 with monitor attribute. Default option is @option{-mno-exr}.
19522 This option is valid only for H8S targets.
19523
19524 @item -mint32
19525 @opindex mint32
19526 Make @code{int} data 32 bits by default.
19527
19528 @item -malign-300
19529 @opindex malign-300
19530 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19531 The default for the H8/300H and H8S is to align longs and floats on
19532 4-byte boundaries.
19533 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19534 This option has no effect on the H8/300.
19535 @end table
19536
19537 @node HPPA Options
19538 @subsection HPPA Options
19539 @cindex HPPA Options
19540
19541 These @samp{-m} options are defined for the HPPA family of computers:
19542
19543 @table @gcctabopt
19544 @item -march=@var{architecture-type}
19545 @opindex march
19546 Generate code for the specified architecture. The choices for
19547 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19548 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19549 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19550 architecture option for your machine. Code compiled for lower numbered
19551 architectures runs on higher numbered architectures, but not the
19552 other way around.
19553
19554 @item -mpa-risc-1-0
19555 @itemx -mpa-risc-1-1
19556 @itemx -mpa-risc-2-0
19557 @opindex mpa-risc-1-0
19558 @opindex mpa-risc-1-1
19559 @opindex mpa-risc-2-0
19560 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19561
19562 @item -mcaller-copies
19563 @opindex mcaller-copies
19564 The caller copies function arguments passed by hidden reference. This
19565 option should be used with care as it is not compatible with the default
19566 32-bit runtime. However, only aggregates larger than eight bytes are
19567 passed by hidden reference and the option provides better compatibility
19568 with OpenMP.
19569
19570 @item -mjump-in-delay
19571 @opindex mjump-in-delay
19572 This option is ignored and provided for compatibility purposes only.
19573
19574 @item -mdisable-fpregs
19575 @opindex mdisable-fpregs
19576 Prevent floating-point registers from being used in any manner. This is
19577 necessary for compiling kernels that perform lazy context switching of
19578 floating-point registers. If you use this option and attempt to perform
19579 floating-point operations, the compiler aborts.
19580
19581 @item -mdisable-indexing
19582 @opindex mdisable-indexing
19583 Prevent the compiler from using indexing address modes. This avoids some
19584 rather obscure problems when compiling MIG generated code under MACH@.
19585
19586 @item -mno-space-regs
19587 @opindex mno-space-regs
19588 @opindex mspace-regs
19589 Generate code that assumes the target has no space registers. This allows
19590 GCC to generate faster indirect calls and use unscaled index address modes.
19591
19592 Such code is suitable for level 0 PA systems and kernels.
19593
19594 @item -mfast-indirect-calls
19595 @opindex mfast-indirect-calls
19596 Generate code that assumes calls never cross space boundaries. This
19597 allows GCC to emit code that performs faster indirect calls.
19598
19599 This option does not work in the presence of shared libraries or nested
19600 functions.
19601
19602 @item -mfixed-range=@var{register-range}
19603 @opindex mfixed-range
19604 Generate code treating the given register range as fixed registers.
19605 A fixed register is one that the register allocator cannot use. This is
19606 useful when compiling kernel code. A register range is specified as
19607 two registers separated by a dash. Multiple register ranges can be
19608 specified separated by a comma.
19609
19610 @item -mlong-load-store
19611 @opindex mlong-load-store
19612 Generate 3-instruction load and store sequences as sometimes required by
19613 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19614 the HP compilers.
19615
19616 @item -mportable-runtime
19617 @opindex mportable-runtime
19618 Use the portable calling conventions proposed by HP for ELF systems.
19619
19620 @item -mgas
19621 @opindex mgas
19622 Enable the use of assembler directives only GAS understands.
19623
19624 @item -mschedule=@var{cpu-type}
19625 @opindex mschedule
19626 Schedule code according to the constraints for the machine type
19627 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19628 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19629 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19630 proper scheduling option for your machine. The default scheduling is
19631 @samp{8000}.
19632
19633 @item -mlinker-opt
19634 @opindex mlinker-opt
19635 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19636 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19637 linkers in which they give bogus error messages when linking some programs.
19638
19639 @item -msoft-float
19640 @opindex msoft-float
19641 Generate output containing library calls for floating point.
19642 @strong{Warning:} the requisite libraries are not available for all HPPA
19643 targets. Normally the facilities of the machine's usual C compiler are
19644 used, but this cannot be done directly in cross-compilation. You must make
19645 your own arrangements to provide suitable library functions for
19646 cross-compilation.
19647
19648 @option{-msoft-float} changes the calling convention in the output file;
19649 therefore, it is only useful if you compile @emph{all} of a program with
19650 this option. In particular, you need to compile @file{libgcc.a}, the
19651 library that comes with GCC, with @option{-msoft-float} in order for
19652 this to work.
19653
19654 @item -msio
19655 @opindex msio
19656 Generate the predefine, @code{_SIO}, for server IO@. The default is
19657 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19658 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19659 options are available under HP-UX and HI-UX@.
19660
19661 @item -mgnu-ld
19662 @opindex mgnu-ld
19663 Use options specific to GNU @command{ld}.
19664 This passes @option{-shared} to @command{ld} when
19665 building a shared library. It is the default when GCC is configured,
19666 explicitly or implicitly, with the GNU linker. This option does not
19667 affect which @command{ld} is called; it only changes what parameters
19668 are passed to that @command{ld}.
19669 The @command{ld} that is called is determined by the
19670 @option{--with-ld} configure option, GCC's program search path, and
19671 finally by the user's @env{PATH}. The linker used by GCC can be printed
19672 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
19673 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19674
19675 @item -mhp-ld
19676 @opindex mhp-ld
19677 Use options specific to HP @command{ld}.
19678 This passes @option{-b} to @command{ld} when building
19679 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
19680 links. It is the default when GCC is configured, explicitly or
19681 implicitly, with the HP linker. This option does not affect
19682 which @command{ld} is called; it only changes what parameters are passed to that
19683 @command{ld}.
19684 The @command{ld} that is called is determined by the @option{--with-ld}
19685 configure option, GCC's program search path, and finally by the user's
19686 @env{PATH}. The linker used by GCC can be printed using @samp{which
19687 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
19688 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19689
19690 @item -mlong-calls
19691 @opindex mno-long-calls
19692 @opindex mlong-calls
19693 Generate code that uses long call sequences. This ensures that a call
19694 is always able to reach linker generated stubs. The default is to generate
19695 long calls only when the distance from the call site to the beginning
19696 of the function or translation unit, as the case may be, exceeds a
19697 predefined limit set by the branch type being used. The limits for
19698 normal calls are 7,600,000 and 240,000 bytes, respectively for the
19699 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
19700 240,000 bytes.
19701
19702 Distances are measured from the beginning of functions when using the
19703 @option{-ffunction-sections} option, or when using the @option{-mgas}
19704 and @option{-mno-portable-runtime} options together under HP-UX with
19705 the SOM linker.
19706
19707 It is normally not desirable to use this option as it degrades
19708 performance. However, it may be useful in large applications,
19709 particularly when partial linking is used to build the application.
19710
19711 The types of long calls used depends on the capabilities of the
19712 assembler and linker, and the type of code being generated. The
19713 impact on systems that support long absolute calls, and long pic
19714 symbol-difference or pc-relative calls should be relatively small.
19715 However, an indirect call is used on 32-bit ELF systems in pic code
19716 and it is quite long.
19717
19718 @item -munix=@var{unix-std}
19719 @opindex march
19720 Generate compiler predefines and select a startfile for the specified
19721 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
19722 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
19723 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
19724 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
19725 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
19726 and later.
19727
19728 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
19729 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
19730 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
19731 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
19732 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
19733 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
19734
19735 It is @emph{important} to note that this option changes the interfaces
19736 for various library routines. It also affects the operational behavior
19737 of the C library. Thus, @emph{extreme} care is needed in using this
19738 option.
19739
19740 Library code that is intended to operate with more than one UNIX
19741 standard must test, set and restore the variable @code{__xpg4_extended_mask}
19742 as appropriate. Most GNU software doesn't provide this capability.
19743
19744 @item -nolibdld
19745 @opindex nolibdld
19746 Suppress the generation of link options to search libdld.sl when the
19747 @option{-static} option is specified on HP-UX 10 and later.
19748
19749 @item -static
19750 @opindex static
19751 The HP-UX implementation of setlocale in libc has a dependency on
19752 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19753 when the @option{-static} option is specified, special link options
19754 are needed to resolve this dependency.
19755
19756 On HP-UX 10 and later, the GCC driver adds the necessary options to
19757 link with libdld.sl when the @option{-static} option is specified.
19758 This causes the resulting binary to be dynamic. On the 64-bit port,
19759 the linkers generate dynamic binaries by default in any case. The
19760 @option{-nolibdld} option can be used to prevent the GCC driver from
19761 adding these link options.
19762
19763 @item -threads
19764 @opindex threads
19765 Add support for multithreading with the @dfn{dce thread} library
19766 under HP-UX@. This option sets flags for both the preprocessor and
19767 linker.
19768 @end table
19769
19770 @node IA-64 Options
19771 @subsection IA-64 Options
19772 @cindex IA-64 Options
19773
19774 These are the @samp{-m} options defined for the Intel IA-64 architecture.
19775
19776 @table @gcctabopt
19777 @item -mbig-endian
19778 @opindex mbig-endian
19779 Generate code for a big-endian target. This is the default for HP-UX@.
19780
19781 @item -mlittle-endian
19782 @opindex mlittle-endian
19783 Generate code for a little-endian target. This is the default for AIX5
19784 and GNU/Linux.
19785
19786 @item -mgnu-as
19787 @itemx -mno-gnu-as
19788 @opindex mgnu-as
19789 @opindex mno-gnu-as
19790 Generate (or don't) code for the GNU assembler. This is the default.
19791 @c Also, this is the default if the configure option @option{--with-gnu-as}
19792 @c is used.
19793
19794 @item -mgnu-ld
19795 @itemx -mno-gnu-ld
19796 @opindex mgnu-ld
19797 @opindex mno-gnu-ld
19798 Generate (or don't) code for the GNU linker. This is the default.
19799 @c Also, this is the default if the configure option @option{--with-gnu-ld}
19800 @c is used.
19801
19802 @item -mno-pic
19803 @opindex mno-pic
19804 Generate code that does not use a global pointer register. The result
19805 is not position independent code, and violates the IA-64 ABI@.
19806
19807 @item -mvolatile-asm-stop
19808 @itemx -mno-volatile-asm-stop
19809 @opindex mvolatile-asm-stop
19810 @opindex mno-volatile-asm-stop
19811 Generate (or don't) a stop bit immediately before and after volatile asm
19812 statements.
19813
19814 @item -mregister-names
19815 @itemx -mno-register-names
19816 @opindex mregister-names
19817 @opindex mno-register-names
19818 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
19819 the stacked registers. This may make assembler output more readable.
19820
19821 @item -mno-sdata
19822 @itemx -msdata
19823 @opindex mno-sdata
19824 @opindex msdata
19825 Disable (or enable) optimizations that use the small data section. This may
19826 be useful for working around optimizer bugs.
19827
19828 @item -mconstant-gp
19829 @opindex mconstant-gp
19830 Generate code that uses a single constant global pointer value. This is
19831 useful when compiling kernel code.
19832
19833 @item -mauto-pic
19834 @opindex mauto-pic
19835 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
19836 This is useful when compiling firmware code.
19837
19838 @item -minline-float-divide-min-latency
19839 @opindex minline-float-divide-min-latency
19840 Generate code for inline divides of floating-point values
19841 using the minimum latency algorithm.
19842
19843 @item -minline-float-divide-max-throughput
19844 @opindex minline-float-divide-max-throughput
19845 Generate code for inline divides of floating-point values
19846 using the maximum throughput algorithm.
19847
19848 @item -mno-inline-float-divide
19849 @opindex mno-inline-float-divide
19850 Do not generate inline code for divides of floating-point values.
19851
19852 @item -minline-int-divide-min-latency
19853 @opindex minline-int-divide-min-latency
19854 Generate code for inline divides of integer values
19855 using the minimum latency algorithm.
19856
19857 @item -minline-int-divide-max-throughput
19858 @opindex minline-int-divide-max-throughput
19859 Generate code for inline divides of integer values
19860 using the maximum throughput algorithm.
19861
19862 @item -mno-inline-int-divide
19863 @opindex mno-inline-int-divide
19864 @opindex minline-int-divide
19865 Do not generate inline code for divides of integer values.
19866
19867 @item -minline-sqrt-min-latency
19868 @opindex minline-sqrt-min-latency
19869 Generate code for inline square roots
19870 using the minimum latency algorithm.
19871
19872 @item -minline-sqrt-max-throughput
19873 @opindex minline-sqrt-max-throughput
19874 Generate code for inline square roots
19875 using the maximum throughput algorithm.
19876
19877 @item -mno-inline-sqrt
19878 @opindex mno-inline-sqrt
19879 Do not generate inline code for @code{sqrt}.
19880
19881 @item -mfused-madd
19882 @itemx -mno-fused-madd
19883 @opindex mfused-madd
19884 @opindex mno-fused-madd
19885 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19886 instructions. The default is to use these instructions.
19887
19888 @item -mno-dwarf2-asm
19889 @itemx -mdwarf2-asm
19890 @opindex mno-dwarf2-asm
19891 @opindex mdwarf2-asm
19892 Don't (or do) generate assembler code for the DWARF line number debugging
19893 info. This may be useful when not using the GNU assembler.
19894
19895 @item -mearly-stop-bits
19896 @itemx -mno-early-stop-bits
19897 @opindex mearly-stop-bits
19898 @opindex mno-early-stop-bits
19899 Allow stop bits to be placed earlier than immediately preceding the
19900 instruction that triggered the stop bit. This can improve instruction
19901 scheduling, but does not always do so.
19902
19903 @item -mfixed-range=@var{register-range}
19904 @opindex mfixed-range
19905 Generate code treating the given register range as fixed registers.
19906 A fixed register is one that the register allocator cannot use. This is
19907 useful when compiling kernel code. A register range is specified as
19908 two registers separated by a dash. Multiple register ranges can be
19909 specified separated by a comma.
19910
19911 @item -mtls-size=@var{tls-size}
19912 @opindex mtls-size
19913 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19914 64.
19915
19916 @item -mtune=@var{cpu-type}
19917 @opindex mtune
19918 Tune the instruction scheduling for a particular CPU, Valid values are
19919 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19920 and @samp{mckinley}.
19921
19922 @item -milp32
19923 @itemx -mlp64
19924 @opindex milp32
19925 @opindex mlp64
19926 Generate code for a 32-bit or 64-bit environment.
19927 The 32-bit environment sets int, long and pointer to 32 bits.
19928 The 64-bit environment sets int to 32 bits and long and pointer
19929 to 64 bits. These are HP-UX specific flags.
19930
19931 @item -mno-sched-br-data-spec
19932 @itemx -msched-br-data-spec
19933 @opindex mno-sched-br-data-spec
19934 @opindex msched-br-data-spec
19935 (Dis/En)able data speculative scheduling before reload.
19936 This results in generation of @code{ld.a} instructions and
19937 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19938 The default setting is disabled.
19939
19940 @item -msched-ar-data-spec
19941 @itemx -mno-sched-ar-data-spec
19942 @opindex msched-ar-data-spec
19943 @opindex mno-sched-ar-data-spec
19944 (En/Dis)able data speculative scheduling after reload.
19945 This results in generation of @code{ld.a} instructions and
19946 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19947 The default setting is enabled.
19948
19949 @item -mno-sched-control-spec
19950 @itemx -msched-control-spec
19951 @opindex mno-sched-control-spec
19952 @opindex msched-control-spec
19953 (Dis/En)able control speculative scheduling. This feature is
19954 available only during region scheduling (i.e.@: before reload).
19955 This results in generation of the @code{ld.s} instructions and
19956 the corresponding check instructions @code{chk.s}.
19957 The default setting is disabled.
19958
19959 @item -msched-br-in-data-spec
19960 @itemx -mno-sched-br-in-data-spec
19961 @opindex msched-br-in-data-spec
19962 @opindex mno-sched-br-in-data-spec
19963 (En/Dis)able speculative scheduling of the instructions that
19964 are dependent on the data speculative loads before reload.
19965 This is effective only with @option{-msched-br-data-spec} enabled.
19966 The default setting is enabled.
19967
19968 @item -msched-ar-in-data-spec
19969 @itemx -mno-sched-ar-in-data-spec
19970 @opindex msched-ar-in-data-spec
19971 @opindex mno-sched-ar-in-data-spec
19972 (En/Dis)able speculative scheduling of the instructions that
19973 are dependent on the data speculative loads after reload.
19974 This is effective only with @option{-msched-ar-data-spec} enabled.
19975 The default setting is enabled.
19976
19977 @item -msched-in-control-spec
19978 @itemx -mno-sched-in-control-spec
19979 @opindex msched-in-control-spec
19980 @opindex mno-sched-in-control-spec
19981 (En/Dis)able speculative scheduling of the instructions that
19982 are dependent on the control speculative loads.
19983 This is effective only with @option{-msched-control-spec} enabled.
19984 The default setting is enabled.
19985
19986 @item -mno-sched-prefer-non-data-spec-insns
19987 @itemx -msched-prefer-non-data-spec-insns
19988 @opindex mno-sched-prefer-non-data-spec-insns
19989 @opindex msched-prefer-non-data-spec-insns
19990 If enabled, data-speculative instructions are chosen for schedule
19991 only if there are no other choices at the moment. This makes
19992 the use of the data speculation much more conservative.
19993 The default setting is disabled.
19994
19995 @item -mno-sched-prefer-non-control-spec-insns
19996 @itemx -msched-prefer-non-control-spec-insns
19997 @opindex mno-sched-prefer-non-control-spec-insns
19998 @opindex msched-prefer-non-control-spec-insns
19999 If enabled, control-speculative instructions are chosen for schedule
20000 only if there are no other choices at the moment. This makes
20001 the use of the control speculation much more conservative.
20002 The default setting is disabled.
20003
20004 @item -mno-sched-count-spec-in-critical-path
20005 @itemx -msched-count-spec-in-critical-path
20006 @opindex mno-sched-count-spec-in-critical-path
20007 @opindex msched-count-spec-in-critical-path
20008 If enabled, speculative dependencies are considered during
20009 computation of the instructions priorities. This makes the use of the
20010 speculation a bit more conservative.
20011 The default setting is disabled.
20012
20013 @item -msched-spec-ldc
20014 @opindex msched-spec-ldc
20015 Use a simple data speculation check. This option is on by default.
20016
20017 @item -msched-control-spec-ldc
20018 @opindex msched-spec-ldc
20019 Use a simple check for control speculation. This option is on by default.
20020
20021 @item -msched-stop-bits-after-every-cycle
20022 @opindex msched-stop-bits-after-every-cycle
20023 Place a stop bit after every cycle when scheduling. This option is on
20024 by default.
20025
20026 @item -msched-fp-mem-deps-zero-cost
20027 @opindex msched-fp-mem-deps-zero-cost
20028 Assume that floating-point stores and loads are not likely to cause a conflict
20029 when placed into the same instruction group. This option is disabled by
20030 default.
20031
20032 @item -msel-sched-dont-check-control-spec
20033 @opindex msel-sched-dont-check-control-spec
20034 Generate checks for control speculation in selective scheduling.
20035 This flag is disabled by default.
20036
20037 @item -msched-max-memory-insns=@var{max-insns}
20038 @opindex msched-max-memory-insns
20039 Limit on the number of memory insns per instruction group, giving lower
20040 priority to subsequent memory insns attempting to schedule in the same
20041 instruction group. Frequently useful to prevent cache bank conflicts.
20042 The default value is 1.
20043
20044 @item -msched-max-memory-insns-hard-limit
20045 @opindex msched-max-memory-insns-hard-limit
20046 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20047 disallowing more than that number in an instruction group.
20048 Otherwise, the limit is ``soft'', meaning that non-memory operations
20049 are preferred when the limit is reached, but memory operations may still
20050 be scheduled.
20051
20052 @end table
20053
20054 @node LM32 Options
20055 @subsection LM32 Options
20056 @cindex LM32 options
20057
20058 These @option{-m} options are defined for the LatticeMico32 architecture:
20059
20060 @table @gcctabopt
20061 @item -mbarrel-shift-enabled
20062 @opindex mbarrel-shift-enabled
20063 Enable barrel-shift instructions.
20064
20065 @item -mdivide-enabled
20066 @opindex mdivide-enabled
20067 Enable divide and modulus instructions.
20068
20069 @item -mmultiply-enabled
20070 @opindex multiply-enabled
20071 Enable multiply instructions.
20072
20073 @item -msign-extend-enabled
20074 @opindex msign-extend-enabled
20075 Enable sign extend instructions.
20076
20077 @item -muser-enabled
20078 @opindex muser-enabled
20079 Enable user-defined instructions.
20080
20081 @end table
20082
20083 @node M32C Options
20084 @subsection M32C Options
20085 @cindex M32C options
20086
20087 @table @gcctabopt
20088 @item -mcpu=@var{name}
20089 @opindex mcpu=
20090 Select the CPU for which code is generated. @var{name} may be one of
20091 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20092 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20093 the M32C/80 series.
20094
20095 @item -msim
20096 @opindex msim
20097 Specifies that the program will be run on the simulator. This causes
20098 an alternate runtime library to be linked in which supports, for
20099 example, file I/O@. You must not use this option when generating
20100 programs that will run on real hardware; you must provide your own
20101 runtime library for whatever I/O functions are needed.
20102
20103 @item -memregs=@var{number}
20104 @opindex memregs=
20105 Specifies the number of memory-based pseudo-registers GCC uses
20106 during code generation. These pseudo-registers are used like real
20107 registers, so there is a tradeoff between GCC's ability to fit the
20108 code into available registers, and the performance penalty of using
20109 memory instead of registers. Note that all modules in a program must
20110 be compiled with the same value for this option. Because of that, you
20111 must not use this option with GCC's default runtime libraries.
20112
20113 @end table
20114
20115 @node M32R/D Options
20116 @subsection M32R/D Options
20117 @cindex M32R/D options
20118
20119 These @option{-m} options are defined for Renesas M32R/D architectures:
20120
20121 @table @gcctabopt
20122 @item -m32r2
20123 @opindex m32r2
20124 Generate code for the M32R/2@.
20125
20126 @item -m32rx
20127 @opindex m32rx
20128 Generate code for the M32R/X@.
20129
20130 @item -m32r
20131 @opindex m32r
20132 Generate code for the M32R@. This is the default.
20133
20134 @item -mmodel=small
20135 @opindex mmodel=small
20136 Assume all objects live in the lower 16MB of memory (so that their addresses
20137 can be loaded with the @code{ld24} instruction), and assume all subroutines
20138 are reachable with the @code{bl} instruction.
20139 This is the default.
20140
20141 The addressability of a particular object can be set with the
20142 @code{model} attribute.
20143
20144 @item -mmodel=medium
20145 @opindex mmodel=medium
20146 Assume objects may be anywhere in the 32-bit address space (the compiler
20147 generates @code{seth/add3} instructions to load their addresses), and
20148 assume all subroutines are reachable with the @code{bl} instruction.
20149
20150 @item -mmodel=large
20151 @opindex mmodel=large
20152 Assume objects may be anywhere in the 32-bit address space (the compiler
20153 generates @code{seth/add3} instructions to load their addresses), and
20154 assume subroutines may not be reachable with the @code{bl} instruction
20155 (the compiler generates the much slower @code{seth/add3/jl}
20156 instruction sequence).
20157
20158 @item -msdata=none
20159 @opindex msdata=none
20160 Disable use of the small data area. Variables are put into
20161 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20162 @code{section} attribute has been specified).
20163 This is the default.
20164
20165 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20166 Objects may be explicitly put in the small data area with the
20167 @code{section} attribute using one of these sections.
20168
20169 @item -msdata=sdata
20170 @opindex msdata=sdata
20171 Put small global and static data in the small data area, but do not
20172 generate special code to reference them.
20173
20174 @item -msdata=use
20175 @opindex msdata=use
20176 Put small global and static data in the small data area, and generate
20177 special instructions to reference them.
20178
20179 @item -G @var{num}
20180 @opindex G
20181 @cindex smaller data references
20182 Put global and static objects less than or equal to @var{num} bytes
20183 into the small data or BSS sections instead of the normal data or BSS
20184 sections. The default value of @var{num} is 8.
20185 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20186 for this option to have any effect.
20187
20188 All modules should be compiled with the same @option{-G @var{num}} value.
20189 Compiling with different values of @var{num} may or may not work; if it
20190 doesn't the linker gives an error message---incorrect code is not
20191 generated.
20192
20193 @item -mdebug
20194 @opindex mdebug
20195 Makes the M32R-specific code in the compiler display some statistics
20196 that might help in debugging programs.
20197
20198 @item -malign-loops
20199 @opindex malign-loops
20200 Align all loops to a 32-byte boundary.
20201
20202 @item -mno-align-loops
20203 @opindex mno-align-loops
20204 Do not enforce a 32-byte alignment for loops. This is the default.
20205
20206 @item -missue-rate=@var{number}
20207 @opindex missue-rate=@var{number}
20208 Issue @var{number} instructions per cycle. @var{number} can only be 1
20209 or 2.
20210
20211 @item -mbranch-cost=@var{number}
20212 @opindex mbranch-cost=@var{number}
20213 @var{number} can only be 1 or 2. If it is 1 then branches are
20214 preferred over conditional code, if it is 2, then the opposite applies.
20215
20216 @item -mflush-trap=@var{number}
20217 @opindex mflush-trap=@var{number}
20218 Specifies the trap number to use to flush the cache. The default is
20219 12. Valid numbers are between 0 and 15 inclusive.
20220
20221 @item -mno-flush-trap
20222 @opindex mno-flush-trap
20223 Specifies that the cache cannot be flushed by using a trap.
20224
20225 @item -mflush-func=@var{name}
20226 @opindex mflush-func=@var{name}
20227 Specifies the name of the operating system function to call to flush
20228 the cache. The default is @samp{_flush_cache}, but a function call
20229 is only used if a trap is not available.
20230
20231 @item -mno-flush-func
20232 @opindex mno-flush-func
20233 Indicates that there is no OS function for flushing the cache.
20234
20235 @end table
20236
20237 @node M680x0 Options
20238 @subsection M680x0 Options
20239 @cindex M680x0 options
20240
20241 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20242 The default settings depend on which architecture was selected when
20243 the compiler was configured; the defaults for the most common choices
20244 are given below.
20245
20246 @table @gcctabopt
20247 @item -march=@var{arch}
20248 @opindex march
20249 Generate code for a specific M680x0 or ColdFire instruction set
20250 architecture. Permissible values of @var{arch} for M680x0
20251 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20252 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20253 architectures are selected according to Freescale's ISA classification
20254 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20255 @samp{isab} and @samp{isac}.
20256
20257 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20258 code for a ColdFire target. The @var{arch} in this macro is one of the
20259 @option{-march} arguments given above.
20260
20261 When used together, @option{-march} and @option{-mtune} select code
20262 that runs on a family of similar processors but that is optimized
20263 for a particular microarchitecture.
20264
20265 @item -mcpu=@var{cpu}
20266 @opindex mcpu
20267 Generate code for a specific M680x0 or ColdFire processor.
20268 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20269 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20270 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20271 below, which also classifies the CPUs into families:
20272
20273 @multitable @columnfractions 0.20 0.80
20274 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20275 @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}
20276 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20277 @item @samp{5206e} @tab @samp{5206e}
20278 @item @samp{5208} @tab @samp{5207} @samp{5208}
20279 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20280 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20281 @item @samp{5216} @tab @samp{5214} @samp{5216}
20282 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20283 @item @samp{5225} @tab @samp{5224} @samp{5225}
20284 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20285 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20286 @item @samp{5249} @tab @samp{5249}
20287 @item @samp{5250} @tab @samp{5250}
20288 @item @samp{5271} @tab @samp{5270} @samp{5271}
20289 @item @samp{5272} @tab @samp{5272}
20290 @item @samp{5275} @tab @samp{5274} @samp{5275}
20291 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20292 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20293 @item @samp{5307} @tab @samp{5307}
20294 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20295 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20296 @item @samp{5407} @tab @samp{5407}
20297 @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}
20298 @end multitable
20299
20300 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20301 @var{arch} is compatible with @var{cpu}. Other combinations of
20302 @option{-mcpu} and @option{-march} are rejected.
20303
20304 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20305 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20306 where the value of @var{family} is given by the table above.
20307
20308 @item -mtune=@var{tune}
20309 @opindex mtune
20310 Tune the code for a particular microarchitecture within the
20311 constraints set by @option{-march} and @option{-mcpu}.
20312 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20313 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20314 and @samp{cpu32}. The ColdFire microarchitectures
20315 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20316
20317 You can also use @option{-mtune=68020-40} for code that needs
20318 to run relatively well on 68020, 68030 and 68040 targets.
20319 @option{-mtune=68020-60} is similar but includes 68060 targets
20320 as well. These two options select the same tuning decisions as
20321 @option{-m68020-40} and @option{-m68020-60} respectively.
20322
20323 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20324 when tuning for 680x0 architecture @var{arch}. It also defines
20325 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20326 option is used. If GCC is tuning for a range of architectures,
20327 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20328 it defines the macros for every architecture in the range.
20329
20330 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20331 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20332 of the arguments given above.
20333
20334 @item -m68000
20335 @itemx -mc68000
20336 @opindex m68000
20337 @opindex mc68000
20338 Generate output for a 68000. This is the default
20339 when the compiler is configured for 68000-based systems.
20340 It is equivalent to @option{-march=68000}.
20341
20342 Use this option for microcontrollers with a 68000 or EC000 core,
20343 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20344
20345 @item -m68010
20346 @opindex m68010
20347 Generate output for a 68010. This is the default
20348 when the compiler is configured for 68010-based systems.
20349 It is equivalent to @option{-march=68010}.
20350
20351 @item -m68020
20352 @itemx -mc68020
20353 @opindex m68020
20354 @opindex mc68020
20355 Generate output for a 68020. This is the default
20356 when the compiler is configured for 68020-based systems.
20357 It is equivalent to @option{-march=68020}.
20358
20359 @item -m68030
20360 @opindex m68030
20361 Generate output for a 68030. This is the default when the compiler is
20362 configured for 68030-based systems. It is equivalent to
20363 @option{-march=68030}.
20364
20365 @item -m68040
20366 @opindex m68040
20367 Generate output for a 68040. This is the default when the compiler is
20368 configured for 68040-based systems. It is equivalent to
20369 @option{-march=68040}.
20370
20371 This option inhibits the use of 68881/68882 instructions that have to be
20372 emulated by software on the 68040. Use this option if your 68040 does not
20373 have code to emulate those instructions.
20374
20375 @item -m68060
20376 @opindex m68060
20377 Generate output for a 68060. This is the default when the compiler is
20378 configured for 68060-based systems. It is equivalent to
20379 @option{-march=68060}.
20380
20381 This option inhibits the use of 68020 and 68881/68882 instructions that
20382 have to be emulated by software on the 68060. Use this option if your 68060
20383 does not have code to emulate those instructions.
20384
20385 @item -mcpu32
20386 @opindex mcpu32
20387 Generate output for a CPU32. This is the default
20388 when the compiler is configured for CPU32-based systems.
20389 It is equivalent to @option{-march=cpu32}.
20390
20391 Use this option for microcontrollers with a
20392 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20393 68336, 68340, 68341, 68349 and 68360.
20394
20395 @item -m5200
20396 @opindex m5200
20397 Generate output for a 520X ColdFire CPU@. This is the default
20398 when the compiler is configured for 520X-based systems.
20399 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20400 in favor of that option.
20401
20402 Use this option for microcontroller with a 5200 core, including
20403 the MCF5202, MCF5203, MCF5204 and MCF5206.
20404
20405 @item -m5206e
20406 @opindex m5206e
20407 Generate output for a 5206e ColdFire CPU@. The option is now
20408 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20409
20410 @item -m528x
20411 @opindex m528x
20412 Generate output for a member of the ColdFire 528X family.
20413 The option is now deprecated in favor of the equivalent
20414 @option{-mcpu=528x}.
20415
20416 @item -m5307
20417 @opindex m5307
20418 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20419 in favor of the equivalent @option{-mcpu=5307}.
20420
20421 @item -m5407
20422 @opindex m5407
20423 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20424 in favor of the equivalent @option{-mcpu=5407}.
20425
20426 @item -mcfv4e
20427 @opindex mcfv4e
20428 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20429 This includes use of hardware floating-point instructions.
20430 The option is equivalent to @option{-mcpu=547x}, and is now
20431 deprecated in favor of that option.
20432
20433 @item -m68020-40
20434 @opindex m68020-40
20435 Generate output for a 68040, without using any of the new instructions.
20436 This results in code that can run relatively efficiently on either a
20437 68020/68881 or a 68030 or a 68040. The generated code does use the
20438 68881 instructions that are emulated on the 68040.
20439
20440 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20441
20442 @item -m68020-60
20443 @opindex m68020-60
20444 Generate output for a 68060, without using any of the new instructions.
20445 This results in code that can run relatively efficiently on either a
20446 68020/68881 or a 68030 or a 68040. The generated code does use the
20447 68881 instructions that are emulated on the 68060.
20448
20449 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20450
20451 @item -mhard-float
20452 @itemx -m68881
20453 @opindex mhard-float
20454 @opindex m68881
20455 Generate floating-point instructions. This is the default for 68020
20456 and above, and for ColdFire devices that have an FPU@. It defines the
20457 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20458 on ColdFire targets.
20459
20460 @item -msoft-float
20461 @opindex msoft-float
20462 Do not generate floating-point instructions; use library calls instead.
20463 This is the default for 68000, 68010, and 68832 targets. It is also
20464 the default for ColdFire devices that have no FPU.
20465
20466 @item -mdiv
20467 @itemx -mno-div
20468 @opindex mdiv
20469 @opindex mno-div
20470 Generate (do not generate) ColdFire hardware divide and remainder
20471 instructions. If @option{-march} is used without @option{-mcpu},
20472 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20473 architectures. Otherwise, the default is taken from the target CPU
20474 (either the default CPU, or the one specified by @option{-mcpu}). For
20475 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20476 @option{-mcpu=5206e}.
20477
20478 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20479
20480 @item -mshort
20481 @opindex mshort
20482 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20483 Additionally, parameters passed on the stack are also aligned to a
20484 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20485
20486 @item -mno-short
20487 @opindex mno-short
20488 Do not consider type @code{int} to be 16 bits wide. This is the default.
20489
20490 @item -mnobitfield
20491 @itemx -mno-bitfield
20492 @opindex mnobitfield
20493 @opindex mno-bitfield
20494 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20495 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20496
20497 @item -mbitfield
20498 @opindex mbitfield
20499 Do use the bit-field instructions. The @option{-m68020} option implies
20500 @option{-mbitfield}. This is the default if you use a configuration
20501 designed for a 68020.
20502
20503 @item -mrtd
20504 @opindex mrtd
20505 Use a different function-calling convention, in which functions
20506 that take a fixed number of arguments return with the @code{rtd}
20507 instruction, which pops their arguments while returning. This
20508 saves one instruction in the caller since there is no need to pop
20509 the arguments there.
20510
20511 This calling convention is incompatible with the one normally
20512 used on Unix, so you cannot use it if you need to call libraries
20513 compiled with the Unix compiler.
20514
20515 Also, you must provide function prototypes for all functions that
20516 take variable numbers of arguments (including @code{printf});
20517 otherwise incorrect code is generated for calls to those
20518 functions.
20519
20520 In addition, seriously incorrect code results if you call a
20521 function with too many arguments. (Normally, extra arguments are
20522 harmlessly ignored.)
20523
20524 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20525 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20526
20527 The default is @option{-mno-rtd}.
20528
20529 @item -malign-int
20530 @itemx -mno-align-int
20531 @opindex malign-int
20532 @opindex mno-align-int
20533 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20534 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20535 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20536 Aligning variables on 32-bit boundaries produces code that runs somewhat
20537 faster on processors with 32-bit busses at the expense of more memory.
20538
20539 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20540 aligns structures containing the above types differently than
20541 most published application binary interface specifications for the m68k.
20542
20543 @item -mpcrel
20544 @opindex mpcrel
20545 Use the pc-relative addressing mode of the 68000 directly, instead of
20546 using a global offset table. At present, this option implies @option{-fpic},
20547 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20548 not presently supported with @option{-mpcrel}, though this could be supported for
20549 68020 and higher processors.
20550
20551 @item -mno-strict-align
20552 @itemx -mstrict-align
20553 @opindex mno-strict-align
20554 @opindex mstrict-align
20555 Do not (do) assume that unaligned memory references are handled by
20556 the system.
20557
20558 @item -msep-data
20559 Generate code that allows the data segment to be located in a different
20560 area of memory from the text segment. This allows for execute-in-place in
20561 an environment without virtual memory management. This option implies
20562 @option{-fPIC}.
20563
20564 @item -mno-sep-data
20565 Generate code that assumes that the data segment follows the text segment.
20566 This is the default.
20567
20568 @item -mid-shared-library
20569 Generate code that supports shared libraries via the library ID method.
20570 This allows for execute-in-place and shared libraries in an environment
20571 without virtual memory management. This option implies @option{-fPIC}.
20572
20573 @item -mno-id-shared-library
20574 Generate code that doesn't assume ID-based shared libraries are being used.
20575 This is the default.
20576
20577 @item -mshared-library-id=n
20578 Specifies the identification number of the ID-based shared library being
20579 compiled. Specifying a value of 0 generates more compact code; specifying
20580 other values forces the allocation of that number to the current
20581 library, but is no more space- or time-efficient than omitting this option.
20582
20583 @item -mxgot
20584 @itemx -mno-xgot
20585 @opindex mxgot
20586 @opindex mno-xgot
20587 When generating position-independent code for ColdFire, generate code
20588 that works if the GOT has more than 8192 entries. This code is
20589 larger and slower than code generated without this option. On M680x0
20590 processors, this option is not needed; @option{-fPIC} suffices.
20591
20592 GCC normally uses a single instruction to load values from the GOT@.
20593 While this is relatively efficient, it only works if the GOT
20594 is smaller than about 64k. Anything larger causes the linker
20595 to report an error such as:
20596
20597 @cindex relocation truncated to fit (ColdFire)
20598 @smallexample
20599 relocation truncated to fit: R_68K_GOT16O foobar
20600 @end smallexample
20601
20602 If this happens, you should recompile your code with @option{-mxgot}.
20603 It should then work with very large GOTs. However, code generated with
20604 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20605 the value of a global symbol.
20606
20607 Note that some linkers, including newer versions of the GNU linker,
20608 can create multiple GOTs and sort GOT entries. If you have such a linker,
20609 you should only need to use @option{-mxgot} when compiling a single
20610 object file that accesses more than 8192 GOT entries. Very few do.
20611
20612 These options have no effect unless GCC is generating
20613 position-independent code.
20614
20615 @item -mlong-jump-table-offsets
20616 @opindex mlong-jump-table-offsets
20617 Use 32-bit offsets in @code{switch} tables. The default is to use
20618 16-bit offsets.
20619
20620 @end table
20621
20622 @node MCore Options
20623 @subsection MCore Options
20624 @cindex MCore options
20625
20626 These are the @samp{-m} options defined for the Motorola M*Core
20627 processors.
20628
20629 @table @gcctabopt
20630
20631 @item -mhardlit
20632 @itemx -mno-hardlit
20633 @opindex mhardlit
20634 @opindex mno-hardlit
20635 Inline constants into the code stream if it can be done in two
20636 instructions or less.
20637
20638 @item -mdiv
20639 @itemx -mno-div
20640 @opindex mdiv
20641 @opindex mno-div
20642 Use the divide instruction. (Enabled by default).
20643
20644 @item -mrelax-immediate
20645 @itemx -mno-relax-immediate
20646 @opindex mrelax-immediate
20647 @opindex mno-relax-immediate
20648 Allow arbitrary-sized immediates in bit operations.
20649
20650 @item -mwide-bitfields
20651 @itemx -mno-wide-bitfields
20652 @opindex mwide-bitfields
20653 @opindex mno-wide-bitfields
20654 Always treat bit-fields as @code{int}-sized.
20655
20656 @item -m4byte-functions
20657 @itemx -mno-4byte-functions
20658 @opindex m4byte-functions
20659 @opindex mno-4byte-functions
20660 Force all functions to be aligned to a 4-byte boundary.
20661
20662 @item -mcallgraph-data
20663 @itemx -mno-callgraph-data
20664 @opindex mcallgraph-data
20665 @opindex mno-callgraph-data
20666 Emit callgraph information.
20667
20668 @item -mslow-bytes
20669 @itemx -mno-slow-bytes
20670 @opindex mslow-bytes
20671 @opindex mno-slow-bytes
20672 Prefer word access when reading byte quantities.
20673
20674 @item -mlittle-endian
20675 @itemx -mbig-endian
20676 @opindex mlittle-endian
20677 @opindex mbig-endian
20678 Generate code for a little-endian target.
20679
20680 @item -m210
20681 @itemx -m340
20682 @opindex m210
20683 @opindex m340
20684 Generate code for the 210 processor.
20685
20686 @item -mno-lsim
20687 @opindex mno-lsim
20688 Assume that runtime support has been provided and so omit the
20689 simulator library (@file{libsim.a)} from the linker command line.
20690
20691 @item -mstack-increment=@var{size}
20692 @opindex mstack-increment
20693 Set the maximum amount for a single stack increment operation. Large
20694 values can increase the speed of programs that contain functions
20695 that need a large amount of stack space, but they can also trigger a
20696 segmentation fault if the stack is extended too much. The default
20697 value is 0x1000.
20698
20699 @end table
20700
20701 @node MeP Options
20702 @subsection MeP Options
20703 @cindex MeP options
20704
20705 @table @gcctabopt
20706
20707 @item -mabsdiff
20708 @opindex mabsdiff
20709 Enables the @code{abs} instruction, which is the absolute difference
20710 between two registers.
20711
20712 @item -mall-opts
20713 @opindex mall-opts
20714 Enables all the optional instructions---average, multiply, divide, bit
20715 operations, leading zero, absolute difference, min/max, clip, and
20716 saturation.
20717
20718
20719 @item -maverage
20720 @opindex maverage
20721 Enables the @code{ave} instruction, which computes the average of two
20722 registers.
20723
20724 @item -mbased=@var{n}
20725 @opindex mbased=
20726 Variables of size @var{n} bytes or smaller are placed in the
20727 @code{.based} section by default. Based variables use the @code{$tp}
20728 register as a base register, and there is a 128-byte limit to the
20729 @code{.based} section.
20730
20731 @item -mbitops
20732 @opindex mbitops
20733 Enables the bit operation instructions---bit test (@code{btstm}), set
20734 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
20735 test-and-set (@code{tas}).
20736
20737 @item -mc=@var{name}
20738 @opindex mc=
20739 Selects which section constant data is placed in. @var{name} may
20740 be @samp{tiny}, @samp{near}, or @samp{far}.
20741
20742 @item -mclip
20743 @opindex mclip
20744 Enables the @code{clip} instruction. Note that @option{-mclip} is not
20745 useful unless you also provide @option{-mminmax}.
20746
20747 @item -mconfig=@var{name}
20748 @opindex mconfig=
20749 Selects one of the built-in core configurations. Each MeP chip has
20750 one or more modules in it; each module has a core CPU and a variety of
20751 coprocessors, optional instructions, and peripherals. The
20752 @code{MeP-Integrator} tool, not part of GCC, provides these
20753 configurations through this option; using this option is the same as
20754 using all the corresponding command-line options. The default
20755 configuration is @samp{default}.
20756
20757 @item -mcop
20758 @opindex mcop
20759 Enables the coprocessor instructions. By default, this is a 32-bit
20760 coprocessor. Note that the coprocessor is normally enabled via the
20761 @option{-mconfig=} option.
20762
20763 @item -mcop32
20764 @opindex mcop32
20765 Enables the 32-bit coprocessor's instructions.
20766
20767 @item -mcop64
20768 @opindex mcop64
20769 Enables the 64-bit coprocessor's instructions.
20770
20771 @item -mivc2
20772 @opindex mivc2
20773 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20774
20775 @item -mdc
20776 @opindex mdc
20777 Causes constant variables to be placed in the @code{.near} section.
20778
20779 @item -mdiv
20780 @opindex mdiv
20781 Enables the @code{div} and @code{divu} instructions.
20782
20783 @item -meb
20784 @opindex meb
20785 Generate big-endian code.
20786
20787 @item -mel
20788 @opindex mel
20789 Generate little-endian code.
20790
20791 @item -mio-volatile
20792 @opindex mio-volatile
20793 Tells the compiler that any variable marked with the @code{io}
20794 attribute is to be considered volatile.
20795
20796 @item -ml
20797 @opindex ml
20798 Causes variables to be assigned to the @code{.far} section by default.
20799
20800 @item -mleadz
20801 @opindex mleadz
20802 Enables the @code{leadz} (leading zero) instruction.
20803
20804 @item -mm
20805 @opindex mm
20806 Causes variables to be assigned to the @code{.near} section by default.
20807
20808 @item -mminmax
20809 @opindex mminmax
20810 Enables the @code{min} and @code{max} instructions.
20811
20812 @item -mmult
20813 @opindex mmult
20814 Enables the multiplication and multiply-accumulate instructions.
20815
20816 @item -mno-opts
20817 @opindex mno-opts
20818 Disables all the optional instructions enabled by @option{-mall-opts}.
20819
20820 @item -mrepeat
20821 @opindex mrepeat
20822 Enables the @code{repeat} and @code{erepeat} instructions, used for
20823 low-overhead looping.
20824
20825 @item -ms
20826 @opindex ms
20827 Causes all variables to default to the @code{.tiny} section. Note
20828 that there is a 65536-byte limit to this section. Accesses to these
20829 variables use the @code{%gp} base register.
20830
20831 @item -msatur
20832 @opindex msatur
20833 Enables the saturation instructions. Note that the compiler does not
20834 currently generate these itself, but this option is included for
20835 compatibility with other tools, like @code{as}.
20836
20837 @item -msdram
20838 @opindex msdram
20839 Link the SDRAM-based runtime instead of the default ROM-based runtime.
20840
20841 @item -msim
20842 @opindex msim
20843 Link the simulator run-time libraries.
20844
20845 @item -msimnovec
20846 @opindex msimnovec
20847 Link the simulator runtime libraries, excluding built-in support
20848 for reset and exception vectors and tables.
20849
20850 @item -mtf
20851 @opindex mtf
20852 Causes all functions to default to the @code{.far} section. Without
20853 this option, functions default to the @code{.near} section.
20854
20855 @item -mtiny=@var{n}
20856 @opindex mtiny=
20857 Variables that are @var{n} bytes or smaller are allocated to the
20858 @code{.tiny} section. These variables use the @code{$gp} base
20859 register. The default for this option is 4, but note that there's a
20860 65536-byte limit to the @code{.tiny} section.
20861
20862 @end table
20863
20864 @node MicroBlaze Options
20865 @subsection MicroBlaze Options
20866 @cindex MicroBlaze Options
20867
20868 @table @gcctabopt
20869
20870 @item -msoft-float
20871 @opindex msoft-float
20872 Use software emulation for floating point (default).
20873
20874 @item -mhard-float
20875 @opindex mhard-float
20876 Use hardware floating-point instructions.
20877
20878 @item -mmemcpy
20879 @opindex mmemcpy
20880 Do not optimize block moves, use @code{memcpy}.
20881
20882 @item -mno-clearbss
20883 @opindex mno-clearbss
20884 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20885
20886 @item -mcpu=@var{cpu-type}
20887 @opindex mcpu=
20888 Use features of, and schedule code for, the given CPU.
20889 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20890 where @var{X} is a major version, @var{YY} is the minor version, and
20891 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20892 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
20893
20894 @item -mxl-soft-mul
20895 @opindex mxl-soft-mul
20896 Use software multiply emulation (default).
20897
20898 @item -mxl-soft-div
20899 @opindex mxl-soft-div
20900 Use software emulation for divides (default).
20901
20902 @item -mxl-barrel-shift
20903 @opindex mxl-barrel-shift
20904 Use the hardware barrel shifter.
20905
20906 @item -mxl-pattern-compare
20907 @opindex mxl-pattern-compare
20908 Use pattern compare instructions.
20909
20910 @item -msmall-divides
20911 @opindex msmall-divides
20912 Use table lookup optimization for small signed integer divisions.
20913
20914 @item -mxl-stack-check
20915 @opindex mxl-stack-check
20916 This option is deprecated. Use @option{-fstack-check} instead.
20917
20918 @item -mxl-gp-opt
20919 @opindex mxl-gp-opt
20920 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20921
20922 @item -mxl-multiply-high
20923 @opindex mxl-multiply-high
20924 Use multiply high instructions for high part of 32x32 multiply.
20925
20926 @item -mxl-float-convert
20927 @opindex mxl-float-convert
20928 Use hardware floating-point conversion instructions.
20929
20930 @item -mxl-float-sqrt
20931 @opindex mxl-float-sqrt
20932 Use hardware floating-point square root instruction.
20933
20934 @item -mbig-endian
20935 @opindex mbig-endian
20936 Generate code for a big-endian target.
20937
20938 @item -mlittle-endian
20939 @opindex mlittle-endian
20940 Generate code for a little-endian target.
20941
20942 @item -mxl-reorder
20943 @opindex mxl-reorder
20944 Use reorder instructions (swap and byte reversed load/store).
20945
20946 @item -mxl-mode-@var{app-model}
20947 Select application model @var{app-model}. Valid models are
20948 @table @samp
20949 @item executable
20950 normal executable (default), uses startup code @file{crt0.o}.
20951
20952 @item -mpic-data-is-text-relative
20953 @opindex mpic-data-is-text-relative
20954 Assume that the displacement between the text and data segments is fixed
20955 at static link time. This allows data to be referenced by offset from start of
20956 text address instead of GOT since PC-relative addressing is not supported.
20957
20958 @item xmdstub
20959 for use with Xilinx Microprocessor Debugger (XMD) based
20960 software intrusive debug agent called xmdstub. This uses startup file
20961 @file{crt1.o} and sets the start address of the program to 0x800.
20962
20963 @item bootstrap
20964 for applications that are loaded using a bootloader.
20965 This model uses startup file @file{crt2.o} which does not contain a processor
20966 reset vector handler. This is suitable for transferring control on a
20967 processor reset to the bootloader rather than the application.
20968
20969 @item novectors
20970 for applications that do not require any of the
20971 MicroBlaze vectors. This option may be useful for applications running
20972 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20973 @end table
20974
20975 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20976 @option{-mxl-mode-@var{app-model}}.
20977
20978 @end table
20979
20980 @node MIPS Options
20981 @subsection MIPS Options
20982 @cindex MIPS options
20983
20984 @table @gcctabopt
20985
20986 @item -EB
20987 @opindex EB
20988 Generate big-endian code.
20989
20990 @item -EL
20991 @opindex EL
20992 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20993 configurations.
20994
20995 @item -march=@var{arch}
20996 @opindex march
20997 Generate code that runs on @var{arch}, which can be the name of a
20998 generic MIPS ISA, or the name of a particular processor.
20999 The ISA names are:
21000 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21001 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21002 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21003 @samp{mips64r5} and @samp{mips64r6}.
21004 The processor names are:
21005 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21006 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21007 @samp{5kc}, @samp{5kf},
21008 @samp{20kc},
21009 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21010 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21011 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21012 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21013 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21014 @samp{i6400}, @samp{i6500},
21015 @samp{interaptiv},
21016 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21017 @samp{gs464e}, @samp{gs264e},
21018 @samp{m4k},
21019 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21020 @samp{m5100}, @samp{m5101},
21021 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21022 @samp{orion},
21023 @samp{p5600}, @samp{p6600},
21024 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21025 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
21026 @samp{rm7000}, @samp{rm9000},
21027 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21028 @samp{sb1},
21029 @samp{sr71000},
21030 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21031 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21032 @samp{xlr} and @samp{xlp}.
21033 The special value @samp{from-abi} selects the
21034 most compatible architecture for the selected ABI (that is,
21035 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21036
21037 The native Linux/GNU toolchain also supports the value @samp{native},
21038 which selects the best architecture option for the host processor.
21039 @option{-march=native} has no effect if GCC does not recognize
21040 the processor.
21041
21042 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21043 (for example, @option{-march=r2k}). Prefixes are optional, and
21044 @samp{vr} may be written @samp{r}.
21045
21046 Names of the form @samp{@var{n}f2_1} refer to processors with
21047 FPUs clocked at half the rate of the core, names of the form
21048 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21049 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21050 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21051 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21052 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21053 accepted as synonyms for @samp{@var{n}f1_1}.
21054
21055 GCC defines two macros based on the value of this option. The first
21056 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21057 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21058 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21059 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21060 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21061
21062 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21063 above. In other words, it has the full prefix and does not
21064 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21065 the macro names the resolved architecture (either @code{"mips1"} or
21066 @code{"mips3"}). It names the default architecture when no
21067 @option{-march} option is given.
21068
21069 @item -mtune=@var{arch}
21070 @opindex mtune
21071 Optimize for @var{arch}. Among other things, this option controls
21072 the way instructions are scheduled, and the perceived cost of arithmetic
21073 operations. The list of @var{arch} values is the same as for
21074 @option{-march}.
21075
21076 When this option is not used, GCC optimizes for the processor
21077 specified by @option{-march}. By using @option{-march} and
21078 @option{-mtune} together, it is possible to generate code that
21079 runs on a family of processors, but optimize the code for one
21080 particular member of that family.
21081
21082 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21083 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21084 @option{-march} ones described above.
21085
21086 @item -mips1
21087 @opindex mips1
21088 Equivalent to @option{-march=mips1}.
21089
21090 @item -mips2
21091 @opindex mips2
21092 Equivalent to @option{-march=mips2}.
21093
21094 @item -mips3
21095 @opindex mips3
21096 Equivalent to @option{-march=mips3}.
21097
21098 @item -mips4
21099 @opindex mips4
21100 Equivalent to @option{-march=mips4}.
21101
21102 @item -mips32
21103 @opindex mips32
21104 Equivalent to @option{-march=mips32}.
21105
21106 @item -mips32r3
21107 @opindex mips32r3
21108 Equivalent to @option{-march=mips32r3}.
21109
21110 @item -mips32r5
21111 @opindex mips32r5
21112 Equivalent to @option{-march=mips32r5}.
21113
21114 @item -mips32r6
21115 @opindex mips32r6
21116 Equivalent to @option{-march=mips32r6}.
21117
21118 @item -mips64
21119 @opindex mips64
21120 Equivalent to @option{-march=mips64}.
21121
21122 @item -mips64r2
21123 @opindex mips64r2
21124 Equivalent to @option{-march=mips64r2}.
21125
21126 @item -mips64r3
21127 @opindex mips64r3
21128 Equivalent to @option{-march=mips64r3}.
21129
21130 @item -mips64r5
21131 @opindex mips64r5
21132 Equivalent to @option{-march=mips64r5}.
21133
21134 @item -mips64r6
21135 @opindex mips64r6
21136 Equivalent to @option{-march=mips64r6}.
21137
21138 @item -mips16
21139 @itemx -mno-mips16
21140 @opindex mips16
21141 @opindex mno-mips16
21142 Generate (do not generate) MIPS16 code. If GCC is targeting a
21143 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21144
21145 MIPS16 code generation can also be controlled on a per-function basis
21146 by means of @code{mips16} and @code{nomips16} attributes.
21147 @xref{Function Attributes}, for more information.
21148
21149 @item -mflip-mips16
21150 @opindex mflip-mips16
21151 Generate MIPS16 code on alternating functions. This option is provided
21152 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21153 not intended for ordinary use in compiling user code.
21154
21155 @item -minterlink-compressed
21156 @itemx -mno-interlink-compressed
21157 @opindex minterlink-compressed
21158 @opindex mno-interlink-compressed
21159 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21160 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21161
21162 For example, code using the standard ISA encoding cannot jump directly
21163 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21164 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21165 knows that the target of the jump is not compressed.
21166
21167 @item -minterlink-mips16
21168 @itemx -mno-interlink-mips16
21169 @opindex minterlink-mips16
21170 @opindex mno-interlink-mips16
21171 Aliases of @option{-minterlink-compressed} and
21172 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21173 and are retained for backwards compatibility.
21174
21175 @item -mabi=32
21176 @itemx -mabi=o64
21177 @itemx -mabi=n32
21178 @itemx -mabi=64
21179 @itemx -mabi=eabi
21180 @opindex mabi=32
21181 @opindex mabi=o64
21182 @opindex mabi=n32
21183 @opindex mabi=64
21184 @opindex mabi=eabi
21185 Generate code for the given ABI@.
21186
21187 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21188 generates 64-bit code when you select a 64-bit architecture, but you
21189 can use @option{-mgp32} to get 32-bit code instead.
21190
21191 For information about the O64 ABI, see
21192 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21193
21194 GCC supports a variant of the o32 ABI in which floating-point registers
21195 are 64 rather than 32 bits wide. You can select this combination with
21196 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21197 and @code{mfhc1} instructions and is therefore only supported for
21198 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21199
21200 The register assignments for arguments and return values remain the
21201 same, but each scalar value is passed in a single 64-bit register
21202 rather than a pair of 32-bit registers. For example, scalar
21203 floating-point values are returned in @samp{$f0} only, not a
21204 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21205 remains the same in that the even-numbered double-precision registers
21206 are saved.
21207
21208 Two additional variants of the o32 ABI are supported to enable
21209 a transition from 32-bit to 64-bit registers. These are FPXX
21210 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21211 The FPXX extension mandates that all code must execute correctly
21212 when run using 32-bit or 64-bit registers. The code can be interlinked
21213 with either FP32 or FP64, but not both.
21214 The FP64A extension is similar to the FP64 extension but forbids the
21215 use of odd-numbered single-precision registers. This can be used
21216 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21217 processors and allows both FP32 and FP64A code to interlink and
21218 run in the same process without changing FPU modes.
21219
21220 @item -mabicalls
21221 @itemx -mno-abicalls
21222 @opindex mabicalls
21223 @opindex mno-abicalls
21224 Generate (do not generate) code that is suitable for SVR4-style
21225 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21226 systems.
21227
21228 @item -mshared
21229 @itemx -mno-shared
21230 Generate (do not generate) code that is fully position-independent,
21231 and that can therefore be linked into shared libraries. This option
21232 only affects @option{-mabicalls}.
21233
21234 All @option{-mabicalls} code has traditionally been position-independent,
21235 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21236 as an extension, the GNU toolchain allows executables to use absolute
21237 accesses for locally-binding symbols. It can also use shorter GP
21238 initialization sequences and generate direct calls to locally-defined
21239 functions. This mode is selected by @option{-mno-shared}.
21240
21241 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21242 objects that can only be linked by the GNU linker. However, the option
21243 does not affect the ABI of the final executable; it only affects the ABI
21244 of relocatable objects. Using @option{-mno-shared} generally makes
21245 executables both smaller and quicker.
21246
21247 @option{-mshared} is the default.
21248
21249 @item -mplt
21250 @itemx -mno-plt
21251 @opindex mplt
21252 @opindex mno-plt
21253 Assume (do not assume) that the static and dynamic linkers
21254 support PLTs and copy relocations. This option only affects
21255 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21256 has no effect without @option{-msym32}.
21257
21258 You can make @option{-mplt} the default by configuring
21259 GCC with @option{--with-mips-plt}. The default is
21260 @option{-mno-plt} otherwise.
21261
21262 @item -mxgot
21263 @itemx -mno-xgot
21264 @opindex mxgot
21265 @opindex mno-xgot
21266 Lift (do not lift) the usual restrictions on the size of the global
21267 offset table.
21268
21269 GCC normally uses a single instruction to load values from the GOT@.
21270 While this is relatively efficient, it only works if the GOT
21271 is smaller than about 64k. Anything larger causes the linker
21272 to report an error such as:
21273
21274 @cindex relocation truncated to fit (MIPS)
21275 @smallexample
21276 relocation truncated to fit: R_MIPS_GOT16 foobar
21277 @end smallexample
21278
21279 If this happens, you should recompile your code with @option{-mxgot}.
21280 This works with very large GOTs, although the code is also
21281 less efficient, since it takes three instructions to fetch the
21282 value of a global symbol.
21283
21284 Note that some linkers can create multiple GOTs. If you have such a
21285 linker, you should only need to use @option{-mxgot} when a single object
21286 file accesses more than 64k's worth of GOT entries. Very few do.
21287
21288 These options have no effect unless GCC is generating position
21289 independent code.
21290
21291 @item -mgp32
21292 @opindex mgp32
21293 Assume that general-purpose registers are 32 bits wide.
21294
21295 @item -mgp64
21296 @opindex mgp64
21297 Assume that general-purpose registers are 64 bits wide.
21298
21299 @item -mfp32
21300 @opindex mfp32
21301 Assume that floating-point registers are 32 bits wide.
21302
21303 @item -mfp64
21304 @opindex mfp64
21305 Assume that floating-point registers are 64 bits wide.
21306
21307 @item -mfpxx
21308 @opindex mfpxx
21309 Do not assume the width of floating-point registers.
21310
21311 @item -mhard-float
21312 @opindex mhard-float
21313 Use floating-point coprocessor instructions.
21314
21315 @item -msoft-float
21316 @opindex msoft-float
21317 Do not use floating-point coprocessor instructions. Implement
21318 floating-point calculations using library calls instead.
21319
21320 @item -mno-float
21321 @opindex mno-float
21322 Equivalent to @option{-msoft-float}, but additionally asserts that the
21323 program being compiled does not perform any floating-point operations.
21324 This option is presently supported only by some bare-metal MIPS
21325 configurations, where it may select a special set of libraries
21326 that lack all floating-point support (including, for example, the
21327 floating-point @code{printf} formats).
21328 If code compiled with @option{-mno-float} accidentally contains
21329 floating-point operations, it is likely to suffer a link-time
21330 or run-time failure.
21331
21332 @item -msingle-float
21333 @opindex msingle-float
21334 Assume that the floating-point coprocessor only supports single-precision
21335 operations.
21336
21337 @item -mdouble-float
21338 @opindex mdouble-float
21339 Assume that the floating-point coprocessor supports double-precision
21340 operations. This is the default.
21341
21342 @item -modd-spreg
21343 @itemx -mno-odd-spreg
21344 @opindex modd-spreg
21345 @opindex mno-odd-spreg
21346 Enable the use of odd-numbered single-precision floating-point registers
21347 for the o32 ABI. This is the default for processors that are known to
21348 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21349 is set by default.
21350
21351 @item -mabs=2008
21352 @itemx -mabs=legacy
21353 @opindex mabs=2008
21354 @opindex mabs=legacy
21355 These options control the treatment of the special not-a-number (NaN)
21356 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21357 @code{neg.@i{fmt}} machine instructions.
21358
21359 By default or when @option{-mabs=legacy} is used the legacy
21360 treatment is selected. In this case these instructions are considered
21361 arithmetic and avoided where correct operation is required and the
21362 input operand might be a NaN. A longer sequence of instructions that
21363 manipulate the sign bit of floating-point datum manually is used
21364 instead unless the @option{-ffinite-math-only} option has also been
21365 specified.
21366
21367 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21368 this case these instructions are considered non-arithmetic and therefore
21369 operating correctly in all cases, including in particular where the
21370 input operand is a NaN. These instructions are therefore always used
21371 for the respective operations.
21372
21373 @item -mnan=2008
21374 @itemx -mnan=legacy
21375 @opindex mnan=2008
21376 @opindex mnan=legacy
21377 These options control the encoding of the special not-a-number (NaN)
21378 IEEE 754 floating-point data.
21379
21380 The @option{-mnan=legacy} option selects the legacy encoding. In this
21381 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21382 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21383 by the first bit of their trailing significand field being 1.
21384
21385 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21386 this case qNaNs are denoted by the first bit of their trailing
21387 significand field being 1, whereas sNaNs are denoted by the first bit of
21388 their trailing significand field being 0.
21389
21390 The default is @option{-mnan=legacy} unless GCC has been configured with
21391 @option{--with-nan=2008}.
21392
21393 @item -mllsc
21394 @itemx -mno-llsc
21395 @opindex mllsc
21396 @opindex mno-llsc
21397 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21398 implement atomic memory built-in functions. When neither option is
21399 specified, GCC uses the instructions if the target architecture
21400 supports them.
21401
21402 @option{-mllsc} is useful if the runtime environment can emulate the
21403 instructions and @option{-mno-llsc} can be useful when compiling for
21404 nonstandard ISAs. You can make either option the default by
21405 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21406 respectively. @option{--with-llsc} is the default for some
21407 configurations; see the installation documentation for details.
21408
21409 @item -mdsp
21410 @itemx -mno-dsp
21411 @opindex mdsp
21412 @opindex mno-dsp
21413 Use (do not use) revision 1 of the MIPS DSP ASE@.
21414 @xref{MIPS DSP Built-in Functions}. This option defines the
21415 preprocessor macro @code{__mips_dsp}. It also defines
21416 @code{__mips_dsp_rev} to 1.
21417
21418 @item -mdspr2
21419 @itemx -mno-dspr2
21420 @opindex mdspr2
21421 @opindex mno-dspr2
21422 Use (do not use) revision 2 of the MIPS DSP ASE@.
21423 @xref{MIPS DSP Built-in Functions}. This option defines the
21424 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21425 It also defines @code{__mips_dsp_rev} to 2.
21426
21427 @item -msmartmips
21428 @itemx -mno-smartmips
21429 @opindex msmartmips
21430 @opindex mno-smartmips
21431 Use (do not use) the MIPS SmartMIPS ASE.
21432
21433 @item -mpaired-single
21434 @itemx -mno-paired-single
21435 @opindex mpaired-single
21436 @opindex mno-paired-single
21437 Use (do not use) paired-single floating-point instructions.
21438 @xref{MIPS Paired-Single Support}. This option requires
21439 hardware floating-point support to be enabled.
21440
21441 @item -mdmx
21442 @itemx -mno-mdmx
21443 @opindex mdmx
21444 @opindex mno-mdmx
21445 Use (do not use) MIPS Digital Media Extension instructions.
21446 This option can only be used when generating 64-bit code and requires
21447 hardware floating-point support to be enabled.
21448
21449 @item -mips3d
21450 @itemx -mno-mips3d
21451 @opindex mips3d
21452 @opindex mno-mips3d
21453 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21454 The option @option{-mips3d} implies @option{-mpaired-single}.
21455
21456 @item -mmicromips
21457 @itemx -mno-micromips
21458 @opindex mmicromips
21459 @opindex mno-mmicromips
21460 Generate (do not generate) microMIPS code.
21461
21462 MicroMIPS code generation can also be controlled on a per-function basis
21463 by means of @code{micromips} and @code{nomicromips} attributes.
21464 @xref{Function Attributes}, for more information.
21465
21466 @item -mmt
21467 @itemx -mno-mt
21468 @opindex mmt
21469 @opindex mno-mt
21470 Use (do not use) MT Multithreading instructions.
21471
21472 @item -mmcu
21473 @itemx -mno-mcu
21474 @opindex mmcu
21475 @opindex mno-mcu
21476 Use (do not use) the MIPS MCU ASE instructions.
21477
21478 @item -meva
21479 @itemx -mno-eva
21480 @opindex meva
21481 @opindex mno-eva
21482 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21483
21484 @item -mvirt
21485 @itemx -mno-virt
21486 @opindex mvirt
21487 @opindex mno-virt
21488 Use (do not use) the MIPS Virtualization (VZ) instructions.
21489
21490 @item -mxpa
21491 @itemx -mno-xpa
21492 @opindex mxpa
21493 @opindex mno-xpa
21494 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21495
21496 @item -mcrc
21497 @itemx -mno-crc
21498 @opindex mcrc
21499 @opindex mno-crc
21500 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21501
21502 @item -mginv
21503 @itemx -mno-ginv
21504 @opindex mginv
21505 @opindex mno-ginv
21506 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21507
21508 @item -mloongson-mmi
21509 @itemx -mno-loongson-mmi
21510 @opindex mloongson-mmi
21511 @opindex mno-loongson-mmi
21512 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
21513
21514 @item -mloongson-ext
21515 @itemx -mno-loongson-ext
21516 @opindex mloongson-ext
21517 @opindex mno-loongson-ext
21518 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21519
21520 @item -mloongson-ext2
21521 @itemx -mno-loongson-ext2
21522 @opindex mloongson-ext2
21523 @opindex mno-loongson-ext2
21524 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
21525
21526 @item -mlong64
21527 @opindex mlong64
21528 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21529 an explanation of the default and the way that the pointer size is
21530 determined.
21531
21532 @item -mlong32
21533 @opindex mlong32
21534 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21535
21536 The default size of @code{int}s, @code{long}s and pointers depends on
21537 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21538 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21539 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21540 or the same size as integer registers, whichever is smaller.
21541
21542 @item -msym32
21543 @itemx -mno-sym32
21544 @opindex msym32
21545 @opindex mno-sym32
21546 Assume (do not assume) that all symbols have 32-bit values, regardless
21547 of the selected ABI@. This option is useful in combination with
21548 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21549 to generate shorter and faster references to symbolic addresses.
21550
21551 @item -G @var{num}
21552 @opindex G
21553 Put definitions of externally-visible data in a small data section
21554 if that data is no bigger than @var{num} bytes. GCC can then generate
21555 more efficient accesses to the data; see @option{-mgpopt} for details.
21556
21557 The default @option{-G} option depends on the configuration.
21558
21559 @item -mlocal-sdata
21560 @itemx -mno-local-sdata
21561 @opindex mlocal-sdata
21562 @opindex mno-local-sdata
21563 Extend (do not extend) the @option{-G} behavior to local data too,
21564 such as to static variables in C@. @option{-mlocal-sdata} is the
21565 default for all configurations.
21566
21567 If the linker complains that an application is using too much small data,
21568 you might want to try rebuilding the less performance-critical parts with
21569 @option{-mno-local-sdata}. You might also want to build large
21570 libraries with @option{-mno-local-sdata}, so that the libraries leave
21571 more room for the main program.
21572
21573 @item -mextern-sdata
21574 @itemx -mno-extern-sdata
21575 @opindex mextern-sdata
21576 @opindex mno-extern-sdata
21577 Assume (do not assume) that externally-defined data is in
21578 a small data section if the size of that data is within the @option{-G} limit.
21579 @option{-mextern-sdata} is the default for all configurations.
21580
21581 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21582 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21583 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21584 is placed in a small data section. If @var{Var} is defined by another
21585 module, you must either compile that module with a high-enough
21586 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21587 definition. If @var{Var} is common, you must link the application
21588 with a high-enough @option{-G} setting.
21589
21590 The easiest way of satisfying these restrictions is to compile
21591 and link every module with the same @option{-G} option. However,
21592 you may wish to build a library that supports several different
21593 small data limits. You can do this by compiling the library with
21594 the highest supported @option{-G} setting and additionally using
21595 @option{-mno-extern-sdata} to stop the library from making assumptions
21596 about externally-defined data.
21597
21598 @item -mgpopt
21599 @itemx -mno-gpopt
21600 @opindex mgpopt
21601 @opindex mno-gpopt
21602 Use (do not use) GP-relative accesses for symbols that are known to be
21603 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21604 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21605 configurations.
21606
21607 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21608 might not hold the value of @code{_gp}. For example, if the code is
21609 part of a library that might be used in a boot monitor, programs that
21610 call boot monitor routines pass an unknown value in @code{$gp}.
21611 (In such situations, the boot monitor itself is usually compiled
21612 with @option{-G0}.)
21613
21614 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21615 @option{-mno-extern-sdata}.
21616
21617 @item -membedded-data
21618 @itemx -mno-embedded-data
21619 @opindex membedded-data
21620 @opindex mno-embedded-data
21621 Allocate variables to the read-only data section first if possible, then
21622 next in the small data section if possible, otherwise in data. This gives
21623 slightly slower code than the default, but reduces the amount of RAM required
21624 when executing, and thus may be preferred for some embedded systems.
21625
21626 @item -muninit-const-in-rodata
21627 @itemx -mno-uninit-const-in-rodata
21628 @opindex muninit-const-in-rodata
21629 @opindex mno-uninit-const-in-rodata
21630 Put uninitialized @code{const} variables in the read-only data section.
21631 This option is only meaningful in conjunction with @option{-membedded-data}.
21632
21633 @item -mcode-readable=@var{setting}
21634 @opindex mcode-readable
21635 Specify whether GCC may generate code that reads from executable sections.
21636 There are three possible settings:
21637
21638 @table @gcctabopt
21639 @item -mcode-readable=yes
21640 Instructions may freely access executable sections. This is the
21641 default setting.
21642
21643 @item -mcode-readable=pcrel
21644 MIPS16 PC-relative load instructions can access executable sections,
21645 but other instructions must not do so. This option is useful on 4KSc
21646 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21647 It is also useful on processors that can be configured to have a dual
21648 instruction/data SRAM interface and that, like the M4K, automatically
21649 redirect PC-relative loads to the instruction RAM.
21650
21651 @item -mcode-readable=no
21652 Instructions must not access executable sections. This option can be
21653 useful on targets that are configured to have a dual instruction/data
21654 SRAM interface but that (unlike the M4K) do not automatically redirect
21655 PC-relative loads to the instruction RAM.
21656 @end table
21657
21658 @item -msplit-addresses
21659 @itemx -mno-split-addresses
21660 @opindex msplit-addresses
21661 @opindex mno-split-addresses
21662 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21663 relocation operators. This option has been superseded by
21664 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21665
21666 @item -mexplicit-relocs
21667 @itemx -mno-explicit-relocs
21668 @opindex mexplicit-relocs
21669 @opindex mno-explicit-relocs
21670 Use (do not use) assembler relocation operators when dealing with symbolic
21671 addresses. The alternative, selected by @option{-mno-explicit-relocs},
21672 is to use assembler macros instead.
21673
21674 @option{-mexplicit-relocs} is the default if GCC was configured
21675 to use an assembler that supports relocation operators.
21676
21677 @item -mcheck-zero-division
21678 @itemx -mno-check-zero-division
21679 @opindex mcheck-zero-division
21680 @opindex mno-check-zero-division
21681 Trap (do not trap) on integer division by zero.
21682
21683 The default is @option{-mcheck-zero-division}.
21684
21685 @item -mdivide-traps
21686 @itemx -mdivide-breaks
21687 @opindex mdivide-traps
21688 @opindex mdivide-breaks
21689 MIPS systems check for division by zero by generating either a
21690 conditional trap or a break instruction. Using traps results in
21691 smaller code, but is only supported on MIPS II and later. Also, some
21692 versions of the Linux kernel have a bug that prevents trap from
21693 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
21694 allow conditional traps on architectures that support them and
21695 @option{-mdivide-breaks} to force the use of breaks.
21696
21697 The default is usually @option{-mdivide-traps}, but this can be
21698 overridden at configure time using @option{--with-divide=breaks}.
21699 Divide-by-zero checks can be completely disabled using
21700 @option{-mno-check-zero-division}.
21701
21702 @item -mload-store-pairs
21703 @itemx -mno-load-store-pairs
21704 @opindex mload-store-pairs
21705 @opindex mno-load-store-pairs
21706 Enable (disable) an optimization that pairs consecutive load or store
21707 instructions to enable load/store bonding. This option is enabled by
21708 default but only takes effect when the selected architecture is known
21709 to support bonding.
21710
21711 @item -mmemcpy
21712 @itemx -mno-memcpy
21713 @opindex mmemcpy
21714 @opindex mno-memcpy
21715 Force (do not force) the use of @code{memcpy} for non-trivial block
21716 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
21717 most constant-sized copies.
21718
21719 @item -mlong-calls
21720 @itemx -mno-long-calls
21721 @opindex mlong-calls
21722 @opindex mno-long-calls
21723 Disable (do not disable) use of the @code{jal} instruction. Calling
21724 functions using @code{jal} is more efficient but requires the caller
21725 and callee to be in the same 256 megabyte segment.
21726
21727 This option has no effect on abicalls code. The default is
21728 @option{-mno-long-calls}.
21729
21730 @item -mmad
21731 @itemx -mno-mad
21732 @opindex mmad
21733 @opindex mno-mad
21734 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
21735 instructions, as provided by the R4650 ISA@.
21736
21737 @item -mimadd
21738 @itemx -mno-imadd
21739 @opindex mimadd
21740 @opindex mno-imadd
21741 Enable (disable) use of the @code{madd} and @code{msub} integer
21742 instructions. The default is @option{-mimadd} on architectures
21743 that support @code{madd} and @code{msub} except for the 74k
21744 architecture where it was found to generate slower code.
21745
21746 @item -mfused-madd
21747 @itemx -mno-fused-madd
21748 @opindex mfused-madd
21749 @opindex mno-fused-madd
21750 Enable (disable) use of the floating-point multiply-accumulate
21751 instructions, when they are available. The default is
21752 @option{-mfused-madd}.
21753
21754 On the R8000 CPU when multiply-accumulate instructions are used,
21755 the intermediate product is calculated to infinite precision
21756 and is not subject to the FCSR Flush to Zero bit. This may be
21757 undesirable in some circumstances. On other processors the result
21758 is numerically identical to the equivalent computation using
21759 separate multiply, add, subtract and negate instructions.
21760
21761 @item -nocpp
21762 @opindex nocpp
21763 Tell the MIPS assembler to not run its preprocessor over user
21764 assembler files (with a @samp{.s} suffix) when assembling them.
21765
21766 @item -mfix-24k
21767 @itemx -mno-fix-24k
21768 @opindex mfix-24k
21769 @opindex mno-fix-24k
21770 Work around the 24K E48 (lost data on stores during refill) errata.
21771 The workarounds are implemented by the assembler rather than by GCC@.
21772
21773 @item -mfix-r4000
21774 @itemx -mno-fix-r4000
21775 @opindex mfix-r4000
21776 @opindex mno-fix-r4000
21777 Work around certain R4000 CPU errata:
21778 @itemize @minus
21779 @item
21780 A double-word or a variable shift may give an incorrect result if executed
21781 immediately after starting an integer division.
21782 @item
21783 A double-word or a variable shift may give an incorrect result if executed
21784 while an integer multiplication is in progress.
21785 @item
21786 An integer division may give an incorrect result if started in a delay slot
21787 of a taken branch or a jump.
21788 @end itemize
21789
21790 @item -mfix-r4400
21791 @itemx -mno-fix-r4400
21792 @opindex mfix-r4400
21793 @opindex mno-fix-r4400
21794 Work around certain R4400 CPU errata:
21795 @itemize @minus
21796 @item
21797 A double-word or a variable shift may give an incorrect result if executed
21798 immediately after starting an integer division.
21799 @end itemize
21800
21801 @item -mfix-r10000
21802 @itemx -mno-fix-r10000
21803 @opindex mfix-r10000
21804 @opindex mno-fix-r10000
21805 Work around certain R10000 errata:
21806 @itemize @minus
21807 @item
21808 @code{ll}/@code{sc} sequences may not behave atomically on revisions
21809 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21810 @end itemize
21811
21812 This option can only be used if the target architecture supports
21813 branch-likely instructions. @option{-mfix-r10000} is the default when
21814 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
21815 otherwise.
21816
21817 @item -mfix-rm7000
21818 @itemx -mno-fix-rm7000
21819 @opindex mfix-rm7000
21820 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
21821 workarounds are implemented by the assembler rather than by GCC@.
21822
21823 @item -mfix-vr4120
21824 @itemx -mno-fix-vr4120
21825 @opindex mfix-vr4120
21826 Work around certain VR4120 errata:
21827 @itemize @minus
21828 @item
21829 @code{dmultu} does not always produce the correct result.
21830 @item
21831 @code{div} and @code{ddiv} do not always produce the correct result if one
21832 of the operands is negative.
21833 @end itemize
21834 The workarounds for the division errata rely on special functions in
21835 @file{libgcc.a}. At present, these functions are only provided by
21836 the @code{mips64vr*-elf} configurations.
21837
21838 Other VR4120 errata require a NOP to be inserted between certain pairs of
21839 instructions. These errata are handled by the assembler, not by GCC itself.
21840
21841 @item -mfix-vr4130
21842 @opindex mfix-vr4130
21843 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
21844 workarounds are implemented by the assembler rather than by GCC,
21845 although GCC avoids using @code{mflo} and @code{mfhi} if the
21846 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
21847 instructions are available instead.
21848
21849 @item -mfix-sb1
21850 @itemx -mno-fix-sb1
21851 @opindex mfix-sb1
21852 Work around certain SB-1 CPU core errata.
21853 (This flag currently works around the SB-1 revision 2
21854 ``F1'' and ``F2'' floating-point errata.)
21855
21856 @item -mr10k-cache-barrier=@var{setting}
21857 @opindex mr10k-cache-barrier
21858 Specify whether GCC should insert cache barriers to avoid the
21859 side effects of speculation on R10K processors.
21860
21861 In common with many processors, the R10K tries to predict the outcome
21862 of a conditional branch and speculatively executes instructions from
21863 the ``taken'' branch. It later aborts these instructions if the
21864 predicted outcome is wrong. However, on the R10K, even aborted
21865 instructions can have side effects.
21866
21867 This problem only affects kernel stores and, depending on the system,
21868 kernel loads. As an example, a speculatively-executed store may load
21869 the target memory into cache and mark the cache line as dirty, even if
21870 the store itself is later aborted. If a DMA operation writes to the
21871 same area of memory before the ``dirty'' line is flushed, the cached
21872 data overwrites the DMA-ed data. See the R10K processor manual
21873 for a full description, including other potential problems.
21874
21875 One workaround is to insert cache barrier instructions before every memory
21876 access that might be speculatively executed and that might have side
21877 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
21878 controls GCC's implementation of this workaround. It assumes that
21879 aborted accesses to any byte in the following regions does not have
21880 side effects:
21881
21882 @enumerate
21883 @item
21884 the memory occupied by the current function's stack frame;
21885
21886 @item
21887 the memory occupied by an incoming stack argument;
21888
21889 @item
21890 the memory occupied by an object with a link-time-constant address.
21891 @end enumerate
21892
21893 It is the kernel's responsibility to ensure that speculative
21894 accesses to these regions are indeed safe.
21895
21896 If the input program contains a function declaration such as:
21897
21898 @smallexample
21899 void foo (void);
21900 @end smallexample
21901
21902 then the implementation of @code{foo} must allow @code{j foo} and
21903 @code{jal foo} to be executed speculatively. GCC honors this
21904 restriction for functions it compiles itself. It expects non-GCC
21905 functions (such as hand-written assembly code) to do the same.
21906
21907 The option has three forms:
21908
21909 @table @gcctabopt
21910 @item -mr10k-cache-barrier=load-store
21911 Insert a cache barrier before a load or store that might be
21912 speculatively executed and that might have side effects even
21913 if aborted.
21914
21915 @item -mr10k-cache-barrier=store
21916 Insert a cache barrier before a store that might be speculatively
21917 executed and that might have side effects even if aborted.
21918
21919 @item -mr10k-cache-barrier=none
21920 Disable the insertion of cache barriers. This is the default setting.
21921 @end table
21922
21923 @item -mflush-func=@var{func}
21924 @itemx -mno-flush-func
21925 @opindex mflush-func
21926 Specifies the function to call to flush the I and D caches, or to not
21927 call any such function. If called, the function must take the same
21928 arguments as the common @code{_flush_func}, that is, the address of the
21929 memory range for which the cache is being flushed, the size of the
21930 memory range, and the number 3 (to flush both caches). The default
21931 depends on the target GCC was configured for, but commonly is either
21932 @code{_flush_func} or @code{__cpu_flush}.
21933
21934 @item mbranch-cost=@var{num}
21935 @opindex mbranch-cost
21936 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21937 This cost is only a heuristic and is not guaranteed to produce
21938 consistent results across releases. A zero cost redundantly selects
21939 the default, which is based on the @option{-mtune} setting.
21940
21941 @item -mbranch-likely
21942 @itemx -mno-branch-likely
21943 @opindex mbranch-likely
21944 @opindex mno-branch-likely
21945 Enable or disable use of Branch Likely instructions, regardless of the
21946 default for the selected architecture. By default, Branch Likely
21947 instructions may be generated if they are supported by the selected
21948 architecture. An exception is for the MIPS32 and MIPS64 architectures
21949 and processors that implement those architectures; for those, Branch
21950 Likely instructions are not be generated by default because the MIPS32
21951 and MIPS64 architectures specifically deprecate their use.
21952
21953 @item -mcompact-branches=never
21954 @itemx -mcompact-branches=optimal
21955 @itemx -mcompact-branches=always
21956 @opindex mcompact-branches=never
21957 @opindex mcompact-branches=optimal
21958 @opindex mcompact-branches=always
21959 These options control which form of branches will be generated. The
21960 default is @option{-mcompact-branches=optimal}.
21961
21962 The @option{-mcompact-branches=never} option ensures that compact branch
21963 instructions will never be generated.
21964
21965 The @option{-mcompact-branches=always} option ensures that a compact
21966 branch instruction will be generated if available. If a compact branch
21967 instruction is not available, a delay slot form of the branch will be
21968 used instead.
21969
21970 This option is supported from MIPS Release 6 onwards.
21971
21972 The @option{-mcompact-branches=optimal} option will cause a delay slot
21973 branch to be used if one is available in the current ISA and the delay
21974 slot is successfully filled. If the delay slot is not filled, a compact
21975 branch will be chosen if one is available.
21976
21977 @item -mfp-exceptions
21978 @itemx -mno-fp-exceptions
21979 @opindex mfp-exceptions
21980 Specifies whether FP exceptions are enabled. This affects how
21981 FP instructions are scheduled for some processors.
21982 The default is that FP exceptions are
21983 enabled.
21984
21985 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21986 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21987 FP pipe.
21988
21989 @item -mvr4130-align
21990 @itemx -mno-vr4130-align
21991 @opindex mvr4130-align
21992 The VR4130 pipeline is two-way superscalar, but can only issue two
21993 instructions together if the first one is 8-byte aligned. When this
21994 option is enabled, GCC aligns pairs of instructions that it
21995 thinks should execute in parallel.
21996
21997 This option only has an effect when optimizing for the VR4130.
21998 It normally makes code faster, but at the expense of making it bigger.
21999 It is enabled by default at optimization level @option{-O3}.
22000
22001 @item -msynci
22002 @itemx -mno-synci
22003 @opindex msynci
22004 Enable (disable) generation of @code{synci} instructions on
22005 architectures that support it. The @code{synci} instructions (if
22006 enabled) are generated when @code{__builtin___clear_cache} is
22007 compiled.
22008
22009 This option defaults to @option{-mno-synci}, but the default can be
22010 overridden by configuring GCC with @option{--with-synci}.
22011
22012 When compiling code for single processor systems, it is generally safe
22013 to use @code{synci}. However, on many multi-core (SMP) systems, it
22014 does not invalidate the instruction caches on all cores and may lead
22015 to undefined behavior.
22016
22017 @item -mrelax-pic-calls
22018 @itemx -mno-relax-pic-calls
22019 @opindex mrelax-pic-calls
22020 Try to turn PIC calls that are normally dispatched via register
22021 @code{$25} into direct calls. This is only possible if the linker can
22022 resolve the destination at link time and if the destination is within
22023 range for a direct call.
22024
22025 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22026 an assembler and a linker that support the @code{.reloc} assembly
22027 directive and @option{-mexplicit-relocs} is in effect. With
22028 @option{-mno-explicit-relocs}, this optimization can be performed by the
22029 assembler and the linker alone without help from the compiler.
22030
22031 @item -mmcount-ra-address
22032 @itemx -mno-mcount-ra-address
22033 @opindex mmcount-ra-address
22034 @opindex mno-mcount-ra-address
22035 Emit (do not emit) code that allows @code{_mcount} to modify the
22036 calling function's return address. When enabled, this option extends
22037 the usual @code{_mcount} interface with a new @var{ra-address}
22038 parameter, which has type @code{intptr_t *} and is passed in register
22039 @code{$12}. @code{_mcount} can then modify the return address by
22040 doing both of the following:
22041 @itemize
22042 @item
22043 Returning the new address in register @code{$31}.
22044 @item
22045 Storing the new address in @code{*@var{ra-address}},
22046 if @var{ra-address} is nonnull.
22047 @end itemize
22048
22049 The default is @option{-mno-mcount-ra-address}.
22050
22051 @item -mframe-header-opt
22052 @itemx -mno-frame-header-opt
22053 @opindex mframe-header-opt
22054 Enable (disable) frame header optimization in the o32 ABI. When using the
22055 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22056 function to write out register arguments. When enabled, this optimization
22057 will suppress the allocation of the frame header if it can be determined that
22058 it is unused.
22059
22060 This optimization is off by default at all optimization levels.
22061
22062 @item -mlxc1-sxc1
22063 @itemx -mno-lxc1-sxc1
22064 @opindex mlxc1-sxc1
22065 When applicable, enable (disable) the generation of @code{lwxc1},
22066 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22067
22068 @item -mmadd4
22069 @itemx -mno-madd4
22070 @opindex mmadd4
22071 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22072 @code{madd.d} and related instructions. Enabled by default.
22073
22074 @end table
22075
22076 @node MMIX Options
22077 @subsection MMIX Options
22078 @cindex MMIX Options
22079
22080 These options are defined for the MMIX:
22081
22082 @table @gcctabopt
22083 @item -mlibfuncs
22084 @itemx -mno-libfuncs
22085 @opindex mlibfuncs
22086 @opindex mno-libfuncs
22087 Specify that intrinsic library functions are being compiled, passing all
22088 values in registers, no matter the size.
22089
22090 @item -mepsilon
22091 @itemx -mno-epsilon
22092 @opindex mepsilon
22093 @opindex mno-epsilon
22094 Generate floating-point comparison instructions that compare with respect
22095 to the @code{rE} epsilon register.
22096
22097 @item -mabi=mmixware
22098 @itemx -mabi=gnu
22099 @opindex mabi=mmixware
22100 @opindex mabi=gnu
22101 Generate code that passes function parameters and return values that (in
22102 the called function) are seen as registers @code{$0} and up, as opposed to
22103 the GNU ABI which uses global registers @code{$231} and up.
22104
22105 @item -mzero-extend
22106 @itemx -mno-zero-extend
22107 @opindex mzero-extend
22108 @opindex mno-zero-extend
22109 When reading data from memory in sizes shorter than 64 bits, use (do not
22110 use) zero-extending load instructions by default, rather than
22111 sign-extending ones.
22112
22113 @item -mknuthdiv
22114 @itemx -mno-knuthdiv
22115 @opindex mknuthdiv
22116 @opindex mno-knuthdiv
22117 Make the result of a division yielding a remainder have the same sign as
22118 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22119 remainder follows the sign of the dividend. Both methods are
22120 arithmetically valid, the latter being almost exclusively used.
22121
22122 @item -mtoplevel-symbols
22123 @itemx -mno-toplevel-symbols
22124 @opindex mtoplevel-symbols
22125 @opindex mno-toplevel-symbols
22126 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22127 code can be used with the @code{PREFIX} assembly directive.
22128
22129 @item -melf
22130 @opindex melf
22131 Generate an executable in the ELF format, rather than the default
22132 @samp{mmo} format used by the @command{mmix} simulator.
22133
22134 @item -mbranch-predict
22135 @itemx -mno-branch-predict
22136 @opindex mbranch-predict
22137 @opindex mno-branch-predict
22138 Use (do not use) the probable-branch instructions, when static branch
22139 prediction indicates a probable branch.
22140
22141 @item -mbase-addresses
22142 @itemx -mno-base-addresses
22143 @opindex mbase-addresses
22144 @opindex mno-base-addresses
22145 Generate (do not generate) code that uses @emph{base addresses}. Using a
22146 base address automatically generates a request (handled by the assembler
22147 and the linker) for a constant to be set up in a global register. The
22148 register is used for one or more base address requests within the range 0
22149 to 255 from the value held in the register. The generally leads to short
22150 and fast code, but the number of different data items that can be
22151 addressed is limited. This means that a program that uses lots of static
22152 data may require @option{-mno-base-addresses}.
22153
22154 @item -msingle-exit
22155 @itemx -mno-single-exit
22156 @opindex msingle-exit
22157 @opindex mno-single-exit
22158 Force (do not force) generated code to have a single exit point in each
22159 function.
22160 @end table
22161
22162 @node MN10300 Options
22163 @subsection MN10300 Options
22164 @cindex MN10300 options
22165
22166 These @option{-m} options are defined for Matsushita MN10300 architectures:
22167
22168 @table @gcctabopt
22169 @item -mmult-bug
22170 @opindex mmult-bug
22171 Generate code to avoid bugs in the multiply instructions for the MN10300
22172 processors. This is the default.
22173
22174 @item -mno-mult-bug
22175 @opindex mno-mult-bug
22176 Do not generate code to avoid bugs in the multiply instructions for the
22177 MN10300 processors.
22178
22179 @item -mam33
22180 @opindex mam33
22181 Generate code using features specific to the AM33 processor.
22182
22183 @item -mno-am33
22184 @opindex mno-am33
22185 Do not generate code using features specific to the AM33 processor. This
22186 is the default.
22187
22188 @item -mam33-2
22189 @opindex mam33-2
22190 Generate code using features specific to the AM33/2.0 processor.
22191
22192 @item -mam34
22193 @opindex mam34
22194 Generate code using features specific to the AM34 processor.
22195
22196 @item -mtune=@var{cpu-type}
22197 @opindex mtune
22198 Use the timing characteristics of the indicated CPU type when
22199 scheduling instructions. This does not change the targeted processor
22200 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22201 @samp{am33-2} or @samp{am34}.
22202
22203 @item -mreturn-pointer-on-d0
22204 @opindex mreturn-pointer-on-d0
22205 When generating a function that returns a pointer, return the pointer
22206 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22207 only in @code{a0}, and attempts to call such functions without a prototype
22208 result in errors. Note that this option is on by default; use
22209 @option{-mno-return-pointer-on-d0} to disable it.
22210
22211 @item -mno-crt0
22212 @opindex mno-crt0
22213 Do not link in the C run-time initialization object file.
22214
22215 @item -mrelax
22216 @opindex mrelax
22217 Indicate to the linker that it should perform a relaxation optimization pass
22218 to shorten branches, calls and absolute memory addresses. This option only
22219 has an effect when used on the command line for the final link step.
22220
22221 This option makes symbolic debugging impossible.
22222
22223 @item -mliw
22224 @opindex mliw
22225 Allow the compiler to generate @emph{Long Instruction Word}
22226 instructions if the target is the @samp{AM33} or later. This is the
22227 default. This option defines the preprocessor macro @code{__LIW__}.
22228
22229 @item -mno-liw
22230 @opindex mno-liw
22231 Do not allow the compiler to generate @emph{Long Instruction Word}
22232 instructions. This option defines the preprocessor macro
22233 @code{__NO_LIW__}.
22234
22235 @item -msetlb
22236 @opindex msetlb
22237 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22238 instructions if the target is the @samp{AM33} or later. This is the
22239 default. This option defines the preprocessor macro @code{__SETLB__}.
22240
22241 @item -mno-setlb
22242 @opindex mno-setlb
22243 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22244 instructions. This option defines the preprocessor macro
22245 @code{__NO_SETLB__}.
22246
22247 @end table
22248
22249 @node Moxie Options
22250 @subsection Moxie Options
22251 @cindex Moxie Options
22252
22253 @table @gcctabopt
22254
22255 @item -meb
22256 @opindex meb
22257 Generate big-endian code. This is the default for @samp{moxie-*-*}
22258 configurations.
22259
22260 @item -mel
22261 @opindex mel
22262 Generate little-endian code.
22263
22264 @item -mmul.x
22265 @opindex mmul.x
22266 Generate mul.x and umul.x instructions. This is the default for
22267 @samp{moxiebox-*-*} configurations.
22268
22269 @item -mno-crt0
22270 @opindex mno-crt0
22271 Do not link in the C run-time initialization object file.
22272
22273 @end table
22274
22275 @node MSP430 Options
22276 @subsection MSP430 Options
22277 @cindex MSP430 Options
22278
22279 These options are defined for the MSP430:
22280
22281 @table @gcctabopt
22282
22283 @item -masm-hex
22284 @opindex masm-hex
22285 Force assembly output to always use hex constants. Normally such
22286 constants are signed decimals, but this option is available for
22287 testsuite and/or aesthetic purposes.
22288
22289 @item -mmcu=
22290 @opindex mmcu=
22291 Select the MCU to target. This is used to create a C preprocessor
22292 symbol based upon the MCU name, converted to upper case and pre- and
22293 post-fixed with @samp{__}. This in turn is used by the
22294 @file{msp430.h} header file to select an MCU-specific supplementary
22295 header file.
22296
22297 The option also sets the ISA to use. If the MCU name is one that is
22298 known to only support the 430 ISA then that is selected, otherwise the
22299 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22300 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22301 name selects the 430X ISA.
22302
22303 In addition an MCU-specific linker script is added to the linker
22304 command line. The script's name is the name of the MCU with
22305 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22306 command line defines the C preprocessor symbol @code{__XXX__} and
22307 cause the linker to search for a script called @file{xxx.ld}.
22308
22309 This option is also passed on to the assembler.
22310
22311 @item -mwarn-mcu
22312 @itemx -mno-warn-mcu
22313 @opindex mwarn-mcu
22314 @opindex mno-warn-mcu
22315 This option enables or disables warnings about conflicts between the
22316 MCU name specified by the @option{-mmcu} option and the ISA set by the
22317 @option{-mcpu} option and/or the hardware multiply support set by the
22318 @option{-mhwmult} option. It also toggles warnings about unrecognized
22319 MCU names. This option is on by default.
22320
22321 @item -mcpu=
22322 @opindex mcpu=
22323 Specifies the ISA to use. Accepted values are @samp{msp430},
22324 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22325 @option{-mmcu=} option should be used to select the ISA.
22326
22327 @item -msim
22328 @opindex msim
22329 Link to the simulator runtime libraries and linker script. Overrides
22330 any scripts that would be selected by the @option{-mmcu=} option.
22331
22332 @item -mlarge
22333 @opindex mlarge
22334 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22335
22336 @item -msmall
22337 @opindex msmall
22338 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22339
22340 @item -mrelax
22341 @opindex mrelax
22342 This option is passed to the assembler and linker, and allows the
22343 linker to perform certain optimizations that cannot be done until
22344 the final link.
22345
22346 @item mhwmult=
22347 @opindex mhwmult=
22348 Describes the type of hardware multiply supported by the target.
22349 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22350 for the original 16-bit-only multiply supported by early MCUs.
22351 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22352 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22353 A value of @samp{auto} can also be given. This tells GCC to deduce
22354 the hardware multiply support based upon the MCU name provided by the
22355 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22356 the MCU name is not recognized then no hardware multiply support is
22357 assumed. @code{auto} is the default setting.
22358
22359 Hardware multiplies are normally performed by calling a library
22360 routine. This saves space in the generated code. When compiling at
22361 @option{-O3} or higher however the hardware multiplier is invoked
22362 inline. This makes for bigger, but faster code.
22363
22364 The hardware multiply routines disable interrupts whilst running and
22365 restore the previous interrupt state when they finish. This makes
22366 them safe to use inside interrupt handlers as well as in normal code.
22367
22368 @item -minrt
22369 @opindex minrt
22370 Enable the use of a minimum runtime environment - no static
22371 initializers or constructors. This is intended for memory-constrained
22372 devices. The compiler includes special symbols in some objects
22373 that tell the linker and runtime which code fragments are required.
22374
22375 @item -mcode-region=
22376 @itemx -mdata-region=
22377 @opindex mcode-region
22378 @opindex mdata-region
22379 These options tell the compiler where to place functions and data that
22380 do not have one of the @code{lower}, @code{upper}, @code{either} or
22381 @code{section} attributes. Possible values are @code{lower},
22382 @code{upper}, @code{either} or @code{any}. The first three behave
22383 like the corresponding attribute. The fourth possible value -
22384 @code{any} - is the default. It leaves placement entirely up to the
22385 linker script and how it assigns the standard sections
22386 (@code{.text}, @code{.data}, etc) to the memory regions.
22387
22388 @item -msilicon-errata=
22389 @opindex msilicon-errata
22390 This option passes on a request to assembler to enable the fixes for
22391 the named silicon errata.
22392
22393 @item -msilicon-errata-warn=
22394 @opindex msilicon-errata-warn
22395 This option passes on a request to the assembler to enable warning
22396 messages when a silicon errata might need to be applied.
22397
22398 @end table
22399
22400 @node NDS32 Options
22401 @subsection NDS32 Options
22402 @cindex NDS32 Options
22403
22404 These options are defined for NDS32 implementations:
22405
22406 @table @gcctabopt
22407
22408 @item -mbig-endian
22409 @opindex mbig-endian
22410 Generate code in big-endian mode.
22411
22412 @item -mlittle-endian
22413 @opindex mlittle-endian
22414 Generate code in little-endian mode.
22415
22416 @item -mreduced-regs
22417 @opindex mreduced-regs
22418 Use reduced-set registers for register allocation.
22419
22420 @item -mfull-regs
22421 @opindex mfull-regs
22422 Use full-set registers for register allocation.
22423
22424 @item -mcmov
22425 @opindex mcmov
22426 Generate conditional move instructions.
22427
22428 @item -mno-cmov
22429 @opindex mno-cmov
22430 Do not generate conditional move instructions.
22431
22432 @item -mext-perf
22433 @opindex mext-perf
22434 Generate performance extension instructions.
22435
22436 @item -mno-ext-perf
22437 @opindex mno-ext-perf
22438 Do not generate performance extension instructions.
22439
22440 @item -mext-perf2
22441 @opindex mext-perf2
22442 Generate performance extension 2 instructions.
22443
22444 @item -mno-ext-perf2
22445 @opindex mno-ext-perf2
22446 Do not generate performance extension 2 instructions.
22447
22448 @item -mext-string
22449 @opindex mext-string
22450 Generate string extension instructions.
22451
22452 @item -mno-ext-string
22453 @opindex mno-ext-string
22454 Do not generate string extension instructions.
22455
22456 @item -mv3push
22457 @opindex mv3push
22458 Generate v3 push25/pop25 instructions.
22459
22460 @item -mno-v3push
22461 @opindex mno-v3push
22462 Do not generate v3 push25/pop25 instructions.
22463
22464 @item -m16-bit
22465 @opindex m16-bit
22466 Generate 16-bit instructions.
22467
22468 @item -mno-16-bit
22469 @opindex mno-16-bit
22470 Do not generate 16-bit instructions.
22471
22472 @item -misr-vector-size=@var{num}
22473 @opindex misr-vector-size
22474 Specify the size of each interrupt vector, which must be 4 or 16.
22475
22476 @item -mcache-block-size=@var{num}
22477 @opindex mcache-block-size
22478 Specify the size of each cache block,
22479 which must be a power of 2 between 4 and 512.
22480
22481 @item -march=@var{arch}
22482 @opindex march
22483 Specify the name of the target architecture.
22484
22485 @item -mcmodel=@var{code-model}
22486 @opindex mcmodel
22487 Set the code model to one of
22488 @table @asis
22489 @item @samp{small}
22490 All the data and read-only data segments must be within 512KB addressing space.
22491 The text segment must be within 16MB addressing space.
22492 @item @samp{medium}
22493 The data segment must be within 512KB while the read-only data segment can be
22494 within 4GB addressing space. The text segment should be still within 16MB
22495 addressing space.
22496 @item @samp{large}
22497 All the text and data segments can be within 4GB addressing space.
22498 @end table
22499
22500 @item -mctor-dtor
22501 @opindex mctor-dtor
22502 Enable constructor/destructor feature.
22503
22504 @item -mrelax
22505 @opindex mrelax
22506 Guide linker to relax instructions.
22507
22508 @end table
22509
22510 @node Nios II Options
22511 @subsection Nios II Options
22512 @cindex Nios II options
22513 @cindex Altera Nios II options
22514
22515 These are the options defined for the Altera Nios II processor.
22516
22517 @table @gcctabopt
22518
22519 @item -G @var{num}
22520 @opindex G
22521 @cindex smaller data references
22522 Put global and static objects less than or equal to @var{num} bytes
22523 into the small data or BSS sections instead of the normal data or BSS
22524 sections. The default value of @var{num} is 8.
22525
22526 @item -mgpopt=@var{option}
22527 @itemx -mgpopt
22528 @itemx -mno-gpopt
22529 @opindex mgpopt
22530 @opindex mno-gpopt
22531 Generate (do not generate) GP-relative accesses. The following
22532 @var{option} names are recognized:
22533
22534 @table @samp
22535
22536 @item none
22537 Do not generate GP-relative accesses.
22538
22539 @item local
22540 Generate GP-relative accesses for small data objects that are not
22541 external, weak, or uninitialized common symbols.
22542 Also use GP-relative addressing for objects that
22543 have been explicitly placed in a small data section via a @code{section}
22544 attribute.
22545
22546 @item global
22547 As for @samp{local}, but also generate GP-relative accesses for
22548 small data objects that are external, weak, or common. If you use this option,
22549 you must ensure that all parts of your program (including libraries) are
22550 compiled with the same @option{-G} setting.
22551
22552 @item data
22553 Generate GP-relative accesses for all data objects in the program. If you
22554 use this option, the entire data and BSS segments
22555 of your program must fit in 64K of memory and you must use an appropriate
22556 linker script to allocate them within the addressable range of the
22557 global pointer.
22558
22559 @item all
22560 Generate GP-relative addresses for function pointers as well as data
22561 pointers. If you use this option, the entire text, data, and BSS segments
22562 of your program must fit in 64K of memory and you must use an appropriate
22563 linker script to allocate them within the addressable range of the
22564 global pointer.
22565
22566 @end table
22567
22568 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22569 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22570
22571 The default is @option{-mgpopt} except when @option{-fpic} or
22572 @option{-fPIC} is specified to generate position-independent code.
22573 Note that the Nios II ABI does not permit GP-relative accesses from
22574 shared libraries.
22575
22576 You may need to specify @option{-mno-gpopt} explicitly when building
22577 programs that include large amounts of small data, including large
22578 GOT data sections. In this case, the 16-bit offset for GP-relative
22579 addressing may not be large enough to allow access to the entire
22580 small data section.
22581
22582 @item -mgprel-sec=@var{regexp}
22583 @opindex mgprel-sec
22584 This option specifies additional section names that can be accessed via
22585 GP-relative addressing. It is most useful in conjunction with
22586 @code{section} attributes on variable declarations
22587 (@pxref{Common Variable Attributes}) and a custom linker script.
22588 The @var{regexp} is a POSIX Extended Regular Expression.
22589
22590 This option does not affect the behavior of the @option{-G} option, and
22591 the specified sections are in addition to the standard @code{.sdata}
22592 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22593
22594 @item -mr0rel-sec=@var{regexp}
22595 @opindex mr0rel-sec
22596 This option specifies names of sections that can be accessed via a
22597 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22598 of the 32-bit address space. It is most useful in conjunction with
22599 @code{section} attributes on variable declarations
22600 (@pxref{Common Variable Attributes}) and a custom linker script.
22601 The @var{regexp} is a POSIX Extended Regular Expression.
22602
22603 In contrast to the use of GP-relative addressing for small data,
22604 zero-based addressing is never generated by default and there are no
22605 conventional section names used in standard linker scripts for sections
22606 in the low or high areas of memory.
22607
22608 @item -mel
22609 @itemx -meb
22610 @opindex mel
22611 @opindex meb
22612 Generate little-endian (default) or big-endian (experimental) code,
22613 respectively.
22614
22615 @item -march=@var{arch}
22616 @opindex march
22617 This specifies the name of the target Nios II architecture. GCC uses this
22618 name to determine what kind of instructions it can emit when generating
22619 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22620
22621 The preprocessor macro @code{__nios2_arch__} is available to programs,
22622 with value 1 or 2, indicating the targeted ISA level.
22623
22624 @item -mbypass-cache
22625 @itemx -mno-bypass-cache
22626 @opindex mno-bypass-cache
22627 @opindex mbypass-cache
22628 Force all load and store instructions to always bypass cache by
22629 using I/O variants of the instructions. The default is not to
22630 bypass the cache.
22631
22632 @item -mno-cache-volatile
22633 @itemx -mcache-volatile
22634 @opindex mcache-volatile
22635 @opindex mno-cache-volatile
22636 Volatile memory access bypass the cache using the I/O variants of
22637 the load and store instructions. The default is not to bypass the cache.
22638
22639 @item -mno-fast-sw-div
22640 @itemx -mfast-sw-div
22641 @opindex mno-fast-sw-div
22642 @opindex mfast-sw-div
22643 Do not use table-based fast divide for small numbers. The default
22644 is to use the fast divide at @option{-O3} and above.
22645
22646 @item -mno-hw-mul
22647 @itemx -mhw-mul
22648 @itemx -mno-hw-mulx
22649 @itemx -mhw-mulx
22650 @itemx -mno-hw-div
22651 @itemx -mhw-div
22652 @opindex mno-hw-mul
22653 @opindex mhw-mul
22654 @opindex mno-hw-mulx
22655 @opindex mhw-mulx
22656 @opindex mno-hw-div
22657 @opindex mhw-div
22658 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
22659 instructions by the compiler. The default is to emit @code{mul}
22660 and not emit @code{div} and @code{mulx}.
22661
22662 @item -mbmx
22663 @itemx -mno-bmx
22664 @itemx -mcdx
22665 @itemx -mno-cdx
22666 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
22667 CDX (code density) instructions. Enabling these instructions also
22668 requires @option{-march=r2}. Since these instructions are optional
22669 extensions to the R2 architecture, the default is not to emit them.
22670
22671 @item -mcustom-@var{insn}=@var{N}
22672 @itemx -mno-custom-@var{insn}
22673 @opindex mcustom-@var{insn}
22674 @opindex mno-custom-@var{insn}
22675 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
22676 custom instruction with encoding @var{N} when generating code that uses
22677 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
22678 instruction 253 for single-precision floating-point add operations instead
22679 of the default behavior of using a library call.
22680
22681 The following values of @var{insn} are supported. Except as otherwise
22682 noted, floating-point operations are expected to be implemented with
22683 normal IEEE 754 semantics and correspond directly to the C operators or the
22684 equivalent GCC built-in functions (@pxref{Other Builtins}).
22685
22686 Single-precision floating point:
22687 @table @asis
22688
22689 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
22690 Binary arithmetic operations.
22691
22692 @item @samp{fnegs}
22693 Unary negation.
22694
22695 @item @samp{fabss}
22696 Unary absolute value.
22697
22698 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
22699 Comparison operations.
22700
22701 @item @samp{fmins}, @samp{fmaxs}
22702 Floating-point minimum and maximum. These instructions are only
22703 generated if @option{-ffinite-math-only} is specified.
22704
22705 @item @samp{fsqrts}
22706 Unary square root operation.
22707
22708 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
22709 Floating-point trigonometric and exponential functions. These instructions
22710 are only generated if @option{-funsafe-math-optimizations} is also specified.
22711
22712 @end table
22713
22714 Double-precision floating point:
22715 @table @asis
22716
22717 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
22718 Binary arithmetic operations.
22719
22720 @item @samp{fnegd}
22721 Unary negation.
22722
22723 @item @samp{fabsd}
22724 Unary absolute value.
22725
22726 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
22727 Comparison operations.
22728
22729 @item @samp{fmind}, @samp{fmaxd}
22730 Double-precision minimum and maximum. These instructions are only
22731 generated if @option{-ffinite-math-only} is specified.
22732
22733 @item @samp{fsqrtd}
22734 Unary square root operation.
22735
22736 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
22737 Double-precision trigonometric and exponential functions. These instructions
22738 are only generated if @option{-funsafe-math-optimizations} is also specified.
22739
22740 @end table
22741
22742 Conversions:
22743 @table @asis
22744 @item @samp{fextsd}
22745 Conversion from single precision to double precision.
22746
22747 @item @samp{ftruncds}
22748 Conversion from double precision to single precision.
22749
22750 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
22751 Conversion from floating point to signed or unsigned integer types, with
22752 truncation towards zero.
22753
22754 @item @samp{round}
22755 Conversion from single-precision floating point to signed integer,
22756 rounding to the nearest integer and ties away from zero.
22757 This corresponds to the @code{__builtin_lroundf} function when
22758 @option{-fno-math-errno} is used.
22759
22760 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
22761 Conversion from signed or unsigned integer types to floating-point types.
22762
22763 @end table
22764
22765 In addition, all of the following transfer instructions for internal
22766 registers X and Y must be provided to use any of the double-precision
22767 floating-point instructions. Custom instructions taking two
22768 double-precision source operands expect the first operand in the
22769 64-bit register X. The other operand (or only operand of a unary
22770 operation) is given to the custom arithmetic instruction with the
22771 least significant half in source register @var{src1} and the most
22772 significant half in @var{src2}. A custom instruction that returns a
22773 double-precision result returns the most significant 32 bits in the
22774 destination register and the other half in 32-bit register Y.
22775 GCC automatically generates the necessary code sequences to write
22776 register X and/or read register Y when double-precision floating-point
22777 instructions are used.
22778
22779 @table @asis
22780
22781 @item @samp{fwrx}
22782 Write @var{src1} into the least significant half of X and @var{src2} into
22783 the most significant half of X.
22784
22785 @item @samp{fwry}
22786 Write @var{src1} into Y.
22787
22788 @item @samp{frdxhi}, @samp{frdxlo}
22789 Read the most or least (respectively) significant half of X and store it in
22790 @var{dest}.
22791
22792 @item @samp{frdy}
22793 Read the value of Y and store it into @var{dest}.
22794 @end table
22795
22796 Note that you can gain more local control over generation of Nios II custom
22797 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
22798 and @code{target("no-custom-@var{insn}")} function attributes
22799 (@pxref{Function Attributes})
22800 or pragmas (@pxref{Function Specific Option Pragmas}).
22801
22802 @item -mcustom-fpu-cfg=@var{name}
22803 @opindex mcustom-fpu-cfg
22804
22805 This option enables a predefined, named set of custom instruction encodings
22806 (see @option{-mcustom-@var{insn}} above).
22807 Currently, the following sets are defined:
22808
22809 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
22810 @gccoptlist{-mcustom-fmuls=252 @gol
22811 -mcustom-fadds=253 @gol
22812 -mcustom-fsubs=254 @gol
22813 -fsingle-precision-constant}
22814
22815 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
22816 @gccoptlist{-mcustom-fmuls=252 @gol
22817 -mcustom-fadds=253 @gol
22818 -mcustom-fsubs=254 @gol
22819 -mcustom-fdivs=255 @gol
22820 -fsingle-precision-constant}
22821
22822 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
22823 @gccoptlist{-mcustom-floatus=243 @gol
22824 -mcustom-fixsi=244 @gol
22825 -mcustom-floatis=245 @gol
22826 -mcustom-fcmpgts=246 @gol
22827 -mcustom-fcmples=249 @gol
22828 -mcustom-fcmpeqs=250 @gol
22829 -mcustom-fcmpnes=251 @gol
22830 -mcustom-fmuls=252 @gol
22831 -mcustom-fadds=253 @gol
22832 -mcustom-fsubs=254 @gol
22833 -mcustom-fdivs=255 @gol
22834 -fsingle-precision-constant}
22835
22836 Custom instruction assignments given by individual
22837 @option{-mcustom-@var{insn}=} options override those given by
22838 @option{-mcustom-fpu-cfg=}, regardless of the
22839 order of the options on the command line.
22840
22841 Note that you can gain more local control over selection of a FPU
22842 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
22843 function attribute (@pxref{Function Attributes})
22844 or pragma (@pxref{Function Specific Option Pragmas}).
22845
22846 @end table
22847
22848 These additional @samp{-m} options are available for the Altera Nios II
22849 ELF (bare-metal) target:
22850
22851 @table @gcctabopt
22852
22853 @item -mhal
22854 @opindex mhal
22855 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
22856 startup and termination code, and is typically used in conjunction with
22857 @option{-msys-crt0=} to specify the location of the alternate startup code
22858 provided by the HAL BSP.
22859
22860 @item -msmallc
22861 @opindex msmallc
22862 Link with a limited version of the C library, @option{-lsmallc}, rather than
22863 Newlib.
22864
22865 @item -msys-crt0=@var{startfile}
22866 @opindex msys-crt0
22867 @var{startfile} is the file name of the startfile (crt0) to use
22868 when linking. This option is only useful in conjunction with @option{-mhal}.
22869
22870 @item -msys-lib=@var{systemlib}
22871 @opindex msys-lib
22872 @var{systemlib} is the library name of the library that provides
22873 low-level system calls required by the C library,
22874 e.g.@: @code{read} and @code{write}.
22875 This option is typically used to link with a library provided by a HAL BSP.
22876
22877 @end table
22878
22879 @node Nvidia PTX Options
22880 @subsection Nvidia PTX Options
22881 @cindex Nvidia PTX options
22882 @cindex nvptx options
22883
22884 These options are defined for Nvidia PTX:
22885
22886 @table @gcctabopt
22887
22888 @item -m32
22889 @itemx -m64
22890 @opindex m32
22891 @opindex m64
22892 Generate code for 32-bit or 64-bit ABI.
22893
22894 @item -misa=@var{ISA-string}
22895 @opindex march
22896 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
22897 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
22898 @samp{sm_35}. The default ISA is sm_30.
22899
22900 @item -mmainkernel
22901 @opindex mmainkernel
22902 Link in code for a __main kernel. This is for stand-alone instead of
22903 offloading execution.
22904
22905 @item -moptimize
22906 @opindex moptimize
22907 Apply partitioned execution optimizations. This is the default when any
22908 level of optimization is selected.
22909
22910 @item -msoft-stack
22911 @opindex msoft-stack
22912 Generate code that does not use @code{.local} memory
22913 directly for stack storage. Instead, a per-warp stack pointer is
22914 maintained explicitly. This enables variable-length stack allocation (with
22915 variable-length arrays or @code{alloca}), and when global memory is used for
22916 underlying storage, makes it possible to access automatic variables from other
22917 threads, or with atomic instructions. This code generation variant is used
22918 for OpenMP offloading, but the option is exposed on its own for the purpose
22919 of testing the compiler; to generate code suitable for linking into programs
22920 using OpenMP offloading, use option @option{-mgomp}.
22921
22922 @item -muniform-simt
22923 @opindex muniform-simt
22924 Switch to code generation variant that allows to execute all threads in each
22925 warp, while maintaining memory state and side effects as if only one thread
22926 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22927 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22928 current lane index equals the master lane index), and the register being
22929 assigned is copied via a shuffle instruction from the master lane. Outside of
22930 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22931 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22932 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22933 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22934 with current lane index to compute the master lane index.
22935
22936 @item -mgomp
22937 @opindex mgomp
22938 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22939 @option{-muniform-simt} options, and selects corresponding multilib variant.
22940
22941 @end table
22942
22943 @node OpenRISC Options
22944 @subsection OpenRISC Options
22945 @cindex OpenRISC Options
22946
22947 These options are defined for OpenRISC:
22948
22949 @table @gcctabopt
22950
22951 @item -mboard=@var{name}
22952 @opindex mboard
22953 Configure a board specific runtime. This will be passed to the linker for
22954 newlib board library linking. The default is @code{or1ksim}.
22955
22956 @item -mnewlib
22957 @opindex mnewlib
22958 For compatibility, it's always newlib for elf now.
22959
22960 @item -mhard-div
22961 @opindex mhard-div
22962 Generate code for hardware which supports divide instructions. This is the
22963 default.
22964
22965 @item -mhard-mul
22966 @opindex mhard-mul
22967 Generate code for hardware which supports multiply instructions. This is the
22968 default.
22969
22970 @item -mcmov
22971 @opindex mcmov
22972 Generate code for hardware which supports the conditional move (@code{l.cmov})
22973 instruction.
22974
22975 @item -mror
22976 @opindex mror
22977 Generate code for hardware which supports rotate right instructions.
22978
22979 @item -msext
22980 @opindex msext
22981 Generate code for hardware which supports sign-extension instructions.
22982
22983 @item -msfimm
22984 @opindex msfimm
22985 Generate code for hardware which supports set flag immediate (@code{l.sf*i})
22986 instructions.
22987
22988 @item -mshftimm
22989 @opindex mshftimm
22990 Generate code for hardware which supports shift immediate related instructions
22991 (i.e. @code{l.srai}, @code{l.srli}, @code{l.slli}, @code{1.rori}). Note, to
22992 enable generation of the @code{l.rori} instruction the @option{-mror} flag must
22993 also be specified.
22994
22995 @item -msoft-div
22996 @opindex msoft-div
22997 Generate code for hardware which requires divide instruction emulation.
22998
22999 @item -msoft-mul
23000 @opindex msoft-mul
23001 Generate code for hardware which requires multiply instruction emulation.
23002
23003 @end table
23004
23005 @node PDP-11 Options
23006 @subsection PDP-11 Options
23007 @cindex PDP-11 Options
23008
23009 These options are defined for the PDP-11:
23010
23011 @table @gcctabopt
23012 @item -mfpu
23013 @opindex mfpu
23014 Use hardware FPP floating point. This is the default. (FIS floating
23015 point on the PDP-11/40 is not supported.) Implies -m45.
23016
23017 @item -msoft-float
23018 @opindex msoft-float
23019 Do not use hardware floating point.
23020
23021 @item -mac0
23022 @opindex mac0
23023 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23024
23025 @item -mno-ac0
23026 @opindex mno-ac0
23027 Return floating-point results in memory. This is the default.
23028
23029 @item -m40
23030 @opindex m40
23031 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23032
23033 @item -m45
23034 @opindex m45
23035 Generate code for a PDP-11/45. This is the default.
23036
23037 @item -m10
23038 @opindex m10
23039 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23040
23041 @item -mint16
23042 @itemx -mno-int32
23043 @opindex mint16
23044 @opindex mno-int32
23045 Use 16-bit @code{int}. This is the default.
23046
23047 @item -mint32
23048 @itemx -mno-int16
23049 @opindex mint32
23050 @opindex mno-int16
23051 Use 32-bit @code{int}.
23052
23053 @item -msplit
23054 @opindex msplit
23055 Target has split instruction and data space. Implies -m45.
23056
23057 @item -munix-asm
23058 @opindex munix-asm
23059 Use Unix assembler syntax.
23060
23061 @item -mdec-asm
23062 @opindex mdec-asm
23063 Use DEC assembler syntax.
23064
23065 @item -mgnu-asm
23066 @opindex mgnu-asm
23067 Use GNU assembler syntax. This is the default.
23068
23069 @item -mlra
23070 @opindex mlra
23071 Use the new LRA register allocator. By default, the old ``reload''
23072 allocator is used.
23073 @end table
23074
23075 @node picoChip Options
23076 @subsection picoChip Options
23077 @cindex picoChip options
23078
23079 These @samp{-m} options are defined for picoChip implementations:
23080
23081 @table @gcctabopt
23082
23083 @item -mae=@var{ae_type}
23084 @opindex mcpu
23085 Set the instruction set, register set, and instruction scheduling
23086 parameters for array element type @var{ae_type}. Supported values
23087 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23088
23089 @option{-mae=ANY} selects a completely generic AE type. Code
23090 generated with this option runs on any of the other AE types. The
23091 code is not as efficient as it would be if compiled for a specific
23092 AE type, and some types of operation (e.g., multiplication) do not
23093 work properly on all types of AE.
23094
23095 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23096 for compiled code, and is the default.
23097
23098 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23099 option may suffer from poor performance of byte (char) manipulation,
23100 since the DSP AE does not provide hardware support for byte load/stores.
23101
23102 @item -msymbol-as-address
23103 Enable the compiler to directly use a symbol name as an address in a
23104 load/store instruction, without first loading it into a
23105 register. Typically, the use of this option generates larger
23106 programs, which run faster than when the option isn't used. However, the
23107 results vary from program to program, so it is left as a user option,
23108 rather than being permanently enabled.
23109
23110 @item -mno-inefficient-warnings
23111 Disables warnings about the generation of inefficient code. These
23112 warnings can be generated, for example, when compiling code that
23113 performs byte-level memory operations on the MAC AE type. The MAC AE has
23114 no hardware support for byte-level memory operations, so all byte
23115 load/stores must be synthesized from word load/store operations. This is
23116 inefficient and a warning is generated to indicate
23117 that you should rewrite the code to avoid byte operations, or to target
23118 an AE type that has the necessary hardware support. This option disables
23119 these warnings.
23120
23121 @end table
23122
23123 @node PowerPC Options
23124 @subsection PowerPC Options
23125 @cindex PowerPC options
23126
23127 These are listed under @xref{RS/6000 and PowerPC Options}.
23128
23129 @node PowerPC SPE Options
23130 @subsection PowerPC SPE Options
23131 @cindex PowerPC SPE options
23132
23133 These @samp{-m} options are defined for PowerPC SPE:
23134 @table @gcctabopt
23135 @item -mmfcrf
23136 @itemx -mno-mfcrf
23137 @itemx -mpopcntb
23138 @itemx -mno-popcntb
23139 @opindex mmfcrf
23140 @opindex mno-mfcrf
23141 @opindex mpopcntb
23142 @opindex mno-popcntb
23143 You use these options to specify which instructions are available on the
23144 processor you are using. The default value of these options is
23145 determined when configuring GCC@. Specifying the
23146 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23147 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23148 rather than the options listed above.
23149
23150 The @option{-mmfcrf} option allows GCC to generate the move from
23151 condition register field instruction implemented on the POWER4
23152 processor and other processors that support the PowerPC V2.01
23153 architecture.
23154 The @option{-mpopcntb} option allows GCC to generate the popcount and
23155 double-precision FP reciprocal estimate instruction implemented on the
23156 POWER5 processor and other processors that support the PowerPC V2.02
23157 architecture.
23158
23159 @item -mcpu=@var{cpu_type}
23160 @opindex mcpu
23161 Set architecture type, register usage, and
23162 instruction scheduling parameters for machine type @var{cpu_type}.
23163 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
23164 and @samp{native}.
23165
23166 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
23167 endian), with an appropriate, generic processor model assumed for
23168 scheduling purposes.
23169
23170 Specifying @samp{native} as cpu type detects and selects the
23171 architecture option that corresponds to the host processor of the
23172 system performing the compilation.
23173 @option{-mcpu=native} has no effect if GCC does not recognize the
23174 processor.
23175
23176 The other options specify a specific processor. Code generated under
23177 those options runs best on that processor, and may not run at all on
23178 others.
23179
23180 The @option{-mcpu} options automatically enable or disable the
23181 following options:
23182
23183 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
23184 -mpopcntb -mpopcntd @gol
23185 -msingle-float -mdouble-float @gol
23186 -mfloat128}
23187
23188 The particular options set for any particular CPU varies between
23189 compiler versions, depending on what setting seems to produce optimal
23190 code for that CPU; it doesn't necessarily reflect the actual hardware's
23191 capabilities. If you wish to set an individual option to a particular
23192 value, you may specify it after the @option{-mcpu} option, like
23193 @option{-mcpu=8548}.
23194
23195 @item -mtune=@var{cpu_type}
23196 @opindex mtune
23197 Set the instruction scheduling parameters for machine type
23198 @var{cpu_type}, but do not set the architecture type or register usage,
23199 as @option{-mcpu=@var{cpu_type}} does. The same
23200 values for @var{cpu_type} are used for @option{-mtune} as for
23201 @option{-mcpu}. If both are specified, the code generated uses the
23202 architecture and registers set by @option{-mcpu}, but the
23203 scheduling parameters set by @option{-mtune}.
23204
23205 @item -msecure-plt
23206 @opindex msecure-plt
23207 Generate code that allows @command{ld} and @command{ld.so}
23208 to build executables and shared
23209 libraries with non-executable @code{.plt} and @code{.got} sections.
23210 This is a PowerPC
23211 32-bit SYSV ABI option.
23212
23213 @item -mbss-plt
23214 @opindex mbss-plt
23215 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23216 fills in, and
23217 requires @code{.plt} and @code{.got}
23218 sections that are both writable and executable.
23219 This is a PowerPC 32-bit SYSV ABI option.
23220
23221 @item -misel
23222 @itemx -mno-isel
23223 @opindex misel
23224 @opindex mno-isel
23225 This switch enables or disables the generation of ISEL instructions.
23226
23227 @item -misel=@var{yes/no}
23228 This switch has been deprecated. Use @option{-misel} and
23229 @option{-mno-isel} instead.
23230
23231 @item -mspe
23232 @itemx -mno-spe
23233 @opindex mspe
23234 @opindex mno-spe
23235 This switch enables or disables the generation of SPE simd
23236 instructions.
23237
23238 @item -mspe=@var{yes/no}
23239 This option has been deprecated. Use @option{-mspe} and
23240 @option{-mno-spe} instead.
23241
23242 @item -mfloat128
23243 @itemx -mno-float128
23244 @opindex mfloat128
23245 @opindex mno-float128
23246 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23247 and use either software emulation for IEEE 128-bit floating point or
23248 hardware instructions.
23249
23250 @item -mfloat-gprs=@var{yes/single/double/no}
23251 @itemx -mfloat-gprs
23252 @opindex mfloat-gprs
23253 This switch enables or disables the generation of floating-point
23254 operations on the general-purpose registers for architectures that
23255 support it.
23256
23257 The argument @samp{yes} or @samp{single} enables the use of
23258 single-precision floating-point operations.
23259
23260 The argument @samp{double} enables the use of single and
23261 double-precision floating-point operations.
23262
23263 The argument @samp{no} disables floating-point operations on the
23264 general-purpose registers.
23265
23266 This option is currently only available on the MPC854x.
23267
23268 @item -mfull-toc
23269 @itemx -mno-fp-in-toc
23270 @itemx -mno-sum-in-toc
23271 @itemx -mminimal-toc
23272 @opindex mfull-toc
23273 @opindex mno-fp-in-toc
23274 @opindex mno-sum-in-toc
23275 @opindex mminimal-toc
23276 Modify generation of the TOC (Table Of Contents), which is created for
23277 every executable file. The @option{-mfull-toc} option is selected by
23278 default. In that case, GCC allocates at least one TOC entry for
23279 each unique non-automatic variable reference in your program. GCC
23280 also places floating-point constants in the TOC@. However, only
23281 16,384 entries are available in the TOC@.
23282
23283 If you receive a linker error message that saying you have overflowed
23284 the available TOC space, you can reduce the amount of TOC space used
23285 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23286 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23287 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23288 generate code to calculate the sum of an address and a constant at
23289 run time instead of putting that sum into the TOC@. You may specify one
23290 or both of these options. Each causes GCC to produce very slightly
23291 slower and larger code at the expense of conserving TOC space.
23292
23293 If you still run out of space in the TOC even when you specify both of
23294 these options, specify @option{-mminimal-toc} instead. This option causes
23295 GCC to make only one TOC entry for every file. When you specify this
23296 option, GCC produces code that is slower and larger but which
23297 uses extremely little TOC space. You may wish to use this option
23298 only on files that contain less frequently-executed code.
23299
23300 @item -maix32
23301 @opindex maix32
23302 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
23303
23304 @item -mxl-compat
23305 @itemx -mno-xl-compat
23306 @opindex mxl-compat
23307 @opindex mno-xl-compat
23308 Produce code that conforms more closely to IBM XL compiler semantics
23309 when using AIX-compatible ABI@. Pass floating-point arguments to
23310 prototyped functions beyond the register save area (RSA) on the stack
23311 in addition to argument FPRs. Do not assume that most significant
23312 double in 128-bit long double value is properly rounded when comparing
23313 values and converting to double. Use XL symbol names for long double
23314 support routines.
23315
23316 The AIX calling convention was extended but not initially documented to
23317 handle an obscure K&R C case of calling a function that takes the
23318 address of its arguments with fewer arguments than declared. IBM XL
23319 compilers access floating-point arguments that do not fit in the
23320 RSA from the stack when a subroutine is compiled without
23321 optimization. Because always storing floating-point arguments on the
23322 stack is inefficient and rarely needed, this option is not enabled by
23323 default and only is necessary when calling subroutines compiled by IBM
23324 XL compilers without optimization.
23325
23326 @item -malign-natural
23327 @itemx -malign-power
23328 @opindex malign-natural
23329 @opindex malign-power
23330 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23331 @option{-malign-natural} overrides the ABI-defined alignment of larger
23332 types, such as floating-point doubles, on their natural size-based boundary.
23333 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23334 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23335
23336 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23337 is not supported.
23338
23339 @item -msoft-float
23340 @itemx -mhard-float
23341 @opindex msoft-float
23342 @opindex mhard-float
23343 Generate code that does not use (uses) the floating-point register set.
23344 Software floating-point emulation is provided if you use the
23345 @option{-msoft-float} option, and pass the option to GCC when linking.
23346
23347 @item -msingle-float
23348 @itemx -mdouble-float
23349 @opindex msingle-float
23350 @opindex mdouble-float
23351 Generate code for single- or double-precision floating-point operations.
23352 @option{-mdouble-float} implies @option{-msingle-float}.
23353
23354 @item -mmultiple
23355 @itemx -mno-multiple
23356 @opindex mmultiple
23357 @opindex mno-multiple
23358 Generate code that uses (does not use) the load multiple word
23359 instructions and the store multiple word instructions. These
23360 instructions are generated by default on POWER systems, and not
23361 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23362 PowerPC systems, since those instructions do not work when the
23363 processor is in little-endian mode. The exceptions are PPC740 and
23364 PPC750 which permit these instructions in little-endian mode.
23365
23366 @item -mupdate
23367 @itemx -mno-update
23368 @opindex mupdate
23369 @opindex mno-update
23370 Generate code that uses (does not use) the load or store instructions
23371 that update the base register to the address of the calculated memory
23372 location. These instructions are generated by default. If you use
23373 @option{-mno-update}, there is a small window between the time that the
23374 stack pointer is updated and the address of the previous frame is
23375 stored, which means code that walks the stack frame across interrupts or
23376 signals may get corrupted data.
23377
23378 @item -mavoid-indexed-addresses
23379 @itemx -mno-avoid-indexed-addresses
23380 @opindex mavoid-indexed-addresses
23381 @opindex mno-avoid-indexed-addresses
23382 Generate code that tries to avoid (not avoid) the use of indexed load
23383 or store instructions. These instructions can incur a performance
23384 penalty on Power6 processors in certain situations, such as when
23385 stepping through large arrays that cross a 16M boundary. This option
23386 is enabled by default when targeting Power6 and disabled otherwise.
23387
23388 @item -mfused-madd
23389 @itemx -mno-fused-madd
23390 @opindex mfused-madd
23391 @opindex mno-fused-madd
23392 Generate code that uses (does not use) the floating-point multiply and
23393 accumulate instructions. These instructions are generated by default
23394 if hardware floating point is used. The machine-dependent
23395 @option{-mfused-madd} option is now mapped to the machine-independent
23396 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23397 mapped to @option{-ffp-contract=off}.
23398
23399 @item -mno-strict-align
23400 @itemx -mstrict-align
23401 @opindex mno-strict-align
23402 @opindex mstrict-align
23403 On System V.4 and embedded PowerPC systems do not (do) assume that
23404 unaligned memory references are handled by the system.
23405
23406 @item -mrelocatable
23407 @itemx -mno-relocatable
23408 @opindex mrelocatable
23409 @opindex mno-relocatable
23410 Generate code that allows (does not allow) a static executable to be
23411 relocated to a different address at run time. A simple embedded
23412 PowerPC system loader should relocate the entire contents of
23413 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23414 a table of 32-bit addresses generated by this option. For this to
23415 work, all objects linked together must be compiled with
23416 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23417 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23418
23419 @item -mrelocatable-lib
23420 @itemx -mno-relocatable-lib
23421 @opindex mrelocatable-lib
23422 @opindex mno-relocatable-lib
23423 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23424 @code{.fixup} section to allow static executables to be relocated at
23425 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23426 alignment of @option{-mrelocatable}. Objects compiled with
23427 @option{-mrelocatable-lib} may be linked with objects compiled with
23428 any combination of the @option{-mrelocatable} options.
23429
23430 @item -mno-toc
23431 @itemx -mtoc
23432 @opindex mno-toc
23433 @opindex mtoc
23434 On System V.4 and embedded PowerPC systems do not (do) assume that
23435 register 2 contains a pointer to a global area pointing to the addresses
23436 used in the program.
23437
23438 @item -mlittle
23439 @itemx -mlittle-endian
23440 @opindex mlittle
23441 @opindex mlittle-endian
23442 On System V.4 and embedded PowerPC systems compile code for the
23443 processor in little-endian mode. The @option{-mlittle-endian} option is
23444 the same as @option{-mlittle}.
23445
23446 @item -mbig
23447 @itemx -mbig-endian
23448 @opindex mbig
23449 @opindex mbig-endian
23450 On System V.4 and embedded PowerPC systems compile code for the
23451 processor in big-endian mode. The @option{-mbig-endian} option is
23452 the same as @option{-mbig}.
23453
23454 @item -mdynamic-no-pic
23455 @opindex mdynamic-no-pic
23456 On Darwin and Mac OS X systems, compile code so that it is not
23457 relocatable, but that its external references are relocatable. The
23458 resulting code is suitable for applications, but not shared
23459 libraries.
23460
23461 @item -msingle-pic-base
23462 @opindex msingle-pic-base
23463 Treat the register used for PIC addressing as read-only, rather than
23464 loading it in the prologue for each function. The runtime system is
23465 responsible for initializing this register with an appropriate value
23466 before execution begins.
23467
23468 @item -mprioritize-restricted-insns=@var{priority}
23469 @opindex mprioritize-restricted-insns
23470 This option controls the priority that is assigned to
23471 dispatch-slot restricted instructions during the second scheduling
23472 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23473 or @samp{2} to assign no, highest, or second-highest (respectively)
23474 priority to dispatch-slot restricted
23475 instructions.
23476
23477 @item -msched-costly-dep=@var{dependence_type}
23478 @opindex msched-costly-dep
23479 This option controls which dependences are considered costly
23480 by the target during instruction scheduling. The argument
23481 @var{dependence_type} takes one of the following values:
23482
23483 @table @asis
23484 @item @samp{no}
23485 No dependence is costly.
23486
23487 @item @samp{all}
23488 All dependences are costly.
23489
23490 @item @samp{true_store_to_load}
23491 A true dependence from store to load is costly.
23492
23493 @item @samp{store_to_load}
23494 Any dependence from store to load is costly.
23495
23496 @item @var{number}
23497 Any dependence for which the latency is greater than or equal to
23498 @var{number} is costly.
23499 @end table
23500
23501 @item -minsert-sched-nops=@var{scheme}
23502 @opindex minsert-sched-nops
23503 This option controls which NOP insertion scheme is used during
23504 the second scheduling pass. The argument @var{scheme} takes one of the
23505 following values:
23506
23507 @table @asis
23508 @item @samp{no}
23509 Don't insert NOPs.
23510
23511 @item @samp{pad}
23512 Pad with NOPs any dispatch group that has vacant issue slots,
23513 according to the scheduler's grouping.
23514
23515 @item @samp{regroup_exact}
23516 Insert NOPs to force costly dependent insns into
23517 separate groups. Insert exactly as many NOPs as needed to force an insn
23518 to a new group, according to the estimated processor grouping.
23519
23520 @item @var{number}
23521 Insert NOPs to force costly dependent insns into
23522 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23523 @end table
23524
23525 @item -mcall-sysv
23526 @opindex mcall-sysv
23527 On System V.4 and embedded PowerPC systems compile code using calling
23528 conventions that adhere to the March 1995 draft of the System V
23529 Application Binary Interface, PowerPC processor supplement. This is the
23530 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23531
23532 @item -mcall-sysv-eabi
23533 @itemx -mcall-eabi
23534 @opindex mcall-sysv-eabi
23535 @opindex mcall-eabi
23536 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23537
23538 @item -mcall-sysv-noeabi
23539 @opindex mcall-sysv-noeabi
23540 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23541
23542 @item -mcall-aixdesc
23543 @opindex m
23544 On System V.4 and embedded PowerPC systems compile code for the AIX
23545 operating system.
23546
23547 @item -mcall-linux
23548 @opindex mcall-linux
23549 On System V.4 and embedded PowerPC systems compile code for the
23550 Linux-based GNU system.
23551
23552 @item -mcall-freebsd
23553 @opindex mcall-freebsd
23554 On System V.4 and embedded PowerPC systems compile code for the
23555 FreeBSD operating system.
23556
23557 @item -mcall-netbsd
23558 @opindex mcall-netbsd
23559 On System V.4 and embedded PowerPC systems compile code for the
23560 NetBSD operating system.
23561
23562 @item -mcall-openbsd
23563 @opindex mcall-netbsd
23564 On System V.4 and embedded PowerPC systems compile code for the
23565 OpenBSD operating system.
23566
23567 @item -maix-struct-return
23568 @opindex maix-struct-return
23569 Return all structures in memory (as specified by the AIX ABI)@.
23570
23571 @item -msvr4-struct-return
23572 @opindex msvr4-struct-return
23573 Return structures smaller than 8 bytes in registers (as specified by the
23574 SVR4 ABI)@.
23575
23576 @item -mabi=@var{abi-type}
23577 @opindex mabi
23578 Extend the current ABI with a particular extension, or remove such extension.
23579 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23580 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23581 @samp{elfv1}, @samp{elfv2}@.
23582
23583 @item -mabi=spe
23584 @opindex mabi=spe
23585 Extend the current ABI with SPE ABI extensions. This does not change
23586 the default ABI, instead it adds the SPE ABI extensions to the current
23587 ABI@.
23588
23589 @item -mabi=no-spe
23590 @opindex mabi=no-spe
23591 Disable Book-E SPE ABI extensions for the current ABI@.
23592
23593 @item -mabi=ibmlongdouble
23594 @opindex mabi=ibmlongdouble
23595 Change the current ABI to use IBM extended-precision long double.
23596 This is not likely to work if your system defaults to using IEEE
23597 extended-precision long double. If you change the long double type
23598 from IEEE extended-precision, the compiler will issue a warning unless
23599 you use the @option{-Wno-psabi} option.
23600
23601 @item -mabi=ieeelongdouble
23602 @opindex mabi=ieeelongdouble
23603 Change the current ABI to use IEEE extended-precision long double.
23604 This is not likely to work if your system defaults to using IBM
23605 extended-precision long double. If you change the long double type
23606 from IBM extended-precision, the compiler will issue a warning unless
23607 you use the @option{-Wno-psabi} option.
23608
23609 @item -mabi=elfv1
23610 @opindex mabi=elfv1
23611 Change the current ABI to use the ELFv1 ABI.
23612 This is the default ABI for big-endian PowerPC 64-bit Linux.
23613 Overriding the default ABI requires special system support and is
23614 likely to fail in spectacular ways.
23615
23616 @item -mabi=elfv2
23617 @opindex mabi=elfv2
23618 Change the current ABI to use the ELFv2 ABI.
23619 This is the default ABI for little-endian PowerPC 64-bit Linux.
23620 Overriding the default ABI requires special system support and is
23621 likely to fail in spectacular ways.
23622
23623 @item -mgnu-attribute
23624 @itemx -mno-gnu-attribute
23625 @opindex mgnu-attribute
23626 @opindex mno-gnu-attribute
23627 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23628 .gnu.attributes section that specify ABI variations in function
23629 parameters or return values.
23630
23631 @item -mprototype
23632 @itemx -mno-prototype
23633 @opindex mprototype
23634 @opindex mno-prototype
23635 On System V.4 and embedded PowerPC systems assume that all calls to
23636 variable argument functions are properly prototyped. Otherwise, the
23637 compiler must insert an instruction before every non-prototyped call to
23638 set or clear bit 6 of the condition code register (@code{CR}) to
23639 indicate whether floating-point values are passed in the floating-point
23640 registers in case the function takes variable arguments. With
23641 @option{-mprototype}, only calls to prototyped variable argument functions
23642 set or clear the bit.
23643
23644 @item -msim
23645 @opindex msim
23646 On embedded PowerPC systems, assume that the startup module is called
23647 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23648 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23649 configurations.
23650
23651 @item -mmvme
23652 @opindex mmvme
23653 On embedded PowerPC systems, assume that the startup module is called
23654 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23655 @file{libc.a}.
23656
23657 @item -mads
23658 @opindex mads
23659 On embedded PowerPC systems, assume that the startup module is called
23660 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23661 @file{libc.a}.
23662
23663 @item -myellowknife
23664 @opindex myellowknife
23665 On embedded PowerPC systems, assume that the startup module is called
23666 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23667 @file{libc.a}.
23668
23669 @item -mvxworks
23670 @opindex mvxworks
23671 On System V.4 and embedded PowerPC systems, specify that you are
23672 compiling for a VxWorks system.
23673
23674 @item -memb
23675 @opindex memb
23676 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23677 header to indicate that @samp{eabi} extended relocations are used.
23678
23679 @item -meabi
23680 @itemx -mno-eabi
23681 @opindex meabi
23682 @opindex mno-eabi
23683 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23684 Embedded Applications Binary Interface (EABI), which is a set of
23685 modifications to the System V.4 specifications. Selecting @option{-meabi}
23686 means that the stack is aligned to an 8-byte boundary, a function
23687 @code{__eabi} is called from @code{main} to set up the EABI
23688 environment, and the @option{-msdata} option can use both @code{r2} and
23689 @code{r13} to point to two separate small data areas. Selecting
23690 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
23691 no EABI initialization function is called from @code{main}, and the
23692 @option{-msdata} option only uses @code{r13} to point to a single
23693 small data area. The @option{-meabi} option is on by default if you
23694 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23695
23696 @item -msdata=eabi
23697 @opindex msdata=eabi
23698 On System V.4 and embedded PowerPC systems, put small initialized
23699 @code{const} global and static data in the @code{.sdata2} section, which
23700 is pointed to by register @code{r2}. Put small initialized
23701 non-@code{const} global and static data in the @code{.sdata} section,
23702 which is pointed to by register @code{r13}. Put small uninitialized
23703 global and static data in the @code{.sbss} section, which is adjacent to
23704 the @code{.sdata} section. The @option{-msdata=eabi} option is
23705 incompatible with the @option{-mrelocatable} option. The
23706 @option{-msdata=eabi} option also sets the @option{-memb} option.
23707
23708 @item -msdata=sysv
23709 @opindex msdata=sysv
23710 On System V.4 and embedded PowerPC systems, put small global and static
23711 data in the @code{.sdata} section, which is pointed to by register
23712 @code{r13}. Put small uninitialized global and static data in the
23713 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23714 The @option{-msdata=sysv} option is incompatible with the
23715 @option{-mrelocatable} option.
23716
23717 @item -msdata=default
23718 @itemx -msdata
23719 @opindex msdata=default
23720 @opindex msdata
23721 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23722 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23723 same as @option{-msdata=sysv}.
23724
23725 @item -msdata=data
23726 @opindex msdata=data
23727 On System V.4 and embedded PowerPC systems, put small global
23728 data in the @code{.sdata} section. Put small uninitialized global
23729 data in the @code{.sbss} section. Do not use register @code{r13}
23730 to address small data however. This is the default behavior unless
23731 other @option{-msdata} options are used.
23732
23733 @item -msdata=none
23734 @itemx -mno-sdata
23735 @opindex msdata=none
23736 @opindex mno-sdata
23737 On embedded PowerPC systems, put all initialized global and static data
23738 in the @code{.data} section, and all uninitialized data in the
23739 @code{.bss} section.
23740
23741 @item -mblock-move-inline-limit=@var{num}
23742 @opindex mblock-move-inline-limit
23743 Inline all block moves (such as calls to @code{memcpy} or structure
23744 copies) less than or equal to @var{num} bytes. The minimum value for
23745 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
23746 targets. The default value is target-specific.
23747
23748 @item -G @var{num}
23749 @opindex G
23750 @cindex smaller data references (PowerPC)
23751 @cindex .sdata/.sdata2 references (PowerPC)
23752 On embedded PowerPC systems, put global and static items less than or
23753 equal to @var{num} bytes into the small data or BSS sections instead of
23754 the normal data or BSS section. By default, @var{num} is 8. The
23755 @option{-G @var{num}} switch is also passed to the linker.
23756 All modules should be compiled with the same @option{-G @var{num}} value.
23757
23758 @item -mregnames
23759 @itemx -mno-regnames
23760 @opindex mregnames
23761 @opindex mno-regnames
23762 On System V.4 and embedded PowerPC systems do (do not) emit register
23763 names in the assembly language output using symbolic forms.
23764
23765 @item -mlongcall
23766 @itemx -mno-longcall
23767 @opindex mlongcall
23768 @opindex mno-longcall
23769 By default assume that all calls are far away so that a longer and more
23770 expensive calling sequence is required. This is required for calls
23771 farther than 32 megabytes (33,554,432 bytes) from the current location.
23772 A short call is generated if the compiler knows
23773 the call cannot be that far away. This setting can be overridden by
23774 the @code{shortcall} function attribute, or by @code{#pragma
23775 longcall(0)}.
23776
23777 Some linkers are capable of detecting out-of-range calls and generating
23778 glue code on the fly. On these systems, long calls are unnecessary and
23779 generate slower code. As of this writing, the AIX linker can do this,
23780 as can the GNU linker for PowerPC/64. It is planned to add this feature
23781 to the GNU linker for 32-bit PowerPC systems as well.
23782
23783 In the future, GCC may ignore all longcall specifications
23784 when the linker is known to generate glue.
23785
23786 @item -mtls-markers
23787 @itemx -mno-tls-markers
23788 @opindex mtls-markers
23789 @opindex mno-tls-markers
23790 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
23791 specifying the function argument. The relocation allows the linker to
23792 reliably associate function call with argument setup instructions for
23793 TLS optimization, which in turn allows GCC to better schedule the
23794 sequence.
23795
23796 @item -mrecip
23797 @itemx -mno-recip
23798 @opindex mrecip
23799 This option enables use of the reciprocal estimate and
23800 reciprocal square root estimate instructions with additional
23801 Newton-Raphson steps to increase precision instead of doing a divide or
23802 square root and divide for floating-point arguments. You should use
23803 the @option{-ffast-math} option when using @option{-mrecip} (or at
23804 least @option{-funsafe-math-optimizations},
23805 @option{-ffinite-math-only}, @option{-freciprocal-math} and
23806 @option{-fno-trapping-math}). Note that while the throughput of the
23807 sequence is generally higher than the throughput of the non-reciprocal
23808 instruction, the precision of the sequence can be decreased by up to 2
23809 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
23810 roots.
23811
23812 @item -mrecip=@var{opt}
23813 @opindex mrecip=opt
23814 This option controls which reciprocal estimate instructions
23815 may be used. @var{opt} is a comma-separated list of options, which may
23816 be preceded by a @code{!} to invert the option:
23817
23818 @table @samp
23819
23820 @item all
23821 Enable all estimate instructions.
23822
23823 @item default
23824 Enable the default instructions, equivalent to @option{-mrecip}.
23825
23826 @item none
23827 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23828
23829 @item div
23830 Enable the reciprocal approximation instructions for both
23831 single and double precision.
23832
23833 @item divf
23834 Enable the single-precision reciprocal approximation instructions.
23835
23836 @item divd
23837 Enable the double-precision reciprocal approximation instructions.
23838
23839 @item rsqrt
23840 Enable the reciprocal square root approximation instructions for both
23841 single and double precision.
23842
23843 @item rsqrtf
23844 Enable the single-precision reciprocal square root approximation instructions.
23845
23846 @item rsqrtd
23847 Enable the double-precision reciprocal square root approximation instructions.
23848
23849 @end table
23850
23851 So, for example, @option{-mrecip=all,!rsqrtd} enables
23852 all of the reciprocal estimate instructions, except for the
23853 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
23854 which handle the double-precision reciprocal square root calculations.
23855
23856 @item -mrecip-precision
23857 @itemx -mno-recip-precision
23858 @opindex mrecip-precision
23859 Assume (do not assume) that the reciprocal estimate instructions
23860 provide higher-precision estimates than is mandated by the PowerPC
23861 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
23862 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
23863 The double-precision square root estimate instructions are not generated by
23864 default on low-precision machines, since they do not provide an
23865 estimate that converges after three steps.
23866
23867 @item -mpointers-to-nested-functions
23868 @itemx -mno-pointers-to-nested-functions
23869 @opindex mpointers-to-nested-functions
23870 Generate (do not generate) code to load up the static chain register
23871 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
23872 systems where a function pointer points to a 3-word descriptor giving
23873 the function address, TOC value to be loaded in register @code{r2}, and
23874 static chain value to be loaded in register @code{r11}. The
23875 @option{-mpointers-to-nested-functions} is on by default. You cannot
23876 call through pointers to nested functions or pointers
23877 to functions compiled in other languages that use the static chain if
23878 you use @option{-mno-pointers-to-nested-functions}.
23879
23880 @item -msave-toc-indirect
23881 @itemx -mno-save-toc-indirect
23882 @opindex msave-toc-indirect
23883 Generate (do not generate) code to save the TOC value in the reserved
23884 stack location in the function prologue if the function calls through
23885 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
23886 saved in the prologue, it is saved just before the call through the
23887 pointer. The @option{-mno-save-toc-indirect} option is the default.
23888
23889 @item -mcompat-align-parm
23890 @itemx -mno-compat-align-parm
23891 @opindex mcompat-align-parm
23892 Generate (do not generate) code to pass structure parameters with a
23893 maximum alignment of 64 bits, for compatibility with older versions
23894 of GCC.
23895
23896 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23897 structure parameter on a 128-bit boundary when that structure contained
23898 a member requiring 128-bit alignment. This is corrected in more
23899 recent versions of GCC. This option may be used to generate code
23900 that is compatible with functions compiled with older versions of
23901 GCC.
23902
23903 The @option{-mno-compat-align-parm} option is the default.
23904
23905 @item -mstack-protector-guard=@var{guard}
23906 @itemx -mstack-protector-guard-reg=@var{reg}
23907 @itemx -mstack-protector-guard-offset=@var{offset}
23908 @itemx -mstack-protector-guard-symbol=@var{symbol}
23909 @opindex mstack-protector-guard
23910 @opindex mstack-protector-guard-reg
23911 @opindex mstack-protector-guard-offset
23912 @opindex mstack-protector-guard-symbol
23913 Generate stack protection code using canary at @var{guard}. Supported
23914 locations are @samp{global} for global canary or @samp{tls} for per-thread
23915 canary in the TLS block (the default with GNU libc version 2.4 or later).
23916
23917 With the latter choice the options
23918 @option{-mstack-protector-guard-reg=@var{reg}} and
23919 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
23920 which register to use as base register for reading the canary, and from what
23921 offset from that base register. The default for those is as specified in the
23922 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
23923 the offset with a symbol reference to a canary in the TLS block.
23924 @end table
23925
23926
23927 @node RISC-V Options
23928 @subsection RISC-V Options
23929 @cindex RISC-V Options
23930
23931 These command-line options are defined for RISC-V targets:
23932
23933 @table @gcctabopt
23934 @item -mbranch-cost=@var{n}
23935 @opindex mbranch-cost
23936 Set the cost of branches to roughly @var{n} instructions.
23937
23938 @item -mplt
23939 @itemx -mno-plt
23940 @opindex plt
23941 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23942 non-PIC. The default is @option{-mplt}.
23943
23944 @item -mabi=@var{ABI-string}
23945 @opindex mabi
23946 Specify integer and floating-point calling convention. @var{ABI-string}
23947 contains two parts: the size of integer types and the registers used for
23948 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23949 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23950 32-bit), and that floating-point values up to 64 bits wide are passed in F
23951 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23952 allows the compiler to generate code that uses the F and D extensions but only
23953 allows floating-point values up to 32 bits long to be passed in registers; or
23954 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23955 passed in registers.
23956
23957 The default for this argument is system dependent, users who want a specific
23958 calling convention should specify one explicitly. The valid calling
23959 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23960 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23961 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23962 invalid because the ABI requires 64-bit values be passed in F registers, but F
23963 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23964 only be used with the @samp{rv32e} architecture. This ABI is not well
23965 specified at present, and is subject to change.
23966
23967 @item -mfdiv
23968 @itemx -mno-fdiv
23969 @opindex mfdiv
23970 Do or don't use hardware floating-point divide and square root instructions.
23971 This requires the F or D extensions for floating-point registers. The default
23972 is to use them if the specified architecture has these instructions.
23973
23974 @item -mdiv
23975 @itemx -mno-div
23976 @opindex mdiv
23977 Do or don't use hardware instructions for integer division. This requires the
23978 M extension. The default is to use them if the specified architecture has
23979 these instructions.
23980
23981 @item -march=@var{ISA-string}
23982 @opindex march
23983 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23984 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23985 @samp{rv32imaf}.
23986
23987 @item -mtune=@var{processor-string}
23988 @opindex mtune
23989 Optimize the output for the given processor, specified by microarchitecture
23990 name.
23991
23992 @item -mpreferred-stack-boundary=@var{num}
23993 @opindex mpreferred-stack-boundary
23994 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23995 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23996 the default is 4 (16 bytes or 128-bits).
23997
23998 @strong{Warning:} If you use this switch, then you must build all modules with
23999 the same value, including any libraries. This includes the system libraries
24000 and startup modules.
24001
24002 @item -msmall-data-limit=@var{n}
24003 @opindex msmall-data-limit
24004 Put global and static data smaller than @var{n} bytes into a special section
24005 (on some targets).
24006
24007 @item -msave-restore
24008 @itemx -mno-save-restore
24009 @opindex msave-restore
24010 Do or don't use smaller but slower prologue and epilogue code that uses
24011 library function calls. The default is to use fast inline prologues and
24012 epilogues.
24013
24014 @item -mstrict-align
24015 @itemx -mno-strict-align
24016 @opindex mstrict-align
24017 Do not or do generate unaligned memory accesses. The default is set depending
24018 on whether the processor we are optimizing for supports fast unaligned access
24019 or not.
24020
24021 @item -mcmodel=medlow
24022 @opindex mcmodel=medlow
24023 Generate code for the medium-low code model. The program and its statically
24024 defined symbols must lie within a single 2 GiB address range and must lie
24025 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24026 statically or dynamically linked. This is the default code model.
24027
24028 @item -mcmodel=medany
24029 @opindex mcmodel=medany
24030 Generate code for the medium-any code model. The program and its statically
24031 defined symbols must be within any single 2 GiB address range. Programs can be
24032 statically or dynamically linked.
24033
24034 @item -mexplicit-relocs
24035 @itemx -mno-exlicit-relocs
24036 Use or do not use assembler relocation operators when dealing with symbolic
24037 addresses. The alternative is to use assembler macros instead, which may
24038 limit optimization.
24039
24040 @item -mrelax
24041 @itemx -mno-relax
24042 Take advantage of linker relaxations to reduce the number of instructions
24043 required to materialize symbol addresses. The default is to take advantage of
24044 linker relaxations.
24045
24046 @end table
24047
24048 @node RL78 Options
24049 @subsection RL78 Options
24050 @cindex RL78 Options
24051
24052 @table @gcctabopt
24053
24054 @item -msim
24055 @opindex msim
24056 Links in additional target libraries to support operation within a
24057 simulator.
24058
24059 @item -mmul=none
24060 @itemx -mmul=g10
24061 @itemx -mmul=g13
24062 @itemx -mmul=g14
24063 @itemx -mmul=rl78
24064 @opindex mmul
24065 Specifies the type of hardware multiplication and division support to
24066 be used. The simplest is @code{none}, which uses software for both
24067 multiplication and division. This is the default. The @code{g13}
24068 value is for the hardware multiply/divide peripheral found on the
24069 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24070 the multiplication and division instructions supported by the RL78/G14
24071 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24072 the value @code{mg10} is an alias for @code{none}.
24073
24074 In addition a C preprocessor macro is defined, based upon the setting
24075 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24076 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24077
24078 @item -mcpu=g10
24079 @itemx -mcpu=g13
24080 @itemx -mcpu=g14
24081 @itemx -mcpu=rl78
24082 @opindex mcpu
24083 Specifies the RL78 core to target. The default is the G14 core, also
24084 known as an S3 core or just RL78. The G13 or S2 core does not have
24085 multiply or divide instructions, instead it uses a hardware peripheral
24086 for these operations. The G10 or S1 core does not have register
24087 banks, so it uses a different calling convention.
24088
24089 If this option is set it also selects the type of hardware multiply
24090 support to use, unless this is overridden by an explicit
24091 @option{-mmul=none} option on the command line. Thus specifying
24092 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24093 peripheral and specifying @option{-mcpu=g10} disables the use of
24094 hardware multiplications altogether.
24095
24096 Note, although the RL78/G14 core is the default target, specifying
24097 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24098 change the behavior of the toolchain since it also enables G14
24099 hardware multiply support. If these options are not specified on the
24100 command line then software multiplication routines will be used even
24101 though the code targets the RL78 core. This is for backwards
24102 compatibility with older toolchains which did not have hardware
24103 multiply and divide support.
24104
24105 In addition a C preprocessor macro is defined, based upon the setting
24106 of this option. Possible values are: @code{__RL78_G10__},
24107 @code{__RL78_G13__} or @code{__RL78_G14__}.
24108
24109 @item -mg10
24110 @itemx -mg13
24111 @itemx -mg14
24112 @itemx -mrl78
24113 @opindex mg10
24114 @opindex mg13
24115 @opindex mg14
24116 @opindex mrl78
24117 These are aliases for the corresponding @option{-mcpu=} option. They
24118 are provided for backwards compatibility.
24119
24120 @item -mallregs
24121 @opindex mallregs
24122 Allow the compiler to use all of the available registers. By default
24123 registers @code{r24..r31} are reserved for use in interrupt handlers.
24124 With this option enabled these registers can be used in ordinary
24125 functions as well.
24126
24127 @item -m64bit-doubles
24128 @itemx -m32bit-doubles
24129 @opindex m64bit-doubles
24130 @opindex m32bit-doubles
24131 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24132 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24133 @option{-m32bit-doubles}.
24134
24135 @item -msave-mduc-in-interrupts
24136 @itemx -mno-save-mduc-in-interrupts
24137 @opindex msave-mduc-in-interrupts
24138 @opindex mno-save-mduc-in-interrupts
24139 Specifies that interrupt handler functions should preserve the
24140 MDUC registers. This is only necessary if normal code might use
24141 the MDUC registers, for example because it performs multiplication
24142 and division operations. The default is to ignore the MDUC registers
24143 as this makes the interrupt handlers faster. The target option -mg13
24144 needs to be passed for this to work as this feature is only available
24145 on the G13 target (S2 core). The MDUC registers will only be saved
24146 if the interrupt handler performs a multiplication or division
24147 operation or it calls another function.
24148
24149 @end table
24150
24151 @node RS/6000 and PowerPC Options
24152 @subsection IBM RS/6000 and PowerPC Options
24153 @cindex RS/6000 and PowerPC Options
24154 @cindex IBM RS/6000 and PowerPC Options
24155
24156 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24157 @table @gcctabopt
24158 @item -mpowerpc-gpopt
24159 @itemx -mno-powerpc-gpopt
24160 @itemx -mpowerpc-gfxopt
24161 @itemx -mno-powerpc-gfxopt
24162 @need 800
24163 @itemx -mpowerpc64
24164 @itemx -mno-powerpc64
24165 @itemx -mmfcrf
24166 @itemx -mno-mfcrf
24167 @itemx -mpopcntb
24168 @itemx -mno-popcntb
24169 @itemx -mpopcntd
24170 @itemx -mno-popcntd
24171 @itemx -mfprnd
24172 @itemx -mno-fprnd
24173 @need 800
24174 @itemx -mcmpb
24175 @itemx -mno-cmpb
24176 @itemx -mmfpgpr
24177 @itemx -mno-mfpgpr
24178 @itemx -mhard-dfp
24179 @itemx -mno-hard-dfp
24180 @opindex mpowerpc-gpopt
24181 @opindex mno-powerpc-gpopt
24182 @opindex mpowerpc-gfxopt
24183 @opindex mno-powerpc-gfxopt
24184 @opindex mpowerpc64
24185 @opindex mno-powerpc64
24186 @opindex mmfcrf
24187 @opindex mno-mfcrf
24188 @opindex mpopcntb
24189 @opindex mno-popcntb
24190 @opindex mpopcntd
24191 @opindex mno-popcntd
24192 @opindex mfprnd
24193 @opindex mno-fprnd
24194 @opindex mcmpb
24195 @opindex mno-cmpb
24196 @opindex mmfpgpr
24197 @opindex mno-mfpgpr
24198 @opindex mhard-dfp
24199 @opindex mno-hard-dfp
24200 You use these options to specify which instructions are available on the
24201 processor you are using. The default value of these options is
24202 determined when configuring GCC@. Specifying the
24203 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24204 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24205 rather than the options listed above.
24206
24207 Specifying @option{-mpowerpc-gpopt} allows
24208 GCC to use the optional PowerPC architecture instructions in the
24209 General Purpose group, including floating-point square root. Specifying
24210 @option{-mpowerpc-gfxopt} allows GCC to
24211 use the optional PowerPC architecture instructions in the Graphics
24212 group, including floating-point select.
24213
24214 The @option{-mmfcrf} option allows GCC to generate the move from
24215 condition register field instruction implemented on the POWER4
24216 processor and other processors that support the PowerPC V2.01
24217 architecture.
24218 The @option{-mpopcntb} option allows GCC to generate the popcount and
24219 double-precision FP reciprocal estimate instruction implemented on the
24220 POWER5 processor and other processors that support the PowerPC V2.02
24221 architecture.
24222 The @option{-mpopcntd} option allows GCC to generate the popcount
24223 instruction implemented on the POWER7 processor and other processors
24224 that support the PowerPC V2.06 architecture.
24225 The @option{-mfprnd} option allows GCC to generate the FP round to
24226 integer instructions implemented on the POWER5+ processor and other
24227 processors that support the PowerPC V2.03 architecture.
24228 The @option{-mcmpb} option allows GCC to generate the compare bytes
24229 instruction implemented on the POWER6 processor and other processors
24230 that support the PowerPC V2.05 architecture.
24231 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
24232 general-purpose register instructions implemented on the POWER6X
24233 processor and other processors that support the extended PowerPC V2.05
24234 architecture.
24235 The @option{-mhard-dfp} option allows GCC to generate the decimal
24236 floating-point instructions implemented on some POWER processors.
24237
24238 The @option{-mpowerpc64} option allows GCC to generate the additional
24239 64-bit instructions that are found in the full PowerPC64 architecture
24240 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24241 @option{-mno-powerpc64}.
24242
24243 @item -mcpu=@var{cpu_type}
24244 @opindex mcpu
24245 Set architecture type, register usage, and
24246 instruction scheduling parameters for machine type @var{cpu_type}.
24247 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24248 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24249 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24250 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24251 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24252 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24253 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24254 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24255 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24256 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24257 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24258 @samp{rs64}, and @samp{native}.
24259
24260 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24261 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24262 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24263 architecture machine types, with an appropriate, generic processor
24264 model assumed for scheduling purposes.
24265
24266 Specifying @samp{native} as cpu type detects and selects the
24267 architecture option that corresponds to the host processor of the
24268 system performing the compilation.
24269 @option{-mcpu=native} has no effect if GCC does not recognize the
24270 processor.
24271
24272 The other options specify a specific processor. Code generated under
24273 those options runs best on that processor, and may not run at all on
24274 others.
24275
24276 The @option{-mcpu} options automatically enable or disable the
24277 following options:
24278
24279 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24280 -mpopcntb -mpopcntd -mpowerpc64 @gol
24281 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24282 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24283 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24284 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24285
24286 The particular options set for any particular CPU varies between
24287 compiler versions, depending on what setting seems to produce optimal
24288 code for that CPU; it doesn't necessarily reflect the actual hardware's
24289 capabilities. If you wish to set an individual option to a particular
24290 value, you may specify it after the @option{-mcpu} option, like
24291 @option{-mcpu=970 -mno-altivec}.
24292
24293 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24294 not enabled or disabled by the @option{-mcpu} option at present because
24295 AIX does not have full support for these options. You may still
24296 enable or disable them individually if you're sure it'll work in your
24297 environment.
24298
24299 @item -mtune=@var{cpu_type}
24300 @opindex mtune
24301 Set the instruction scheduling parameters for machine type
24302 @var{cpu_type}, but do not set the architecture type or register usage,
24303 as @option{-mcpu=@var{cpu_type}} does. The same
24304 values for @var{cpu_type} are used for @option{-mtune} as for
24305 @option{-mcpu}. If both are specified, the code generated uses the
24306 architecture and registers set by @option{-mcpu}, but the
24307 scheduling parameters set by @option{-mtune}.
24308
24309 @item -mcmodel=small
24310 @opindex mcmodel=small
24311 Generate PowerPC64 code for the small model: The TOC is limited to
24312 64k.
24313
24314 @item -mcmodel=medium
24315 @opindex mcmodel=medium
24316 Generate PowerPC64 code for the medium model: The TOC and other static
24317 data may be up to a total of 4G in size. This is the default for 64-bit
24318 Linux.
24319
24320 @item -mcmodel=large
24321 @opindex mcmodel=large
24322 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24323 in size. Other data and code is only limited by the 64-bit address
24324 space.
24325
24326 @item -maltivec
24327 @itemx -mno-altivec
24328 @opindex maltivec
24329 @opindex mno-altivec
24330 Generate code that uses (does not use) AltiVec instructions, and also
24331 enable the use of built-in functions that allow more direct access to
24332 the AltiVec instruction set. You may also need to set
24333 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24334 enhancements.
24335
24336 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
24337 @option{-maltivec=be}, the element order for AltiVec intrinsics such
24338 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24339 match array element order corresponding to the endianness of the
24340 target. That is, element zero identifies the leftmost element in a
24341 vector register when targeting a big-endian platform, and identifies
24342 the rightmost element in a vector register when targeting a
24343 little-endian platform.
24344
24345 @item -maltivec=be
24346 @opindex maltivec=be
24347 Generate AltiVec instructions using big-endian element order,
24348 regardless of whether the target is big- or little-endian. This is
24349 the default when targeting a big-endian platform. Using this option
24350 is currently deprecated. Support for this feature will be removed in
24351 GCC 9.
24352
24353 The element order is used to interpret element numbers in AltiVec
24354 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24355 @code{vec_insert}. By default, these match array element order
24356 corresponding to the endianness for the target.
24357
24358 @item -maltivec=le
24359 @opindex maltivec=le
24360 Generate AltiVec instructions using little-endian element order,
24361 regardless of whether the target is big- or little-endian. This is
24362 the default when targeting a little-endian platform. This option is
24363 currently ignored when targeting a big-endian platform.
24364
24365 The element order is used to interpret element numbers in AltiVec
24366 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24367 @code{vec_insert}. By default, these match array element order
24368 corresponding to the endianness for the target.
24369
24370 @item -mvrsave
24371 @itemx -mno-vrsave
24372 @opindex mvrsave
24373 @opindex mno-vrsave
24374 Generate VRSAVE instructions when generating AltiVec code.
24375
24376 @item -msecure-plt
24377 @opindex msecure-plt
24378 Generate code that allows @command{ld} and @command{ld.so}
24379 to build executables and shared
24380 libraries with non-executable @code{.plt} and @code{.got} sections.
24381 This is a PowerPC
24382 32-bit SYSV ABI option.
24383
24384 @item -mbss-plt
24385 @opindex mbss-plt
24386 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24387 fills in, and
24388 requires @code{.plt} and @code{.got}
24389 sections that are both writable and executable.
24390 This is a PowerPC 32-bit SYSV ABI option.
24391
24392 @item -misel
24393 @itemx -mno-isel
24394 @opindex misel
24395 @opindex mno-isel
24396 This switch enables or disables the generation of ISEL instructions.
24397
24398 @item -mvsx
24399 @itemx -mno-vsx
24400 @opindex mvsx
24401 @opindex mno-vsx
24402 Generate code that uses (does not use) vector/scalar (VSX)
24403 instructions, and also enable the use of built-in functions that allow
24404 more direct access to the VSX instruction set.
24405
24406 @item -mcrypto
24407 @itemx -mno-crypto
24408 @opindex mcrypto
24409 @opindex mno-crypto
24410 Enable the use (disable) of the built-in functions that allow direct
24411 access to the cryptographic instructions that were added in version
24412 2.07 of the PowerPC ISA.
24413
24414 @item -mhtm
24415 @itemx -mno-htm
24416 @opindex mhtm
24417 @opindex mno-htm
24418 Enable (disable) the use of the built-in functions that allow direct
24419 access to the Hardware Transactional Memory (HTM) instructions that
24420 were added in version 2.07 of the PowerPC ISA.
24421
24422 @item -mpower8-fusion
24423 @itemx -mno-power8-fusion
24424 @opindex mpower8-fusion
24425 @opindex mno-power8-fusion
24426 Generate code that keeps (does not keeps) some integer operations
24427 adjacent so that the instructions can be fused together on power8 and
24428 later processors.
24429
24430 @item -mpower8-vector
24431 @itemx -mno-power8-vector
24432 @opindex mpower8-vector
24433 @opindex mno-power8-vector
24434 Generate code that uses (does not use) the vector and scalar
24435 instructions that were added in version 2.07 of the PowerPC ISA. Also
24436 enable the use of built-in functions that allow more direct access to
24437 the vector instructions.
24438
24439 @item -mquad-memory
24440 @itemx -mno-quad-memory
24441 @opindex mquad-memory
24442 @opindex mno-quad-memory
24443 Generate code that uses (does not use) the non-atomic quad word memory
24444 instructions. The @option{-mquad-memory} option requires use of
24445 64-bit mode.
24446
24447 @item -mquad-memory-atomic
24448 @itemx -mno-quad-memory-atomic
24449 @opindex mquad-memory-atomic
24450 @opindex mno-quad-memory-atomic
24451 Generate code that uses (does not use) the atomic quad word memory
24452 instructions. The @option{-mquad-memory-atomic} option requires use of
24453 64-bit mode.
24454
24455 @item -mfloat128
24456 @itemx -mno-float128
24457 @opindex mfloat128
24458 @opindex mno-float128
24459 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24460 and use either software emulation for IEEE 128-bit floating point or
24461 hardware instructions.
24462
24463 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24464 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24465 use the IEEE 128-bit floating point support. The IEEE 128-bit
24466 floating point support only works on PowerPC Linux systems.
24467
24468 The default for @option{-mfloat128} is enabled on PowerPC Linux
24469 systems using the VSX instruction set, and disabled on other systems.
24470
24471 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24472 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24473 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24474 floating point instructions. Otherwise, if you do not specify to
24475 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24476 system, IEEE 128-bit floating point will be done with software
24477 emulation.
24478
24479 @item -mfloat128-hardware
24480 @itemx -mno-float128-hardware
24481 @opindex mfloat128-hardware
24482 @opindex mno-float128-hardware
24483 Enable/disable using ISA 3.0 hardware instructions to support the
24484 @var{__float128} data type.
24485
24486 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24487 Linux systems using the ISA 3.0 instruction set, and disabled on other
24488 systems.
24489
24490 @item -m32
24491 @itemx -m64
24492 @opindex m32
24493 @opindex m64
24494 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24495 targets (including GNU/Linux). The 32-bit environment sets int, long
24496 and pointer to 32 bits and generates code that runs on any PowerPC
24497 variant. The 64-bit environment sets int to 32 bits and long and
24498 pointer to 64 bits, and generates code for PowerPC64, as for
24499 @option{-mpowerpc64}.
24500
24501 @item -mfull-toc
24502 @itemx -mno-fp-in-toc
24503 @itemx -mno-sum-in-toc
24504 @itemx -mminimal-toc
24505 @opindex mfull-toc
24506 @opindex mno-fp-in-toc
24507 @opindex mno-sum-in-toc
24508 @opindex mminimal-toc
24509 Modify generation of the TOC (Table Of Contents), which is created for
24510 every executable file. The @option{-mfull-toc} option is selected by
24511 default. In that case, GCC allocates at least one TOC entry for
24512 each unique non-automatic variable reference in your program. GCC
24513 also places floating-point constants in the TOC@. However, only
24514 16,384 entries are available in the TOC@.
24515
24516 If you receive a linker error message that saying you have overflowed
24517 the available TOC space, you can reduce the amount of TOC space used
24518 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24519 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24520 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24521 generate code to calculate the sum of an address and a constant at
24522 run time instead of putting that sum into the TOC@. You may specify one
24523 or both of these options. Each causes GCC to produce very slightly
24524 slower and larger code at the expense of conserving TOC space.
24525
24526 If you still run out of space in the TOC even when you specify both of
24527 these options, specify @option{-mminimal-toc} instead. This option causes
24528 GCC to make only one TOC entry for every file. When you specify this
24529 option, GCC produces code that is slower and larger but which
24530 uses extremely little TOC space. You may wish to use this option
24531 only on files that contain less frequently-executed code.
24532
24533 @item -maix64
24534 @itemx -maix32
24535 @opindex maix64
24536 @opindex maix32
24537 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24538 @code{long} type, and the infrastructure needed to support them.
24539 Specifying @option{-maix64} implies @option{-mpowerpc64},
24540 while @option{-maix32} disables the 64-bit ABI and
24541 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24542
24543 @item -mxl-compat
24544 @itemx -mno-xl-compat
24545 @opindex mxl-compat
24546 @opindex mno-xl-compat
24547 Produce code that conforms more closely to IBM XL compiler semantics
24548 when using AIX-compatible ABI@. Pass floating-point arguments to
24549 prototyped functions beyond the register save area (RSA) on the stack
24550 in addition to argument FPRs. Do not assume that most significant
24551 double in 128-bit long double value is properly rounded when comparing
24552 values and converting to double. Use XL symbol names for long double
24553 support routines.
24554
24555 The AIX calling convention was extended but not initially documented to
24556 handle an obscure K&R C case of calling a function that takes the
24557 address of its arguments with fewer arguments than declared. IBM XL
24558 compilers access floating-point arguments that do not fit in the
24559 RSA from the stack when a subroutine is compiled without
24560 optimization. Because always storing floating-point arguments on the
24561 stack is inefficient and rarely needed, this option is not enabled by
24562 default and only is necessary when calling subroutines compiled by IBM
24563 XL compilers without optimization.
24564
24565 @item -mpe
24566 @opindex mpe
24567 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24568 application written to use message passing with special startup code to
24569 enable the application to run. The system must have PE installed in the
24570 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24571 must be overridden with the @option{-specs=} option to specify the
24572 appropriate directory location. The Parallel Environment does not
24573 support threads, so the @option{-mpe} option and the @option{-pthread}
24574 option are incompatible.
24575
24576 @item -malign-natural
24577 @itemx -malign-power
24578 @opindex malign-natural
24579 @opindex malign-power
24580 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24581 @option{-malign-natural} overrides the ABI-defined alignment of larger
24582 types, such as floating-point doubles, on their natural size-based boundary.
24583 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24584 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24585
24586 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24587 is not supported.
24588
24589 @item -msoft-float
24590 @itemx -mhard-float
24591 @opindex msoft-float
24592 @opindex mhard-float
24593 Generate code that does not use (uses) the floating-point register set.
24594 Software floating-point emulation is provided if you use the
24595 @option{-msoft-float} option, and pass the option to GCC when linking.
24596
24597 @item -mmultiple
24598 @itemx -mno-multiple
24599 @opindex mmultiple
24600 @opindex mno-multiple
24601 Generate code that uses (does not use) the load multiple word
24602 instructions and the store multiple word instructions. These
24603 instructions are generated by default on POWER systems, and not
24604 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24605 PowerPC systems, since those instructions do not work when the
24606 processor is in little-endian mode. The exceptions are PPC740 and
24607 PPC750 which permit these instructions in little-endian mode.
24608
24609 @item -mupdate
24610 @itemx -mno-update
24611 @opindex mupdate
24612 @opindex mno-update
24613 Generate code that uses (does not use) the load or store instructions
24614 that update the base register to the address of the calculated memory
24615 location. These instructions are generated by default. If you use
24616 @option{-mno-update}, there is a small window between the time that the
24617 stack pointer is updated and the address of the previous frame is
24618 stored, which means code that walks the stack frame across interrupts or
24619 signals may get corrupted data.
24620
24621 @item -mavoid-indexed-addresses
24622 @itemx -mno-avoid-indexed-addresses
24623 @opindex mavoid-indexed-addresses
24624 @opindex mno-avoid-indexed-addresses
24625 Generate code that tries to avoid (not avoid) the use of indexed load
24626 or store instructions. These instructions can incur a performance
24627 penalty on Power6 processors in certain situations, such as when
24628 stepping through large arrays that cross a 16M boundary. This option
24629 is enabled by default when targeting Power6 and disabled otherwise.
24630
24631 @item -mfused-madd
24632 @itemx -mno-fused-madd
24633 @opindex mfused-madd
24634 @opindex mno-fused-madd
24635 Generate code that uses (does not use) the floating-point multiply and
24636 accumulate instructions. These instructions are generated by default
24637 if hardware floating point is used. The machine-dependent
24638 @option{-mfused-madd} option is now mapped to the machine-independent
24639 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24640 mapped to @option{-ffp-contract=off}.
24641
24642 @item -mmulhw
24643 @itemx -mno-mulhw
24644 @opindex mmulhw
24645 @opindex mno-mulhw
24646 Generate code that uses (does not use) the half-word multiply and
24647 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24648 These instructions are generated by default when targeting those
24649 processors.
24650
24651 @item -mdlmzb
24652 @itemx -mno-dlmzb
24653 @opindex mdlmzb
24654 @opindex mno-dlmzb
24655 Generate code that uses (does not use) the string-search @samp{dlmzb}
24656 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24657 generated by default when targeting those processors.
24658
24659 @item -mno-bit-align
24660 @itemx -mbit-align
24661 @opindex mno-bit-align
24662 @opindex mbit-align
24663 On System V.4 and embedded PowerPC systems do not (do) force structures
24664 and unions that contain bit-fields to be aligned to the base type of the
24665 bit-field.
24666
24667 For example, by default a structure containing nothing but 8
24668 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24669 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24670 the structure is aligned to a 1-byte boundary and is 1 byte in
24671 size.
24672
24673 @item -mno-strict-align
24674 @itemx -mstrict-align
24675 @opindex mno-strict-align
24676 @opindex mstrict-align
24677 On System V.4 and embedded PowerPC systems do not (do) assume that
24678 unaligned memory references are handled by the system.
24679
24680 @item -mrelocatable
24681 @itemx -mno-relocatable
24682 @opindex mrelocatable
24683 @opindex mno-relocatable
24684 Generate code that allows (does not allow) a static executable to be
24685 relocated to a different address at run time. A simple embedded
24686 PowerPC system loader should relocate the entire contents of
24687 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24688 a table of 32-bit addresses generated by this option. For this to
24689 work, all objects linked together must be compiled with
24690 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24691 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24692
24693 @item -mrelocatable-lib
24694 @itemx -mno-relocatable-lib
24695 @opindex mrelocatable-lib
24696 @opindex mno-relocatable-lib
24697 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24698 @code{.fixup} section to allow static executables to be relocated at
24699 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24700 alignment of @option{-mrelocatable}. Objects compiled with
24701 @option{-mrelocatable-lib} may be linked with objects compiled with
24702 any combination of the @option{-mrelocatable} options.
24703
24704 @item -mno-toc
24705 @itemx -mtoc
24706 @opindex mno-toc
24707 @opindex mtoc
24708 On System V.4 and embedded PowerPC systems do not (do) assume that
24709 register 2 contains a pointer to a global area pointing to the addresses
24710 used in the program.
24711
24712 @item -mlittle
24713 @itemx -mlittle-endian
24714 @opindex mlittle
24715 @opindex mlittle-endian
24716 On System V.4 and embedded PowerPC systems compile code for the
24717 processor in little-endian mode. The @option{-mlittle-endian} option is
24718 the same as @option{-mlittle}.
24719
24720 @item -mbig
24721 @itemx -mbig-endian
24722 @opindex mbig
24723 @opindex mbig-endian
24724 On System V.4 and embedded PowerPC systems compile code for the
24725 processor in big-endian mode. The @option{-mbig-endian} option is
24726 the same as @option{-mbig}.
24727
24728 @item -mdynamic-no-pic
24729 @opindex mdynamic-no-pic
24730 On Darwin and Mac OS X systems, compile code so that it is not
24731 relocatable, but that its external references are relocatable. The
24732 resulting code is suitable for applications, but not shared
24733 libraries.
24734
24735 @item -msingle-pic-base
24736 @opindex msingle-pic-base
24737 Treat the register used for PIC addressing as read-only, rather than
24738 loading it in the prologue for each function. The runtime system is
24739 responsible for initializing this register with an appropriate value
24740 before execution begins.
24741
24742 @item -mprioritize-restricted-insns=@var{priority}
24743 @opindex mprioritize-restricted-insns
24744 This option controls the priority that is assigned to
24745 dispatch-slot restricted instructions during the second scheduling
24746 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24747 or @samp{2} to assign no, highest, or second-highest (respectively)
24748 priority to dispatch-slot restricted
24749 instructions.
24750
24751 @item -msched-costly-dep=@var{dependence_type}
24752 @opindex msched-costly-dep
24753 This option controls which dependences are considered costly
24754 by the target during instruction scheduling. The argument
24755 @var{dependence_type} takes one of the following values:
24756
24757 @table @asis
24758 @item @samp{no}
24759 No dependence is costly.
24760
24761 @item @samp{all}
24762 All dependences are costly.
24763
24764 @item @samp{true_store_to_load}
24765 A true dependence from store to load is costly.
24766
24767 @item @samp{store_to_load}
24768 Any dependence from store to load is costly.
24769
24770 @item @var{number}
24771 Any dependence for which the latency is greater than or equal to
24772 @var{number} is costly.
24773 @end table
24774
24775 @item -minsert-sched-nops=@var{scheme}
24776 @opindex minsert-sched-nops
24777 This option controls which NOP insertion scheme is used during
24778 the second scheduling pass. The argument @var{scheme} takes one of the
24779 following values:
24780
24781 @table @asis
24782 @item @samp{no}
24783 Don't insert NOPs.
24784
24785 @item @samp{pad}
24786 Pad with NOPs any dispatch group that has vacant issue slots,
24787 according to the scheduler's grouping.
24788
24789 @item @samp{regroup_exact}
24790 Insert NOPs to force costly dependent insns into
24791 separate groups. Insert exactly as many NOPs as needed to force an insn
24792 to a new group, according to the estimated processor grouping.
24793
24794 @item @var{number}
24795 Insert NOPs to force costly dependent insns into
24796 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24797 @end table
24798
24799 @item -mcall-sysv
24800 @opindex mcall-sysv
24801 On System V.4 and embedded PowerPC systems compile code using calling
24802 conventions that adhere to the March 1995 draft of the System V
24803 Application Binary Interface, PowerPC processor supplement. This is the
24804 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24805
24806 @item -mcall-sysv-eabi
24807 @itemx -mcall-eabi
24808 @opindex mcall-sysv-eabi
24809 @opindex mcall-eabi
24810 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24811
24812 @item -mcall-sysv-noeabi
24813 @opindex mcall-sysv-noeabi
24814 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24815
24816 @item -mcall-aixdesc
24817 @opindex m
24818 On System V.4 and embedded PowerPC systems compile code for the AIX
24819 operating system.
24820
24821 @item -mcall-linux
24822 @opindex mcall-linux
24823 On System V.4 and embedded PowerPC systems compile code for the
24824 Linux-based GNU system.
24825
24826 @item -mcall-freebsd
24827 @opindex mcall-freebsd
24828 On System V.4 and embedded PowerPC systems compile code for the
24829 FreeBSD operating system.
24830
24831 @item -mcall-netbsd
24832 @opindex mcall-netbsd
24833 On System V.4 and embedded PowerPC systems compile code for the
24834 NetBSD operating system.
24835
24836 @item -mcall-openbsd
24837 @opindex mcall-netbsd
24838 On System V.4 and embedded PowerPC systems compile code for the
24839 OpenBSD operating system.
24840
24841 @item -mtraceback=@var{traceback_type}
24842 @opindex mtraceback
24843 Select the type of traceback table. Valid values for @var{traceback_type}
24844 are @samp{full}, @samp{part}, and @samp{no}.
24845
24846 @item -maix-struct-return
24847 @opindex maix-struct-return
24848 Return all structures in memory (as specified by the AIX ABI)@.
24849
24850 @item -msvr4-struct-return
24851 @opindex msvr4-struct-return
24852 Return structures smaller than 8 bytes in registers (as specified by the
24853 SVR4 ABI)@.
24854
24855 @item -mabi=@var{abi-type}
24856 @opindex mabi
24857 Extend the current ABI with a particular extension, or remove such extension.
24858 Valid values are @samp{altivec}, @samp{no-altivec},
24859 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24860 @samp{elfv1}, @samp{elfv2}@.
24861
24862 @item -mabi=ibmlongdouble
24863 @opindex mabi=ibmlongdouble
24864 Change the current ABI to use IBM extended-precision long double.
24865 This is not likely to work if your system defaults to using IEEE
24866 extended-precision long double. If you change the long double type
24867 from IEEE extended-precision, the compiler will issue a warning unless
24868 you use the @option{-Wno-psabi} option.
24869
24870 @item -mabi=ieeelongdouble
24871 @opindex mabi=ieeelongdouble
24872 Change the current ABI to use IEEE extended-precision long double.
24873 This is not likely to work if your system defaults to using IBM
24874 extended-precision long double. If you change the long double type
24875 from IBM extended-precision, the compiler will issue a warning unless
24876 you use the @option{-Wno-psabi} option.
24877
24878 @item -mabi=elfv1
24879 @opindex mabi=elfv1
24880 Change the current ABI to use the ELFv1 ABI.
24881 This is the default ABI for big-endian PowerPC 64-bit Linux.
24882 Overriding the default ABI requires special system support and is
24883 likely to fail in spectacular ways.
24884
24885 @item -mabi=elfv2
24886 @opindex mabi=elfv2
24887 Change the current ABI to use the ELFv2 ABI.
24888 This is the default ABI for little-endian PowerPC 64-bit Linux.
24889 Overriding the default ABI requires special system support and is
24890 likely to fail in spectacular ways.
24891
24892 @item -mgnu-attribute
24893 @itemx -mno-gnu-attribute
24894 @opindex mgnu-attribute
24895 @opindex mno-gnu-attribute
24896 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24897 .gnu.attributes section that specify ABI variations in function
24898 parameters or return values.
24899
24900 @item -mprototype
24901 @itemx -mno-prototype
24902 @opindex mprototype
24903 @opindex mno-prototype
24904 On System V.4 and embedded PowerPC systems assume that all calls to
24905 variable argument functions are properly prototyped. Otherwise, the
24906 compiler must insert an instruction before every non-prototyped call to
24907 set or clear bit 6 of the condition code register (@code{CR}) to
24908 indicate whether floating-point values are passed in the floating-point
24909 registers in case the function takes variable arguments. With
24910 @option{-mprototype}, only calls to prototyped variable argument functions
24911 set or clear the bit.
24912
24913 @item -msim
24914 @opindex msim
24915 On embedded PowerPC systems, assume that the startup module is called
24916 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24917 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24918 configurations.
24919
24920 @item -mmvme
24921 @opindex mmvme
24922 On embedded PowerPC systems, assume that the startup module is called
24923 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24924 @file{libc.a}.
24925
24926 @item -mads
24927 @opindex mads
24928 On embedded PowerPC systems, assume that the startup module is called
24929 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24930 @file{libc.a}.
24931
24932 @item -myellowknife
24933 @opindex myellowknife
24934 On embedded PowerPC systems, assume that the startup module is called
24935 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24936 @file{libc.a}.
24937
24938 @item -mvxworks
24939 @opindex mvxworks
24940 On System V.4 and embedded PowerPC systems, specify that you are
24941 compiling for a VxWorks system.
24942
24943 @item -memb
24944 @opindex memb
24945 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24946 header to indicate that @samp{eabi} extended relocations are used.
24947
24948 @item -meabi
24949 @itemx -mno-eabi
24950 @opindex meabi
24951 @opindex mno-eabi
24952 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24953 Embedded Applications Binary Interface (EABI), which is a set of
24954 modifications to the System V.4 specifications. Selecting @option{-meabi}
24955 means that the stack is aligned to an 8-byte boundary, a function
24956 @code{__eabi} is called from @code{main} to set up the EABI
24957 environment, and the @option{-msdata} option can use both @code{r2} and
24958 @code{r13} to point to two separate small data areas. Selecting
24959 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24960 no EABI initialization function is called from @code{main}, and the
24961 @option{-msdata} option only uses @code{r13} to point to a single
24962 small data area. The @option{-meabi} option is on by default if you
24963 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24964
24965 @item -msdata=eabi
24966 @opindex msdata=eabi
24967 On System V.4 and embedded PowerPC systems, put small initialized
24968 @code{const} global and static data in the @code{.sdata2} section, which
24969 is pointed to by register @code{r2}. Put small initialized
24970 non-@code{const} global and static data in the @code{.sdata} section,
24971 which is pointed to by register @code{r13}. Put small uninitialized
24972 global and static data in the @code{.sbss} section, which is adjacent to
24973 the @code{.sdata} section. The @option{-msdata=eabi} option is
24974 incompatible with the @option{-mrelocatable} option. The
24975 @option{-msdata=eabi} option also sets the @option{-memb} option.
24976
24977 @item -msdata=sysv
24978 @opindex msdata=sysv
24979 On System V.4 and embedded PowerPC systems, put small global and static
24980 data in the @code{.sdata} section, which is pointed to by register
24981 @code{r13}. Put small uninitialized global and static data in the
24982 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24983 The @option{-msdata=sysv} option is incompatible with the
24984 @option{-mrelocatable} option.
24985
24986 @item -msdata=default
24987 @itemx -msdata
24988 @opindex msdata=default
24989 @opindex msdata
24990 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24991 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24992 same as @option{-msdata=sysv}.
24993
24994 @item -msdata=data
24995 @opindex msdata=data
24996 On System V.4 and embedded PowerPC systems, put small global
24997 data in the @code{.sdata} section. Put small uninitialized global
24998 data in the @code{.sbss} section. Do not use register @code{r13}
24999 to address small data however. This is the default behavior unless
25000 other @option{-msdata} options are used.
25001
25002 @item -msdata=none
25003 @itemx -mno-sdata
25004 @opindex msdata=none
25005 @opindex mno-sdata
25006 On embedded PowerPC systems, put all initialized global and static data
25007 in the @code{.data} section, and all uninitialized data in the
25008 @code{.bss} section.
25009
25010 @item -mreadonly-in-sdata
25011 @opindex mreadonly-in-sdata
25012 @opindex mno-readonly-in-sdata
25013 Put read-only objects in the @code{.sdata} section as well. This is the
25014 default.
25015
25016 @item -mblock-move-inline-limit=@var{num}
25017 @opindex mblock-move-inline-limit
25018 Inline all block moves (such as calls to @code{memcpy} or structure
25019 copies) less than or equal to @var{num} bytes. The minimum value for
25020 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25021 targets. The default value is target-specific.
25022
25023 @item -mblock-compare-inline-limit=@var{num}
25024 @opindex mblock-compare-inline-limit
25025 Generate non-looping inline code for all block compares (such as calls
25026 to @code{memcmp} or structure compares) less than or equal to @var{num}
25027 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25028 block compare is disabled. The default value is target-specific.
25029
25030 @item -mblock-compare-inline-loop-limit=@var{num}
25031 @opindex mblock-compare-inline-loop-limit
25032 Generate an inline expansion using loop code for all block compares that
25033 are less than or equal to @var{num} bytes, but greater than the limit
25034 for non-loop inline block compare expansion. If the block length is not
25035 constant, at most @var{num} bytes will be compared before @code{memcmp}
25036 is called to compare the remainder of the block. The default value is
25037 target-specific.
25038
25039 @item -mstring-compare-inline-limit=@var{num}
25040 @opindex mstring-compare-inline-limit
25041 Compare at most @var{num} string bytes with inline code.
25042 If the difference or end of string is not found at the
25043 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25044 take care of the rest of the comparison. The default is 64 bytes.
25045
25046 @item -G @var{num}
25047 @opindex G
25048 @cindex smaller data references (PowerPC)
25049 @cindex .sdata/.sdata2 references (PowerPC)
25050 On embedded PowerPC systems, put global and static items less than or
25051 equal to @var{num} bytes into the small data or BSS sections instead of
25052 the normal data or BSS section. By default, @var{num} is 8. The
25053 @option{-G @var{num}} switch is also passed to the linker.
25054 All modules should be compiled with the same @option{-G @var{num}} value.
25055
25056 @item -mregnames
25057 @itemx -mno-regnames
25058 @opindex mregnames
25059 @opindex mno-regnames
25060 On System V.4 and embedded PowerPC systems do (do not) emit register
25061 names in the assembly language output using symbolic forms.
25062
25063 @item -mlongcall
25064 @itemx -mno-longcall
25065 @opindex mlongcall
25066 @opindex mno-longcall
25067 By default assume that all calls are far away so that a longer and more
25068 expensive calling sequence is required. This is required for calls
25069 farther than 32 megabytes (33,554,432 bytes) from the current location.
25070 A short call is generated if the compiler knows
25071 the call cannot be that far away. This setting can be overridden by
25072 the @code{shortcall} function attribute, or by @code{#pragma
25073 longcall(0)}.
25074
25075 Some linkers are capable of detecting out-of-range calls and generating
25076 glue code on the fly. On these systems, long calls are unnecessary and
25077 generate slower code. As of this writing, the AIX linker can do this,
25078 as can the GNU linker for PowerPC/64. It is planned to add this feature
25079 to the GNU linker for 32-bit PowerPC systems as well.
25080
25081 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25082 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25083 addresses represent the callee and the branch island. The
25084 Darwin/PPC linker prefers the first address and generates a @code{bl
25085 callee} if the PPC @code{bl} instruction reaches the callee directly;
25086 otherwise, the linker generates @code{bl L42} to call the branch
25087 island. The branch island is appended to the body of the
25088 calling function; it computes the full 32-bit address of the callee
25089 and jumps to it.
25090
25091 On Mach-O (Darwin) systems, this option directs the compiler emit to
25092 the glue for every direct call, and the Darwin linker decides whether
25093 to use or discard it.
25094
25095 In the future, GCC may ignore all longcall specifications
25096 when the linker is known to generate glue.
25097
25098 @item -mtls-markers
25099 @itemx -mno-tls-markers
25100 @opindex mtls-markers
25101 @opindex mno-tls-markers
25102 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25103 specifying the function argument. The relocation allows the linker to
25104 reliably associate function call with argument setup instructions for
25105 TLS optimization, which in turn allows GCC to better schedule the
25106 sequence.
25107
25108 @item -mrecip
25109 @itemx -mno-recip
25110 @opindex mrecip
25111 This option enables use of the reciprocal estimate and
25112 reciprocal square root estimate instructions with additional
25113 Newton-Raphson steps to increase precision instead of doing a divide or
25114 square root and divide for floating-point arguments. You should use
25115 the @option{-ffast-math} option when using @option{-mrecip} (or at
25116 least @option{-funsafe-math-optimizations},
25117 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25118 @option{-fno-trapping-math}). Note that while the throughput of the
25119 sequence is generally higher than the throughput of the non-reciprocal
25120 instruction, the precision of the sequence can be decreased by up to 2
25121 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25122 roots.
25123
25124 @item -mrecip=@var{opt}
25125 @opindex mrecip=opt
25126 This option controls which reciprocal estimate instructions
25127 may be used. @var{opt} is a comma-separated list of options, which may
25128 be preceded by a @code{!} to invert the option:
25129
25130 @table @samp
25131
25132 @item all
25133 Enable all estimate instructions.
25134
25135 @item default
25136 Enable the default instructions, equivalent to @option{-mrecip}.
25137
25138 @item none
25139 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25140
25141 @item div
25142 Enable the reciprocal approximation instructions for both
25143 single and double precision.
25144
25145 @item divf
25146 Enable the single-precision reciprocal approximation instructions.
25147
25148 @item divd
25149 Enable the double-precision reciprocal approximation instructions.
25150
25151 @item rsqrt
25152 Enable the reciprocal square root approximation instructions for both
25153 single and double precision.
25154
25155 @item rsqrtf
25156 Enable the single-precision reciprocal square root approximation instructions.
25157
25158 @item rsqrtd
25159 Enable the double-precision reciprocal square root approximation instructions.
25160
25161 @end table
25162
25163 So, for example, @option{-mrecip=all,!rsqrtd} enables
25164 all of the reciprocal estimate instructions, except for the
25165 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25166 which handle the double-precision reciprocal square root calculations.
25167
25168 @item -mrecip-precision
25169 @itemx -mno-recip-precision
25170 @opindex mrecip-precision
25171 Assume (do not assume) that the reciprocal estimate instructions
25172 provide higher-precision estimates than is mandated by the PowerPC
25173 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25174 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25175 The double-precision square root estimate instructions are not generated by
25176 default on low-precision machines, since they do not provide an
25177 estimate that converges after three steps.
25178
25179 @item -mveclibabi=@var{type}
25180 @opindex mveclibabi
25181 Specifies the ABI type to use for vectorizing intrinsics using an
25182 external library. The only type supported at present is @samp{mass},
25183 which specifies to use IBM's Mathematical Acceleration Subsystem
25184 (MASS) libraries for vectorizing intrinsics using external libraries.
25185 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25186 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25187 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25188 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25189 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25190 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25191 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25192 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25193 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25194 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25195 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25196 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25197 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25198 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25199 for power7. Both @option{-ftree-vectorize} and
25200 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25201 libraries must be specified at link time.
25202
25203 @item -mfriz
25204 @itemx -mno-friz
25205 @opindex mfriz
25206 Generate (do not generate) the @code{friz} instruction when the
25207 @option{-funsafe-math-optimizations} option is used to optimize
25208 rounding of floating-point values to 64-bit integer and back to floating
25209 point. The @code{friz} instruction does not return the same value if
25210 the floating-point number is too large to fit in an integer.
25211
25212 @item -mpointers-to-nested-functions
25213 @itemx -mno-pointers-to-nested-functions
25214 @opindex mpointers-to-nested-functions
25215 Generate (do not generate) code to load up the static chain register
25216 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25217 systems where a function pointer points to a 3-word descriptor giving
25218 the function address, TOC value to be loaded in register @code{r2}, and
25219 static chain value to be loaded in register @code{r11}. The
25220 @option{-mpointers-to-nested-functions} is on by default. You cannot
25221 call through pointers to nested functions or pointers
25222 to functions compiled in other languages that use the static chain if
25223 you use @option{-mno-pointers-to-nested-functions}.
25224
25225 @item -msave-toc-indirect
25226 @itemx -mno-save-toc-indirect
25227 @opindex msave-toc-indirect
25228 Generate (do not generate) code to save the TOC value in the reserved
25229 stack location in the function prologue if the function calls through
25230 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25231 saved in the prologue, it is saved just before the call through the
25232 pointer. The @option{-mno-save-toc-indirect} option is the default.
25233
25234 @item -mcompat-align-parm
25235 @itemx -mno-compat-align-parm
25236 @opindex mcompat-align-parm
25237 Generate (do not generate) code to pass structure parameters with a
25238 maximum alignment of 64 bits, for compatibility with older versions
25239 of GCC.
25240
25241 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25242 structure parameter on a 128-bit boundary when that structure contained
25243 a member requiring 128-bit alignment. This is corrected in more
25244 recent versions of GCC. This option may be used to generate code
25245 that is compatible with functions compiled with older versions of
25246 GCC.
25247
25248 The @option{-mno-compat-align-parm} option is the default.
25249
25250 @item -mstack-protector-guard=@var{guard}
25251 @itemx -mstack-protector-guard-reg=@var{reg}
25252 @itemx -mstack-protector-guard-offset=@var{offset}
25253 @itemx -mstack-protector-guard-symbol=@var{symbol}
25254 @opindex mstack-protector-guard
25255 @opindex mstack-protector-guard-reg
25256 @opindex mstack-protector-guard-offset
25257 @opindex mstack-protector-guard-symbol
25258 Generate stack protection code using canary at @var{guard}. Supported
25259 locations are @samp{global} for global canary or @samp{tls} for per-thread
25260 canary in the TLS block (the default with GNU libc version 2.4 or later).
25261
25262 With the latter choice the options
25263 @option{-mstack-protector-guard-reg=@var{reg}} and
25264 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25265 which register to use as base register for reading the canary, and from what
25266 offset from that base register. The default for those is as specified in the
25267 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25268 the offset with a symbol reference to a canary in the TLS block.
25269 @end table
25270
25271 @node RX Options
25272 @subsection RX Options
25273 @cindex RX Options
25274
25275 These command-line options are defined for RX targets:
25276
25277 @table @gcctabopt
25278 @item -m64bit-doubles
25279 @itemx -m32bit-doubles
25280 @opindex m64bit-doubles
25281 @opindex m32bit-doubles
25282 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25283 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25284 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25285 works on 32-bit values, which is why the default is
25286 @option{-m32bit-doubles}.
25287
25288 @item -fpu
25289 @itemx -nofpu
25290 @opindex fpu
25291 @opindex nofpu
25292 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25293 floating-point hardware. The default is enabled for the RX600
25294 series and disabled for the RX200 series.
25295
25296 Floating-point instructions are only generated for 32-bit floating-point
25297 values, however, so the FPU hardware is not used for doubles if the
25298 @option{-m64bit-doubles} option is used.
25299
25300 @emph{Note} If the @option{-fpu} option is enabled then
25301 @option{-funsafe-math-optimizations} is also enabled automatically.
25302 This is because the RX FPU instructions are themselves unsafe.
25303
25304 @item -mcpu=@var{name}
25305 @opindex mcpu
25306 Selects the type of RX CPU to be targeted. Currently three types are
25307 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25308 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25309
25310 The only difference between @samp{RX600} and @samp{RX610} is that the
25311 @samp{RX610} does not support the @code{MVTIPL} instruction.
25312
25313 The @samp{RX200} series does not have a hardware floating-point unit
25314 and so @option{-nofpu} is enabled by default when this type is
25315 selected.
25316
25317 @item -mbig-endian-data
25318 @itemx -mlittle-endian-data
25319 @opindex mbig-endian-data
25320 @opindex mlittle-endian-data
25321 Store data (but not code) in the big-endian format. The default is
25322 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25323 format.
25324
25325 @item -msmall-data-limit=@var{N}
25326 @opindex msmall-data-limit
25327 Specifies the maximum size in bytes of global and static variables
25328 which can be placed into the small data area. Using the small data
25329 area can lead to smaller and faster code, but the size of area is
25330 limited and it is up to the programmer to ensure that the area does
25331 not overflow. Also when the small data area is used one of the RX's
25332 registers (usually @code{r13}) is reserved for use pointing to this
25333 area, so it is no longer available for use by the compiler. This
25334 could result in slower and/or larger code if variables are pushed onto
25335 the stack instead of being held in this register.
25336
25337 Note, common variables (variables that have not been initialized) and
25338 constants are not placed into the small data area as they are assigned
25339 to other sections in the output executable.
25340
25341 The default value is zero, which disables this feature. Note, this
25342 feature is not enabled by default with higher optimization levels
25343 (@option{-O2} etc) because of the potentially detrimental effects of
25344 reserving a register. It is up to the programmer to experiment and
25345 discover whether this feature is of benefit to their program. See the
25346 description of the @option{-mpid} option for a description of how the
25347 actual register to hold the small data area pointer is chosen.
25348
25349 @item -msim
25350 @itemx -mno-sim
25351 @opindex msim
25352 @opindex mno-sim
25353 Use the simulator runtime. The default is to use the libgloss
25354 board-specific runtime.
25355
25356 @item -mas100-syntax
25357 @itemx -mno-as100-syntax
25358 @opindex mas100-syntax
25359 @opindex mno-as100-syntax
25360 When generating assembler output use a syntax that is compatible with
25361 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25362 assembler, but it has some restrictions so it is not generated by default.
25363
25364 @item -mmax-constant-size=@var{N}
25365 @opindex mmax-constant-size
25366 Specifies the maximum size, in bytes, of a constant that can be used as
25367 an operand in a RX instruction. Although the RX instruction set does
25368 allow constants of up to 4 bytes in length to be used in instructions,
25369 a longer value equates to a longer instruction. Thus in some
25370 circumstances it can be beneficial to restrict the size of constants
25371 that are used in instructions. Constants that are too big are instead
25372 placed into a constant pool and referenced via register indirection.
25373
25374 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25375 or 4 means that constants of any size are allowed.
25376
25377 @item -mrelax
25378 @opindex mrelax
25379 Enable linker relaxation. Linker relaxation is a process whereby the
25380 linker attempts to reduce the size of a program by finding shorter
25381 versions of various instructions. Disabled by default.
25382
25383 @item -mint-register=@var{N}
25384 @opindex mint-register
25385 Specify the number of registers to reserve for fast interrupt handler
25386 functions. The value @var{N} can be between 0 and 4. A value of 1
25387 means that register @code{r13} is reserved for the exclusive use
25388 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25389 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25390 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25391 A value of 0, the default, does not reserve any registers.
25392
25393 @item -msave-acc-in-interrupts
25394 @opindex msave-acc-in-interrupts
25395 Specifies that interrupt handler functions should preserve the
25396 accumulator register. This is only necessary if normal code might use
25397 the accumulator register, for example because it performs 64-bit
25398 multiplications. The default is to ignore the accumulator as this
25399 makes the interrupt handlers faster.
25400
25401 @item -mpid
25402 @itemx -mno-pid
25403 @opindex mpid
25404 @opindex mno-pid
25405 Enables the generation of position independent data. When enabled any
25406 access to constant data is done via an offset from a base address
25407 held in a register. This allows the location of constant data to be
25408 determined at run time without requiring the executable to be
25409 relocated, which is a benefit to embedded applications with tight
25410 memory constraints. Data that can be modified is not affected by this
25411 option.
25412
25413 Note, using this feature reserves a register, usually @code{r13}, for
25414 the constant data base address. This can result in slower and/or
25415 larger code, especially in complicated functions.
25416
25417 The actual register chosen to hold the constant data base address
25418 depends upon whether the @option{-msmall-data-limit} and/or the
25419 @option{-mint-register} command-line options are enabled. Starting
25420 with register @code{r13} and proceeding downwards, registers are
25421 allocated first to satisfy the requirements of @option{-mint-register},
25422 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25423 is possible for the small data area register to be @code{r8} if both
25424 @option{-mint-register=4} and @option{-mpid} are specified on the
25425 command line.
25426
25427 By default this feature is not enabled. The default can be restored
25428 via the @option{-mno-pid} command-line option.
25429
25430 @item -mno-warn-multiple-fast-interrupts
25431 @itemx -mwarn-multiple-fast-interrupts
25432 @opindex mno-warn-multiple-fast-interrupts
25433 @opindex mwarn-multiple-fast-interrupts
25434 Prevents GCC from issuing a warning message if it finds more than one
25435 fast interrupt handler when it is compiling a file. The default is to
25436 issue a warning for each extra fast interrupt handler found, as the RX
25437 only supports one such interrupt.
25438
25439 @item -mallow-string-insns
25440 @itemx -mno-allow-string-insns
25441 @opindex mallow-string-insns
25442 @opindex mno-allow-string-insns
25443 Enables or disables the use of the string manipulation instructions
25444 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25445 @code{SWHILE} and also the @code{RMPA} instruction. These
25446 instructions may prefetch data, which is not safe to do if accessing
25447 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25448 for more information).
25449
25450 The default is to allow these instructions, but it is not possible for
25451 GCC to reliably detect all circumstances where a string instruction
25452 might be used to access an I/O register, so their use cannot be
25453 disabled automatically. Instead it is reliant upon the programmer to
25454 use the @option{-mno-allow-string-insns} option if their program
25455 accesses I/O space.
25456
25457 When the instructions are enabled GCC defines the C preprocessor
25458 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25459 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25460
25461 @item -mjsr
25462 @itemx -mno-jsr
25463 @opindex mjsr
25464 @opindex mno-jsr
25465 Use only (or not only) @code{JSR} instructions to access functions.
25466 This option can be used when code size exceeds the range of @code{BSR}
25467 instructions. Note that @option{-mno-jsr} does not mean to not use
25468 @code{JSR} but instead means that any type of branch may be used.
25469 @end table
25470
25471 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25472 has special significance to the RX port when used with the
25473 @code{interrupt} function attribute. This attribute indicates a
25474 function intended to process fast interrupts. GCC ensures
25475 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25476 and/or @code{r13} and only provided that the normal use of the
25477 corresponding registers have been restricted via the
25478 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25479 options.
25480
25481 @node S/390 and zSeries Options
25482 @subsection S/390 and zSeries Options
25483 @cindex S/390 and zSeries Options
25484
25485 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25486
25487 @table @gcctabopt
25488 @item -mhard-float
25489 @itemx -msoft-float
25490 @opindex mhard-float
25491 @opindex msoft-float
25492 Use (do not use) the hardware floating-point instructions and registers
25493 for floating-point operations. When @option{-msoft-float} is specified,
25494 functions in @file{libgcc.a} are used to perform floating-point
25495 operations. When @option{-mhard-float} is specified, the compiler
25496 generates IEEE floating-point instructions. This is the default.
25497
25498 @item -mhard-dfp
25499 @itemx -mno-hard-dfp
25500 @opindex mhard-dfp
25501 @opindex mno-hard-dfp
25502 Use (do not use) the hardware decimal-floating-point instructions for
25503 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25504 specified, functions in @file{libgcc.a} are used to perform
25505 decimal-floating-point operations. When @option{-mhard-dfp} is
25506 specified, the compiler generates decimal-floating-point hardware
25507 instructions. This is the default for @option{-march=z9-ec} or higher.
25508
25509 @item -mlong-double-64
25510 @itemx -mlong-double-128
25511 @opindex mlong-double-64
25512 @opindex mlong-double-128
25513 These switches control the size of @code{long double} type. A size
25514 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25515 type. This is the default.
25516
25517 @item -mbackchain
25518 @itemx -mno-backchain
25519 @opindex mbackchain
25520 @opindex mno-backchain
25521 Store (do not store) the address of the caller's frame as backchain pointer
25522 into the callee's stack frame.
25523 A backchain may be needed to allow debugging using tools that do not understand
25524 DWARF call frame information.
25525 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25526 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25527 the backchain is placed into the topmost word of the 96/160 byte register
25528 save area.
25529
25530 In general, code compiled with @option{-mbackchain} is call-compatible with
25531 code compiled with @option{-mmo-backchain}; however, use of the backchain
25532 for debugging purposes usually requires that the whole binary is built with
25533 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25534 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25535 to build a linux kernel use @option{-msoft-float}.
25536
25537 The default is to not maintain the backchain.
25538
25539 @item -mpacked-stack
25540 @itemx -mno-packed-stack
25541 @opindex mpacked-stack
25542 @opindex mno-packed-stack
25543 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25544 specified, the compiler uses the all fields of the 96/160 byte register save
25545 area only for their default purpose; unused fields still take up stack space.
25546 When @option{-mpacked-stack} is specified, register save slots are densely
25547 packed at the top of the register save area; unused space is reused for other
25548 purposes, allowing for more efficient use of the available stack space.
25549 However, when @option{-mbackchain} is also in effect, the topmost word of
25550 the save area is always used to store the backchain, and the return address
25551 register is always saved two words below the backchain.
25552
25553 As long as the stack frame backchain is not used, code generated with
25554 @option{-mpacked-stack} is call-compatible with code generated with
25555 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25556 S/390 or zSeries generated code that uses the stack frame backchain at run
25557 time, not just for debugging purposes. Such code is not call-compatible
25558 with code compiled with @option{-mpacked-stack}. Also, note that the
25559 combination of @option{-mbackchain},
25560 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25561 to build a linux kernel use @option{-msoft-float}.
25562
25563 The default is to not use the packed stack layout.
25564
25565 @item -msmall-exec
25566 @itemx -mno-small-exec
25567 @opindex msmall-exec
25568 @opindex mno-small-exec
25569 Generate (or do not generate) code using the @code{bras} instruction
25570 to do subroutine calls.
25571 This only works reliably if the total executable size does not
25572 exceed 64k. The default is to use the @code{basr} instruction instead,
25573 which does not have this limitation.
25574
25575 @item -m64
25576 @itemx -m31
25577 @opindex m64
25578 @opindex m31
25579 When @option{-m31} is specified, generate code compliant to the
25580 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25581 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25582 particular to generate 64-bit instructions. For the @samp{s390}
25583 targets, the default is @option{-m31}, while the @samp{s390x}
25584 targets default to @option{-m64}.
25585
25586 @item -mzarch
25587 @itemx -mesa
25588 @opindex mzarch
25589 @opindex mesa
25590 When @option{-mzarch} is specified, generate code using the
25591 instructions available on z/Architecture.
25592 When @option{-mesa} is specified, generate code using the
25593 instructions available on ESA/390. Note that @option{-mesa} is
25594 not possible with @option{-m64}.
25595 When generating code compliant to the GNU/Linux for S/390 ABI,
25596 the default is @option{-mesa}. When generating code compliant
25597 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25598
25599 @item -mhtm
25600 @itemx -mno-htm
25601 @opindex mhtm
25602 @opindex mno-htm
25603 The @option{-mhtm} option enables a set of builtins making use of
25604 instructions available with the transactional execution facility
25605 introduced with the IBM zEnterprise EC12 machine generation
25606 @ref{S/390 System z Built-in Functions}.
25607 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25608
25609 @item -mvx
25610 @itemx -mno-vx
25611 @opindex mvx
25612 @opindex mno-vx
25613 When @option{-mvx} is specified, generate code using the instructions
25614 available with the vector extension facility introduced with the IBM
25615 z13 machine generation.
25616 This option changes the ABI for some vector type values with regard to
25617 alignment and calling conventions. In case vector type values are
25618 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25619 command will be added to mark the resulting binary with the ABI used.
25620 @option{-mvx} is enabled by default when using @option{-march=z13}.
25621
25622 @item -mzvector
25623 @itemx -mno-zvector
25624 @opindex mzvector
25625 @opindex mno-zvector
25626 The @option{-mzvector} option enables vector language extensions and
25627 builtins using instructions available with the vector extension
25628 facility introduced with the IBM z13 machine generation.
25629 This option adds support for @samp{vector} to be used as a keyword to
25630 define vector type variables and arguments. @samp{vector} is only
25631 available when GNU extensions are enabled. It will not be expanded
25632 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25633 In addition to the GCC low-level builtins @option{-mzvector} enables
25634 a set of builtins added for compatibility with AltiVec-style
25635 implementations like Power and Cell. In order to make use of these
25636 builtins the header file @file{vecintrin.h} needs to be included.
25637 @option{-mzvector} is disabled by default.
25638
25639 @item -mmvcle
25640 @itemx -mno-mvcle
25641 @opindex mmvcle
25642 @opindex mno-mvcle
25643 Generate (or do not generate) code using the @code{mvcle} instruction
25644 to perform block moves. When @option{-mno-mvcle} is specified,
25645 use a @code{mvc} loop instead. This is the default unless optimizing for
25646 size.
25647
25648 @item -mdebug
25649 @itemx -mno-debug
25650 @opindex mdebug
25651 @opindex mno-debug
25652 Print (or do not print) additional debug information when compiling.
25653 The default is to not print debug information.
25654
25655 @item -march=@var{cpu-type}
25656 @opindex march
25657 Generate code that runs on @var{cpu-type}, which is the name of a
25658 system representing a certain processor type. Possible values for
25659 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25660 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25661 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
25662 @samp{native}.
25663
25664 The default is @option{-march=z900}.
25665
25666 Specifying @samp{native} as cpu type can be used to select the best
25667 architecture option for the host processor.
25668 @option{-march=native} has no effect if GCC does not recognize the
25669 processor.
25670
25671 @item -mtune=@var{cpu-type}
25672 @opindex mtune
25673 Tune to @var{cpu-type} everything applicable about the generated code,
25674 except for the ABI and the set of available instructions.
25675 The list of @var{cpu-type} values is the same as for @option{-march}.
25676 The default is the value used for @option{-march}.
25677
25678 @item -mtpf-trace
25679 @itemx -mno-tpf-trace
25680 @opindex mtpf-trace
25681 @opindex mno-tpf-trace
25682 Generate code that adds (does not add) in TPF OS specific branches to trace
25683 routines in the operating system. This option is off by default, even
25684 when compiling for the TPF OS@.
25685
25686 @item -mfused-madd
25687 @itemx -mno-fused-madd
25688 @opindex mfused-madd
25689 @opindex mno-fused-madd
25690 Generate code that uses (does not use) the floating-point multiply and
25691 accumulate instructions. These instructions are generated by default if
25692 hardware floating point is used.
25693
25694 @item -mwarn-framesize=@var{framesize}
25695 @opindex mwarn-framesize
25696 Emit a warning if the current function exceeds the given frame size. Because
25697 this is a compile-time check it doesn't need to be a real problem when the program
25698 runs. It is intended to identify functions that most probably cause
25699 a stack overflow. It is useful to be used in an environment with limited stack
25700 size e.g.@: the linux kernel.
25701
25702 @item -mwarn-dynamicstack
25703 @opindex mwarn-dynamicstack
25704 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25705 arrays. This is generally a bad idea with a limited stack size.
25706
25707 @item -mstack-guard=@var{stack-guard}
25708 @itemx -mstack-size=@var{stack-size}
25709 @opindex mstack-guard
25710 @opindex mstack-size
25711 If these options are provided the S/390 back end emits additional instructions in
25712 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25713 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25714 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25715 the frame size of the compiled function is chosen.
25716 These options are intended to be used to help debugging stack overflow problems.
25717 The additionally emitted code causes only little overhead and hence can also be
25718 used in production-like systems without greater performance degradation. The given
25719 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25720 @var{stack-guard} without exceeding 64k.
25721 In order to be efficient the extra code makes the assumption that the stack starts
25722 at an address aligned to the value given by @var{stack-size}.
25723 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25724
25725 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25726 @opindex mhotpatch
25727 If the hotpatch option is enabled, a ``hot-patching'' function
25728 prologue is generated for all functions in the compilation unit.
25729 The funtion label is prepended with the given number of two-byte
25730 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25731 the label, 2 * @var{post-halfwords} bytes are appended, using the
25732 largest NOP like instructions the architecture allows (maximum
25733 1000000).
25734
25735 If both arguments are zero, hotpatching is disabled.
25736
25737 This option can be overridden for individual functions with the
25738 @code{hotpatch} attribute.
25739 @end table
25740
25741 @node Score Options
25742 @subsection Score Options
25743 @cindex Score Options
25744
25745 These options are defined for Score implementations:
25746
25747 @table @gcctabopt
25748 @item -meb
25749 @opindex meb
25750 Compile code for big-endian mode. This is the default.
25751
25752 @item -mel
25753 @opindex mel
25754 Compile code for little-endian mode.
25755
25756 @item -mnhwloop
25757 @opindex mnhwloop
25758 Disable generation of @code{bcnz} instructions.
25759
25760 @item -muls
25761 @opindex muls
25762 Enable generation of unaligned load and store instructions.
25763
25764 @item -mmac
25765 @opindex mmac
25766 Enable the use of multiply-accumulate instructions. Disabled by default.
25767
25768 @item -mscore5
25769 @opindex mscore5
25770 Specify the SCORE5 as the target architecture.
25771
25772 @item -mscore5u
25773 @opindex mscore5u
25774 Specify the SCORE5U of the target architecture.
25775
25776 @item -mscore7
25777 @opindex mscore7
25778 Specify the SCORE7 as the target architecture. This is the default.
25779
25780 @item -mscore7d
25781 @opindex mscore7d
25782 Specify the SCORE7D as the target architecture.
25783 @end table
25784
25785 @node SH Options
25786 @subsection SH Options
25787
25788 These @samp{-m} options are defined for the SH implementations:
25789
25790 @table @gcctabopt
25791 @item -m1
25792 @opindex m1
25793 Generate code for the SH1.
25794
25795 @item -m2
25796 @opindex m2
25797 Generate code for the SH2.
25798
25799 @item -m2e
25800 Generate code for the SH2e.
25801
25802 @item -m2a-nofpu
25803 @opindex m2a-nofpu
25804 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25805 that the floating-point unit is not used.
25806
25807 @item -m2a-single-only
25808 @opindex m2a-single-only
25809 Generate code for the SH2a-FPU, in such a way that no double-precision
25810 floating-point operations are used.
25811
25812 @item -m2a-single
25813 @opindex m2a-single
25814 Generate code for the SH2a-FPU assuming the floating-point unit is in
25815 single-precision mode by default.
25816
25817 @item -m2a
25818 @opindex m2a
25819 Generate code for the SH2a-FPU assuming the floating-point unit is in
25820 double-precision mode by default.
25821
25822 @item -m3
25823 @opindex m3
25824 Generate code for the SH3.
25825
25826 @item -m3e
25827 @opindex m3e
25828 Generate code for the SH3e.
25829
25830 @item -m4-nofpu
25831 @opindex m4-nofpu
25832 Generate code for the SH4 without a floating-point unit.
25833
25834 @item -m4-single-only
25835 @opindex m4-single-only
25836 Generate code for the SH4 with a floating-point unit that only
25837 supports single-precision arithmetic.
25838
25839 @item -m4-single
25840 @opindex m4-single
25841 Generate code for the SH4 assuming the floating-point unit is in
25842 single-precision mode by default.
25843
25844 @item -m4
25845 @opindex m4
25846 Generate code for the SH4.
25847
25848 @item -m4-100
25849 @opindex m4-100
25850 Generate code for SH4-100.
25851
25852 @item -m4-100-nofpu
25853 @opindex m4-100-nofpu
25854 Generate code for SH4-100 in such a way that the
25855 floating-point unit is not used.
25856
25857 @item -m4-100-single
25858 @opindex m4-100-single
25859 Generate code for SH4-100 assuming the floating-point unit is in
25860 single-precision mode by default.
25861
25862 @item -m4-100-single-only
25863 @opindex m4-100-single-only
25864 Generate code for SH4-100 in such a way that no double-precision
25865 floating-point operations are used.
25866
25867 @item -m4-200
25868 @opindex m4-200
25869 Generate code for SH4-200.
25870
25871 @item -m4-200-nofpu
25872 @opindex m4-200-nofpu
25873 Generate code for SH4-200 without in such a way that the
25874 floating-point unit is not used.
25875
25876 @item -m4-200-single
25877 @opindex m4-200-single
25878 Generate code for SH4-200 assuming the floating-point unit is in
25879 single-precision mode by default.
25880
25881 @item -m4-200-single-only
25882 @opindex m4-200-single-only
25883 Generate code for SH4-200 in such a way that no double-precision
25884 floating-point operations are used.
25885
25886 @item -m4-300
25887 @opindex m4-300
25888 Generate code for SH4-300.
25889
25890 @item -m4-300-nofpu
25891 @opindex m4-300-nofpu
25892 Generate code for SH4-300 without in such a way that the
25893 floating-point unit is not used.
25894
25895 @item -m4-300-single
25896 @opindex m4-300-single
25897 Generate code for SH4-300 in such a way that no double-precision
25898 floating-point operations are used.
25899
25900 @item -m4-300-single-only
25901 @opindex m4-300-single-only
25902 Generate code for SH4-300 in such a way that no double-precision
25903 floating-point operations are used.
25904
25905 @item -m4-340
25906 @opindex m4-340
25907 Generate code for SH4-340 (no MMU, no FPU).
25908
25909 @item -m4-500
25910 @opindex m4-500
25911 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25912 assembler.
25913
25914 @item -m4a-nofpu
25915 @opindex m4a-nofpu
25916 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25917 floating-point unit is not used.
25918
25919 @item -m4a-single-only
25920 @opindex m4a-single-only
25921 Generate code for the SH4a, in such a way that no double-precision
25922 floating-point operations are used.
25923
25924 @item -m4a-single
25925 @opindex m4a-single
25926 Generate code for the SH4a assuming the floating-point unit is in
25927 single-precision mode by default.
25928
25929 @item -m4a
25930 @opindex m4a
25931 Generate code for the SH4a.
25932
25933 @item -m4al
25934 @opindex m4al
25935 Same as @option{-m4a-nofpu}, except that it implicitly passes
25936 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25937 instructions at the moment.
25938
25939 @item -mb
25940 @opindex mb
25941 Compile code for the processor in big-endian mode.
25942
25943 @item -ml
25944 @opindex ml
25945 Compile code for the processor in little-endian mode.
25946
25947 @item -mdalign
25948 @opindex mdalign
25949 Align doubles at 64-bit boundaries. Note that this changes the calling
25950 conventions, and thus some functions from the standard C library do
25951 not work unless you recompile it first with @option{-mdalign}.
25952
25953 @item -mrelax
25954 @opindex mrelax
25955 Shorten some address references at link time, when possible; uses the
25956 linker option @option{-relax}.
25957
25958 @item -mbigtable
25959 @opindex mbigtable
25960 Use 32-bit offsets in @code{switch} tables. The default is to use
25961 16-bit offsets.
25962
25963 @item -mbitops
25964 @opindex mbitops
25965 Enable the use of bit manipulation instructions on SH2A.
25966
25967 @item -mfmovd
25968 @opindex mfmovd
25969 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25970 alignment constraints.
25971
25972 @item -mrenesas
25973 @opindex mrenesas
25974 Comply with the calling conventions defined by Renesas.
25975
25976 @item -mno-renesas
25977 @opindex mno-renesas
25978 Comply with the calling conventions defined for GCC before the Renesas
25979 conventions were available. This option is the default for all
25980 targets of the SH toolchain.
25981
25982 @item -mnomacsave
25983 @opindex mnomacsave
25984 Mark the @code{MAC} register as call-clobbered, even if
25985 @option{-mrenesas} is given.
25986
25987 @item -mieee
25988 @itemx -mno-ieee
25989 @opindex mieee
25990 @opindex mno-ieee
25991 Control the IEEE compliance of floating-point comparisons, which affects the
25992 handling of cases where the result of a comparison is unordered. By default
25993 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25994 enabled @option{-mno-ieee} is implicitly set, which results in faster
25995 floating-point greater-equal and less-equal comparisons. The implicit settings
25996 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25997
25998 @item -minline-ic_invalidate
25999 @opindex minline-ic_invalidate
26000 Inline code to invalidate instruction cache entries after setting up
26001 nested function trampolines.
26002 This option has no effect if @option{-musermode} is in effect and the selected
26003 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26004 instruction.
26005 If the selected code generation option does not allow the use of the @code{icbi}
26006 instruction, and @option{-musermode} is not in effect, the inlined code
26007 manipulates the instruction cache address array directly with an associative
26008 write. This not only requires privileged mode at run time, but it also
26009 fails if the cache line had been mapped via the TLB and has become unmapped.
26010
26011 @item -misize
26012 @opindex misize
26013 Dump instruction size and location in the assembly code.
26014
26015 @item -mpadstruct
26016 @opindex mpadstruct
26017 This option is deprecated. It pads structures to multiple of 4 bytes,
26018 which is incompatible with the SH ABI@.
26019
26020 @item -matomic-model=@var{model}
26021 @opindex matomic-model=@var{model}
26022 Sets the model of atomic operations and additional parameters as a comma
26023 separated list. For details on the atomic built-in functions see
26024 @ref{__atomic Builtins}. The following models and parameters are supported:
26025
26026 @table @samp
26027
26028 @item none
26029 Disable compiler generated atomic sequences and emit library calls for atomic
26030 operations. This is the default if the target is not @code{sh*-*-linux*}.
26031
26032 @item soft-gusa
26033 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26034 built-in functions. The generated atomic sequences require additional support
26035 from the interrupt/exception handling code of the system and are only suitable
26036 for SH3* and SH4* single-core systems. This option is enabled by default when
26037 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26038 this option also partially utilizes the hardware atomic instructions
26039 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26040 @samp{strict} is specified.
26041
26042 @item soft-tcb
26043 Generate software atomic sequences that use a variable in the thread control
26044 block. This is a variation of the gUSA sequences which can also be used on
26045 SH1* and SH2* targets. The generated atomic sequences require additional
26046 support from the interrupt/exception handling code of the system and are only
26047 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26048 parameter has to be specified as well.
26049
26050 @item soft-imask
26051 Generate software atomic sequences that temporarily disable interrupts by
26052 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26053 in privileged mode and is only suitable for single-core systems. Additional
26054 support from the interrupt/exception handling code of the system is not
26055 required. This model is enabled by default when the target is
26056 @code{sh*-*-linux*} and SH1* or SH2*.
26057
26058 @item hard-llcs
26059 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26060 instructions only. This is only available on SH4A and is suitable for
26061 multi-core systems. Since the hardware instructions support only 32 bit atomic
26062 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26063 Code compiled with this option is also compatible with other software
26064 atomic model interrupt/exception handling systems if executed on an SH4A
26065 system. Additional support from the interrupt/exception handling code of the
26066 system is not required for this model.
26067
26068 @item gbr-offset=
26069 This parameter specifies the offset in bytes of the variable in the thread
26070 control block structure that should be used by the generated atomic sequences
26071 when the @samp{soft-tcb} model has been selected. For other models this
26072 parameter is ignored. The specified value must be an integer multiple of four
26073 and in the range 0-1020.
26074
26075 @item strict
26076 This parameter prevents mixed usage of multiple atomic models, even if they
26077 are compatible, and makes the compiler generate atomic sequences of the
26078 specified model only.
26079
26080 @end table
26081
26082 @item -mtas
26083 @opindex mtas
26084 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26085 Notice that depending on the particular hardware and software configuration
26086 this can degrade overall performance due to the operand cache line flushes
26087 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26088 processors the @code{tas.b} instruction must be used with caution since it
26089 can result in data corruption for certain cache configurations.
26090
26091 @item -mprefergot
26092 @opindex mprefergot
26093 When generating position-independent code, emit function calls using
26094 the Global Offset Table instead of the Procedure Linkage Table.
26095
26096 @item -musermode
26097 @itemx -mno-usermode
26098 @opindex musermode
26099 @opindex mno-usermode
26100 Don't allow (allow) the compiler generating privileged mode code. Specifying
26101 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26102 inlined code would not work in user mode. @option{-musermode} is the default
26103 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26104 @option{-musermode} has no effect, since there is no user mode.
26105
26106 @item -multcost=@var{number}
26107 @opindex multcost=@var{number}
26108 Set the cost to assume for a multiply insn.
26109
26110 @item -mdiv=@var{strategy}
26111 @opindex mdiv=@var{strategy}
26112 Set the division strategy to be used for integer division operations.
26113 @var{strategy} can be one of:
26114
26115 @table @samp
26116
26117 @item call-div1
26118 Calls a library function that uses the single-step division instruction
26119 @code{div1} to perform the operation. Division by zero calculates an
26120 unspecified result and does not trap. This is the default except for SH4,
26121 SH2A and SHcompact.
26122
26123 @item call-fp
26124 Calls a library function that performs the operation in double precision
26125 floating point. Division by zero causes a floating-point exception. This is
26126 the default for SHcompact with FPU. Specifying this for targets that do not
26127 have a double precision FPU defaults to @code{call-div1}.
26128
26129 @item call-table
26130 Calls a library function that uses a lookup table for small divisors and
26131 the @code{div1} instruction with case distinction for larger divisors. Division
26132 by zero calculates an unspecified result and does not trap. This is the default
26133 for SH4. Specifying this for targets that do not have dynamic shift
26134 instructions defaults to @code{call-div1}.
26135
26136 @end table
26137
26138 When a division strategy has not been specified the default strategy is
26139 selected based on the current target. For SH2A the default strategy is to
26140 use the @code{divs} and @code{divu} instructions instead of library function
26141 calls.
26142
26143 @item -maccumulate-outgoing-args
26144 @opindex maccumulate-outgoing-args
26145 Reserve space once for outgoing arguments in the function prologue rather
26146 than around each call. Generally beneficial for performance and size. Also
26147 needed for unwinding to avoid changing the stack frame around conditional code.
26148
26149 @item -mdivsi3_libfunc=@var{name}
26150 @opindex mdivsi3_libfunc=@var{name}
26151 Set the name of the library function used for 32-bit signed division to
26152 @var{name}.
26153 This only affects the name used in the @samp{call} division strategies, and
26154 the compiler still expects the same sets of input/output/clobbered registers as
26155 if this option were not present.
26156
26157 @item -mfixed-range=@var{register-range}
26158 @opindex mfixed-range
26159 Generate code treating the given register range as fixed registers.
26160 A fixed register is one that the register allocator can not use. This is
26161 useful when compiling kernel code. A register range is specified as
26162 two registers separated by a dash. Multiple register ranges can be
26163 specified separated by a comma.
26164
26165 @item -mbranch-cost=@var{num}
26166 @opindex mbranch-cost=@var{num}
26167 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26168 make the compiler try to generate more branch-free code if possible.
26169 If not specified the value is selected depending on the processor type that
26170 is being compiled for.
26171
26172 @item -mzdcbranch
26173 @itemx -mno-zdcbranch
26174 @opindex mzdcbranch
26175 @opindex mno-zdcbranch
26176 Assume (do not assume) that zero displacement conditional branch instructions
26177 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26178 compiler prefers zero displacement branch code sequences. This is
26179 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26180 disabled by specifying @option{-mno-zdcbranch}.
26181
26182 @item -mcbranch-force-delay-slot
26183 @opindex mcbranch-force-delay-slot
26184 Force the usage of delay slots for conditional branches, which stuffs the delay
26185 slot with a @code{nop} if a suitable instruction cannot be found. By default
26186 this option is disabled. It can be enabled to work around hardware bugs as
26187 found in the original SH7055.
26188
26189 @item -mfused-madd
26190 @itemx -mno-fused-madd
26191 @opindex mfused-madd
26192 @opindex mno-fused-madd
26193 Generate code that uses (does not use) the floating-point multiply and
26194 accumulate instructions. These instructions are generated by default
26195 if hardware floating point is used. The machine-dependent
26196 @option{-mfused-madd} option is now mapped to the machine-independent
26197 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26198 mapped to @option{-ffp-contract=off}.
26199
26200 @item -mfsca
26201 @itemx -mno-fsca
26202 @opindex mfsca
26203 @opindex mno-fsca
26204 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26205 and cosine approximations. The option @option{-mfsca} must be used in
26206 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26207 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26208 approximations even if @option{-funsafe-math-optimizations} is in effect.
26209
26210 @item -mfsrra
26211 @itemx -mno-fsrra
26212 @opindex mfsrra
26213 @opindex mno-fsrra
26214 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26215 reciprocal square root approximations. The option @option{-mfsrra} must be used
26216 in combination with @option{-funsafe-math-optimizations} and
26217 @option{-ffinite-math-only}. It is enabled by default when generating code for
26218 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26219 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26220 in effect.
26221
26222 @item -mpretend-cmove
26223 @opindex mpretend-cmove
26224 Prefer zero-displacement conditional branches for conditional move instruction
26225 patterns. This can result in faster code on the SH4 processor.
26226
26227 @item -mfdpic
26228 @opindex fdpic
26229 Generate code using the FDPIC ABI.
26230
26231 @end table
26232
26233 @node Solaris 2 Options
26234 @subsection Solaris 2 Options
26235 @cindex Solaris 2 options
26236
26237 These @samp{-m} options are supported on Solaris 2:
26238
26239 @table @gcctabopt
26240 @item -mclear-hwcap
26241 @opindex mclear-hwcap
26242 @option{-mclear-hwcap} tells the compiler to remove the hardware
26243 capabilities generated by the Solaris assembler. This is only necessary
26244 when object files use ISA extensions not supported by the current
26245 machine, but check at runtime whether or not to use them.
26246
26247 @item -mimpure-text
26248 @opindex mimpure-text
26249 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26250 the compiler to not pass @option{-z text} to the linker when linking a
26251 shared object. Using this option, you can link position-dependent
26252 code into a shared object.
26253
26254 @option{-mimpure-text} suppresses the ``relocations remain against
26255 allocatable but non-writable sections'' linker error message.
26256 However, the necessary relocations trigger copy-on-write, and the
26257 shared object is not actually shared across processes. Instead of
26258 using @option{-mimpure-text}, you should compile all source code with
26259 @option{-fpic} or @option{-fPIC}.
26260
26261 @end table
26262
26263 These switches are supported in addition to the above on Solaris 2:
26264
26265 @table @gcctabopt
26266 @item -pthreads
26267 @opindex pthreads
26268 This is a synonym for @option{-pthread}.
26269 @end table
26270
26271 @node SPARC Options
26272 @subsection SPARC Options
26273 @cindex SPARC options
26274
26275 These @samp{-m} options are supported on the SPARC:
26276
26277 @table @gcctabopt
26278 @item -mno-app-regs
26279 @itemx -mapp-regs
26280 @opindex mno-app-regs
26281 @opindex mapp-regs
26282 Specify @option{-mapp-regs} to generate output using the global registers
26283 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26284 global register 1, each global register 2 through 4 is then treated as an
26285 allocable register that is clobbered by function calls. This is the default.
26286
26287 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26288 specify @option{-mno-app-regs}. You should compile libraries and system
26289 software with this option.
26290
26291 @item -mflat
26292 @itemx -mno-flat
26293 @opindex mflat
26294 @opindex mno-flat
26295 With @option{-mflat}, the compiler does not generate save/restore instructions
26296 and uses a ``flat'' or single register window model. This model is compatible
26297 with the regular register window model. The local registers and the input
26298 registers (0--5) are still treated as ``call-saved'' registers and are
26299 saved on the stack as needed.
26300
26301 With @option{-mno-flat} (the default), the compiler generates save/restore
26302 instructions (except for leaf functions). This is the normal operating mode.
26303
26304 @item -mfpu
26305 @itemx -mhard-float
26306 @opindex mfpu
26307 @opindex mhard-float
26308 Generate output containing floating-point instructions. This is the
26309 default.
26310
26311 @item -mno-fpu
26312 @itemx -msoft-float
26313 @opindex mno-fpu
26314 @opindex msoft-float
26315 Generate output containing library calls for floating point.
26316 @strong{Warning:} the requisite libraries are not available for all SPARC
26317 targets. Normally the facilities of the machine's usual C compiler are
26318 used, but this cannot be done directly in cross-compilation. You must make
26319 your own arrangements to provide suitable library functions for
26320 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26321 @samp{sparclite-*-*} do provide software floating-point support.
26322
26323 @option{-msoft-float} changes the calling convention in the output file;
26324 therefore, it is only useful if you compile @emph{all} of a program with
26325 this option. In particular, you need to compile @file{libgcc.a}, the
26326 library that comes with GCC, with @option{-msoft-float} in order for
26327 this to work.
26328
26329 @item -mhard-quad-float
26330 @opindex mhard-quad-float
26331 Generate output containing quad-word (long double) floating-point
26332 instructions.
26333
26334 @item -msoft-quad-float
26335 @opindex msoft-quad-float
26336 Generate output containing library calls for quad-word (long double)
26337 floating-point instructions. The functions called are those specified
26338 in the SPARC ABI@. This is the default.
26339
26340 As of this writing, there are no SPARC implementations that have hardware
26341 support for the quad-word floating-point instructions. They all invoke
26342 a trap handler for one of these instructions, and then the trap handler
26343 emulates the effect of the instruction. Because of the trap handler overhead,
26344 this is much slower than calling the ABI library routines. Thus the
26345 @option{-msoft-quad-float} option is the default.
26346
26347 @item -mno-unaligned-doubles
26348 @itemx -munaligned-doubles
26349 @opindex mno-unaligned-doubles
26350 @opindex munaligned-doubles
26351 Assume that doubles have 8-byte alignment. This is the default.
26352
26353 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26354 alignment only if they are contained in another type, or if they have an
26355 absolute address. Otherwise, it assumes they have 4-byte alignment.
26356 Specifying this option avoids some rare compatibility problems with code
26357 generated by other compilers. It is not the default because it results
26358 in a performance loss, especially for floating-point code.
26359
26360 @item -muser-mode
26361 @itemx -mno-user-mode
26362 @opindex muser-mode
26363 @opindex mno-user-mode
26364 Do not generate code that can only run in supervisor mode. This is relevant
26365 only for the @code{casa} instruction emitted for the LEON3 processor. This
26366 is the default.
26367
26368 @item -mfaster-structs
26369 @itemx -mno-faster-structs
26370 @opindex mfaster-structs
26371 @opindex mno-faster-structs
26372 With @option{-mfaster-structs}, the compiler assumes that structures
26373 should have 8-byte alignment. This enables the use of pairs of
26374 @code{ldd} and @code{std} instructions for copies in structure
26375 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26376 However, the use of this changed alignment directly violates the SPARC
26377 ABI@. Thus, it's intended only for use on targets where the developer
26378 acknowledges that their resulting code is not directly in line with
26379 the rules of the ABI@.
26380
26381 @item -mstd-struct-return
26382 @itemx -mno-std-struct-return
26383 @opindex mstd-struct-return
26384 @opindex mno-std-struct-return
26385 With @option{-mstd-struct-return}, the compiler generates checking code
26386 in functions returning structures or unions to detect size mismatches
26387 between the two sides of function calls, as per the 32-bit ABI@.
26388
26389 The default is @option{-mno-std-struct-return}. This option has no effect
26390 in 64-bit mode.
26391
26392 @item -mlra
26393 @itemx -mno-lra
26394 @opindex mlra
26395 @opindex mno-lra
26396 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26397 so @option{-mno-lra} needs to be passed to get old Reload.
26398
26399 @item -mcpu=@var{cpu_type}
26400 @opindex mcpu
26401 Set the instruction set, register set, and instruction scheduling parameters
26402 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26403 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26404 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26405 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26406 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26407 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26408
26409 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26410 which selects the best architecture option for the host processor.
26411 @option{-mcpu=native} has no effect if GCC does not recognize
26412 the processor.
26413
26414 Default instruction scheduling parameters are used for values that select
26415 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26416 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26417
26418 Here is a list of each supported architecture and their supported
26419 implementations.
26420
26421 @table @asis
26422 @item v7
26423 cypress, leon3v7
26424
26425 @item v8
26426 supersparc, hypersparc, leon, leon3
26427
26428 @item sparclite
26429 f930, f934, sparclite86x
26430
26431 @item sparclet
26432 tsc701
26433
26434 @item v9
26435 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26436 niagara7, m8
26437 @end table
26438
26439 By default (unless configured otherwise), GCC generates code for the V7
26440 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26441 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26442 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26443 SPARCStation 1, 2, IPX etc.
26444
26445 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26446 architecture. The only difference from V7 code is that the compiler emits
26447 the integer multiply and integer divide instructions which exist in SPARC-V8
26448 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26449 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26450 2000 series.
26451
26452 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26453 the SPARC architecture. This adds the integer multiply, integer divide step
26454 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26455 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26456 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26457 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26458 MB86934 chip, which is the more recent SPARClite with FPU@.
26459
26460 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26461 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26462 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26463 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26464 optimizes it for the TEMIC SPARClet chip.
26465
26466 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26467 architecture. This adds 64-bit integer and floating-point move instructions,
26468 3 additional floating-point condition code registers and conditional move
26469 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26470 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26471 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26472 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26473 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26474 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26475 additionally optimizes it for Sun UltraSPARC T2 chips. With
26476 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26477 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26478 additionally optimizes it for Sun UltraSPARC T4 chips. With
26479 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26480 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26481 additionally optimizes it for Oracle M8 chips.
26482
26483 @item -mtune=@var{cpu_type}
26484 @opindex mtune
26485 Set the instruction scheduling parameters for machine type
26486 @var{cpu_type}, but do not set the instruction set or register set that the
26487 option @option{-mcpu=@var{cpu_type}} does.
26488
26489 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26490 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26491 that select a particular CPU implementation. Those are
26492 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26493 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26494 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26495 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26496 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26497 and GNU/Linux toolchains, @samp{native} can also be used.
26498
26499 @item -mv8plus
26500 @itemx -mno-v8plus
26501 @opindex mv8plus
26502 @opindex mno-v8plus
26503 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26504 difference from the V8 ABI is that the global and out registers are
26505 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26506 mode for all SPARC-V9 processors.
26507
26508 @item -mvis
26509 @itemx -mno-vis
26510 @opindex mvis
26511 @opindex mno-vis
26512 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26513 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26514
26515 @item -mvis2
26516 @itemx -mno-vis2
26517 @opindex mvis2
26518 @opindex mno-vis2
26519 With @option{-mvis2}, GCC generates code that takes advantage of
26520 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26521 default is @option{-mvis2} when targeting a cpu that supports such
26522 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26523 also sets @option{-mvis}.
26524
26525 @item -mvis3
26526 @itemx -mno-vis3
26527 @opindex mvis3
26528 @opindex mno-vis3
26529 With @option{-mvis3}, GCC generates code that takes advantage of
26530 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26531 default is @option{-mvis3} when targeting a cpu that supports such
26532 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26533 also sets @option{-mvis2} and @option{-mvis}.
26534
26535 @item -mvis4
26536 @itemx -mno-vis4
26537 @opindex mvis4
26538 @opindex mno-vis4
26539 With @option{-mvis4}, GCC generates code that takes advantage of
26540 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26541 default is @option{-mvis4} when targeting a cpu that supports such
26542 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26543 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26544
26545 @item -mvis4b
26546 @itemx -mno-vis4b
26547 @opindex mvis4b
26548 @opindex mno-vis4b
26549 With @option{-mvis4b}, GCC generates code that takes advantage of
26550 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26551 the additional VIS instructions introduced in the Oracle SPARC
26552 Architecture 2017. The default is @option{-mvis4b} when targeting a
26553 cpu that supports such instructions, such as m8 and later. Setting
26554 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26555 @option{-mvis2} and @option{-mvis}.
26556
26557 @item -mcbcond
26558 @itemx -mno-cbcond
26559 @opindex mcbcond
26560 @opindex mno-cbcond
26561 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26562 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26563 when targeting a CPU that supports such instructions, such as Niagara-4 and
26564 later.
26565
26566 @item -mfmaf
26567 @itemx -mno-fmaf
26568 @opindex mfmaf
26569 @opindex mno-fmaf
26570 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26571 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26572 when targeting a CPU that supports such instructions, such as Niagara-3 and
26573 later.
26574
26575 @item -mfsmuld
26576 @itemx -mno-fsmuld
26577 @opindex mfsmuld
26578 @opindex mno-fsmuld
26579 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26580 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26581 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26582 or V9 with FPU except @option{-mcpu=leon}.
26583
26584 @item -mpopc
26585 @itemx -mno-popc
26586 @opindex mpopc
26587 @opindex mno-popc
26588 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26589 Population Count instruction. The default is @option{-mpopc}
26590 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26591 later.
26592
26593 @item -msubxc
26594 @itemx -mno-subxc
26595 @opindex msubxc
26596 @opindex mno-subxc
26597 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26598 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26599 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26600 later.
26601
26602 @item -mfix-at697f
26603 @opindex mfix-at697f
26604 Enable the documented workaround for the single erratum of the Atmel AT697F
26605 processor (which corresponds to erratum #13 of the AT697E processor).
26606
26607 @item -mfix-ut699
26608 @opindex mfix-ut699
26609 Enable the documented workarounds for the floating-point errata and the data
26610 cache nullify errata of the UT699 processor.
26611
26612 @item -mfix-ut700
26613 @opindex mfix-ut700
26614 Enable the documented workaround for the back-to-back store errata of
26615 the UT699E/UT700 processor.
26616
26617 @item -mfix-gr712rc
26618 @opindex mfix-gr712rc
26619 Enable the documented workaround for the back-to-back store errata of
26620 the GR712RC processor.
26621 @end table
26622
26623 These @samp{-m} options are supported in addition to the above
26624 on SPARC-V9 processors in 64-bit environments:
26625
26626 @table @gcctabopt
26627 @item -m32
26628 @itemx -m64
26629 @opindex m32
26630 @opindex m64
26631 Generate code for a 32-bit or 64-bit environment.
26632 The 32-bit environment sets int, long and pointer to 32 bits.
26633 The 64-bit environment sets int to 32 bits and long and pointer
26634 to 64 bits.
26635
26636 @item -mcmodel=@var{which}
26637 @opindex mcmodel
26638 Set the code model to one of
26639
26640 @table @samp
26641 @item medlow
26642 The Medium/Low code model: 64-bit addresses, programs
26643 must be linked in the low 32 bits of memory. Programs can be statically
26644 or dynamically linked.
26645
26646 @item medmid
26647 The Medium/Middle code model: 64-bit addresses, programs
26648 must be linked in the low 44 bits of memory, the text and data segments must
26649 be less than 2GB in size and the data segment must be located within 2GB of
26650 the text segment.
26651
26652 @item medany
26653 The Medium/Anywhere code model: 64-bit addresses, programs
26654 may be linked anywhere in memory, the text and data segments must be less
26655 than 2GB in size and the data segment must be located within 2GB of the
26656 text segment.
26657
26658 @item embmedany
26659 The Medium/Anywhere code model for embedded systems:
26660 64-bit addresses, the text and data segments must be less than 2GB in
26661 size, both starting anywhere in memory (determined at link time). The
26662 global register %g4 points to the base of the data segment. Programs
26663 are statically linked and PIC is not supported.
26664 @end table
26665
26666 @item -mmemory-model=@var{mem-model}
26667 @opindex mmemory-model
26668 Set the memory model in force on the processor to one of
26669
26670 @table @samp
26671 @item default
26672 The default memory model for the processor and operating system.
26673
26674 @item rmo
26675 Relaxed Memory Order
26676
26677 @item pso
26678 Partial Store Order
26679
26680 @item tso
26681 Total Store Order
26682
26683 @item sc
26684 Sequential Consistency
26685 @end table
26686
26687 These memory models are formally defined in Appendix D of the SPARC-V9
26688 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26689
26690 @item -mstack-bias
26691 @itemx -mno-stack-bias
26692 @opindex mstack-bias
26693 @opindex mno-stack-bias
26694 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26695 frame pointer if present, are offset by @minus{}2047 which must be added back
26696 when making stack frame references. This is the default in 64-bit mode.
26697 Otherwise, assume no such offset is present.
26698 @end table
26699
26700 @node SPU Options
26701 @subsection SPU Options
26702 @cindex SPU options
26703
26704 These @samp{-m} options are supported on the SPU:
26705
26706 @table @gcctabopt
26707 @item -mwarn-reloc
26708 @itemx -merror-reloc
26709 @opindex mwarn-reloc
26710 @opindex merror-reloc
26711
26712 The loader for SPU does not handle dynamic relocations. By default, GCC
26713 gives an error when it generates code that requires a dynamic
26714 relocation. @option{-mno-error-reloc} disables the error,
26715 @option{-mwarn-reloc} generates a warning instead.
26716
26717 @item -msafe-dma
26718 @itemx -munsafe-dma
26719 @opindex msafe-dma
26720 @opindex munsafe-dma
26721
26722 Instructions that initiate or test completion of DMA must not be
26723 reordered with respect to loads and stores of the memory that is being
26724 accessed.
26725 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26726 memory accesses, but that can lead to inefficient code in places where the
26727 memory is known to not change. Rather than mark the memory as volatile,
26728 you can use @option{-msafe-dma} to tell the compiler to treat
26729 the DMA instructions as potentially affecting all memory.
26730
26731 @item -mbranch-hints
26732 @opindex mbranch-hints
26733
26734 By default, GCC generates a branch hint instruction to avoid
26735 pipeline stalls for always-taken or probably-taken branches. A hint
26736 is not generated closer than 8 instructions away from its branch.
26737 There is little reason to disable them, except for debugging purposes,
26738 or to make an object a little bit smaller.
26739
26740 @item -msmall-mem
26741 @itemx -mlarge-mem
26742 @opindex msmall-mem
26743 @opindex mlarge-mem
26744
26745 By default, GCC generates code assuming that addresses are never larger
26746 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26747 a full 32-bit address.
26748
26749 @item -mstdmain
26750 @opindex mstdmain
26751
26752 By default, GCC links against startup code that assumes the SPU-style
26753 main function interface (which has an unconventional parameter list).
26754 With @option{-mstdmain}, GCC links your program against startup
26755 code that assumes a C99-style interface to @code{main}, including a
26756 local copy of @code{argv} strings.
26757
26758 @item -mfixed-range=@var{register-range}
26759 @opindex mfixed-range
26760 Generate code treating the given register range as fixed registers.
26761 A fixed register is one that the register allocator cannot use. This is
26762 useful when compiling kernel code. A register range is specified as
26763 two registers separated by a dash. Multiple register ranges can be
26764 specified separated by a comma.
26765
26766 @item -mea32
26767 @itemx -mea64
26768 @opindex mea32
26769 @opindex mea64
26770 Compile code assuming that pointers to the PPU address space accessed
26771 via the @code{__ea} named address space qualifier are either 32 or 64
26772 bits wide. The default is 32 bits. As this is an ABI-changing option,
26773 all object code in an executable must be compiled with the same setting.
26774
26775 @item -maddress-space-conversion
26776 @itemx -mno-address-space-conversion
26777 @opindex maddress-space-conversion
26778 @opindex mno-address-space-conversion
26779 Allow/disallow treating the @code{__ea} address space as superset
26780 of the generic address space. This enables explicit type casts
26781 between @code{__ea} and generic pointer as well as implicit
26782 conversions of generic pointers to @code{__ea} pointers. The
26783 default is to allow address space pointer conversions.
26784
26785 @item -mcache-size=@var{cache-size}
26786 @opindex mcache-size
26787 This option controls the version of libgcc that the compiler links to an
26788 executable and selects a software-managed cache for accessing variables
26789 in the @code{__ea} address space with a particular cache size. Possible
26790 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26791 and @samp{128}. The default cache size is 64KB.
26792
26793 @item -matomic-updates
26794 @itemx -mno-atomic-updates
26795 @opindex matomic-updates
26796 @opindex mno-atomic-updates
26797 This option controls the version of libgcc that the compiler links to an
26798 executable and selects whether atomic updates to the software-managed
26799 cache of PPU-side variables are used. If you use atomic updates, changes
26800 to a PPU variable from SPU code using the @code{__ea} named address space
26801 qualifier do not interfere with changes to other PPU variables residing
26802 in the same cache line from PPU code. If you do not use atomic updates,
26803 such interference may occur; however, writing back cache lines is
26804 more efficient. The default behavior is to use atomic updates.
26805
26806 @item -mdual-nops
26807 @itemx -mdual-nops=@var{n}
26808 @opindex mdual-nops
26809 By default, GCC inserts NOPs to increase dual issue when it expects
26810 it to increase performance. @var{n} can be a value from 0 to 10. A
26811 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26812 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26813
26814 @item -mhint-max-nops=@var{n}
26815 @opindex mhint-max-nops
26816 Maximum number of NOPs to insert for a branch hint. A branch hint must
26817 be at least 8 instructions away from the branch it is affecting. GCC
26818 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26819 generate the branch hint.
26820
26821 @item -mhint-max-distance=@var{n}
26822 @opindex mhint-max-distance
26823 The encoding of the branch hint instruction limits the hint to be within
26824 256 instructions of the branch it is affecting. By default, GCC makes
26825 sure it is within 125.
26826
26827 @item -msafe-hints
26828 @opindex msafe-hints
26829 Work around a hardware bug that causes the SPU to stall indefinitely.
26830 By default, GCC inserts the @code{hbrp} instruction to make sure
26831 this stall won't happen.
26832
26833 @end table
26834
26835 @node System V Options
26836 @subsection Options for System V
26837
26838 These additional options are available on System V Release 4 for
26839 compatibility with other compilers on those systems:
26840
26841 @table @gcctabopt
26842 @item -G
26843 @opindex G
26844 Create a shared object.
26845 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26846
26847 @item -Qy
26848 @opindex Qy
26849 Identify the versions of each tool used by the compiler, in a
26850 @code{.ident} assembler directive in the output.
26851
26852 @item -Qn
26853 @opindex Qn
26854 Refrain from adding @code{.ident} directives to the output file (this is
26855 the default).
26856
26857 @item -YP,@var{dirs}
26858 @opindex YP
26859 Search the directories @var{dirs}, and no others, for libraries
26860 specified with @option{-l}.
26861
26862 @item -Ym,@var{dir}
26863 @opindex Ym
26864 Look in the directory @var{dir} to find the M4 preprocessor.
26865 The assembler uses this option.
26866 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26867 @c the generic assembler that comes with Solaris takes just -Ym.
26868 @end table
26869
26870 @node TILE-Gx Options
26871 @subsection TILE-Gx Options
26872 @cindex TILE-Gx options
26873
26874 These @samp{-m} options are supported on the TILE-Gx:
26875
26876 @table @gcctabopt
26877 @item -mcmodel=small
26878 @opindex mcmodel=small
26879 Generate code for the small model. The distance for direct calls is
26880 limited to 500M in either direction. PC-relative addresses are 32
26881 bits. Absolute addresses support the full address range.
26882
26883 @item -mcmodel=large
26884 @opindex mcmodel=large
26885 Generate code for the large model. There is no limitation on call
26886 distance, pc-relative addresses, or absolute addresses.
26887
26888 @item -mcpu=@var{name}
26889 @opindex mcpu
26890 Selects the type of CPU to be targeted. Currently the only supported
26891 type is @samp{tilegx}.
26892
26893 @item -m32
26894 @itemx -m64
26895 @opindex m32
26896 @opindex m64
26897 Generate code for a 32-bit or 64-bit environment. The 32-bit
26898 environment sets int, long, and pointer to 32 bits. The 64-bit
26899 environment sets int to 32 bits and long and pointer to 64 bits.
26900
26901 @item -mbig-endian
26902 @itemx -mlittle-endian
26903 @opindex mbig-endian
26904 @opindex mlittle-endian
26905 Generate code in big/little endian mode, respectively.
26906 @end table
26907
26908 @node TILEPro Options
26909 @subsection TILEPro Options
26910 @cindex TILEPro options
26911
26912 These @samp{-m} options are supported on the TILEPro:
26913
26914 @table @gcctabopt
26915 @item -mcpu=@var{name}
26916 @opindex mcpu
26917 Selects the type of CPU to be targeted. Currently the only supported
26918 type is @samp{tilepro}.
26919
26920 @item -m32
26921 @opindex m32
26922 Generate code for a 32-bit environment, which sets int, long, and
26923 pointer to 32 bits. This is the only supported behavior so the flag
26924 is essentially ignored.
26925 @end table
26926
26927 @node V850 Options
26928 @subsection V850 Options
26929 @cindex V850 Options
26930
26931 These @samp{-m} options are defined for V850 implementations:
26932
26933 @table @gcctabopt
26934 @item -mlong-calls
26935 @itemx -mno-long-calls
26936 @opindex mlong-calls
26937 @opindex mno-long-calls
26938 Treat all calls as being far away (near). If calls are assumed to be
26939 far away, the compiler always loads the function's address into a
26940 register, and calls indirect through the pointer.
26941
26942 @item -mno-ep
26943 @itemx -mep
26944 @opindex mno-ep
26945 @opindex mep
26946 Do not optimize (do optimize) basic blocks that use the same index
26947 pointer 4 or more times to copy pointer into the @code{ep} register, and
26948 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26949 option is on by default if you optimize.
26950
26951 @item -mno-prolog-function
26952 @itemx -mprolog-function
26953 @opindex mno-prolog-function
26954 @opindex mprolog-function
26955 Do not use (do use) external functions to save and restore registers
26956 at the prologue and epilogue of a function. The external functions
26957 are slower, but use less code space if more than one function saves
26958 the same number of registers. The @option{-mprolog-function} option
26959 is on by default if you optimize.
26960
26961 @item -mspace
26962 @opindex mspace
26963 Try to make the code as small as possible. At present, this just turns
26964 on the @option{-mep} and @option{-mprolog-function} options.
26965
26966 @item -mtda=@var{n}
26967 @opindex mtda
26968 Put static or global variables whose size is @var{n} bytes or less into
26969 the tiny data area that register @code{ep} points to. The tiny data
26970 area can hold up to 256 bytes in total (128 bytes for byte references).
26971
26972 @item -msda=@var{n}
26973 @opindex msda
26974 Put static or global variables whose size is @var{n} bytes or less into
26975 the small data area that register @code{gp} points to. The small data
26976 area can hold up to 64 kilobytes.
26977
26978 @item -mzda=@var{n}
26979 @opindex mzda
26980 Put static or global variables whose size is @var{n} bytes or less into
26981 the first 32 kilobytes of memory.
26982
26983 @item -mv850
26984 @opindex mv850
26985 Specify that the target processor is the V850.
26986
26987 @item -mv850e3v5
26988 @opindex mv850e3v5
26989 Specify that the target processor is the V850E3V5. The preprocessor
26990 constant @code{__v850e3v5__} is defined if this option is used.
26991
26992 @item -mv850e2v4
26993 @opindex mv850e2v4
26994 Specify that the target processor is the V850E3V5. This is an alias for
26995 the @option{-mv850e3v5} option.
26996
26997 @item -mv850e2v3
26998 @opindex mv850e2v3
26999 Specify that the target processor is the V850E2V3. The preprocessor
27000 constant @code{__v850e2v3__} is defined if this option is used.
27001
27002 @item -mv850e2
27003 @opindex mv850e2
27004 Specify that the target processor is the V850E2. The preprocessor
27005 constant @code{__v850e2__} is defined if this option is used.
27006
27007 @item -mv850e1
27008 @opindex mv850e1
27009 Specify that the target processor is the V850E1. The preprocessor
27010 constants @code{__v850e1__} and @code{__v850e__} are defined if
27011 this option is used.
27012
27013 @item -mv850es
27014 @opindex mv850es
27015 Specify that the target processor is the V850ES. This is an alias for
27016 the @option{-mv850e1} option.
27017
27018 @item -mv850e
27019 @opindex mv850e
27020 Specify that the target processor is the V850E@. The preprocessor
27021 constant @code{__v850e__} is defined if this option is used.
27022
27023 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27024 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27025 are defined then a default target processor is chosen and the
27026 relevant @samp{__v850*__} preprocessor constant is defined.
27027
27028 The preprocessor constants @code{__v850} and @code{__v851__} are always
27029 defined, regardless of which processor variant is the target.
27030
27031 @item -mdisable-callt
27032 @itemx -mno-disable-callt
27033 @opindex mdisable-callt
27034 @opindex mno-disable-callt
27035 This option suppresses generation of the @code{CALLT} instruction for the
27036 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27037 architecture.
27038
27039 This option is enabled by default when the RH850 ABI is
27040 in use (see @option{-mrh850-abi}), and disabled by default when the
27041 GCC ABI is in use. If @code{CALLT} instructions are being generated
27042 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27043
27044 @item -mrelax
27045 @itemx -mno-relax
27046 @opindex mrelax
27047 @opindex mno-relax
27048 Pass on (or do not pass on) the @option{-mrelax} command-line option
27049 to the assembler.
27050
27051 @item -mlong-jumps
27052 @itemx -mno-long-jumps
27053 @opindex mlong-jumps
27054 @opindex mno-long-jumps
27055 Disable (or re-enable) the generation of PC-relative jump instructions.
27056
27057 @item -msoft-float
27058 @itemx -mhard-float
27059 @opindex msoft-float
27060 @opindex mhard-float
27061 Disable (or re-enable) the generation of hardware floating point
27062 instructions. This option is only significant when the target
27063 architecture is @samp{V850E2V3} or higher. If hardware floating point
27064 instructions are being generated then the C preprocessor symbol
27065 @code{__FPU_OK__} is defined, otherwise the symbol
27066 @code{__NO_FPU__} is defined.
27067
27068 @item -mloop
27069 @opindex mloop
27070 Enables the use of the e3v5 LOOP instruction. The use of this
27071 instruction is not enabled by default when the e3v5 architecture is
27072 selected because its use is still experimental.
27073
27074 @item -mrh850-abi
27075 @itemx -mghs
27076 @opindex mrh850-abi
27077 @opindex mghs
27078 Enables support for the RH850 version of the V850 ABI. This is the
27079 default. With this version of the ABI the following rules apply:
27080
27081 @itemize
27082 @item
27083 Integer sized structures and unions are returned via a memory pointer
27084 rather than a register.
27085
27086 @item
27087 Large structures and unions (more than 8 bytes in size) are passed by
27088 value.
27089
27090 @item
27091 Functions are aligned to 16-bit boundaries.
27092
27093 @item
27094 The @option{-m8byte-align} command-line option is supported.
27095
27096 @item
27097 The @option{-mdisable-callt} command-line option is enabled by
27098 default. The @option{-mno-disable-callt} command-line option is not
27099 supported.
27100 @end itemize
27101
27102 When this version of the ABI is enabled the C preprocessor symbol
27103 @code{__V850_RH850_ABI__} is defined.
27104
27105 @item -mgcc-abi
27106 @opindex mgcc-abi
27107 Enables support for the old GCC version of the V850 ABI. With this
27108 version of the ABI the following rules apply:
27109
27110 @itemize
27111 @item
27112 Integer sized structures and unions are returned in register @code{r10}.
27113
27114 @item
27115 Large structures and unions (more than 8 bytes in size) are passed by
27116 reference.
27117
27118 @item
27119 Functions are aligned to 32-bit boundaries, unless optimizing for
27120 size.
27121
27122 @item
27123 The @option{-m8byte-align} command-line option is not supported.
27124
27125 @item
27126 The @option{-mdisable-callt} command-line option is supported but not
27127 enabled by default.
27128 @end itemize
27129
27130 When this version of the ABI is enabled the C preprocessor symbol
27131 @code{__V850_GCC_ABI__} is defined.
27132
27133 @item -m8byte-align
27134 @itemx -mno-8byte-align
27135 @opindex m8byte-align
27136 @opindex mno-8byte-align
27137 Enables support for @code{double} and @code{long long} types to be
27138 aligned on 8-byte boundaries. The default is to restrict the
27139 alignment of all objects to at most 4-bytes. When
27140 @option{-m8byte-align} is in effect the C preprocessor symbol
27141 @code{__V850_8BYTE_ALIGN__} is defined.
27142
27143 @item -mbig-switch
27144 @opindex mbig-switch
27145 Generate code suitable for big switch tables. Use this option only if
27146 the assembler/linker complain about out of range branches within a switch
27147 table.
27148
27149 @item -mapp-regs
27150 @opindex mapp-regs
27151 This option causes r2 and r5 to be used in the code generated by
27152 the compiler. This setting is the default.
27153
27154 @item -mno-app-regs
27155 @opindex mno-app-regs
27156 This option causes r2 and r5 to be treated as fixed registers.
27157
27158 @end table
27159
27160 @node VAX Options
27161 @subsection VAX Options
27162 @cindex VAX options
27163
27164 These @samp{-m} options are defined for the VAX:
27165
27166 @table @gcctabopt
27167 @item -munix
27168 @opindex munix
27169 Do not output certain jump instructions (@code{aobleq} and so on)
27170 that the Unix assembler for the VAX cannot handle across long
27171 ranges.
27172
27173 @item -mgnu
27174 @opindex mgnu
27175 Do output those jump instructions, on the assumption that the
27176 GNU assembler is being used.
27177
27178 @item -mg
27179 @opindex mg
27180 Output code for G-format floating-point numbers instead of D-format.
27181 @end table
27182
27183 @node Visium Options
27184 @subsection Visium Options
27185 @cindex Visium options
27186
27187 @table @gcctabopt
27188
27189 @item -mdebug
27190 @opindex mdebug
27191 A program which performs file I/O and is destined to run on an MCM target
27192 should be linked with this option. It causes the libraries libc.a and
27193 libdebug.a to be linked. The program should be run on the target under
27194 the control of the GDB remote debugging stub.
27195
27196 @item -msim
27197 @opindex msim
27198 A program which performs file I/O and is destined to run on the simulator
27199 should be linked with option. This causes libraries libc.a and libsim.a to
27200 be linked.
27201
27202 @item -mfpu
27203 @itemx -mhard-float
27204 @opindex mfpu
27205 @opindex mhard-float
27206 Generate code containing floating-point instructions. This is the
27207 default.
27208
27209 @item -mno-fpu
27210 @itemx -msoft-float
27211 @opindex mno-fpu
27212 @opindex msoft-float
27213 Generate code containing library calls for floating-point.
27214
27215 @option{-msoft-float} changes the calling convention in the output file;
27216 therefore, it is only useful if you compile @emph{all} of a program with
27217 this option. In particular, you need to compile @file{libgcc.a}, the
27218 library that comes with GCC, with @option{-msoft-float} in order for
27219 this to work.
27220
27221 @item -mcpu=@var{cpu_type}
27222 @opindex mcpu
27223 Set the instruction set, register set, and instruction scheduling parameters
27224 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27225 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27226
27227 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27228
27229 By default (unless configured otherwise), GCC generates code for the GR5
27230 variant of the Visium architecture.
27231
27232 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27233 architecture. The only difference from GR5 code is that the compiler will
27234 generate block move instructions.
27235
27236 @item -mtune=@var{cpu_type}
27237 @opindex mtune
27238 Set the instruction scheduling parameters for machine type @var{cpu_type},
27239 but do not set the instruction set or register set that the option
27240 @option{-mcpu=@var{cpu_type}} would.
27241
27242 @item -msv-mode
27243 @opindex msv-mode
27244 Generate code for the supervisor mode, where there are no restrictions on
27245 the access to general registers. This is the default.
27246
27247 @item -muser-mode
27248 @opindex muser-mode
27249 Generate code for the user mode, where the access to some general registers
27250 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27251 mode; on the GR6, only registers r29 to r31 are affected.
27252 @end table
27253
27254 @node VMS Options
27255 @subsection VMS Options
27256
27257 These @samp{-m} options are defined for the VMS implementations:
27258
27259 @table @gcctabopt
27260 @item -mvms-return-codes
27261 @opindex mvms-return-codes
27262 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27263 condition (e.g.@: error) codes.
27264
27265 @item -mdebug-main=@var{prefix}
27266 @opindex mdebug-main=@var{prefix}
27267 Flag the first routine whose name starts with @var{prefix} as the main
27268 routine for the debugger.
27269
27270 @item -mmalloc64
27271 @opindex mmalloc64
27272 Default to 64-bit memory allocation routines.
27273
27274 @item -mpointer-size=@var{size}
27275 @opindex mpointer-size=@var{size}
27276 Set the default size of pointers. Possible options for @var{size} are
27277 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27278 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27279 The later option disables @code{pragma pointer_size}.
27280 @end table
27281
27282 @node VxWorks Options
27283 @subsection VxWorks Options
27284 @cindex VxWorks Options
27285
27286 The options in this section are defined for all VxWorks targets.
27287 Options specific to the target hardware are listed with the other
27288 options for that target.
27289
27290 @table @gcctabopt
27291 @item -mrtp
27292 @opindex mrtp
27293 GCC can generate code for both VxWorks kernels and real time processes
27294 (RTPs). This option switches from the former to the latter. It also
27295 defines the preprocessor macro @code{__RTP__}.
27296
27297 @item -non-static
27298 @opindex non-static
27299 Link an RTP executable against shared libraries rather than static
27300 libraries. The options @option{-static} and @option{-shared} can
27301 also be used for RTPs (@pxref{Link Options}); @option{-static}
27302 is the default.
27303
27304 @item -Bstatic
27305 @itemx -Bdynamic
27306 @opindex Bstatic
27307 @opindex Bdynamic
27308 These options are passed down to the linker. They are defined for
27309 compatibility with Diab.
27310
27311 @item -Xbind-lazy
27312 @opindex Xbind-lazy
27313 Enable lazy binding of function calls. This option is equivalent to
27314 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27315
27316 @item -Xbind-now
27317 @opindex Xbind-now
27318 Disable lazy binding of function calls. This option is the default and
27319 is defined for compatibility with Diab.
27320 @end table
27321
27322 @node x86 Options
27323 @subsection x86 Options
27324 @cindex x86 Options
27325
27326 These @samp{-m} options are defined for the x86 family of computers.
27327
27328 @table @gcctabopt
27329
27330 @item -march=@var{cpu-type}
27331 @opindex march
27332 Generate instructions for the machine type @var{cpu-type}. In contrast to
27333 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27334 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27335 to generate code that may not run at all on processors other than the one
27336 indicated. Specifying @option{-march=@var{cpu-type}} implies
27337 @option{-mtune=@var{cpu-type}}.
27338
27339 The choices for @var{cpu-type} are:
27340
27341 @table @samp
27342 @item native
27343 This selects the CPU to generate code for at compilation time by determining
27344 the processor type of the compiling machine. Using @option{-march=native}
27345 enables all instruction subsets supported by the local machine (hence
27346 the result might not run on different machines). Using @option{-mtune=native}
27347 produces code optimized for the local machine under the constraints
27348 of the selected instruction set.
27349
27350 @item x86-64
27351 A generic CPU with 64-bit extensions.
27352
27353 @item i386
27354 Original Intel i386 CPU@.
27355
27356 @item i486
27357 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27358
27359 @item i586
27360 @itemx pentium
27361 Intel Pentium CPU with no MMX support.
27362
27363 @item lakemont
27364 Intel Lakemont MCU, based on Intel Pentium CPU.
27365
27366 @item pentium-mmx
27367 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27368
27369 @item pentiumpro
27370 Intel Pentium Pro CPU@.
27371
27372 @item i686
27373 When used with @option{-march}, the Pentium Pro
27374 instruction set is used, so the code runs on all i686 family chips.
27375 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27376
27377 @item pentium2
27378 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27379 support.
27380
27381 @item pentium3
27382 @itemx pentium3m
27383 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27384 set support.
27385
27386 @item pentium-m
27387 Intel Pentium M; low-power version of Intel Pentium III CPU
27388 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27389
27390 @item pentium4
27391 @itemx pentium4m
27392 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27393
27394 @item prescott
27395 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27396 set support.
27397
27398 @item nocona
27399 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27400 SSE2 and SSE3 instruction set support.
27401
27402 @item core2
27403 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27404 instruction set support.
27405
27406 @item nehalem
27407 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27408 SSE4.1, SSE4.2 and POPCNT instruction set support.
27409
27410 @item westmere
27411 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27412 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27413
27414 @item sandybridge
27415 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27416 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27417
27418 @item ivybridge
27419 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27420 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27421 instruction set support.
27422
27423 @item haswell
27424 Intel Haswell 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 and F16C instruction set support.
27427
27428 @item broadwell
27429 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27430 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27431 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27432
27433 @item skylake
27434 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27435 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27436 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27437 XSAVES instruction set support.
27438
27439 @item bonnell
27440 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27441 instruction set support.
27442
27443 @item silvermont
27444 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27445 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27446
27447 @item goldmont
27448 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27449 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27450 instruction set support.
27451
27452 @item goldmont-plus
27453 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27454 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27455 PTWRITE, RDPID, SGX and UMIP instruction set support.
27456
27457 @item tremont
27458 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27459 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27460 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27461
27462 @item knl
27463 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27464 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27465 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27466 AVX512CD instruction set support.
27467
27468 @item knm
27469 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27470 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27471 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27472 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27473
27474 @item skylake-avx512
27475 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27476 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27477 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27478 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27479
27480 @item cannonlake
27481 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27482 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27483 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27484 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27485 AVX512IFMA, SHA and UMIP instruction set support.
27486
27487 @item icelake-client
27488 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27489 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27490 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27491 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27492 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27493 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27494
27495 @item icelake-server
27496 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27497 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27498 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27499 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27500 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27501 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27502 set support.
27503
27504 @item k6
27505 AMD K6 CPU with MMX instruction set support.
27506
27507 @item k6-2
27508 @itemx k6-3
27509 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27510
27511 @item athlon
27512 @itemx athlon-tbird
27513 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27514 support.
27515
27516 @item athlon-4
27517 @itemx athlon-xp
27518 @itemx athlon-mp
27519 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27520 instruction set support.
27521
27522 @item k8
27523 @itemx opteron
27524 @itemx athlon64
27525 @itemx athlon-fx
27526 Processors based on the AMD K8 core with x86-64 instruction set support,
27527 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27528 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27529 instruction set extensions.)
27530
27531 @item k8-sse3
27532 @itemx opteron-sse3
27533 @itemx athlon64-sse3
27534 Improved versions of AMD K8 cores with SSE3 instruction set support.
27535
27536 @item amdfam10
27537 @itemx barcelona
27538 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27539 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27540 instruction set extensions.)
27541
27542 @item bdver1
27543 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27544 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27545 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27546 @item bdver2
27547 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27548 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27549 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27550 extensions.)
27551 @item bdver3
27552 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27553 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27554 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27555 64-bit instruction set extensions.
27556 @item bdver4
27557 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27558 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27559 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27560 SSE4.2, ABM and 64-bit instruction set extensions.
27561
27562 @item znver1
27563 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27564 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27565 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27566 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27567 instruction set extensions.
27568 @item znver2
27569 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27570 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27571 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27572 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27573 instruction set extensions.)
27574
27575
27576 @item btver1
27577 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27578 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27579 instruction set extensions.)
27580
27581 @item btver2
27582 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27583 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27584 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27585
27586 @item winchip-c6
27587 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27588 set support.
27589
27590 @item winchip2
27591 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27592 instruction set support.
27593
27594 @item c3
27595 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27596 (No scheduling is implemented for this chip.)
27597
27598 @item c3-2
27599 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27600 (No scheduling is implemented for this chip.)
27601
27602 @item c7
27603 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27604 (No scheduling is implemented for this chip.)
27605
27606 @item samuel-2
27607 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27608 (No scheduling is implemented for this chip.)
27609
27610 @item nehemiah
27611 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27612 (No scheduling is implemented for this chip.)
27613
27614 @item esther
27615 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27616 (No scheduling is implemented for this chip.)
27617
27618 @item eden-x2
27619 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27620 (No scheduling is implemented for this chip.)
27621
27622 @item eden-x4
27623 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27624 AVX and AVX2 instruction set support.
27625 (No scheduling is implemented for this chip.)
27626
27627 @item nano
27628 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27629 instruction set support.
27630 (No scheduling is implemented for this chip.)
27631
27632 @item nano-1000
27633 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27634 instruction set support.
27635 (No scheduling is implemented for this chip.)
27636
27637 @item nano-2000
27638 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27639 instruction set support.
27640 (No scheduling is implemented for this chip.)
27641
27642 @item nano-3000
27643 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27644 instruction set support.
27645 (No scheduling is implemented for this chip.)
27646
27647 @item nano-x2
27648 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27649 instruction set support.
27650 (No scheduling is implemented for this chip.)
27651
27652 @item nano-x4
27653 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27654 instruction set support.
27655 (No scheduling is implemented for this chip.)
27656
27657 @item geode
27658 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27659 @end table
27660
27661 @item -mtune=@var{cpu-type}
27662 @opindex mtune
27663 Tune to @var{cpu-type} everything applicable about the generated code, except
27664 for the ABI and the set of available instructions.
27665 While picking a specific @var{cpu-type} schedules things appropriately
27666 for that particular chip, the compiler does not generate any code that
27667 cannot run on the default machine type unless you use a
27668 @option{-march=@var{cpu-type}} option.
27669 For example, if GCC is configured for i686-pc-linux-gnu
27670 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27671 but still runs on i686 machines.
27672
27673 The choices for @var{cpu-type} are the same as for @option{-march}.
27674 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27675
27676 @table @samp
27677 @item generic
27678 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27679 If you know the CPU on which your code will run, then you should use
27680 the corresponding @option{-mtune} or @option{-march} option instead of
27681 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27682 of your application will have, then you should use this option.
27683
27684 As new processors are deployed in the marketplace, the behavior of this
27685 option will change. Therefore, if you upgrade to a newer version of
27686 GCC, code generation controlled by this option will change to reflect
27687 the processors
27688 that are most common at the time that version of GCC is released.
27689
27690 There is no @option{-march=generic} option because @option{-march}
27691 indicates the instruction set the compiler can use, and there is no
27692 generic instruction set applicable to all processors. In contrast,
27693 @option{-mtune} indicates the processor (or, in this case, collection of
27694 processors) for which the code is optimized.
27695
27696 @item intel
27697 Produce code optimized for the most current Intel processors, which are
27698 Haswell and Silvermont for this version of GCC. If you know the CPU
27699 on which your code will run, then you should use the corresponding
27700 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27701 But, if you want your application performs better on both Haswell and
27702 Silvermont, then you should use this option.
27703
27704 As new Intel processors are deployed in the marketplace, the behavior of
27705 this option will change. Therefore, if you upgrade to a newer version of
27706 GCC, code generation controlled by this option will change to reflect
27707 the most current Intel processors at the time that version of GCC is
27708 released.
27709
27710 There is no @option{-march=intel} option because @option{-march} indicates
27711 the instruction set the compiler can use, and there is no common
27712 instruction set applicable to all processors. In contrast,
27713 @option{-mtune} indicates the processor (or, in this case, collection of
27714 processors) for which the code is optimized.
27715 @end table
27716
27717 @item -mcpu=@var{cpu-type}
27718 @opindex mcpu
27719 A deprecated synonym for @option{-mtune}.
27720
27721 @item -mfpmath=@var{unit}
27722 @opindex mfpmath
27723 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27724 for @var{unit} are:
27725
27726 @table @samp
27727 @item 387
27728 Use the standard 387 floating-point coprocessor present on the majority of chips and
27729 emulated otherwise. Code compiled with this option runs almost everywhere.
27730 The temporary results are computed in 80-bit precision instead of the precision
27731 specified by the type, resulting in slightly different results compared to most
27732 of other chips. See @option{-ffloat-store} for more detailed description.
27733
27734 This is the default choice for non-Darwin x86-32 targets.
27735
27736 @item sse
27737 Use scalar floating-point instructions present in the SSE instruction set.
27738 This instruction set is supported by Pentium III and newer chips,
27739 and in the AMD line
27740 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27741 instruction set supports only single-precision arithmetic, thus the double and
27742 extended-precision arithmetic are still done using 387. A later version, present
27743 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27744 arithmetic too.
27745
27746 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27747 or @option{-msse2} switches to enable SSE extensions and make this option
27748 effective. For the x86-64 compiler, these extensions are enabled by default.
27749
27750 The resulting code should be considerably faster in the majority of cases and avoid
27751 the numerical instability problems of 387 code, but may break some existing
27752 code that expects temporaries to be 80 bits.
27753
27754 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27755 and the default choice for x86-32 targets with the SSE2 instruction set
27756 when @option{-ffast-math} is enabled.
27757
27758 @item sse,387
27759 @itemx sse+387
27760 @itemx both
27761 Attempt to utilize both instruction sets at once. This effectively doubles the
27762 amount of available registers, and on chips with separate execution units for
27763 387 and SSE the execution resources too. Use this option with care, as it is
27764 still experimental, because the GCC register allocator does not model separate
27765 functional units well, resulting in unstable performance.
27766 @end table
27767
27768 @item -masm=@var{dialect}
27769 @opindex masm=@var{dialect}
27770 Output assembly instructions using selected @var{dialect}. Also affects
27771 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27772 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27773 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27774 not support @samp{intel}.
27775
27776 @item -mieee-fp
27777 @itemx -mno-ieee-fp
27778 @opindex mieee-fp
27779 @opindex mno-ieee-fp
27780 Control whether or not the compiler uses IEEE floating-point
27781 comparisons. These correctly handle the case where the result of a
27782 comparison is unordered.
27783
27784 @item -m80387
27785 @itemx -mhard-float
27786 @opindex 80387
27787 @opindex mhard-float
27788 Generate output containing 80387 instructions for floating point.
27789
27790 @item -mno-80387
27791 @itemx -msoft-float
27792 @opindex no-80387
27793 @opindex msoft-float
27794 Generate output containing library calls for floating point.
27795
27796 @strong{Warning:} the requisite libraries are not part of GCC@.
27797 Normally the facilities of the machine's usual C compiler are used, but
27798 this cannot be done directly in cross-compilation. You must make your
27799 own arrangements to provide suitable library functions for
27800 cross-compilation.
27801
27802 On machines where a function returns floating-point results in the 80387
27803 register stack, some floating-point opcodes may be emitted even if
27804 @option{-msoft-float} is used.
27805
27806 @item -mno-fp-ret-in-387
27807 @opindex mno-fp-ret-in-387
27808 @opindex mfp-ret-in-387
27809 Do not use the FPU registers for return values of functions.
27810
27811 The usual calling convention has functions return values of types
27812 @code{float} and @code{double} in an FPU register, even if there
27813 is no FPU@. The idea is that the operating system should emulate
27814 an FPU@.
27815
27816 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27817 in ordinary CPU registers instead.
27818
27819 @item -mno-fancy-math-387
27820 @opindex mno-fancy-math-387
27821 @opindex mfancy-math-387
27822 Some 387 emulators do not support the @code{sin}, @code{cos} and
27823 @code{sqrt} instructions for the 387. Specify this option to avoid
27824 generating those instructions.
27825 This option is overridden when @option{-march}
27826 indicates that the target CPU always has an FPU and so the
27827 instruction does not need emulation. These
27828 instructions are not generated unless you also use the
27829 @option{-funsafe-math-optimizations} switch.
27830
27831 @item -malign-double
27832 @itemx -mno-align-double
27833 @opindex malign-double
27834 @opindex mno-align-double
27835 Control whether GCC aligns @code{double}, @code{long double}, and
27836 @code{long long} variables on a two-word boundary or a one-word
27837 boundary. Aligning @code{double} variables on a two-word boundary
27838 produces code that runs somewhat faster on a Pentium at the
27839 expense of more memory.
27840
27841 On x86-64, @option{-malign-double} is enabled by default.
27842
27843 @strong{Warning:} if you use the @option{-malign-double} switch,
27844 structures containing the above types are aligned differently than
27845 the published application binary interface specifications for the x86-32
27846 and are not binary compatible with structures in code compiled
27847 without that switch.
27848
27849 @item -m96bit-long-double
27850 @itemx -m128bit-long-double
27851 @opindex m96bit-long-double
27852 @opindex m128bit-long-double
27853 These switches control the size of @code{long double} type. The x86-32
27854 application binary interface specifies the size to be 96 bits,
27855 so @option{-m96bit-long-double} is the default in 32-bit mode.
27856
27857 Modern architectures (Pentium and newer) prefer @code{long double}
27858 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27859 conforming to the ABI, this is not possible. So specifying
27860 @option{-m128bit-long-double} aligns @code{long double}
27861 to a 16-byte boundary by padding the @code{long double} with an additional
27862 32-bit zero.
27863
27864 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27865 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27866
27867 Notice that neither of these options enable any extra precision over the x87
27868 standard of 80 bits for a @code{long double}.
27869
27870 @strong{Warning:} if you override the default value for your target ABI, this
27871 changes the size of
27872 structures and arrays containing @code{long double} variables,
27873 as well as modifying the function calling convention for functions taking
27874 @code{long double}. Hence they are not binary-compatible
27875 with code compiled without that switch.
27876
27877 @item -mlong-double-64
27878 @itemx -mlong-double-80
27879 @itemx -mlong-double-128
27880 @opindex mlong-double-64
27881 @opindex mlong-double-80
27882 @opindex mlong-double-128
27883 These switches control the size of @code{long double} type. A size
27884 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27885 type. This is the default for 32-bit Bionic C library. A size
27886 of 128 bits makes the @code{long double} type equivalent to the
27887 @code{__float128} type. This is the default for 64-bit Bionic C library.
27888
27889 @strong{Warning:} if you override the default value for your target ABI, this
27890 changes the size of
27891 structures and arrays containing @code{long double} variables,
27892 as well as modifying the function calling convention for functions taking
27893 @code{long double}. Hence they are not binary-compatible
27894 with code compiled without that switch.
27895
27896 @item -malign-data=@var{type}
27897 @opindex malign-data
27898 Control how GCC aligns variables. Supported values for @var{type} are
27899 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27900 and earlier, @samp{abi} uses alignment value as specified by the
27901 psABI, and @samp{cacheline} uses increased alignment value to match
27902 the cache line size. @samp{compat} is the default.
27903
27904 @item -mlarge-data-threshold=@var{threshold}
27905 @opindex mlarge-data-threshold
27906 When @option{-mcmodel=medium} is specified, data objects larger than
27907 @var{threshold} are placed in the large data section. This value must be the
27908 same across all objects linked into the binary, and defaults to 65535.
27909
27910 @item -mrtd
27911 @opindex mrtd
27912 Use a different function-calling convention, in which functions that
27913 take a fixed number of arguments return with the @code{ret @var{num}}
27914 instruction, which pops their arguments while returning. This saves one
27915 instruction in the caller since there is no need to pop the arguments
27916 there.
27917
27918 You can specify that an individual function is called with this calling
27919 sequence with the function attribute @code{stdcall}. You can also
27920 override the @option{-mrtd} option by using the function attribute
27921 @code{cdecl}. @xref{Function Attributes}.
27922
27923 @strong{Warning:} this calling convention is incompatible with the one
27924 normally used on Unix, so you cannot use it if you need to call
27925 libraries compiled with the Unix compiler.
27926
27927 Also, you must provide function prototypes for all functions that
27928 take variable numbers of arguments (including @code{printf});
27929 otherwise incorrect code is generated for calls to those
27930 functions.
27931
27932 In addition, seriously incorrect code results if you call a
27933 function with too many arguments. (Normally, extra arguments are
27934 harmlessly ignored.)
27935
27936 @item -mregparm=@var{num}
27937 @opindex mregparm
27938 Control how many registers are used to pass integer arguments. By
27939 default, no registers are used to pass arguments, and at most 3
27940 registers can be used. You can control this behavior for a specific
27941 function by using the function attribute @code{regparm}.
27942 @xref{Function Attributes}.
27943
27944 @strong{Warning:} if you use this switch, and
27945 @var{num} is nonzero, then you must build all modules with the same
27946 value, including any libraries. This includes the system libraries and
27947 startup modules.
27948
27949 @item -msseregparm
27950 @opindex msseregparm
27951 Use SSE register passing conventions for float and double arguments
27952 and return values. You can control this behavior for a specific
27953 function by using the function attribute @code{sseregparm}.
27954 @xref{Function Attributes}.
27955
27956 @strong{Warning:} if you use this switch then you must build all
27957 modules with the same value, including any libraries. This includes
27958 the system libraries and startup modules.
27959
27960 @item -mvect8-ret-in-mem
27961 @opindex mvect8-ret-in-mem
27962 Return 8-byte vectors in memory instead of MMX registers. This is the
27963 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27964 Studio compilers until version 12. Later compiler versions (starting
27965 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27966 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27967 you need to remain compatible with existing code produced by those
27968 previous compiler versions or older versions of GCC@.
27969
27970 @item -mpc32
27971 @itemx -mpc64
27972 @itemx -mpc80
27973 @opindex mpc32
27974 @opindex mpc64
27975 @opindex mpc80
27976
27977 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27978 is specified, the significands of results of floating-point operations are
27979 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27980 significands of results of floating-point operations to 53 bits (double
27981 precision) and @option{-mpc80} rounds the significands of results of
27982 floating-point operations to 64 bits (extended double precision), which is
27983 the default. When this option is used, floating-point operations in higher
27984 precisions are not available to the programmer without setting the FPU
27985 control word explicitly.
27986
27987 Setting the rounding of floating-point operations to less than the default
27988 80 bits can speed some programs by 2% or more. Note that some mathematical
27989 libraries assume that extended-precision (80-bit) floating-point operations
27990 are enabled by default; routines in such libraries could suffer significant
27991 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27992 when this option is used to set the precision to less than extended precision.
27993
27994 @item -mstackrealign
27995 @opindex mstackrealign
27996 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27997 option generates an alternate prologue and epilogue that realigns the
27998 run-time stack if necessary. This supports mixing legacy codes that keep
27999 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28000 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28001 applicable to individual functions.
28002
28003 @item -mpreferred-stack-boundary=@var{num}
28004 @opindex mpreferred-stack-boundary
28005 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28006 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28007 the default is 4 (16 bytes or 128 bits).
28008
28009 @strong{Warning:} When generating code for the x86-64 architecture with
28010 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28011 used to keep the stack boundary aligned to 8 byte boundary. Since
28012 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28013 intended to be used in controlled environment where stack space is
28014 important limitation. This option leads to wrong code when functions
28015 compiled with 16 byte stack alignment (such as functions from a standard
28016 library) are called with misaligned stack. In this case, SSE
28017 instructions may lead to misaligned memory access traps. In addition,
28018 variable arguments are handled incorrectly for 16 byte aligned
28019 objects (including x87 long double and __int128), leading to wrong
28020 results. You must build all modules with
28021 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28022 includes the system libraries and startup modules.
28023
28024 @item -mincoming-stack-boundary=@var{num}
28025 @opindex mincoming-stack-boundary
28026 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28027 boundary. If @option{-mincoming-stack-boundary} is not specified,
28028 the one specified by @option{-mpreferred-stack-boundary} is used.
28029
28030 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28031 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28032 suffer significant run time performance penalties. On Pentium III, the
28033 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28034 properly if it is not 16-byte aligned.
28035
28036 To ensure proper alignment of this values on the stack, the stack boundary
28037 must be as aligned as that required by any value stored on the stack.
28038 Further, every function must be generated such that it keeps the stack
28039 aligned. Thus calling a function compiled with a higher preferred
28040 stack boundary from a function compiled with a lower preferred stack
28041 boundary most likely misaligns the stack. It is recommended that
28042 libraries that use callbacks always use the default setting.
28043
28044 This extra alignment does consume extra stack space, and generally
28045 increases code size. Code that is sensitive to stack space usage, such
28046 as embedded systems and operating system kernels, may want to reduce the
28047 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28048
28049 @need 200
28050 @item -mmmx
28051 @opindex mmmx
28052 @need 200
28053 @itemx -msse
28054 @opindex msse
28055 @need 200
28056 @itemx -msse2
28057 @opindex msse2
28058 @need 200
28059 @itemx -msse3
28060 @opindex msse3
28061 @need 200
28062 @itemx -mssse3
28063 @opindex mssse3
28064 @need 200
28065 @itemx -msse4
28066 @opindex msse4
28067 @need 200
28068 @itemx -msse4a
28069 @opindex msse4a
28070 @need 200
28071 @itemx -msse4.1
28072 @opindex msse4.1
28073 @need 200
28074 @itemx -msse4.2
28075 @opindex msse4.2
28076 @need 200
28077 @itemx -mavx
28078 @opindex mavx
28079 @need 200
28080 @itemx -mavx2
28081 @opindex mavx2
28082 @need 200
28083 @itemx -mavx512f
28084 @opindex mavx512f
28085 @need 200
28086 @itemx -mavx512pf
28087 @opindex mavx512pf
28088 @need 200
28089 @itemx -mavx512er
28090 @opindex mavx512er
28091 @need 200
28092 @itemx -mavx512cd
28093 @opindex mavx512cd
28094 @need 200
28095 @itemx -mavx512vl
28096 @opindex mavx512vl
28097 @need 200
28098 @itemx -mavx512bw
28099 @opindex mavx512bw
28100 @need 200
28101 @itemx -mavx512dq
28102 @opindex mavx512dq
28103 @need 200
28104 @itemx -mavx512ifma
28105 @opindex mavx512ifma
28106 @need 200
28107 @itemx -mavx512vbmi
28108 @opindex mavx512vbmi
28109 @need 200
28110 @itemx -msha
28111 @opindex msha
28112 @need 200
28113 @itemx -maes
28114 @opindex maes
28115 @need 200
28116 @itemx -mpclmul
28117 @opindex mpclmul
28118 @need 200
28119 @itemx -mclflushopt
28120 @opindex mclflushopt
28121 @need 200
28122 @itemx -mfsgsbase
28123 @opindex mfsgsbase
28124 @need 200
28125 @itemx -mptwrite
28126 @opindex mptwrite
28127 @need 200
28128 @itemx -mrdrnd
28129 @opindex mrdrnd
28130 @need 200
28131 @itemx -mf16c
28132 @opindex mf16c
28133 @need 200
28134 @itemx -mfma
28135 @opindex mfma
28136 @need 200
28137 @itemx -mpconfig
28138 @opindex mpconfig
28139 @need 200
28140 @itemx -mwbnoinvd
28141 @opindex mwbnoinvd
28142 @need 200
28143 @itemx -mfma4
28144 @opindex mfma4
28145 @need 200
28146 @itemx -mprefetchwt1
28147 @opindex mprefetchwt1
28148 @need 200
28149 @itemx -mxop
28150 @opindex mxop
28151 @need 200
28152 @itemx -mlwp
28153 @opindex mlwp
28154 @need 200
28155 @itemx -m3dnow
28156 @opindex m3dnow
28157 @need 200
28158 @itemx -m3dnowa
28159 @opindex m3dnowa
28160 @need 200
28161 @itemx -mpopcnt
28162 @opindex mpopcnt
28163 @need 200
28164 @itemx -mabm
28165 @opindex mabm
28166 @need 200
28167 @itemx -mbmi
28168 @opindex mbmi
28169 @need 200
28170 @itemx -mbmi2
28171 @need 200
28172 @itemx -mlzcnt
28173 @opindex mlzcnt
28174 @need 200
28175 @itemx -mfxsr
28176 @opindex mfxsr
28177 @need 200
28178 @itemx -mxsave
28179 @opindex mxsave
28180 @need 200
28181 @itemx -mxsaveopt
28182 @opindex mxsaveopt
28183 @need 200
28184 @itemx -mxsavec
28185 @opindex mxsavec
28186 @need 200
28187 @itemx -mxsaves
28188 @opindex mxsaves
28189 @need 200
28190 @itemx -mrtm
28191 @opindex mrtm
28192 @need 200
28193 @itemx -mtbm
28194 @opindex mtbm
28195 @need 200
28196 @itemx -mmwaitx
28197 @opindex mmwaitx
28198 @need 200
28199 @itemx -mclzero
28200 @opindex mclzero
28201 @need 200
28202 @itemx -mpku
28203 @opindex mpku
28204 @need 200
28205 @itemx -mavx512vbmi2
28206 @opindex mavx512vbmi2
28207 @need 200
28208 @itemx -mgfni
28209 @opindex mgfni
28210 @need 200
28211 @itemx -mvaes
28212 @opindex mvaes
28213 @need 200
28214 @itemx -mwaitpkg
28215 @opindex mwaitpkg
28216 @need 200
28217 @itemx -mvpclmulqdq
28218 @opindex mvpclmulqdq
28219 @need 200
28220 @itemx -mavx512bitalg
28221 @opindex mavx512bitalg
28222 @need 200
28223 @itemx -mmovdiri
28224 @opindex mmovdiri
28225 @need 200
28226 @itemx -mmovdir64b
28227 @opindex mmovdir64b
28228 @need 200
28229 @itemx -mavx512vpopcntdq
28230 @opindex mavx512vpopcntdq
28231 @need 200
28232 @itemx -mcldemote
28233 @opindex mcldemote
28234 These switches enable the use of instructions in the MMX, SSE,
28235 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28236 SHA, AES, PCLMUL, FSGSBASE, PTWRITE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
28237 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
28238 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
28239 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
28240 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
28241 sets. Each has a corresponding @option{-mno-} option to disable use of these
28242 instructions.
28243
28244 These extensions are also available as built-in functions: see
28245 @ref{x86 Built-in Functions}, for details of the functions enabled and
28246 disabled by these switches.
28247
28248 To generate SSE/SSE2 instructions automatically from floating-point
28249 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28250
28251 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28252 generates new AVX instructions or AVX equivalence for all SSEx instructions
28253 when needed.
28254
28255 These options enable GCC to use these extended instructions in
28256 generated code, even without @option{-mfpmath=sse}. Applications that
28257 perform run-time CPU detection must compile separate files for each
28258 supported architecture, using the appropriate flags. In particular,
28259 the file containing the CPU detection code should be compiled without
28260 these options.
28261
28262 @item -mdump-tune-features
28263 @opindex mdump-tune-features
28264 This option instructs GCC to dump the names of the x86 performance
28265 tuning features and default settings. The names can be used in
28266 @option{-mtune-ctrl=@var{feature-list}}.
28267
28268 @item -mtune-ctrl=@var{feature-list}
28269 @opindex mtune-ctrl=@var{feature-list}
28270 This option is used to do fine grain control of x86 code generation features.
28271 @var{feature-list} is a comma separated list of @var{feature} names. See also
28272 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28273 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28274 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28275 developers. Using it may lead to code paths not covered by testing and can
28276 potentially result in compiler ICEs or runtime errors.
28277
28278 @item -mno-default
28279 @opindex mno-default
28280 This option instructs GCC to turn off all tunable features. See also
28281 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28282
28283 @item -mcld
28284 @opindex mcld
28285 This option instructs GCC to emit a @code{cld} instruction in the prologue
28286 of functions that use string instructions. String instructions depend on
28287 the DF flag to select between autoincrement or autodecrement mode. While the
28288 ABI specifies the DF flag to be cleared on function entry, some operating
28289 systems violate this specification by not clearing the DF flag in their
28290 exception dispatchers. The exception handler can be invoked with the DF flag
28291 set, which leads to wrong direction mode when string instructions are used.
28292 This option can be enabled by default on 32-bit x86 targets by configuring
28293 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28294 instructions can be suppressed with the @option{-mno-cld} compiler option
28295 in this case.
28296
28297 @item -mvzeroupper
28298 @opindex mvzeroupper
28299 This option instructs GCC to emit a @code{vzeroupper} instruction
28300 before a transfer of control flow out of the function to minimize
28301 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28302 intrinsics.
28303
28304 @item -mprefer-avx128
28305 @opindex mprefer-avx128
28306 This option instructs GCC to use 128-bit AVX instructions instead of
28307 256-bit AVX instructions in the auto-vectorizer.
28308
28309 @item -mprefer-vector-width=@var{opt}
28310 @opindex mprefer-vector-width
28311 This option instructs GCC to use @var{opt}-bit vector width in instructions
28312 instead of default on the selected platform.
28313
28314 @table @samp
28315 @item none
28316 No extra limitations applied to GCC other than defined by the selected platform.
28317
28318 @item 128
28319 Prefer 128-bit vector width for instructions.
28320
28321 @item 256
28322 Prefer 256-bit vector width for instructions.
28323
28324 @item 512
28325 Prefer 512-bit vector width for instructions.
28326 @end table
28327
28328 @item -mcx16
28329 @opindex mcx16
28330 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28331 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28332 objects. This is useful for atomic updates of data structures exceeding one
28333 machine word in size. The compiler uses this instruction to implement
28334 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28335 128-bit integers, a library call is always used.
28336
28337 @item -msahf
28338 @opindex msahf
28339 This option enables generation of @code{SAHF} instructions in 64-bit code.
28340 Early Intel Pentium 4 CPUs with Intel 64 support,
28341 prior to the introduction of Pentium 4 G1 step in December 2005,
28342 lacked the @code{LAHF} and @code{SAHF} instructions
28343 which are supported by AMD64.
28344 These are load and store instructions, respectively, for certain status flags.
28345 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28346 @code{drem}, and @code{remainder} built-in functions;
28347 see @ref{Other Builtins} for details.
28348
28349 @item -mmovbe
28350 @opindex mmovbe
28351 This option enables use of the @code{movbe} instruction to implement
28352 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28353
28354 @item -mshstk
28355 @opindex mshstk
28356 The @option{-mshstk} option enables shadow stack built-in functions
28357 from x86 Control-flow Enforcement Technology (CET).
28358
28359 @item -mcrc32
28360 @opindex mcrc32
28361 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28362 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28363 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28364
28365 @item -mrecip
28366 @opindex mrecip
28367 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28368 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28369 with an additional Newton-Raphson step
28370 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28371 (and their vectorized
28372 variants) for single-precision floating-point arguments. These instructions
28373 are generated only when @option{-funsafe-math-optimizations} is enabled
28374 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28375 Note that while the throughput of the sequence is higher than the throughput
28376 of the non-reciprocal instruction, the precision of the sequence can be
28377 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28378
28379 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28380 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28381 combination), and doesn't need @option{-mrecip}.
28382
28383 Also note that GCC emits the above sequence with additional Newton-Raphson step
28384 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28385 already with @option{-ffast-math} (or the above option combination), and
28386 doesn't need @option{-mrecip}.
28387
28388 @item -mrecip=@var{opt}
28389 @opindex mrecip=opt
28390 This option controls which reciprocal estimate instructions
28391 may be used. @var{opt} is a comma-separated list of options, which may
28392 be preceded by a @samp{!} to invert the option:
28393
28394 @table @samp
28395 @item all
28396 Enable all estimate instructions.
28397
28398 @item default
28399 Enable the default instructions, equivalent to @option{-mrecip}.
28400
28401 @item none
28402 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28403
28404 @item div
28405 Enable the approximation for scalar division.
28406
28407 @item vec-div
28408 Enable the approximation for vectorized division.
28409
28410 @item sqrt
28411 Enable the approximation for scalar square root.
28412
28413 @item vec-sqrt
28414 Enable the approximation for vectorized square root.
28415 @end table
28416
28417 So, for example, @option{-mrecip=all,!sqrt} enables
28418 all of the reciprocal approximations, except for square root.
28419
28420 @item -mveclibabi=@var{type}
28421 @opindex mveclibabi
28422 Specifies the ABI type to use for vectorizing intrinsics using an
28423 external library. Supported values for @var{type} are @samp{svml}
28424 for the Intel short
28425 vector math library and @samp{acml} for the AMD math core library.
28426 To use this option, both @option{-ftree-vectorize} and
28427 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28428 ABI-compatible library must be specified at link time.
28429
28430 GCC currently emits calls to @code{vmldExp2},
28431 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28432 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28433 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28434 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28435 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28436 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28437 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28438 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28439 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28440 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28441 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28442 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28443 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28444 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28445 when @option{-mveclibabi=acml} is used.
28446
28447 @item -mabi=@var{name}
28448 @opindex mabi
28449 Generate code for the specified calling convention. Permissible values
28450 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28451 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28452 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28453 You can control this behavior for specific functions by
28454 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28455 @xref{Function Attributes}.
28456
28457 @item -mforce-indirect-call
28458 @opindex mforce-indirect-call
28459 Force all calls to functions to be indirect. This is useful
28460 when using Intel Processor Trace where it generates more precise timing
28461 information for function calls.
28462
28463 @item -mcall-ms2sysv-xlogues
28464 @opindex mcall-ms2sysv-xlogues
28465 @opindex mno-call-ms2sysv-xlogues
28466 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28467 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28468 default, the code for saving and restoring these registers is emitted inline,
28469 resulting in fairly lengthy prologues and epilogues. Using
28470 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28471 use stubs in the static portion of libgcc to perform these saves and restores,
28472 thus reducing function size at the cost of a few extra instructions.
28473
28474 @item -mtls-dialect=@var{type}
28475 @opindex mtls-dialect
28476 Generate code to access thread-local storage using the @samp{gnu} or
28477 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28478 @samp{gnu2} is more efficient, but it may add compile- and run-time
28479 requirements that cannot be satisfied on all systems.
28480
28481 @item -mpush-args
28482 @itemx -mno-push-args
28483 @opindex mpush-args
28484 @opindex mno-push-args
28485 Use PUSH operations to store outgoing parameters. This method is shorter
28486 and usually equally fast as method using SUB/MOV operations and is enabled
28487 by default. In some cases disabling it may improve performance because of
28488 improved scheduling and reduced dependencies.
28489
28490 @item -maccumulate-outgoing-args
28491 @opindex maccumulate-outgoing-args
28492 If enabled, the maximum amount of space required for outgoing arguments is
28493 computed in the function prologue. This is faster on most modern CPUs
28494 because of reduced dependencies, improved scheduling and reduced stack usage
28495 when the preferred stack boundary is not equal to 2. The drawback is a notable
28496 increase in code size. This switch implies @option{-mno-push-args}.
28497
28498 @item -mthreads
28499 @opindex mthreads
28500 Support thread-safe exception handling on MinGW. Programs that rely
28501 on thread-safe exception handling must compile and link all code with the
28502 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28503 @option{-D_MT}; when linking, it links in a special thread helper library
28504 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28505
28506 @item -mms-bitfields
28507 @itemx -mno-ms-bitfields
28508 @opindex mms-bitfields
28509 @opindex mno-ms-bitfields
28510
28511 Enable/disable bit-field layout compatible with the native Microsoft
28512 Windows compiler.
28513
28514 If @code{packed} is used on a structure, or if bit-fields are used,
28515 it may be that the Microsoft ABI lays out the structure differently
28516 than the way GCC normally does. Particularly when moving packed
28517 data between functions compiled with GCC and the native Microsoft compiler
28518 (either via function call or as data in a file), it may be necessary to access
28519 either format.
28520
28521 This option is enabled by default for Microsoft Windows
28522 targets. This behavior can also be controlled locally by use of variable
28523 or type attributes. For more information, see @ref{x86 Variable Attributes}
28524 and @ref{x86 Type Attributes}.
28525
28526 The Microsoft structure layout algorithm is fairly simple with the exception
28527 of the bit-field packing.
28528 The padding and alignment of members of structures and whether a bit-field
28529 can straddle a storage-unit boundary are determine by these rules:
28530
28531 @enumerate
28532 @item Structure members are stored sequentially in the order in which they are
28533 declared: the first member has the lowest memory address and the last member
28534 the highest.
28535
28536 @item Every data object has an alignment requirement. The alignment requirement
28537 for all data except structures, unions, and arrays is either the size of the
28538 object or the current packing size (specified with either the
28539 @code{aligned} attribute or the @code{pack} pragma),
28540 whichever is less. For structures, unions, and arrays,
28541 the alignment requirement is the largest alignment requirement of its members.
28542 Every object is allocated an offset so that:
28543
28544 @smallexample
28545 offset % alignment_requirement == 0
28546 @end smallexample
28547
28548 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28549 unit if the integral types are the same size and if the next bit-field fits
28550 into the current allocation unit without crossing the boundary imposed by the
28551 common alignment requirements of the bit-fields.
28552 @end enumerate
28553
28554 MSVC interprets zero-length bit-fields in the following ways:
28555
28556 @enumerate
28557 @item If a zero-length bit-field is inserted between two bit-fields that
28558 are normally coalesced, the bit-fields are not coalesced.
28559
28560 For example:
28561
28562 @smallexample
28563 struct
28564 @{
28565 unsigned long bf_1 : 12;
28566 unsigned long : 0;
28567 unsigned long bf_2 : 12;
28568 @} t1;
28569 @end smallexample
28570
28571 @noindent
28572 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28573 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28574
28575 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28576 alignment of the zero-length bit-field is greater than the member that follows it,
28577 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28578
28579 For example:
28580
28581 @smallexample
28582 struct
28583 @{
28584 char foo : 4;
28585 short : 0;
28586 char bar;
28587 @} t2;
28588
28589 struct
28590 @{
28591 char foo : 4;
28592 short : 0;
28593 double bar;
28594 @} t3;
28595 @end smallexample
28596
28597 @noindent
28598 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28599 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28600 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28601 of the structure.
28602
28603 Taking this into account, it is important to note the following:
28604
28605 @enumerate
28606 @item If a zero-length bit-field follows a normal bit-field, the type of the
28607 zero-length bit-field may affect the alignment of the structure as whole. For
28608 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28609 normal bit-field, and is of type short.
28610
28611 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28612 still affect the alignment of the structure:
28613
28614 @smallexample
28615 struct
28616 @{
28617 char foo : 6;
28618 long : 0;
28619 @} t4;
28620 @end smallexample
28621
28622 @noindent
28623 Here, @code{t4} takes up 4 bytes.
28624 @end enumerate
28625
28626 @item Zero-length bit-fields following non-bit-field members are ignored:
28627
28628 @smallexample
28629 struct
28630 @{
28631 char foo;
28632 long : 0;
28633 char bar;
28634 @} t5;
28635 @end smallexample
28636
28637 @noindent
28638 Here, @code{t5} takes up 2 bytes.
28639 @end enumerate
28640
28641
28642 @item -mno-align-stringops
28643 @opindex mno-align-stringops
28644 @opindex malign-stringops
28645 Do not align the destination of inlined string operations. This switch reduces
28646 code size and improves performance in case the destination is already aligned,
28647 but GCC doesn't know about it.
28648
28649 @item -minline-all-stringops
28650 @opindex minline-all-stringops
28651 By default GCC inlines string operations only when the destination is
28652 known to be aligned to least a 4-byte boundary.
28653 This enables more inlining and increases code
28654 size, but may improve performance of code that depends on fast
28655 @code{memcpy}, @code{strlen},
28656 and @code{memset} for short lengths.
28657
28658 @item -minline-stringops-dynamically
28659 @opindex minline-stringops-dynamically
28660 For string operations of unknown size, use run-time checks with
28661 inline code for small blocks and a library call for large blocks.
28662
28663 @item -mstringop-strategy=@var{alg}
28664 @opindex mstringop-strategy=@var{alg}
28665 Override the internal decision heuristic for the particular algorithm to use
28666 for inlining string operations. The allowed values for @var{alg} are:
28667
28668 @table @samp
28669 @item rep_byte
28670 @itemx rep_4byte
28671 @itemx rep_8byte
28672 Expand using i386 @code{rep} prefix of the specified size.
28673
28674 @item byte_loop
28675 @itemx loop
28676 @itemx unrolled_loop
28677 Expand into an inline loop.
28678
28679 @item libcall
28680 Always use a library call.
28681 @end table
28682
28683 @item -mmemcpy-strategy=@var{strategy}
28684 @opindex mmemcpy-strategy=@var{strategy}
28685 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28686 should be inlined and what inline algorithm to use when the expected size
28687 of the copy operation is known. @var{strategy}
28688 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28689 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28690 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28691 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28692 in the list must be specified in increasing order. The minimal byte size for
28693 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28694 preceding range.
28695
28696 @item -mmemset-strategy=@var{strategy}
28697 @opindex mmemset-strategy=@var{strategy}
28698 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28699 @code{__builtin_memset} expansion.
28700
28701 @item -momit-leaf-frame-pointer
28702 @opindex momit-leaf-frame-pointer
28703 Don't keep the frame pointer in a register for leaf functions. This
28704 avoids the instructions to save, set up, and restore frame pointers and
28705 makes an extra register available in leaf functions. The option
28706 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28707 which might make debugging harder.
28708
28709 @item -mtls-direct-seg-refs
28710 @itemx -mno-tls-direct-seg-refs
28711 @opindex mtls-direct-seg-refs
28712 Controls whether TLS variables may be accessed with offsets from the
28713 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28714 or whether the thread base pointer must be added. Whether or not this
28715 is valid depends on the operating system, and whether it maps the
28716 segment to cover the entire TLS area.
28717
28718 For systems that use the GNU C Library, the default is on.
28719
28720 @item -msse2avx
28721 @itemx -mno-sse2avx
28722 @opindex msse2avx
28723 Specify that the assembler should encode SSE instructions with VEX
28724 prefix. The option @option{-mavx} turns this on by default.
28725
28726 @item -mfentry
28727 @itemx -mno-fentry
28728 @opindex mfentry
28729 If profiling is active (@option{-pg}), put the profiling
28730 counter call before the prologue.
28731 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28732 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28733
28734 @item -mrecord-mcount
28735 @itemx -mno-record-mcount
28736 @opindex mrecord-mcount
28737 If profiling is active (@option{-pg}), generate a __mcount_loc section
28738 that contains pointers to each profiling call. This is useful for
28739 automatically patching and out calls.
28740
28741 @item -mnop-mcount
28742 @itemx -mno-nop-mcount
28743 @opindex mnop-mcount
28744 If profiling is active (@option{-pg}), generate the calls to
28745 the profiling functions as NOPs. This is useful when they
28746 should be patched in later dynamically. This is likely only
28747 useful together with @option{-mrecord-mcount}.
28748
28749 @item -mskip-rax-setup
28750 @itemx -mno-skip-rax-setup
28751 @opindex mskip-rax-setup
28752 When generating code for the x86-64 architecture with SSE extensions
28753 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28754 register when there are no variable arguments passed in vector registers.
28755
28756 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28757 saving vector registers on stack when passing variable arguments, the
28758 impacts of this option are callees may waste some stack space,
28759 misbehave or jump to a random location. GCC 4.4 or newer don't have
28760 those issues, regardless the RAX register value.
28761
28762 @item -m8bit-idiv
28763 @itemx -mno-8bit-idiv
28764 @opindex m8bit-idiv
28765 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28766 much faster than 32-bit/64-bit integer divide. This option generates a
28767 run-time check. If both dividend and divisor are within range of 0
28768 to 255, 8-bit unsigned integer divide is used instead of
28769 32-bit/64-bit integer divide.
28770
28771 @item -mavx256-split-unaligned-load
28772 @itemx -mavx256-split-unaligned-store
28773 @opindex mavx256-split-unaligned-load
28774 @opindex mavx256-split-unaligned-store
28775 Split 32-byte AVX unaligned load and store.
28776
28777 @item -mstack-protector-guard=@var{guard}
28778 @itemx -mstack-protector-guard-reg=@var{reg}
28779 @itemx -mstack-protector-guard-offset=@var{offset}
28780 @opindex mstack-protector-guard
28781 @opindex mstack-protector-guard-reg
28782 @opindex mstack-protector-guard-offset
28783 Generate stack protection code using canary at @var{guard}. Supported
28784 locations are @samp{global} for global canary or @samp{tls} for per-thread
28785 canary in the TLS block (the default). This option has effect only when
28786 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28787
28788 With the latter choice the options
28789 @option{-mstack-protector-guard-reg=@var{reg}} and
28790 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28791 which segment register (@code{%fs} or @code{%gs}) to use as base register
28792 for reading the canary, and from what offset from that base register.
28793 The default for those is as specified in the relevant ABI.
28794
28795 @item -mgeneral-regs-only
28796 @opindex mgeneral-regs-only
28797 Generate code that uses only the general-purpose registers. This
28798 prevents the compiler from using floating-point, vector, mask and bound
28799 registers.
28800
28801 @item -mindirect-branch=@var{choice}
28802 @opindex mindirect-branch
28803 Convert indirect call and jump with @var{choice}. The default is
28804 @samp{keep}, which keeps indirect call and jump unmodified.
28805 @samp{thunk} converts indirect call and jump to call and return thunk.
28806 @samp{thunk-inline} converts indirect call and jump to inlined call
28807 and return thunk. @samp{thunk-extern} converts indirect call and jump
28808 to external call and return thunk provided in a separate object file.
28809 You can control this behavior for a specific function by using the
28810 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28811
28812 Note that @option{-mcmodel=large} is incompatible with
28813 @option{-mindirect-branch=thunk} and
28814 @option{-mindirect-branch=thunk-extern} since the thunk function may
28815 not be reachable in the large code model.
28816
28817 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28818 @option{-fcf-protection=branch} since the external thunk can not be modified
28819 to disable control-flow check.
28820
28821 @item -mfunction-return=@var{choice}
28822 @opindex mfunction-return
28823 Convert function return with @var{choice}. The default is @samp{keep},
28824 which keeps function return unmodified. @samp{thunk} converts function
28825 return to call and return thunk. @samp{thunk-inline} converts function
28826 return to inlined call and return thunk. @samp{thunk-extern} converts
28827 function return to external call and return thunk provided in a separate
28828 object file. You can control this behavior for a specific function by
28829 using the function attribute @code{function_return}.
28830 @xref{Function Attributes}.
28831
28832 Note that @option{-mcmodel=large} is incompatible with
28833 @option{-mfunction-return=thunk} and
28834 @option{-mfunction-return=thunk-extern} since the thunk function may
28835 not be reachable in the large code model.
28836
28837
28838 @item -mindirect-branch-register
28839 @opindex mindirect-branch-register
28840 Force indirect call and jump via register.
28841
28842 @end table
28843
28844 These @samp{-m} switches are supported in addition to the above
28845 on x86-64 processors in 64-bit environments.
28846
28847 @table @gcctabopt
28848 @item -m32
28849 @itemx -m64
28850 @itemx -mx32
28851 @itemx -m16
28852 @itemx -miamcu
28853 @opindex m32
28854 @opindex m64
28855 @opindex mx32
28856 @opindex m16
28857 @opindex miamcu
28858 Generate code for a 16-bit, 32-bit or 64-bit environment.
28859 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28860 to 32 bits, and
28861 generates code that runs on any i386 system.
28862
28863 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28864 types to 64 bits, and generates code for the x86-64 architecture.
28865 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28866 and @option{-mdynamic-no-pic} options.
28867
28868 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28869 to 32 bits, and
28870 generates code for the x86-64 architecture.
28871
28872 The @option{-m16} option is the same as @option{-m32}, except for that
28873 it outputs the @code{.code16gcc} assembly directive at the beginning of
28874 the assembly output so that the binary can run in 16-bit mode.
28875
28876 The @option{-miamcu} option generates code which conforms to Intel MCU
28877 psABI. It requires the @option{-m32} option to be turned on.
28878
28879 @item -mno-red-zone
28880 @opindex mno-red-zone
28881 @opindex mred-zone
28882 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28883 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28884 stack pointer that is not modified by signal or interrupt handlers
28885 and therefore can be used for temporary data without adjusting the stack
28886 pointer. The flag @option{-mno-red-zone} disables this red zone.
28887
28888 @item -mcmodel=small
28889 @opindex mcmodel=small
28890 Generate code for the small code model: the program and its symbols must
28891 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28892 Programs can be statically or dynamically linked. This is the default
28893 code model.
28894
28895 @item -mcmodel=kernel
28896 @opindex mcmodel=kernel
28897 Generate code for the kernel code model. The kernel runs in the
28898 negative 2 GB of the address space.
28899 This model has to be used for Linux kernel code.
28900
28901 @item -mcmodel=medium
28902 @opindex mcmodel=medium
28903 Generate code for the medium model: the program is linked in the lower 2
28904 GB of the address space. Small symbols are also placed there. Symbols
28905 with sizes larger than @option{-mlarge-data-threshold} are put into
28906 large data or BSS sections and can be located above 2GB. Programs can
28907 be statically or dynamically linked.
28908
28909 @item -mcmodel=large
28910 @opindex mcmodel=large
28911 Generate code for the large model. This model makes no assumptions
28912 about addresses and sizes of sections.
28913
28914 @item -maddress-mode=long
28915 @opindex maddress-mode=long
28916 Generate code for long address mode. This is only supported for 64-bit
28917 and x32 environments. It is the default address mode for 64-bit
28918 environments.
28919
28920 @item -maddress-mode=short
28921 @opindex maddress-mode=short
28922 Generate code for short address mode. This is only supported for 32-bit
28923 and x32 environments. It is the default address mode for 32-bit and
28924 x32 environments.
28925 @end table
28926
28927 @node x86 Windows Options
28928 @subsection x86 Windows Options
28929 @cindex x86 Windows Options
28930 @cindex Windows Options for x86
28931
28932 These additional options are available for Microsoft Windows targets:
28933
28934 @table @gcctabopt
28935 @item -mconsole
28936 @opindex mconsole
28937 This option
28938 specifies that a console application is to be generated, by
28939 instructing the linker to set the PE header subsystem type
28940 required for console applications.
28941 This option is available for Cygwin and MinGW targets and is
28942 enabled by default on those targets.
28943
28944 @item -mdll
28945 @opindex mdll
28946 This option is available for Cygwin and MinGW targets. It
28947 specifies that a DLL---a dynamic link library---is to be
28948 generated, enabling the selection of the required runtime
28949 startup object and entry point.
28950
28951 @item -mnop-fun-dllimport
28952 @opindex mnop-fun-dllimport
28953 This option is available for Cygwin and MinGW targets. It
28954 specifies that the @code{dllimport} attribute should be ignored.
28955
28956 @item -mthread
28957 @opindex mthread
28958 This option is available for MinGW targets. It specifies
28959 that MinGW-specific thread support is to be used.
28960
28961 @item -municode
28962 @opindex municode
28963 This option is available for MinGW-w64 targets. It causes
28964 the @code{UNICODE} preprocessor macro to be predefined, and
28965 chooses Unicode-capable runtime startup code.
28966
28967 @item -mwin32
28968 @opindex mwin32
28969 This option is available for Cygwin and MinGW targets. It
28970 specifies that the typical Microsoft Windows predefined macros are to
28971 be set in the pre-processor, but does not influence the choice
28972 of runtime library/startup code.
28973
28974 @item -mwindows
28975 @opindex mwindows
28976 This option is available for Cygwin and MinGW targets. It
28977 specifies that a GUI application is to be generated by
28978 instructing the linker to set the PE header subsystem type
28979 appropriately.
28980
28981 @item -fno-set-stack-executable
28982 @opindex fno-set-stack-executable
28983 @opindex fset-stack-executable
28984 This option is available for MinGW targets. It specifies that
28985 the executable flag for the stack used by nested functions isn't
28986 set. This is necessary for binaries running in kernel mode of
28987 Microsoft Windows, as there the User32 API, which is used to set executable
28988 privileges, isn't available.
28989
28990 @item -fwritable-relocated-rdata
28991 @opindex fno-writable-relocated-rdata
28992 @opindex fwritable-relocated-rdata
28993 This option is available for MinGW and Cygwin targets. It specifies
28994 that relocated-data in read-only section is put into the @code{.data}
28995 section. This is a necessary for older runtimes not supporting
28996 modification of @code{.rdata} sections for pseudo-relocation.
28997
28998 @item -mpe-aligned-commons
28999 @opindex mpe-aligned-commons
29000 This option is available for Cygwin and MinGW targets. It
29001 specifies that the GNU extension to the PE file format that
29002 permits the correct alignment of COMMON variables should be
29003 used when generating code. It is enabled by default if
29004 GCC detects that the target assembler found during configuration
29005 supports the feature.
29006 @end table
29007
29008 See also under @ref{x86 Options} for standard options.
29009
29010 @node Xstormy16 Options
29011 @subsection Xstormy16 Options
29012 @cindex Xstormy16 Options
29013
29014 These options are defined for Xstormy16:
29015
29016 @table @gcctabopt
29017 @item -msim
29018 @opindex msim
29019 Choose startup files and linker script suitable for the simulator.
29020 @end table
29021
29022 @node Xtensa Options
29023 @subsection Xtensa Options
29024 @cindex Xtensa Options
29025
29026 These options are supported for Xtensa targets:
29027
29028 @table @gcctabopt
29029 @item -mconst16
29030 @itemx -mno-const16
29031 @opindex mconst16
29032 @opindex mno-const16
29033 Enable or disable use of @code{CONST16} instructions for loading
29034 constant values. The @code{CONST16} instruction is currently not a
29035 standard option from Tensilica. When enabled, @code{CONST16}
29036 instructions are always used in place of the standard @code{L32R}
29037 instructions. The use of @code{CONST16} is enabled by default only if
29038 the @code{L32R} instruction is not available.
29039
29040 @item -mfused-madd
29041 @itemx -mno-fused-madd
29042 @opindex mfused-madd
29043 @opindex mno-fused-madd
29044 Enable or disable use of fused multiply/add and multiply/subtract
29045 instructions in the floating-point option. This has no effect if the
29046 floating-point option is not also enabled. Disabling fused multiply/add
29047 and multiply/subtract instructions forces the compiler to use separate
29048 instructions for the multiply and add/subtract operations. This may be
29049 desirable in some cases where strict IEEE 754-compliant results are
29050 required: the fused multiply add/subtract instructions do not round the
29051 intermediate result, thereby producing results with @emph{more} bits of
29052 precision than specified by the IEEE standard. Disabling fused multiply
29053 add/subtract instructions also ensures that the program output is not
29054 sensitive to the compiler's ability to combine multiply and add/subtract
29055 operations.
29056
29057 @item -mserialize-volatile
29058 @itemx -mno-serialize-volatile
29059 @opindex mserialize-volatile
29060 @opindex mno-serialize-volatile
29061 When this option is enabled, GCC inserts @code{MEMW} instructions before
29062 @code{volatile} memory references to guarantee sequential consistency.
29063 The default is @option{-mserialize-volatile}. Use
29064 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29065
29066 @item -mforce-no-pic
29067 @opindex mforce-no-pic
29068 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29069 position-independent code (PIC), this option disables PIC for compiling
29070 kernel code.
29071
29072 @item -mtext-section-literals
29073 @itemx -mno-text-section-literals
29074 @opindex mtext-section-literals
29075 @opindex mno-text-section-literals
29076 These options control the treatment of literal pools. The default is
29077 @option{-mno-text-section-literals}, which places literals in a separate
29078 section in the output file. This allows the literal pool to be placed
29079 in a data RAM/ROM, and it also allows the linker to combine literal
29080 pools from separate object files to remove redundant literals and
29081 improve code size. With @option{-mtext-section-literals}, the literals
29082 are interspersed in the text section in order to keep them as close as
29083 possible to their references. This may be necessary for large assembly
29084 files. Literals for each function are placed right before that function.
29085
29086 @item -mauto-litpools
29087 @itemx -mno-auto-litpools
29088 @opindex mauto-litpools
29089 @opindex mno-auto-litpools
29090 These options control the treatment of literal pools. The default is
29091 @option{-mno-auto-litpools}, which places literals in a separate
29092 section in the output file unless @option{-mtext-section-literals} is
29093 used. With @option{-mauto-litpools} the literals are interspersed in
29094 the text section by the assembler. Compiler does not produce explicit
29095 @code{.literal} directives and loads literals into registers with
29096 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29097 do relaxation and place literals as necessary. This option allows
29098 assembler to create several literal pools per function and assemble
29099 very big functions, which may not be possible with
29100 @option{-mtext-section-literals}.
29101
29102 @item -mtarget-align
29103 @itemx -mno-target-align
29104 @opindex mtarget-align
29105 @opindex mno-target-align
29106 When this option is enabled, GCC instructs the assembler to
29107 automatically align instructions to reduce branch penalties at the
29108 expense of some code density. The assembler attempts to widen density
29109 instructions to align branch targets and the instructions following call
29110 instructions. If there are not enough preceding safe density
29111 instructions to align a target, no widening is performed. The
29112 default is @option{-mtarget-align}. These options do not affect the
29113 treatment of auto-aligned instructions like @code{LOOP}, which the
29114 assembler always aligns, either by widening density instructions or
29115 by inserting NOP instructions.
29116
29117 @item -mlongcalls
29118 @itemx -mno-longcalls
29119 @opindex mlongcalls
29120 @opindex mno-longcalls
29121 When this option is enabled, GCC instructs the assembler to translate
29122 direct calls to indirect calls unless it can determine that the target
29123 of a direct call is in the range allowed by the call instruction. This
29124 translation typically occurs for calls to functions in other source
29125 files. Specifically, the assembler translates a direct @code{CALL}
29126 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29127 The default is @option{-mno-longcalls}. This option should be used in
29128 programs where the call target can potentially be out of range. This
29129 option is implemented in the assembler, not the compiler, so the
29130 assembly code generated by GCC still shows direct call
29131 instructions---look at the disassembled object code to see the actual
29132 instructions. Note that the assembler uses an indirect call for
29133 every cross-file call, not just those that really are out of range.
29134 @end table
29135
29136 @node zSeries Options
29137 @subsection zSeries Options
29138 @cindex zSeries options
29139
29140 These are listed under @xref{S/390 and zSeries Options}.
29141
29142
29143 @c man end
29144
29145 @node Spec Files
29146 @section Specifying Subprocesses and the Switches to Pass to Them
29147 @cindex Spec Files
29148
29149 @command{gcc} is a driver program. It performs its job by invoking a
29150 sequence of other programs to do the work of compiling, assembling and
29151 linking. GCC interprets its command-line parameters and uses these to
29152 deduce which programs it should invoke, and which command-line options
29153 it ought to place on their command lines. This behavior is controlled
29154 by @dfn{spec strings}. In most cases there is one spec string for each
29155 program that GCC can invoke, but a few programs have multiple spec
29156 strings to control their behavior. The spec strings built into GCC can
29157 be overridden by using the @option{-specs=} command-line switch to specify
29158 a spec file.
29159
29160 @dfn{Spec files} are plain-text files that are used to construct spec
29161 strings. They consist of a sequence of directives separated by blank
29162 lines. The type of directive is determined by the first non-whitespace
29163 character on the line, which can be one of the following:
29164
29165 @table @code
29166 @item %@var{command}
29167 Issues a @var{command} to the spec file processor. The commands that can
29168 appear here are:
29169
29170 @table @code
29171 @item %include <@var{file}>
29172 @cindex @code{%include}
29173 Search for @var{file} and insert its text at the current point in the
29174 specs file.
29175
29176 @item %include_noerr <@var{file}>
29177 @cindex @code{%include_noerr}
29178 Just like @samp{%include}, but do not generate an error message if the include
29179 file cannot be found.
29180
29181 @item %rename @var{old_name} @var{new_name}
29182 @cindex @code{%rename}
29183 Rename the spec string @var{old_name} to @var{new_name}.
29184
29185 @end table
29186
29187 @item *[@var{spec_name}]:
29188 This tells the compiler to create, override or delete the named spec
29189 string. All lines after this directive up to the next directive or
29190 blank line are considered to be the text for the spec string. If this
29191 results in an empty string then the spec is deleted. (Or, if the
29192 spec did not exist, then nothing happens.) Otherwise, if the spec
29193 does not currently exist a new spec is created. If the spec does
29194 exist then its contents are overridden by the text of this
29195 directive, unless the first character of that text is the @samp{+}
29196 character, in which case the text is appended to the spec.
29197
29198 @item [@var{suffix}]:
29199 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29200 and up to the next directive or blank line are considered to make up the
29201 spec string for the indicated suffix. When the compiler encounters an
29202 input file with the named suffix, it processes the spec string in
29203 order to work out how to compile that file. For example:
29204
29205 @smallexample
29206 .ZZ:
29207 z-compile -input %i
29208 @end smallexample
29209
29210 This says that any input file whose name ends in @samp{.ZZ} should be
29211 passed to the program @samp{z-compile}, which should be invoked with the
29212 command-line switch @option{-input} and with the result of performing the
29213 @samp{%i} substitution. (See below.)
29214
29215 As an alternative to providing a spec string, the text following a
29216 suffix directive can be one of the following:
29217
29218 @table @code
29219 @item @@@var{language}
29220 This says that the suffix is an alias for a known @var{language}. This is
29221 similar to using the @option{-x} command-line switch to GCC to specify a
29222 language explicitly. For example:
29223
29224 @smallexample
29225 .ZZ:
29226 @@c++
29227 @end smallexample
29228
29229 Says that .ZZ files are, in fact, C++ source files.
29230
29231 @item #@var{name}
29232 This causes an error messages saying:
29233
29234 @smallexample
29235 @var{name} compiler not installed on this system.
29236 @end smallexample
29237 @end table
29238
29239 GCC already has an extensive list of suffixes built into it.
29240 This directive adds an entry to the end of the list of suffixes, but
29241 since the list is searched from the end backwards, it is effectively
29242 possible to override earlier entries using this technique.
29243
29244 @end table
29245
29246 GCC has the following spec strings built into it. Spec files can
29247 override these strings or create their own. Note that individual
29248 targets can also add their own spec strings to this list.
29249
29250 @smallexample
29251 asm Options to pass to the assembler
29252 asm_final Options to pass to the assembler post-processor
29253 cpp Options to pass to the C preprocessor
29254 cc1 Options to pass to the C compiler
29255 cc1plus Options to pass to the C++ compiler
29256 endfile Object files to include at the end of the link
29257 link Options to pass to the linker
29258 lib Libraries to include on the command line to the linker
29259 libgcc Decides which GCC support library to pass to the linker
29260 linker Sets the name of the linker
29261 predefines Defines to be passed to the C preprocessor
29262 signed_char Defines to pass to CPP to say whether @code{char} is signed
29263 by default
29264 startfile Object files to include at the start of the link
29265 @end smallexample
29266
29267 Here is a small example of a spec file:
29268
29269 @smallexample
29270 %rename lib old_lib
29271
29272 *lib:
29273 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29274 @end smallexample
29275
29276 This example renames the spec called @samp{lib} to @samp{old_lib} and
29277 then overrides the previous definition of @samp{lib} with a new one.
29278 The new definition adds in some extra command-line options before
29279 including the text of the old definition.
29280
29281 @dfn{Spec strings} are a list of command-line options to be passed to their
29282 corresponding program. In addition, the spec strings can contain
29283 @samp{%}-prefixed sequences to substitute variable text or to
29284 conditionally insert text into the command line. Using these constructs
29285 it is possible to generate quite complex command lines.
29286
29287 Here is a table of all defined @samp{%}-sequences for spec
29288 strings. Note that spaces are not generated automatically around the
29289 results of expanding these sequences. Therefore you can concatenate them
29290 together or combine them with constant text in a single argument.
29291
29292 @table @code
29293 @item %%
29294 Substitute one @samp{%} into the program name or argument.
29295
29296 @item %i
29297 Substitute the name of the input file being processed.
29298
29299 @item %b
29300 Substitute the basename of the input file being processed.
29301 This is the substring up to (and not including) the last period
29302 and not including the directory.
29303
29304 @item %B
29305 This is the same as @samp{%b}, but include the file suffix (text after
29306 the last period).
29307
29308 @item %d
29309 Marks the argument containing or following the @samp{%d} as a
29310 temporary file name, so that that file is deleted if GCC exits
29311 successfully. Unlike @samp{%g}, this contributes no text to the
29312 argument.
29313
29314 @item %g@var{suffix}
29315 Substitute a file name that has suffix @var{suffix} and is chosen
29316 once per compilation, and mark the argument in the same way as
29317 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29318 name is now chosen in a way that is hard to predict even when previously
29319 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29320 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29321 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29322 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29323 was simply substituted with a file name chosen once per compilation,
29324 without regard to any appended suffix (which was therefore treated
29325 just like ordinary text), making such attacks more likely to succeed.
29326
29327 @item %u@var{suffix}
29328 Like @samp{%g}, but generates a new temporary file name
29329 each time it appears instead of once per compilation.
29330
29331 @item %U@var{suffix}
29332 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29333 new one if there is no such last file name. In the absence of any
29334 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29335 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29336 involves the generation of two distinct file names, one
29337 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29338 simply substituted with a file name chosen for the previous @samp{%u},
29339 without regard to any appended suffix.
29340
29341 @item %j@var{suffix}
29342 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29343 writable, and if @option{-save-temps} is not used;
29344 otherwise, substitute the name
29345 of a temporary file, just like @samp{%u}. This temporary file is not
29346 meant for communication between processes, but rather as a junk
29347 disposal mechanism.
29348
29349 @item %|@var{suffix}
29350 @itemx %m@var{suffix}
29351 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29352 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29353 all. These are the two most common ways to instruct a program that it
29354 should read from standard input or write to standard output. If you
29355 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29356 construct: see for example @file{f/lang-specs.h}.
29357
29358 @item %.@var{SUFFIX}
29359 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29360 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29361 terminated by the next space or %.
29362
29363 @item %w
29364 Marks the argument containing or following the @samp{%w} as the
29365 designated output file of this compilation. This puts the argument
29366 into the sequence of arguments that @samp{%o} substitutes.
29367
29368 @item %o
29369 Substitutes the names of all the output files, with spaces
29370 automatically placed around them. You should write spaces
29371 around the @samp{%o} as well or the results are undefined.
29372 @samp{%o} is for use in the specs for running the linker.
29373 Input files whose names have no recognized suffix are not compiled
29374 at all, but they are included among the output files, so they are
29375 linked.
29376
29377 @item %O
29378 Substitutes the suffix for object files. Note that this is
29379 handled specially when it immediately follows @samp{%g, %u, or %U},
29380 because of the need for those to form complete file names. The
29381 handling is such that @samp{%O} is treated exactly as if it had already
29382 been substituted, except that @samp{%g, %u, and %U} do not currently
29383 support additional @var{suffix} characters following @samp{%O} as they do
29384 following, for example, @samp{.o}.
29385
29386 @item %p
29387 Substitutes the standard macro predefinitions for the
29388 current target machine. Use this when running @command{cpp}.
29389
29390 @item %P
29391 Like @samp{%p}, but puts @samp{__} before and after the name of each
29392 predefined macro, except for macros that start with @samp{__} or with
29393 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29394 C@.
29395
29396 @item %I
29397 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29398 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29399 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29400 and @option{-imultilib} as necessary.
29401
29402 @item %s
29403 Current argument is the name of a library or startup file of some sort.
29404 Search for that file in a standard list of directories and substitute
29405 the full name found. The current working directory is included in the
29406 list of directories scanned.
29407
29408 @item %T
29409 Current argument is the name of a linker script. Search for that file
29410 in the current list of directories to scan for libraries. If the file
29411 is located insert a @option{--script} option into the command line
29412 followed by the full path name found. If the file is not found then
29413 generate an error message. Note: the current working directory is not
29414 searched.
29415
29416 @item %e@var{str}
29417 Print @var{str} as an error message. @var{str} is terminated by a newline.
29418 Use this when inconsistent options are detected.
29419
29420 @item %(@var{name})
29421 Substitute the contents of spec string @var{name} at this point.
29422
29423 @item %x@{@var{option}@}
29424 Accumulate an option for @samp{%X}.
29425
29426 @item %X
29427 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29428 spec string.
29429
29430 @item %Y
29431 Output the accumulated assembler options specified by @option{-Wa}.
29432
29433 @item %Z
29434 Output the accumulated preprocessor options specified by @option{-Wp}.
29435
29436 @item %a
29437 Process the @code{asm} spec. This is used to compute the
29438 switches to be passed to the assembler.
29439
29440 @item %A
29441 Process the @code{asm_final} spec. This is a spec string for
29442 passing switches to an assembler post-processor, if such a program is
29443 needed.
29444
29445 @item %l
29446 Process the @code{link} spec. This is the spec for computing the
29447 command line passed to the linker. Typically it makes use of the
29448 @samp{%L %G %S %D and %E} sequences.
29449
29450 @item %D
29451 Dump out a @option{-L} option for each directory that GCC believes might
29452 contain startup files. If the target supports multilibs then the
29453 current multilib directory is prepended to each of these paths.
29454
29455 @item %L
29456 Process the @code{lib} spec. This is a spec string for deciding which
29457 libraries are included on the command line to the linker.
29458
29459 @item %G
29460 Process the @code{libgcc} spec. This is a spec string for deciding
29461 which GCC support library is included on the command line to the linker.
29462
29463 @item %S
29464 Process the @code{startfile} spec. This is a spec for deciding which
29465 object files are the first ones passed to the linker. Typically
29466 this might be a file named @file{crt0.o}.
29467
29468 @item %E
29469 Process the @code{endfile} spec. This is a spec string that specifies
29470 the last object files that are passed to the linker.
29471
29472 @item %C
29473 Process the @code{cpp} spec. This is used to construct the arguments
29474 to be passed to the C preprocessor.
29475
29476 @item %1
29477 Process the @code{cc1} spec. This is used to construct the options to be
29478 passed to the actual C compiler (@command{cc1}).
29479
29480 @item %2
29481 Process the @code{cc1plus} spec. This is used to construct the options to be
29482 passed to the actual C++ compiler (@command{cc1plus}).
29483
29484 @item %*
29485 Substitute the variable part of a matched option. See below.
29486 Note that each comma in the substituted string is replaced by
29487 a single space.
29488
29489 @item %<S
29490 Remove all occurrences of @code{-S} from the command line. Note---this
29491 command is position dependent. @samp{%} commands in the spec string
29492 before this one see @code{-S}, @samp{%} commands in the spec string
29493 after this one do not.
29494
29495 @item %:@var{function}(@var{args})
29496 Call the named function @var{function}, passing it @var{args}.
29497 @var{args} is first processed as a nested spec string, then split
29498 into an argument vector in the usual fashion. The function returns
29499 a string which is processed as if it had appeared literally as part
29500 of the current spec.
29501
29502 The following built-in spec functions are provided:
29503
29504 @table @code
29505 @item @code{getenv}
29506 The @code{getenv} spec function takes two arguments: an environment
29507 variable name and a string. If the environment variable is not
29508 defined, a fatal error is issued. Otherwise, the return value is the
29509 value of the environment variable concatenated with the string. For
29510 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29511
29512 @smallexample
29513 %:getenv(TOPDIR /include)
29514 @end smallexample
29515
29516 expands to @file{/path/to/top/include}.
29517
29518 @item @code{if-exists}
29519 The @code{if-exists} spec function takes one argument, an absolute
29520 pathname to a file. If the file exists, @code{if-exists} returns the
29521 pathname. Here is a small example of its usage:
29522
29523 @smallexample
29524 *startfile:
29525 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29526 @end smallexample
29527
29528 @item @code{if-exists-else}
29529 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29530 spec function, except that it takes two arguments. The first argument is
29531 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29532 returns the pathname. If it does not exist, it returns the second argument.
29533 This way, @code{if-exists-else} can be used to select one file or another,
29534 based on the existence of the first. Here is a small example of its usage:
29535
29536 @smallexample
29537 *startfile:
29538 crt0%O%s %:if-exists(crti%O%s) \
29539 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29540 @end smallexample
29541
29542 @item @code{replace-outfile}
29543 The @code{replace-outfile} spec function takes two arguments. It looks for the
29544 first argument in the outfiles array and replaces it with the second argument. Here
29545 is a small example of its usage:
29546
29547 @smallexample
29548 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29549 @end smallexample
29550
29551 @item @code{remove-outfile}
29552 The @code{remove-outfile} spec function takes one argument. It looks for the
29553 first argument in the outfiles array and removes it. Here is a small example
29554 its usage:
29555
29556 @smallexample
29557 %:remove-outfile(-lm)
29558 @end smallexample
29559
29560 @item @code{pass-through-libs}
29561 The @code{pass-through-libs} spec function takes any number of arguments. It
29562 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29563 assumes are the names of linker input library archive files) and returns a
29564 result containing all the found arguments each prepended by
29565 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29566 intended to be passed to the LTO linker plugin.
29567
29568 @smallexample
29569 %:pass-through-libs(%G %L %G)
29570 @end smallexample
29571
29572 @item @code{print-asm-header}
29573 The @code{print-asm-header} function takes no arguments and simply
29574 prints a banner like:
29575
29576 @smallexample
29577 Assembler options
29578 =================
29579
29580 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29581 @end smallexample
29582
29583 It is used to separate compiler options from assembler options
29584 in the @option{--target-help} output.
29585 @end table
29586
29587 @item %@{S@}
29588 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29589 If that switch is not specified, this substitutes nothing. Note that
29590 the leading dash is omitted when specifying this option, and it is
29591 automatically inserted if the substitution is performed. Thus the spec
29592 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29593 and outputs the command-line option @option{-foo}.
29594
29595 @item %W@{S@}
29596 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29597 deleted on failure.
29598
29599 @item %@{S*@}
29600 Substitutes all the switches specified to GCC whose names start
29601 with @code{-S}, but which also take an argument. This is used for
29602 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29603 GCC considers @option{-o foo} as being
29604 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29605 text, including the space. Thus two arguments are generated.
29606
29607 @item %@{S*&T*@}
29608 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29609 (the order of @code{S} and @code{T} in the spec is not significant).
29610 There can be any number of ampersand-separated variables; for each the
29611 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29612
29613 @item %@{S:X@}
29614 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29615
29616 @item %@{!S:X@}
29617 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29618
29619 @item %@{S*:X@}
29620 Substitutes @code{X} if one or more switches whose names start with
29621 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29622 once, no matter how many such switches appeared. However, if @code{%*}
29623 appears somewhere in @code{X}, then @code{X} is substituted once
29624 for each matching switch, with the @code{%*} replaced by the part of
29625 that switch matching the @code{*}.
29626
29627 If @code{%*} appears as the last part of a spec sequence then a space
29628 is added after the end of the last substitution. If there is more
29629 text in the sequence, however, then a space is not generated. This
29630 allows the @code{%*} substitution to be used as part of a larger
29631 string. For example, a spec string like this:
29632
29633 @smallexample
29634 %@{mcu=*:--script=%*/memory.ld@}
29635 @end smallexample
29636
29637 @noindent
29638 when matching an option like @option{-mcu=newchip} produces:
29639
29640 @smallexample
29641 --script=newchip/memory.ld
29642 @end smallexample
29643
29644 @item %@{.S:X@}
29645 Substitutes @code{X}, if processing a file with suffix @code{S}.
29646
29647 @item %@{!.S:X@}
29648 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29649
29650 @item %@{,S:X@}
29651 Substitutes @code{X}, if processing a file for language @code{S}.
29652
29653 @item %@{!,S:X@}
29654 Substitutes @code{X}, if not processing a file for language @code{S}.
29655
29656 @item %@{S|P:X@}
29657 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29658 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29659 @code{*} sequences as well, although they have a stronger binding than
29660 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29661 alternatives must be starred, and only the first matching alternative
29662 is substituted.
29663
29664 For example, a spec string like this:
29665
29666 @smallexample
29667 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29668 @end smallexample
29669
29670 @noindent
29671 outputs the following command-line options from the following input
29672 command-line options:
29673
29674 @smallexample
29675 fred.c -foo -baz
29676 jim.d -bar -boggle
29677 -d fred.c -foo -baz -boggle
29678 -d jim.d -bar -baz -boggle
29679 @end smallexample
29680
29681 @item %@{S:X; T:Y; :D@}
29682
29683 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29684 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29685 be as many clauses as you need. This may be combined with @code{.},
29686 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29687
29688
29689 @end table
29690
29691 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29692 or similar construct can use a backslash to ignore the special meaning
29693 of the character following it, thus allowing literal matching of a
29694 character that is otherwise specially treated. For example,
29695 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29696 @option{-std=iso9899:1999} option is given.
29697
29698 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29699 construct may contain other nested @samp{%} constructs or spaces, or
29700 even newlines. They are processed as usual, as described above.
29701 Trailing white space in @code{X} is ignored. White space may also
29702 appear anywhere on the left side of the colon in these constructs,
29703 except between @code{.} or @code{*} and the corresponding word.
29704
29705 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29706 handled specifically in these constructs. If another value of
29707 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29708 @option{-W} switch is found later in the command line, the earlier
29709 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29710 just one letter, which passes all matching options.
29711
29712 The character @samp{|} at the beginning of the predicate text is used to
29713 indicate that a command should be piped to the following command, but
29714 only if @option{-pipe} is specified.
29715
29716 It is built into GCC which switches take arguments and which do not.
29717 (You might think it would be useful to generalize this to allow each
29718 compiler's spec to say which switches take arguments. But this cannot
29719 be done in a consistent fashion. GCC cannot even decide which input
29720 files have been specified without knowing which switches take arguments,
29721 and it must know which input files to compile in order to tell which
29722 compilers to run).
29723
29724 GCC also knows implicitly that arguments starting in @option{-l} are to be
29725 treated as compiler output files, and passed to the linker in their
29726 proper position among the other output files.
29727
29728 @node Environment Variables
29729 @section Environment Variables Affecting GCC
29730 @cindex environment variables
29731
29732 @c man begin ENVIRONMENT
29733 This section describes several environment variables that affect how GCC
29734 operates. Some of them work by specifying directories or prefixes to use
29735 when searching for various kinds of files. Some are used to specify other
29736 aspects of the compilation environment.
29737
29738 Note that you can also specify places to search using options such as
29739 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29740 take precedence over places specified using environment variables, which
29741 in turn take precedence over those specified by the configuration of GCC@.
29742 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29743 GNU Compiler Collection (GCC) Internals}.
29744
29745 @table @env
29746 @item LANG
29747 @itemx LC_CTYPE
29748 @c @itemx LC_COLLATE
29749 @itemx LC_MESSAGES
29750 @c @itemx LC_MONETARY
29751 @c @itemx LC_NUMERIC
29752 @c @itemx LC_TIME
29753 @itemx LC_ALL
29754 @findex LANG
29755 @findex LC_CTYPE
29756 @c @findex LC_COLLATE
29757 @findex LC_MESSAGES
29758 @c @findex LC_MONETARY
29759 @c @findex LC_NUMERIC
29760 @c @findex LC_TIME
29761 @findex LC_ALL
29762 @cindex locale
29763 These environment variables control the way that GCC uses
29764 localization information which allows GCC to work with different
29765 national conventions. GCC inspects the locale categories
29766 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29767 so. These locale categories can be set to any value supported by your
29768 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29769 Kingdom encoded in UTF-8.
29770
29771 The @env{LC_CTYPE} environment variable specifies character
29772 classification. GCC uses it to determine the character boundaries in
29773 a string; this is needed for some multibyte encodings that contain quote
29774 and escape characters that are otherwise interpreted as a string
29775 end or escape.
29776
29777 The @env{LC_MESSAGES} environment variable specifies the language to
29778 use in diagnostic messages.
29779
29780 If the @env{LC_ALL} environment variable is set, it overrides the value
29781 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29782 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29783 environment variable. If none of these variables are set, GCC
29784 defaults to traditional C English behavior.
29785
29786 @item TMPDIR
29787 @findex TMPDIR
29788 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29789 files. GCC uses temporary files to hold the output of one stage of
29790 compilation which is to be used as input to the next stage: for example,
29791 the output of the preprocessor, which is the input to the compiler
29792 proper.
29793
29794 @item GCC_COMPARE_DEBUG
29795 @findex GCC_COMPARE_DEBUG
29796 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29797 @option{-fcompare-debug} to the compiler driver. See the documentation
29798 of this option for more details.
29799
29800 @item GCC_EXEC_PREFIX
29801 @findex GCC_EXEC_PREFIX
29802 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29803 names of the subprograms executed by the compiler. No slash is added
29804 when this prefix is combined with the name of a subprogram, but you can
29805 specify a prefix that ends with a slash if you wish.
29806
29807 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29808 an appropriate prefix to use based on the pathname it is invoked with.
29809
29810 If GCC cannot find the subprogram using the specified prefix, it
29811 tries looking in the usual places for the subprogram.
29812
29813 The default value of @env{GCC_EXEC_PREFIX} is
29814 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29815 the installed compiler. In many cases @var{prefix} is the value
29816 of @code{prefix} when you ran the @file{configure} script.
29817
29818 Other prefixes specified with @option{-B} take precedence over this prefix.
29819
29820 This prefix is also used for finding files such as @file{crt0.o} that are
29821 used for linking.
29822
29823 In addition, the prefix is used in an unusual way in finding the
29824 directories to search for header files. For each of the standard
29825 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29826 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29827 replacing that beginning with the specified prefix to produce an
29828 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29829 @file{foo/bar} just before it searches the standard directory
29830 @file{/usr/local/lib/bar}.
29831 If a standard directory begins with the configured
29832 @var{prefix} then the value of @var{prefix} is replaced by
29833 @env{GCC_EXEC_PREFIX} when looking for header files.
29834
29835 @item COMPILER_PATH
29836 @findex COMPILER_PATH
29837 The value of @env{COMPILER_PATH} is a colon-separated list of
29838 directories, much like @env{PATH}. GCC tries the directories thus
29839 specified when searching for subprograms, if it cannot find the
29840 subprograms using @env{GCC_EXEC_PREFIX}.
29841
29842 @item LIBRARY_PATH
29843 @findex LIBRARY_PATH
29844 The value of @env{LIBRARY_PATH} is a colon-separated list of
29845 directories, much like @env{PATH}. When configured as a native compiler,
29846 GCC tries the directories thus specified when searching for special
29847 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29848 using GCC also uses these directories when searching for ordinary
29849 libraries for the @option{-l} option (but directories specified with
29850 @option{-L} come first).
29851
29852 @item LANG
29853 @findex LANG
29854 @cindex locale definition
29855 This variable is used to pass locale information to the compiler. One way in
29856 which this information is used is to determine the character set to be used
29857 when character literals, string literals and comments are parsed in C and C++.
29858 When the compiler is configured to allow multibyte characters,
29859 the following values for @env{LANG} are recognized:
29860
29861 @table @samp
29862 @item C-JIS
29863 Recognize JIS characters.
29864 @item C-SJIS
29865 Recognize SJIS characters.
29866 @item C-EUCJP
29867 Recognize EUCJP characters.
29868 @end table
29869
29870 If @env{LANG} is not defined, or if it has some other value, then the
29871 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29872 recognize and translate multibyte characters.
29873 @end table
29874
29875 @noindent
29876 Some additional environment variables affect the behavior of the
29877 preprocessor.
29878
29879 @include cppenv.texi
29880
29881 @c man end
29882
29883 @node Precompiled Headers
29884 @section Using Precompiled Headers
29885 @cindex precompiled headers
29886 @cindex speed of compilation
29887
29888 Often large projects have many header files that are included in every
29889 source file. The time the compiler takes to process these header files
29890 over and over again can account for nearly all of the time required to
29891 build the project. To make builds faster, GCC allows you to
29892 @dfn{precompile} a header file.
29893
29894 To create a precompiled header file, simply compile it as you would any
29895 other file, if necessary using the @option{-x} option to make the driver
29896 treat it as a C or C++ header file. You may want to use a
29897 tool like @command{make} to keep the precompiled header up-to-date when
29898 the headers it contains change.
29899
29900 A precompiled header file is searched for when @code{#include} is
29901 seen in the compilation. As it searches for the included file
29902 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29903 compiler looks for a precompiled header in each directory just before it
29904 looks for the include file in that directory. The name searched for is
29905 the name specified in the @code{#include} with @samp{.gch} appended. If
29906 the precompiled header file cannot be used, it is ignored.
29907
29908 For instance, if you have @code{#include "all.h"}, and you have
29909 @file{all.h.gch} in the same directory as @file{all.h}, then the
29910 precompiled header file is used if possible, and the original
29911 header is used otherwise.
29912
29913 Alternatively, you might decide to put the precompiled header file in a
29914 directory and use @option{-I} to ensure that directory is searched
29915 before (or instead of) the directory containing the original header.
29916 Then, if you want to check that the precompiled header file is always
29917 used, you can put a file of the same name as the original header in this
29918 directory containing an @code{#error} command.
29919
29920 This also works with @option{-include}. So yet another way to use
29921 precompiled headers, good for projects not designed with precompiled
29922 header files in mind, is to simply take most of the header files used by
29923 a project, include them from another header file, precompile that header
29924 file, and @option{-include} the precompiled header. If the header files
29925 have guards against multiple inclusion, they are skipped because
29926 they've already been included (in the precompiled header).
29927
29928 If you need to precompile the same header file for different
29929 languages, targets, or compiler options, you can instead make a
29930 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29931 header in the directory, perhaps using @option{-o}. It doesn't matter
29932 what you call the files in the directory; every precompiled header in
29933 the directory is considered. The first precompiled header
29934 encountered in the directory that is valid for this compilation is
29935 used; they're searched in no particular order.
29936
29937 There are many other possibilities, limited only by your imagination,
29938 good sense, and the constraints of your build system.
29939
29940 A precompiled header file can be used only when these conditions apply:
29941
29942 @itemize
29943 @item
29944 Only one precompiled header can be used in a particular compilation.
29945
29946 @item
29947 A precompiled header cannot be used once the first C token is seen. You
29948 can have preprocessor directives before a precompiled header; you cannot
29949 include a precompiled header from inside another header.
29950
29951 @item
29952 The precompiled header file must be produced for the same language as
29953 the current compilation. You cannot use a C precompiled header for a C++
29954 compilation.
29955
29956 @item
29957 The precompiled header file must have been produced by the same compiler
29958 binary as the current compilation is using.
29959
29960 @item
29961 Any macros defined before the precompiled header is included must
29962 either be defined in the same way as when the precompiled header was
29963 generated, or must not affect the precompiled header, which usually
29964 means that they don't appear in the precompiled header at all.
29965
29966 The @option{-D} option is one way to define a macro before a
29967 precompiled header is included; using a @code{#define} can also do it.
29968 There are also some options that define macros implicitly, like
29969 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29970 defined this way.
29971
29972 @item If debugging information is output when using the precompiled
29973 header, using @option{-g} or similar, the same kind of debugging information
29974 must have been output when building the precompiled header. However,
29975 a precompiled header built using @option{-g} can be used in a compilation
29976 when no debugging information is being output.
29977
29978 @item The same @option{-m} options must generally be used when building
29979 and using the precompiled header. @xref{Submodel Options},
29980 for any cases where this rule is relaxed.
29981
29982 @item Each of the following options must be the same when building and using
29983 the precompiled header:
29984
29985 @gccoptlist{-fexceptions}
29986
29987 @item
29988 Some other command-line options starting with @option{-f},
29989 @option{-p}, or @option{-O} must be defined in the same way as when
29990 the precompiled header was generated. At present, it's not clear
29991 which options are safe to change and which are not; the safest choice
29992 is to use exactly the same options when generating and using the
29993 precompiled header. The following are known to be safe:
29994
29995 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29996 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29997 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29998 -pedantic-errors}
29999
30000 @end itemize
30001
30002 For all of these except the last, the compiler automatically
30003 ignores the precompiled header if the conditions aren't met. If you
30004 find an option combination that doesn't work and doesn't cause the
30005 precompiled header to be ignored, please consider filing a bug report,
30006 see @ref{Bugs}.
30007
30008 If you do use differing options when generating and using the
30009 precompiled header, the actual behavior is a mixture of the
30010 behavior for the options. For instance, if you use @option{-g} to
30011 generate the precompiled header but not when using it, you may or may
30012 not get debugging information for routines in the precompiled header.