[arm][1/2] Remove support for deprecated -march=armv5 and armv5e
[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 @c man end
125
126 @xref{Option Index}, for an index to GCC's options.
127
128 @menu
129 * Option Summary:: Brief list of all options, without explanations.
130 * Overall Options:: Controlling the kind of output:
131 an executable, object files, assembler files,
132 or preprocessed source.
133 * Invoking G++:: Compiling C++ programs.
134 * C Dialect Options:: Controlling the variant of C language compiled.
135 * C++ Dialect Options:: Variations on C++.
136 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
137 and Objective-C++.
138 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
139 be formatted.
140 * Warning Options:: How picky should the compiler be?
141 * Debugging Options:: Producing debuggable code.
142 * Optimize Options:: How much optimization?
143 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
144 * Preprocessor Options:: Controlling header files and macro definitions.
145 Also, getting dependency information for Make.
146 * Assembler Options:: Passing options to the assembler.
147 * Link Options:: Specifying libraries and so on.
148 * Directory Options:: Where to find header files and libraries.
149 Where to find the compiler executable files.
150 * Code Gen Options:: Specifying conventions for function calls, data layout
151 and register usage.
152 * Developer Options:: Printing GCC configuration info, statistics, and
153 debugging dumps.
154 * Submodel Options:: Target-specific options, such as compiling for a
155 specific processor variant.
156 * Spec Files:: How to pass switches to sub-processes.
157 * Environment Variables:: Env vars that affect GCC.
158 * Precompiled Headers:: Compiling a header once, and using it many times.
159 @end menu
160
161 @c man begin OPTIONS
162
163 @node Option Summary
164 @section Option Summary
165
166 Here is a summary of all the options, grouped by type. Explanations are
167 in the following sections.
168
169 @table @emph
170 @item Overall Options
171 @xref{Overall Options,,Options Controlling the Kind of Output}.
172 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
173 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
174 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
175 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
176 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
177 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
178
179 @item C Language Options
180 @xref{C Dialect Options,,Options Controlling C Dialect}.
181 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
182 -fpermitted-flt-eval-methods=@var{standard} @gol
183 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
184 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
185 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
186 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
187 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
188 -fsigned-bitfields -fsigned-char @gol
189 -funsigned-bitfields -funsigned-char}
190
191 @item C++ Language Options
192 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
193 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
194 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
195 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -fnew-inheriting-ctors @gol
203 -fnew-ttp-matching @gol
204 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
205 -fno-optional-diags -fpermissive @gol
206 -fno-pretty-templates @gol
207 -frepo -fno-rtti -fsized-deallocation @gol
208 -ftemplate-backtrace-limit=@var{n} @gol
209 -ftemplate-depth=@var{n} @gol
210 -fno-threadsafe-statics -fuse-cxa-atexit @gol
211 -fno-weak -nostdinc++ @gol
212 -fvisibility-inlines-hidden @gol
213 -fvisibility-ms-compat @gol
214 -fext-numeric-literals @gol
215 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
216 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
217 -Wnamespaces -Wnarrowing @gol
218 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
219 -Wnon-virtual-dtor -Wreorder -Wregister @gol
220 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
221 -Wno-non-template-friend -Wold-style-cast @gol
222 -Woverloaded-virtual -Wno-pmf-conversions @gol
223 -Wsign-promo -Wvirtual-inheritance}
224
225 @item Objective-C and Objective-C++ Language Options
226 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
227 Objective-C and Objective-C++ Dialects}.
228 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
229 -fgnu-runtime -fnext-runtime @gol
230 -fno-nil-receivers @gol
231 -fobjc-abi-version=@var{n} @gol
232 -fobjc-call-cxx-cdtors @gol
233 -fobjc-direct-dispatch @gol
234 -fobjc-exceptions @gol
235 -fobjc-gc @gol
236 -fobjc-nilcheck @gol
237 -fobjc-std=objc1 @gol
238 -fno-local-ivars @gol
239 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
240 -freplace-objc-classes @gol
241 -fzero-link @gol
242 -gen-decls @gol
243 -Wassign-intercept @gol
244 -Wno-protocol -Wselector @gol
245 -Wstrict-selector-match @gol
246 -Wundeclared-selector}
247
248 @item Diagnostic Message Formatting Options
249 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
250 @gccoptlist{-fmessage-length=@var{n} @gol
251 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
252 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
253 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
254 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
255 -fdiagnostics-show-template-tree -fno-elide-type @gol
256 -fno-show-column}
257
258 @item Warning Options
259 @xref{Warning Options,,Options to Request or Suppress Warnings}.
260 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
261 -pedantic-errors @gol
262 -w -Wextra -Wall -Waddress -Waggregate-return @gol
263 -Walloc-zero -Walloc-size-larger-than=@var{n}
264 -Walloca -Walloca-larger-than=@var{n} @gol
265 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
266 -Wno-attributes -Wbool-compare -Wbool-operation @gol
267 -Wno-builtin-declaration-mismatch @gol
268 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
269 -Wc++-compat -Wc++11-compat -Wc++14-compat @gol
270 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
271 -Wchar-subscripts -Wchkp -Wcatch-value -Wcatch-value=@var{n} @gol
272 -Wclobbered -Wcomment -Wconditionally-supported @gol
273 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
274 -Wdelete-incomplete @gol
275 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
276 -Wdisabled-optimization @gol
277 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
278 -Wno-div-by-zero -Wdouble-promotion @gol
279 -Wduplicated-branches -Wduplicated-cond @gol
280 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
281 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
282 -Wfloat-equal -Wformat -Wformat=2 @gol
283 -Wno-format-contains-nul -Wno-format-extra-args @gol
284 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
285 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
286 -Wformat-y2k -Wframe-address @gol
287 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
288 -Wif-not-aligned @gol
289 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
290 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
291 -Wimplicit-function-declaration -Wimplicit-int @gol
292 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
293 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
294 -Winvalid-pch -Wlarger-than=@var{len} @gol
295 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
296 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
297 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
298 -Wmissing-field-initializers -Wmissing-include-dirs @gol
299 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
300 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
301 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
302 -Woverride-init-side-effects -Woverlength-strings @gol
303 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
304 -Wparentheses -Wno-pedantic-ms-format @gol
305 -Wplacement-new -Wplacement-new=@var{n} @gol
306 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
307 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
308 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
309 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
310 -Wshift-overflow -Wshift-overflow=@var{n} @gol
311 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
312 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
313 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
314 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
315 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
316 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
317 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
318 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
319 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
320 -Wmissing-format-attribute -Wsubobject-linkage @gol
321 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
322 -Wswitch-unreachable -Wsync-nand @gol
323 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
324 -Wtype-limits -Wundef @gol
325 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
326 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
327 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
328 -Wunused-parameter -Wno-unused-result @gol
329 -Wunused-value -Wunused-variable @gol
330 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
331 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
332 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
333 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
334 -Wzero-as-null-pointer-constant -Whsa}
335
336 @item C and Objective-C-only Warning Options
337 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
338 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
339 -Wold-style-declaration -Wold-style-definition @gol
340 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
341 -Wdeclaration-after-statement -Wpointer-sign}
342
343 @item Debugging Options
344 @xref{Debugging Options,,Options for Debugging Your Program}.
345 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
346 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
347 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
348 -gas-loc-support -gno-as-loc-support @gol
349 -gas-locview-support -gno-as-locview-support @gol
350 -gcolumn-info -gno-column-info @gol
351 -gstatement-frontiers -gno-statement-frontiers @gol
352 -gvariable-location-views -gno-variable-location-views @gol
353 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
354 -ginline-points -gno-inline-points @gol
355 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
356 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
357 -fno-eliminate-unused-debug-types @gol
358 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
359 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
360 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
361 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
362 -fvar-tracking -fvar-tracking-assignments}
363
364 @item Optimization Options
365 @xref{Optimize Options,,Options that Control Optimization}.
366 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
367 -falign-jumps[=@var{n}] @gol
368 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
369 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
370 -fauto-inc-dec -fbranch-probabilities @gol
371 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
372 -fbtr-bb-exclusive -fcaller-saves @gol
373 -fcombine-stack-adjustments -fconserve-stack @gol
374 -fcompare-elim -fcprop-registers -fcrossjumping @gol
375 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
376 -fcx-limited-range @gol
377 -fdata-sections -fdce -fdelayed-branch @gol
378 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
379 -fdevirtualize-at-ltrans -fdse @gol
380 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
381 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
382 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
383 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
384 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
385 -fif-conversion2 -findirect-inlining @gol
386 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
387 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
388 -fipa-bit-cp -fipa-vrp @gol
389 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
390 -fira-algorithm=@var{algorithm} @gol
391 -fira-region=@var{region} -fira-hoist-pressure @gol
392 -fira-loop-pressure -fno-ira-share-save-slots @gol
393 -fno-ira-share-spill-slots @gol
394 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
395 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
396 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
397 -floop-block -floop-interchange -floop-strip-mine @gol
398 -floop-unroll-and-jam -floop-nest-optimize @gol
399 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
400 -flto-partition=@var{alg} -fmerge-all-constants @gol
401 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
402 -fmove-loop-invariants -fno-branch-count-reg @gol
403 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
404 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
405 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
406 -fno-sched-spec -fno-signed-zeros @gol
407 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
408 -fomit-frame-pointer -foptimize-sibling-calls @gol
409 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
410 -fprefetch-loop-arrays @gol
411 -fprofile-correction @gol
412 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
413 -fprofile-reorder-functions @gol
414 -freciprocal-math -free -frename-registers -freorder-blocks @gol
415 -freorder-blocks-algorithm=@var{algorithm} @gol
416 -freorder-blocks-and-partition -freorder-functions @gol
417 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
418 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
419 -fsched-spec-load -fsched-spec-load-dangerous @gol
420 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
421 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
422 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
423 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
424 -fschedule-fusion @gol
425 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
426 -fselective-scheduling -fselective-scheduling2 @gol
427 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
428 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
429 -fsignaling-nans @gol
430 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
431 -fsplit-paths @gol
432 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
433 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
434 -fthread-jumps -ftracer -ftree-bit-ccp @gol
435 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
436 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
437 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
438 -ftree-loop-if-convert -ftree-loop-im @gol
439 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
440 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
441 -ftree-loop-vectorize @gol
442 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
443 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
444 -ftree-switch-conversion -ftree-tail-merge @gol
445 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
446 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
447 -funsafe-math-optimizations -funswitch-loops @gol
448 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
449 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
450 --param @var{name}=@var{value}
451 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
452
453 @item Program Instrumentation Options
454 @xref{Instrumentation Options,,Program Instrumentation Options}.
455 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
456 -fprofile-abs-path @gol
457 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
458 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
459 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
460 -fsanitize-undefined-trap-on-error -fbounds-check @gol
461 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
462 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
463 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
464 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
465 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
466 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
467 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
468 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
469 -fchkp-use-wrappers -fchkp-flexible-struct-trailing-arrays@gol
470 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
471 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
472 -fstack-protector-explicit -fstack-check @gol
473 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
474 -fno-stack-limit -fsplit-stack @gol
475 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
476 -fvtv-counts -fvtv-debug @gol
477 -finstrument-functions @gol
478 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
479 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
480
481 @item Preprocessor Options
482 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
483 @gccoptlist{-A@var{question}=@var{answer} @gol
484 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
485 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
486 -dD -dI -dM -dN -dU @gol
487 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
488 -fexec-charset=@var{charset} -fextended-identifiers @gol
489 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
490 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
491 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
492 -fwide-exec-charset=@var{charset} -fworking-directory @gol
493 -H -imacros @var{file} -include @var{file} @gol
494 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
495 -no-integrated-cpp -P -pthread -remap @gol
496 -traditional -traditional-cpp -trigraphs @gol
497 -U@var{macro} -undef @gol
498 -Wp,@var{option} -Xpreprocessor @var{option}}
499
500 @item Assembler Options
501 @xref{Assembler Options,,Passing Options to the Assembler}.
502 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
503
504 @item Linker Options
505 @xref{Link Options,,Options for Linking}.
506 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
507 -nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol
508 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
509 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
510 -static-libmpx -static-libmpxwrappers @gol
511 -shared -shared-libgcc -symbolic @gol
512 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
513 -u @var{symbol} -z @var{keyword}}
514
515 @item Directory Options
516 @xref{Directory Options,,Options for Directory Search}.
517 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
518 -idirafter @var{dir} @gol
519 -imacros @var{file} -imultilib @var{dir} @gol
520 -iplugindir=@var{dir} -iprefix @var{file} @gol
521 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
522 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
523 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
524 -nostdinc -nostdinc++ --sysroot=@var{dir}}
525
526 @item Code Generation Options
527 @xref{Code Gen Options,,Options for Code Generation Conventions}.
528 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
529 -ffixed-@var{reg} -fexceptions @gol
530 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
531 -fasynchronous-unwind-tables @gol
532 -fno-gnu-unique @gol
533 -finhibit-size-directive -fno-common -fno-ident @gol
534 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
535 -fno-jump-tables @gol
536 -frecord-gcc-switches @gol
537 -freg-struct-return -fshort-enums -fshort-wchar @gol
538 -fverbose-asm -fpack-struct[=@var{n}] @gol
539 -fleading-underscore -ftls-model=@var{model} @gol
540 -fstack-reuse=@var{reuse_level} @gol
541 -ftrampolines -ftrapv -fwrapv @gol
542 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
543 -fstrict-volatile-bitfields -fsync-libcalls}
544
545 @item Developer Options
546 @xref{Developer Options,,GCC Developer Options}.
547 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
548 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
549 -fdbg-cnt=@var{counter-value-list} @gol
550 -fdisable-ipa-@var{pass_name} @gol
551 -fdisable-rtl-@var{pass_name} @gol
552 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
553 -fdisable-tree-@var{pass_name} @gol
554 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
555 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
556 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
557 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
558 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
559 -fdump-lang-all @gol
560 -fdump-lang-@var{switch} @gol
561 -fdump-lang-@var{switch}-@var{options} @gol
562 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
563 -fdump-passes @gol
564 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
565 -fdump-statistics @gol
566 -fdump-tree-all @gol
567 -fdump-tree-@var{switch} @gol
568 -fdump-tree-@var{switch}-@var{options} @gol
569 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
570 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
571 -fenable-@var{kind}-@var{pass} @gol
572 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
573 -fira-verbose=@var{n} @gol
574 -flto-report -flto-report-wpa -fmem-report-wpa @gol
575 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
576 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
577 -fprofile-report @gol
578 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
579 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
580 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
581 -fvar-tracking-assignments-toggle -gtoggle @gol
582 -print-file-name=@var{library} -print-libgcc-file-name @gol
583 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
584 -print-prog-name=@var{program} -print-search-dirs -Q @gol
585 -print-sysroot -print-sysroot-headers-suffix @gol
586 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
587
588 @item Machine-Dependent Options
589 @xref{Submodel Options,,Machine-Dependent Options}.
590 @c This list is ordered alphanumerically by subsection name.
591 @c Try and put the significant identifier (CPU or system) first,
592 @c so users have a clue at guessing where the ones they want will be.
593
594 @emph{AArch64 Options}
595 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
596 -mgeneral-regs-only @gol
597 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
598 -mstrict-align @gol
599 -momit-leaf-frame-pointer @gol
600 -mtls-dialect=desc -mtls-dialect=traditional @gol
601 -mtls-size=@var{size} @gol
602 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
603 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
604 -mpc-relative-literal-loads @gol
605 -msign-return-address=@var{scope} @gol
606 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
607 -moverride=@var{string} -mverbose-cost-dump}
608
609 @emph{Adapteva Epiphany Options}
610 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
611 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
612 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
613 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
614 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
615 -msplit-vecmove-early -m1reg-@var{reg}}
616
617 @emph{ARC Options}
618 @gccoptlist{-mbarrel-shifter -mjli-always @gol
619 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
620 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
621 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
622 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
623 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
624 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
625 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
626 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
627 -mvolatile-cache -mtp-regno=@var{regno} @gol
628 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
629 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
630 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
631 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
632 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
633 -mtune=@var{cpu} -mmultcost=@var{num} @gol
634 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
635 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16}
636
637 @emph{ARM Options}
638 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
639 -mabi=@var{name} @gol
640 -mapcs-stack-check -mno-apcs-stack-check @gol
641 -mapcs-reentrant -mno-apcs-reentrant @gol
642 -msched-prolog -mno-sched-prolog @gol
643 -mlittle-endian -mbig-endian @gol
644 -mbe8 -mbe32 @gol
645 -mfloat-abi=@var{name} @gol
646 -mfp16-format=@var{name}
647 -mthumb-interwork -mno-thumb-interwork @gol
648 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
649 -mtune=@var{name} -mprint-tune-info @gol
650 -mstructure-size-boundary=@var{n} @gol
651 -mabort-on-noreturn @gol
652 -mlong-calls -mno-long-calls @gol
653 -msingle-pic-base -mno-single-pic-base @gol
654 -mpic-register=@var{reg} @gol
655 -mnop-fun-dllimport @gol
656 -mpoke-function-name @gol
657 -mthumb -marm -mflip-thumb @gol
658 -mtpcs-frame -mtpcs-leaf-frame @gol
659 -mcaller-super-interworking -mcallee-super-interworking @gol
660 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
661 -mword-relocations @gol
662 -mfix-cortex-m3-ldrd @gol
663 -munaligned-access @gol
664 -mneon-for-64bits @gol
665 -mslow-flash-data @gol
666 -masm-syntax-unified @gol
667 -mrestrict-it @gol
668 -mverbose-cost-dump @gol
669 -mpure-code @gol
670 -mcmse}
671
672 @emph{AVR Options}
673 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
674 -mbranch-cost=@var{cost} @gol
675 -mcall-prologues -mgas-isr-prologues -mint8 @gol
676 -mn_flash=@var{size} -mno-interrupts @gol
677 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
678 -mfract-convert-truncate @gol
679 -mshort-calls -nodevicelib @gol
680 -Waddr-space-convert -Wmisspelled-isr}
681
682 @emph{Blackfin Options}
683 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
684 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
685 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
686 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
687 -mno-id-shared-library -mshared-library-id=@var{n} @gol
688 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
689 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
690 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
691 -micplb}
692
693 @emph{C6X Options}
694 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
695 -msim -msdata=@var{sdata-type}}
696
697 @emph{CRIS Options}
698 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
699 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
700 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
701 -mstack-align -mdata-align -mconst-align @gol
702 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
703 -melf -maout -melinux -mlinux -sim -sim2 @gol
704 -mmul-bug-workaround -mno-mul-bug-workaround}
705
706 @emph{CR16 Options}
707 @gccoptlist{-mmac @gol
708 -mcr16cplus -mcr16c @gol
709 -msim -mint32 -mbit-ops
710 -mdata-model=@var{model}}
711
712 @emph{Darwin Options}
713 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
714 -arch_only -bind_at_load -bundle -bundle_loader @gol
715 -client_name -compatibility_version -current_version @gol
716 -dead_strip @gol
717 -dependency-file -dylib_file -dylinker_install_name @gol
718 -dynamic -dynamiclib -exported_symbols_list @gol
719 -filelist -flat_namespace -force_cpusubtype_ALL @gol
720 -force_flat_namespace -headerpad_max_install_names @gol
721 -iframework @gol
722 -image_base -init -install_name -keep_private_externs @gol
723 -multi_module -multiply_defined -multiply_defined_unused @gol
724 -noall_load -no_dead_strip_inits_and_terms @gol
725 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
726 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
727 -private_bundle -read_only_relocs -sectalign @gol
728 -sectobjectsymbols -whyload -seg1addr @gol
729 -sectcreate -sectobjectsymbols -sectorder @gol
730 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
731 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
732 -segprot -segs_read_only_addr -segs_read_write_addr @gol
733 -single_module -static -sub_library -sub_umbrella @gol
734 -twolevel_namespace -umbrella -undefined @gol
735 -unexported_symbols_list -weak_reference_mismatches @gol
736 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
737 -mkernel -mone-byte-bool}
738
739 @emph{DEC Alpha Options}
740 @gccoptlist{-mno-fp-regs -msoft-float @gol
741 -mieee -mieee-with-inexact -mieee-conformant @gol
742 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
743 -mtrap-precision=@var{mode} -mbuild-constants @gol
744 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
745 -mbwx -mmax -mfix -mcix @gol
746 -mfloat-vax -mfloat-ieee @gol
747 -mexplicit-relocs -msmall-data -mlarge-data @gol
748 -msmall-text -mlarge-text @gol
749 -mmemory-latency=@var{time}}
750
751 @emph{FR30 Options}
752 @gccoptlist{-msmall-model -mno-lsim}
753
754 @emph{FT32 Options}
755 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
756
757 @emph{FRV Options}
758 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
759 -mhard-float -msoft-float @gol
760 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
761 -mdouble -mno-double @gol
762 -mmedia -mno-media -mmuladd -mno-muladd @gol
763 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
764 -mlinked-fp -mlong-calls -malign-labels @gol
765 -mlibrary-pic -macc-4 -macc-8 @gol
766 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
767 -moptimize-membar -mno-optimize-membar @gol
768 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
769 -mvliw-branch -mno-vliw-branch @gol
770 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
771 -mno-nested-cond-exec -mtomcat-stats @gol
772 -mTLS -mtls @gol
773 -mcpu=@var{cpu}}
774
775 @emph{GNU/Linux Options}
776 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
777 -tno-android-cc -tno-android-ld}
778
779 @emph{H8/300 Options}
780 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
781
782 @emph{HPPA Options}
783 @gccoptlist{-march=@var{architecture-type} @gol
784 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
785 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
786 -mfixed-range=@var{register-range} @gol
787 -mjump-in-delay -mlinker-opt -mlong-calls @gol
788 -mlong-load-store -mno-disable-fpregs @gol
789 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
790 -mno-jump-in-delay -mno-long-load-store @gol
791 -mno-portable-runtime -mno-soft-float @gol
792 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
793 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
794 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
795 -munix=@var{unix-std} -nolibdld -static -threads}
796
797 @emph{IA-64 Options}
798 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
799 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
800 -mconstant-gp -mauto-pic -mfused-madd @gol
801 -minline-float-divide-min-latency @gol
802 -minline-float-divide-max-throughput @gol
803 -mno-inline-float-divide @gol
804 -minline-int-divide-min-latency @gol
805 -minline-int-divide-max-throughput @gol
806 -mno-inline-int-divide @gol
807 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
808 -mno-inline-sqrt @gol
809 -mdwarf2-asm -mearly-stop-bits @gol
810 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
811 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
812 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
813 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
814 -msched-spec-ldc -msched-spec-control-ldc @gol
815 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
816 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
817 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
818 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
819
820 @emph{LM32 Options}
821 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
822 -msign-extend-enabled -muser-enabled}
823
824 @emph{M32R/D Options}
825 @gccoptlist{-m32r2 -m32rx -m32r @gol
826 -mdebug @gol
827 -malign-loops -mno-align-loops @gol
828 -missue-rate=@var{number} @gol
829 -mbranch-cost=@var{number} @gol
830 -mmodel=@var{code-size-model-type} @gol
831 -msdata=@var{sdata-type} @gol
832 -mno-flush-func -mflush-func=@var{name} @gol
833 -mno-flush-trap -mflush-trap=@var{number} @gol
834 -G @var{num}}
835
836 @emph{M32C Options}
837 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
838
839 @emph{M680x0 Options}
840 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
841 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
842 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
843 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
844 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
845 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
846 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
847 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
848 -mxgot -mno-xgot -mlong-jump-table-offsets}
849
850 @emph{MCore Options}
851 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
852 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
853 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
854 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
855 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
856
857 @emph{MeP Options}
858 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
859 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
860 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
861 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
862 -mtiny=@var{n}}
863
864 @emph{MicroBlaze Options}
865 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
866 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
867 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
868 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
869 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
870 -mpic-data-is-text-relative}
871
872 @emph{MIPS Options}
873 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
874 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
875 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
876 -mips16 -mno-mips16 -mflip-mips16 @gol
877 -minterlink-compressed -mno-interlink-compressed @gol
878 -minterlink-mips16 -mno-interlink-mips16 @gol
879 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
880 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
881 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
882 -mno-float -msingle-float -mdouble-float @gol
883 -modd-spreg -mno-odd-spreg @gol
884 -mabs=@var{mode} -mnan=@var{encoding} @gol
885 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
886 -mmcu -mmno-mcu @gol
887 -meva -mno-eva @gol
888 -mvirt -mno-virt @gol
889 -mxpa -mno-xpa @gol
890 -mmicromips -mno-micromips @gol
891 -mmsa -mno-msa @gol
892 -mfpu=@var{fpu-type} @gol
893 -msmartmips -mno-smartmips @gol
894 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
895 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
896 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
897 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
898 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
899 -membedded-data -mno-embedded-data @gol
900 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
901 -mcode-readable=@var{setting} @gol
902 -msplit-addresses -mno-split-addresses @gol
903 -mexplicit-relocs -mno-explicit-relocs @gol
904 -mcheck-zero-division -mno-check-zero-division @gol
905 -mdivide-traps -mdivide-breaks @gol
906 -mload-store-pairs -mno-load-store-pairs @gol
907 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
908 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
909 -mfix-24k -mno-fix-24k @gol
910 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
911 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
912 -mfix-vr4120 -mno-fix-vr4120 @gol
913 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
914 -mflush-func=@var{func} -mno-flush-func @gol
915 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
916 -mcompact-branches=@var{policy} @gol
917 -mfp-exceptions -mno-fp-exceptions @gol
918 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
919 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
920 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
921 -mframe-header-opt -mno-frame-header-opt}
922
923 @emph{MMIX Options}
924 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
925 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
926 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
927 -mno-base-addresses -msingle-exit -mno-single-exit}
928
929 @emph{MN10300 Options}
930 @gccoptlist{-mmult-bug -mno-mult-bug @gol
931 -mno-am33 -mam33 -mam33-2 -mam34 @gol
932 -mtune=@var{cpu-type} @gol
933 -mreturn-pointer-on-d0 @gol
934 -mno-crt0 -mrelax -mliw -msetlb}
935
936 @emph{Moxie Options}
937 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
938
939 @emph{MSP430 Options}
940 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
941 -mwarn-mcu @gol
942 -mcode-region= -mdata-region= @gol
943 -msilicon-errata= -msilicon-errata-warn= @gol
944 -mhwmult= -minrt}
945
946 @emph{NDS32 Options}
947 @gccoptlist{-mbig-endian -mlittle-endian @gol
948 -mreduced-regs -mfull-regs @gol
949 -mcmov -mno-cmov @gol
950 -mext-perf -mno-ext-perf @gol
951 -mext-perf2 -mno-ext-perf2 @gol
952 -mext-string -mno-ext-string @gol
953 -mv3push -mno-v3push @gol
954 -m16bit -mno-16bit @gol
955 -misr-vector-size=@var{num} @gol
956 -mcache-block-size=@var{num} @gol
957 -march=@var{arch} @gol
958 -mcmodel=@var{code-model} @gol
959 -mctor-dtor -mrelax}
960
961 @emph{Nios II Options}
962 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
963 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
964 -mel -meb @gol
965 -mno-bypass-cache -mbypass-cache @gol
966 -mno-cache-volatile -mcache-volatile @gol
967 -mno-fast-sw-div -mfast-sw-div @gol
968 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
969 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
970 -mcustom-fpu-cfg=@var{name} @gol
971 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
972 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
973
974 @emph{Nvidia PTX Options}
975 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
976
977 @emph{PDP-11 Options}
978 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
979 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
980 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
981 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
982 -mbranch-expensive -mbranch-cheap @gol
983 -munix-asm -mdec-asm}
984
985 @emph{picoChip Options}
986 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
987 -msymbol-as-address -mno-inefficient-warnings}
988
989 @emph{PowerPC Options}
990 See RS/6000 and PowerPC Options.
991
992 @emph{PowerPC SPE Options}
993 @gccoptlist{-mcpu=@var{cpu-type} @gol
994 -mtune=@var{cpu-type} @gol
995 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
996 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
997 -m32 -mxl-compat -mno-xl-compat @gol
998 -malign-power -malign-natural @gol
999 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1000 -msingle-float -mdouble-float @gol
1001 -mupdate -mno-update @gol
1002 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1003 -mstrict-align -mno-strict-align -mrelocatable @gol
1004 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1005 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1006 -msingle-pic-base @gol
1007 -mprioritize-restricted-insns=@var{priority} @gol
1008 -msched-costly-dep=@var{dependence_type} @gol
1009 -minsert-sched-nops=@var{scheme} @gol
1010 -mcall-sysv -mcall-netbsd @gol
1011 -maix-struct-return -msvr4-struct-return @gol
1012 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1013 -mblock-move-inline-limit=@var{num} @gol
1014 -misel -mno-isel @gol
1015 -misel=yes -misel=no @gol
1016 -mspe -mno-spe @gol
1017 -mspe=yes -mspe=no @gol
1018 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1019 -mprototype -mno-prototype @gol
1020 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1021 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1022 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1023 -mno-recip-precision @gol
1024 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1025 -msave-toc-indirect -mno-save-toc-indirect @gol
1026 -mcompat-align-parm -mno-compat-align-parm @gol
1027 -mfloat128 -mno-float128 @gol
1028 -mgnu-attribute -mno-gnu-attribute @gol
1029 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1030 -mstack-protector-guard-offset=@var{offset}}
1031
1032 @emph{RISC-V Options}
1033 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1034 -mplt -mno-plt @gol
1035 -mabi=@var{ABI-string} @gol
1036 -mfdiv -mno-fdiv @gol
1037 -mdiv -mno-div @gol
1038 -march=@var{ISA-string} @gol
1039 -mtune=@var{processor-string} @gol
1040 -mpreferred-stack-boundary=@var{num} @gol
1041 -msmall-data-limit=@var{N-bytes} @gol
1042 -msave-restore -mno-save-restore @gol
1043 -mstrict-align -mno-strict-align @gol
1044 -mcmodel=medlow -mcmodel=medany @gol
1045 -mexplicit-relocs -mno-explicit-relocs @gol
1046 -mrelax -mno-relax @gol}
1047
1048 @emph{RL78 Options}
1049 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1050 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1051 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1052
1053 @emph{RS/6000 and PowerPC Options}
1054 @gccoptlist{-mcpu=@var{cpu-type} @gol
1055 -mtune=@var{cpu-type} @gol
1056 -mcmodel=@var{code-model} @gol
1057 -mpowerpc64 @gol
1058 -maltivec -mno-altivec @gol
1059 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1060 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1061 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1062 -mfprnd -mno-fprnd @gol
1063 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1064 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1065 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1066 -malign-power -malign-natural @gol
1067 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1068 -mupdate -mno-update @gol
1069 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1070 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1071 -mstrict-align -mno-strict-align -mrelocatable @gol
1072 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1073 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1074 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1075 -mprioritize-restricted-insns=@var{priority} @gol
1076 -msched-costly-dep=@var{dependence_type} @gol
1077 -minsert-sched-nops=@var{scheme} @gol
1078 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1079 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1080 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1081 -mtraceback=@var{traceback_type} @gol
1082 -maix-struct-return -msvr4-struct-return @gol
1083 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1084 -mblock-move-inline-limit=@var{num} @gol
1085 -mblock-compare-inline-limit=@var{num} @gol
1086 -mblock-compare-inline-loop-limit=@var{num} @gol
1087 -mstring-compare-inline-limit=@var{num} @gol
1088 -misel -mno-isel @gol
1089 -misel=yes -misel=no @gol
1090 -mvrsave -mno-vrsave @gol
1091 -mmulhw -mno-mulhw @gol
1092 -mdlmzb -mno-dlmzb @gol
1093 -mprototype -mno-prototype @gol
1094 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1095 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1096 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1097 -mno-recip-precision @gol
1098 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1099 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1100 -msave-toc-indirect -mno-save-toc-indirect @gol
1101 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1102 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1103 -mquad-memory -mno-quad-memory @gol
1104 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1105 -mcompat-align-parm -mno-compat-align-parm @gol
1106 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1107 -mgnu-attribute -mno-gnu-attribute @gol
1108 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1109 -mstack-protector-guard-offset=@var{offset}}
1110
1111 @emph{RX Options}
1112 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1113 -mcpu=@gol
1114 -mbig-endian-data -mlittle-endian-data @gol
1115 -msmall-data @gol
1116 -msim -mno-sim@gol
1117 -mas100-syntax -mno-as100-syntax@gol
1118 -mrelax@gol
1119 -mmax-constant-size=@gol
1120 -mint-register=@gol
1121 -mpid@gol
1122 -mallow-string-insns -mno-allow-string-insns@gol
1123 -mjsr@gol
1124 -mno-warn-multiple-fast-interrupts@gol
1125 -msave-acc-in-interrupts}
1126
1127 @emph{S/390 and zSeries Options}
1128 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1129 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1130 -mlong-double-64 -mlong-double-128 @gol
1131 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1132 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1133 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1134 -mhtm -mvx -mzvector @gol
1135 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1136 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1137 -mhotpatch=@var{halfwords},@var{halfwords}}
1138
1139 @emph{Score Options}
1140 @gccoptlist{-meb -mel @gol
1141 -mnhwloop @gol
1142 -muls @gol
1143 -mmac @gol
1144 -mscore5 -mscore5u -mscore7 -mscore7d}
1145
1146 @emph{SH Options}
1147 @gccoptlist{-m1 -m2 -m2e @gol
1148 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1149 -m3 -m3e @gol
1150 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1151 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1152 -mb -ml -mdalign -mrelax @gol
1153 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1154 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1155 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1156 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1157 -maccumulate-outgoing-args @gol
1158 -matomic-model=@var{atomic-model} @gol
1159 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1160 -mcbranch-force-delay-slot @gol
1161 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1162 -mpretend-cmove -mtas}
1163
1164 @emph{Solaris 2 Options}
1165 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1166 -pthreads}
1167
1168 @emph{SPARC Options}
1169 @gccoptlist{-mcpu=@var{cpu-type} @gol
1170 -mtune=@var{cpu-type} @gol
1171 -mcmodel=@var{code-model} @gol
1172 -mmemory-model=@var{mem-model} @gol
1173 -m32 -m64 -mapp-regs -mno-app-regs @gol
1174 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1175 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1176 -mhard-quad-float -msoft-quad-float @gol
1177 -mstack-bias -mno-stack-bias @gol
1178 -mstd-struct-return -mno-std-struct-return @gol
1179 -munaligned-doubles -mno-unaligned-doubles @gol
1180 -muser-mode -mno-user-mode @gol
1181 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1182 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1183 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1184 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1185 -mpopc -mno-popc -msubxc -mno-subxc @gol
1186 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1187 -mlra -mno-lra}
1188
1189 @emph{SPU Options}
1190 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1191 -msafe-dma -munsafe-dma @gol
1192 -mbranch-hints @gol
1193 -msmall-mem -mlarge-mem -mstdmain @gol
1194 -mfixed-range=@var{register-range} @gol
1195 -mea32 -mea64 @gol
1196 -maddress-space-conversion -mno-address-space-conversion @gol
1197 -mcache-size=@var{cache-size} @gol
1198 -matomic-updates -mno-atomic-updates}
1199
1200 @emph{System V Options}
1201 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1202
1203 @emph{TILE-Gx Options}
1204 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1205 -mcmodel=@var{code-model}}
1206
1207 @emph{TILEPro Options}
1208 @gccoptlist{-mcpu=@var{cpu} -m32}
1209
1210 @emph{V850 Options}
1211 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1212 -mprolog-function -mno-prolog-function -mspace @gol
1213 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1214 -mapp-regs -mno-app-regs @gol
1215 -mdisable-callt -mno-disable-callt @gol
1216 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1217 -mv850e -mv850 -mv850e3v5 @gol
1218 -mloop @gol
1219 -mrelax @gol
1220 -mlong-jumps @gol
1221 -msoft-float @gol
1222 -mhard-float @gol
1223 -mgcc-abi @gol
1224 -mrh850-abi @gol
1225 -mbig-switch}
1226
1227 @emph{VAX Options}
1228 @gccoptlist{-mg -mgnu -munix}
1229
1230 @emph{Visium Options}
1231 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1232 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1233
1234 @emph{VMS Options}
1235 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1236 -mpointer-size=@var{size}}
1237
1238 @emph{VxWorks Options}
1239 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1240 -Xbind-lazy -Xbind-now}
1241
1242 @emph{x86 Options}
1243 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1244 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1245 -mfpmath=@var{unit} @gol
1246 -masm=@var{dialect} -mno-fancy-math-387 @gol
1247 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1248 -mno-wide-multiply -mrtd -malign-double @gol
1249 -mpreferred-stack-boundary=@var{num} @gol
1250 -mincoming-stack-boundary=@var{num} @gol
1251 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1252 -mrecip -mrecip=@var{opt} @gol
1253 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1254 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1255 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1256 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1257 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1258 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1259 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1260 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx @gol
1261 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1262 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1263 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1264 -mcldemote @gol
1265 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1266 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1267 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1268 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1269 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1270 -mregparm=@var{num} -msseregparm @gol
1271 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1272 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1273 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1274 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1275 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1276 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1277 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1278 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1279 -mstack-protector-guard-reg=@var{reg} @gol
1280 -mstack-protector-guard-offset=@var{offset} @gol
1281 -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol
1282 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1283 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1284 -mindirect-branch-register}
1285
1286 @emph{x86 Windows Options}
1287 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1288 -mnop-fun-dllimport -mthread @gol
1289 -municode -mwin32 -mwindows -fno-set-stack-executable}
1290
1291 @emph{Xstormy16 Options}
1292 @gccoptlist{-msim}
1293
1294 @emph{Xtensa Options}
1295 @gccoptlist{-mconst16 -mno-const16 @gol
1296 -mfused-madd -mno-fused-madd @gol
1297 -mforce-no-pic @gol
1298 -mserialize-volatile -mno-serialize-volatile @gol
1299 -mtext-section-literals -mno-text-section-literals @gol
1300 -mauto-litpools -mno-auto-litpools @gol
1301 -mtarget-align -mno-target-align @gol
1302 -mlongcalls -mno-longcalls}
1303
1304 @emph{zSeries Options}
1305 See S/390 and zSeries Options.
1306 @end table
1307
1308
1309 @node Overall Options
1310 @section Options Controlling the Kind of Output
1311
1312 Compilation can involve up to four stages: preprocessing, compilation
1313 proper, assembly and linking, always in that order. GCC is capable of
1314 preprocessing and compiling several files either into several
1315 assembler input files, or into one assembler input file; then each
1316 assembler input file produces an object file, and linking combines all
1317 the object files (those newly compiled, and those specified as input)
1318 into an executable file.
1319
1320 @cindex file name suffix
1321 For any given input file, the file name suffix determines what kind of
1322 compilation is done:
1323
1324 @table @gcctabopt
1325 @item @var{file}.c
1326 C source code that must be preprocessed.
1327
1328 @item @var{file}.i
1329 C source code that should not be preprocessed.
1330
1331 @item @var{file}.ii
1332 C++ source code that should not be preprocessed.
1333
1334 @item @var{file}.m
1335 Objective-C source code. Note that you must link with the @file{libobjc}
1336 library to make an Objective-C program work.
1337
1338 @item @var{file}.mi
1339 Objective-C source code that should not be preprocessed.
1340
1341 @item @var{file}.mm
1342 @itemx @var{file}.M
1343 Objective-C++ source code. Note that you must link with the @file{libobjc}
1344 library to make an Objective-C++ program work. Note that @samp{.M} refers
1345 to a literal capital M@.
1346
1347 @item @var{file}.mii
1348 Objective-C++ source code that should not be preprocessed.
1349
1350 @item @var{file}.h
1351 C, C++, Objective-C or Objective-C++ header file to be turned into a
1352 precompiled header (default), or C, C++ header file to be turned into an
1353 Ada spec (via the @option{-fdump-ada-spec} switch).
1354
1355 @item @var{file}.cc
1356 @itemx @var{file}.cp
1357 @itemx @var{file}.cxx
1358 @itemx @var{file}.cpp
1359 @itemx @var{file}.CPP
1360 @itemx @var{file}.c++
1361 @itemx @var{file}.C
1362 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1363 the last two letters must both be literally @samp{x}. Likewise,
1364 @samp{.C} refers to a literal capital C@.
1365
1366 @item @var{file}.mm
1367 @itemx @var{file}.M
1368 Objective-C++ source code that must be preprocessed.
1369
1370 @item @var{file}.mii
1371 Objective-C++ source code that should not be preprocessed.
1372
1373 @item @var{file}.hh
1374 @itemx @var{file}.H
1375 @itemx @var{file}.hp
1376 @itemx @var{file}.hxx
1377 @itemx @var{file}.hpp
1378 @itemx @var{file}.HPP
1379 @itemx @var{file}.h++
1380 @itemx @var{file}.tcc
1381 C++ header file to be turned into a precompiled header or Ada spec.
1382
1383 @item @var{file}.f
1384 @itemx @var{file}.for
1385 @itemx @var{file}.ftn
1386 Fixed form Fortran source code that should not be preprocessed.
1387
1388 @item @var{file}.F
1389 @itemx @var{file}.FOR
1390 @itemx @var{file}.fpp
1391 @itemx @var{file}.FPP
1392 @itemx @var{file}.FTN
1393 Fixed form Fortran source code that must be preprocessed (with the traditional
1394 preprocessor).
1395
1396 @item @var{file}.f90
1397 @itemx @var{file}.f95
1398 @itemx @var{file}.f03
1399 @itemx @var{file}.f08
1400 Free form Fortran source code that should not be preprocessed.
1401
1402 @item @var{file}.F90
1403 @itemx @var{file}.F95
1404 @itemx @var{file}.F03
1405 @itemx @var{file}.F08
1406 Free form Fortran source code that must be preprocessed (with the
1407 traditional preprocessor).
1408
1409 @item @var{file}.go
1410 Go source code.
1411
1412 @item @var{file}.brig
1413 BRIG files (binary representation of HSAIL).
1414
1415 @item @var{file}.ads
1416 Ada source code file that contains a library unit declaration (a
1417 declaration of a package, subprogram, or generic, or a generic
1418 instantiation), or a library unit renaming declaration (a package,
1419 generic, or subprogram renaming declaration). Such files are also
1420 called @dfn{specs}.
1421
1422 @item @var{file}.adb
1423 Ada source code file containing a library unit body (a subprogram or
1424 package body). Such files are also called @dfn{bodies}.
1425
1426 @c GCC also knows about some suffixes for languages not yet included:
1427 @c Pascal:
1428 @c @var{file}.p
1429 @c @var{file}.pas
1430 @c Ratfor:
1431 @c @var{file}.r
1432
1433 @item @var{file}.s
1434 Assembler code.
1435
1436 @item @var{file}.S
1437 @itemx @var{file}.sx
1438 Assembler code that must be preprocessed.
1439
1440 @item @var{other}
1441 An object file to be fed straight into linking.
1442 Any file name with no recognized suffix is treated this way.
1443 @end table
1444
1445 @opindex x
1446 You can specify the input language explicitly with the @option{-x} option:
1447
1448 @table @gcctabopt
1449 @item -x @var{language}
1450 Specify explicitly the @var{language} for the following input files
1451 (rather than letting the compiler choose a default based on the file
1452 name suffix). This option applies to all following input files until
1453 the next @option{-x} option. Possible values for @var{language} are:
1454 @smallexample
1455 c c-header cpp-output
1456 c++ c++-header c++-cpp-output
1457 objective-c objective-c-header objective-c-cpp-output
1458 objective-c++ objective-c++-header objective-c++-cpp-output
1459 assembler assembler-with-cpp
1460 ada
1461 f77 f77-cpp-input f95 f95-cpp-input
1462 go
1463 brig
1464 @end smallexample
1465
1466 @item -x none
1467 Turn off any specification of a language, so that subsequent files are
1468 handled according to their file name suffixes (as they are if @option{-x}
1469 has not been used at all).
1470 @end table
1471
1472 If you only want some of the stages of compilation, you can use
1473 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1474 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1475 @command{gcc} is to stop. Note that some combinations (for example,
1476 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1477
1478 @table @gcctabopt
1479 @item -c
1480 @opindex c
1481 Compile or assemble the source files, but do not link. The linking
1482 stage simply is not done. The ultimate output is in the form of an
1483 object file for each source file.
1484
1485 By default, the object file name for a source file is made by replacing
1486 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1487
1488 Unrecognized input files, not requiring compilation or assembly, are
1489 ignored.
1490
1491 @item -S
1492 @opindex S
1493 Stop after the stage of compilation proper; do not assemble. The output
1494 is in the form of an assembler code file for each non-assembler input
1495 file specified.
1496
1497 By default, the assembler file name for a source file is made by
1498 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1499
1500 Input files that don't require compilation are ignored.
1501
1502 @item -E
1503 @opindex E
1504 Stop after the preprocessing stage; do not run the compiler proper. The
1505 output is in the form of preprocessed source code, which is sent to the
1506 standard output.
1507
1508 Input files that don't require preprocessing are ignored.
1509
1510 @cindex output file option
1511 @item -o @var{file}
1512 @opindex o
1513 Place output in file @var{file}. This applies to whatever
1514 sort of output is being produced, whether it be an executable file,
1515 an object file, an assembler file or preprocessed C code.
1516
1517 If @option{-o} is not specified, the default is to put an executable
1518 file in @file{a.out}, the object file for
1519 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1520 assembler file in @file{@var{source}.s}, a precompiled header file in
1521 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1522 standard output.
1523
1524 @item -v
1525 @opindex v
1526 Print (on standard error output) the commands executed to run the stages
1527 of compilation. Also print the version number of the compiler driver
1528 program and of the preprocessor and the compiler proper.
1529
1530 @item -###
1531 @opindex ###
1532 Like @option{-v} except the commands are not executed and arguments
1533 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1534 This is useful for shell scripts to capture the driver-generated command lines.
1535
1536 @item --help
1537 @opindex help
1538 Print (on the standard output) a description of the command-line options
1539 understood by @command{gcc}. If the @option{-v} option is also specified
1540 then @option{--help} is also passed on to the various processes
1541 invoked by @command{gcc}, so that they can display the command-line options
1542 they accept. If the @option{-Wextra} option has also been specified
1543 (prior to the @option{--help} option), then command-line options that
1544 have no documentation associated with them are also displayed.
1545
1546 @item --target-help
1547 @opindex target-help
1548 Print (on the standard output) a description of target-specific command-line
1549 options for each tool. For some targets extra target-specific
1550 information may also be printed.
1551
1552 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1553 Print (on the standard output) a description of the command-line
1554 options understood by the compiler that fit into all specified classes
1555 and qualifiers. These are the supported classes:
1556
1557 @table @asis
1558 @item @samp{optimizers}
1559 Display all of the optimization options supported by the
1560 compiler.
1561
1562 @item @samp{warnings}
1563 Display all of the options controlling warning messages
1564 produced by the compiler.
1565
1566 @item @samp{target}
1567 Display target-specific options. Unlike the
1568 @option{--target-help} option however, target-specific options of the
1569 linker and assembler are not displayed. This is because those
1570 tools do not currently support the extended @option{--help=} syntax.
1571
1572 @item @samp{params}
1573 Display the values recognized by the @option{--param}
1574 option.
1575
1576 @item @var{language}
1577 Display the options supported for @var{language}, where
1578 @var{language} is the name of one of the languages supported in this
1579 version of GCC@.
1580
1581 @item @samp{common}
1582 Display the options that are common to all languages.
1583 @end table
1584
1585 These are the supported qualifiers:
1586
1587 @table @asis
1588 @item @samp{undocumented}
1589 Display only those options that are undocumented.
1590
1591 @item @samp{joined}
1592 Display options taking an argument that appears after an equal
1593 sign in the same continuous piece of text, such as:
1594 @samp{--help=target}.
1595
1596 @item @samp{separate}
1597 Display options taking an argument that appears as a separate word
1598 following the original option, such as: @samp{-o output-file}.
1599 @end table
1600
1601 Thus for example to display all the undocumented target-specific
1602 switches supported by the compiler, use:
1603
1604 @smallexample
1605 --help=target,undocumented
1606 @end smallexample
1607
1608 The sense of a qualifier can be inverted by prefixing it with the
1609 @samp{^} character, so for example to display all binary warning
1610 options (i.e., ones that are either on or off and that do not take an
1611 argument) that have a description, use:
1612
1613 @smallexample
1614 --help=warnings,^joined,^undocumented
1615 @end smallexample
1616
1617 The argument to @option{--help=} should not consist solely of inverted
1618 qualifiers.
1619
1620 Combining several classes is possible, although this usually
1621 restricts the output so much that there is nothing to display. One
1622 case where it does work, however, is when one of the classes is
1623 @var{target}. For example, to display all the target-specific
1624 optimization options, use:
1625
1626 @smallexample
1627 --help=target,optimizers
1628 @end smallexample
1629
1630 The @option{--help=} option can be repeated on the command line. Each
1631 successive use displays its requested class of options, skipping
1632 those that have already been displayed.
1633
1634 If the @option{-Q} option appears on the command line before the
1635 @option{--help=} option, then the descriptive text displayed by
1636 @option{--help=} is changed. Instead of describing the displayed
1637 options, an indication is given as to whether the option is enabled,
1638 disabled or set to a specific value (assuming that the compiler
1639 knows this at the point where the @option{--help=} option is used).
1640
1641 Here is a truncated example from the ARM port of @command{gcc}:
1642
1643 @smallexample
1644 % gcc -Q -mabi=2 --help=target -c
1645 The following options are target specific:
1646 -mabi= 2
1647 -mabort-on-noreturn [disabled]
1648 -mapcs [disabled]
1649 @end smallexample
1650
1651 The output is sensitive to the effects of previous command-line
1652 options, so for example it is possible to find out which optimizations
1653 are enabled at @option{-O2} by using:
1654
1655 @smallexample
1656 -Q -O2 --help=optimizers
1657 @end smallexample
1658
1659 Alternatively you can discover which binary optimizations are enabled
1660 by @option{-O3} by using:
1661
1662 @smallexample
1663 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1664 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1665 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1666 @end smallexample
1667
1668 @item --version
1669 @opindex version
1670 Display the version number and copyrights of the invoked GCC@.
1671
1672 @item -pass-exit-codes
1673 @opindex pass-exit-codes
1674 Normally the @command{gcc} program exits with the code of 1 if any
1675 phase of the compiler returns a non-success return code. If you specify
1676 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1677 the numerically highest error produced by any phase returning an error
1678 indication. The C, C++, and Fortran front ends return 4 if an internal
1679 compiler error is encountered.
1680
1681 @item -pipe
1682 @opindex pipe
1683 Use pipes rather than temporary files for communication between the
1684 various stages of compilation. This fails to work on some systems where
1685 the assembler is unable to read from a pipe; but the GNU assembler has
1686 no trouble.
1687
1688 @item -specs=@var{file}
1689 @opindex specs
1690 Process @var{file} after the compiler reads in the standard @file{specs}
1691 file, in order to override the defaults which the @command{gcc} driver
1692 program uses when determining what switches to pass to @command{cc1},
1693 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1694 @option{-specs=@var{file}} can be specified on the command line, and they
1695 are processed in order, from left to right. @xref{Spec Files}, for
1696 information about the format of the @var{file}.
1697
1698 @item -wrapper
1699 @opindex wrapper
1700 Invoke all subcommands under a wrapper program. The name of the
1701 wrapper program and its parameters are passed as a comma separated
1702 list.
1703
1704 @smallexample
1705 gcc -c t.c -wrapper gdb,--args
1706 @end smallexample
1707
1708 @noindent
1709 This invokes all subprograms of @command{gcc} under
1710 @samp{gdb --args}, thus the invocation of @command{cc1} is
1711 @samp{gdb --args cc1 @dots{}}.
1712
1713 @item -ffile-prefix-map=@var{old}=@var{new}
1714 @opindex ffile-prefix-map
1715 When compiling files residing in directory @file{@var{old}}, record
1716 any references to them in the result of the compilation as if the
1717 files resided in directory @file{@var{new}} instead. Specifying this
1718 option is equivalent to specifying all the individual
1719 @option{-f*-prefix-map} options. This can be used to make reproducible
1720 builds that are location independent. See also
1721 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1722
1723 @item -fplugin=@var{name}.so
1724 @opindex fplugin
1725 Load the plugin code in file @var{name}.so, assumed to be a
1726 shared object to be dlopen'd by the compiler. The base name of
1727 the shared object file is used to identify the plugin for the
1728 purposes of argument parsing (See
1729 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1730 Each plugin should define the callback functions specified in the
1731 Plugins API.
1732
1733 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1734 @opindex fplugin-arg
1735 Define an argument called @var{key} with a value of @var{value}
1736 for the plugin called @var{name}.
1737
1738 @item -fdump-ada-spec@r{[}-slim@r{]}
1739 @opindex fdump-ada-spec
1740 For C and C++ source and include files, generate corresponding Ada specs.
1741 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1742 GNAT User's Guide}, which provides detailed documentation on this feature.
1743
1744 @item -fada-spec-parent=@var{unit}
1745 @opindex fada-spec-parent
1746 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1747 Ada specs as child units of parent @var{unit}.
1748
1749 @item -fdump-go-spec=@var{file}
1750 @opindex fdump-go-spec
1751 For input files in any language, generate corresponding Go
1752 declarations in @var{file}. This generates Go @code{const},
1753 @code{type}, @code{var}, and @code{func} declarations which may be a
1754 useful way to start writing a Go interface to code written in some
1755 other language.
1756
1757 @include @value{srcdir}/../libiberty/at-file.texi
1758 @end table
1759
1760 @node Invoking G++
1761 @section Compiling C++ Programs
1762
1763 @cindex suffixes for C++ source
1764 @cindex C++ source file suffixes
1765 C++ source files conventionally use one of the suffixes @samp{.C},
1766 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1767 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1768 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1769 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1770 files with these names and compiles them as C++ programs even if you
1771 call the compiler the same way as for compiling C programs (usually
1772 with the name @command{gcc}).
1773
1774 @findex g++
1775 @findex c++
1776 However, the use of @command{gcc} does not add the C++ library.
1777 @command{g++} is a program that calls GCC and automatically specifies linking
1778 against the C++ library. It treats @samp{.c},
1779 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1780 files unless @option{-x} is used. This program is also useful when
1781 precompiling a C header file with a @samp{.h} extension for use in C++
1782 compilations. On many systems, @command{g++} is also installed with
1783 the name @command{c++}.
1784
1785 @cindex invoking @command{g++}
1786 When you compile C++ programs, you may specify many of the same
1787 command-line options that you use for compiling programs in any
1788 language; or command-line options meaningful for C and related
1789 languages; or options that are meaningful only for C++ programs.
1790 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1791 explanations of options for languages related to C@.
1792 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1793 explanations of options that are meaningful only for C++ programs.
1794
1795 @node C Dialect Options
1796 @section Options Controlling C Dialect
1797 @cindex dialect options
1798 @cindex language dialect options
1799 @cindex options, dialect
1800
1801 The following options control the dialect of C (or languages derived
1802 from C, such as C++, Objective-C and Objective-C++) that the compiler
1803 accepts:
1804
1805 @table @gcctabopt
1806 @cindex ANSI support
1807 @cindex ISO support
1808 @item -ansi
1809 @opindex ansi
1810 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1811 equivalent to @option{-std=c++98}.
1812
1813 This turns off certain features of GCC that are incompatible with ISO
1814 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1815 such as the @code{asm} and @code{typeof} keywords, and
1816 predefined macros such as @code{unix} and @code{vax} that identify the
1817 type of system you are using. It also enables the undesirable and
1818 rarely used ISO trigraph feature. For the C compiler,
1819 it disables recognition of C++ style @samp{//} comments as well as
1820 the @code{inline} keyword.
1821
1822 The alternate keywords @code{__asm__}, @code{__extension__},
1823 @code{__inline__} and @code{__typeof__} continue to work despite
1824 @option{-ansi}. You would not want to use them in an ISO C program, of
1825 course, but it is useful to put them in header files that might be included
1826 in compilations done with @option{-ansi}. Alternate predefined macros
1827 such as @code{__unix__} and @code{__vax__} are also available, with or
1828 without @option{-ansi}.
1829
1830 The @option{-ansi} option does not cause non-ISO programs to be
1831 rejected gratuitously. For that, @option{-Wpedantic} is required in
1832 addition to @option{-ansi}. @xref{Warning Options}.
1833
1834 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1835 option is used. Some header files may notice this macro and refrain
1836 from declaring certain functions or defining certain macros that the
1837 ISO standard doesn't call for; this is to avoid interfering with any
1838 programs that might use these names for other things.
1839
1840 Functions that are normally built in but do not have semantics
1841 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1842 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1843 built-in functions provided by GCC}, for details of the functions
1844 affected.
1845
1846 @item -std=
1847 @opindex std
1848 Determine the language standard. @xref{Standards,,Language Standards
1849 Supported by GCC}, for details of these standard versions. This option
1850 is currently only supported when compiling C or C++.
1851
1852 The compiler can accept several base standards, such as @samp{c90} or
1853 @samp{c++98}, and GNU dialects of those standards, such as
1854 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1855 compiler accepts all programs following that standard plus those
1856 using GNU extensions that do not contradict it. For example,
1857 @option{-std=c90} turns off certain features of GCC that are
1858 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1859 keywords, but not other GNU extensions that do not have a meaning in
1860 ISO C90, such as omitting the middle term of a @code{?:}
1861 expression. On the other hand, when a GNU dialect of a standard is
1862 specified, all features supported by the compiler are enabled, even when
1863 those features change the meaning of the base standard. As a result, some
1864 strict-conforming programs may be rejected. The particular standard
1865 is used by @option{-Wpedantic} to identify which features are GNU
1866 extensions given that version of the standard. For example
1867 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1868 comments, while @option{-std=gnu99 -Wpedantic} does not.
1869
1870 A value for this option must be provided; possible values are
1871
1872 @table @samp
1873 @item c90
1874 @itemx c89
1875 @itemx iso9899:1990
1876 Support all ISO C90 programs (certain GNU extensions that conflict
1877 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1878
1879 @item iso9899:199409
1880 ISO C90 as modified in amendment 1.
1881
1882 @item c99
1883 @itemx c9x
1884 @itemx iso9899:1999
1885 @itemx iso9899:199x
1886 ISO C99. This standard is substantially completely supported, modulo
1887 bugs and floating-point issues
1888 (mainly but not entirely relating to optional C99 features from
1889 Annexes F and G). See
1890 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1891 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1892
1893 @item c11
1894 @itemx c1x
1895 @itemx iso9899:2011
1896 ISO C11, the 2011 revision of the ISO C standard. This standard is
1897 substantially completely supported, modulo bugs, floating-point issues
1898 (mainly but not entirely relating to optional C11 features from
1899 Annexes F and G) and the optional Annexes K (Bounds-checking
1900 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1901
1902 @item c17
1903 @itemx c18
1904 @itemx iso9899:2017
1905 @itemx iso9899:2018
1906 ISO C17, the 2017 revision of the ISO C standard (expected to be
1907 published in 2018). This standard is
1908 same as C11 except for corrections of defects (all of which are also
1909 applied with @option{-std=c11}) and a new value of
1910 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1911
1912 @item gnu90
1913 @itemx gnu89
1914 GNU dialect of ISO C90 (including some C99 features).
1915
1916 @item gnu99
1917 @itemx gnu9x
1918 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1919
1920 @item gnu11
1921 @itemx gnu1x
1922 GNU dialect of ISO C11.
1923 The name @samp{gnu1x} is deprecated.
1924
1925 @item gnu17
1926 @itemx gnu18
1927 GNU dialect of ISO C17. This is the default for C code.
1928
1929 @item c++98
1930 @itemx c++03
1931 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1932 additional defect reports. Same as @option{-ansi} for C++ code.
1933
1934 @item gnu++98
1935 @itemx gnu++03
1936 GNU dialect of @option{-std=c++98}.
1937
1938 @item c++11
1939 @itemx c++0x
1940 The 2011 ISO C++ standard plus amendments.
1941 The name @samp{c++0x} is deprecated.
1942
1943 @item gnu++11
1944 @itemx gnu++0x
1945 GNU dialect of @option{-std=c++11}.
1946 The name @samp{gnu++0x} is deprecated.
1947
1948 @item c++14
1949 @itemx c++1y
1950 The 2014 ISO C++ standard plus amendments.
1951 The name @samp{c++1y} is deprecated.
1952
1953 @item gnu++14
1954 @itemx gnu++1y
1955 GNU dialect of @option{-std=c++14}.
1956 This is the default for C++ code.
1957 The name @samp{gnu++1y} is deprecated.
1958
1959 @item c++17
1960 @itemx c++1z
1961 The 2017 ISO C++ standard plus amendments.
1962 The name @samp{c++1z} is deprecated.
1963
1964 @item gnu++17
1965 @itemx gnu++1z
1966 GNU dialect of @option{-std=c++17}.
1967 The name @samp{gnu++1z} is deprecated.
1968
1969 @item c++2a
1970 The next revision of the ISO C++ standard, tentatively planned for
1971 2020. Support is highly experimental, and will almost certainly
1972 change in incompatible ways in future releases.
1973
1974 @item gnu++2a
1975 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
1976 and will almost certainly change in incompatible ways in future
1977 releases.
1978 @end table
1979
1980 @item -fgnu89-inline
1981 @opindex fgnu89-inline
1982 The option @option{-fgnu89-inline} tells GCC to use the traditional
1983 GNU semantics for @code{inline} functions when in C99 mode.
1984 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1985 Using this option is roughly equivalent to adding the
1986 @code{gnu_inline} function attribute to all inline functions
1987 (@pxref{Function Attributes}).
1988
1989 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1990 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1991 specifies the default behavior).
1992 This option is not supported in @option{-std=c90} or
1993 @option{-std=gnu90} mode.
1994
1995 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1996 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1997 in effect for @code{inline} functions. @xref{Common Predefined
1998 Macros,,,cpp,The C Preprocessor}.
1999
2000 @item -fpermitted-flt-eval-methods=@var{style}
2001 @opindex fpermitted-flt-eval-methods
2002 @opindex fpermitted-flt-eval-methods=c11
2003 @opindex fpermitted-flt-eval-methods=ts-18661-3
2004 ISO/IEC TS 18661-3 defines new permissible values for
2005 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2006 a semantic type that is an interchange or extended format should be
2007 evaluated to the precision and range of that type. These new values are
2008 a superset of those permitted under C99/C11, which does not specify the
2009 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2010 conforming to C11 may not have been written expecting the possibility of
2011 the new values.
2012
2013 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2014 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2015 or the extended set of values specified in ISO/IEC TS 18661-3.
2016
2017 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2018
2019 The default when in a standards compliant mode (@option{-std=c11} or similar)
2020 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2021 dialect (@option{-std=gnu11} or similar) is
2022 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2023
2024 @item -aux-info @var{filename}
2025 @opindex aux-info
2026 Output to the given filename prototyped declarations for all functions
2027 declared and/or defined in a translation unit, including those in header
2028 files. This option is silently ignored in any language other than C@.
2029
2030 Besides declarations, the file indicates, in comments, the origin of
2031 each declaration (source file and line), whether the declaration was
2032 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2033 @samp{O} for old, respectively, in the first character after the line
2034 number and the colon), and whether it came from a declaration or a
2035 definition (@samp{C} or @samp{F}, respectively, in the following
2036 character). In the case of function definitions, a K&R-style list of
2037 arguments followed by their declarations is also provided, inside
2038 comments, after the declaration.
2039
2040 @item -fallow-parameterless-variadic-functions
2041 @opindex fallow-parameterless-variadic-functions
2042 Accept variadic functions without named parameters.
2043
2044 Although it is possible to define such a function, this is not very
2045 useful as it is not possible to read the arguments. This is only
2046 supported for C as this construct is allowed by C++.
2047
2048 @item -fno-asm
2049 @opindex fno-asm
2050 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2051 keyword, so that code can use these words as identifiers. You can use
2052 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2053 instead. @option{-ansi} implies @option{-fno-asm}.
2054
2055 In C++, this switch only affects the @code{typeof} keyword, since
2056 @code{asm} and @code{inline} are standard keywords. You may want to
2057 use the @option{-fno-gnu-keywords} flag instead, which has the same
2058 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2059 switch only affects the @code{asm} and @code{typeof} keywords, since
2060 @code{inline} is a standard keyword in ISO C99.
2061
2062 @item -fno-builtin
2063 @itemx -fno-builtin-@var{function}
2064 @opindex fno-builtin
2065 @cindex built-in functions
2066 Don't recognize built-in functions that do not begin with
2067 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2068 functions provided by GCC}, for details of the functions affected,
2069 including those which are not built-in functions when @option{-ansi} or
2070 @option{-std} options for strict ISO C conformance are used because they
2071 do not have an ISO standard meaning.
2072
2073 GCC normally generates special code to handle certain built-in functions
2074 more efficiently; for instance, calls to @code{alloca} may become single
2075 instructions which adjust the stack directly, and calls to @code{memcpy}
2076 may become inline copy loops. The resulting code is often both smaller
2077 and faster, but since the function calls no longer appear as such, you
2078 cannot set a breakpoint on those calls, nor can you change the behavior
2079 of the functions by linking with a different library. In addition,
2080 when a function is recognized as a built-in function, GCC may use
2081 information about that function to warn about problems with calls to
2082 that function, or to generate more efficient code, even if the
2083 resulting code still contains calls to that function. For example,
2084 warnings are given with @option{-Wformat} for bad calls to
2085 @code{printf} when @code{printf} is built in and @code{strlen} is
2086 known not to modify global memory.
2087
2088 With the @option{-fno-builtin-@var{function}} option
2089 only the built-in function @var{function} is
2090 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2091 function is named that is not built-in in this version of GCC, this
2092 option is ignored. There is no corresponding
2093 @option{-fbuiltin-@var{function}} option; if you wish to enable
2094 built-in functions selectively when using @option{-fno-builtin} or
2095 @option{-ffreestanding}, you may define macros such as:
2096
2097 @smallexample
2098 #define abs(n) __builtin_abs ((n))
2099 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2100 @end smallexample
2101
2102 @item -fgimple
2103 @opindex fgimple
2104
2105 Enable parsing of function definitions marked with @code{__GIMPLE}.
2106 This is an experimental feature that allows unit testing of GIMPLE
2107 passes.
2108
2109 @item -fhosted
2110 @opindex fhosted
2111 @cindex hosted environment
2112
2113 Assert that compilation targets a hosted environment. This implies
2114 @option{-fbuiltin}. A hosted environment is one in which the
2115 entire standard library is available, and in which @code{main} has a return
2116 type of @code{int}. Examples are nearly everything except a kernel.
2117 This is equivalent to @option{-fno-freestanding}.
2118
2119 @item -ffreestanding
2120 @opindex ffreestanding
2121 @cindex hosted environment
2122
2123 Assert that compilation targets a freestanding environment. This
2124 implies @option{-fno-builtin}. A freestanding environment
2125 is one in which the standard library may not exist, and program startup may
2126 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2127 This is equivalent to @option{-fno-hosted}.
2128
2129 @xref{Standards,,Language Standards Supported by GCC}, for details of
2130 freestanding and hosted environments.
2131
2132 @item -fopenacc
2133 @opindex fopenacc
2134 @cindex OpenACC accelerator programming
2135 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2136 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2137 compiler generates accelerated code according to the OpenACC Application
2138 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2139 implies @option{-pthread}, and thus is only supported on targets that
2140 have support for @option{-pthread}.
2141
2142 @item -fopenacc-dim=@var{geom}
2143 @opindex fopenacc-dim
2144 @cindex OpenACC accelerator programming
2145 Specify default compute dimensions for parallel offload regions that do
2146 not explicitly specify. The @var{geom} value is a triple of
2147 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2148 can be omitted, to use a target-specific default value.
2149
2150 @item -fopenmp
2151 @opindex fopenmp
2152 @cindex OpenMP parallel
2153 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2154 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2155 compiler generates parallel code according to the OpenMP Application
2156 Program Interface v4.5 @w{@uref{http://www.openmp.org/}}. This option
2157 implies @option{-pthread}, and thus is only supported on targets that
2158 have support for @option{-pthread}. @option{-fopenmp} implies
2159 @option{-fopenmp-simd}.
2160
2161 @item -fopenmp-simd
2162 @opindex fopenmp-simd
2163 @cindex OpenMP SIMD
2164 @cindex SIMD
2165 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2166 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2167 are ignored.
2168
2169 @item -fgnu-tm
2170 @opindex fgnu-tm
2171 When the option @option{-fgnu-tm} is specified, the compiler
2172 generates code for the Linux variant of Intel's current Transactional
2173 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2174 an experimental feature whose interface may change in future versions
2175 of GCC, as the official specification changes. Please note that not
2176 all architectures are supported for this feature.
2177
2178 For more information on GCC's support for transactional memory,
2179 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2180 Transactional Memory Library}.
2181
2182 Note that the transactional memory feature is not supported with
2183 non-call exceptions (@option{-fnon-call-exceptions}).
2184
2185 @item -fms-extensions
2186 @opindex fms-extensions
2187 Accept some non-standard constructs used in Microsoft header files.
2188
2189 In C++ code, this allows member names in structures to be similar
2190 to previous types declarations.
2191
2192 @smallexample
2193 typedef int UOW;
2194 struct ABC @{
2195 UOW UOW;
2196 @};
2197 @end smallexample
2198
2199 Some cases of unnamed fields in structures and unions are only
2200 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2201 fields within structs/unions}, for details.
2202
2203 Note that this option is off for all targets but x86
2204 targets using ms-abi.
2205
2206 @item -fplan9-extensions
2207 @opindex fplan9-extensions
2208 Accept some non-standard constructs used in Plan 9 code.
2209
2210 This enables @option{-fms-extensions}, permits passing pointers to
2211 structures with anonymous fields to functions that expect pointers to
2212 elements of the type of the field, and permits referring to anonymous
2213 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2214 struct/union fields within structs/unions}, for details. This is only
2215 supported for C, not C++.
2216
2217 @item -fcond-mismatch
2218 @opindex fcond-mismatch
2219 Allow conditional expressions with mismatched types in the second and
2220 third arguments. The value of such an expression is void. This option
2221 is not supported for C++.
2222
2223 @item -flax-vector-conversions
2224 @opindex flax-vector-conversions
2225 Allow implicit conversions between vectors with differing numbers of
2226 elements and/or incompatible element types. This option should not be
2227 used for new code.
2228
2229 @item -funsigned-char
2230 @opindex funsigned-char
2231 Let the type @code{char} be unsigned, like @code{unsigned char}.
2232
2233 Each kind of machine has a default for what @code{char} should
2234 be. It is either like @code{unsigned char} by default or like
2235 @code{signed char} by default.
2236
2237 Ideally, a portable program should always use @code{signed char} or
2238 @code{unsigned char} when it depends on the signedness of an object.
2239 But many programs have been written to use plain @code{char} and
2240 expect it to be signed, or expect it to be unsigned, depending on the
2241 machines they were written for. This option, and its inverse, let you
2242 make such a program work with the opposite default.
2243
2244 The type @code{char} is always a distinct type from each of
2245 @code{signed char} or @code{unsigned char}, even though its behavior
2246 is always just like one of those two.
2247
2248 @item -fsigned-char
2249 @opindex fsigned-char
2250 Let the type @code{char} be signed, like @code{signed char}.
2251
2252 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2253 the negative form of @option{-funsigned-char}. Likewise, the option
2254 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2255
2256 @item -fsigned-bitfields
2257 @itemx -funsigned-bitfields
2258 @itemx -fno-signed-bitfields
2259 @itemx -fno-unsigned-bitfields
2260 @opindex fsigned-bitfields
2261 @opindex funsigned-bitfields
2262 @opindex fno-signed-bitfields
2263 @opindex fno-unsigned-bitfields
2264 These options control whether a bit-field is signed or unsigned, when the
2265 declaration does not use either @code{signed} or @code{unsigned}. By
2266 default, such a bit-field is signed, because this is consistent: the
2267 basic integer types such as @code{int} are signed types.
2268
2269 @item -fsso-struct=@var{endianness}
2270 @opindex fsso-struct
2271 Set the default scalar storage order of structures and unions to the
2272 specified endianness. The accepted values are @samp{big-endian},
2273 @samp{little-endian} and @samp{native} for the native endianness of
2274 the target (the default). This option is not supported for C++.
2275
2276 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2277 code that is not binary compatible with code generated without it if the
2278 specified endianness is not the native endianness of the target.
2279 @end table
2280
2281 @node C++ Dialect Options
2282 @section Options Controlling C++ Dialect
2283
2284 @cindex compiler options, C++
2285 @cindex C++ options, command-line
2286 @cindex options, C++
2287 This section describes the command-line options that are only meaningful
2288 for C++ programs. You can also use most of the GNU compiler options
2289 regardless of what language your program is in. For example, you
2290 might compile a file @file{firstClass.C} like this:
2291
2292 @smallexample
2293 g++ -g -fstrict-enums -O -c firstClass.C
2294 @end smallexample
2295
2296 @noindent
2297 In this example, only @option{-fstrict-enums} is an option meant
2298 only for C++ programs; you can use the other options with any
2299 language supported by GCC@.
2300
2301 Some options for compiling C programs, such as @option{-std}, are also
2302 relevant for C++ programs.
2303 @xref{C Dialect Options,,Options Controlling C Dialect}.
2304
2305 Here is a list of options that are @emph{only} for compiling C++ programs:
2306
2307 @table @gcctabopt
2308
2309 @item -fabi-version=@var{n}
2310 @opindex fabi-version
2311 Use version @var{n} of the C++ ABI@. The default is version 0.
2312
2313 Version 0 refers to the version conforming most closely to
2314 the C++ ABI specification. Therefore, the ABI obtained using version 0
2315 will change in different versions of G++ as ABI bugs are fixed.
2316
2317 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2318
2319 Version 2 is the version of the C++ ABI that first appeared in G++
2320 3.4, and was the default through G++ 4.9.
2321
2322 Version 3 corrects an error in mangling a constant address as a
2323 template argument.
2324
2325 Version 4, which first appeared in G++ 4.5, implements a standard
2326 mangling for vector types.
2327
2328 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2329 attribute const/volatile on function pointer types, decltype of a
2330 plain decl, and use of a function parameter in the declaration of
2331 another parameter.
2332
2333 Version 6, which first appeared in G++ 4.7, corrects the promotion
2334 behavior of C++11 scoped enums and the mangling of template argument
2335 packs, const/static_cast, prefix ++ and --, and a class scope function
2336 used as a template argument.
2337
2338 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2339 builtin type and corrects the mangling of lambdas in default argument
2340 scope.
2341
2342 Version 8, which first appeared in G++ 4.9, corrects the substitution
2343 behavior of function types with function-cv-qualifiers.
2344
2345 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2346 @code{nullptr_t}.
2347
2348 Version 10, which first appeared in G++ 6.1, adds mangling of
2349 attributes that affect type identity, such as ia32 calling convention
2350 attributes (e.g. @samp{stdcall}).
2351
2352 Version 11, which first appeared in G++ 7, corrects the mangling of
2353 sizeof... expressions and operator names. For multiple entities with
2354 the same name within a function, that are declared in different scopes,
2355 the mangling now changes starting with the twelfth occurrence. It also
2356 implies @option{-fnew-inheriting-ctors}.
2357
2358 See also @option{-Wabi}.
2359
2360 @item -fabi-compat-version=@var{n}
2361 @opindex fabi-compat-version
2362 On targets that support strong aliases, G++
2363 works around mangling changes by creating an alias with the correct
2364 mangled name when defining a symbol with an incorrect mangled name.
2365 This switch specifies which ABI version to use for the alias.
2366
2367 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2368 compatibility). If another ABI version is explicitly selected, this
2369 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2370 use @option{-fabi-compat-version=2}.
2371
2372 If this option is not provided but @option{-Wabi=@var{n}} is, that
2373 version is used for compatibility aliases. If this option is provided
2374 along with @option{-Wabi} (without the version), the version from this
2375 option is used for the warning.
2376
2377 @item -fno-access-control
2378 @opindex fno-access-control
2379 Turn off all access checking. This switch is mainly useful for working
2380 around bugs in the access control code.
2381
2382 @item -faligned-new
2383 @opindex faligned-new
2384 Enable support for C++17 @code{new} of types that require more
2385 alignment than @code{void* ::operator new(std::size_t)} provides. A
2386 numeric argument such as @code{-faligned-new=32} can be used to
2387 specify how much alignment (in bytes) is provided by that function,
2388 but few users will need to override the default of
2389 @code{alignof(std::max_align_t)}.
2390
2391 This flag is enabled by default for @option{-std=c++17}.
2392
2393 @item -fcheck-new
2394 @opindex fcheck-new
2395 Check that the pointer returned by @code{operator new} is non-null
2396 before attempting to modify the storage allocated. This check is
2397 normally unnecessary because the C++ standard specifies that
2398 @code{operator new} only returns @code{0} if it is declared
2399 @code{throw()}, in which case the compiler always checks the
2400 return value even without this option. In all other cases, when
2401 @code{operator new} has a non-empty exception specification, memory
2402 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2403 @samp{new (nothrow)}.
2404
2405 @item -fconcepts
2406 @opindex fconcepts
2407 Enable support for the C++ Extensions for Concepts Technical
2408 Specification, ISO 19217 (2015), which allows code like
2409
2410 @smallexample
2411 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2412 template <Addable T> T add (T a, T b) @{ return a + b; @}
2413 @end smallexample
2414
2415 @item -fconstexpr-depth=@var{n}
2416 @opindex fconstexpr-depth
2417 Set the maximum nested evaluation depth for C++11 constexpr functions
2418 to @var{n}. A limit is needed to detect endless recursion during
2419 constant expression evaluation. The minimum specified by the standard
2420 is 512.
2421
2422 @item -fconstexpr-loop-limit=@var{n}
2423 @opindex fconstexpr-loop-limit
2424 Set the maximum number of iterations for a loop in C++14 constexpr functions
2425 to @var{n}. A limit is needed to detect infinite loops during
2426 constant expression evaluation. The default is 262144 (1<<18).
2427
2428 @item -fdeduce-init-list
2429 @opindex fdeduce-init-list
2430 Enable deduction of a template type parameter as
2431 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2432
2433 @smallexample
2434 template <class T> auto forward(T t) -> decltype (realfn (t))
2435 @{
2436 return realfn (t);
2437 @}
2438
2439 void f()
2440 @{
2441 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2442 @}
2443 @end smallexample
2444
2445 This deduction was implemented as a possible extension to the
2446 originally proposed semantics for the C++11 standard, but was not part
2447 of the final standard, so it is disabled by default. This option is
2448 deprecated, and may be removed in a future version of G++.
2449
2450 @item -fno-elide-constructors
2451 @opindex fno-elide-constructors
2452 The C++ standard allows an implementation to omit creating a temporary
2453 that is only used to initialize another object of the same type.
2454 Specifying this option disables that optimization, and forces G++ to
2455 call the copy constructor in all cases. This option also causes G++
2456 to call trivial member functions which otherwise would be expanded inline.
2457
2458 In C++17, the compiler is required to omit these temporaries, but this
2459 option still affects trivial member functions.
2460
2461 @item -fno-enforce-eh-specs
2462 @opindex fno-enforce-eh-specs
2463 Don't generate code to check for violation of exception specifications
2464 at run time. This option violates the C++ standard, but may be useful
2465 for reducing code size in production builds, much like defining
2466 @code{NDEBUG}. This does not give user code permission to throw
2467 exceptions in violation of the exception specifications; the compiler
2468 still optimizes based on the specifications, so throwing an
2469 unexpected exception results in undefined behavior at run time.
2470
2471 @item -fextern-tls-init
2472 @itemx -fno-extern-tls-init
2473 @opindex fextern-tls-init
2474 @opindex fno-extern-tls-init
2475 The C++11 and OpenMP standards allow @code{thread_local} and
2476 @code{threadprivate} variables to have dynamic (runtime)
2477 initialization. To support this, any use of such a variable goes
2478 through a wrapper function that performs any necessary initialization.
2479 When the use and definition of the variable are in the same
2480 translation unit, this overhead can be optimized away, but when the
2481 use is in a different translation unit there is significant overhead
2482 even if the variable doesn't actually need dynamic initialization. If
2483 the programmer can be sure that no use of the variable in a
2484 non-defining TU needs to trigger dynamic initialization (either
2485 because the variable is statically initialized, or a use of the
2486 variable in the defining TU will be executed before any uses in
2487 another TU), they can avoid this overhead with the
2488 @option{-fno-extern-tls-init} option.
2489
2490 On targets that support symbol aliases, the default is
2491 @option{-fextern-tls-init}. On targets that do not support symbol
2492 aliases, the default is @option{-fno-extern-tls-init}.
2493
2494 @item -fno-gnu-keywords
2495 @opindex fno-gnu-keywords
2496 Do not recognize @code{typeof} as a keyword, so that code can use this
2497 word as an identifier. You can use the keyword @code{__typeof__} instead.
2498 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2499 @option{-std=c++98}, @option{-std=c++11}, etc.
2500
2501 @item -fno-implicit-templates
2502 @opindex fno-implicit-templates
2503 Never emit code for non-inline templates that are instantiated
2504 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2505 @xref{Template Instantiation}, for more information.
2506
2507 @item -fno-implicit-inline-templates
2508 @opindex fno-implicit-inline-templates
2509 Don't emit code for implicit instantiations of inline templates, either.
2510 The default is to handle inlines differently so that compiles with and
2511 without optimization need the same set of explicit instantiations.
2512
2513 @item -fno-implement-inlines
2514 @opindex fno-implement-inlines
2515 To save space, do not emit out-of-line copies of inline functions
2516 controlled by @code{#pragma implementation}. This causes linker
2517 errors if these functions are not inlined everywhere they are called.
2518
2519 @item -fms-extensions
2520 @opindex fms-extensions
2521 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2522 int and getting a pointer to member function via non-standard syntax.
2523
2524 @item -fnew-inheriting-ctors
2525 @opindex fnew-inheriting-ctors
2526 Enable the P0136 adjustment to the semantics of C++11 constructor
2527 inheritance. This is part of C++17 but also considered to be a Defect
2528 Report against C++11 and C++14. This flag is enabled by default
2529 unless @option{-fabi-version=10} or lower is specified.
2530
2531 @item -fnew-ttp-matching
2532 @opindex fnew-ttp-matching
2533 Enable the P0522 resolution to Core issue 150, template template
2534 parameters and default arguments: this allows a template with default
2535 template arguments as an argument for a template template parameter
2536 with fewer template parameters. This flag is enabled by default for
2537 @option{-std=c++17}.
2538
2539 @item -fno-nonansi-builtins
2540 @opindex fno-nonansi-builtins
2541 Disable built-in declarations of functions that are not mandated by
2542 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2543 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2544
2545 @item -fnothrow-opt
2546 @opindex fnothrow-opt
2547 Treat a @code{throw()} exception specification as if it were a
2548 @code{noexcept} specification to reduce or eliminate the text size
2549 overhead relative to a function with no exception specification. If
2550 the function has local variables of types with non-trivial
2551 destructors, the exception specification actually makes the
2552 function smaller because the EH cleanups for those variables can be
2553 optimized away. The semantic effect is that an exception thrown out of
2554 a function with such an exception specification results in a call
2555 to @code{terminate} rather than @code{unexpected}.
2556
2557 @item -fno-operator-names
2558 @opindex fno-operator-names
2559 Do not treat the operator name keywords @code{and}, @code{bitand},
2560 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2561 synonyms as keywords.
2562
2563 @item -fno-optional-diags
2564 @opindex fno-optional-diags
2565 Disable diagnostics that the standard says a compiler does not need to
2566 issue. Currently, the only such diagnostic issued by G++ is the one for
2567 a name having multiple meanings within a class.
2568
2569 @item -fpermissive
2570 @opindex fpermissive
2571 Downgrade some diagnostics about nonconformant code from errors to
2572 warnings. Thus, using @option{-fpermissive} allows some
2573 nonconforming code to compile.
2574
2575 @item -fno-pretty-templates
2576 @opindex fno-pretty-templates
2577 When an error message refers to a specialization of a function
2578 template, the compiler normally prints the signature of the
2579 template followed by the template arguments and any typedefs or
2580 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2581 rather than @code{void f(int)}) so that it's clear which template is
2582 involved. When an error message refers to a specialization of a class
2583 template, the compiler omits any template arguments that match
2584 the default template arguments for that template. If either of these
2585 behaviors make it harder to understand the error message rather than
2586 easier, you can use @option{-fno-pretty-templates} to disable them.
2587
2588 @item -frepo
2589 @opindex frepo
2590 Enable automatic template instantiation at link time. This option also
2591 implies @option{-fno-implicit-templates}. @xref{Template
2592 Instantiation}, for more information.
2593
2594 @item -fno-rtti
2595 @opindex fno-rtti
2596 Disable generation of information about every class with virtual
2597 functions for use by the C++ run-time type identification features
2598 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2599 of the language, you can save some space by using this flag. Note that
2600 exception handling uses the same information, but G++ generates it as
2601 needed. The @code{dynamic_cast} operator can still be used for casts that
2602 do not require run-time type information, i.e.@: casts to @code{void *} or to
2603 unambiguous base classes.
2604
2605 @item -fsized-deallocation
2606 @opindex fsized-deallocation
2607 Enable the built-in global declarations
2608 @smallexample
2609 void operator delete (void *, std::size_t) noexcept;
2610 void operator delete[] (void *, std::size_t) noexcept;
2611 @end smallexample
2612 as introduced in C++14. This is useful for user-defined replacement
2613 deallocation functions that, for example, use the size of the object
2614 to make deallocation faster. Enabled by default under
2615 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2616 warns about places that might want to add a definition.
2617
2618 @item -fstrict-enums
2619 @opindex fstrict-enums
2620 Allow the compiler to optimize using the assumption that a value of
2621 enumerated type can only be one of the values of the enumeration (as
2622 defined in the C++ standard; basically, a value that can be
2623 represented in the minimum number of bits needed to represent all the
2624 enumerators). This assumption may not be valid if the program uses a
2625 cast to convert an arbitrary integer value to the enumerated type.
2626
2627 @item -fstrong-eval-order
2628 @opindex fstrong-eval-order
2629 Evaluate member access, array subscripting, and shift expressions in
2630 left-to-right order, and evaluate assignment in right-to-left order,
2631 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2632 @option{-fstrong-eval-order=some} enables just the ordering of member
2633 access and shift expressions, and is the default without
2634 @option{-std=c++17}.
2635
2636 @item -ftemplate-backtrace-limit=@var{n}
2637 @opindex ftemplate-backtrace-limit
2638 Set the maximum number of template instantiation notes for a single
2639 warning or error to @var{n}. The default value is 10.
2640
2641 @item -ftemplate-depth=@var{n}
2642 @opindex ftemplate-depth
2643 Set the maximum instantiation depth for template classes to @var{n}.
2644 A limit on the template instantiation depth is needed to detect
2645 endless recursions during template class instantiation. ANSI/ISO C++
2646 conforming programs must not rely on a maximum depth greater than 17
2647 (changed to 1024 in C++11). The default value is 900, as the compiler
2648 can run out of stack space before hitting 1024 in some situations.
2649
2650 @item -fno-threadsafe-statics
2651 @opindex fno-threadsafe-statics
2652 Do not emit the extra code to use the routines specified in the C++
2653 ABI for thread-safe initialization of local statics. You can use this
2654 option to reduce code size slightly in code that doesn't need to be
2655 thread-safe.
2656
2657 @item -fuse-cxa-atexit
2658 @opindex fuse-cxa-atexit
2659 Register destructors for objects with static storage duration with the
2660 @code{__cxa_atexit} function rather than the @code{atexit} function.
2661 This option is required for fully standards-compliant handling of static
2662 destructors, but only works if your C library supports
2663 @code{__cxa_atexit}.
2664
2665 @item -fno-use-cxa-get-exception-ptr
2666 @opindex fno-use-cxa-get-exception-ptr
2667 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2668 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2669 if the runtime routine is not available.
2670
2671 @item -fvisibility-inlines-hidden
2672 @opindex fvisibility-inlines-hidden
2673 This switch declares that the user does not attempt to compare
2674 pointers to inline functions or methods where the addresses of the two functions
2675 are taken in different shared objects.
2676
2677 The effect of this is that GCC may, effectively, mark inline methods with
2678 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2679 appear in the export table of a DSO and do not require a PLT indirection
2680 when used within the DSO@. Enabling this option can have a dramatic effect
2681 on load and link times of a DSO as it massively reduces the size of the
2682 dynamic export table when the library makes heavy use of templates.
2683
2684 The behavior of this switch is not quite the same as marking the
2685 methods as hidden directly, because it does not affect static variables
2686 local to the function or cause the compiler to deduce that
2687 the function is defined in only one shared object.
2688
2689 You may mark a method as having a visibility explicitly to negate the
2690 effect of the switch for that method. For example, if you do want to
2691 compare pointers to a particular inline method, you might mark it as
2692 having default visibility. Marking the enclosing class with explicit
2693 visibility has no effect.
2694
2695 Explicitly instantiated inline methods are unaffected by this option
2696 as their linkage might otherwise cross a shared library boundary.
2697 @xref{Template Instantiation}.
2698
2699 @item -fvisibility-ms-compat
2700 @opindex fvisibility-ms-compat
2701 This flag attempts to use visibility settings to make GCC's C++
2702 linkage model compatible with that of Microsoft Visual Studio.
2703
2704 The flag makes these changes to GCC's linkage model:
2705
2706 @enumerate
2707 @item
2708 It sets the default visibility to @code{hidden}, like
2709 @option{-fvisibility=hidden}.
2710
2711 @item
2712 Types, but not their members, are not hidden by default.
2713
2714 @item
2715 The One Definition Rule is relaxed for types without explicit
2716 visibility specifications that are defined in more than one
2717 shared object: those declarations are permitted if they are
2718 permitted when this option is not used.
2719 @end enumerate
2720
2721 In new code it is better to use @option{-fvisibility=hidden} and
2722 export those classes that are intended to be externally visible.
2723 Unfortunately it is possible for code to rely, perhaps accidentally,
2724 on the Visual Studio behavior.
2725
2726 Among the consequences of these changes are that static data members
2727 of the same type with the same name but defined in different shared
2728 objects are different, so changing one does not change the other;
2729 and that pointers to function members defined in different shared
2730 objects may not compare equal. When this flag is given, it is a
2731 violation of the ODR to define types with the same name differently.
2732
2733 @item -fno-weak
2734 @opindex fno-weak
2735 Do not use weak symbol support, even if it is provided by the linker.
2736 By default, G++ uses weak symbols if they are available. This
2737 option exists only for testing, and should not be used by end-users;
2738 it results in inferior code and has no benefits. This option may
2739 be removed in a future release of G++.
2740
2741 @item -nostdinc++
2742 @opindex nostdinc++
2743 Do not search for header files in the standard directories specific to
2744 C++, but do still search the other standard directories. (This option
2745 is used when building the C++ library.)
2746 @end table
2747
2748 In addition, these optimization, warning, and code generation options
2749 have meanings only for C++ programs:
2750
2751 @table @gcctabopt
2752 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2753 @opindex Wabi
2754 @opindex Wno-abi
2755 Warn when G++ it generates code that is probably not compatible with
2756 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2757 ABI with each major release, normally @option{-Wabi} will warn only if
2758 there is a check added later in a release series for an ABI issue
2759 discovered since the initial release. @option{-Wabi} will warn about
2760 more things if an older ABI version is selected (with
2761 @option{-fabi-version=@var{n}}).
2762
2763 @option{-Wabi} can also be used with an explicit version number to
2764 warn about compatibility with a particular @option{-fabi-version}
2765 level, e.g. @option{-Wabi=2} to warn about changes relative to
2766 @option{-fabi-version=2}.
2767
2768 If an explicit version number is provided and
2769 @option{-fabi-compat-version} is not specified, the version number
2770 from this option is used for compatibility aliases. If no explicit
2771 version number is provided with this option, but
2772 @option{-fabi-compat-version} is specified, that version number is
2773 used for ABI warnings.
2774
2775 Although an effort has been made to warn about
2776 all such cases, there are probably some cases that are not warned about,
2777 even though G++ is generating incompatible code. There may also be
2778 cases where warnings are emitted even though the code that is generated
2779 is compatible.
2780
2781 You should rewrite your code to avoid these warnings if you are
2782 concerned about the fact that code generated by G++ may not be binary
2783 compatible with code generated by other compilers.
2784
2785 Known incompatibilities in @option{-fabi-version=2} (which was the
2786 default from GCC 3.4 to 4.9) include:
2787
2788 @itemize @bullet
2789
2790 @item
2791 A template with a non-type template parameter of reference type was
2792 mangled incorrectly:
2793 @smallexample
2794 extern int N;
2795 template <int &> struct S @{@};
2796 void n (S<N>) @{2@}
2797 @end smallexample
2798
2799 This was fixed in @option{-fabi-version=3}.
2800
2801 @item
2802 SIMD vector types declared using @code{__attribute ((vector_size))} were
2803 mangled in a non-standard way that does not allow for overloading of
2804 functions taking vectors of different sizes.
2805
2806 The mangling was changed in @option{-fabi-version=4}.
2807
2808 @item
2809 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2810 qualifiers, and @code{decltype} of a plain declaration was folded away.
2811
2812 These mangling issues were fixed in @option{-fabi-version=5}.
2813
2814 @item
2815 Scoped enumerators passed as arguments to a variadic function are
2816 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2817 On most targets this does not actually affect the parameter passing
2818 ABI, as there is no way to pass an argument smaller than @code{int}.
2819
2820 Also, the ABI changed the mangling of template argument packs,
2821 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2822 a class scope function used as a template argument.
2823
2824 These issues were corrected in @option{-fabi-version=6}.
2825
2826 @item
2827 Lambdas in default argument scope were mangled incorrectly, and the
2828 ABI changed the mangling of @code{nullptr_t}.
2829
2830 These issues were corrected in @option{-fabi-version=7}.
2831
2832 @item
2833 When mangling a function type with function-cv-qualifiers, the
2834 un-qualified function type was incorrectly treated as a substitution
2835 candidate.
2836
2837 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2838
2839 @item
2840 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2841 unaligned accesses. Note that this did not affect the ABI of a
2842 function with a @code{nullptr_t} parameter, as parameters have a
2843 minimum alignment.
2844
2845 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2846
2847 @item
2848 Target-specific attributes that affect the identity of a type, such as
2849 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2850 did not affect the mangled name, leading to name collisions when
2851 function pointers were used as template arguments.
2852
2853 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2854
2855 @end itemize
2856
2857 It also warns about psABI-related changes. The known psABI changes at this
2858 point include:
2859
2860 @itemize @bullet
2861
2862 @item
2863 For SysV/x86-64, unions with @code{long double} members are
2864 passed in memory as specified in psABI. For example:
2865
2866 @smallexample
2867 union U @{
2868 long double ld;
2869 int i;
2870 @};
2871 @end smallexample
2872
2873 @noindent
2874 @code{union U} is always passed in memory.
2875
2876 @end itemize
2877
2878 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2879 @opindex Wabi-tag
2880 @opindex -Wabi-tag
2881 Warn when a type with an ABI tag is used in a context that does not
2882 have that ABI tag. See @ref{C++ Attributes} for more information
2883 about ABI tags.
2884
2885 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2886 @opindex Wctor-dtor-privacy
2887 @opindex Wno-ctor-dtor-privacy
2888 Warn when a class seems unusable because all the constructors or
2889 destructors in that class are private, and it has neither friends nor
2890 public static member functions. Also warn if there are no non-private
2891 methods, and there's at least one private member function that isn't
2892 a constructor or destructor.
2893
2894 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2895 @opindex Wdelete-non-virtual-dtor
2896 @opindex Wno-delete-non-virtual-dtor
2897 Warn when @code{delete} is used to destroy an instance of a class that
2898 has virtual functions and non-virtual destructor. It is unsafe to delete
2899 an instance of a derived class through a pointer to a base class if the
2900 base class does not have a virtual destructor. This warning is enabled
2901 by @option{-Wall}.
2902
2903 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2904 @opindex Wliteral-suffix
2905 @opindex Wno-literal-suffix
2906 Warn when a string or character literal is followed by a ud-suffix which does
2907 not begin with an underscore. As a conforming extension, GCC treats such
2908 suffixes as separate preprocessing tokens in order to maintain backwards
2909 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2910 For example:
2911
2912 @smallexample
2913 #define __STDC_FORMAT_MACROS
2914 #include <inttypes.h>
2915 #include <stdio.h>
2916
2917 int main() @{
2918 int64_t i64 = 123;
2919 printf("My int64: %" PRId64"\n", i64);
2920 @}
2921 @end smallexample
2922
2923 In this case, @code{PRId64} is treated as a separate preprocessing token.
2924
2925 Additionally, warn when a user-defined literal operator is declared with
2926 a literal suffix identifier that doesn't begin with an underscore. Literal
2927 suffix identifiers that don't begin with an underscore are reserved for
2928 future standardization.
2929
2930 This warning is enabled by default.
2931
2932 @item -Wlto-type-mismatch
2933 @opindex Wlto-type-mismatch
2934 @opindex Wno-lto-type-mismatch
2935
2936 During the link-time optimization warn about type mismatches in
2937 global declarations from different compilation units.
2938 Requires @option{-flto} to be enabled. Enabled by default.
2939
2940 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
2941 @opindex Wnarrowing
2942 @opindex Wno-narrowing
2943 For C++11 and later standards, narrowing conversions are diagnosed by default,
2944 as required by the standard. A narrowing conversion from a constant produces
2945 an error, and a narrowing conversion from a non-constant produces a warning,
2946 but @option{-Wno-narrowing} suppresses the diagnostic.
2947 Note that this does not affect the meaning of well-formed code;
2948 narrowing conversions are still considered ill-formed in SFINAE contexts.
2949
2950 With @option{-Wnarrowing} in C++98, warn when a narrowing
2951 conversion prohibited by C++11 occurs within
2952 @samp{@{ @}}, e.g.
2953
2954 @smallexample
2955 int i = @{ 2.2 @}; // error: narrowing from double to int
2956 @end smallexample
2957
2958 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2959
2960 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2961 @opindex Wnoexcept
2962 @opindex Wno-noexcept
2963 Warn when a noexcept-expression evaluates to false because of a call
2964 to a function that does not have a non-throwing exception
2965 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2966 the compiler to never throw an exception.
2967
2968 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
2969 @opindex Wnoexcept-type
2970 @opindex Wno-noexcept-type
2971 Warn if the C++17 feature making @code{noexcept} part of a function
2972 type changes the mangled name of a symbol relative to C++14. Enabled
2973 by @option{-Wabi} and @option{-Wc++17-compat}.
2974
2975 As an example:
2976
2977 @smallexample
2978 template <class T> void f(T t) @{ t(); @};
2979 void g() noexcept;
2980 void h() @{ f(g); @}
2981 @end smallexample
2982
2983 @noindent
2984 In C++14, @code{f} calls calls @code{f<void(*)()>}, but in
2985 C++17 it calls @code{f<void(*)()noexcept>}.
2986
2987 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
2988 @opindex Wclass-memaccess
2989 Warn when the destination of a call to a raw memory function such as
2990 @code{memset} or @code{memcpy} is an object of class type, and when writing
2991 into such an object might bypass the class non-trivial or deleted constructor
2992 or copy assignment, violate const-correctness or encapsulation, or corrupt
2993 virtual table pointers. Modifying the representation of such objects may
2994 violate invariants maintained by member functions of the class. For example,
2995 the call to @code{memset} below is undefined because it modifies a non-trivial
2996 class object and is, therefore, diagnosed. The safe way to either initialize
2997 or clear the storage of objects of such types is by using the appropriate
2998 constructor or assignment operator, if one is available.
2999 @smallexample
3000 std::string str = "abc";
3001 memset (&str, 0, sizeof str);
3002 @end smallexample
3003 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3004 Explicitly casting the pointer to the class object to @code{void *} or
3005 to a type that can be safely accessed by the raw memory function suppresses
3006 the warning.
3007
3008 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3009 @opindex Wnon-virtual-dtor
3010 @opindex Wno-non-virtual-dtor
3011 Warn when a class has virtual functions and an accessible non-virtual
3012 destructor itself or in an accessible polymorphic base class, in which
3013 case it is possible but unsafe to delete an instance of a derived
3014 class through a pointer to the class itself or base class. This
3015 warning is automatically enabled if @option{-Weffc++} is specified.
3016
3017 @item -Wregister @r{(C++ and Objective-C++ only)}
3018 @opindex Wregister
3019 @opindex Wno-register
3020 Warn on uses of the @code{register} storage class specifier, except
3021 when it is part of the GNU @ref{Explicit Register Variables} extension.
3022 The use of the @code{register} keyword as storage class specifier has
3023 been deprecated in C++11 and removed in C++17.
3024 Enabled by default with @option{-std=c++17}.
3025
3026 @item -Wreorder @r{(C++ and Objective-C++ only)}
3027 @opindex Wreorder
3028 @opindex Wno-reorder
3029 @cindex reordering, warning
3030 @cindex warning for reordering of member initializers
3031 Warn when the order of member initializers given in the code does not
3032 match the order in which they must be executed. For instance:
3033
3034 @smallexample
3035 struct A @{
3036 int i;
3037 int j;
3038 A(): j (0), i (1) @{ @}
3039 @};
3040 @end smallexample
3041
3042 @noindent
3043 The compiler rearranges the member initializers for @code{i}
3044 and @code{j} to match the declaration order of the members, emitting
3045 a warning to that effect. This warning is enabled by @option{-Wall}.
3046
3047 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3048 @opindex fext-numeric-literals
3049 @opindex fno-ext-numeric-literals
3050 Accept imaginary, fixed-point, or machine-defined
3051 literal number suffixes as GNU extensions.
3052 When this option is turned off these suffixes are treated
3053 as C++11 user-defined literal numeric suffixes.
3054 This is on by default for all pre-C++11 dialects and all GNU dialects:
3055 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3056 @option{-std=gnu++14}.
3057 This option is off by default
3058 for ISO C++11 onwards (@option{-std=c++11}, ...).
3059 @end table
3060
3061 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3062
3063 @table @gcctabopt
3064 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3065 @opindex Weffc++
3066 @opindex Wno-effc++
3067 Warn about violations of the following style guidelines from Scott Meyers'
3068 @cite{Effective C++} series of books:
3069
3070 @itemize @bullet
3071 @item
3072 Define a copy constructor and an assignment operator for classes
3073 with dynamically-allocated memory.
3074
3075 @item
3076 Prefer initialization to assignment in constructors.
3077
3078 @item
3079 Have @code{operator=} return a reference to @code{*this}.
3080
3081 @item
3082 Don't try to return a reference when you must return an object.
3083
3084 @item
3085 Distinguish between prefix and postfix forms of increment and
3086 decrement operators.
3087
3088 @item
3089 Never overload @code{&&}, @code{||}, or @code{,}.
3090
3091 @end itemize
3092
3093 This option also enables @option{-Wnon-virtual-dtor}, which is also
3094 one of the effective C++ recommendations. However, the check is
3095 extended to warn about the lack of virtual destructor in accessible
3096 non-polymorphic bases classes too.
3097
3098 When selecting this option, be aware that the standard library
3099 headers do not obey all of these guidelines; use @samp{grep -v}
3100 to filter out those warnings.
3101
3102 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3103 @opindex Wstrict-null-sentinel
3104 @opindex Wno-strict-null-sentinel
3105 Warn about the use of an uncasted @code{NULL} as sentinel. When
3106 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3107 to @code{__null}. Although it is a null pointer constant rather than a
3108 null pointer, it is guaranteed to be of the same size as a pointer.
3109 But this use is not portable across different compilers.
3110
3111 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3112 @opindex Wno-non-template-friend
3113 @opindex Wnon-template-friend
3114 Disable warnings when non-template friend functions are declared
3115 within a template. In very old versions of GCC that predate implementation
3116 of the ISO standard, declarations such as
3117 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3118 could be interpreted as a particular specialization of a template
3119 function; the warning exists to diagnose compatibility problems,
3120 and is enabled by default.
3121
3122 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3123 @opindex Wold-style-cast
3124 @opindex Wno-old-style-cast
3125 Warn if an old-style (C-style) cast to a non-void type is used within
3126 a C++ program. The new-style casts (@code{dynamic_cast},
3127 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3128 less vulnerable to unintended effects and much easier to search for.
3129
3130 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3131 @opindex Woverloaded-virtual
3132 @opindex Wno-overloaded-virtual
3133 @cindex overloaded virtual function, warning
3134 @cindex warning for overloaded virtual function
3135 Warn when a function declaration hides virtual functions from a
3136 base class. For example, in:
3137
3138 @smallexample
3139 struct A @{
3140 virtual void f();
3141 @};
3142
3143 struct B: public A @{
3144 void f(int);
3145 @};
3146 @end smallexample
3147
3148 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3149 like:
3150
3151 @smallexample
3152 B* b;
3153 b->f();
3154 @end smallexample
3155
3156 @noindent
3157 fails to compile.
3158
3159 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3160 @opindex Wno-pmf-conversions
3161 @opindex Wpmf-conversions
3162 Disable the diagnostic for converting a bound pointer to member function
3163 to a plain pointer.
3164
3165 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3166 @opindex Wsign-promo
3167 @opindex Wno-sign-promo
3168 Warn when overload resolution chooses a promotion from unsigned or
3169 enumerated type to a signed type, over a conversion to an unsigned type of
3170 the same size. Previous versions of G++ tried to preserve
3171 unsignedness, but the standard mandates the current behavior.
3172
3173 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3174 @opindex Wtemplates
3175 Warn when a primary template declaration is encountered. Some coding
3176 rules disallow templates, and this may be used to enforce that rule.
3177 The warning is inactive inside a system header file, such as the STL, so
3178 one can still use the STL. One may also instantiate or specialize
3179 templates.
3180
3181 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3182 @opindex Wmultiple-inheritance
3183 Warn when a class is defined with multiple direct base classes. Some
3184 coding rules disallow multiple inheritance, and this may be used to
3185 enforce that rule. The warning is inactive inside a system header file,
3186 such as the STL, so one can still use the STL. One may also define
3187 classes that indirectly use multiple inheritance.
3188
3189 @item -Wvirtual-inheritance
3190 @opindex Wvirtual-inheritance
3191 Warn when a class is defined with a virtual direct base class. Some
3192 coding rules disallow multiple inheritance, and this may be used to
3193 enforce that rule. The warning is inactive inside a system header file,
3194 such as the STL, so one can still use the STL. One may also define
3195 classes that indirectly use virtual inheritance.
3196
3197 @item -Wnamespaces
3198 @opindex Wnamespaces
3199 Warn when a namespace definition is opened. Some coding rules disallow
3200 namespaces, and this may be used to enforce that rule. The warning is
3201 inactive inside a system header file, such as the STL, so one can still
3202 use the STL. One may also use using directives and qualified names.
3203
3204 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3205 @opindex Wterminate
3206 @opindex Wno-terminate
3207 Disable the warning about a throw-expression that will immediately
3208 result in a call to @code{terminate}.
3209 @end table
3210
3211 @node Objective-C and Objective-C++ Dialect Options
3212 @section Options Controlling Objective-C and Objective-C++ Dialects
3213
3214 @cindex compiler options, Objective-C and Objective-C++
3215 @cindex Objective-C and Objective-C++ options, command-line
3216 @cindex options, Objective-C and Objective-C++
3217 (NOTE: This manual does not describe the Objective-C and Objective-C++
3218 languages themselves. @xref{Standards,,Language Standards
3219 Supported by GCC}, for references.)
3220
3221 This section describes the command-line options that are only meaningful
3222 for Objective-C and Objective-C++ programs. You can also use most of
3223 the language-independent GNU compiler options.
3224 For example, you might compile a file @file{some_class.m} like this:
3225
3226 @smallexample
3227 gcc -g -fgnu-runtime -O -c some_class.m
3228 @end smallexample
3229
3230 @noindent
3231 In this example, @option{-fgnu-runtime} is an option meant only for
3232 Objective-C and Objective-C++ programs; you can use the other options with
3233 any language supported by GCC@.
3234
3235 Note that since Objective-C is an extension of the C language, Objective-C
3236 compilations may also use options specific to the C front-end (e.g.,
3237 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3238 C++-specific options (e.g., @option{-Wabi}).
3239
3240 Here is a list of options that are @emph{only} for compiling Objective-C
3241 and Objective-C++ programs:
3242
3243 @table @gcctabopt
3244 @item -fconstant-string-class=@var{class-name}
3245 @opindex fconstant-string-class
3246 Use @var{class-name} as the name of the class to instantiate for each
3247 literal string specified with the syntax @code{@@"@dots{}"}. The default
3248 class name is @code{NXConstantString} if the GNU runtime is being used, and
3249 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3250 @option{-fconstant-cfstrings} option, if also present, overrides the
3251 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3252 to be laid out as constant CoreFoundation strings.
3253
3254 @item -fgnu-runtime
3255 @opindex fgnu-runtime
3256 Generate object code compatible with the standard GNU Objective-C
3257 runtime. This is the default for most types of systems.
3258
3259 @item -fnext-runtime
3260 @opindex fnext-runtime
3261 Generate output compatible with the NeXT runtime. This is the default
3262 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3263 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3264 used.
3265
3266 @item -fno-nil-receivers
3267 @opindex fno-nil-receivers
3268 Assume that all Objective-C message dispatches (@code{[receiver
3269 message:arg]}) in this translation unit ensure that the receiver is
3270 not @code{nil}. This allows for more efficient entry points in the
3271 runtime to be used. This option is only available in conjunction with
3272 the NeXT runtime and ABI version 0 or 1.
3273
3274 @item -fobjc-abi-version=@var{n}
3275 @opindex fobjc-abi-version
3276 Use version @var{n} of the Objective-C ABI for the selected runtime.
3277 This option is currently supported only for the NeXT runtime. In that
3278 case, Version 0 is the traditional (32-bit) ABI without support for
3279 properties and other Objective-C 2.0 additions. Version 1 is the
3280 traditional (32-bit) ABI with support for properties and other
3281 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3282 nothing is specified, the default is Version 0 on 32-bit target
3283 machines, and Version 2 on 64-bit target machines.
3284
3285 @item -fobjc-call-cxx-cdtors
3286 @opindex fobjc-call-cxx-cdtors
3287 For each Objective-C class, check if any of its instance variables is a
3288 C++ object with a non-trivial default constructor. If so, synthesize a
3289 special @code{- (id) .cxx_construct} instance method which runs
3290 non-trivial default constructors on any such instance variables, in order,
3291 and then return @code{self}. Similarly, check if any instance variable
3292 is a C++ object with a non-trivial destructor, and if so, synthesize a
3293 special @code{- (void) .cxx_destruct} method which runs
3294 all such default destructors, in reverse order.
3295
3296 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3297 methods thusly generated only operate on instance variables
3298 declared in the current Objective-C class, and not those inherited
3299 from superclasses. It is the responsibility of the Objective-C
3300 runtime to invoke all such methods in an object's inheritance
3301 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3302 by the runtime immediately after a new object instance is allocated;
3303 the @code{- (void) .cxx_destruct} methods are invoked immediately
3304 before the runtime deallocates an object instance.
3305
3306 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3307 support for invoking the @code{- (id) .cxx_construct} and
3308 @code{- (void) .cxx_destruct} methods.
3309
3310 @item -fobjc-direct-dispatch
3311 @opindex fobjc-direct-dispatch
3312 Allow fast jumps to the message dispatcher. On Darwin this is
3313 accomplished via the comm page.
3314
3315 @item -fobjc-exceptions
3316 @opindex fobjc-exceptions
3317 Enable syntactic support for structured exception handling in
3318 Objective-C, similar to what is offered by C++. This option
3319 is required to use the Objective-C keywords @code{@@try},
3320 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3321 @code{@@synchronized}. This option is available with both the GNU
3322 runtime and the NeXT runtime (but not available in conjunction with
3323 the NeXT runtime on Mac OS X 10.2 and earlier).
3324
3325 @item -fobjc-gc
3326 @opindex fobjc-gc
3327 Enable garbage collection (GC) in Objective-C and Objective-C++
3328 programs. This option is only available with the NeXT runtime; the
3329 GNU runtime has a different garbage collection implementation that
3330 does not require special compiler flags.
3331
3332 @item -fobjc-nilcheck
3333 @opindex fobjc-nilcheck
3334 For the NeXT runtime with version 2 of the ABI, check for a nil
3335 receiver in method invocations before doing the actual method call.
3336 This is the default and can be disabled using
3337 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3338 checked for nil in this way no matter what this flag is set to.
3339 Currently this flag does nothing when the GNU runtime, or an older
3340 version of the NeXT runtime ABI, is used.
3341
3342 @item -fobjc-std=objc1
3343 @opindex fobjc-std
3344 Conform to the language syntax of Objective-C 1.0, the language
3345 recognized by GCC 4.0. This only affects the Objective-C additions to
3346 the C/C++ language; it does not affect conformance to C/C++ standards,
3347 which is controlled by the separate C/C++ dialect option flags. When
3348 this option is used with the Objective-C or Objective-C++ compiler,
3349 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3350 This is useful if you need to make sure that your Objective-C code can
3351 be compiled with older versions of GCC@.
3352
3353 @item -freplace-objc-classes
3354 @opindex freplace-objc-classes
3355 Emit a special marker instructing @command{ld(1)} not to statically link in
3356 the resulting object file, and allow @command{dyld(1)} to load it in at
3357 run time instead. This is used in conjunction with the Fix-and-Continue
3358 debugging mode, where the object file in question may be recompiled and
3359 dynamically reloaded in the course of program execution, without the need
3360 to restart the program itself. Currently, Fix-and-Continue functionality
3361 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3362 and later.
3363
3364 @item -fzero-link
3365 @opindex fzero-link
3366 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3367 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3368 compile time) with static class references that get initialized at load time,
3369 which improves run-time performance. Specifying the @option{-fzero-link} flag
3370 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3371 to be retained. This is useful in Zero-Link debugging mode, since it allows
3372 for individual class implementations to be modified during program execution.
3373 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3374 regardless of command-line options.
3375
3376 @item -fno-local-ivars
3377 @opindex fno-local-ivars
3378 @opindex flocal-ivars
3379 By default instance variables in Objective-C can be accessed as if
3380 they were local variables from within the methods of the class they're
3381 declared in. This can lead to shadowing between instance variables
3382 and other variables declared either locally inside a class method or
3383 globally with the same name. Specifying the @option{-fno-local-ivars}
3384 flag disables this behavior thus avoiding variable shadowing issues.
3385
3386 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3387 @opindex fivar-visibility
3388 Set the default instance variable visibility to the specified option
3389 so that instance variables declared outside the scope of any access
3390 modifier directives default to the specified visibility.
3391
3392 @item -gen-decls
3393 @opindex gen-decls
3394 Dump interface declarations for all classes seen in the source file to a
3395 file named @file{@var{sourcename}.decl}.
3396
3397 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3398 @opindex Wassign-intercept
3399 @opindex Wno-assign-intercept
3400 Warn whenever an Objective-C assignment is being intercepted by the
3401 garbage collector.
3402
3403 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3404 @opindex Wno-protocol
3405 @opindex Wprotocol
3406 If a class is declared to implement a protocol, a warning is issued for
3407 every method in the protocol that is not implemented by the class. The
3408 default behavior is to issue a warning for every method not explicitly
3409 implemented in the class, even if a method implementation is inherited
3410 from the superclass. If you use the @option{-Wno-protocol} option, then
3411 methods inherited from the superclass are considered to be implemented,
3412 and no warning is issued for them.
3413
3414 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3415 @opindex Wselector
3416 @opindex Wno-selector
3417 Warn if multiple methods of different types for the same selector are
3418 found during compilation. The check is performed on the list of methods
3419 in the final stage of compilation. Additionally, a check is performed
3420 for each selector appearing in a @code{@@selector(@dots{})}
3421 expression, and a corresponding method for that selector has been found
3422 during compilation. Because these checks scan the method table only at
3423 the end of compilation, these warnings are not produced if the final
3424 stage of compilation is not reached, for example because an error is
3425 found during compilation, or because the @option{-fsyntax-only} option is
3426 being used.
3427
3428 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3429 @opindex Wstrict-selector-match
3430 @opindex Wno-strict-selector-match
3431 Warn if multiple methods with differing argument and/or return types are
3432 found for a given selector when attempting to send a message using this
3433 selector to a receiver of type @code{id} or @code{Class}. When this flag
3434 is off (which is the default behavior), the compiler omits such warnings
3435 if any differences found are confined to types that share the same size
3436 and alignment.
3437
3438 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3439 @opindex Wundeclared-selector
3440 @opindex Wno-undeclared-selector
3441 Warn if a @code{@@selector(@dots{})} expression referring to an
3442 undeclared selector is found. A selector is considered undeclared if no
3443 method with that name has been declared before the
3444 @code{@@selector(@dots{})} expression, either explicitly in an
3445 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3446 an @code{@@implementation} section. This option always performs its
3447 checks as soon as a @code{@@selector(@dots{})} expression is found,
3448 while @option{-Wselector} only performs its checks in the final stage of
3449 compilation. This also enforces the coding style convention
3450 that methods and selectors must be declared before being used.
3451
3452 @item -print-objc-runtime-info
3453 @opindex print-objc-runtime-info
3454 Generate C header describing the largest structure that is passed by
3455 value, if any.
3456
3457 @end table
3458
3459 @node Diagnostic Message Formatting Options
3460 @section Options to Control Diagnostic Messages Formatting
3461 @cindex options to control diagnostics formatting
3462 @cindex diagnostic messages
3463 @cindex message formatting
3464
3465 Traditionally, diagnostic messages have been formatted irrespective of
3466 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3467 options described below
3468 to control the formatting algorithm for diagnostic messages,
3469 e.g.@: how many characters per line, how often source location
3470 information should be reported. Note that some language front ends may not
3471 honor these options.
3472
3473 @table @gcctabopt
3474 @item -fmessage-length=@var{n}
3475 @opindex fmessage-length
3476 Try to format error messages so that they fit on lines of about
3477 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3478 done; each error message appears on a single line. This is the
3479 default for all front ends.
3480
3481 @item -fdiagnostics-show-location=once
3482 @opindex fdiagnostics-show-location
3483 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3484 reporter to emit source location information @emph{once}; that is, in
3485 case the message is too long to fit on a single physical line and has to
3486 be wrapped, the source location won't be emitted (as prefix) again,
3487 over and over, in subsequent continuation lines. This is the default
3488 behavior.
3489
3490 @item -fdiagnostics-show-location=every-line
3491 Only meaningful in line-wrapping mode. Instructs the diagnostic
3492 messages reporter to emit the same source location information (as
3493 prefix) for physical lines that result from the process of breaking
3494 a message which is too long to fit on a single line.
3495
3496 @item -fdiagnostics-color[=@var{WHEN}]
3497 @itemx -fno-diagnostics-color
3498 @opindex fdiagnostics-color
3499 @cindex highlight, color
3500 @vindex GCC_COLORS @r{environment variable}
3501 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3502 or @samp{auto}. The default depends on how the compiler has been configured,
3503 it can be any of the above @var{WHEN} options or also @samp{never}
3504 if @env{GCC_COLORS} environment variable isn't present in the environment,
3505 and @samp{auto} otherwise.
3506 @samp{auto} means to use color only when the standard error is a terminal.
3507 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3508 aliases for @option{-fdiagnostics-color=always} and
3509 @option{-fdiagnostics-color=never}, respectively.
3510
3511 The colors are defined by the environment variable @env{GCC_COLORS}.
3512 Its value is a colon-separated list of capabilities and Select Graphic
3513 Rendition (SGR) substrings. SGR commands are interpreted by the
3514 terminal or terminal emulator. (See the section in the documentation
3515 of your text terminal for permitted values and their meanings as
3516 character attributes.) These substring values are integers in decimal
3517 representation and can be concatenated with semicolons.
3518 Common values to concatenate include
3519 @samp{1} for bold,
3520 @samp{4} for underline,
3521 @samp{5} for blink,
3522 @samp{7} for inverse,
3523 @samp{39} for default foreground color,
3524 @samp{30} to @samp{37} for foreground colors,
3525 @samp{90} to @samp{97} for 16-color mode foreground colors,
3526 @samp{38;5;0} to @samp{38;5;255}
3527 for 88-color and 256-color modes foreground colors,
3528 @samp{49} for default background color,
3529 @samp{40} to @samp{47} for background colors,
3530 @samp{100} to @samp{107} for 16-color mode background colors,
3531 and @samp{48;5;0} to @samp{48;5;255}
3532 for 88-color and 256-color modes background colors.
3533
3534 The default @env{GCC_COLORS} is
3535 @smallexample
3536 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3537 quote=01:fixit-insert=32:fixit-delete=31:\
3538 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3539 type-diff=01;32
3540 @end smallexample
3541 @noindent
3542 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3543 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3544 @samp{01} is bold, and @samp{31} is red.
3545 Setting @env{GCC_COLORS} to the empty string disables colors.
3546 Supported capabilities are as follows.
3547
3548 @table @code
3549 @item error=
3550 @vindex error GCC_COLORS @r{capability}
3551 SGR substring for error: markers.
3552
3553 @item warning=
3554 @vindex warning GCC_COLORS @r{capability}
3555 SGR substring for warning: markers.
3556
3557 @item note=
3558 @vindex note GCC_COLORS @r{capability}
3559 SGR substring for note: markers.
3560
3561 @item range1=
3562 @vindex range1 GCC_COLORS @r{capability}
3563 SGR substring for first additional range.
3564
3565 @item range2=
3566 @vindex range2 GCC_COLORS @r{capability}
3567 SGR substring for second additional range.
3568
3569 @item locus=
3570 @vindex locus GCC_COLORS @r{capability}
3571 SGR substring for location information, @samp{file:line} or
3572 @samp{file:line:column} etc.
3573
3574 @item quote=
3575 @vindex quote GCC_COLORS @r{capability}
3576 SGR substring for information printed within quotes.
3577
3578 @item fixit-insert=
3579 @vindex fixit-insert GCC_COLORS @r{capability}
3580 SGR substring for fix-it hints suggesting text to
3581 be inserted or replaced.
3582
3583 @item fixit-delete=
3584 @vindex fixit-delete GCC_COLORS @r{capability}
3585 SGR substring for fix-it hints suggesting text to
3586 be deleted.
3587
3588 @item diff-filename=
3589 @vindex diff-filename GCC_COLORS @r{capability}
3590 SGR substring for filename headers within generated patches.
3591
3592 @item diff-hunk=
3593 @vindex diff-hunk GCC_COLORS @r{capability}
3594 SGR substring for the starts of hunks within generated patches.
3595
3596 @item diff-delete=
3597 @vindex diff-delete GCC_COLORS @r{capability}
3598 SGR substring for deleted lines within generated patches.
3599
3600 @item diff-insert=
3601 @vindex diff-insert GCC_COLORS @r{capability}
3602 SGR substring for inserted lines within generated patches.
3603
3604 @item type-diff=
3605 @vindex type-diff GCC_COLORS @r{capability}
3606 SGR substring for highlighting mismatching types within template
3607 arguments in the C++ frontend.
3608 @end table
3609
3610 @item -fno-diagnostics-show-option
3611 @opindex fno-diagnostics-show-option
3612 @opindex fdiagnostics-show-option
3613 By default, each diagnostic emitted includes text indicating the
3614 command-line option that directly controls the diagnostic (if such an
3615 option is known to the diagnostic machinery). Specifying the
3616 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3617
3618 @item -fno-diagnostics-show-caret
3619 @opindex fno-diagnostics-show-caret
3620 @opindex fdiagnostics-show-caret
3621 By default, each diagnostic emitted includes the original source line
3622 and a caret @samp{^} indicating the column. This option suppresses this
3623 information. The source line is truncated to @var{n} characters, if
3624 the @option{-fmessage-length=n} option is given. When the output is done
3625 to the terminal, the width is limited to the width given by the
3626 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3627
3628 @item -fdiagnostics-parseable-fixits
3629 @opindex fdiagnostics-parseable-fixits
3630 Emit fix-it hints in a machine-parseable format, suitable for consumption
3631 by IDEs. For each fix-it, a line will be printed after the relevant
3632 diagnostic, starting with the string ``fix-it:''. For example:
3633
3634 @smallexample
3635 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3636 @end smallexample
3637
3638 The location is expressed as a half-open range, expressed as a count of
3639 bytes, starting at byte 1 for the initial column. In the above example,
3640 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3641 given string:
3642
3643 @smallexample
3644 00000000011111111112222222222
3645 12345678901234567890123456789
3646 gtk_widget_showall (dlg);
3647 ^^^^^^^^^^^^^^^^^^
3648 gtk_widget_show_all
3649 @end smallexample
3650
3651 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3652 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3653 (e.g. vertical tab as ``\013'').
3654
3655 An empty replacement string indicates that the given range is to be removed.
3656 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3657 be inserted at the given position.
3658
3659 @item -fdiagnostics-generate-patch
3660 @opindex fdiagnostics-generate-patch
3661 Print fix-it hints to stderr in unified diff format, after any diagnostics
3662 are printed. For example:
3663
3664 @smallexample
3665 --- test.c
3666 +++ test.c
3667 @@ -42,5 +42,5 @@
3668
3669 void show_cb(GtkDialog *dlg)
3670 @{
3671 - gtk_widget_showall(dlg);
3672 + gtk_widget_show_all(dlg);
3673 @}
3674
3675 @end smallexample
3676
3677 The diff may or may not be colorized, following the same rules
3678 as for diagnostics (see @option{-fdiagnostics-color}).
3679
3680 @item -fdiagnostics-show-template-tree
3681 @opindex fdiagnostics-show-template-tree
3682
3683 In the C++ frontend, when printing diagnostics showing mismatching
3684 template types, such as:
3685
3686 @smallexample
3687 could not convert 'std::map<int, std::vector<double> >()'
3688 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3689 @end smallexample
3690
3691 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3692 tree-like structure showing the common and differing parts of the types,
3693 such as:
3694
3695 @smallexample
3696 map<
3697 [...],
3698 vector<
3699 [double != float]>>
3700 @end smallexample
3701
3702 The parts that differ are highlighted with color (``double'' and
3703 ``float'' in this case).
3704
3705 @item -fno-elide-type
3706 @opindex fno-elide-type
3707 @opindex felide-type
3708 By default when the C++ frontend prints diagnostics showing mismatching
3709 template types, common parts of the types are printed as ``[...]'' to
3710 simplify the error message. For example:
3711
3712 @smallexample
3713 could not convert 'std::map<int, std::vector<double> >()'
3714 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3715 @end smallexample
3716
3717 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3718 This flag also affects the output of the
3719 @option{-fdiagnostics-show-template-tree} flag.
3720
3721 @item -fno-show-column
3722 @opindex fno-show-column
3723 Do not print column numbers in diagnostics. This may be necessary if
3724 diagnostics are being scanned by a program that does not understand the
3725 column numbers, such as @command{dejagnu}.
3726
3727 @end table
3728
3729 @node Warning Options
3730 @section Options to Request or Suppress Warnings
3731 @cindex options to control warnings
3732 @cindex warning messages
3733 @cindex messages, warning
3734 @cindex suppressing warnings
3735
3736 Warnings are diagnostic messages that report constructions that
3737 are not inherently erroneous but that are risky or suggest there
3738 may have been an error.
3739
3740 The following language-independent options do not enable specific
3741 warnings but control the kinds of diagnostics produced by GCC@.
3742
3743 @table @gcctabopt
3744 @cindex syntax checking
3745 @item -fsyntax-only
3746 @opindex fsyntax-only
3747 Check the code for syntax errors, but don't do anything beyond that.
3748
3749 @item -fmax-errors=@var{n}
3750 @opindex fmax-errors
3751 Limits the maximum number of error messages to @var{n}, at which point
3752 GCC bails out rather than attempting to continue processing the source
3753 code. If @var{n} is 0 (the default), there is no limit on the number
3754 of error messages produced. If @option{-Wfatal-errors} is also
3755 specified, then @option{-Wfatal-errors} takes precedence over this
3756 option.
3757
3758 @item -w
3759 @opindex w
3760 Inhibit all warning messages.
3761
3762 @item -Werror
3763 @opindex Werror
3764 @opindex Wno-error
3765 Make all warnings into errors.
3766
3767 @item -Werror=
3768 @opindex Werror=
3769 @opindex Wno-error=
3770 Make the specified warning into an error. The specifier for a warning
3771 is appended; for example @option{-Werror=switch} turns the warnings
3772 controlled by @option{-Wswitch} into errors. This switch takes a
3773 negative form, to be used to negate @option{-Werror} for specific
3774 warnings; for example @option{-Wno-error=switch} makes
3775 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3776 is in effect.
3777
3778 The warning message for each controllable warning includes the
3779 option that controls the warning. That option can then be used with
3780 @option{-Werror=} and @option{-Wno-error=} as described above.
3781 (Printing of the option in the warning message can be disabled using the
3782 @option{-fno-diagnostics-show-option} flag.)
3783
3784 Note that specifying @option{-Werror=}@var{foo} automatically implies
3785 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3786 imply anything.
3787
3788 @item -Wfatal-errors
3789 @opindex Wfatal-errors
3790 @opindex Wno-fatal-errors
3791 This option causes the compiler to abort compilation on the first error
3792 occurred rather than trying to keep going and printing further error
3793 messages.
3794
3795 @end table
3796
3797 You can request many specific warnings with options beginning with
3798 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3799 implicit declarations. Each of these specific warning options also
3800 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3801 example, @option{-Wno-implicit}. This manual lists only one of the
3802 two forms, whichever is not the default. For further
3803 language-specific options also refer to @ref{C++ Dialect Options} and
3804 @ref{Objective-C and Objective-C++ Dialect Options}.
3805
3806 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3807 options, such as @option{-Wunused}, which may turn on further options,
3808 such as @option{-Wunused-value}. The combined effect of positive and
3809 negative forms is that more specific options have priority over less
3810 specific ones, independently of their position in the command-line. For
3811 options of the same specificity, the last one takes effect. Options
3812 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3813 as if they appeared at the end of the command-line.
3814
3815 When an unrecognized warning option is requested (e.g.,
3816 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3817 that the option is not recognized. However, if the @option{-Wno-} form
3818 is used, the behavior is slightly different: no diagnostic is
3819 produced for @option{-Wno-unknown-warning} unless other diagnostics
3820 are being produced. This allows the use of new @option{-Wno-} options
3821 with old compilers, but if something goes wrong, the compiler
3822 warns that an unrecognized option is present.
3823
3824 @table @gcctabopt
3825 @item -Wpedantic
3826 @itemx -pedantic
3827 @opindex pedantic
3828 @opindex Wpedantic
3829 Issue all the warnings demanded by strict ISO C and ISO C++;
3830 reject all programs that use forbidden extensions, and some other
3831 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3832 version of the ISO C standard specified by any @option{-std} option used.
3833
3834 Valid ISO C and ISO C++ programs should compile properly with or without
3835 this option (though a rare few require @option{-ansi} or a
3836 @option{-std} option specifying the required version of ISO C)@. However,
3837 without this option, certain GNU extensions and traditional C and C++
3838 features are supported as well. With this option, they are rejected.
3839
3840 @option{-Wpedantic} does not cause warning messages for use of the
3841 alternate keywords whose names begin and end with @samp{__}. Pedantic
3842 warnings are also disabled in the expression that follows
3843 @code{__extension__}. However, only system header files should use
3844 these escape routes; application programs should avoid them.
3845 @xref{Alternate Keywords}.
3846
3847 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3848 C conformance. They soon find that it does not do quite what they want:
3849 it finds some non-ISO practices, but not all---only those for which
3850 ISO C @emph{requires} a diagnostic, and some others for which
3851 diagnostics have been added.
3852
3853 A feature to report any failure to conform to ISO C might be useful in
3854 some instances, but would require considerable additional work and would
3855 be quite different from @option{-Wpedantic}. We don't have plans to
3856 support such a feature in the near future.
3857
3858 Where the standard specified with @option{-std} represents a GNU
3859 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3860 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3861 extended dialect is based. Warnings from @option{-Wpedantic} are given
3862 where they are required by the base standard. (It does not make sense
3863 for such warnings to be given only for features not in the specified GNU
3864 C dialect, since by definition the GNU dialects of C include all
3865 features the compiler supports with the given option, and there would be
3866 nothing to warn about.)
3867
3868 @item -pedantic-errors
3869 @opindex pedantic-errors
3870 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3871 requires a diagnostic, in some cases where there is undefined behavior
3872 at compile-time and in some other cases that do not prevent compilation
3873 of programs that are valid according to the standard. This is not
3874 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3875 by this option and not enabled by the latter and vice versa.
3876
3877 @item -Wall
3878 @opindex Wall
3879 @opindex Wno-all
3880 This enables all the warnings about constructions that some users
3881 consider questionable, and that are easy to avoid (or modify to
3882 prevent the warning), even in conjunction with macros. This also
3883 enables some language-specific warnings described in @ref{C++ Dialect
3884 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3885
3886 @option{-Wall} turns on the following warning flags:
3887
3888 @gccoptlist{-Waddress @gol
3889 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3890 -Wbool-compare @gol
3891 -Wbool-operation @gol
3892 -Wc++11-compat -Wc++14-compat @gol
3893 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
3894 -Wchar-subscripts @gol
3895 -Wcomment @gol
3896 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3897 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3898 -Wformat @gol
3899 -Wint-in-bool-context @gol
3900 -Wimplicit @r{(C and Objective-C only)} @gol
3901 -Wimplicit-int @r{(C and Objective-C only)} @gol
3902 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3903 -Winit-self @r{(only for C++)} @gol
3904 -Wlogical-not-parentheses @gol
3905 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3906 -Wmaybe-uninitialized @gol
3907 -Wmemset-elt-size @gol
3908 -Wmemset-transposed-args @gol
3909 -Wmisleading-indentation @r{(only for C/C++)} @gol
3910 -Wmissing-attributes @gol
3911 -Wmissing-braces @r{(only for C/ObjC)} @gol
3912 -Wmultistatement-macros @gol
3913 -Wnarrowing @r{(only for C++)} @gol
3914 -Wnonnull @gol
3915 -Wnonnull-compare @gol
3916 -Wopenmp-simd @gol
3917 -Wparentheses @gol
3918 -Wpointer-sign @gol
3919 -Wreorder @gol
3920 -Wrestrict @gol
3921 -Wreturn-type @gol
3922 -Wsequence-point @gol
3923 -Wsign-compare @r{(only in C++)} @gol
3924 -Wsizeof-pointer-div @gol
3925 -Wsizeof-pointer-memaccess @gol
3926 -Wstrict-aliasing @gol
3927 -Wstrict-overflow=1 @gol
3928 -Wswitch @gol
3929 -Wtautological-compare @gol
3930 -Wtrigraphs @gol
3931 -Wuninitialized @gol
3932 -Wunknown-pragmas @gol
3933 -Wunused-function @gol
3934 -Wunused-label @gol
3935 -Wunused-value @gol
3936 -Wunused-variable @gol
3937 -Wvolatile-register-var @gol
3938 }
3939
3940 Note that some warning flags are not implied by @option{-Wall}. Some of
3941 them warn about constructions that users generally do not consider
3942 questionable, but which occasionally you might wish to check for;
3943 others warn about constructions that are necessary or hard to avoid in
3944 some cases, and there is no simple way to modify the code to suppress
3945 the warning. Some of them are enabled by @option{-Wextra} but many of
3946 them must be enabled individually.
3947
3948 @item -Wextra
3949 @opindex W
3950 @opindex Wextra
3951 @opindex Wno-extra
3952 This enables some extra warning flags that are not enabled by
3953 @option{-Wall}. (This option used to be called @option{-W}. The older
3954 name is still supported, but the newer name is more descriptive.)
3955
3956 @gccoptlist{-Wclobbered @gol
3957 -Wcast-function-type @gol
3958 -Wempty-body @gol
3959 -Wignored-qualifiers @gol
3960 -Wimplicit-fallthrough=3 @gol
3961 -Wmissing-field-initializers @gol
3962 -Wmissing-parameter-type @r{(C only)} @gol
3963 -Wold-style-declaration @r{(C only)} @gol
3964 -Woverride-init @gol
3965 -Wsign-compare @r{(C only)} @gol
3966 -Wtype-limits @gol
3967 -Wuninitialized @gol
3968 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3969 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3970 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3971 }
3972
3973 The option @option{-Wextra} also prints warning messages for the
3974 following cases:
3975
3976 @itemize @bullet
3977
3978 @item
3979 A pointer is compared against integer zero with @code{<}, @code{<=},
3980 @code{>}, or @code{>=}.
3981
3982 @item
3983 (C++ only) An enumerator and a non-enumerator both appear in a
3984 conditional expression.
3985
3986 @item
3987 (C++ only) Ambiguous virtual bases.
3988
3989 @item
3990 (C++ only) Subscripting an array that has been declared @code{register}.
3991
3992 @item
3993 (C++ only) Taking the address of a variable that has been declared
3994 @code{register}.
3995
3996 @item
3997 (C++ only) A base class is not initialized in the copy constructor
3998 of a derived class.
3999
4000 @end itemize
4001
4002 @item -Wchar-subscripts
4003 @opindex Wchar-subscripts
4004 @opindex Wno-char-subscripts
4005 Warn if an array subscript has type @code{char}. This is a common cause
4006 of error, as programmers often forget that this type is signed on some
4007 machines.
4008 This warning is enabled by @option{-Wall}.
4009
4010 @item -Wchkp
4011 @opindex Wchkp
4012 Warn about an invalid memory access that is found by Pointer Bounds Checker
4013 (@option{-fcheck-pointer-bounds}).
4014
4015 @item -Wno-coverage-mismatch
4016 @opindex Wno-coverage-mismatch
4017 Warn if feedback profiles do not match when using the
4018 @option{-fprofile-use} option.
4019 If a source file is changed between compiling with @option{-fprofile-gen} and
4020 with @option{-fprofile-use}, the files with the profile feedback can fail
4021 to match the source file and GCC cannot use the profile feedback
4022 information. By default, this warning is enabled and is treated as an
4023 error. @option{-Wno-coverage-mismatch} can be used to disable the
4024 warning or @option{-Wno-error=coverage-mismatch} can be used to
4025 disable the error. Disabling the error for this warning can result in
4026 poorly optimized code and is useful only in the
4027 case of very minor changes such as bug fixes to an existing code-base.
4028 Completely disabling the warning is not recommended.
4029
4030 @item -Wno-cpp
4031 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4032
4033 Suppress warning messages emitted by @code{#warning} directives.
4034
4035 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4036 @opindex Wdouble-promotion
4037 @opindex Wno-double-promotion
4038 Give a warning when a value of type @code{float} is implicitly
4039 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4040 floating-point unit implement @code{float} in hardware, but emulate
4041 @code{double} in software. On such a machine, doing computations
4042 using @code{double} values is much more expensive because of the
4043 overhead required for software emulation.
4044
4045 It is easy to accidentally do computations with @code{double} because
4046 floating-point literals are implicitly of type @code{double}. For
4047 example, in:
4048 @smallexample
4049 @group
4050 float area(float radius)
4051 @{
4052 return 3.14159 * radius * radius;
4053 @}
4054 @end group
4055 @end smallexample
4056 the compiler performs the entire computation with @code{double}
4057 because the floating-point literal is a @code{double}.
4058
4059 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4060 @opindex Wduplicate-decl-specifier
4061 @opindex Wno-duplicate-decl-specifier
4062 Warn if a declaration has duplicate @code{const}, @code{volatile},
4063 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4064 @option{-Wall}.
4065
4066 @item -Wformat
4067 @itemx -Wformat=@var{n}
4068 @opindex Wformat
4069 @opindex Wno-format
4070 @opindex ffreestanding
4071 @opindex fno-builtin
4072 @opindex Wformat=
4073 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4074 the arguments supplied have types appropriate to the format string
4075 specified, and that the conversions specified in the format string make
4076 sense. This includes standard functions, and others specified by format
4077 attributes (@pxref{Function Attributes}), in the @code{printf},
4078 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4079 not in the C standard) families (or other target-specific families).
4080 Which functions are checked without format attributes having been
4081 specified depends on the standard version selected, and such checks of
4082 functions without the attribute specified are disabled by
4083 @option{-ffreestanding} or @option{-fno-builtin}.
4084
4085 The formats are checked against the format features supported by GNU
4086 libc version 2.2. These include all ISO C90 and C99 features, as well
4087 as features from the Single Unix Specification and some BSD and GNU
4088 extensions. Other library implementations may not support all these
4089 features; GCC does not support warning about features that go beyond a
4090 particular library's limitations. However, if @option{-Wpedantic} is used
4091 with @option{-Wformat}, warnings are given about format features not
4092 in the selected standard version (but not for @code{strfmon} formats,
4093 since those are not in any version of the C standard). @xref{C Dialect
4094 Options,,Options Controlling C Dialect}.
4095
4096 @table @gcctabopt
4097 @item -Wformat=1
4098 @itemx -Wformat
4099 @opindex Wformat
4100 @opindex Wformat=1
4101 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4102 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4103 @option{-Wformat} also checks for null format arguments for several
4104 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4105 aspects of this level of format checking can be disabled by the
4106 options: @option{-Wno-format-contains-nul},
4107 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4108 @option{-Wformat} is enabled by @option{-Wall}.
4109
4110 @item -Wno-format-contains-nul
4111 @opindex Wno-format-contains-nul
4112 @opindex Wformat-contains-nul
4113 If @option{-Wformat} is specified, do not warn about format strings that
4114 contain NUL bytes.
4115
4116 @item -Wno-format-extra-args
4117 @opindex Wno-format-extra-args
4118 @opindex Wformat-extra-args
4119 If @option{-Wformat} is specified, do not warn about excess arguments to a
4120 @code{printf} or @code{scanf} format function. The C standard specifies
4121 that such arguments are ignored.
4122
4123 Where the unused arguments lie between used arguments that are
4124 specified with @samp{$} operand number specifications, normally
4125 warnings are still given, since the implementation could not know what
4126 type to pass to @code{va_arg} to skip the unused arguments. However,
4127 in the case of @code{scanf} formats, this option suppresses the
4128 warning if the unused arguments are all pointers, since the Single
4129 Unix Specification says that such unused arguments are allowed.
4130
4131 @item -Wformat-overflow
4132 @itemx -Wformat-overflow=@var{level}
4133 @opindex Wformat-overflow
4134 @opindex Wno-format-overflow
4135 Warn about calls to formatted input/output functions such as @code{sprintf}
4136 and @code{vsprintf} that might overflow the destination buffer. When the
4137 exact number of bytes written by a format directive cannot be determined
4138 at compile-time it is estimated based on heuristics that depend on the
4139 @var{level} argument and on optimization. While enabling optimization
4140 will in most cases improve the accuracy of the warning, it may also
4141 result in false positives.
4142
4143 @table @gcctabopt
4144 @item -Wformat-overflow
4145 @itemx -Wformat-overflow=1
4146 @opindex Wformat-overflow
4147 @opindex Wno-format-overflow
4148 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4149 employs a conservative approach that warns only about calls that most
4150 likely overflow the buffer. At this level, numeric arguments to format
4151 directives with unknown values are assumed to have the value of one, and
4152 strings of unknown length to be empty. Numeric arguments that are known
4153 to be bounded to a subrange of their type, or string arguments whose output
4154 is bounded either by their directive's precision or by a finite set of
4155 string literals, are assumed to take on the value within the range that
4156 results in the most bytes on output. For example, the call to @code{sprintf}
4157 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4158 the terminating NUL character (@code{'\0'}) appended by the function
4159 to the destination buffer will be written past its end. Increasing
4160 the size of the buffer by a single byte is sufficient to avoid the
4161 warning, though it may not be sufficient to avoid the overflow.
4162
4163 @smallexample
4164 void f (int a, int b)
4165 @{
4166 char buf [13];
4167 sprintf (buf, "a = %i, b = %i\n", a, b);
4168 @}
4169 @end smallexample
4170
4171 @item -Wformat-overflow=2
4172 Level @var{2} warns also about calls that might overflow the destination
4173 buffer given an argument of sufficient length or magnitude. At level
4174 @var{2}, unknown numeric arguments are assumed to have the minimum
4175 representable value for signed types with a precision greater than 1, and
4176 the maximum representable value otherwise. Unknown string arguments whose
4177 length cannot be assumed to be bounded either by the directive's precision,
4178 or by a finite set of string literals they may evaluate to, or the character
4179 array they may point to, are assumed to be 1 character long.
4180
4181 At level @var{2}, the call in the example above is again diagnosed, but
4182 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4183 @code{%i} directive will write some of its digits beyond the end of
4184 the destination buffer. To make the call safe regardless of the values
4185 of the two variables, the size of the destination buffer must be increased
4186 to at least 34 bytes. GCC includes the minimum size of the buffer in
4187 an informational note following the warning.
4188
4189 An alternative to increasing the size of the destination buffer is to
4190 constrain the range of formatted values. The maximum length of string
4191 arguments can be bounded by specifying the precision in the format
4192 directive. When numeric arguments of format directives can be assumed
4193 to be bounded by less than the precision of their type, choosing
4194 an appropriate length modifier to the format specifier will reduce
4195 the required buffer size. For example, if @var{a} and @var{b} in the
4196 example above can be assumed to be within the precision of
4197 the @code{short int} type then using either the @code{%hi} format
4198 directive or casting the argument to @code{short} reduces the maximum
4199 required size of the buffer to 24 bytes.
4200
4201 @smallexample
4202 void f (int a, int b)
4203 @{
4204 char buf [23];
4205 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4206 @}
4207 @end smallexample
4208 @end table
4209
4210 @item -Wno-format-zero-length
4211 @opindex Wno-format-zero-length
4212 @opindex Wformat-zero-length
4213 If @option{-Wformat} is specified, do not warn about zero-length formats.
4214 The C standard specifies that zero-length formats are allowed.
4215
4216
4217 @item -Wformat=2
4218 @opindex Wformat=2
4219 Enable @option{-Wformat} plus additional format checks. Currently
4220 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4221 -Wformat-y2k}.
4222
4223 @item -Wformat-nonliteral
4224 @opindex Wformat-nonliteral
4225 @opindex Wno-format-nonliteral
4226 If @option{-Wformat} is specified, also warn if the format string is not a
4227 string literal and so cannot be checked, unless the format function
4228 takes its format arguments as a @code{va_list}.
4229
4230 @item -Wformat-security
4231 @opindex Wformat-security
4232 @opindex Wno-format-security
4233 If @option{-Wformat} is specified, also warn about uses of format
4234 functions that represent possible security problems. At present, this
4235 warns about calls to @code{printf} and @code{scanf} functions where the
4236 format string is not a string literal and there are no format arguments,
4237 as in @code{printf (foo);}. This may be a security hole if the format
4238 string came from untrusted input and contains @samp{%n}. (This is
4239 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4240 in future warnings may be added to @option{-Wformat-security} that are not
4241 included in @option{-Wformat-nonliteral}.)
4242
4243 @item -Wformat-signedness
4244 @opindex Wformat-signedness
4245 @opindex Wno-format-signedness
4246 If @option{-Wformat} is specified, also warn if the format string
4247 requires an unsigned argument and the argument is signed and vice versa.
4248
4249 @item -Wformat-truncation
4250 @itemx -Wformat-truncation=@var{level}
4251 @opindex Wformat-truncation
4252 @opindex Wno-format-truncation
4253 Warn about calls to formatted input/output functions such as @code{snprintf}
4254 and @code{vsnprintf} that might result in output truncation. When the exact
4255 number of bytes written by a format directive cannot be determined at
4256 compile-time it is estimated based on heuristics that depend on
4257 the @var{level} argument and on optimization. While enabling optimization
4258 will in most cases improve the accuracy of the warning, it may also result
4259 in false positives. Except as noted otherwise, the option uses the same
4260 logic @option{-Wformat-overflow}.
4261
4262 @table @gcctabopt
4263 @item -Wformat-truncation
4264 @itemx -Wformat-truncation=1
4265 @opindex Wformat-truncation
4266 @opindex Wno-format-overflow
4267 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4268 employs a conservative approach that warns only about calls to bounded
4269 functions whose return value is unused and that will most likely result
4270 in output truncation.
4271
4272 @item -Wformat-truncation=2
4273 Level @var{2} warns also about calls to bounded functions whose return
4274 value is used and that might result in truncation given an argument of
4275 sufficient length or magnitude.
4276 @end table
4277
4278 @item -Wformat-y2k
4279 @opindex Wformat-y2k
4280 @opindex Wno-format-y2k
4281 If @option{-Wformat} is specified, also warn about @code{strftime}
4282 formats that may yield only a two-digit year.
4283 @end table
4284
4285 @item -Wnonnull
4286 @opindex Wnonnull
4287 @opindex Wno-nonnull
4288 Warn about passing a null pointer for arguments marked as
4289 requiring a non-null value by the @code{nonnull} function attribute.
4290
4291 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4292 can be disabled with the @option{-Wno-nonnull} option.
4293
4294 @item -Wnonnull-compare
4295 @opindex Wnonnull-compare
4296 @opindex Wno-nonnull-compare
4297 Warn when comparing an argument marked with the @code{nonnull}
4298 function attribute against null inside the function.
4299
4300 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4301 can be disabled with the @option{-Wno-nonnull-compare} option.
4302
4303 @item -Wnull-dereference
4304 @opindex Wnull-dereference
4305 @opindex Wno-null-dereference
4306 Warn if the compiler detects paths that trigger erroneous or
4307 undefined behavior due to dereferencing a null pointer. This option
4308 is only active when @option{-fdelete-null-pointer-checks} is active,
4309 which is enabled by optimizations in most targets. The precision of
4310 the warnings depends on the optimization options used.
4311
4312 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4313 @opindex Winit-self
4314 @opindex Wno-init-self
4315 Warn about uninitialized variables that are initialized with themselves.
4316 Note this option can only be used with the @option{-Wuninitialized} option.
4317
4318 For example, GCC warns about @code{i} being uninitialized in the
4319 following snippet only when @option{-Winit-self} has been specified:
4320 @smallexample
4321 @group
4322 int f()
4323 @{
4324 int i = i;
4325 return i;
4326 @}
4327 @end group
4328 @end smallexample
4329
4330 This warning is enabled by @option{-Wall} in C++.
4331
4332 @item -Wimplicit-int @r{(C and Objective-C only)}
4333 @opindex Wimplicit-int
4334 @opindex Wno-implicit-int
4335 Warn when a declaration does not specify a type.
4336 This warning is enabled by @option{-Wall}.
4337
4338 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4339 @opindex Wimplicit-function-declaration
4340 @opindex Wno-implicit-function-declaration
4341 Give a warning whenever a function is used before being declared. In
4342 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4343 enabled by default and it is made into an error by
4344 @option{-pedantic-errors}. This warning is also enabled by
4345 @option{-Wall}.
4346
4347 @item -Wimplicit @r{(C and Objective-C only)}
4348 @opindex Wimplicit
4349 @opindex Wno-implicit
4350 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4351 This warning is enabled by @option{-Wall}.
4352
4353 @item -Wimplicit-fallthrough
4354 @opindex Wimplicit-fallthrough
4355 @opindex Wno-implicit-fallthrough
4356 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4357 and @option{-Wno-implicit-fallthrough} is the same as
4358 @option{-Wimplicit-fallthrough=0}.
4359
4360 @item -Wimplicit-fallthrough=@var{n}
4361 @opindex Wimplicit-fallthrough=
4362 Warn when a switch case falls through. For example:
4363
4364 @smallexample
4365 @group
4366 switch (cond)
4367 @{
4368 case 1:
4369 a = 1;
4370 break;
4371 case 2:
4372 a = 2;
4373 case 3:
4374 a = 3;
4375 break;
4376 @}
4377 @end group
4378 @end smallexample
4379
4380 This warning does not warn when the last statement of a case cannot
4381 fall through, e.g. when there is a return statement or a call to function
4382 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4383 also takes into account control flow statements, such as ifs, and only
4384 warns when appropriate. E.g.@:
4385
4386 @smallexample
4387 @group
4388 switch (cond)
4389 @{
4390 case 1:
4391 if (i > 3) @{
4392 bar (5);
4393 break;
4394 @} else if (i < 1) @{
4395 bar (0);
4396 @} else
4397 return;
4398 default:
4399 @dots{}
4400 @}
4401 @end group
4402 @end smallexample
4403
4404 Since there are occasions where a switch case fall through is desirable,
4405 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4406 to be used along with a null statement to suppress this warning that
4407 would normally occur:
4408
4409 @smallexample
4410 @group
4411 switch (cond)
4412 @{
4413 case 1:
4414 bar (0);
4415 __attribute__ ((fallthrough));
4416 default:
4417 @dots{}
4418 @}
4419 @end group
4420 @end smallexample
4421
4422 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4423 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4424 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4425 Instead of these attributes, it is also possible to add a fallthrough comment
4426 to silence the warning. The whole body of the C or C++ style comment should
4427 match the given regular expressions listed below. The option argument @var{n}
4428 specifies what kind of comments are accepted:
4429
4430 @itemize @bullet
4431
4432 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4433
4434 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4435 expression, any comment is used as fallthrough comment.
4436
4437 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4438 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4439
4440 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4441 following regular expressions:
4442
4443 @itemize @bullet
4444
4445 @item @code{-fallthrough}
4446
4447 @item @code{@@fallthrough@@}
4448
4449 @item @code{lint -fallthrough[ \t]*}
4450
4451 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4452
4453 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4454
4455 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4456
4457 @end itemize
4458
4459 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4460 following regular expressions:
4461
4462 @itemize @bullet
4463
4464 @item @code{-fallthrough}
4465
4466 @item @code{@@fallthrough@@}
4467
4468 @item @code{lint -fallthrough[ \t]*}
4469
4470 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4471
4472 @end itemize
4473
4474 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4475 fallthrough comments, only attributes disable the warning.
4476
4477 @end itemize
4478
4479 The comment needs to be followed after optional whitespace and other comments
4480 by @code{case} or @code{default} keywords or by a user label that precedes some
4481 @code{case} or @code{default} label.
4482
4483 @smallexample
4484 @group
4485 switch (cond)
4486 @{
4487 case 1:
4488 bar (0);
4489 /* FALLTHRU */
4490 default:
4491 @dots{}
4492 @}
4493 @end group
4494 @end smallexample
4495
4496 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4497
4498 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4499 @opindex Wif-not-aligned
4500 @opindex Wno-if-not-aligned
4501 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4502 should be issued. This is is enabled by default.
4503 Use @option{-Wno-if-not-aligned} to disable it.
4504
4505 @item -Wignored-qualifiers @r{(C and C++ only)}
4506 @opindex Wignored-qualifiers
4507 @opindex Wno-ignored-qualifiers
4508 Warn if the return type of a function has a type qualifier
4509 such as @code{const}. For ISO C such a type qualifier has no effect,
4510 since the value returned by a function is not an lvalue.
4511 For C++, the warning is only emitted for scalar types or @code{void}.
4512 ISO C prohibits qualified @code{void} return types on function
4513 definitions, so such return types always receive a warning
4514 even without this option.
4515
4516 This warning is also enabled by @option{-Wextra}.
4517
4518 @item -Wignored-attributes @r{(C and C++ only)}
4519 @opindex Wignored-attributes
4520 @opindex Wno-ignored-attributes
4521 Warn when an attribute is ignored. This is different from the
4522 @option{-Wattributes} option in that it warns whenever the compiler decides
4523 to drop an attribute, not that the attribute is either unknown, used in a
4524 wrong place, etc. This warning is enabled by default.
4525
4526 @item -Wmain
4527 @opindex Wmain
4528 @opindex Wno-main
4529 Warn if the type of @code{main} is suspicious. @code{main} should be
4530 a function with external linkage, returning int, taking either zero
4531 arguments, two, or three arguments of appropriate types. This warning
4532 is enabled by default in C++ and is enabled by either @option{-Wall}
4533 or @option{-Wpedantic}.
4534
4535 @item -Wmisleading-indentation @r{(C and C++ only)}
4536 @opindex Wmisleading-indentation
4537 @opindex Wno-misleading-indentation
4538 Warn when the indentation of the code does not reflect the block structure.
4539 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4540 @code{for} clauses with a guarded statement that does not use braces,
4541 followed by an unguarded statement with the same indentation.
4542
4543 In the following example, the call to ``bar'' is misleadingly indented as
4544 if it were guarded by the ``if'' conditional.
4545
4546 @smallexample
4547 if (some_condition ())
4548 foo ();
4549 bar (); /* Gotcha: this is not guarded by the "if". */
4550 @end smallexample
4551
4552 In the case of mixed tabs and spaces, the warning uses the
4553 @option{-ftabstop=} option to determine if the statements line up
4554 (defaulting to 8).
4555
4556 The warning is not issued for code involving multiline preprocessor logic
4557 such as the following example.
4558
4559 @smallexample
4560 if (flagA)
4561 foo (0);
4562 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4563 if (flagB)
4564 #endif
4565 foo (1);
4566 @end smallexample
4567
4568 The warning is not issued after a @code{#line} directive, since this
4569 typically indicates autogenerated code, and no assumptions can be made
4570 about the layout of the file that the directive references.
4571
4572 This warning is enabled by @option{-Wall} in C and C++.
4573
4574 @item -Wmissing-attributes
4575 @opindex Wmissing-attributes
4576 @opindex Wno-missing-attributes
4577 Warn when a declaration of a function is missing one or more attributes
4578 that a related function is declared with and whose absence may adversely
4579 affect the correctness or efficiency of generated code. For example, in
4580 C++, the warning is issued when an explicit specialization of a primary
4581 template declared with attribute @code{alloc_align}, @code{alloc_size},
4582 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4583 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4584 @code{error}, and @code{warning} suppress the warning.
4585 (@pxref{Function Attributes}).
4586
4587 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4588
4589 For example, since the declaration of the primary function template
4590 below makes use of both attribute @code{malloc} and @code{alloc_size}
4591 the declaration of the explicit specialization of the template is
4592 diagnosed because it is missing one of the attributes.
4593
4594 @smallexample
4595 template <class T>
4596 T* __attribute__ ((malloc, alloc_size (1)))
4597 allocate (size_t);
4598
4599 template <>
4600 void* __attribute__ ((malloc)) // missing alloc_size
4601 allocate<void> (size_t);
4602 @end smallexample
4603
4604 @item -Wmissing-braces
4605 @opindex Wmissing-braces
4606 @opindex Wno-missing-braces
4607 Warn if an aggregate or union initializer is not fully bracketed. In
4608 the following example, the initializer for @code{a} is not fully
4609 bracketed, but that for @code{b} is fully bracketed. This warning is
4610 enabled by @option{-Wall} in C.
4611
4612 @smallexample
4613 int a[2][2] = @{ 0, 1, 2, 3 @};
4614 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4615 @end smallexample
4616
4617 This warning is enabled by @option{-Wall}.
4618
4619 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4620 @opindex Wmissing-include-dirs
4621 @opindex Wno-missing-include-dirs
4622 Warn if a user-supplied include directory does not exist.
4623
4624 @item -Wmultistatement-macros
4625 @opindex Wmultistatement-macros
4626 @opindex Wno-multistatement-macros
4627 Warn about unsafe multiple statement macros that appear to be guarded
4628 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4629 @code{while}, in which only the first statement is actually guarded after
4630 the macro is expanded.
4631
4632 For example:
4633
4634 @smallexample
4635 #define DOIT x++; y++
4636 if (c)
4637 DOIT;
4638 @end smallexample
4639
4640 will increment @code{y} unconditionally, not just when @code{c} holds.
4641 The can usually be fixed by wrapping the macro in a do-while loop:
4642 @smallexample
4643 #define DOIT do @{ x++; y++; @} while (0)
4644 if (c)
4645 DOIT;
4646 @end smallexample
4647
4648 This warning is enabled by @option{-Wall} in C and C++.
4649
4650 @item -Wparentheses
4651 @opindex Wparentheses
4652 @opindex Wno-parentheses
4653 Warn if parentheses are omitted in certain contexts, such
4654 as when there is an assignment in a context where a truth value
4655 is expected, or when operators are nested whose precedence people
4656 often get confused about.
4657
4658 Also warn if a comparison like @code{x<=y<=z} appears; this is
4659 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4660 interpretation from that of ordinary mathematical notation.
4661
4662 Also warn for dangerous uses of the GNU extension to
4663 @code{?:} with omitted middle operand. When the condition
4664 in the @code{?}: operator is a boolean expression, the omitted value is
4665 always 1. Often programmers expect it to be a value computed
4666 inside the conditional expression instead.
4667
4668 For C++ this also warns for some cases of unnecessary parentheses in
4669 declarations, which can indicate an attempt at a function call instead
4670 of a declaration:
4671 @smallexample
4672 @{
4673 // Declares a local variable called mymutex.
4674 std::unique_lock<std::mutex> (mymutex);
4675 // User meant std::unique_lock<std::mutex> lock (mymutex);
4676 @}
4677 @end smallexample
4678
4679 This warning is enabled by @option{-Wall}.
4680
4681 @item -Wsequence-point
4682 @opindex Wsequence-point
4683 @opindex Wno-sequence-point
4684 Warn about code that may have undefined semantics because of violations
4685 of sequence point rules in the C and C++ standards.
4686
4687 The C and C++ standards define the order in which expressions in a C/C++
4688 program are evaluated in terms of @dfn{sequence points}, which represent
4689 a partial ordering between the execution of parts of the program: those
4690 executed before the sequence point, and those executed after it. These
4691 occur after the evaluation of a full expression (one which is not part
4692 of a larger expression), after the evaluation of the first operand of a
4693 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4694 function is called (but after the evaluation of its arguments and the
4695 expression denoting the called function), and in certain other places.
4696 Other than as expressed by the sequence point rules, the order of
4697 evaluation of subexpressions of an expression is not specified. All
4698 these rules describe only a partial order rather than a total order,
4699 since, for example, if two functions are called within one expression
4700 with no sequence point between them, the order in which the functions
4701 are called is not specified. However, the standards committee have
4702 ruled that function calls do not overlap.
4703
4704 It is not specified when between sequence points modifications to the
4705 values of objects take effect. Programs whose behavior depends on this
4706 have undefined behavior; the C and C++ standards specify that ``Between
4707 the previous and next sequence point an object shall have its stored
4708 value modified at most once by the evaluation of an expression.
4709 Furthermore, the prior value shall be read only to determine the value
4710 to be stored.''. If a program breaks these rules, the results on any
4711 particular implementation are entirely unpredictable.
4712
4713 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4714 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4715 diagnosed by this option, and it may give an occasional false positive
4716 result, but in general it has been found fairly effective at detecting
4717 this sort of problem in programs.
4718
4719 The C++17 standard will define the order of evaluation of operands in
4720 more cases: in particular it requires that the right-hand side of an
4721 assignment be evaluated before the left-hand side, so the above
4722 examples are no longer undefined. But this warning will still warn
4723 about them, to help people avoid writing code that is undefined in C
4724 and earlier revisions of C++.
4725
4726 The standard is worded confusingly, therefore there is some debate
4727 over the precise meaning of the sequence point rules in subtle cases.
4728 Links to discussions of the problem, including proposed formal
4729 definitions, may be found on the GCC readings page, at
4730 @uref{http://gcc.gnu.org/@/readings.html}.
4731
4732 This warning is enabled by @option{-Wall} for C and C++.
4733
4734 @item -Wno-return-local-addr
4735 @opindex Wno-return-local-addr
4736 @opindex Wreturn-local-addr
4737 Do not warn about returning a pointer (or in C++, a reference) to a
4738 variable that goes out of scope after the function returns.
4739
4740 @item -Wreturn-type
4741 @opindex Wreturn-type
4742 @opindex Wno-return-type
4743 Warn whenever a function is defined with a return type that defaults
4744 to @code{int}. Also warn about any @code{return} statement with no
4745 return value in a function whose return type is not @code{void}
4746 (falling off the end of the function body is considered returning
4747 without a value).
4748
4749 For C only, warn about a @code{return} statement with an expression in a
4750 function whose return type is @code{void}, unless the expression type is
4751 also @code{void}. As a GNU extension, the latter case is accepted
4752 without a warning unless @option{-Wpedantic} is used.
4753
4754 For C++, a function without return type always produces a diagnostic
4755 message, even when @option{-Wno-return-type} is specified. The only
4756 exceptions are @code{main} and functions defined in system headers.
4757
4758 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
4759
4760 @item -Wshift-count-negative
4761 @opindex Wshift-count-negative
4762 @opindex Wno-shift-count-negative
4763 Warn if shift count is negative. This warning is enabled by default.
4764
4765 @item -Wshift-count-overflow
4766 @opindex Wshift-count-overflow
4767 @opindex Wno-shift-count-overflow
4768 Warn if shift count >= width of type. This warning is enabled by default.
4769
4770 @item -Wshift-negative-value
4771 @opindex Wshift-negative-value
4772 @opindex Wno-shift-negative-value
4773 Warn if left shifting a negative value. This warning is enabled by
4774 @option{-Wextra} in C99 and C++11 modes (and newer).
4775
4776 @item -Wshift-overflow
4777 @itemx -Wshift-overflow=@var{n}
4778 @opindex Wshift-overflow
4779 @opindex Wno-shift-overflow
4780 Warn about left shift overflows. This warning is enabled by
4781 default in C99 and C++11 modes (and newer).
4782
4783 @table @gcctabopt
4784 @item -Wshift-overflow=1
4785 This is the warning level of @option{-Wshift-overflow} and is enabled
4786 by default in C99 and C++11 modes (and newer). This warning level does
4787 not warn about left-shifting 1 into the sign bit. (However, in C, such
4788 an overflow is still rejected in contexts where an integer constant expression
4789 is required.)
4790
4791 @item -Wshift-overflow=2
4792 This warning level also warns about left-shifting 1 into the sign bit,
4793 unless C++14 mode is active.
4794 @end table
4795
4796 @item -Wswitch
4797 @opindex Wswitch
4798 @opindex Wno-switch
4799 Warn whenever a @code{switch} statement has an index of enumerated type
4800 and lacks a @code{case} for one or more of the named codes of that
4801 enumeration. (The presence of a @code{default} label prevents this
4802 warning.) @code{case} labels outside the enumeration range also
4803 provoke warnings when this option is used (even if there is a
4804 @code{default} label).
4805 This warning is enabled by @option{-Wall}.
4806
4807 @item -Wswitch-default
4808 @opindex Wswitch-default
4809 @opindex Wno-switch-default
4810 Warn whenever a @code{switch} statement does not have a @code{default}
4811 case.
4812
4813 @item -Wswitch-enum
4814 @opindex Wswitch-enum
4815 @opindex Wno-switch-enum
4816 Warn whenever a @code{switch} statement has an index of enumerated type
4817 and lacks a @code{case} for one or more of the named codes of that
4818 enumeration. @code{case} labels outside the enumeration range also
4819 provoke warnings when this option is used. The only difference
4820 between @option{-Wswitch} and this option is that this option gives a
4821 warning about an omitted enumeration code even if there is a
4822 @code{default} label.
4823
4824 @item -Wswitch-bool
4825 @opindex Wswitch-bool
4826 @opindex Wno-switch-bool
4827 Warn whenever a @code{switch} statement has an index of boolean type
4828 and the case values are outside the range of a boolean type.
4829 It is possible to suppress this warning by casting the controlling
4830 expression to a type other than @code{bool}. For example:
4831 @smallexample
4832 @group
4833 switch ((int) (a == 4))
4834 @{
4835 @dots{}
4836 @}
4837 @end group
4838 @end smallexample
4839 This warning is enabled by default for C and C++ programs.
4840
4841 @item -Wswitch-unreachable
4842 @opindex Wswitch-unreachable
4843 @opindex Wno-switch-unreachable
4844 Warn whenever a @code{switch} statement contains statements between the
4845 controlling expression and the first case label, which will never be
4846 executed. For example:
4847 @smallexample
4848 @group
4849 switch (cond)
4850 @{
4851 i = 15;
4852 @dots{}
4853 case 5:
4854 @dots{}
4855 @}
4856 @end group
4857 @end smallexample
4858 @option{-Wswitch-unreachable} does not warn if the statement between the
4859 controlling expression and the first case label is just a declaration:
4860 @smallexample
4861 @group
4862 switch (cond)
4863 @{
4864 int i;
4865 @dots{}
4866 case 5:
4867 i = 5;
4868 @dots{}
4869 @}
4870 @end group
4871 @end smallexample
4872 This warning is enabled by default for C and C++ programs.
4873
4874 @item -Wsync-nand @r{(C and C++ only)}
4875 @opindex Wsync-nand
4876 @opindex Wno-sync-nand
4877 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4878 built-in functions are used. These functions changed semantics in GCC 4.4.
4879
4880 @item -Wunused-but-set-parameter
4881 @opindex Wunused-but-set-parameter
4882 @opindex Wno-unused-but-set-parameter
4883 Warn whenever a function parameter is assigned to, but otherwise unused
4884 (aside from its declaration).
4885
4886 To suppress this warning use the @code{unused} attribute
4887 (@pxref{Variable Attributes}).
4888
4889 This warning is also enabled by @option{-Wunused} together with
4890 @option{-Wextra}.
4891
4892 @item -Wunused-but-set-variable
4893 @opindex Wunused-but-set-variable
4894 @opindex Wno-unused-but-set-variable
4895 Warn whenever a local variable is assigned to, but otherwise unused
4896 (aside from its declaration).
4897 This warning is enabled by @option{-Wall}.
4898
4899 To suppress this warning use the @code{unused} attribute
4900 (@pxref{Variable Attributes}).
4901
4902 This warning is also enabled by @option{-Wunused}, which is enabled
4903 by @option{-Wall}.
4904
4905 @item -Wunused-function
4906 @opindex Wunused-function
4907 @opindex Wno-unused-function
4908 Warn whenever a static function is declared but not defined or a
4909 non-inline static function is unused.
4910 This warning is enabled by @option{-Wall}.
4911
4912 @item -Wunused-label
4913 @opindex Wunused-label
4914 @opindex Wno-unused-label
4915 Warn whenever a label is declared but not used.
4916 This warning is enabled by @option{-Wall}.
4917
4918 To suppress this warning use the @code{unused} attribute
4919 (@pxref{Variable Attributes}).
4920
4921 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4922 @opindex Wunused-local-typedefs
4923 Warn when a typedef locally defined in a function is not used.
4924 This warning is enabled by @option{-Wall}.
4925
4926 @item -Wunused-parameter
4927 @opindex Wunused-parameter
4928 @opindex Wno-unused-parameter
4929 Warn whenever a function parameter is unused aside from its declaration.
4930
4931 To suppress this warning use the @code{unused} attribute
4932 (@pxref{Variable Attributes}).
4933
4934 @item -Wno-unused-result
4935 @opindex Wunused-result
4936 @opindex Wno-unused-result
4937 Do not warn if a caller of a function marked with attribute
4938 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4939 its return value. The default is @option{-Wunused-result}.
4940
4941 @item -Wunused-variable
4942 @opindex Wunused-variable
4943 @opindex Wno-unused-variable
4944 Warn whenever a local or static variable is unused aside from its
4945 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4946 but not for C++. This warning is enabled by @option{-Wall}.
4947
4948 To suppress this warning use the @code{unused} attribute
4949 (@pxref{Variable Attributes}).
4950
4951 @item -Wunused-const-variable
4952 @itemx -Wunused-const-variable=@var{n}
4953 @opindex Wunused-const-variable
4954 @opindex Wno-unused-const-variable
4955 Warn whenever a constant static variable is unused aside from its declaration.
4956 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4957 for C, but not for C++. In C this declares variable storage, but in C++ this
4958 is not an error since const variables take the place of @code{#define}s.
4959
4960 To suppress this warning use the @code{unused} attribute
4961 (@pxref{Variable Attributes}).
4962
4963 @table @gcctabopt
4964 @item -Wunused-const-variable=1
4965 This is the warning level that is enabled by @option{-Wunused-variable} for
4966 C. It warns only about unused static const variables defined in the main
4967 compilation unit, but not about static const variables declared in any
4968 header included.
4969
4970 @item -Wunused-const-variable=2
4971 This warning level also warns for unused constant static variables in
4972 headers (excluding system headers). This is the warning level of
4973 @option{-Wunused-const-variable} and must be explicitly requested since
4974 in C++ this isn't an error and in C it might be harder to clean up all
4975 headers included.
4976 @end table
4977
4978 @item -Wunused-value
4979 @opindex Wunused-value
4980 @opindex Wno-unused-value
4981 Warn whenever a statement computes a result that is explicitly not
4982 used. To suppress this warning cast the unused expression to
4983 @code{void}. This includes an expression-statement or the left-hand
4984 side of a comma expression that contains no side effects. For example,
4985 an expression such as @code{x[i,j]} causes a warning, while
4986 @code{x[(void)i,j]} does not.
4987
4988 This warning is enabled by @option{-Wall}.
4989
4990 @item -Wunused
4991 @opindex Wunused
4992 @opindex Wno-unused
4993 All the above @option{-Wunused} options combined.
4994
4995 In order to get a warning about an unused function parameter, you must
4996 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4997 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4998
4999 @item -Wuninitialized
5000 @opindex Wuninitialized
5001 @opindex Wno-uninitialized
5002 Warn if an automatic variable is used without first being initialized
5003 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5004 warn if a non-static reference or non-static @code{const} member
5005 appears in a class without constructors.
5006
5007 If you want to warn about code that uses the uninitialized value of the
5008 variable in its own initializer, use the @option{-Winit-self} option.
5009
5010 These warnings occur for individual uninitialized or clobbered
5011 elements of structure, union or array variables as well as for
5012 variables that are uninitialized or clobbered as a whole. They do
5013 not occur for variables or elements declared @code{volatile}. Because
5014 these warnings depend on optimization, the exact variables or elements
5015 for which there are warnings depends on the precise optimization
5016 options and version of GCC used.
5017
5018 Note that there may be no warning about a variable that is used only
5019 to compute a value that itself is never used, because such
5020 computations may be deleted by data flow analysis before the warnings
5021 are printed.
5022
5023 @item -Winvalid-memory-model
5024 @opindex Winvalid-memory-model
5025 @opindex Wno-invalid-memory-model
5026 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5027 and the C11 atomic generic functions with a memory consistency argument
5028 that is either invalid for the operation or outside the range of values
5029 of the @code{memory_order} enumeration. For example, since the
5030 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5031 defined for the relaxed, release, and sequentially consistent memory
5032 orders the following code is diagnosed:
5033
5034 @smallexample
5035 void store (int *i)
5036 @{
5037 __atomic_store_n (i, 0, memory_order_consume);
5038 @}
5039 @end smallexample
5040
5041 @option{-Winvalid-memory-model} is enabled by default.
5042
5043 @item -Wmaybe-uninitialized
5044 @opindex Wmaybe-uninitialized
5045 @opindex Wno-maybe-uninitialized
5046 For an automatic (i.e.@ local) variable, if there exists a path from the
5047 function entry to a use of the variable that is initialized, but there exist
5048 some other paths for which the variable is not initialized, the compiler
5049 emits a warning if it cannot prove the uninitialized paths are not
5050 executed at run time.
5051
5052 These warnings are only possible in optimizing compilation, because otherwise
5053 GCC does not keep track of the state of variables.
5054
5055 These warnings are made optional because GCC may not be able to determine when
5056 the code is correct in spite of appearing to have an error. Here is one
5057 example of how this can happen:
5058
5059 @smallexample
5060 @group
5061 @{
5062 int x;
5063 switch (y)
5064 @{
5065 case 1: x = 1;
5066 break;
5067 case 2: x = 4;
5068 break;
5069 case 3: x = 5;
5070 @}
5071 foo (x);
5072 @}
5073 @end group
5074 @end smallexample
5075
5076 @noindent
5077 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5078 always initialized, but GCC doesn't know this. To suppress the
5079 warning, you need to provide a default case with assert(0) or
5080 similar code.
5081
5082 @cindex @code{longjmp} warnings
5083 This option also warns when a non-volatile automatic variable might be
5084 changed by a call to @code{longjmp}.
5085 The compiler sees only the calls to @code{setjmp}. It cannot know
5086 where @code{longjmp} will be called; in fact, a signal handler could
5087 call it at any point in the code. As a result, you may get a warning
5088 even when there is in fact no problem because @code{longjmp} cannot
5089 in fact be called at the place that would cause a problem.
5090
5091 Some spurious warnings can be avoided if you declare all the functions
5092 you use that never return as @code{noreturn}. @xref{Function
5093 Attributes}.
5094
5095 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5096
5097 @item -Wunknown-pragmas
5098 @opindex Wunknown-pragmas
5099 @opindex Wno-unknown-pragmas
5100 @cindex warning for unknown pragmas
5101 @cindex unknown pragmas, warning
5102 @cindex pragmas, warning of unknown
5103 Warn when a @code{#pragma} directive is encountered that is not understood by
5104 GCC@. If this command-line option is used, warnings are even issued
5105 for unknown pragmas in system header files. This is not the case if
5106 the warnings are only enabled by the @option{-Wall} command-line option.
5107
5108 @item -Wno-pragmas
5109 @opindex Wno-pragmas
5110 @opindex Wpragmas
5111 Do not warn about misuses of pragmas, such as incorrect parameters,
5112 invalid syntax, or conflicts between pragmas. See also
5113 @option{-Wunknown-pragmas}.
5114
5115 @item -Wstrict-aliasing
5116 @opindex Wstrict-aliasing
5117 @opindex Wno-strict-aliasing
5118 This option is only active when @option{-fstrict-aliasing} is active.
5119 It warns about code that might break the strict aliasing rules that the
5120 compiler is using for optimization. The warning does not catch all
5121 cases, but does attempt to catch the more common pitfalls. It is
5122 included in @option{-Wall}.
5123 It is equivalent to @option{-Wstrict-aliasing=3}
5124
5125 @item -Wstrict-aliasing=n
5126 @opindex Wstrict-aliasing=n
5127 This option is only active when @option{-fstrict-aliasing} is active.
5128 It warns about code that might break the strict aliasing rules that the
5129 compiler is using for optimization.
5130 Higher levels correspond to higher accuracy (fewer false positives).
5131 Higher levels also correspond to more effort, similar to the way @option{-O}
5132 works.
5133 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5134
5135 Level 1: Most aggressive, quick, least accurate.
5136 Possibly useful when higher levels
5137 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5138 false negatives. However, it has many false positives.
5139 Warns for all pointer conversions between possibly incompatible types,
5140 even if never dereferenced. Runs in the front end only.
5141
5142 Level 2: Aggressive, quick, not too precise.
5143 May still have many false positives (not as many as level 1 though),
5144 and few false negatives (but possibly more than level 1).
5145 Unlike level 1, it only warns when an address is taken. Warns about
5146 incomplete types. Runs in the front end only.
5147
5148 Level 3 (default for @option{-Wstrict-aliasing}):
5149 Should have very few false positives and few false
5150 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5151 Takes care of the common pun+dereference pattern in the front end:
5152 @code{*(int*)&some_float}.
5153 If optimization is enabled, it also runs in the back end, where it deals
5154 with multiple statement cases using flow-sensitive points-to information.
5155 Only warns when the converted pointer is dereferenced.
5156 Does not warn about incomplete types.
5157
5158 @item -Wstrict-overflow
5159 @itemx -Wstrict-overflow=@var{n}
5160 @opindex Wstrict-overflow
5161 @opindex Wno-strict-overflow
5162 This option is only active when signed overflow is undefined.
5163 It warns about cases where the compiler optimizes based on the
5164 assumption that signed overflow does not occur. Note that it does not
5165 warn about all cases where the code might overflow: it only warns
5166 about cases where the compiler implements some optimization. Thus
5167 this warning depends on the optimization level.
5168
5169 An optimization that assumes that signed overflow does not occur is
5170 perfectly safe if the values of the variables involved are such that
5171 overflow never does, in fact, occur. Therefore this warning can
5172 easily give a false positive: a warning about code that is not
5173 actually a problem. To help focus on important issues, several
5174 warning levels are defined. No warnings are issued for the use of
5175 undefined signed overflow when estimating how many iterations a loop
5176 requires, in particular when determining whether a loop will be
5177 executed at all.
5178
5179 @table @gcctabopt
5180 @item -Wstrict-overflow=1
5181 Warn about cases that are both questionable and easy to avoid. For
5182 example the compiler simplifies
5183 @code{x + 1 > x} to @code{1}. This level of
5184 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5185 are not, and must be explicitly requested.
5186
5187 @item -Wstrict-overflow=2
5188 Also warn about other cases where a comparison is simplified to a
5189 constant. For example: @code{abs (x) >= 0}. This can only be
5190 simplified when signed integer overflow is undefined, because
5191 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5192 zero. @option{-Wstrict-overflow} (with no level) is the same as
5193 @option{-Wstrict-overflow=2}.
5194
5195 @item -Wstrict-overflow=3
5196 Also warn about other cases where a comparison is simplified. For
5197 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5198
5199 @item -Wstrict-overflow=4
5200 Also warn about other simplifications not covered by the above cases.
5201 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5202
5203 @item -Wstrict-overflow=5
5204 Also warn about cases where the compiler reduces the magnitude of a
5205 constant involved in a comparison. For example: @code{x + 2 > y} is
5206 simplified to @code{x + 1 >= y}. This is reported only at the
5207 highest warning level because this simplification applies to many
5208 comparisons, so this warning level gives a very large number of
5209 false positives.
5210 @end table
5211
5212 @item -Wstringop-overflow
5213 @itemx -Wstringop-overflow=@var{type}
5214 @opindex Wstringop-overflow
5215 @opindex Wno-stringop-overflow
5216 Warn for calls to string manipulation functions such as @code{memcpy} and
5217 @code{strcpy} that are determined to overflow the destination buffer. The
5218 optional argument is one greater than the type of Object Size Checking to
5219 perform to determine the size of the destination. @xref{Object Size Checking}.
5220 The argument is meaningful only for functions that operate on character arrays
5221 but not for raw memory functions like @code{memcpy} which always make use
5222 of Object Size type-0. The option also warns for calls that specify a size
5223 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5224 The option produces the best results with optimization enabled but can detect
5225 a small subset of simple buffer overflows even without optimization in
5226 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5227 correspond to the standard functions. In any case, the option warns about
5228 just a subset of buffer overflows detected by the corresponding overflow
5229 checking built-ins. For example, the option will issue a warning for
5230 the @code{strcpy} call below because it copies at least 5 characters
5231 (the string @code{"blue"} including the terminating NUL) into the buffer
5232 of size 4.
5233
5234 @smallexample
5235 enum Color @{ blue, purple, yellow @};
5236 const char* f (enum Color clr)
5237 @{
5238 static char buf [4];
5239 const char *str;
5240 switch (clr)
5241 @{
5242 case blue: str = "blue"; break;
5243 case purple: str = "purple"; break;
5244 case yellow: str = "yellow"; break;
5245 @}
5246
5247 return strcpy (buf, str); // warning here
5248 @}
5249 @end smallexample
5250
5251 Option @option{-Wstringop-overflow=2} is enabled by default.
5252
5253 @table @gcctabopt
5254 @item -Wstringop-overflow
5255 @itemx -Wstringop-overflow=1
5256 @opindex Wstringop-overflow
5257 @opindex Wno-stringop-overflow
5258 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5259 to determine the sizes of destination objects. This is the default setting
5260 of the option. At this setting the option will not warn for writes past
5261 the end of subobjects of larger objects accessed by pointers unless the
5262 size of the largest surrounding object is known. When the destination may
5263 be one of several objects it is assumed to be the largest one of them. On
5264 Linux systems, when optimization is enabled at this setting the option warns
5265 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5266 a non-zero value.
5267
5268 @item -Wstringop-overflow=2
5269 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5270 to determine the sizes of destination objects. At this setting the option
5271 will warn about overflows when writing to members of the largest complete
5272 objects whose exact size is known. It will, however, not warn for excessive
5273 writes to the same members of unknown objects referenced by pointers since
5274 they may point to arrays containing unknown numbers of elements.
5275
5276 @item -Wstringop-overflow=3
5277 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5278 to determine the sizes of destination objects. At this setting the option
5279 warns about overflowing the smallest object or data member. This is the
5280 most restrictive setting of the option that may result in warnings for safe
5281 code.
5282
5283 @item -Wstringop-overflow=4
5284 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5285 to determine the sizes of destination objects. At this setting the option
5286 will warn about overflowing any data members, and when the destination is
5287 one of several objects it uses the size of the largest of them to decide
5288 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5289 setting of the option may result in warnings for benign code.
5290 @end table
5291
5292 @item -Wstringop-truncation
5293 @opindex Wstringop-truncation
5294 @opindex Wno-stringop-truncation
5295 Warn for calls to bounded string manipulation functions such as @code{strncat},
5296 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5297 or leave the destination unchanged.
5298
5299 In the following example, the call to @code{strncat} specifies a bound that
5300 is less than the length of the source string. As a result, the copy of
5301 the source will be truncated and so the call is diagnosed. To avoid the
5302 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5303
5304 @smallexample
5305 void append (char *buf, size_t bufsize)
5306 @{
5307 strncat (buf, ".txt", 3);
5308 @}
5309 @end smallexample
5310
5311 As another example, the following call to @code{strncpy} results in copying
5312 to @code{d} just the characters preceding the terminating NUL, without
5313 appending the NUL to the end. Assuming the result of @code{strncpy} is
5314 necessarily a NUL-terminated string is a common mistake, and so the call
5315 is diagnosed. To avoid the warning when the result is not expected to be
5316 NUL-terminated, call @code{memcpy} instead.
5317
5318 @smallexample
5319 void copy (char *d, const char *s)
5320 @{
5321 strncpy (d, s, strlen (s));
5322 @}
5323 @end smallexample
5324
5325 In the following example, the call to @code{strncpy} specifies the size
5326 of the destination buffer as the bound. If the length of the source
5327 string is equal to or greater than this size the result of the copy will
5328 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5329 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5330 element of the buffer to @code{NUL}.
5331
5332 @smallexample
5333 void copy (const char *s)
5334 @{
5335 char buf[80];
5336 strncpy (buf, s, sizeof buf);
5337 @dots{}
5338 @}
5339 @end smallexample
5340
5341 In situations where a character array is intended to store a sequence
5342 of bytes with no terminating @code{NUL} such an array may be annotated
5343 with attribute @code{nonstring} to avoid this warning. Such arrays,
5344 however, are not suitable arguments to functions that expect
5345 @code{NUL}-terminated strings. To help detect accidental misuses of
5346 such arrays GCC issues warnings unless it can prove that the use is
5347 safe. @xref{Common Variable Attributes}.
5348
5349 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5350 @opindex Wsuggest-attribute=
5351 @opindex Wno-suggest-attribute=
5352 Warn for cases where adding an attribute may be beneficial. The
5353 attributes currently supported are listed below.
5354
5355 @table @gcctabopt
5356 @item -Wsuggest-attribute=pure
5357 @itemx -Wsuggest-attribute=const
5358 @itemx -Wsuggest-attribute=noreturn
5359 @itemx -Wsuggest-attribute=malloc
5360 @opindex Wsuggest-attribute=pure
5361 @opindex Wno-suggest-attribute=pure
5362 @opindex Wsuggest-attribute=const
5363 @opindex Wno-suggest-attribute=const
5364 @opindex Wsuggest-attribute=noreturn
5365 @opindex Wno-suggest-attribute=noreturn
5366 @opindex Wsuggest-attribute=malloc
5367 @opindex Wno-suggest-attribute=malloc
5368
5369 Warn about functions that might be candidates for attributes
5370 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5371 only warns for functions visible in other compilation units or (in the case of
5372 @code{pure} and @code{const}) if it cannot prove that the function returns
5373 normally. A function returns normally if it doesn't contain an infinite loop or
5374 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5375 requires option @option{-fipa-pure-const}, which is enabled by default at
5376 @option{-O} and higher. Higher optimization levels improve the accuracy
5377 of the analysis.
5378
5379 @item -Wsuggest-attribute=format
5380 @itemx -Wmissing-format-attribute
5381 @opindex Wsuggest-attribute=format
5382 @opindex Wmissing-format-attribute
5383 @opindex Wno-suggest-attribute=format
5384 @opindex Wno-missing-format-attribute
5385 @opindex Wformat
5386 @opindex Wno-format
5387
5388 Warn about function pointers that might be candidates for @code{format}
5389 attributes. Note these are only possible candidates, not absolute ones.
5390 GCC guesses that function pointers with @code{format} attributes that
5391 are used in assignment, initialization, parameter passing or return
5392 statements should have a corresponding @code{format} attribute in the
5393 resulting type. I.e.@: the left-hand side of the assignment or
5394 initialization, the type of the parameter variable, or the return type
5395 of the containing function respectively should also have a @code{format}
5396 attribute to avoid the warning.
5397
5398 GCC also warns about function definitions that might be
5399 candidates for @code{format} attributes. Again, these are only
5400 possible candidates. GCC guesses that @code{format} attributes
5401 might be appropriate for any function that calls a function like
5402 @code{vprintf} or @code{vscanf}, but this might not always be the
5403 case, and some functions for which @code{format} attributes are
5404 appropriate may not be detected.
5405
5406 @item -Wsuggest-attribute=cold
5407 @opindex Wsuggest-attribute=cold
5408 @opindex Wno-suggest-attribute=cold
5409
5410 Warn about functions that might be candidates for @code{cold} attribute. This
5411 is based on static detection and generally will only warn about functions which
5412 always leads to a call to another @code{cold} function such as wrappers of
5413 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5414 @end table
5415
5416 @item -Wsuggest-final-types
5417 @opindex Wno-suggest-final-types
5418 @opindex Wsuggest-final-types
5419 Warn about types with virtual methods where code quality would be improved
5420 if the type were declared with the C++11 @code{final} specifier,
5421 or, if possible,
5422 declared in an anonymous namespace. This allows GCC to more aggressively
5423 devirtualize the polymorphic calls. This warning is more effective with link
5424 time optimization, where the information about the class hierarchy graph is
5425 more complete.
5426
5427 @item -Wsuggest-final-methods
5428 @opindex Wno-suggest-final-methods
5429 @opindex Wsuggest-final-methods
5430 Warn about virtual methods where code quality would be improved if the method
5431 were declared with the C++11 @code{final} specifier,
5432 or, if possible, its type were
5433 declared in an anonymous namespace or with the @code{final} specifier.
5434 This warning is
5435 more effective with link-time optimization, where the information about the
5436 class hierarchy graph is more complete. It is recommended to first consider
5437 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5438 annotations.
5439
5440 @item -Wsuggest-override
5441 Warn about overriding virtual functions that are not marked with the override
5442 keyword.
5443
5444 @item -Walloc-zero
5445 @opindex Wno-alloc-zero
5446 @opindex Walloc-zero
5447 Warn about calls to allocation functions decorated with attribute
5448 @code{alloc_size} that specify zero bytes, including those to the built-in
5449 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5450 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5451 when called with a zero size differs among implementations (and in the case
5452 of @code{realloc} has been deprecated) relying on it may result in subtle
5453 portability bugs and should be avoided.
5454
5455 @item -Walloc-size-larger-than=@var{n}
5456 Warn about calls to functions decorated with attribute @code{alloc_size}
5457 that attempt to allocate objects larger than the specified number of bytes,
5458 or where the result of the size computation in an integer type with infinite
5459 precision would exceed @code{SIZE_MAX / 2}. The option argument @var{n}
5460 may end in one of the standard suffixes designating a multiple of bytes
5461 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
5462 @code{MB} and @code{MiB} for megabyte and mebibyte, and so on.
5463 @xref{Function Attributes}.
5464
5465 @item -Walloca
5466 @opindex Wno-alloca
5467 @opindex Walloca
5468 This option warns on all uses of @code{alloca} in the source.
5469
5470 @item -Walloca-larger-than=@var{n}
5471 This option warns on calls to @code{alloca} that are not bounded by a
5472 controlling predicate limiting its argument of integer type to at most
5473 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5474 Arguments of non-integer types are considered unbounded even if they
5475 appear to be constrained to the expected range.
5476
5477 For example, a bounded case of @code{alloca} could be:
5478
5479 @smallexample
5480 void func (size_t n)
5481 @{
5482 void *p;
5483 if (n <= 1000)
5484 p = alloca (n);
5485 else
5486 p = malloc (n);
5487 f (p);
5488 @}
5489 @end smallexample
5490
5491 In the above example, passing @code{-Walloca-larger-than=1000} would not
5492 issue a warning because the call to @code{alloca} is known to be at most
5493 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5494 the compiler would emit a warning.
5495
5496 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5497 controlling predicate constraining its integer argument. For example:
5498
5499 @smallexample
5500 void func ()
5501 @{
5502 void *p = alloca (n);
5503 f (p);
5504 @}
5505 @end smallexample
5506
5507 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5508 a warning, but this time because of the lack of bounds checking.
5509
5510 Note, that even seemingly correct code involving signed integers could
5511 cause a warning:
5512
5513 @smallexample
5514 void func (signed int n)
5515 @{
5516 if (n < 500)
5517 @{
5518 p = alloca (n);
5519 f (p);
5520 @}
5521 @}
5522 @end smallexample
5523
5524 In the above example, @var{n} could be negative, causing a larger than
5525 expected argument to be implicitly cast into the @code{alloca} call.
5526
5527 This option also warns when @code{alloca} is used in a loop.
5528
5529 This warning is not enabled by @option{-Wall}, and is only active when
5530 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5531
5532 See also @option{-Wvla-larger-than=@var{n}}.
5533
5534 @item -Warray-bounds
5535 @itemx -Warray-bounds=@var{n}
5536 @opindex Wno-array-bounds
5537 @opindex Warray-bounds
5538 This option is only active when @option{-ftree-vrp} is active
5539 (default for @option{-O2} and above). It warns about subscripts to arrays
5540 that are always out of bounds. This warning is enabled by @option{-Wall}.
5541
5542 @table @gcctabopt
5543 @item -Warray-bounds=1
5544 This is the warning level of @option{-Warray-bounds} and is enabled
5545 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5546
5547 @item -Warray-bounds=2
5548 This warning level also warns about out of bounds access for
5549 arrays at the end of a struct and for arrays accessed through
5550 pointers. This warning level may give a larger number of
5551 false positives and is deactivated by default.
5552 @end table
5553
5554 @item -Wattribute-alias
5555 Warn about declarations using the @code{alias} and similar attributes whose
5556 target is incompatible with the type of the alias. @xref{Function Attributes,
5557 ,Declaring Attributes of Functions}.
5558
5559 @item -Wbool-compare
5560 @opindex Wno-bool-compare
5561 @opindex Wbool-compare
5562 Warn about boolean expression compared with an integer value different from
5563 @code{true}/@code{false}. For instance, the following comparison is
5564 always false:
5565 @smallexample
5566 int n = 5;
5567 @dots{}
5568 if ((n > 1) == 2) @{ @dots{} @}
5569 @end smallexample
5570 This warning is enabled by @option{-Wall}.
5571
5572 @item -Wbool-operation
5573 @opindex Wno-bool-operation
5574 @opindex Wbool-operation
5575 Warn about suspicious operations on expressions of a boolean type. For
5576 instance, bitwise negation of a boolean is very likely a bug in the program.
5577 For C, this warning also warns about incrementing or decrementing a boolean,
5578 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5579 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5580
5581 This warning is enabled by @option{-Wall}.
5582
5583 @item -Wduplicated-branches
5584 @opindex Wno-duplicated-branches
5585 @opindex Wduplicated-branches
5586 Warn when an if-else has identical branches. This warning detects cases like
5587 @smallexample
5588 if (p != NULL)
5589 return 0;
5590 else
5591 return 0;
5592 @end smallexample
5593 It doesn't warn when both branches contain just a null statement. This warning
5594 also warn for conditional operators:
5595 @smallexample
5596 int i = x ? *p : *p;
5597 @end smallexample
5598
5599 @item -Wduplicated-cond
5600 @opindex Wno-duplicated-cond
5601 @opindex Wduplicated-cond
5602 Warn about duplicated conditions in an if-else-if chain. For instance,
5603 warn for the following code:
5604 @smallexample
5605 if (p->q != NULL) @{ @dots{} @}
5606 else if (p->q != NULL) @{ @dots{} @}
5607 @end smallexample
5608
5609 @item -Wframe-address
5610 @opindex Wno-frame-address
5611 @opindex Wframe-address
5612 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5613 is called with an argument greater than 0. Such calls may return indeterminate
5614 values or crash the program. The warning is included in @option{-Wall}.
5615
5616 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5617 @opindex Wno-discarded-qualifiers
5618 @opindex Wdiscarded-qualifiers
5619 Do not warn if type qualifiers on pointers are being discarded.
5620 Typically, the compiler warns if a @code{const char *} variable is
5621 passed to a function that takes a @code{char *} parameter. This option
5622 can be used to suppress such a warning.
5623
5624 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5625 @opindex Wno-discarded-array-qualifiers
5626 @opindex Wdiscarded-array-qualifiers
5627 Do not warn if type qualifiers on arrays which are pointer targets
5628 are being discarded. Typically, the compiler warns if a
5629 @code{const int (*)[]} variable is passed to a function that
5630 takes a @code{int (*)[]} parameter. This option can be used to
5631 suppress such a warning.
5632
5633 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5634 @opindex Wno-incompatible-pointer-types
5635 @opindex Wincompatible-pointer-types
5636 Do not warn when there is a conversion between pointers that have incompatible
5637 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5638 which warns for pointer argument passing or assignment with different
5639 signedness.
5640
5641 @item -Wno-int-conversion @r{(C and Objective-C only)}
5642 @opindex Wno-int-conversion
5643 @opindex Wint-conversion
5644 Do not warn about incompatible integer to pointer and pointer to integer
5645 conversions. This warning is about implicit conversions; for explicit
5646 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5647 @option{-Wno-pointer-to-int-cast} may be used.
5648
5649 @item -Wno-div-by-zero
5650 @opindex Wno-div-by-zero
5651 @opindex Wdiv-by-zero
5652 Do not warn about compile-time integer division by zero. Floating-point
5653 division by zero is not warned about, as it can be a legitimate way of
5654 obtaining infinities and NaNs.
5655
5656 @item -Wsystem-headers
5657 @opindex Wsystem-headers
5658 @opindex Wno-system-headers
5659 @cindex warnings from system headers
5660 @cindex system headers, warnings from
5661 Print warning messages for constructs found in system header files.
5662 Warnings from system headers are normally suppressed, on the assumption
5663 that they usually do not indicate real problems and would only make the
5664 compiler output harder to read. Using this command-line option tells
5665 GCC to emit warnings from system headers as if they occurred in user
5666 code. However, note that using @option{-Wall} in conjunction with this
5667 option does @emph{not} warn about unknown pragmas in system
5668 headers---for that, @option{-Wunknown-pragmas} must also be used.
5669
5670 @item -Wtautological-compare
5671 @opindex Wtautological-compare
5672 @opindex Wno-tautological-compare
5673 Warn if a self-comparison always evaluates to true or false. This
5674 warning detects various mistakes such as:
5675 @smallexample
5676 int i = 1;
5677 @dots{}
5678 if (i > i) @{ @dots{} @}
5679 @end smallexample
5680
5681 This warning also warns about bitwise comparisons that always evaluate
5682 to true or false, for instance:
5683 @smallexample
5684 if ((a & 16) == 10) @{ @dots{} @}
5685 @end smallexample
5686 will always be false.
5687
5688 This warning is enabled by @option{-Wall}.
5689
5690 @item -Wtrampolines
5691 @opindex Wtrampolines
5692 @opindex Wno-trampolines
5693 Warn about trampolines generated for pointers to nested functions.
5694 A trampoline is a small piece of data or code that is created at run
5695 time on the stack when the address of a nested function is taken, and is
5696 used to call the nested function indirectly. For some targets, it is
5697 made up of data only and thus requires no special treatment. But, for
5698 most targets, it is made up of code and thus requires the stack to be
5699 made executable in order for the program to work properly.
5700
5701 @item -Wfloat-equal
5702 @opindex Wfloat-equal
5703 @opindex Wno-float-equal
5704 Warn if floating-point values are used in equality comparisons.
5705
5706 The idea behind this is that sometimes it is convenient (for the
5707 programmer) to consider floating-point values as approximations to
5708 infinitely precise real numbers. If you are doing this, then you need
5709 to compute (by analyzing the code, or in some other way) the maximum or
5710 likely maximum error that the computation introduces, and allow for it
5711 when performing comparisons (and when producing output, but that's a
5712 different problem). In particular, instead of testing for equality, you
5713 should check to see whether the two values have ranges that overlap; and
5714 this is done with the relational operators, so equality comparisons are
5715 probably mistaken.
5716
5717 @item -Wtraditional @r{(C and Objective-C only)}
5718 @opindex Wtraditional
5719 @opindex Wno-traditional
5720 Warn about certain constructs that behave differently in traditional and
5721 ISO C@. Also warn about ISO C constructs that have no traditional C
5722 equivalent, and/or problematic constructs that should be avoided.
5723
5724 @itemize @bullet
5725 @item
5726 Macro parameters that appear within string literals in the macro body.
5727 In traditional C macro replacement takes place within string literals,
5728 but in ISO C it does not.
5729
5730 @item
5731 In traditional C, some preprocessor directives did not exist.
5732 Traditional preprocessors only considered a line to be a directive
5733 if the @samp{#} appeared in column 1 on the line. Therefore
5734 @option{-Wtraditional} warns about directives that traditional C
5735 understands but ignores because the @samp{#} does not appear as the
5736 first character on the line. It also suggests you hide directives like
5737 @code{#pragma} not understood by traditional C by indenting them. Some
5738 traditional implementations do not recognize @code{#elif}, so this option
5739 suggests avoiding it altogether.
5740
5741 @item
5742 A function-like macro that appears without arguments.
5743
5744 @item
5745 The unary plus operator.
5746
5747 @item
5748 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5749 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5750 constants.) Note, these suffixes appear in macros defined in the system
5751 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5752 Use of these macros in user code might normally lead to spurious
5753 warnings, however GCC's integrated preprocessor has enough context to
5754 avoid warning in these cases.
5755
5756 @item
5757 A function declared external in one block and then used after the end of
5758 the block.
5759
5760 @item
5761 A @code{switch} statement has an operand of type @code{long}.
5762
5763 @item
5764 A non-@code{static} function declaration follows a @code{static} one.
5765 This construct is not accepted by some traditional C compilers.
5766
5767 @item
5768 The ISO type of an integer constant has a different width or
5769 signedness from its traditional type. This warning is only issued if
5770 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5771 typically represent bit patterns, are not warned about.
5772
5773 @item
5774 Usage of ISO string concatenation is detected.
5775
5776 @item
5777 Initialization of automatic aggregates.
5778
5779 @item
5780 Identifier conflicts with labels. Traditional C lacks a separate
5781 namespace for labels.
5782
5783 @item
5784 Initialization of unions. If the initializer is zero, the warning is
5785 omitted. This is done under the assumption that the zero initializer in
5786 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5787 initializer warnings and relies on default initialization to zero in the
5788 traditional C case.
5789
5790 @item
5791 Conversions by prototypes between fixed/floating-point values and vice
5792 versa. The absence of these prototypes when compiling with traditional
5793 C causes serious problems. This is a subset of the possible
5794 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5795
5796 @item
5797 Use of ISO C style function definitions. This warning intentionally is
5798 @emph{not} issued for prototype declarations or variadic functions
5799 because these ISO C features appear in your code when using
5800 libiberty's traditional C compatibility macros, @code{PARAMS} and
5801 @code{VPARAMS}. This warning is also bypassed for nested functions
5802 because that feature is already a GCC extension and thus not relevant to
5803 traditional C compatibility.
5804 @end itemize
5805
5806 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5807 @opindex Wtraditional-conversion
5808 @opindex Wno-traditional-conversion
5809 Warn if a prototype causes a type conversion that is different from what
5810 would happen to the same argument in the absence of a prototype. This
5811 includes conversions of fixed point to floating and vice versa, and
5812 conversions changing the width or signedness of a fixed-point argument
5813 except when the same as the default promotion.
5814
5815 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5816 @opindex Wdeclaration-after-statement
5817 @opindex Wno-declaration-after-statement
5818 Warn when a declaration is found after a statement in a block. This
5819 construct, known from C++, was introduced with ISO C99 and is by default
5820 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5821
5822 @item -Wshadow
5823 @opindex Wshadow
5824 @opindex Wno-shadow
5825 Warn whenever a local variable or type declaration shadows another
5826 variable, parameter, type, class member (in C++), or instance variable
5827 (in Objective-C) or whenever a built-in function is shadowed. Note
5828 that in C++, the compiler warns if a local variable shadows an
5829 explicit typedef, but not if it shadows a struct/class/enum.
5830 Same as @option{-Wshadow=global}.
5831
5832 @item -Wno-shadow-ivar @r{(Objective-C only)}
5833 @opindex Wno-shadow-ivar
5834 @opindex Wshadow-ivar
5835 Do not warn whenever a local variable shadows an instance variable in an
5836 Objective-C method.
5837
5838 @item -Wshadow=global
5839 @opindex Wshadow=local
5840 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5841
5842 @item -Wshadow=local
5843 @opindex Wshadow=local
5844 Warn when a local variable shadows another local variable or parameter.
5845 This warning is enabled by @option{-Wshadow=global}.
5846
5847 @item -Wshadow=compatible-local
5848 @opindex Wshadow=compatible-local
5849 Warn when a local variable shadows another local variable or parameter
5850 whose type is compatible with that of the shadowing variable. In C++,
5851 type compatibility here means the type of the shadowing variable can be
5852 converted to that of the shadowed variable. The creation of this flag
5853 (in addition to @option{-Wshadow=local}) is based on the idea that when
5854 a local variable shadows another one of incompatible type, it is most
5855 likely intentional, not a bug or typo, as shown in the following example:
5856
5857 @smallexample
5858 @group
5859 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5860 @{
5861 for (int i = 0; i < N; ++i)
5862 @{
5863 ...
5864 @}
5865 ...
5866 @}
5867 @end group
5868 @end smallexample
5869
5870 Since the two variable @code{i} in the example above have incompatible types,
5871 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5872 Because their types are incompatible, if a programmer accidentally uses one
5873 in place of the other, type checking will catch that and emit an error or
5874 warning. So not warning (about shadowing) in this case will not lead to
5875 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5876 possibly reduce the number of warnings triggered by intentional shadowing.
5877
5878 This warning is enabled by @option{-Wshadow=local}.
5879
5880 @item -Wlarger-than=@var{len}
5881 @opindex Wlarger-than=@var{len}
5882 @opindex Wlarger-than-@var{len}
5883 Warn whenever an object of larger than @var{len} bytes is defined.
5884
5885 @item -Wframe-larger-than=@var{len}
5886 @opindex Wframe-larger-than
5887 Warn if the size of a function frame is larger than @var{len} bytes.
5888 The computation done to determine the stack frame size is approximate
5889 and not conservative.
5890 The actual requirements may be somewhat greater than @var{len}
5891 even if you do not get a warning. In addition, any space allocated
5892 via @code{alloca}, variable-length arrays, or related constructs
5893 is not included by the compiler when determining
5894 whether or not to issue a warning.
5895
5896 @item -Wno-free-nonheap-object
5897 @opindex Wno-free-nonheap-object
5898 @opindex Wfree-nonheap-object
5899 Do not warn when attempting to free an object that was not allocated
5900 on the heap.
5901
5902 @item -Wstack-usage=@var{len}
5903 @opindex Wstack-usage
5904 Warn if the stack usage of a function might be larger than @var{len} bytes.
5905 The computation done to determine the stack usage is conservative.
5906 Any space allocated via @code{alloca}, variable-length arrays, or related
5907 constructs is included by the compiler when determining whether or not to
5908 issue a warning.
5909
5910 The message is in keeping with the output of @option{-fstack-usage}.
5911
5912 @itemize
5913 @item
5914 If the stack usage is fully static but exceeds the specified amount, it's:
5915
5916 @smallexample
5917 warning: stack usage is 1120 bytes
5918 @end smallexample
5919 @item
5920 If the stack usage is (partly) dynamic but bounded, it's:
5921
5922 @smallexample
5923 warning: stack usage might be 1648 bytes
5924 @end smallexample
5925 @item
5926 If the stack usage is (partly) dynamic and not bounded, it's:
5927
5928 @smallexample
5929 warning: stack usage might be unbounded
5930 @end smallexample
5931 @end itemize
5932
5933 @item -Wunsafe-loop-optimizations
5934 @opindex Wunsafe-loop-optimizations
5935 @opindex Wno-unsafe-loop-optimizations
5936 Warn if the loop cannot be optimized because the compiler cannot
5937 assume anything on the bounds of the loop indices. With
5938 @option{-funsafe-loop-optimizations} warn if the compiler makes
5939 such assumptions.
5940
5941 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5942 @opindex Wno-pedantic-ms-format
5943 @opindex Wpedantic-ms-format
5944 When used in combination with @option{-Wformat}
5945 and @option{-pedantic} without GNU extensions, this option
5946 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5947 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5948 which depend on the MS runtime.
5949
5950 @item -Waligned-new
5951 @opindex Waligned-new
5952 @opindex Wno-aligned-new
5953 Warn about a new-expression of a type that requires greater alignment
5954 than the @code{alignof(std::max_align_t)} but uses an allocation
5955 function without an explicit alignment parameter. This option is
5956 enabled by @option{-Wall}.
5957
5958 Normally this only warns about global allocation functions, but
5959 @option{-Waligned-new=all} also warns about class member allocation
5960 functions.
5961
5962 @item -Wplacement-new
5963 @itemx -Wplacement-new=@var{n}
5964 @opindex Wplacement-new
5965 @opindex Wno-placement-new
5966 Warn about placement new expressions with undefined behavior, such as
5967 constructing an object in a buffer that is smaller than the type of
5968 the object. For example, the placement new expression below is diagnosed
5969 because it attempts to construct an array of 64 integers in a buffer only
5970 64 bytes large.
5971 @smallexample
5972 char buf [64];
5973 new (buf) int[64];
5974 @end smallexample
5975 This warning is enabled by default.
5976
5977 @table @gcctabopt
5978 @item -Wplacement-new=1
5979 This is the default warning level of @option{-Wplacement-new}. At this
5980 level the warning is not issued for some strictly undefined constructs that
5981 GCC allows as extensions for compatibility with legacy code. For example,
5982 the following @code{new} expression is not diagnosed at this level even
5983 though it has undefined behavior according to the C++ standard because
5984 it writes past the end of the one-element array.
5985 @smallexample
5986 struct S @{ int n, a[1]; @};
5987 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5988 new (s->a)int [32]();
5989 @end smallexample
5990
5991 @item -Wplacement-new=2
5992 At this level, in addition to diagnosing all the same constructs as at level
5993 1, a diagnostic is also issued for placement new expressions that construct
5994 an object in the last member of structure whose type is an array of a single
5995 element and whose size is less than the size of the object being constructed.
5996 While the previous example would be diagnosed, the following construct makes
5997 use of the flexible member array extension to avoid the warning at level 2.
5998 @smallexample
5999 struct S @{ int n, a[]; @};
6000 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6001 new (s->a)int [32]();
6002 @end smallexample
6003
6004 @end table
6005
6006 @item -Wpointer-arith
6007 @opindex Wpointer-arith
6008 @opindex Wno-pointer-arith
6009 Warn about anything that depends on the ``size of'' a function type or
6010 of @code{void}. GNU C assigns these types a size of 1, for
6011 convenience in calculations with @code{void *} pointers and pointers
6012 to functions. In C++, warn also when an arithmetic operation involves
6013 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6014
6015 @item -Wpointer-compare
6016 @opindex Wpointer-compare
6017 @opindex Wno-pointer-compare
6018 Warn if a pointer is compared with a zero character constant. This usually
6019 means that the pointer was meant to be dereferenced. For example:
6020
6021 @smallexample
6022 const char *p = foo ();
6023 if (p == '\0')
6024 return 42;
6025 @end smallexample
6026
6027 Note that the code above is invalid in C++11.
6028
6029 This warning is enabled by default.
6030
6031 @item -Wtype-limits
6032 @opindex Wtype-limits
6033 @opindex Wno-type-limits
6034 Warn if a comparison is always true or always false due to the limited
6035 range of the data type, but do not warn for constant expressions. For
6036 example, warn if an unsigned variable is compared against zero with
6037 @code{<} or @code{>=}. This warning is also enabled by
6038 @option{-Wextra}.
6039
6040 @include cppwarnopts.texi
6041
6042 @item -Wbad-function-cast @r{(C and Objective-C only)}
6043 @opindex Wbad-function-cast
6044 @opindex Wno-bad-function-cast
6045 Warn when a function call is cast to a non-matching type.
6046 For example, warn if a call to a function returning an integer type
6047 is cast to a pointer type.
6048
6049 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6050 @opindex Wc90-c99-compat
6051 @opindex Wno-c90-c99-compat
6052 Warn about features not present in ISO C90, but present in ISO C99.
6053 For instance, warn about use of variable length arrays, @code{long long}
6054 type, @code{bool} type, compound literals, designated initializers, and so
6055 on. This option is independent of the standards mode. Warnings are disabled
6056 in the expression that follows @code{__extension__}.
6057
6058 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6059 @opindex Wc99-c11-compat
6060 @opindex Wno-c99-c11-compat
6061 Warn about features not present in ISO C99, but present in ISO C11.
6062 For instance, warn about use of anonymous structures and unions,
6063 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6064 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6065 and so on. This option is independent of the standards mode. Warnings are
6066 disabled in the expression that follows @code{__extension__}.
6067
6068 @item -Wc++-compat @r{(C and Objective-C only)}
6069 @opindex Wc++-compat
6070 Warn about ISO C constructs that are outside of the common subset of
6071 ISO C and ISO C++, e.g.@: request for implicit conversion from
6072 @code{void *} to a pointer to non-@code{void} type.
6073
6074 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6075 @opindex Wc++11-compat
6076 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6077 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6078 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6079 enabled by @option{-Wall}.
6080
6081 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6082 @opindex Wc++14-compat
6083 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6084 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6085
6086 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6087 @opindex Wc++17-compat
6088 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6089 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6090
6091 @item -Wcast-qual
6092 @opindex Wcast-qual
6093 @opindex Wno-cast-qual
6094 Warn whenever a pointer is cast so as to remove a type qualifier from
6095 the target type. For example, warn if a @code{const char *} is cast
6096 to an ordinary @code{char *}.
6097
6098 Also warn when making a cast that introduces a type qualifier in an
6099 unsafe way. For example, casting @code{char **} to @code{const char **}
6100 is unsafe, as in this example:
6101
6102 @smallexample
6103 /* p is char ** value. */
6104 const char **q = (const char **) p;
6105 /* Assignment of readonly string to const char * is OK. */
6106 *q = "string";
6107 /* Now char** pointer points to read-only memory. */
6108 **p = 'b';
6109 @end smallexample
6110
6111 @item -Wcast-align
6112 @opindex Wcast-align
6113 @opindex Wno-cast-align
6114 Warn whenever a pointer is cast such that the required alignment of the
6115 target is increased. For example, warn if a @code{char *} is cast to
6116 an @code{int *} on machines where integers can only be accessed at
6117 two- or four-byte boundaries.
6118
6119 @item -Wcast-align=strict
6120 @opindex Wcast-align=strict
6121 Warn whenever a pointer is cast such that the required alignment of the
6122 target is increased. For example, warn if a @code{char *} is cast to
6123 an @code{int *} regardless of the target machine.
6124
6125 @item -Wcast-function-type
6126 @opindex Wcast-function-type
6127 @opindex Wno-cast-function-type
6128 Warn when a function pointer is cast to an incompatible function pointer.
6129 In a cast involving function types with a variable argument list only
6130 the types of initial arguments that are provided are considered.
6131 Any parameter of pointer-type matches any other pointer-type. Any benign
6132 differences in integral types are ignored, like @code{int} vs. @code{long}
6133 on ILP32 targets. Likewise type qualifiers are ignored. The function
6134 type @code{void (*) (void)} is special and matches everything, which can
6135 be used to suppress this warning.
6136 In a cast involving pointer to member types this warning warns whenever
6137 the type cast is changing the pointer to member type.
6138 This warning is enabled by @option{-Wextra}.
6139
6140 @item -Wwrite-strings
6141 @opindex Wwrite-strings
6142 @opindex Wno-write-strings
6143 When compiling C, give string constants the type @code{const
6144 char[@var{length}]} so that copying the address of one into a
6145 non-@code{const} @code{char *} pointer produces a warning. These
6146 warnings help you find at compile time code that can try to write
6147 into a string constant, but only if you have been very careful about
6148 using @code{const} in declarations and prototypes. Otherwise, it is
6149 just a nuisance. This is why we did not make @option{-Wall} request
6150 these warnings.
6151
6152 When compiling C++, warn about the deprecated conversion from string
6153 literals to @code{char *}. This warning is enabled by default for C++
6154 programs.
6155
6156 @item -Wcatch-value
6157 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6158 @opindex Wcatch-value
6159 @opindex Wno-catch-value
6160 Warn about catch handlers that do not catch via reference.
6161 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6162 warn about polymorphic class types that are caught by value.
6163 With @option{-Wcatch-value=2} warn about all class types that are caught
6164 by value. With @option{-Wcatch-value=3} warn about all types that are
6165 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6166
6167 @item -Wclobbered
6168 @opindex Wclobbered
6169 @opindex Wno-clobbered
6170 Warn for variables that might be changed by @code{longjmp} or
6171 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6172
6173 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6174 @opindex Wconditionally-supported
6175 @opindex Wno-conditionally-supported
6176 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6177
6178 @item -Wconversion
6179 @opindex Wconversion
6180 @opindex Wno-conversion
6181 Warn for implicit conversions that may alter a value. This includes
6182 conversions between real and integer, like @code{abs (x)} when
6183 @code{x} is @code{double}; conversions between signed and unsigned,
6184 like @code{unsigned ui = -1}; and conversions to smaller types, like
6185 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6186 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6187 changed by the conversion like in @code{abs (2.0)}. Warnings about
6188 conversions between signed and unsigned integers can be disabled by
6189 using @option{-Wno-sign-conversion}.
6190
6191 For C++, also warn for confusing overload resolution for user-defined
6192 conversions; and conversions that never use a type conversion
6193 operator: conversions to @code{void}, the same type, a base class or a
6194 reference to them. Warnings about conversions between signed and
6195 unsigned integers are disabled by default in C++ unless
6196 @option{-Wsign-conversion} is explicitly enabled.
6197
6198 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6199 @opindex Wconversion-null
6200 @opindex Wno-conversion-null
6201 Do not warn for conversions between @code{NULL} and non-pointer
6202 types. @option{-Wconversion-null} is enabled by default.
6203
6204 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6205 @opindex Wzero-as-null-pointer-constant
6206 @opindex Wno-zero-as-null-pointer-constant
6207 Warn when a literal @samp{0} is used as null pointer constant. This can
6208 be useful to facilitate the conversion to @code{nullptr} in C++11.
6209
6210 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6211 @opindex Wsubobject-linkage
6212 @opindex Wno-subobject-linkage
6213 Warn if a class type has a base or a field whose type uses the anonymous
6214 namespace or depends on a type with no linkage. If a type A depends on
6215 a type B with no or internal linkage, defining it in multiple
6216 translation units would be an ODR violation because the meaning of B
6217 is different in each translation unit. If A only appears in a single
6218 translation unit, the best way to silence the warning is to give it
6219 internal linkage by putting it in an anonymous namespace as well. The
6220 compiler doesn't give this warning for types defined in the main .C
6221 file, as those are unlikely to have multiple definitions.
6222 @option{-Wsubobject-linkage} is enabled by default.
6223
6224 @item -Wdangling-else
6225 @opindex Wdangling-else
6226 @opindex Wno-dangling-else
6227 Warn about constructions where there may be confusion to which
6228 @code{if} statement an @code{else} branch belongs. Here is an example of
6229 such a case:
6230
6231 @smallexample
6232 @group
6233 @{
6234 if (a)
6235 if (b)
6236 foo ();
6237 else
6238 bar ();
6239 @}
6240 @end group
6241 @end smallexample
6242
6243 In C/C++, every @code{else} branch belongs to the innermost possible
6244 @code{if} statement, which in this example is @code{if (b)}. This is
6245 often not what the programmer expected, as illustrated in the above
6246 example by indentation the programmer chose. When there is the
6247 potential for this confusion, GCC issues a warning when this flag
6248 is specified. To eliminate the warning, add explicit braces around
6249 the innermost @code{if} statement so there is no way the @code{else}
6250 can belong to the enclosing @code{if}. The resulting code
6251 looks like this:
6252
6253 @smallexample
6254 @group
6255 @{
6256 if (a)
6257 @{
6258 if (b)
6259 foo ();
6260 else
6261 bar ();
6262 @}
6263 @}
6264 @end group
6265 @end smallexample
6266
6267 This warning is enabled by @option{-Wparentheses}.
6268
6269 @item -Wdate-time
6270 @opindex Wdate-time
6271 @opindex Wno-date-time
6272 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6273 are encountered as they might prevent bit-wise-identical reproducible
6274 compilations.
6275
6276 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6277 @opindex Wdelete-incomplete
6278 @opindex Wno-delete-incomplete
6279 Warn when deleting a pointer to incomplete type, which may cause
6280 undefined behavior at runtime. This warning is enabled by default.
6281
6282 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6283 @opindex Wuseless-cast
6284 @opindex Wno-useless-cast
6285 Warn when an expression is casted to its own type.
6286
6287 @item -Wempty-body
6288 @opindex Wempty-body
6289 @opindex Wno-empty-body
6290 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6291 while} statement. This warning is also enabled by @option{-Wextra}.
6292
6293 @item -Wenum-compare
6294 @opindex Wenum-compare
6295 @opindex Wno-enum-compare
6296 Warn about a comparison between values of different enumerated types.
6297 In C++ enumerated type mismatches in conditional expressions are also
6298 diagnosed and the warning is enabled by default. In C this warning is
6299 enabled by @option{-Wall}.
6300
6301 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6302 @opindex Wextra-semi
6303 @opindex Wno-extra-semi
6304 Warn about redundant semicolon after in-class function definition.
6305
6306 @item -Wjump-misses-init @r{(C, Objective-C only)}
6307 @opindex Wjump-misses-init
6308 @opindex Wno-jump-misses-init
6309 Warn if a @code{goto} statement or a @code{switch} statement jumps
6310 forward across the initialization of a variable, or jumps backward to a
6311 label after the variable has been initialized. This only warns about
6312 variables that are initialized when they are declared. This warning is
6313 only supported for C and Objective-C; in C++ this sort of branch is an
6314 error in any case.
6315
6316 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6317 can be disabled with the @option{-Wno-jump-misses-init} option.
6318
6319 @item -Wsign-compare
6320 @opindex Wsign-compare
6321 @opindex Wno-sign-compare
6322 @cindex warning for comparison of signed and unsigned values
6323 @cindex comparison of signed and unsigned values, warning
6324 @cindex signed and unsigned values, comparison warning
6325 Warn when a comparison between signed and unsigned values could produce
6326 an incorrect result when the signed value is converted to unsigned.
6327 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6328 also enabled by @option{-Wextra}.
6329
6330 @item -Wsign-conversion
6331 @opindex Wsign-conversion
6332 @opindex Wno-sign-conversion
6333 Warn for implicit conversions that may change the sign of an integer
6334 value, like assigning a signed integer expression to an unsigned
6335 integer variable. An explicit cast silences the warning. In C, this
6336 option is enabled also by @option{-Wconversion}.
6337
6338 @item -Wfloat-conversion
6339 @opindex Wfloat-conversion
6340 @opindex Wno-float-conversion
6341 Warn for implicit conversions that reduce the precision of a real value.
6342 This includes conversions from real to integer, and from higher precision
6343 real to lower precision real values. This option is also enabled by
6344 @option{-Wconversion}.
6345
6346 @item -Wno-scalar-storage-order
6347 @opindex -Wno-scalar-storage-order
6348 @opindex -Wscalar-storage-order
6349 Do not warn on suspicious constructs involving reverse scalar storage order.
6350
6351 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6352 @opindex Wsized-deallocation
6353 @opindex Wno-sized-deallocation
6354 Warn about a definition of an unsized deallocation function
6355 @smallexample
6356 void operator delete (void *) noexcept;
6357 void operator delete[] (void *) noexcept;
6358 @end smallexample
6359 without a definition of the corresponding sized deallocation function
6360 @smallexample
6361 void operator delete (void *, std::size_t) noexcept;
6362 void operator delete[] (void *, std::size_t) noexcept;
6363 @end smallexample
6364 or vice versa. Enabled by @option{-Wextra} along with
6365 @option{-fsized-deallocation}.
6366
6367 @item -Wsizeof-pointer-div
6368 @opindex Wsizeof-pointer-div
6369 @opindex Wno-sizeof-pointer-div
6370 Warn for suspicious divisions of two sizeof expressions that divide
6371 the pointer size by the element size, which is the usual way to compute
6372 the array size but won't work out correctly with pointers. This warning
6373 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6374 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6375
6376 @item -Wsizeof-pointer-memaccess
6377 @opindex Wsizeof-pointer-memaccess
6378 @opindex Wno-sizeof-pointer-memaccess
6379 Warn for suspicious length parameters to certain string and memory built-in
6380 functions if the argument uses @code{sizeof}. This warning triggers for
6381 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6382 an array, but a pointer, and suggests a possible fix, or about
6383 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6384 also warns about calls to bounded string copy functions like @code{strncat}
6385 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6386 the source array. For example, in the following function the call to
6387 @code{strncat} specifies the size of the source string as the bound. That
6388 is almost certainly a mistake and so the call is diagnosed.
6389 @smallexample
6390 void make_file (const char *name)
6391 @{
6392 char path[PATH_MAX];
6393 strncpy (path, name, sizeof path - 1);
6394 strncat (path, ".text", sizeof ".text");
6395 @dots{}
6396 @}
6397 @end smallexample
6398
6399 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6400
6401 @item -Wsizeof-array-argument
6402 @opindex Wsizeof-array-argument
6403 @opindex Wno-sizeof-array-argument
6404 Warn when the @code{sizeof} operator is applied to a parameter that is
6405 declared as an array in a function definition. This warning is enabled by
6406 default for C and C++ programs.
6407
6408 @item -Wmemset-elt-size
6409 @opindex Wmemset-elt-size
6410 @opindex Wno-memset-elt-size
6411 Warn for suspicious calls to the @code{memset} built-in function, if the
6412 first argument references an array, and the third argument is a number
6413 equal to the number of elements, but not equal to the size of the array
6414 in memory. This indicates that the user has omitted a multiplication by
6415 the element size. This warning is enabled by @option{-Wall}.
6416
6417 @item -Wmemset-transposed-args
6418 @opindex Wmemset-transposed-args
6419 @opindex Wno-memset-transposed-args
6420 Warn for suspicious calls to the @code{memset} built-in function, if the
6421 second argument is not zero and the third argument is zero. This warns e.g.@
6422 about @code{memset (buf, sizeof buf, 0)} where most probably
6423 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6424 is only emitted if the third argument is literal zero. If it is some
6425 expression that is folded to zero, a cast of zero to some type, etc.,
6426 it is far less likely that the user has mistakenly exchanged the arguments
6427 and no warning is emitted. This warning is enabled by @option{-Wall}.
6428
6429 @item -Waddress
6430 @opindex Waddress
6431 @opindex Wno-address
6432 Warn about suspicious uses of memory addresses. These include using
6433 the address of a function in a conditional expression, such as
6434 @code{void func(void); if (func)}, and comparisons against the memory
6435 address of a string literal, such as @code{if (x == "abc")}. Such
6436 uses typically indicate a programmer error: the address of a function
6437 always evaluates to true, so their use in a conditional usually
6438 indicate that the programmer forgot the parentheses in a function
6439 call; and comparisons against string literals result in unspecified
6440 behavior and are not portable in C, so they usually indicate that the
6441 programmer intended to use @code{strcmp}. This warning is enabled by
6442 @option{-Wall}.
6443
6444 @item -Wlogical-op
6445 @opindex Wlogical-op
6446 @opindex Wno-logical-op
6447 Warn about suspicious uses of logical operators in expressions.
6448 This includes using logical operators in contexts where a
6449 bit-wise operator is likely to be expected. Also warns when
6450 the operands of a logical operator are the same:
6451 @smallexample
6452 extern int a;
6453 if (a < 0 && a < 0) @{ @dots{} @}
6454 @end smallexample
6455
6456 @item -Wlogical-not-parentheses
6457 @opindex Wlogical-not-parentheses
6458 @opindex Wno-logical-not-parentheses
6459 Warn about logical not used on the left hand side operand of a comparison.
6460 This option does not warn if the right operand is considered to be a boolean
6461 expression. Its purpose is to detect suspicious code like the following:
6462 @smallexample
6463 int a;
6464 @dots{}
6465 if (!a > 1) @{ @dots{} @}
6466 @end smallexample
6467
6468 It is possible to suppress the warning by wrapping the LHS into
6469 parentheses:
6470 @smallexample
6471 if ((!a) > 1) @{ @dots{} @}
6472 @end smallexample
6473
6474 This warning is enabled by @option{-Wall}.
6475
6476 @item -Waggregate-return
6477 @opindex Waggregate-return
6478 @opindex Wno-aggregate-return
6479 Warn if any functions that return structures or unions are defined or
6480 called. (In languages where you can return an array, this also elicits
6481 a warning.)
6482
6483 @item -Wno-aggressive-loop-optimizations
6484 @opindex Wno-aggressive-loop-optimizations
6485 @opindex Waggressive-loop-optimizations
6486 Warn if in a loop with constant number of iterations the compiler detects
6487 undefined behavior in some statement during one or more of the iterations.
6488
6489 @item -Wno-attributes
6490 @opindex Wno-attributes
6491 @opindex Wattributes
6492 Do not warn if an unexpected @code{__attribute__} is used, such as
6493 unrecognized attributes, function attributes applied to variables,
6494 etc. This does not stop errors for incorrect use of supported
6495 attributes.
6496
6497 @item -Wno-builtin-declaration-mismatch
6498 @opindex Wno-builtin-declaration-mismatch
6499 @opindex Wbuiltin-declaration-mismatch
6500 Warn if a built-in function is declared with the wrong signature or
6501 as non-function.
6502 This warning is enabled by default.
6503
6504 @item -Wno-builtin-macro-redefined
6505 @opindex Wno-builtin-macro-redefined
6506 @opindex Wbuiltin-macro-redefined
6507 Do not warn if certain built-in macros are redefined. This suppresses
6508 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6509 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6510
6511 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6512 @opindex Wstrict-prototypes
6513 @opindex Wno-strict-prototypes
6514 Warn if a function is declared or defined without specifying the
6515 argument types. (An old-style function definition is permitted without
6516 a warning if preceded by a declaration that specifies the argument
6517 types.)
6518
6519 @item -Wold-style-declaration @r{(C and Objective-C only)}
6520 @opindex Wold-style-declaration
6521 @opindex Wno-old-style-declaration
6522 Warn for obsolescent usages, according to the C Standard, in a
6523 declaration. For example, warn if storage-class specifiers like
6524 @code{static} are not the first things in a declaration. This warning
6525 is also enabled by @option{-Wextra}.
6526
6527 @item -Wold-style-definition @r{(C and Objective-C only)}
6528 @opindex Wold-style-definition
6529 @opindex Wno-old-style-definition
6530 Warn if an old-style function definition is used. A warning is given
6531 even if there is a previous prototype.
6532
6533 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6534 @opindex Wmissing-parameter-type
6535 @opindex Wno-missing-parameter-type
6536 A function parameter is declared without a type specifier in K&R-style
6537 functions:
6538
6539 @smallexample
6540 void foo(bar) @{ @}
6541 @end smallexample
6542
6543 This warning is also enabled by @option{-Wextra}.
6544
6545 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6546 @opindex Wmissing-prototypes
6547 @opindex Wno-missing-prototypes
6548 Warn if a global function is defined without a previous prototype
6549 declaration. This warning is issued even if the definition itself
6550 provides a prototype. Use this option to detect global functions
6551 that do not have a matching prototype declaration in a header file.
6552 This option is not valid for C++ because all function declarations
6553 provide prototypes and a non-matching declaration declares an
6554 overload rather than conflict with an earlier declaration.
6555 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6556
6557 @item -Wmissing-declarations
6558 @opindex Wmissing-declarations
6559 @opindex Wno-missing-declarations
6560 Warn if a global function is defined without a previous declaration.
6561 Do so even if the definition itself provides a prototype.
6562 Use this option to detect global functions that are not declared in
6563 header files. In C, no warnings are issued for functions with previous
6564 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6565 missing prototypes. In C++, no warnings are issued for function templates,
6566 or for inline functions, or for functions in anonymous namespaces.
6567
6568 @item -Wmissing-field-initializers
6569 @opindex Wmissing-field-initializers
6570 @opindex Wno-missing-field-initializers
6571 @opindex W
6572 @opindex Wextra
6573 @opindex Wno-extra
6574 Warn if a structure's initializer has some fields missing. For
6575 example, the following code causes such a warning, because
6576 @code{x.h} is implicitly zero:
6577
6578 @smallexample
6579 struct s @{ int f, g, h; @};
6580 struct s x = @{ 3, 4 @};
6581 @end smallexample
6582
6583 This option does not warn about designated initializers, so the following
6584 modification does not trigger a warning:
6585
6586 @smallexample
6587 struct s @{ int f, g, h; @};
6588 struct s x = @{ .f = 3, .g = 4 @};
6589 @end smallexample
6590
6591 In C this option does not warn about the universal zero initializer
6592 @samp{@{ 0 @}}:
6593
6594 @smallexample
6595 struct s @{ int f, g, h; @};
6596 struct s x = @{ 0 @};
6597 @end smallexample
6598
6599 Likewise, in C++ this option does not warn about the empty @{ @}
6600 initializer, for example:
6601
6602 @smallexample
6603 struct s @{ int f, g, h; @};
6604 s x = @{ @};
6605 @end smallexample
6606
6607 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6608 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6609
6610 @item -Wno-multichar
6611 @opindex Wno-multichar
6612 @opindex Wmultichar
6613 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6614 Usually they indicate a typo in the user's code, as they have
6615 implementation-defined values, and should not be used in portable code.
6616
6617 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6618 @opindex Wnormalized=
6619 @opindex Wnormalized
6620 @opindex Wno-normalized
6621 @cindex NFC
6622 @cindex NFKC
6623 @cindex character set, input normalization
6624 In ISO C and ISO C++, two identifiers are different if they are
6625 different sequences of characters. However, sometimes when characters
6626 outside the basic ASCII character set are used, you can have two
6627 different character sequences that look the same. To avoid confusion,
6628 the ISO 10646 standard sets out some @dfn{normalization rules} which
6629 when applied ensure that two sequences that look the same are turned into
6630 the same sequence. GCC can warn you if you are using identifiers that
6631 have not been normalized; this option controls that warning.
6632
6633 There are four levels of warning supported by GCC@. The default is
6634 @option{-Wnormalized=nfc}, which warns about any identifier that is
6635 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6636 recommended form for most uses. It is equivalent to
6637 @option{-Wnormalized}.
6638
6639 Unfortunately, there are some characters allowed in identifiers by
6640 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6641 identifiers. That is, there's no way to use these symbols in portable
6642 ISO C or C++ and have all your identifiers in NFC@.
6643 @option{-Wnormalized=id} suppresses the warning for these characters.
6644 It is hoped that future versions of the standards involved will correct
6645 this, which is why this option is not the default.
6646
6647 You can switch the warning off for all characters by writing
6648 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6649 only do this if you are using some other normalization scheme (like
6650 ``D''), because otherwise you can easily create bugs that are
6651 literally impossible to see.
6652
6653 Some characters in ISO 10646 have distinct meanings but look identical
6654 in some fonts or display methodologies, especially once formatting has
6655 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6656 LETTER N'', displays just like a regular @code{n} that has been
6657 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6658 normalization scheme to convert all these into a standard form as
6659 well, and GCC warns if your code is not in NFKC if you use
6660 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6661 about every identifier that contains the letter O because it might be
6662 confused with the digit 0, and so is not the default, but may be
6663 useful as a local coding convention if the programming environment
6664 cannot be fixed to display these characters distinctly.
6665
6666 @item -Wno-deprecated
6667 @opindex Wno-deprecated
6668 @opindex Wdeprecated
6669 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6670
6671 @item -Wno-deprecated-declarations
6672 @opindex Wno-deprecated-declarations
6673 @opindex Wdeprecated-declarations
6674 Do not warn about uses of functions (@pxref{Function Attributes}),
6675 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6676 Attributes}) marked as deprecated by using the @code{deprecated}
6677 attribute.
6678
6679 @item -Wno-overflow
6680 @opindex Wno-overflow
6681 @opindex Woverflow
6682 Do not warn about compile-time overflow in constant expressions.
6683
6684 @item -Wno-odr
6685 @opindex Wno-odr
6686 @opindex Wodr
6687 Warn about One Definition Rule violations during link-time optimization.
6688 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6689
6690 @item -Wopenmp-simd
6691 @opindex Wopenm-simd
6692 Warn if the vectorizer cost model overrides the OpenMP
6693 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6694 option can be used to relax the cost model.
6695
6696 @item -Woverride-init @r{(C and Objective-C only)}
6697 @opindex Woverride-init
6698 @opindex Wno-override-init
6699 @opindex W
6700 @opindex Wextra
6701 @opindex Wno-extra
6702 Warn if an initialized field without side effects is overridden when
6703 using designated initializers (@pxref{Designated Inits, , Designated
6704 Initializers}).
6705
6706 This warning is included in @option{-Wextra}. To get other
6707 @option{-Wextra} warnings without this one, use @option{-Wextra
6708 -Wno-override-init}.
6709
6710 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6711 @opindex Woverride-init-side-effects
6712 @opindex Wno-override-init-side-effects
6713 Warn if an initialized field with side effects is overridden when
6714 using designated initializers (@pxref{Designated Inits, , Designated
6715 Initializers}). This warning is enabled by default.
6716
6717 @item -Wpacked
6718 @opindex Wpacked
6719 @opindex Wno-packed
6720 Warn if a structure is given the packed attribute, but the packed
6721 attribute has no effect on the layout or size of the structure.
6722 Such structures may be mis-aligned for little benefit. For
6723 instance, in this code, the variable @code{f.x} in @code{struct bar}
6724 is misaligned even though @code{struct bar} does not itself
6725 have the packed attribute:
6726
6727 @smallexample
6728 @group
6729 struct foo @{
6730 int x;
6731 char a, b, c, d;
6732 @} __attribute__((packed));
6733 struct bar @{
6734 char z;
6735 struct foo f;
6736 @};
6737 @end group
6738 @end smallexample
6739
6740 @item -Wpacked-bitfield-compat
6741 @opindex Wpacked-bitfield-compat
6742 @opindex Wno-packed-bitfield-compat
6743 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6744 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6745 the change can lead to differences in the structure layout. GCC
6746 informs you when the offset of such a field has changed in GCC 4.4.
6747 For example there is no longer a 4-bit padding between field @code{a}
6748 and @code{b} in this structure:
6749
6750 @smallexample
6751 struct foo
6752 @{
6753 char a:4;
6754 char b:8;
6755 @} __attribute__ ((packed));
6756 @end smallexample
6757
6758 This warning is enabled by default. Use
6759 @option{-Wno-packed-bitfield-compat} to disable this warning.
6760
6761 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6762 @opindex Wpacked-not-aligned
6763 @opindex Wno-packed-not-aligned
6764 Warn if a structure field with explicitly specified alignment in a
6765 packed struct or union is misaligned. For example, a warning will
6766 be issued on @code{struct S}, like, @code{warning: alignment 1 of
6767 'struct S' is less than 8}, in this code:
6768
6769 @smallexample
6770 @group
6771 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
6772 struct __attribute__ ((packed)) S @{
6773 struct S8 s8;
6774 @};
6775 @end group
6776 @end smallexample
6777
6778 This warning is enabled by @option{-Wall}.
6779
6780 @item -Wpadded
6781 @opindex Wpadded
6782 @opindex Wno-padded
6783 Warn if padding is included in a structure, either to align an element
6784 of the structure or to align the whole structure. Sometimes when this
6785 happens it is possible to rearrange the fields of the structure to
6786 reduce the padding and so make the structure smaller.
6787
6788 @item -Wredundant-decls
6789 @opindex Wredundant-decls
6790 @opindex Wno-redundant-decls
6791 Warn if anything is declared more than once in the same scope, even in
6792 cases where multiple declaration is valid and changes nothing.
6793
6794 @item -Wno-restrict
6795 @opindex Wrestrict
6796 @opindex Wno-restrict
6797 Warn when an object referenced by a @code{restrict}-qualified parameter
6798 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
6799 argument, or when copies between such objects overlap. For example,
6800 the call to the @code{strcpy} function below attempts to truncate the string
6801 by replacing its initial characters with the last four. However, because
6802 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
6803 the call is diagnosed.
6804
6805 @smallexample
6806 void foo (void)
6807 @{
6808 char a[] = "abcd1234";
6809 strcpy (a, a + 4);
6810 @dots{}
6811 @}
6812 @end smallexample
6813 The @option{-Wrestrict} option detects some instances of simple overlap
6814 even without optimization but works best at @option{-O2} and above. It
6815 is included in @option{-Wall}.
6816
6817 @item -Wnested-externs @r{(C and Objective-C only)}
6818 @opindex Wnested-externs
6819 @opindex Wno-nested-externs
6820 Warn if an @code{extern} declaration is encountered within a function.
6821
6822 @item -Wno-inherited-variadic-ctor
6823 @opindex Winherited-variadic-ctor
6824 @opindex Wno-inherited-variadic-ctor
6825 Suppress warnings about use of C++11 inheriting constructors when the
6826 base class inherited from has a C variadic constructor; the warning is
6827 on by default because the ellipsis is not inherited.
6828
6829 @item -Winline
6830 @opindex Winline
6831 @opindex Wno-inline
6832 Warn if a function that is declared as inline cannot be inlined.
6833 Even with this option, the compiler does not warn about failures to
6834 inline functions declared in system headers.
6835
6836 The compiler uses a variety of heuristics to determine whether or not
6837 to inline a function. For example, the compiler takes into account
6838 the size of the function being inlined and the amount of inlining
6839 that has already been done in the current function. Therefore,
6840 seemingly insignificant changes in the source program can cause the
6841 warnings produced by @option{-Winline} to appear or disappear.
6842
6843 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6844 @opindex Wno-invalid-offsetof
6845 @opindex Winvalid-offsetof
6846 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6847 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6848 to a non-standard-layout type is undefined. In existing C++ implementations,
6849 however, @code{offsetof} typically gives meaningful results.
6850 This flag is for users who are aware that they are
6851 writing nonportable code and who have deliberately chosen to ignore the
6852 warning about it.
6853
6854 The restrictions on @code{offsetof} may be relaxed in a future version
6855 of the C++ standard.
6856
6857 @item -Wint-in-bool-context
6858 @opindex Wint-in-bool-context
6859 @opindex Wno-int-in-bool-context
6860 Warn for suspicious use of integer values where boolean values are expected,
6861 such as conditional expressions (?:) using non-boolean integer constants in
6862 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6863 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6864 for all kinds of multiplications regardless of the data type.
6865 This warning is enabled by @option{-Wall}.
6866
6867 @item -Wno-int-to-pointer-cast
6868 @opindex Wno-int-to-pointer-cast
6869 @opindex Wint-to-pointer-cast
6870 Suppress warnings from casts to pointer type of an integer of a
6871 different size. In C++, casting to a pointer type of smaller size is
6872 an error. @option{Wint-to-pointer-cast} is enabled by default.
6873
6874
6875 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6876 @opindex Wno-pointer-to-int-cast
6877 @opindex Wpointer-to-int-cast
6878 Suppress warnings from casts from a pointer to an integer type of a
6879 different size.
6880
6881 @item -Winvalid-pch
6882 @opindex Winvalid-pch
6883 @opindex Wno-invalid-pch
6884 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6885 the search path but cannot be used.
6886
6887 @item -Wlong-long
6888 @opindex Wlong-long
6889 @opindex Wno-long-long
6890 Warn if @code{long long} type is used. This is enabled by either
6891 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6892 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6893
6894 @item -Wvariadic-macros
6895 @opindex Wvariadic-macros
6896 @opindex Wno-variadic-macros
6897 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6898 alternate syntax is used in ISO C99 mode. This is enabled by either
6899 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6900 messages, use @option{-Wno-variadic-macros}.
6901
6902 @item -Wvarargs
6903 @opindex Wvarargs
6904 @opindex Wno-varargs
6905 Warn upon questionable usage of the macros used to handle variable
6906 arguments like @code{va_start}. This is default. To inhibit the
6907 warning messages, use @option{-Wno-varargs}.
6908
6909 @item -Wvector-operation-performance
6910 @opindex Wvector-operation-performance
6911 @opindex Wno-vector-operation-performance
6912 Warn if vector operation is not implemented via SIMD capabilities of the
6913 architecture. Mainly useful for the performance tuning.
6914 Vector operation can be implemented @code{piecewise}, which means that the
6915 scalar operation is performed on every vector element;
6916 @code{in parallel}, which means that the vector operation is implemented
6917 using scalars of wider type, which normally is more performance efficient;
6918 and @code{as a single scalar}, which means that vector fits into a
6919 scalar type.
6920
6921 @item -Wno-virtual-move-assign
6922 @opindex Wvirtual-move-assign
6923 @opindex Wno-virtual-move-assign
6924 Suppress warnings about inheriting from a virtual base with a
6925 non-trivial C++11 move assignment operator. This is dangerous because
6926 if the virtual base is reachable along more than one path, it is
6927 moved multiple times, which can mean both objects end up in the
6928 moved-from state. If the move assignment operator is written to avoid
6929 moving from a moved-from object, this warning can be disabled.
6930
6931 @item -Wvla
6932 @opindex Wvla
6933 @opindex Wno-vla
6934 Warn if a variable-length array is used in the code.
6935 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6936 the variable-length array.
6937
6938 @item -Wvla-larger-than=@var{n}
6939 If this option is used, the compiler will warn on uses of
6940 variable-length arrays where the size is either unbounded, or bounded
6941 by an argument that can be larger than @var{n} bytes. This is similar
6942 to how @option{-Walloca-larger-than=@var{n}} works, but with
6943 variable-length arrays.
6944
6945 Note that GCC may optimize small variable-length arrays of a known
6946 value into plain arrays, so this warning may not get triggered for
6947 such arrays.
6948
6949 This warning is not enabled by @option{-Wall}, and is only active when
6950 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6951
6952 See also @option{-Walloca-larger-than=@var{n}}.
6953
6954 @item -Wvolatile-register-var
6955 @opindex Wvolatile-register-var
6956 @opindex Wno-volatile-register-var
6957 Warn if a register variable is declared volatile. The volatile
6958 modifier does not inhibit all optimizations that may eliminate reads
6959 and/or writes to register variables. This warning is enabled by
6960 @option{-Wall}.
6961
6962 @item -Wdisabled-optimization
6963 @opindex Wdisabled-optimization
6964 @opindex Wno-disabled-optimization
6965 Warn if a requested optimization pass is disabled. This warning does
6966 not generally indicate that there is anything wrong with your code; it
6967 merely indicates that GCC's optimizers are unable to handle the code
6968 effectively. Often, the problem is that your code is too big or too
6969 complex; GCC refuses to optimize programs when the optimization
6970 itself is likely to take inordinate amounts of time.
6971
6972 @item -Wpointer-sign @r{(C and Objective-C only)}
6973 @opindex Wpointer-sign
6974 @opindex Wno-pointer-sign
6975 Warn for pointer argument passing or assignment with different signedness.
6976 This option is only supported for C and Objective-C@. It is implied by
6977 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6978 @option{-Wno-pointer-sign}.
6979
6980 @item -Wstack-protector
6981 @opindex Wstack-protector
6982 @opindex Wno-stack-protector
6983 This option is only active when @option{-fstack-protector} is active. It
6984 warns about functions that are not protected against stack smashing.
6985
6986 @item -Woverlength-strings
6987 @opindex Woverlength-strings
6988 @opindex Wno-overlength-strings
6989 Warn about string constants that are longer than the ``minimum
6990 maximum'' length specified in the C standard. Modern compilers
6991 generally allow string constants that are much longer than the
6992 standard's minimum limit, but very portable programs should avoid
6993 using longer strings.
6994
6995 The limit applies @emph{after} string constant concatenation, and does
6996 not count the trailing NUL@. In C90, the limit was 509 characters; in
6997 C99, it was raised to 4095. C++98 does not specify a normative
6998 minimum maximum, so we do not diagnose overlength strings in C++@.
6999
7000 This option is implied by @option{-Wpedantic}, and can be disabled with
7001 @option{-Wno-overlength-strings}.
7002
7003 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7004 @opindex Wunsuffixed-float-constants
7005
7006 Issue a warning for any floating constant that does not have
7007 a suffix. When used together with @option{-Wsystem-headers} it
7008 warns about such constants in system header files. This can be useful
7009 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7010 from the decimal floating-point extension to C99.
7011
7012 @item -Wno-designated-init @r{(C and Objective-C only)}
7013 Suppress warnings when a positional initializer is used to initialize
7014 a structure that has been marked with the @code{designated_init}
7015 attribute.
7016
7017 @item -Whsa
7018 Issue a warning when HSAIL cannot be emitted for the compiled function or
7019 OpenMP construct.
7020
7021 @end table
7022
7023 @node Debugging Options
7024 @section Options for Debugging Your Program
7025 @cindex options, debugging
7026 @cindex debugging information options
7027
7028 To tell GCC to emit extra information for use by a debugger, in almost
7029 all cases you need only to add @option{-g} to your other options.
7030
7031 GCC allows you to use @option{-g} with
7032 @option{-O}. The shortcuts taken by optimized code may occasionally
7033 be surprising: some variables you declared may not exist
7034 at all; flow of control may briefly move where you did not expect it;
7035 some statements may not be executed because they compute constant
7036 results or their values are already at hand; some statements may
7037 execute in different places because they have been moved out of loops.
7038 Nevertheless it is possible to debug optimized output. This makes
7039 it reasonable to use the optimizer for programs that might have bugs.
7040
7041 If you are not using some other optimization option, consider
7042 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7043 With no @option{-O} option at all, some compiler passes that collect
7044 information useful for debugging do not run at all, so that
7045 @option{-Og} may result in a better debugging experience.
7046
7047 @table @gcctabopt
7048 @item -g
7049 @opindex g
7050 Produce debugging information in the operating system's native format
7051 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7052 information.
7053
7054 On most systems that use stabs format, @option{-g} enables use of extra
7055 debugging information that only GDB can use; this extra information
7056 makes debugging work better in GDB but probably makes other debuggers
7057 crash or
7058 refuse to read the program. If you want to control for certain whether
7059 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7060 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7061
7062 @item -ggdb
7063 @opindex ggdb
7064 Produce debugging information for use by GDB@. This means to use the
7065 most expressive format available (DWARF, stabs, or the native format
7066 if neither of those are supported), including GDB extensions if at all
7067 possible.
7068
7069 @item -gdwarf
7070 @itemx -gdwarf-@var{version}
7071 @opindex gdwarf
7072 Produce debugging information in DWARF format (if that is supported).
7073 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7074 for most targets is 4. DWARF Version 5 is only experimental.
7075
7076 Note that with DWARF Version 2, some ports require and always
7077 use some non-conflicting DWARF 3 extensions in the unwind tables.
7078
7079 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7080 for maximum benefit.
7081
7082 GCC no longer supports DWARF Version 1, which is substantially
7083 different than Version 2 and later. For historical reasons, some
7084 other DWARF-related options such as
7085 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7086 in their names, but apply to all currently-supported versions of DWARF.
7087
7088 @item -gstabs
7089 @opindex gstabs
7090 Produce debugging information in stabs format (if that is supported),
7091 without GDB extensions. This is the format used by DBX on most BSD
7092 systems. On MIPS, Alpha and System V Release 4 systems this option
7093 produces stabs debugging output that is not understood by DBX@.
7094 On System V Release 4 systems this option requires the GNU assembler.
7095
7096 @item -gstabs+
7097 @opindex gstabs+
7098 Produce debugging information in stabs format (if that is supported),
7099 using GNU extensions understood only by the GNU debugger (GDB)@. The
7100 use of these extensions is likely to make other debuggers crash or
7101 refuse to read the program.
7102
7103 @item -gxcoff
7104 @opindex gxcoff
7105 Produce debugging information in XCOFF format (if that is supported).
7106 This is the format used by the DBX debugger on IBM RS/6000 systems.
7107
7108 @item -gxcoff+
7109 @opindex gxcoff+
7110 Produce debugging information in XCOFF format (if that is supported),
7111 using GNU extensions understood only by the GNU debugger (GDB)@. The
7112 use of these extensions is likely to make other debuggers crash or
7113 refuse to read the program, and may cause assemblers other than the GNU
7114 assembler (GAS) to fail with an error.
7115
7116 @item -gvms
7117 @opindex gvms
7118 Produce debugging information in Alpha/VMS debug format (if that is
7119 supported). This is the format used by DEBUG on Alpha/VMS systems.
7120
7121 @item -g@var{level}
7122 @itemx -ggdb@var{level}
7123 @itemx -gstabs@var{level}
7124 @itemx -gxcoff@var{level}
7125 @itemx -gvms@var{level}
7126 Request debugging information and also use @var{level} to specify how
7127 much information. The default level is 2.
7128
7129 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7130 @option{-g}.
7131
7132 Level 1 produces minimal information, enough for making backtraces in
7133 parts of the program that you don't plan to debug. This includes
7134 descriptions of functions and external variables, and line number
7135 tables, but no information about local variables.
7136
7137 Level 3 includes extra information, such as all the macro definitions
7138 present in the program. Some debuggers support macro expansion when
7139 you use @option{-g3}.
7140
7141 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7142 confusion with @option{-gdwarf-@var{level}}.
7143 Instead use an additional @option{-g@var{level}} option to change the
7144 debug level for DWARF.
7145
7146 @item -feliminate-unused-debug-symbols
7147 @opindex feliminate-unused-debug-symbols
7148 Produce debugging information in stabs format (if that is supported),
7149 for only symbols that are actually used.
7150
7151 @item -femit-class-debug-always
7152 @opindex femit-class-debug-always
7153 Instead of emitting debugging information for a C++ class in only one
7154 object file, emit it in all object files using the class. This option
7155 should be used only with debuggers that are unable to handle the way GCC
7156 normally emits debugging information for classes because using this
7157 option increases the size of debugging information by as much as a
7158 factor of two.
7159
7160 @item -fno-merge-debug-strings
7161 @opindex fmerge-debug-strings
7162 @opindex fno-merge-debug-strings
7163 Direct the linker to not merge together strings in the debugging
7164 information that are identical in different object files. Merging is
7165 not supported by all assemblers or linkers. Merging decreases the size
7166 of the debug information in the output file at the cost of increasing
7167 link processing time. Merging is enabled by default.
7168
7169 @item -fdebug-prefix-map=@var{old}=@var{new}
7170 @opindex fdebug-prefix-map
7171 When compiling files residing in directory @file{@var{old}}, record
7172 debugging information describing them as if the files resided in
7173 directory @file{@var{new}} instead. This can be used to replace a
7174 build-time path with an install-time path in the debug info. It can
7175 also be used to change an absolute path to a relative path by using
7176 @file{.} for @var{new}. This can give more reproducible builds, which
7177 are location independent, but may require an extra command to tell GDB
7178 where to find the source files. See also @option{-ffile-prefix-map}.
7179
7180 @item -fvar-tracking
7181 @opindex fvar-tracking
7182 Run variable tracking pass. It computes where variables are stored at each
7183 position in code. Better debugging information is then generated
7184 (if the debugging information format supports this information).
7185
7186 It is enabled by default when compiling with optimization (@option{-Os},
7187 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7188 the debug info format supports it.
7189
7190 @item -fvar-tracking-assignments
7191 @opindex fvar-tracking-assignments
7192 @opindex fno-var-tracking-assignments
7193 Annotate assignments to user variables early in the compilation and
7194 attempt to carry the annotations over throughout the compilation all the
7195 way to the end, in an attempt to improve debug information while
7196 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7197
7198 It can be enabled even if var-tracking is disabled, in which case
7199 annotations are created and maintained, but discarded at the end.
7200 By default, this flag is enabled together with @option{-fvar-tracking},
7201 except when selective scheduling is enabled.
7202
7203 @item -gsplit-dwarf
7204 @opindex gsplit-dwarf
7205 Separate as much DWARF debugging information as possible into a
7206 separate output file with the extension @file{.dwo}. This option allows
7207 the build system to avoid linking files with debug information. To
7208 be useful, this option requires a debugger capable of reading @file{.dwo}
7209 files.
7210
7211 @item -gpubnames
7212 @opindex gpubnames
7213 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7214
7215 @item -ggnu-pubnames
7216 @opindex ggnu-pubnames
7217 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7218 suitable for conversion into a GDB@ index. This option is only useful
7219 with a linker that can produce GDB@ index version 7.
7220
7221 @item -fdebug-types-section
7222 @opindex fdebug-types-section
7223 @opindex fno-debug-types-section
7224 When using DWARF Version 4 or higher, type DIEs can be put into
7225 their own @code{.debug_types} section instead of making them part of the
7226 @code{.debug_info} section. It is more efficient to put them in a separate
7227 comdat section since the linker can then remove duplicates.
7228 But not all DWARF consumers support @code{.debug_types} sections yet
7229 and on some objects @code{.debug_types} produces larger instead of smaller
7230 debugging information.
7231
7232 @item -grecord-gcc-switches
7233 @itemx -gno-record-gcc-switches
7234 @opindex grecord-gcc-switches
7235 @opindex gno-record-gcc-switches
7236 This switch causes the command-line options used to invoke the
7237 compiler that may affect code generation to be appended to the
7238 DW_AT_producer attribute in DWARF debugging information. The options
7239 are concatenated with spaces separating them from each other and from
7240 the compiler version.
7241 It is enabled by default.
7242 See also @option{-frecord-gcc-switches} for another
7243 way of storing compiler options into the object file.
7244
7245 @item -gstrict-dwarf
7246 @opindex gstrict-dwarf
7247 Disallow using extensions of later DWARF standard version than selected
7248 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7249 DWARF extensions from later standard versions is allowed.
7250
7251 @item -gno-strict-dwarf
7252 @opindex gno-strict-dwarf
7253 Allow using extensions of later DWARF standard version than selected with
7254 @option{-gdwarf-@var{version}}.
7255
7256 @item -gas-loc-support
7257 @opindex gas-loc-support
7258 Inform the compiler that the assembler supports @code{.loc} directives.
7259 It may then use them for the assembler to generate DWARF2+ line number
7260 tables.
7261
7262 This is generally desirable, because assembler-generated line-number
7263 tables are a lot more compact than those the compiler can generate
7264 itself.
7265
7266 This option will be enabled by default if, at GCC configure time, the
7267 assembler was found to support such directives.
7268
7269 @item -gno-as-loc-support
7270 @opindex gno-as-loc-support
7271 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7272 line number tables are to be generated.
7273
7274 @item gas-locview-support
7275 @opindex gas-locview-support
7276 Inform the compiler that the assembler supports @code{view} assignment
7277 and reset assertion checking in @code{.loc} directives.
7278
7279 This option will be enabled by default if, at GCC configure time, the
7280 assembler was found to support them.
7281
7282 @item gno-as-locview-support
7283 Force GCC to assign view numbers internally, if
7284 @option{-gvariable-location-views} are explicitly requested.
7285
7286 @item -gcolumn-info
7287 @itemx -gno-column-info
7288 @opindex gcolumn-info
7289 @opindex gno-column-info
7290 Emit location column information into DWARF debugging information, rather
7291 than just file and line.
7292 This option is enabled by default.
7293
7294 @item -gstatement-frontiers
7295 @itemx -gno-statement-frontiers
7296 @opindex gstatement-frontiers
7297 @opindex gno-statement-frontiers
7298 This option causes GCC to create markers in the internal representation
7299 at the beginning of statements, and to keep them roughly in place
7300 throughout compilation, using them to guide the output of @code{is_stmt}
7301 markers in the line number table. This is enabled by default when
7302 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7303 @dots{}), and outputting DWARF 2 debug information at the normal level.
7304
7305 @item -gvariable-location-views
7306 @itemx -gvariable-location-views=incompat5
7307 @itemx -gno-variable-location-views
7308 @opindex gvariable-location-views
7309 @opindex gvariable-location-views=incompat5
7310 @opindex gno-variable-location-views
7311 Augment variable location lists with progressive view numbers implied
7312 from the line number table. This enables debug information consumers to
7313 inspect state at certain points of the program, even if no instructions
7314 associated with the corresponding source locations are present at that
7315 point. If the assembler lacks support for view numbers in line number
7316 tables, this will cause the compiler to emit the line number table,
7317 which generally makes them somewhat less compact. The augmented line
7318 number tables and location lists are fully backward-compatible, so they
7319 can be consumed by debug information consumers that are not aware of
7320 these augmentations, but they won't derive any benefit from them either.
7321
7322 This is enabled by default when outputting DWARF 2 debug information at
7323 the normal level, as long as there is assembler support,
7324 @option{-fvar-tracking-assignments} is enabled and
7325 @option{-gstrict-dwarf} is not. When assembler support is not
7326 available, this may still be enabled, but it will force GCC to output
7327 internal line number tables, and if
7328 @option{-ginternal-reset-location-views} is not enabled, that will most
7329 certainly lead to silently mismatching location views.
7330
7331 There is a proposed representation for view numbers that is not backward
7332 compatible with the location list format introduced in DWARF 5, that can
7333 be enabled with @option{-gvariable-location-views=incompat5}. This
7334 option may be removed in the future, is only provided as a reference
7335 implementation of the proposed representation. Debug information
7336 consumers are not expected to support this extended format, and they
7337 would be rendered unable to decode location lists using it.
7338
7339 @item -ginternal-reset-location-views
7340 @itemx -gnointernal-reset-location-views
7341 @opindex ginternal-reset-location-views
7342 @opindex gno-internal-reset-location-views
7343 Attempt to determine location views that can be omitted from location
7344 view lists. This requires the compiler to have very accurate insn
7345 length estimates, which isn't always the case, and it may cause
7346 incorrect view lists to be generated silently when using an assembler
7347 that does not support location view lists. The GNU assembler will flag
7348 any such error as a @code{view number mismatch}. This is only enabled
7349 on ports that define a reliable estimation function.
7350
7351 @item -ginline-points
7352 @itemx -gno-inline-points
7353 @opindex ginline-points
7354 @opindex gno-inline-points
7355 Generate extended debug information for inlined functions. Location
7356 view tracking markers are inserted at inlined entry points, so that
7357 address and view numbers can be computed and output in debug
7358 information. This can be enabled independently of location views, in
7359 which case the view numbers won't be output, but it can only be enabled
7360 along with statement frontiers, and it is only enabled by default if
7361 location views are enabled.
7362
7363 @item -gz@r{[}=@var{type}@r{]}
7364 @opindex gz
7365 Produce compressed debug sections in DWARF format, if that is supported.
7366 If @var{type} is not given, the default type depends on the capabilities
7367 of the assembler and linker used. @var{type} may be one of
7368 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7369 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7370 compression in traditional GNU format). If the linker doesn't support
7371 writing compressed debug sections, the option is rejected. Otherwise,
7372 if the assembler does not support them, @option{-gz} is silently ignored
7373 when producing object files.
7374
7375 @item -femit-struct-debug-baseonly
7376 @opindex femit-struct-debug-baseonly
7377 Emit debug information for struct-like types
7378 only when the base name of the compilation source file
7379 matches the base name of file in which the struct is defined.
7380
7381 This option substantially reduces the size of debugging information,
7382 but at significant potential loss in type information to the debugger.
7383 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7384 See @option{-femit-struct-debug-detailed} for more detailed control.
7385
7386 This option works only with DWARF debug output.
7387
7388 @item -femit-struct-debug-reduced
7389 @opindex femit-struct-debug-reduced
7390 Emit debug information for struct-like types
7391 only when the base name of the compilation source file
7392 matches the base name of file in which the type is defined,
7393 unless the struct is a template or defined in a system header.
7394
7395 This option significantly reduces the size of debugging information,
7396 with some potential loss in type information to the debugger.
7397 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7398 See @option{-femit-struct-debug-detailed} for more detailed control.
7399
7400 This option works only with DWARF debug output.
7401
7402 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7403 @opindex femit-struct-debug-detailed
7404 Specify the struct-like types
7405 for which the compiler generates debug information.
7406 The intent is to reduce duplicate struct debug information
7407 between different object files within the same program.
7408
7409 This option is a detailed version of
7410 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7411 which serves for most needs.
7412
7413 A specification has the syntax@*
7414 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7415
7416 The optional first word limits the specification to
7417 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7418 A struct type is used directly when it is the type of a variable, member.
7419 Indirect uses arise through pointers to structs.
7420 That is, when use of an incomplete struct is valid, the use is indirect.
7421 An example is
7422 @samp{struct one direct; struct two * indirect;}.
7423
7424 The optional second word limits the specification to
7425 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7426 Generic structs are a bit complicated to explain.
7427 For C++, these are non-explicit specializations of template classes,
7428 or non-template classes within the above.
7429 Other programming languages have generics,
7430 but @option{-femit-struct-debug-detailed} does not yet implement them.
7431
7432 The third word specifies the source files for those
7433 structs for which the compiler should emit debug information.
7434 The values @samp{none} and @samp{any} have the normal meaning.
7435 The value @samp{base} means that
7436 the base of name of the file in which the type declaration appears
7437 must match the base of the name of the main compilation file.
7438 In practice, this means that when compiling @file{foo.c}, debug information
7439 is generated for types declared in that file and @file{foo.h},
7440 but not other header files.
7441 The value @samp{sys} means those types satisfying @samp{base}
7442 or declared in system or compiler headers.
7443
7444 You may need to experiment to determine the best settings for your application.
7445
7446 The default is @option{-femit-struct-debug-detailed=all}.
7447
7448 This option works only with DWARF debug output.
7449
7450 @item -fno-dwarf2-cfi-asm
7451 @opindex fdwarf2-cfi-asm
7452 @opindex fno-dwarf2-cfi-asm
7453 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7454 instead of using GAS @code{.cfi_*} directives.
7455
7456 @item -fno-eliminate-unused-debug-types
7457 @opindex feliminate-unused-debug-types
7458 @opindex fno-eliminate-unused-debug-types
7459 Normally, when producing DWARF output, GCC avoids producing debug symbol
7460 output for types that are nowhere used in the source file being compiled.
7461 Sometimes it is useful to have GCC emit debugging
7462 information for all types declared in a compilation
7463 unit, regardless of whether or not they are actually used
7464 in that compilation unit, for example
7465 if, in the debugger, you want to cast a value to a type that is
7466 not actually used in your program (but is declared). More often,
7467 however, this results in a significant amount of wasted space.
7468 @end table
7469
7470 @node Optimize Options
7471 @section Options That Control Optimization
7472 @cindex optimize options
7473 @cindex options, optimization
7474
7475 These options control various sorts of optimizations.
7476
7477 Without any optimization option, the compiler's goal is to reduce the
7478 cost of compilation and to make debugging produce the expected
7479 results. Statements are independent: if you stop the program with a
7480 breakpoint between statements, you can then assign a new value to any
7481 variable or change the program counter to any other statement in the
7482 function and get exactly the results you expect from the source
7483 code.
7484
7485 Turning on optimization flags makes the compiler attempt to improve
7486 the performance and/or code size at the expense of compilation time
7487 and possibly the ability to debug the program.
7488
7489 The compiler performs optimization based on the knowledge it has of the
7490 program. Compiling multiple files at once to a single output file mode allows
7491 the compiler to use information gained from all of the files when compiling
7492 each of them.
7493
7494 Not all optimizations are controlled directly by a flag. Only
7495 optimizations that have a flag are listed in this section.
7496
7497 Most optimizations are only enabled if an @option{-O} level is set on
7498 the command line. Otherwise they are disabled, even if individual
7499 optimization flags are specified.
7500
7501 Depending on the target and how GCC was configured, a slightly different
7502 set of optimizations may be enabled at each @option{-O} level than
7503 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7504 to find out the exact set of optimizations that are enabled at each level.
7505 @xref{Overall Options}, for examples.
7506
7507 @table @gcctabopt
7508 @item -O
7509 @itemx -O1
7510 @opindex O
7511 @opindex O1
7512 Optimize. Optimizing compilation takes somewhat more time, and a lot
7513 more memory for a large function.
7514
7515 With @option{-O}, the compiler tries to reduce code size and execution
7516 time, without performing any optimizations that take a great deal of
7517 compilation time.
7518
7519 @option{-O} turns on the following optimization flags:
7520 @gccoptlist{
7521 -fauto-inc-dec @gol
7522 -fbranch-count-reg @gol
7523 -fcombine-stack-adjustments @gol
7524 -fcompare-elim @gol
7525 -fcprop-registers @gol
7526 -fdce @gol
7527 -fdefer-pop @gol
7528 -fdelayed-branch @gol
7529 -fdse @gol
7530 -fforward-propagate @gol
7531 -fguess-branch-probability @gol
7532 -fif-conversion2 @gol
7533 -fif-conversion @gol
7534 -finline-functions-called-once @gol
7535 -fipa-pure-const @gol
7536 -fipa-profile @gol
7537 -fipa-reference @gol
7538 -fmerge-constants @gol
7539 -fmove-loop-invariants @gol
7540 -fomit-frame-pointer @gol
7541 -freorder-blocks @gol
7542 -fshrink-wrap @gol
7543 -fshrink-wrap-separate @gol
7544 -fsplit-wide-types @gol
7545 -fssa-backprop @gol
7546 -fssa-phiopt @gol
7547 -ftree-bit-ccp @gol
7548 -ftree-ccp @gol
7549 -ftree-ch @gol
7550 -ftree-coalesce-vars @gol
7551 -ftree-copy-prop @gol
7552 -ftree-dce @gol
7553 -ftree-dominator-opts @gol
7554 -ftree-dse @gol
7555 -ftree-forwprop @gol
7556 -ftree-fre @gol
7557 -ftree-phiprop @gol
7558 -ftree-sink @gol
7559 -ftree-slsr @gol
7560 -ftree-sra @gol
7561 -ftree-pta @gol
7562 -ftree-ter @gol
7563 -funit-at-a-time}
7564
7565 @item -O2
7566 @opindex O2
7567 Optimize even more. GCC performs nearly all supported optimizations
7568 that do not involve a space-speed tradeoff.
7569 As compared to @option{-O}, this option increases both compilation time
7570 and the performance of the generated code.
7571
7572 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7573 also turns on the following optimization flags:
7574 @gccoptlist{-fthread-jumps @gol
7575 -falign-functions -falign-jumps @gol
7576 -falign-loops -falign-labels @gol
7577 -fcaller-saves @gol
7578 -fcrossjumping @gol
7579 -fcse-follow-jumps -fcse-skip-blocks @gol
7580 -fdelete-null-pointer-checks @gol
7581 -fdevirtualize -fdevirtualize-speculatively @gol
7582 -fexpensive-optimizations @gol
7583 -fgcse -fgcse-lm @gol
7584 -fhoist-adjacent-loads @gol
7585 -finline-small-functions @gol
7586 -findirect-inlining @gol
7587 -fipa-cp @gol
7588 -fipa-bit-cp @gol
7589 -fipa-vrp @gol
7590 -fipa-sra @gol
7591 -fipa-icf @gol
7592 -fisolate-erroneous-paths-dereference @gol
7593 -flra-remat @gol
7594 -foptimize-sibling-calls @gol
7595 -foptimize-strlen @gol
7596 -fpartial-inlining @gol
7597 -fpeephole2 @gol
7598 -freorder-blocks-algorithm=stc @gol
7599 -freorder-blocks-and-partition -freorder-functions @gol
7600 -frerun-cse-after-loop @gol
7601 -fsched-interblock -fsched-spec @gol
7602 -fschedule-insns -fschedule-insns2 @gol
7603 -fstore-merging @gol
7604 -fstrict-aliasing @gol
7605 -ftree-builtin-call-dce @gol
7606 -ftree-switch-conversion -ftree-tail-merge @gol
7607 -fcode-hoisting @gol
7608 -ftree-pre @gol
7609 -ftree-vrp @gol
7610 -fipa-ra}
7611
7612 Please note the warning under @option{-fgcse} about
7613 invoking @option{-O2} on programs that use computed gotos.
7614
7615 @item -O3
7616 @opindex O3
7617 Optimize yet more. @option{-O3} turns on all optimizations specified
7618 by @option{-O2} and also turns on the following optimization flags:
7619 @gccoptlist{-finline-functions @gol
7620 -funswitch-loops @gol
7621 -fpredictive-commoning @gol
7622 -fgcse-after-reload @gol
7623 -ftree-loop-vectorize @gol
7624 -ftree-loop-distribution @gol
7625 -ftree-loop-distribute-patterns @gol
7626 -floop-interchange @gol
7627 -floop-unroll-and-jam @gol
7628 -fsplit-paths @gol
7629 -ftree-slp-vectorize @gol
7630 -fvect-cost-model @gol
7631 -ftree-partial-pre @gol
7632 -fpeel-loops @gol
7633 -fipa-cp-clone}
7634
7635 @item -O0
7636 @opindex O0
7637 Reduce compilation time and make debugging produce the expected
7638 results. This is the default.
7639
7640 @item -Os
7641 @opindex Os
7642 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7643 do not typically increase code size. It also performs further
7644 optimizations designed to reduce code size.
7645
7646 @option{-Os} disables the following optimization flags:
7647 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7648 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7649 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7650
7651 @item -Ofast
7652 @opindex Ofast
7653 Disregard strict standards compliance. @option{-Ofast} enables all
7654 @option{-O3} optimizations. It also enables optimizations that are not
7655 valid for all standard-compliant programs.
7656 It turns on @option{-ffast-math} and the Fortran-specific
7657 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7658 specified, and @option{-fno-protect-parens}.
7659
7660 @item -Og
7661 @opindex Og
7662 Optimize debugging experience. @option{-Og} enables optimizations
7663 that do not interfere with debugging. It should be the optimization
7664 level of choice for the standard edit-compile-debug cycle, offering
7665 a reasonable level of optimization while maintaining fast compilation
7666 and a good debugging experience.
7667 @end table
7668
7669 If you use multiple @option{-O} options, with or without level numbers,
7670 the last such option is the one that is effective.
7671
7672 Options of the form @option{-f@var{flag}} specify machine-independent
7673 flags. Most flags have both positive and negative forms; the negative
7674 form of @option{-ffoo} is @option{-fno-foo}. In the table
7675 below, only one of the forms is listed---the one you typically
7676 use. You can figure out the other form by either removing @samp{no-}
7677 or adding it.
7678
7679 The following options control specific optimizations. They are either
7680 activated by @option{-O} options or are related to ones that are. You
7681 can use the following flags in the rare cases when ``fine-tuning'' of
7682 optimizations to be performed is desired.
7683
7684 @table @gcctabopt
7685 @item -fno-defer-pop
7686 @opindex fno-defer-pop
7687 Always pop the arguments to each function call as soon as that function
7688 returns. For machines that must pop arguments after a function call,
7689 the compiler normally lets arguments accumulate on the stack for several
7690 function calls and pops them all at once.
7691
7692 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7693
7694 @item -fforward-propagate
7695 @opindex fforward-propagate
7696 Perform a forward propagation pass on RTL@. The pass tries to combine two
7697 instructions and checks if the result can be simplified. If loop unrolling
7698 is active, two passes are performed and the second is scheduled after
7699 loop unrolling.
7700
7701 This option is enabled by default at optimization levels @option{-O},
7702 @option{-O2}, @option{-O3}, @option{-Os}.
7703
7704 @item -ffp-contract=@var{style}
7705 @opindex ffp-contract
7706 @option{-ffp-contract=off} disables floating-point expression contraction.
7707 @option{-ffp-contract=fast} enables floating-point expression contraction
7708 such as forming of fused multiply-add operations if the target has
7709 native support for them.
7710 @option{-ffp-contract=on} enables floating-point expression contraction
7711 if allowed by the language standard. This is currently not implemented
7712 and treated equal to @option{-ffp-contract=off}.
7713
7714 The default is @option{-ffp-contract=fast}.
7715
7716 @item -fomit-frame-pointer
7717 @opindex fomit-frame-pointer
7718 Omit the frame pointer in functions that don't need one. This avoids the
7719 instructions to save, set up and restore the frame pointer; on many targets
7720 it also makes an extra register available.
7721
7722 On some targets this flag has no effect because the standard calling sequence
7723 always uses a frame pointer, so it cannot be omitted.
7724
7725 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
7726 is used in all functions. Several targets always omit the frame pointer in
7727 leaf functions.
7728
7729 Enabled by default at @option{-O} and higher.
7730
7731 @item -foptimize-sibling-calls
7732 @opindex foptimize-sibling-calls
7733 Optimize sibling and tail recursive calls.
7734
7735 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7736
7737 @item -foptimize-strlen
7738 @opindex foptimize-strlen
7739 Optimize various standard C string functions (e.g. @code{strlen},
7740 @code{strchr} or @code{strcpy}) and
7741 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7742
7743 Enabled at levels @option{-O2}, @option{-O3}.
7744
7745 @item -fno-inline
7746 @opindex fno-inline
7747 Do not expand any functions inline apart from those marked with
7748 the @code{always_inline} attribute. This is the default when not
7749 optimizing.
7750
7751 Single functions can be exempted from inlining by marking them
7752 with the @code{noinline} attribute.
7753
7754 @item -finline-small-functions
7755 @opindex finline-small-functions
7756 Integrate functions into their callers when their body is smaller than expected
7757 function call code (so overall size of program gets smaller). The compiler
7758 heuristically decides which functions are simple enough to be worth integrating
7759 in this way. This inlining applies to all functions, even those not declared
7760 inline.
7761
7762 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7763
7764 @item -findirect-inlining
7765 @opindex findirect-inlining
7766 Inline also indirect calls that are discovered to be known at compile
7767 time thanks to previous inlining. This option has any effect only
7768 when inlining itself is turned on by the @option{-finline-functions}
7769 or @option{-finline-small-functions} options.
7770
7771 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7772
7773 @item -finline-functions
7774 @opindex finline-functions
7775 Consider all functions for inlining, even if they are not declared inline.
7776 The compiler heuristically decides which functions are worth integrating
7777 in this way.
7778
7779 If all calls to a given function are integrated, and the function is
7780 declared @code{static}, then the function is normally not output as
7781 assembler code in its own right.
7782
7783 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7784
7785 @item -finline-functions-called-once
7786 @opindex finline-functions-called-once
7787 Consider all @code{static} functions called once for inlining into their
7788 caller even if they are not marked @code{inline}. If a call to a given
7789 function is integrated, then the function is not output as assembler code
7790 in its own right.
7791
7792 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7793
7794 @item -fearly-inlining
7795 @opindex fearly-inlining
7796 Inline functions marked by @code{always_inline} and functions whose body seems
7797 smaller than the function call overhead early before doing
7798 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7799 makes profiling significantly cheaper and usually inlining faster on programs
7800 having large chains of nested wrapper functions.
7801
7802 Enabled by default.
7803
7804 @item -fipa-sra
7805 @opindex fipa-sra
7806 Perform interprocedural scalar replacement of aggregates, removal of
7807 unused parameters and replacement of parameters passed by reference
7808 by parameters passed by value.
7809
7810 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7811
7812 @item -finline-limit=@var{n}
7813 @opindex finline-limit
7814 By default, GCC limits the size of functions that can be inlined. This flag
7815 allows coarse control of this limit. @var{n} is the size of functions that
7816 can be inlined in number of pseudo instructions.
7817
7818 Inlining is actually controlled by a number of parameters, which may be
7819 specified individually by using @option{--param @var{name}=@var{value}}.
7820 The @option{-finline-limit=@var{n}} option sets some of these parameters
7821 as follows:
7822
7823 @table @gcctabopt
7824 @item max-inline-insns-single
7825 is set to @var{n}/2.
7826 @item max-inline-insns-auto
7827 is set to @var{n}/2.
7828 @end table
7829
7830 See below for a documentation of the individual
7831 parameters controlling inlining and for the defaults of these parameters.
7832
7833 @emph{Note:} there may be no value to @option{-finline-limit} that results
7834 in default behavior.
7835
7836 @emph{Note:} pseudo instruction represents, in this particular context, an
7837 abstract measurement of function's size. In no way does it represent a count
7838 of assembly instructions and as such its exact meaning might change from one
7839 release to an another.
7840
7841 @item -fno-keep-inline-dllexport
7842 @opindex fno-keep-inline-dllexport
7843 This is a more fine-grained version of @option{-fkeep-inline-functions},
7844 which applies only to functions that are declared using the @code{dllexport}
7845 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
7846 Functions}.
7847
7848 @item -fkeep-inline-functions
7849 @opindex fkeep-inline-functions
7850 In C, emit @code{static} functions that are declared @code{inline}
7851 into the object file, even if the function has been inlined into all
7852 of its callers. This switch does not affect functions using the
7853 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7854 inline functions into the object file.
7855
7856 @item -fkeep-static-functions
7857 @opindex fkeep-static-functions
7858 Emit @code{static} functions into the object file, even if the function
7859 is never used.
7860
7861 @item -fkeep-static-consts
7862 @opindex fkeep-static-consts
7863 Emit variables declared @code{static const} when optimization isn't turned
7864 on, even if the variables aren't referenced.
7865
7866 GCC enables this option by default. If you want to force the compiler to
7867 check if a variable is referenced, regardless of whether or not
7868 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7869
7870 @item -fmerge-constants
7871 @opindex fmerge-constants
7872 Attempt to merge identical constants (string constants and floating-point
7873 constants) across compilation units.
7874
7875 This option is the default for optimized compilation if the assembler and
7876 linker support it. Use @option{-fno-merge-constants} to inhibit this
7877 behavior.
7878
7879 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7880
7881 @item -fmerge-all-constants
7882 @opindex fmerge-all-constants
7883 Attempt to merge identical constants and identical variables.
7884
7885 This option implies @option{-fmerge-constants}. In addition to
7886 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7887 arrays or initialized constant variables with integral or floating-point
7888 types. Languages like C or C++ require each variable, including multiple
7889 instances of the same variable in recursive calls, to have distinct locations,
7890 so using this option results in non-conforming
7891 behavior.
7892
7893 @item -fmodulo-sched
7894 @opindex fmodulo-sched
7895 Perform swing modulo scheduling immediately before the first scheduling
7896 pass. This pass looks at innermost loops and reorders their
7897 instructions by overlapping different iterations.
7898
7899 @item -fmodulo-sched-allow-regmoves
7900 @opindex fmodulo-sched-allow-regmoves
7901 Perform more aggressive SMS-based modulo scheduling with register moves
7902 allowed. By setting this flag certain anti-dependences edges are
7903 deleted, which triggers the generation of reg-moves based on the
7904 life-range analysis. This option is effective only with
7905 @option{-fmodulo-sched} enabled.
7906
7907 @item -fno-branch-count-reg
7908 @opindex fno-branch-count-reg
7909 Avoid running a pass scanning for opportunities to use ``decrement and
7910 branch'' instructions on a count register instead of generating sequences
7911 of instructions that decrement a register, compare it against zero, and
7912 then branch based upon the result. This option is only meaningful on
7913 architectures that support such instructions, which include x86, PowerPC,
7914 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7915 doesn't remove the decrement and branch instructions from the generated
7916 instruction stream introduced by other optimization passes.
7917
7918 Enabled by default at @option{-O1} and higher.
7919
7920 The default is @option{-fbranch-count-reg}.
7921
7922 @item -fno-function-cse
7923 @opindex fno-function-cse
7924 Do not put function addresses in registers; make each instruction that
7925 calls a constant function contain the function's address explicitly.
7926
7927 This option results in less efficient code, but some strange hacks
7928 that alter the assembler output may be confused by the optimizations
7929 performed when this option is not used.
7930
7931 The default is @option{-ffunction-cse}
7932
7933 @item -fno-zero-initialized-in-bss
7934 @opindex fno-zero-initialized-in-bss
7935 If the target supports a BSS section, GCC by default puts variables that
7936 are initialized to zero into BSS@. This can save space in the resulting
7937 code.
7938
7939 This option turns off this behavior because some programs explicitly
7940 rely on variables going to the data section---e.g., so that the
7941 resulting executable can find the beginning of that section and/or make
7942 assumptions based on that.
7943
7944 The default is @option{-fzero-initialized-in-bss}.
7945
7946 @item -fthread-jumps
7947 @opindex fthread-jumps
7948 Perform optimizations that check to see if a jump branches to a
7949 location where another comparison subsumed by the first is found. If
7950 so, the first branch is redirected to either the destination of the
7951 second branch or a point immediately following it, depending on whether
7952 the condition is known to be true or false.
7953
7954 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7955
7956 @item -fsplit-wide-types
7957 @opindex fsplit-wide-types
7958 When using a type that occupies multiple registers, such as @code{long
7959 long} on a 32-bit system, split the registers apart and allocate them
7960 independently. This normally generates better code for those types,
7961 but may make debugging more difficult.
7962
7963 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7964 @option{-Os}.
7965
7966 @item -fcse-follow-jumps
7967 @opindex fcse-follow-jumps
7968 In common subexpression elimination (CSE), scan through jump instructions
7969 when the target of the jump is not reached by any other path. For
7970 example, when CSE encounters an @code{if} statement with an
7971 @code{else} clause, CSE follows the jump when the condition
7972 tested is false.
7973
7974 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7975
7976 @item -fcse-skip-blocks
7977 @opindex fcse-skip-blocks
7978 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7979 follow jumps that conditionally skip over blocks. When CSE
7980 encounters a simple @code{if} statement with no else clause,
7981 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7982 body of the @code{if}.
7983
7984 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7985
7986 @item -frerun-cse-after-loop
7987 @opindex frerun-cse-after-loop
7988 Re-run common subexpression elimination after loop optimizations are
7989 performed.
7990
7991 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7992
7993 @item -fgcse
7994 @opindex fgcse
7995 Perform a global common subexpression elimination pass.
7996 This pass also performs global constant and copy propagation.
7997
7998 @emph{Note:} When compiling a program using computed gotos, a GCC
7999 extension, you may get better run-time performance if you disable
8000 the global common subexpression elimination pass by adding
8001 @option{-fno-gcse} to the command line.
8002
8003 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8004
8005 @item -fgcse-lm
8006 @opindex fgcse-lm
8007 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8008 attempts to move loads that are only killed by stores into themselves. This
8009 allows a loop containing a load/store sequence to be changed to a load outside
8010 the loop, and a copy/store within the loop.
8011
8012 Enabled by default when @option{-fgcse} is enabled.
8013
8014 @item -fgcse-sm
8015 @opindex fgcse-sm
8016 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8017 global common subexpression elimination. This pass attempts to move
8018 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8019 loops containing a load/store sequence can be changed to a load before
8020 the loop and a store after the loop.
8021
8022 Not enabled at any optimization level.
8023
8024 @item -fgcse-las
8025 @opindex fgcse-las
8026 When @option{-fgcse-las} is enabled, the global common subexpression
8027 elimination pass eliminates redundant loads that come after stores to the
8028 same memory location (both partial and full redundancies).
8029
8030 Not enabled at any optimization level.
8031
8032 @item -fgcse-after-reload
8033 @opindex fgcse-after-reload
8034 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8035 pass is performed after reload. The purpose of this pass is to clean up
8036 redundant spilling.
8037
8038 @item -faggressive-loop-optimizations
8039 @opindex faggressive-loop-optimizations
8040 This option tells the loop optimizer to use language constraints to
8041 derive bounds for the number of iterations of a loop. This assumes that
8042 loop code does not invoke undefined behavior by for example causing signed
8043 integer overflows or out-of-bound array accesses. The bounds for the
8044 number of iterations of a loop are used to guide loop unrolling and peeling
8045 and loop exit test optimizations.
8046 This option is enabled by default.
8047
8048 @item -funconstrained-commons
8049 @opindex funconstrained-commons
8050 This option tells the compiler that variables declared in common blocks
8051 (e.g. Fortran) may later be overridden with longer trailing arrays. This
8052 prevents certain optimizations that depend on knowing the array bounds.
8053
8054 @item -fcrossjumping
8055 @opindex fcrossjumping
8056 Perform cross-jumping transformation.
8057 This transformation unifies equivalent code and saves code size. The
8058 resulting code may or may not perform better than without cross-jumping.
8059
8060 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8061
8062 @item -fauto-inc-dec
8063 @opindex fauto-inc-dec
8064 Combine increments or decrements of addresses with memory accesses.
8065 This pass is always skipped on architectures that do not have
8066 instructions to support this. Enabled by default at @option{-O} and
8067 higher on architectures that support this.
8068
8069 @item -fdce
8070 @opindex fdce
8071 Perform dead code elimination (DCE) on RTL@.
8072 Enabled by default at @option{-O} and higher.
8073
8074 @item -fdse
8075 @opindex fdse
8076 Perform dead store elimination (DSE) on RTL@.
8077 Enabled by default at @option{-O} and higher.
8078
8079 @item -fif-conversion
8080 @opindex fif-conversion
8081 Attempt to transform conditional jumps into branch-less equivalents. This
8082 includes use of conditional moves, min, max, set flags and abs instructions, and
8083 some tricks doable by standard arithmetics. The use of conditional execution
8084 on chips where it is available is controlled by @option{-fif-conversion2}.
8085
8086 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8087
8088 @item -fif-conversion2
8089 @opindex fif-conversion2
8090 Use conditional execution (where available) to transform conditional jumps into
8091 branch-less equivalents.
8092
8093 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8094
8095 @item -fdeclone-ctor-dtor
8096 @opindex fdeclone-ctor-dtor
8097 The C++ ABI requires multiple entry points for constructors and
8098 destructors: one for a base subobject, one for a complete object, and
8099 one for a virtual destructor that calls operator delete afterwards.
8100 For a hierarchy with virtual bases, the base and complete variants are
8101 clones, which means two copies of the function. With this option, the
8102 base and complete variants are changed to be thunks that call a common
8103 implementation.
8104
8105 Enabled by @option{-Os}.
8106
8107 @item -fdelete-null-pointer-checks
8108 @opindex fdelete-null-pointer-checks
8109 Assume that programs cannot safely dereference null pointers, and that
8110 no code or data element resides at address zero.
8111 This option enables simple constant
8112 folding optimizations at all optimization levels. In addition, other
8113 optimization passes in GCC use this flag to control global dataflow
8114 analyses that eliminate useless checks for null pointers; these assume
8115 that a memory access to address zero always results in a trap, so
8116 that if a pointer is checked after it has already been dereferenced,
8117 it cannot be null.
8118
8119 Note however that in some environments this assumption is not true.
8120 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8121 for programs that depend on that behavior.
8122
8123 This option is enabled by default on most targets. On Nios II ELF, it
8124 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8125
8126 Passes that use the dataflow information
8127 are enabled independently at different optimization levels.
8128
8129 @item -fdevirtualize
8130 @opindex fdevirtualize
8131 Attempt to convert calls to virtual functions to direct calls. This
8132 is done both within a procedure and interprocedurally as part of
8133 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8134 propagation (@option{-fipa-cp}).
8135 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8136
8137 @item -fdevirtualize-speculatively
8138 @opindex fdevirtualize-speculatively
8139 Attempt to convert calls to virtual functions to speculative direct calls.
8140 Based on the analysis of the type inheritance graph, determine for a given call
8141 the set of likely targets. If the set is small, preferably of size 1, change
8142 the call into a conditional deciding between direct and indirect calls. The
8143 speculative calls enable more optimizations, such as inlining. When they seem
8144 useless after further optimization, they are converted back into original form.
8145
8146 @item -fdevirtualize-at-ltrans
8147 @opindex fdevirtualize-at-ltrans
8148 Stream extra information needed for aggressive devirtualization when running
8149 the link-time optimizer in local transformation mode.
8150 This option enables more devirtualization but
8151 significantly increases the size of streamed data. For this reason it is
8152 disabled by default.
8153
8154 @item -fexpensive-optimizations
8155 @opindex fexpensive-optimizations
8156 Perform a number of minor optimizations that are relatively expensive.
8157
8158 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8159
8160 @item -free
8161 @opindex free
8162 Attempt to remove redundant extension instructions. This is especially
8163 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8164 registers after writing to their lower 32-bit half.
8165
8166 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8167 @option{-O3}, @option{-Os}.
8168
8169 @item -fno-lifetime-dse
8170 @opindex fno-lifetime-dse
8171 In C++ the value of an object is only affected by changes within its
8172 lifetime: when the constructor begins, the object has an indeterminate
8173 value, and any changes during the lifetime of the object are dead when
8174 the object is destroyed. Normally dead store elimination will take
8175 advantage of this; if your code relies on the value of the object
8176 storage persisting beyond the lifetime of the object, you can use this
8177 flag to disable this optimization. To preserve stores before the
8178 constructor starts (e.g. because your operator new clears the object
8179 storage) but still treat the object as dead after the destructor you,
8180 can use @option{-flifetime-dse=1}. The default behavior can be
8181 explicitly selected with @option{-flifetime-dse=2}.
8182 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8183
8184 @item -flive-range-shrinkage
8185 @opindex flive-range-shrinkage
8186 Attempt to decrease register pressure through register live range
8187 shrinkage. This is helpful for fast processors with small or moderate
8188 size register sets.
8189
8190 @item -fira-algorithm=@var{algorithm}
8191 @opindex fira-algorithm
8192 Use the specified coloring algorithm for the integrated register
8193 allocator. The @var{algorithm} argument can be @samp{priority}, which
8194 specifies Chow's priority coloring, or @samp{CB}, which specifies
8195 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8196 for all architectures, but for those targets that do support it, it is
8197 the default because it generates better code.
8198
8199 @item -fira-region=@var{region}
8200 @opindex fira-region
8201 Use specified regions for the integrated register allocator. The
8202 @var{region} argument should be one of the following:
8203
8204 @table @samp
8205
8206 @item all
8207 Use all loops as register allocation regions.
8208 This can give the best results for machines with a small and/or
8209 irregular register set.
8210
8211 @item mixed
8212 Use all loops except for loops with small register pressure
8213 as the regions. This value usually gives
8214 the best results in most cases and for most architectures,
8215 and is enabled by default when compiling with optimization for speed
8216 (@option{-O}, @option{-O2}, @dots{}).
8217
8218 @item one
8219 Use all functions as a single region.
8220 This typically results in the smallest code size, and is enabled by default for
8221 @option{-Os} or @option{-O0}.
8222
8223 @end table
8224
8225 @item -fira-hoist-pressure
8226 @opindex fira-hoist-pressure
8227 Use IRA to evaluate register pressure in the code hoisting pass for
8228 decisions to hoist expressions. This option usually results in smaller
8229 code, but it can slow the compiler down.
8230
8231 This option is enabled at level @option{-Os} for all targets.
8232
8233 @item -fira-loop-pressure
8234 @opindex fira-loop-pressure
8235 Use IRA to evaluate register pressure in loops for decisions to move
8236 loop invariants. This option usually results in generation
8237 of faster and smaller code on machines with large register files (>= 32
8238 registers), but it can slow the compiler down.
8239
8240 This option is enabled at level @option{-O3} for some targets.
8241
8242 @item -fno-ira-share-save-slots
8243 @opindex fno-ira-share-save-slots
8244 Disable sharing of stack slots used for saving call-used hard
8245 registers living through a call. Each hard register gets a
8246 separate stack slot, and as a result function stack frames are
8247 larger.
8248
8249 @item -fno-ira-share-spill-slots
8250 @opindex fno-ira-share-spill-slots
8251 Disable sharing of stack slots allocated for pseudo-registers. Each
8252 pseudo-register that does not get a hard register gets a separate
8253 stack slot, and as a result function stack frames are larger.
8254
8255 @item -flra-remat
8256 @opindex flra-remat
8257 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8258 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8259 values if it is profitable.
8260
8261 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8262
8263 @item -fdelayed-branch
8264 @opindex fdelayed-branch
8265 If supported for the target machine, attempt to reorder instructions
8266 to exploit instruction slots available after delayed branch
8267 instructions.
8268
8269 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8270
8271 @item -fschedule-insns
8272 @opindex fschedule-insns
8273 If supported for the target machine, attempt to reorder instructions to
8274 eliminate execution stalls due to required data being unavailable. This
8275 helps machines that have slow floating point or memory load instructions
8276 by allowing other instructions to be issued until the result of the load
8277 or floating-point instruction is required.
8278
8279 Enabled at levels @option{-O2}, @option{-O3}.
8280
8281 @item -fschedule-insns2
8282 @opindex fschedule-insns2
8283 Similar to @option{-fschedule-insns}, but requests an additional pass of
8284 instruction scheduling after register allocation has been done. This is
8285 especially useful on machines with a relatively small number of
8286 registers and where memory load instructions take more than one cycle.
8287
8288 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8289
8290 @item -fno-sched-interblock
8291 @opindex fno-sched-interblock
8292 Don't schedule instructions across basic blocks. This is normally
8293 enabled by default when scheduling before register allocation, i.e.@:
8294 with @option{-fschedule-insns} or at @option{-O2} or higher.
8295
8296 @item -fno-sched-spec
8297 @opindex fno-sched-spec
8298 Don't allow speculative motion of non-load instructions. This is normally
8299 enabled by default when scheduling before register allocation, i.e.@:
8300 with @option{-fschedule-insns} or at @option{-O2} or higher.
8301
8302 @item -fsched-pressure
8303 @opindex fsched-pressure
8304 Enable register pressure sensitive insn scheduling before register
8305 allocation. This only makes sense when scheduling before register
8306 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8307 @option{-O2} or higher. Usage of this option can improve the
8308 generated code and decrease its size by preventing register pressure
8309 increase above the number of available hard registers and subsequent
8310 spills in register allocation.
8311
8312 @item -fsched-spec-load
8313 @opindex fsched-spec-load
8314 Allow speculative motion of some load instructions. This only makes
8315 sense when scheduling before register allocation, i.e.@: with
8316 @option{-fschedule-insns} or at @option{-O2} or higher.
8317
8318 @item -fsched-spec-load-dangerous
8319 @opindex fsched-spec-load-dangerous
8320 Allow speculative motion of more load instructions. This only makes
8321 sense when scheduling before register allocation, i.e.@: with
8322 @option{-fschedule-insns} or at @option{-O2} or higher.
8323
8324 @item -fsched-stalled-insns
8325 @itemx -fsched-stalled-insns=@var{n}
8326 @opindex fsched-stalled-insns
8327 Define how many insns (if any) can be moved prematurely from the queue
8328 of stalled insns into the ready list during the second scheduling pass.
8329 @option{-fno-sched-stalled-insns} means that no insns are moved
8330 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8331 on how many queued insns can be moved prematurely.
8332 @option{-fsched-stalled-insns} without a value is equivalent to
8333 @option{-fsched-stalled-insns=1}.
8334
8335 @item -fsched-stalled-insns-dep
8336 @itemx -fsched-stalled-insns-dep=@var{n}
8337 @opindex fsched-stalled-insns-dep
8338 Define how many insn groups (cycles) are examined for a dependency
8339 on a stalled insn that is a candidate for premature removal from the queue
8340 of stalled insns. This has an effect only during the second scheduling pass,
8341 and only if @option{-fsched-stalled-insns} is used.
8342 @option{-fno-sched-stalled-insns-dep} is equivalent to
8343 @option{-fsched-stalled-insns-dep=0}.
8344 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8345 @option{-fsched-stalled-insns-dep=1}.
8346
8347 @item -fsched2-use-superblocks
8348 @opindex fsched2-use-superblocks
8349 When scheduling after register allocation, use superblock scheduling.
8350 This allows motion across basic block boundaries,
8351 resulting in faster schedules. This option is experimental, as not all machine
8352 descriptions used by GCC model the CPU closely enough to avoid unreliable
8353 results from the algorithm.
8354
8355 This only makes sense when scheduling after register allocation, i.e.@: with
8356 @option{-fschedule-insns2} or at @option{-O2} or higher.
8357
8358 @item -fsched-group-heuristic
8359 @opindex fsched-group-heuristic
8360 Enable the group heuristic in the scheduler. This heuristic favors
8361 the instruction that belongs to a schedule group. This is enabled
8362 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8363 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8364
8365 @item -fsched-critical-path-heuristic
8366 @opindex fsched-critical-path-heuristic
8367 Enable the critical-path heuristic in the scheduler. This heuristic favors
8368 instructions on the critical path. This is enabled by default when
8369 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8370 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8371
8372 @item -fsched-spec-insn-heuristic
8373 @opindex fsched-spec-insn-heuristic
8374 Enable the speculative instruction heuristic in the scheduler. This
8375 heuristic favors speculative instructions with greater dependency weakness.
8376 This is enabled by default when scheduling is enabled, i.e.@:
8377 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8378 or at @option{-O2} or higher.
8379
8380 @item -fsched-rank-heuristic
8381 @opindex fsched-rank-heuristic
8382 Enable the rank heuristic in the scheduler. This heuristic favors
8383 the instruction belonging to a basic block with greater size or frequency.
8384 This is enabled by default when scheduling is enabled, i.e.@:
8385 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8386 at @option{-O2} or higher.
8387
8388 @item -fsched-last-insn-heuristic
8389 @opindex fsched-last-insn-heuristic
8390 Enable the last-instruction heuristic in the scheduler. This heuristic
8391 favors the instruction that is less dependent on the last instruction
8392 scheduled. This is enabled by default when scheduling is enabled,
8393 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8394 at @option{-O2} or higher.
8395
8396 @item -fsched-dep-count-heuristic
8397 @opindex fsched-dep-count-heuristic
8398 Enable the dependent-count heuristic in the scheduler. This heuristic
8399 favors the instruction that has more instructions depending on it.
8400 This is enabled by default when scheduling is enabled, i.e.@:
8401 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8402 at @option{-O2} or higher.
8403
8404 @item -freschedule-modulo-scheduled-loops
8405 @opindex freschedule-modulo-scheduled-loops
8406 Modulo scheduling is performed before traditional scheduling. If a loop
8407 is modulo scheduled, later scheduling passes may change its schedule.
8408 Use this option to control that behavior.
8409
8410 @item -fselective-scheduling
8411 @opindex fselective-scheduling
8412 Schedule instructions using selective scheduling algorithm. Selective
8413 scheduling runs instead of the first scheduler pass.
8414
8415 @item -fselective-scheduling2
8416 @opindex fselective-scheduling2
8417 Schedule instructions using selective scheduling algorithm. Selective
8418 scheduling runs instead of the second scheduler pass.
8419
8420 @item -fsel-sched-pipelining
8421 @opindex fsel-sched-pipelining
8422 Enable software pipelining of innermost loops during selective scheduling.
8423 This option has no effect unless one of @option{-fselective-scheduling} or
8424 @option{-fselective-scheduling2} is turned on.
8425
8426 @item -fsel-sched-pipelining-outer-loops
8427 @opindex fsel-sched-pipelining-outer-loops
8428 When pipelining loops during selective scheduling, also pipeline outer loops.
8429 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8430
8431 @item -fsemantic-interposition
8432 @opindex fsemantic-interposition
8433 Some object formats, like ELF, allow interposing of symbols by the
8434 dynamic linker.
8435 This means that for symbols exported from the DSO, the compiler cannot perform
8436 interprocedural propagation, inlining and other optimizations in anticipation
8437 that the function or variable in question may change. While this feature is
8438 useful, for example, to rewrite memory allocation functions by a debugging
8439 implementation, it is expensive in the terms of code quality.
8440 With @option{-fno-semantic-interposition} the compiler assumes that
8441 if interposition happens for functions the overwriting function will have
8442 precisely the same semantics (and side effects).
8443 Similarly if interposition happens
8444 for variables, the constructor of the variable will be the same. The flag
8445 has no effect for functions explicitly declared inline
8446 (where it is never allowed for interposition to change semantics)
8447 and for symbols explicitly declared weak.
8448
8449 @item -fshrink-wrap
8450 @opindex fshrink-wrap
8451 Emit function prologues only before parts of the function that need it,
8452 rather than at the top of the function. This flag is enabled by default at
8453 @option{-O} and higher.
8454
8455 @item -fshrink-wrap-separate
8456 @opindex fshrink-wrap-separate
8457 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8458 those parts are only executed when needed.
8459 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8460 is also turned on and the target supports this.
8461
8462 @item -fcaller-saves
8463 @opindex fcaller-saves
8464 Enable allocation of values to registers that are clobbered by
8465 function calls, by emitting extra instructions to save and restore the
8466 registers around such calls. Such allocation is done only when it
8467 seems to result in better code.
8468
8469 This option is always enabled by default on certain machines, usually
8470 those which have no call-preserved registers to use instead.
8471
8472 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8473
8474 @item -fcombine-stack-adjustments
8475 @opindex fcombine-stack-adjustments
8476 Tracks stack adjustments (pushes and pops) and stack memory references
8477 and then tries to find ways to combine them.
8478
8479 Enabled by default at @option{-O1} and higher.
8480
8481 @item -fipa-ra
8482 @opindex fipa-ra
8483 Use caller save registers for allocation if those registers are not used by
8484 any called function. In that case it is not necessary to save and restore
8485 them around calls. This is only possible if called functions are part of
8486 same compilation unit as current function and they are compiled before it.
8487
8488 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8489 is disabled if generated code will be instrumented for profiling
8490 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8491 exactly (this happens on targets that do not expose prologues
8492 and epilogues in RTL).
8493
8494 @item -fconserve-stack
8495 @opindex fconserve-stack
8496 Attempt to minimize stack usage. The compiler attempts to use less
8497 stack space, even if that makes the program slower. This option
8498 implies setting the @option{large-stack-frame} parameter to 100
8499 and the @option{large-stack-frame-growth} parameter to 400.
8500
8501 @item -ftree-reassoc
8502 @opindex ftree-reassoc
8503 Perform reassociation on trees. This flag is enabled by default
8504 at @option{-O} and higher.
8505
8506 @item -fcode-hoisting
8507 @opindex fcode-hoisting
8508 Perform code hoisting. Code hoisting tries to move the
8509 evaluation of expressions executed on all paths to the function exit
8510 as early as possible. This is especially useful as a code size
8511 optimization, but it often helps for code speed as well.
8512 This flag is enabled by default at @option{-O2} and higher.
8513
8514 @item -ftree-pre
8515 @opindex ftree-pre
8516 Perform partial redundancy elimination (PRE) on trees. This flag is
8517 enabled by default at @option{-O2} and @option{-O3}.
8518
8519 @item -ftree-partial-pre
8520 @opindex ftree-partial-pre
8521 Make partial redundancy elimination (PRE) more aggressive. This flag is
8522 enabled by default at @option{-O3}.
8523
8524 @item -ftree-forwprop
8525 @opindex ftree-forwprop
8526 Perform forward propagation on trees. This flag is enabled by default
8527 at @option{-O} and higher.
8528
8529 @item -ftree-fre
8530 @opindex ftree-fre
8531 Perform full redundancy elimination (FRE) on trees. The difference
8532 between FRE and PRE is that FRE only considers expressions
8533 that are computed on all paths leading to the redundant computation.
8534 This analysis is faster than PRE, though it exposes fewer redundancies.
8535 This flag is enabled by default at @option{-O} and higher.
8536
8537 @item -ftree-phiprop
8538 @opindex ftree-phiprop
8539 Perform hoisting of loads from conditional pointers on trees. This
8540 pass is enabled by default at @option{-O} and higher.
8541
8542 @item -fhoist-adjacent-loads
8543 @opindex fhoist-adjacent-loads
8544 Speculatively hoist loads from both branches of an if-then-else if the
8545 loads are from adjacent locations in the same structure and the target
8546 architecture has a conditional move instruction. This flag is enabled
8547 by default at @option{-O2} and higher.
8548
8549 @item -ftree-copy-prop
8550 @opindex ftree-copy-prop
8551 Perform copy propagation on trees. This pass eliminates unnecessary
8552 copy operations. This flag is enabled by default at @option{-O} and
8553 higher.
8554
8555 @item -fipa-pure-const
8556 @opindex fipa-pure-const
8557 Discover which functions are pure or constant.
8558 Enabled by default at @option{-O} and higher.
8559
8560 @item -fipa-reference
8561 @opindex fipa-reference
8562 Discover which static variables do not escape the
8563 compilation unit.
8564 Enabled by default at @option{-O} and higher.
8565
8566 @item -fipa-pta
8567 @opindex fipa-pta
8568 Perform interprocedural pointer analysis and interprocedural modification
8569 and reference analysis. This option can cause excessive memory and
8570 compile-time usage on large compilation units. It is not enabled by
8571 default at any optimization level.
8572
8573 @item -fipa-profile
8574 @opindex fipa-profile
8575 Perform interprocedural profile propagation. The functions called only from
8576 cold functions are marked as cold. Also functions executed once (such as
8577 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8578 functions and loop less parts of functions executed once are then optimized for
8579 size.
8580 Enabled by default at @option{-O} and higher.
8581
8582 @item -fipa-cp
8583 @opindex fipa-cp
8584 Perform interprocedural constant propagation.
8585 This optimization analyzes the program to determine when values passed
8586 to functions are constants and then optimizes accordingly.
8587 This optimization can substantially increase performance
8588 if the application has constants passed to functions.
8589 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8590
8591 @item -fipa-cp-clone
8592 @opindex fipa-cp-clone
8593 Perform function cloning to make interprocedural constant propagation stronger.
8594 When enabled, interprocedural constant propagation performs function cloning
8595 when externally visible function can be called with constant arguments.
8596 Because this optimization can create multiple copies of functions,
8597 it may significantly increase code size
8598 (see @option{--param ipcp-unit-growth=@var{value}}).
8599 This flag is enabled by default at @option{-O3}.
8600
8601 @item -fipa-bit-cp
8602 @opindex -fipa-bit-cp
8603 When enabled, perform interprocedural bitwise constant
8604 propagation. This flag is enabled by default at @option{-O2}. It
8605 requires that @option{-fipa-cp} is enabled.
8606
8607 @item -fipa-vrp
8608 @opindex -fipa-vrp
8609 When enabled, perform interprocedural propagation of value
8610 ranges. This flag is enabled by default at @option{-O2}. It requires
8611 that @option{-fipa-cp} is enabled.
8612
8613 @item -fipa-icf
8614 @opindex fipa-icf
8615 Perform Identical Code Folding for functions and read-only variables.
8616 The optimization reduces code size and may disturb unwind stacks by replacing
8617 a function by equivalent one with a different name. The optimization works
8618 more effectively with link-time optimization enabled.
8619
8620 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8621 works on different levels and thus the optimizations are not same - there are
8622 equivalences that are found only by GCC and equivalences found only by Gold.
8623
8624 This flag is enabled by default at @option{-O2} and @option{-Os}.
8625
8626 @item -fisolate-erroneous-paths-dereference
8627 @opindex fisolate-erroneous-paths-dereference
8628 Detect paths that trigger erroneous or undefined behavior due to
8629 dereferencing a null pointer. Isolate those paths from the main control
8630 flow and turn the statement with erroneous or undefined behavior into a trap.
8631 This flag is enabled by default at @option{-O2} and higher and depends on
8632 @option{-fdelete-null-pointer-checks} also being enabled.
8633
8634 @item -fisolate-erroneous-paths-attribute
8635 @opindex fisolate-erroneous-paths-attribute
8636 Detect paths that trigger erroneous or undefined behavior due to a null value
8637 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8638 attribute. Isolate those paths from the main control flow and turn the
8639 statement with erroneous or undefined behavior into a trap. This is not
8640 currently enabled, but may be enabled by @option{-O2} in the future.
8641
8642 @item -ftree-sink
8643 @opindex ftree-sink
8644 Perform forward store motion on trees. This flag is
8645 enabled by default at @option{-O} and higher.
8646
8647 @item -ftree-bit-ccp
8648 @opindex ftree-bit-ccp
8649 Perform sparse conditional bit constant propagation on trees and propagate
8650 pointer alignment information.
8651 This pass only operates on local scalar variables and is enabled by default
8652 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8653
8654 @item -ftree-ccp
8655 @opindex ftree-ccp
8656 Perform sparse conditional constant propagation (CCP) on trees. This
8657 pass only operates on local scalar variables and is enabled by default
8658 at @option{-O} and higher.
8659
8660 @item -fssa-backprop
8661 @opindex fssa-backprop
8662 Propagate information about uses of a value up the definition chain
8663 in order to simplify the definitions. For example, this pass strips
8664 sign operations if the sign of a value never matters. The flag is
8665 enabled by default at @option{-O} and higher.
8666
8667 @item -fssa-phiopt
8668 @opindex fssa-phiopt
8669 Perform pattern matching on SSA PHI nodes to optimize conditional
8670 code. This pass is enabled by default at @option{-O} and higher.
8671
8672 @item -ftree-switch-conversion
8673 @opindex ftree-switch-conversion
8674 Perform conversion of simple initializations in a switch to
8675 initializations from a scalar array. This flag is enabled by default
8676 at @option{-O2} and higher.
8677
8678 @item -ftree-tail-merge
8679 @opindex ftree-tail-merge
8680 Look for identical code sequences. When found, replace one with a jump to the
8681 other. This optimization is known as tail merging or cross jumping. This flag
8682 is enabled by default at @option{-O2} and higher. The compilation time
8683 in this pass can
8684 be limited using @option{max-tail-merge-comparisons} parameter and
8685 @option{max-tail-merge-iterations} parameter.
8686
8687 @item -ftree-dce
8688 @opindex ftree-dce
8689 Perform dead code elimination (DCE) on trees. This flag is enabled by
8690 default at @option{-O} and higher.
8691
8692 @item -ftree-builtin-call-dce
8693 @opindex ftree-builtin-call-dce
8694 Perform conditional dead code elimination (DCE) for calls to built-in functions
8695 that may set @code{errno} but are otherwise free of side effects. This flag is
8696 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8697 specified.
8698
8699 @item -ftree-dominator-opts
8700 @opindex ftree-dominator-opts
8701 Perform a variety of simple scalar cleanups (constant/copy
8702 propagation, redundancy elimination, range propagation and expression
8703 simplification) based on a dominator tree traversal. This also
8704 performs jump threading (to reduce jumps to jumps). This flag is
8705 enabled by default at @option{-O} and higher.
8706
8707 @item -ftree-dse
8708 @opindex ftree-dse
8709 Perform dead store elimination (DSE) on trees. A dead store is a store into
8710 a memory location that is later overwritten by another store without
8711 any intervening loads. In this case the earlier store can be deleted. This
8712 flag is enabled by default at @option{-O} and higher.
8713
8714 @item -ftree-ch
8715 @opindex ftree-ch
8716 Perform loop header copying on trees. This is beneficial since it increases
8717 effectiveness of code motion optimizations. It also saves one jump. This flag
8718 is enabled by default at @option{-O} and higher. It is not enabled
8719 for @option{-Os}, since it usually increases code size.
8720
8721 @item -ftree-loop-optimize
8722 @opindex ftree-loop-optimize
8723 Perform loop optimizations on trees. This flag is enabled by default
8724 at @option{-O} and higher.
8725
8726 @item -ftree-loop-linear
8727 @itemx -floop-strip-mine
8728 @itemx -floop-block
8729 @opindex ftree-loop-linear
8730 @opindex floop-strip-mine
8731 @opindex floop-block
8732 Perform loop nest optimizations. Same as
8733 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8734 to be configured with @option{--with-isl} to enable the Graphite loop
8735 transformation infrastructure.
8736
8737 @item -fgraphite-identity
8738 @opindex fgraphite-identity
8739 Enable the identity transformation for graphite. For every SCoP we generate
8740 the polyhedral representation and transform it back to gimple. Using
8741 @option{-fgraphite-identity} we can check the costs or benefits of the
8742 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8743 are also performed by the code generator isl, like index splitting and
8744 dead code elimination in loops.
8745
8746 @item -floop-nest-optimize
8747 @opindex floop-nest-optimize
8748 Enable the isl based loop nest optimizer. This is a generic loop nest
8749 optimizer based on the Pluto optimization algorithms. It calculates a loop
8750 structure optimized for data-locality and parallelism. This option
8751 is experimental.
8752
8753 @item -floop-parallelize-all
8754 @opindex floop-parallelize-all
8755 Use the Graphite data dependence analysis to identify loops that can
8756 be parallelized. Parallelize all the loops that can be analyzed to
8757 not contain loop carried dependences without checking that it is
8758 profitable to parallelize the loops.
8759
8760 @item -ftree-coalesce-vars
8761 @opindex ftree-coalesce-vars
8762 While transforming the program out of the SSA representation, attempt to
8763 reduce copying by coalescing versions of different user-defined
8764 variables, instead of just compiler temporaries. This may severely
8765 limit the ability to debug an optimized program compiled with
8766 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8767 prevents SSA coalescing of user variables. This option is enabled by
8768 default if optimization is enabled, and it does very little otherwise.
8769
8770 @item -ftree-loop-if-convert
8771 @opindex ftree-loop-if-convert
8772 Attempt to transform conditional jumps in the innermost loops to
8773 branch-less equivalents. The intent is to remove control-flow from
8774 the innermost loops in order to improve the ability of the
8775 vectorization pass to handle these loops. This is enabled by default
8776 if vectorization is enabled.
8777
8778 @item -ftree-loop-distribution
8779 @opindex ftree-loop-distribution
8780 Perform loop distribution. This flag can improve cache performance on
8781 big loop bodies and allow further loop optimizations, like
8782 parallelization or vectorization, to take place. For example, the loop
8783 @smallexample
8784 DO I = 1, N
8785 A(I) = B(I) + C
8786 D(I) = E(I) * F
8787 ENDDO
8788 @end smallexample
8789 is transformed to
8790 @smallexample
8791 DO I = 1, N
8792 A(I) = B(I) + C
8793 ENDDO
8794 DO I = 1, N
8795 D(I) = E(I) * F
8796 ENDDO
8797 @end smallexample
8798
8799 @item -ftree-loop-distribute-patterns
8800 @opindex ftree-loop-distribute-patterns
8801 Perform loop distribution of patterns that can be code generated with
8802 calls to a library. This flag is enabled by default at @option{-O3}.
8803
8804 This pass distributes the initialization loops and generates a call to
8805 memset zero. For example, the loop
8806 @smallexample
8807 DO I = 1, N
8808 A(I) = 0
8809 B(I) = A(I) + I
8810 ENDDO
8811 @end smallexample
8812 is transformed to
8813 @smallexample
8814 DO I = 1, N
8815 A(I) = 0
8816 ENDDO
8817 DO I = 1, N
8818 B(I) = A(I) + I
8819 ENDDO
8820 @end smallexample
8821 and the initialization loop is transformed into a call to memset zero.
8822
8823 @item -floop-interchange
8824 @opindex floop-interchange
8825 Perform loop interchange outside of graphite. This flag can improve cache
8826 performance on loop nest and allow further loop optimizations, like
8827 vectorization, to take place. For example, the loop
8828 @smallexample
8829 for (int i = 0; i < N; i++)
8830 for (int j = 0; j < N; j++)
8831 for (int k = 0; k < N; k++)
8832 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8833 @end smallexample
8834 is transformed to
8835 @smallexample
8836 for (int i = 0; i < N; i++)
8837 for (int k = 0; k < N; k++)
8838 for (int j = 0; j < N; j++)
8839 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8840 @end smallexample
8841 This flag is enabled by default at @option{-O3}.
8842
8843 @item -floop-unroll-and-jam
8844 @opindex floop-unroll-and-jam
8845 Apply unroll and jam transformations on feasible loops. In a loop
8846 nest this unrolls the outer loop by some factor and fuses the resulting
8847 multiple inner loops. This flag is enabled by default at @option{-O3}.
8848
8849 @item -ftree-loop-im
8850 @opindex ftree-loop-im
8851 Perform loop invariant motion on trees. This pass moves only invariants that
8852 are hard to handle at RTL level (function calls, operations that expand to
8853 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8854 operands of conditions that are invariant out of the loop, so that we can use
8855 just trivial invariantness analysis in loop unswitching. The pass also includes
8856 store motion.
8857
8858 @item -ftree-loop-ivcanon
8859 @opindex ftree-loop-ivcanon
8860 Create a canonical counter for number of iterations in loops for which
8861 determining number of iterations requires complicated analysis. Later
8862 optimizations then may determine the number easily. Useful especially
8863 in connection with unrolling.
8864
8865 @item -fivopts
8866 @opindex fivopts
8867 Perform induction variable optimizations (strength reduction, induction
8868 variable merging and induction variable elimination) on trees.
8869
8870 @item -ftree-parallelize-loops=n
8871 @opindex ftree-parallelize-loops
8872 Parallelize loops, i.e., split their iteration space to run in n threads.
8873 This is only possible for loops whose iterations are independent
8874 and can be arbitrarily reordered. The optimization is only
8875 profitable on multiprocessor machines, for loops that are CPU-intensive,
8876 rather than constrained e.g.@: by memory bandwidth. This option
8877 implies @option{-pthread}, and thus is only supported on targets
8878 that have support for @option{-pthread}.
8879
8880 @item -ftree-pta
8881 @opindex ftree-pta
8882 Perform function-local points-to analysis on trees. This flag is
8883 enabled by default at @option{-O} and higher.
8884
8885 @item -ftree-sra
8886 @opindex ftree-sra
8887 Perform scalar replacement of aggregates. This pass replaces structure
8888 references with scalars to prevent committing structures to memory too
8889 early. This flag is enabled by default at @option{-O} and higher.
8890
8891 @item -fstore-merging
8892 @opindex fstore-merging
8893 Perform merging of narrow stores to consecutive memory addresses. This pass
8894 merges contiguous stores of immediate values narrower than a word into fewer
8895 wider stores to reduce the number of instructions. This is enabled by default
8896 at @option{-O2} and higher as well as @option{-Os}.
8897
8898 @item -ftree-ter
8899 @opindex ftree-ter
8900 Perform temporary expression replacement during the SSA->normal phase. Single
8901 use/single def temporaries are replaced at their use location with their
8902 defining expression. This results in non-GIMPLE code, but gives the expanders
8903 much more complex trees to work on resulting in better RTL generation. This is
8904 enabled by default at @option{-O} and higher.
8905
8906 @item -ftree-slsr
8907 @opindex ftree-slsr
8908 Perform straight-line strength reduction on trees. This recognizes related
8909 expressions involving multiplications and replaces them by less expensive
8910 calculations when possible. This is enabled by default at @option{-O} and
8911 higher.
8912
8913 @item -ftree-vectorize
8914 @opindex ftree-vectorize
8915 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8916 and @option{-ftree-slp-vectorize} if not explicitly specified.
8917
8918 @item -ftree-loop-vectorize
8919 @opindex ftree-loop-vectorize
8920 Perform loop vectorization on trees. This flag is enabled by default at
8921 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8922
8923 @item -ftree-slp-vectorize
8924 @opindex ftree-slp-vectorize
8925 Perform basic block vectorization on trees. This flag is enabled by default at
8926 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8927
8928 @item -fvect-cost-model=@var{model}
8929 @opindex fvect-cost-model
8930 Alter the cost model used for vectorization. The @var{model} argument
8931 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8932 With the @samp{unlimited} model the vectorized code-path is assumed
8933 to be profitable while with the @samp{dynamic} model a runtime check
8934 guards the vectorized code-path to enable it only for iteration
8935 counts that will likely execute faster than when executing the original
8936 scalar loop. The @samp{cheap} model disables vectorization of
8937 loops where doing so would be cost prohibitive for example due to
8938 required runtime checks for data dependence or alignment but otherwise
8939 is equal to the @samp{dynamic} model.
8940 The default cost model depends on other optimization flags and is
8941 either @samp{dynamic} or @samp{cheap}.
8942
8943 @item -fsimd-cost-model=@var{model}
8944 @opindex fsimd-cost-model
8945 Alter the cost model used for vectorization of loops marked with the OpenMP
8946 simd directive. The @var{model} argument should be one of
8947 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8948 have the same meaning as described in @option{-fvect-cost-model} and by
8949 default a cost model defined with @option{-fvect-cost-model} is used.
8950
8951 @item -ftree-vrp
8952 @opindex ftree-vrp
8953 Perform Value Range Propagation on trees. This is similar to the
8954 constant propagation pass, but instead of values, ranges of values are
8955 propagated. This allows the optimizers to remove unnecessary range
8956 checks like array bound checks and null pointer checks. This is
8957 enabled by default at @option{-O2} and higher. Null pointer check
8958 elimination is only done if @option{-fdelete-null-pointer-checks} is
8959 enabled.
8960
8961 @item -fsplit-paths
8962 @opindex fsplit-paths
8963 Split paths leading to loop backedges. This can improve dead code
8964 elimination and common subexpression elimination. This is enabled by
8965 default at @option{-O2} and above.
8966
8967 @item -fsplit-ivs-in-unroller
8968 @opindex fsplit-ivs-in-unroller
8969 Enables expression of values of induction variables in later iterations
8970 of the unrolled loop using the value in the first iteration. This breaks
8971 long dependency chains, thus improving efficiency of the scheduling passes.
8972
8973 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8974 same effect. However, that is not reliable in cases where the loop body
8975 is more complicated than a single basic block. It also does not work at all
8976 on some architectures due to restrictions in the CSE pass.
8977
8978 This optimization is enabled by default.
8979
8980 @item -fvariable-expansion-in-unroller
8981 @opindex fvariable-expansion-in-unroller
8982 With this option, the compiler creates multiple copies of some
8983 local variables when unrolling a loop, which can result in superior code.
8984
8985 @item -fpartial-inlining
8986 @opindex fpartial-inlining
8987 Inline parts of functions. This option has any effect only
8988 when inlining itself is turned on by the @option{-finline-functions}
8989 or @option{-finline-small-functions} options.
8990
8991 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8992
8993 @item -fpredictive-commoning
8994 @opindex fpredictive-commoning
8995 Perform predictive commoning optimization, i.e., reusing computations
8996 (especially memory loads and stores) performed in previous
8997 iterations of loops.
8998
8999 This option is enabled at level @option{-O3}.
9000
9001 @item -fprefetch-loop-arrays
9002 @opindex fprefetch-loop-arrays
9003 If supported by the target machine, generate instructions to prefetch
9004 memory to improve the performance of loops that access large arrays.
9005
9006 This option may generate better or worse code; results are highly
9007 dependent on the structure of loops within the source code.
9008
9009 Disabled at level @option{-Os}.
9010
9011 @item -fno-printf-return-value
9012 @opindex fno-printf-return-value
9013 Do not substitute constants for known return value of formatted output
9014 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9015 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9016 transformation allows GCC to optimize or even eliminate branches based
9017 on the known return value of these functions called with arguments that
9018 are either constant, or whose values are known to be in a range that
9019 makes determining the exact return value possible. For example, when
9020 @option{-fprintf-return-value} is in effect, both the branch and the
9021 body of the @code{if} statement (but not the call to @code{snprint})
9022 can be optimized away when @code{i} is a 32-bit or smaller integer
9023 because the return value is guaranteed to be at most 8.
9024
9025 @smallexample
9026 char buf[9];
9027 if (snprintf (buf, "%08x", i) >= sizeof buf)
9028 @dots{}
9029 @end smallexample
9030
9031 The @option{-fprintf-return-value} option relies on other optimizations
9032 and yields best results with @option{-O2} and above. It works in tandem
9033 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9034 options. The @option{-fprintf-return-value} option is enabled by default.
9035
9036 @item -fno-peephole
9037 @itemx -fno-peephole2
9038 @opindex fno-peephole
9039 @opindex fno-peephole2
9040 Disable any machine-specific peephole optimizations. The difference
9041 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9042 are implemented in the compiler; some targets use one, some use the
9043 other, a few use both.
9044
9045 @option{-fpeephole} is enabled by default.
9046 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9047
9048 @item -fno-guess-branch-probability
9049 @opindex fno-guess-branch-probability
9050 Do not guess branch probabilities using heuristics.
9051
9052 GCC uses heuristics to guess branch probabilities if they are
9053 not provided by profiling feedback (@option{-fprofile-arcs}). These
9054 heuristics are based on the control flow graph. If some branch probabilities
9055 are specified by @code{__builtin_expect}, then the heuristics are
9056 used to guess branch probabilities for the rest of the control flow graph,
9057 taking the @code{__builtin_expect} info into account. The interactions
9058 between the heuristics and @code{__builtin_expect} can be complex, and in
9059 some cases, it may be useful to disable the heuristics so that the effects
9060 of @code{__builtin_expect} are easier to understand.
9061
9062 The default is @option{-fguess-branch-probability} at levels
9063 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9064
9065 @item -freorder-blocks
9066 @opindex freorder-blocks
9067 Reorder basic blocks in the compiled function in order to reduce number of
9068 taken branches and improve code locality.
9069
9070 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9071
9072 @item -freorder-blocks-algorithm=@var{algorithm}
9073 @opindex freorder-blocks-algorithm
9074 Use the specified algorithm for basic block reordering. The
9075 @var{algorithm} argument can be @samp{simple}, which does not increase
9076 code size (except sometimes due to secondary effects like alignment),
9077 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9078 put all often executed code together, minimizing the number of branches
9079 executed by making extra copies of code.
9080
9081 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9082 @samp{stc} at levels @option{-O2}, @option{-O3}.
9083
9084 @item -freorder-blocks-and-partition
9085 @opindex freorder-blocks-and-partition
9086 In addition to reordering basic blocks in the compiled function, in order
9087 to reduce number of taken branches, partitions hot and cold basic blocks
9088 into separate sections of the assembly and @file{.o} files, to improve
9089 paging and cache locality performance.
9090
9091 This optimization is automatically turned off in the presence of
9092 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9093 section attribute and on any architecture that does not support named
9094 sections. When @option{-fsplit-stack} is used this option is not
9095 enabled by default (to avoid linker errors), but may be enabled
9096 explicitly (if using a working linker).
9097
9098 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9099
9100 @item -freorder-functions
9101 @opindex freorder-functions
9102 Reorder functions in the object file in order to
9103 improve code locality. This is implemented by using special
9104 subsections @code{.text.hot} for most frequently executed functions and
9105 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9106 the linker so object file format must support named sections and linker must
9107 place them in a reasonable way.
9108
9109 Also profile feedback must be available to make this option effective. See
9110 @option{-fprofile-arcs} for details.
9111
9112 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9113
9114 @item -fstrict-aliasing
9115 @opindex fstrict-aliasing
9116 Allow the compiler to assume the strictest aliasing rules applicable to
9117 the language being compiled. For C (and C++), this activates
9118 optimizations based on the type of expressions. In particular, an
9119 object of one type is assumed never to reside at the same address as an
9120 object of a different type, unless the types are almost the same. For
9121 example, an @code{unsigned int} can alias an @code{int}, but not a
9122 @code{void*} or a @code{double}. A character type may alias any other
9123 type.
9124
9125 @anchor{Type-punning}Pay special attention to code like this:
9126 @smallexample
9127 union a_union @{
9128 int i;
9129 double d;
9130 @};
9131
9132 int f() @{
9133 union a_union t;
9134 t.d = 3.0;
9135 return t.i;
9136 @}
9137 @end smallexample
9138 The practice of reading from a different union member than the one most
9139 recently written to (called ``type-punning'') is common. Even with
9140 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9141 is accessed through the union type. So, the code above works as
9142 expected. @xref{Structures unions enumerations and bit-fields
9143 implementation}. However, this code might not:
9144 @smallexample
9145 int f() @{
9146 union a_union t;
9147 int* ip;
9148 t.d = 3.0;
9149 ip = &t.i;
9150 return *ip;
9151 @}
9152 @end smallexample
9153
9154 Similarly, access by taking the address, casting the resulting pointer
9155 and dereferencing the result has undefined behavior, even if the cast
9156 uses a union type, e.g.:
9157 @smallexample
9158 int f() @{
9159 double d = 3.0;
9160 return ((union a_union *) &d)->i;
9161 @}
9162 @end smallexample
9163
9164 The @option{-fstrict-aliasing} option is enabled at levels
9165 @option{-O2}, @option{-O3}, @option{-Os}.
9166
9167 @item -falign-functions
9168 @itemx -falign-functions=@var{n}
9169 @opindex falign-functions
9170 Align the start of functions to the next power-of-two greater than
9171 @var{n}, skipping up to @var{n} bytes. For instance,
9172 @option{-falign-functions=32} aligns functions to the next 32-byte
9173 boundary, but @option{-falign-functions=24} aligns to the next
9174 32-byte boundary only if this can be done by skipping 23 bytes or less.
9175
9176 @option{-fno-align-functions} and @option{-falign-functions=1} are
9177 equivalent and mean that functions are not aligned.
9178
9179 Some assemblers only support this flag when @var{n} is a power of two;
9180 in that case, it is rounded up.
9181
9182 If @var{n} is not specified or is zero, use a machine-dependent default.
9183 The maximum allowed @var{n} option value is 65536.
9184
9185 Enabled at levels @option{-O2}, @option{-O3}.
9186
9187 @item -flimit-function-alignment
9188 If this option is enabled, the compiler tries to avoid unnecessarily
9189 overaligning functions. It attempts to instruct the assembler to align
9190 by the amount specified by @option{-falign-functions}, but not to
9191 skip more bytes than the size of the function.
9192
9193 @item -falign-labels
9194 @itemx -falign-labels=@var{n}
9195 @opindex falign-labels
9196 Align all branch targets to a power-of-two boundary, skipping up to
9197 @var{n} bytes like @option{-falign-functions}. This option can easily
9198 make code slower, because it must insert dummy operations for when the
9199 branch target is reached in the usual flow of the code.
9200
9201 @option{-fno-align-labels} and @option{-falign-labels=1} are
9202 equivalent and mean that labels are not aligned.
9203
9204 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9205 are greater than this value, then their values are used instead.
9206
9207 If @var{n} is not specified or is zero, use a machine-dependent default
9208 which is very likely to be @samp{1}, meaning no alignment.
9209 The maximum allowed @var{n} option value is 65536.
9210
9211 Enabled at levels @option{-O2}, @option{-O3}.
9212
9213 @item -falign-loops
9214 @itemx -falign-loops=@var{n}
9215 @opindex falign-loops
9216 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
9217 like @option{-falign-functions}. If the loops are
9218 executed many times, this makes up for any execution of the dummy
9219 operations.
9220
9221 @option{-fno-align-loops} and @option{-falign-loops=1} are
9222 equivalent and mean that loops are not aligned.
9223 The maximum allowed @var{n} option value is 65536.
9224
9225 If @var{n} is not specified or is zero, use a machine-dependent default.
9226
9227 Enabled at levels @option{-O2}, @option{-O3}.
9228
9229 @item -falign-jumps
9230 @itemx -falign-jumps=@var{n}
9231 @opindex falign-jumps
9232 Align branch targets to a power-of-two boundary, for branch targets
9233 where the targets can only be reached by jumping, skipping up to @var{n}
9234 bytes like @option{-falign-functions}. In this case, no dummy operations
9235 need be executed.
9236
9237 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9238 equivalent and mean that loops are not aligned.
9239
9240 If @var{n} is not specified or is zero, use a machine-dependent default.
9241 The maximum allowed @var{n} option value is 65536.
9242
9243 Enabled at levels @option{-O2}, @option{-O3}.
9244
9245 @item -funit-at-a-time
9246 @opindex funit-at-a-time
9247 This option is left for compatibility reasons. @option{-funit-at-a-time}
9248 has no effect, while @option{-fno-unit-at-a-time} implies
9249 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9250
9251 Enabled by default.
9252
9253 @item -fno-toplevel-reorder
9254 @opindex fno-toplevel-reorder
9255 Do not reorder top-level functions, variables, and @code{asm}
9256 statements. Output them in the same order that they appear in the
9257 input file. When this option is used, unreferenced static variables
9258 are not removed. This option is intended to support existing code
9259 that relies on a particular ordering. For new code, it is better to
9260 use attributes when possible.
9261
9262 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9263 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9264 targets.
9265
9266 @item -fweb
9267 @opindex fweb
9268 Constructs webs as commonly used for register allocation purposes and assign
9269 each web individual pseudo register. This allows the register allocation pass
9270 to operate on pseudos directly, but also strengthens several other optimization
9271 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9272 however, make debugging impossible, since variables no longer stay in a
9273 ``home register''.
9274
9275 Enabled by default with @option{-funroll-loops}.
9276
9277 @item -fwhole-program
9278 @opindex fwhole-program
9279 Assume that the current compilation unit represents the whole program being
9280 compiled. All public functions and variables with the exception of @code{main}
9281 and those merged by attribute @code{externally_visible} become static functions
9282 and in effect are optimized more aggressively by interprocedural optimizers.
9283
9284 This option should not be used in combination with @option{-flto}.
9285 Instead relying on a linker plugin should provide safer and more precise
9286 information.
9287
9288 @item -flto[=@var{n}]
9289 @opindex flto
9290 This option runs the standard link-time optimizer. When invoked
9291 with source code, it generates GIMPLE (one of GCC's internal
9292 representations) and writes it to special ELF sections in the object
9293 file. When the object files are linked together, all the function
9294 bodies are read from these ELF sections and instantiated as if they
9295 had been part of the same translation unit.
9296
9297 To use the link-time optimizer, @option{-flto} and optimization
9298 options should be specified at compile time and during the final link.
9299 It is recommended that you compile all the files participating in the
9300 same link with the same options and also specify those options at
9301 link time.
9302 For example:
9303
9304 @smallexample
9305 gcc -c -O2 -flto foo.c
9306 gcc -c -O2 -flto bar.c
9307 gcc -o myprog -flto -O2 foo.o bar.o
9308 @end smallexample
9309
9310 The first two invocations to GCC save a bytecode representation
9311 of GIMPLE into special ELF sections inside @file{foo.o} and
9312 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9313 @file{foo.o} and @file{bar.o}, merges the two files into a single
9314 internal image, and compiles the result as usual. Since both
9315 @file{foo.o} and @file{bar.o} are merged into a single image, this
9316 causes all the interprocedural analyses and optimizations in GCC to
9317 work across the two files as if they were a single one. This means,
9318 for example, that the inliner is able to inline functions in
9319 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9320
9321 Another (simpler) way to enable link-time optimization is:
9322
9323 @smallexample
9324 gcc -o myprog -flto -O2 foo.c bar.c
9325 @end smallexample
9326
9327 The above generates bytecode for @file{foo.c} and @file{bar.c},
9328 merges them together into a single GIMPLE representation and optimizes
9329 them as usual to produce @file{myprog}.
9330
9331 The only important thing to keep in mind is that to enable link-time
9332 optimizations you need to use the GCC driver to perform the link step.
9333 GCC then automatically performs link-time optimization if any of the
9334 objects involved were compiled with the @option{-flto} command-line option.
9335 You generally
9336 should specify the optimization options to be used for link-time
9337 optimization though GCC tries to be clever at guessing an
9338 optimization level to use from the options used at compile time
9339 if you fail to specify one at link time. You can always override
9340 the automatic decision to do link-time optimization
9341 by passing @option{-fno-lto} to the link command.
9342
9343 To make whole program optimization effective, it is necessary to make
9344 certain whole program assumptions. The compiler needs to know
9345 what functions and variables can be accessed by libraries and runtime
9346 outside of the link-time optimized unit. When supported by the linker,
9347 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9348 to the compiler about used and externally visible symbols. When
9349 the linker plugin is not available, @option{-fwhole-program} should be
9350 used to allow the compiler to make these assumptions, which leads
9351 to more aggressive optimization decisions.
9352
9353 When @option{-fuse-linker-plugin} is not enabled, when a file is
9354 compiled with @option{-flto}, the generated object file is larger than
9355 a regular object file because it contains GIMPLE bytecodes and the usual
9356 final code (see @option{-ffat-lto-objects}. This means that
9357 object files with LTO information can be linked as normal object
9358 files; if @option{-fno-lto} is passed to the linker, no
9359 interprocedural optimizations are applied. Note that when
9360 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9361 but you cannot perform a regular, non-LTO link on them.
9362
9363 Additionally, the optimization flags used to compile individual files
9364 are not necessarily related to those used at link time. For instance,
9365
9366 @smallexample
9367 gcc -c -O0 -ffat-lto-objects -flto foo.c
9368 gcc -c -O0 -ffat-lto-objects -flto bar.c
9369 gcc -o myprog -O3 foo.o bar.o
9370 @end smallexample
9371
9372 This produces individual object files with unoptimized assembler
9373 code, but the resulting binary @file{myprog} is optimized at
9374 @option{-O3}. If, instead, the final binary is generated with
9375 @option{-fno-lto}, then @file{myprog} is not optimized.
9376
9377 When producing the final binary, GCC only
9378 applies link-time optimizations to those files that contain bytecode.
9379 Therefore, you can mix and match object files and libraries with
9380 GIMPLE bytecodes and final object code. GCC automatically selects
9381 which files to optimize in LTO mode and which files to link without
9382 further processing.
9383
9384 There are some code generation flags preserved by GCC when
9385 generating bytecodes, as they need to be used during the final link
9386 stage. Generally options specified at link time override those
9387 specified at compile time.
9388
9389 If you do not specify an optimization level option @option{-O} at
9390 link time, then GCC uses the highest optimization level
9391 used when compiling the object files.
9392
9393 Currently, the following options and their settings are taken from
9394 the first object file that explicitly specifies them:
9395 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9396 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9397 and all the @option{-m} target flags.
9398
9399 Certain ABI-changing flags are required to match in all compilation units,
9400 and trying to override this at link time with a conflicting value
9401 is ignored. This includes options such as @option{-freg-struct-return}
9402 and @option{-fpcc-struct-return}.
9403
9404 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9405 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9406 are passed through to the link stage and merged conservatively for
9407 conflicting translation units. Specifically
9408 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9409 precedence; and for example @option{-ffp-contract=off} takes precedence
9410 over @option{-ffp-contract=fast}. You can override them at link time.
9411
9412 If LTO encounters objects with C linkage declared with incompatible
9413 types in separate translation units to be linked together (undefined
9414 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9415 issued. The behavior is still undefined at run time. Similar
9416 diagnostics may be raised for other languages.
9417
9418 Another feature of LTO is that it is possible to apply interprocedural
9419 optimizations on files written in different languages:
9420
9421 @smallexample
9422 gcc -c -flto foo.c
9423 g++ -c -flto bar.cc
9424 gfortran -c -flto baz.f90
9425 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9426 @end smallexample
9427
9428 Notice that the final link is done with @command{g++} to get the C++
9429 runtime libraries and @option{-lgfortran} is added to get the Fortran
9430 runtime libraries. In general, when mixing languages in LTO mode, you
9431 should use the same link command options as when mixing languages in a
9432 regular (non-LTO) compilation.
9433
9434 If object files containing GIMPLE bytecode are stored in a library archive, say
9435 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9436 are using a linker with plugin support. To create static libraries suitable
9437 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9438 and @command{ranlib};
9439 to show the symbols of object files with GIMPLE bytecode, use
9440 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9441 and @command{nm} have been compiled with plugin support. At link time, use the the
9442 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9443 the LTO optimization process:
9444
9445 @smallexample
9446 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9447 @end smallexample
9448
9449 With the linker plugin enabled, the linker extracts the needed
9450 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9451 to make them part of the aggregated GIMPLE image to be optimized.
9452
9453 If you are not using a linker with plugin support and/or do not
9454 enable the linker plugin, then the objects inside @file{libfoo.a}
9455 are extracted and linked as usual, but they do not participate
9456 in the LTO optimization process. In order to make a static library suitable
9457 for both LTO optimization and usual linkage, compile its object files with
9458 @option{-flto} @option{-ffat-lto-objects}.
9459
9460 Link-time optimizations do not require the presence of the whole program to
9461 operate. If the program does not require any symbols to be exported, it is
9462 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9463 the interprocedural optimizers to use more aggressive assumptions which may
9464 lead to improved optimization opportunities.
9465 Use of @option{-fwhole-program} is not needed when linker plugin is
9466 active (see @option{-fuse-linker-plugin}).
9467
9468 The current implementation of LTO makes no
9469 attempt to generate bytecode that is portable between different
9470 types of hosts. The bytecode files are versioned and there is a
9471 strict version check, so bytecode files generated in one version of
9472 GCC do not work with an older or newer version of GCC.
9473
9474 Link-time optimization does not work well with generation of debugging
9475 information on systems other than those using a combination of ELF and
9476 DWARF.
9477
9478 If you specify the optional @var{n}, the optimization and code
9479 generation done at link time is executed in parallel using @var{n}
9480 parallel jobs by utilizing an installed @command{make} program. The
9481 environment variable @env{MAKE} may be used to override the program
9482 used. The default value for @var{n} is 1.
9483
9484 You can also specify @option{-flto=jobserver} to use GNU make's
9485 job server mode to determine the number of parallel jobs. This
9486 is useful when the Makefile calling GCC is already executing in parallel.
9487 You must prepend a @samp{+} to the command recipe in the parent Makefile
9488 for this to work. This option likely only works if @env{MAKE} is
9489 GNU make.
9490
9491 @item -flto-partition=@var{alg}
9492 @opindex flto-partition
9493 Specify the partitioning algorithm used by the link-time optimizer.
9494 The value is either @samp{1to1} to specify a partitioning mirroring
9495 the original source files or @samp{balanced} to specify partitioning
9496 into equally sized chunks (whenever possible) or @samp{max} to create
9497 new partition for every symbol where possible. Specifying @samp{none}
9498 as an algorithm disables partitioning and streaming completely.
9499 The default value is @samp{balanced}. While @samp{1to1} can be used
9500 as an workaround for various code ordering issues, the @samp{max}
9501 partitioning is intended for internal testing only.
9502 The value @samp{one} specifies that exactly one partition should be
9503 used while the value @samp{none} bypasses partitioning and executes
9504 the link-time optimization step directly from the WPA phase.
9505
9506 @item -flto-odr-type-merging
9507 @opindex flto-odr-type-merging
9508 Enable streaming of mangled types names of C++ types and their unification
9509 at link time. This increases size of LTO object files, but enables
9510 diagnostics about One Definition Rule violations.
9511
9512 @item -flto-compression-level=@var{n}
9513 @opindex flto-compression-level
9514 This option specifies the level of compression used for intermediate
9515 language written to LTO object files, and is only meaningful in
9516 conjunction with LTO mode (@option{-flto}). Valid
9517 values are 0 (no compression) to 9 (maximum compression). Values
9518 outside this range are clamped to either 0 or 9. If the option is not
9519 given, a default balanced compression setting is used.
9520
9521 @item -fuse-linker-plugin
9522 @opindex fuse-linker-plugin
9523 Enables the use of a linker plugin during link-time optimization. This
9524 option relies on plugin support in the linker, which is available in gold
9525 or in GNU ld 2.21 or newer.
9526
9527 This option enables the extraction of object files with GIMPLE bytecode out
9528 of library archives. This improves the quality of optimization by exposing
9529 more code to the link-time optimizer. This information specifies what
9530 symbols can be accessed externally (by non-LTO object or during dynamic
9531 linking). Resulting code quality improvements on binaries (and shared
9532 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9533 See @option{-flto} for a description of the effect of this flag and how to
9534 use it.
9535
9536 This option is enabled by default when LTO support in GCC is enabled
9537 and GCC was configured for use with
9538 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9539
9540 @item -ffat-lto-objects
9541 @opindex ffat-lto-objects
9542 Fat LTO objects are object files that contain both the intermediate language
9543 and the object code. This makes them usable for both LTO linking and normal
9544 linking. This option is effective only when compiling with @option{-flto}
9545 and is ignored at link time.
9546
9547 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9548 requires the complete toolchain to be aware of LTO. It requires a linker with
9549 linker plugin support for basic functionality. Additionally,
9550 @command{nm}, @command{ar} and @command{ranlib}
9551 need to support linker plugins to allow a full-featured build environment
9552 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9553 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9554 to these tools. With non fat LTO makefiles need to be modified to use them.
9555
9556 Note that modern binutils provide plugin auto-load mechanism.
9557 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
9558 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
9559 @command{gcc-ranlib}).
9560
9561 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9562 support.
9563
9564 @item -fcompare-elim
9565 @opindex fcompare-elim
9566 After register allocation and post-register allocation instruction splitting,
9567 identify arithmetic instructions that compute processor flags similar to a
9568 comparison operation based on that arithmetic. If possible, eliminate the
9569 explicit comparison operation.
9570
9571 This pass only applies to certain targets that cannot explicitly represent
9572 the comparison operation before register allocation is complete.
9573
9574 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9575
9576 @item -fcprop-registers
9577 @opindex fcprop-registers
9578 After register allocation and post-register allocation instruction splitting,
9579 perform a copy-propagation pass to try to reduce scheduling dependencies
9580 and occasionally eliminate the copy.
9581
9582 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9583
9584 @item -fprofile-correction
9585 @opindex fprofile-correction
9586 Profiles collected using an instrumented binary for multi-threaded programs may
9587 be inconsistent due to missed counter updates. When this option is specified,
9588 GCC uses heuristics to correct or smooth out such inconsistencies. By
9589 default, GCC emits an error message when an inconsistent profile is detected.
9590
9591 @item -fprofile-use
9592 @itemx -fprofile-use=@var{path}
9593 @opindex fprofile-use
9594 Enable profile feedback-directed optimizations,
9595 and the following optimizations
9596 which are generally profitable only with profile feedback available:
9597 @option{-fbranch-probabilities}, @option{-fvpt},
9598 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9599 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9600
9601 Before you can use this option, you must first generate profiling information.
9602 @xref{Instrumentation Options}, for information about the
9603 @option{-fprofile-generate} option.
9604
9605 By default, GCC emits an error message if the feedback profiles do not
9606 match the source code. This error can be turned into a warning by using
9607 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9608 code.
9609
9610 If @var{path} is specified, GCC looks at the @var{path} to find
9611 the profile feedback data files. See @option{-fprofile-dir}.
9612
9613 @item -fauto-profile
9614 @itemx -fauto-profile=@var{path}
9615 @opindex fauto-profile
9616 Enable sampling-based feedback-directed optimizations,
9617 and the following optimizations
9618 which are generally profitable only with profile feedback available:
9619 @option{-fbranch-probabilities}, @option{-fvpt},
9620 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9621 @option{-ftree-vectorize},
9622 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9623 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9624 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9625
9626 @var{path} is the name of a file containing AutoFDO profile information.
9627 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9628
9629 Producing an AutoFDO profile data file requires running your program
9630 with the @command{perf} utility on a supported GNU/Linux target system.
9631 For more information, see @uref{https://perf.wiki.kernel.org/}.
9632
9633 E.g.
9634 @smallexample
9635 perf record -e br_inst_retired:near_taken -b -o perf.data \
9636 -- your_program
9637 @end smallexample
9638
9639 Then use the @command{create_gcov} tool to convert the raw profile data
9640 to a format that can be used by GCC.@ You must also supply the
9641 unstripped binary for your program to this tool.
9642 See @uref{https://github.com/google/autofdo}.
9643
9644 E.g.
9645 @smallexample
9646 create_gcov --binary=your_program.unstripped --profile=perf.data \
9647 --gcov=profile.afdo
9648 @end smallexample
9649 @end table
9650
9651 The following options control compiler behavior regarding floating-point
9652 arithmetic. These options trade off between speed and
9653 correctness. All must be specifically enabled.
9654
9655 @table @gcctabopt
9656 @item -ffloat-store
9657 @opindex ffloat-store
9658 Do not store floating-point variables in registers, and inhibit other
9659 options that might change whether a floating-point value is taken from a
9660 register or memory.
9661
9662 @cindex floating-point precision
9663 This option prevents undesirable excess precision on machines such as
9664 the 68000 where the floating registers (of the 68881) keep more
9665 precision than a @code{double} is supposed to have. Similarly for the
9666 x86 architecture. For most programs, the excess precision does only
9667 good, but a few programs rely on the precise definition of IEEE floating
9668 point. Use @option{-ffloat-store} for such programs, after modifying
9669 them to store all pertinent intermediate computations into variables.
9670
9671 @item -fexcess-precision=@var{style}
9672 @opindex fexcess-precision
9673 This option allows further control over excess precision on machines
9674 where floating-point operations occur in a format with more precision or
9675 range than the IEEE standard and interchange floating-point types. By
9676 default, @option{-fexcess-precision=fast} is in effect; this means that
9677 operations may be carried out in a wider precision than the types specified
9678 in the source if that would result in faster code, and it is unpredictable
9679 when rounding to the types specified in the source code takes place.
9680 When compiling C, if @option{-fexcess-precision=standard} is specified then
9681 excess precision follows the rules specified in ISO C99; in particular,
9682 both casts and assignments cause values to be rounded to their
9683 semantic types (whereas @option{-ffloat-store} only affects
9684 assignments). This option is enabled by default for C if a strict
9685 conformance option such as @option{-std=c99} is used.
9686 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9687 regardless of whether a strict conformance option is used.
9688
9689 @opindex mfpmath
9690 @option{-fexcess-precision=standard} is not implemented for languages
9691 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9692 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9693 semantics apply without excess precision, and in the latter, rounding
9694 is unpredictable.
9695
9696 @item -ffast-math
9697 @opindex ffast-math
9698 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9699 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9700 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9701 @option{-fexcess-precision=fast}.
9702
9703 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9704
9705 This option is not turned on by any @option{-O} option besides
9706 @option{-Ofast} since it can result in incorrect output for programs
9707 that depend on an exact implementation of IEEE or ISO rules/specifications
9708 for math functions. It may, however, yield faster code for programs
9709 that do not require the guarantees of these specifications.
9710
9711 @item -fno-math-errno
9712 @opindex fno-math-errno
9713 Do not set @code{errno} after calling math functions that are executed
9714 with a single instruction, e.g., @code{sqrt}. A program that relies on
9715 IEEE exceptions for math error handling may want to use this flag
9716 for speed while maintaining IEEE arithmetic compatibility.
9717
9718 This option is not turned on by any @option{-O} option since
9719 it can result in incorrect output for programs that depend on
9720 an exact implementation of IEEE or ISO rules/specifications for
9721 math functions. It may, however, yield faster code for programs
9722 that do not require the guarantees of these specifications.
9723
9724 The default is @option{-fmath-errno}.
9725
9726 On Darwin systems, the math library never sets @code{errno}. There is
9727 therefore no reason for the compiler to consider the possibility that
9728 it might, and @option{-fno-math-errno} is the default.
9729
9730 @item -funsafe-math-optimizations
9731 @opindex funsafe-math-optimizations
9732
9733 Allow optimizations for floating-point arithmetic that (a) assume
9734 that arguments and results are valid and (b) may violate IEEE or
9735 ANSI standards. When used at link time, it may include libraries
9736 or startup files that change the default FPU control word or other
9737 similar optimizations.
9738
9739 This option is not turned on by any @option{-O} option since
9740 it can result in incorrect output for programs that depend on
9741 an exact implementation of IEEE or ISO rules/specifications for
9742 math functions. It may, however, yield faster code for programs
9743 that do not require the guarantees of these specifications.
9744 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9745 @option{-fassociative-math} and @option{-freciprocal-math}.
9746
9747 The default is @option{-fno-unsafe-math-optimizations}.
9748
9749 @item -fassociative-math
9750 @opindex fassociative-math
9751
9752 Allow re-association of operands in series of floating-point operations.
9753 This violates the ISO C and C++ language standard by possibly changing
9754 computation result. NOTE: re-ordering may change the sign of zero as
9755 well as ignore NaNs and inhibit or create underflow or overflow (and
9756 thus cannot be used on code that relies on rounding behavior like
9757 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9758 and thus may not be used when ordered comparisons are required.
9759 This option requires that both @option{-fno-signed-zeros} and
9760 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9761 much sense with @option{-frounding-math}. For Fortran the option
9762 is automatically enabled when both @option{-fno-signed-zeros} and
9763 @option{-fno-trapping-math} are in effect.
9764
9765 The default is @option{-fno-associative-math}.
9766
9767 @item -freciprocal-math
9768 @opindex freciprocal-math
9769
9770 Allow the reciprocal of a value to be used instead of dividing by
9771 the value if this enables optimizations. For example @code{x / y}
9772 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9773 is subject to common subexpression elimination. Note that this loses
9774 precision and increases the number of flops operating on the value.
9775
9776 The default is @option{-fno-reciprocal-math}.
9777
9778 @item -ffinite-math-only
9779 @opindex ffinite-math-only
9780 Allow optimizations for floating-point arithmetic that assume
9781 that arguments and results are not NaNs or +-Infs.
9782
9783 This option is not turned on by any @option{-O} option since
9784 it can result in incorrect output for programs that depend on
9785 an exact implementation of IEEE or ISO rules/specifications for
9786 math functions. It may, however, yield faster code for programs
9787 that do not require the guarantees of these specifications.
9788
9789 The default is @option{-fno-finite-math-only}.
9790
9791 @item -fno-signed-zeros
9792 @opindex fno-signed-zeros
9793 Allow optimizations for floating-point arithmetic that ignore the
9794 signedness of zero. IEEE arithmetic specifies the behavior of
9795 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9796 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9797 This option implies that the sign of a zero result isn't significant.
9798
9799 The default is @option{-fsigned-zeros}.
9800
9801 @item -fno-trapping-math
9802 @opindex fno-trapping-math
9803 Compile code assuming that floating-point operations cannot generate
9804 user-visible traps. These traps include division by zero, overflow,
9805 underflow, inexact result and invalid operation. This option requires
9806 that @option{-fno-signaling-nans} be in effect. Setting this option may
9807 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9808
9809 This option should never be turned on by any @option{-O} option since
9810 it can result in incorrect output for programs that depend on
9811 an exact implementation of IEEE or ISO rules/specifications for
9812 math functions.
9813
9814 The default is @option{-ftrapping-math}.
9815
9816 @item -frounding-math
9817 @opindex frounding-math
9818 Disable transformations and optimizations that assume default floating-point
9819 rounding behavior. This is round-to-zero for all floating point
9820 to integer conversions, and round-to-nearest for all other arithmetic
9821 truncations. This option should be specified for programs that change
9822 the FP rounding mode dynamically, or that may be executed with a
9823 non-default rounding mode. This option disables constant folding of
9824 floating-point expressions at compile time (which may be affected by
9825 rounding mode) and arithmetic transformations that are unsafe in the
9826 presence of sign-dependent rounding modes.
9827
9828 The default is @option{-fno-rounding-math}.
9829
9830 This option is experimental and does not currently guarantee to
9831 disable all GCC optimizations that are affected by rounding mode.
9832 Future versions of GCC may provide finer control of this setting
9833 using C99's @code{FENV_ACCESS} pragma. This command-line option
9834 will be used to specify the default state for @code{FENV_ACCESS}.
9835
9836 @item -fsignaling-nans
9837 @opindex fsignaling-nans
9838 Compile code assuming that IEEE signaling NaNs may generate user-visible
9839 traps during floating-point operations. Setting this option disables
9840 optimizations that may change the number of exceptions visible with
9841 signaling NaNs. This option implies @option{-ftrapping-math}.
9842
9843 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9844 be defined.
9845
9846 The default is @option{-fno-signaling-nans}.
9847
9848 This option is experimental and does not currently guarantee to
9849 disable all GCC optimizations that affect signaling NaN behavior.
9850
9851 @item -fno-fp-int-builtin-inexact
9852 @opindex fno-fp-int-builtin-inexact
9853 Do not allow the built-in functions @code{ceil}, @code{floor},
9854 @code{round} and @code{trunc}, and their @code{float} and @code{long
9855 double} variants, to generate code that raises the ``inexact''
9856 floating-point exception for noninteger arguments. ISO C99 and C11
9857 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9858 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9859 functions to do so.
9860
9861 The default is @option{-ffp-int-builtin-inexact}, allowing the
9862 exception to be raised. This option does nothing unless
9863 @option{-ftrapping-math} is in effect.
9864
9865 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9866 generate a call to a library function then the ``inexact'' exception
9867 may be raised if the library implementation does not follow TS 18661.
9868
9869 @item -fsingle-precision-constant
9870 @opindex fsingle-precision-constant
9871 Treat floating-point constants as single precision instead of
9872 implicitly converting them to double-precision constants.
9873
9874 @item -fcx-limited-range
9875 @opindex fcx-limited-range
9876 When enabled, this option states that a range reduction step is not
9877 needed when performing complex division. Also, there is no checking
9878 whether the result of a complex multiplication or division is @code{NaN
9879 + I*NaN}, with an attempt to rescue the situation in that case. The
9880 default is @option{-fno-cx-limited-range}, but is enabled by
9881 @option{-ffast-math}.
9882
9883 This option controls the default setting of the ISO C99
9884 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9885 all languages.
9886
9887 @item -fcx-fortran-rules
9888 @opindex fcx-fortran-rules
9889 Complex multiplication and division follow Fortran rules. Range
9890 reduction is done as part of complex division, but there is no checking
9891 whether the result of a complex multiplication or division is @code{NaN
9892 + I*NaN}, with an attempt to rescue the situation in that case.
9893
9894 The default is @option{-fno-cx-fortran-rules}.
9895
9896 @end table
9897
9898 The following options control optimizations that may improve
9899 performance, but are not enabled by any @option{-O} options. This
9900 section includes experimental options that may produce broken code.
9901
9902 @table @gcctabopt
9903 @item -fbranch-probabilities
9904 @opindex fbranch-probabilities
9905 After running a program compiled with @option{-fprofile-arcs}
9906 (@pxref{Instrumentation Options}),
9907 you can compile it a second time using
9908 @option{-fbranch-probabilities}, to improve optimizations based on
9909 the number of times each branch was taken. When a program
9910 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9911 counts to a file called @file{@var{sourcename}.gcda} for each source
9912 file. The information in this data file is very dependent on the
9913 structure of the generated code, so you must use the same source code
9914 and the same optimization options for both compilations.
9915
9916 With @option{-fbranch-probabilities}, GCC puts a
9917 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9918 These can be used to improve optimization. Currently, they are only
9919 used in one place: in @file{reorg.c}, instead of guessing which path a
9920 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9921 exactly determine which path is taken more often.
9922
9923 @item -fprofile-values
9924 @opindex fprofile-values
9925 If combined with @option{-fprofile-arcs}, it adds code so that some
9926 data about values of expressions in the program is gathered.
9927
9928 With @option{-fbranch-probabilities}, it reads back the data gathered
9929 from profiling values of expressions for usage in optimizations.
9930
9931 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9932
9933 @item -fprofile-reorder-functions
9934 @opindex fprofile-reorder-functions
9935 Function reordering based on profile instrumentation collects
9936 first time of execution of a function and orders these functions
9937 in ascending order.
9938
9939 Enabled with @option{-fprofile-use}.
9940
9941 @item -fvpt
9942 @opindex fvpt
9943 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9944 to add code to gather information about values of expressions.
9945
9946 With @option{-fbranch-probabilities}, it reads back the data gathered
9947 and actually performs the optimizations based on them.
9948 Currently the optimizations include specialization of division operations
9949 using the knowledge about the value of the denominator.
9950
9951 @item -frename-registers
9952 @opindex frename-registers
9953 Attempt to avoid false dependencies in scheduled code by making use
9954 of registers left over after register allocation. This optimization
9955 most benefits processors with lots of registers. Depending on the
9956 debug information format adopted by the target, however, it can
9957 make debugging impossible, since variables no longer stay in
9958 a ``home register''.
9959
9960 Enabled by default with @option{-funroll-loops}.
9961
9962 @item -fschedule-fusion
9963 @opindex fschedule-fusion
9964 Performs a target dependent pass over the instruction stream to schedule
9965 instructions of same type together because target machine can execute them
9966 more efficiently if they are adjacent to each other in the instruction flow.
9967
9968 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9969
9970 @item -ftracer
9971 @opindex ftracer
9972 Perform tail duplication to enlarge superblock size. This transformation
9973 simplifies the control flow of the function allowing other optimizations to do
9974 a better job.
9975
9976 Enabled with @option{-fprofile-use}.
9977
9978 @item -funroll-loops
9979 @opindex funroll-loops
9980 Unroll loops whose number of iterations can be determined at compile time or
9981 upon entry to the loop. @option{-funroll-loops} implies
9982 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9983 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9984 a small constant number of iterations). This option makes code larger, and may
9985 or may not make it run faster.
9986
9987 Enabled with @option{-fprofile-use}.
9988
9989 @item -funroll-all-loops
9990 @opindex funroll-all-loops
9991 Unroll all loops, even if their number of iterations is uncertain when
9992 the loop is entered. This usually makes programs run more slowly.
9993 @option{-funroll-all-loops} implies the same options as
9994 @option{-funroll-loops}.
9995
9996 @item -fpeel-loops
9997 @opindex fpeel-loops
9998 Peels loops for which there is enough information that they do not
9999 roll much (from profile feedback or static analysis). It also turns on
10000 complete loop peeling (i.e.@: complete removal of loops with small constant
10001 number of iterations).
10002
10003 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10004
10005 @item -fmove-loop-invariants
10006 @opindex fmove-loop-invariants
10007 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10008 at level @option{-O1}
10009
10010 @item -fsplit-loops
10011 @opindex fsplit-loops
10012 Split a loop into two if it contains a condition that's always true
10013 for one side of the iteration space and false for the other.
10014
10015 @item -funswitch-loops
10016 @opindex funswitch-loops
10017 Move branches with loop invariant conditions out of the loop, with duplicates
10018 of the loop on both branches (modified according to result of the condition).
10019
10020 @item -ffunction-sections
10021 @itemx -fdata-sections
10022 @opindex ffunction-sections
10023 @opindex fdata-sections
10024 Place each function or data item into its own section in the output
10025 file if the target supports arbitrary sections. The name of the
10026 function or the name of the data item determines the section's name
10027 in the output file.
10028
10029 Use these options on systems where the linker can perform optimizations to
10030 improve locality of reference in the instruction space. Most systems using the
10031 ELF object format have linkers with such optimizations. On AIX, the linker
10032 rearranges sections (CSECTs) based on the call graph. The performance impact
10033 varies.
10034
10035 Together with a linker garbage collection (linker @option{--gc-sections}
10036 option) these options may lead to smaller statically-linked executables (after
10037 stripping).
10038
10039 On ELF/DWARF systems these options do not degenerate the quality of the debug
10040 information. There could be issues with other object files/debug info formats.
10041
10042 Only use these options when there are significant benefits from doing so. When
10043 you specify these options, the assembler and linker create larger object and
10044 executable files and are also slower. These options affect code generation.
10045 They prevent optimizations by the compiler and assembler using relative
10046 locations inside a translation unit since the locations are unknown until
10047 link time. An example of such an optimization is relaxing calls to short call
10048 instructions.
10049
10050 @item -fbranch-target-load-optimize
10051 @opindex fbranch-target-load-optimize
10052 Perform branch target register load optimization before prologue / epilogue
10053 threading.
10054 The use of target registers can typically be exposed only during reload,
10055 thus hoisting loads out of loops and doing inter-block scheduling needs
10056 a separate optimization pass.
10057
10058 @item -fbranch-target-load-optimize2
10059 @opindex fbranch-target-load-optimize2
10060 Perform branch target register load optimization after prologue / epilogue
10061 threading.
10062
10063 @item -fbtr-bb-exclusive
10064 @opindex fbtr-bb-exclusive
10065 When performing branch target register load optimization, don't reuse
10066 branch target registers within any basic block.
10067
10068 @item -fstdarg-opt
10069 @opindex fstdarg-opt
10070 Optimize the prologue of variadic argument functions with respect to usage of
10071 those arguments.
10072
10073 @item -fsection-anchors
10074 @opindex fsection-anchors
10075 Try to reduce the number of symbolic address calculations by using
10076 shared ``anchor'' symbols to address nearby objects. This transformation
10077 can help to reduce the number of GOT entries and GOT accesses on some
10078 targets.
10079
10080 For example, the implementation of the following function @code{foo}:
10081
10082 @smallexample
10083 static int a, b, c;
10084 int foo (void) @{ return a + b + c; @}
10085 @end smallexample
10086
10087 @noindent
10088 usually calculates the addresses of all three variables, but if you
10089 compile it with @option{-fsection-anchors}, it accesses the variables
10090 from a common anchor point instead. The effect is similar to the
10091 following pseudocode (which isn't valid C):
10092
10093 @smallexample
10094 int foo (void)
10095 @{
10096 register int *xr = &x;
10097 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10098 @}
10099 @end smallexample
10100
10101 Not all targets support this option.
10102
10103 @item --param @var{name}=@var{value}
10104 @opindex param
10105 In some places, GCC uses various constants to control the amount of
10106 optimization that is done. For example, GCC does not inline functions
10107 that contain more than a certain number of instructions. You can
10108 control some of these constants on the command line using the
10109 @option{--param} option.
10110
10111 The names of specific parameters, and the meaning of the values, are
10112 tied to the internals of the compiler, and are subject to change
10113 without notice in future releases.
10114
10115 In each case, the @var{value} is an integer. The allowable choices for
10116 @var{name} are:
10117
10118 @table @gcctabopt
10119 @item predictable-branch-outcome
10120 When branch is predicted to be taken with probability lower than this threshold
10121 (in percent), then it is considered well predictable. The default is 10.
10122
10123 @item max-rtl-if-conversion-insns
10124 RTL if-conversion tries to remove conditional branches around a block and
10125 replace them with conditionally executed instructions. This parameter
10126 gives the maximum number of instructions in a block which should be
10127 considered for if-conversion. The default is 10, though the compiler will
10128 also use other heuristics to decide whether if-conversion is likely to be
10129 profitable.
10130
10131 @item max-rtl-if-conversion-predictable-cost
10132 @itemx max-rtl-if-conversion-unpredictable-cost
10133 RTL if-conversion will try to remove conditional branches around a block
10134 and replace them with conditionally executed instructions. These parameters
10135 give the maximum permissible cost for the sequence that would be generated
10136 by if-conversion depending on whether the branch is statically determined
10137 to be predictable or not. The units for this parameter are the same as
10138 those for the GCC internal seq_cost metric. The compiler will try to
10139 provide a reasonable default for this parameter using the BRANCH_COST
10140 target macro.
10141
10142 @item max-crossjump-edges
10143 The maximum number of incoming edges to consider for cross-jumping.
10144 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10145 the number of edges incoming to each block. Increasing values mean
10146 more aggressive optimization, making the compilation time increase with
10147 probably small improvement in executable size.
10148
10149 @item min-crossjump-insns
10150 The minimum number of instructions that must be matched at the end
10151 of two blocks before cross-jumping is performed on them. This
10152 value is ignored in the case where all instructions in the block being
10153 cross-jumped from are matched. The default value is 5.
10154
10155 @item max-grow-copy-bb-insns
10156 The maximum code size expansion factor when copying basic blocks
10157 instead of jumping. The expansion is relative to a jump instruction.
10158 The default value is 8.
10159
10160 @item max-goto-duplication-insns
10161 The maximum number of instructions to duplicate to a block that jumps
10162 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10163 passes, GCC factors computed gotos early in the compilation process,
10164 and unfactors them as late as possible. Only computed jumps at the
10165 end of a basic blocks with no more than max-goto-duplication-insns are
10166 unfactored. The default value is 8.
10167
10168 @item max-delay-slot-insn-search
10169 The maximum number of instructions to consider when looking for an
10170 instruction to fill a delay slot. If more than this arbitrary number of
10171 instructions are searched, the time savings from filling the delay slot
10172 are minimal, so stop searching. Increasing values mean more
10173 aggressive optimization, making the compilation time increase with probably
10174 small improvement in execution time.
10175
10176 @item max-delay-slot-live-search
10177 When trying to fill delay slots, the maximum number of instructions to
10178 consider when searching for a block with valid live register
10179 information. Increasing this arbitrarily chosen value means more
10180 aggressive optimization, increasing the compilation time. This parameter
10181 should be removed when the delay slot code is rewritten to maintain the
10182 control-flow graph.
10183
10184 @item max-gcse-memory
10185 The approximate maximum amount of memory that can be allocated in
10186 order to perform the global common subexpression elimination
10187 optimization. If more memory than specified is required, the
10188 optimization is not done.
10189
10190 @item max-gcse-insertion-ratio
10191 If the ratio of expression insertions to deletions is larger than this value
10192 for any expression, then RTL PRE inserts or removes the expression and thus
10193 leaves partially redundant computations in the instruction stream. The default value is 20.
10194
10195 @item max-pending-list-length
10196 The maximum number of pending dependencies scheduling allows
10197 before flushing the current state and starting over. Large functions
10198 with few branches or calls can create excessively large lists which
10199 needlessly consume memory and resources.
10200
10201 @item max-modulo-backtrack-attempts
10202 The maximum number of backtrack attempts the scheduler should make
10203 when modulo scheduling a loop. Larger values can exponentially increase
10204 compilation time.
10205
10206 @item max-inline-insns-single
10207 Several parameters control the tree inliner used in GCC@.
10208 This number sets the maximum number of instructions (counted in GCC's
10209 internal representation) in a single function that the tree inliner
10210 considers for inlining. This only affects functions declared
10211 inline and methods implemented in a class declaration (C++).
10212 The default value is 400.
10213
10214 @item max-inline-insns-auto
10215 When you use @option{-finline-functions} (included in @option{-O3}),
10216 a lot of functions that would otherwise not be considered for inlining
10217 by the compiler are investigated. To those functions, a different
10218 (more restrictive) limit compared to functions declared inline can
10219 be applied.
10220 The default value is 30.
10221
10222 @item inline-min-speedup
10223 When estimated performance improvement of caller + callee runtime exceeds this
10224 threshold (in percent), the function can be inlined regardless of the limit on
10225 @option{--param max-inline-insns-single} and @option{--param
10226 max-inline-insns-auto}.
10227 The default value is 15.
10228
10229 @item large-function-insns
10230 The limit specifying really large functions. For functions larger than this
10231 limit after inlining, inlining is constrained by
10232 @option{--param large-function-growth}. This parameter is useful primarily
10233 to avoid extreme compilation time caused by non-linear algorithms used by the
10234 back end.
10235 The default value is 2700.
10236
10237 @item large-function-growth
10238 Specifies maximal growth of large function caused by inlining in percents.
10239 The default value is 100 which limits large function growth to 2.0 times
10240 the original size.
10241
10242 @item large-unit-insns
10243 The limit specifying large translation unit. Growth caused by inlining of
10244 units larger than this limit is limited by @option{--param inline-unit-growth}.
10245 For small units this might be too tight.
10246 For example, consider a unit consisting of function A
10247 that is inline and B that just calls A three times. If B is small relative to
10248 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10249 large units consisting of small inlineable functions, however, the overall unit
10250 growth limit is needed to avoid exponential explosion of code size. Thus for
10251 smaller units, the size is increased to @option{--param large-unit-insns}
10252 before applying @option{--param inline-unit-growth}. The default is 10000.
10253
10254 @item inline-unit-growth
10255 Specifies maximal overall growth of the compilation unit caused by inlining.
10256 The default value is 20 which limits unit growth to 1.2 times the original
10257 size. Cold functions (either marked cold via an attribute or by profile
10258 feedback) are not accounted into the unit size.
10259
10260 @item ipcp-unit-growth
10261 Specifies maximal overall growth of the compilation unit caused by
10262 interprocedural constant propagation. The default value is 10 which limits
10263 unit growth to 1.1 times the original size.
10264
10265 @item large-stack-frame
10266 The limit specifying large stack frames. While inlining the algorithm is trying
10267 to not grow past this limit too much. The default value is 256 bytes.
10268
10269 @item large-stack-frame-growth
10270 Specifies maximal growth of large stack frames caused by inlining in percents.
10271 The default value is 1000 which limits large stack frame growth to 11 times
10272 the original size.
10273
10274 @item max-inline-insns-recursive
10275 @itemx max-inline-insns-recursive-auto
10276 Specifies the maximum number of instructions an out-of-line copy of a
10277 self-recursive inline
10278 function can grow into by performing recursive inlining.
10279
10280 @option{--param max-inline-insns-recursive} applies to functions
10281 declared inline.
10282 For functions not declared inline, recursive inlining
10283 happens only when @option{-finline-functions} (included in @option{-O3}) is
10284 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10285 default value is 450.
10286
10287 @item max-inline-recursive-depth
10288 @itemx max-inline-recursive-depth-auto
10289 Specifies the maximum recursion depth used for recursive inlining.
10290
10291 @option{--param max-inline-recursive-depth} applies to functions
10292 declared inline. For functions not declared inline, recursive inlining
10293 happens only when @option{-finline-functions} (included in @option{-O3}) is
10294 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10295 default value is 8.
10296
10297 @item min-inline-recursive-probability
10298 Recursive inlining is profitable only for function having deep recursion
10299 in average and can hurt for function having little recursion depth by
10300 increasing the prologue size or complexity of function body to other
10301 optimizers.
10302
10303 When profile feedback is available (see @option{-fprofile-generate}) the actual
10304 recursion depth can be guessed from the probability that function recurses
10305 via a given call expression. This parameter limits inlining only to call
10306 expressions whose probability exceeds the given threshold (in percents).
10307 The default value is 10.
10308
10309 @item early-inlining-insns
10310 Specify growth that the early inliner can make. In effect it increases
10311 the amount of inlining for code having a large abstraction penalty.
10312 The default value is 14.
10313
10314 @item max-early-inliner-iterations
10315 Limit of iterations of the early inliner. This basically bounds
10316 the number of nested indirect calls the early inliner can resolve.
10317 Deeper chains are still handled by late inlining.
10318
10319 @item comdat-sharing-probability
10320 Probability (in percent) that C++ inline function with comdat visibility
10321 are shared across multiple compilation units. The default value is 20.
10322
10323 @item profile-func-internal-id
10324 A parameter to control whether to use function internal id in profile
10325 database lookup. If the value is 0, the compiler uses an id that
10326 is based on function assembler name and filename, which makes old profile
10327 data more tolerant to source changes such as function reordering etc.
10328 The default value is 0.
10329
10330 @item min-vect-loop-bound
10331 The minimum number of iterations under which loops are not vectorized
10332 when @option{-ftree-vectorize} is used. The number of iterations after
10333 vectorization needs to be greater than the value specified by this option
10334 to allow vectorization. The default value is 0.
10335
10336 @item gcse-cost-distance-ratio
10337 Scaling factor in calculation of maximum distance an expression
10338 can be moved by GCSE optimizations. This is currently supported only in the
10339 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10340 is with simple expressions, i.e., the expressions that have cost
10341 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10342 hoisting of simple expressions. The default value is 10.
10343
10344 @item gcse-unrestricted-cost
10345 Cost, roughly measured as the cost of a single typical machine
10346 instruction, at which GCSE optimizations do not constrain
10347 the distance an expression can travel. This is currently
10348 supported only in the code hoisting pass. The lesser the cost,
10349 the more aggressive code hoisting is. Specifying 0
10350 allows all expressions to travel unrestricted distances.
10351 The default value is 3.
10352
10353 @item max-hoist-depth
10354 The depth of search in the dominator tree for expressions to hoist.
10355 This is used to avoid quadratic behavior in hoisting algorithm.
10356 The value of 0 does not limit on the search, but may slow down compilation
10357 of huge functions. The default value is 30.
10358
10359 @item max-tail-merge-comparisons
10360 The maximum amount of similar bbs to compare a bb with. This is used to
10361 avoid quadratic behavior in tree tail merging. The default value is 10.
10362
10363 @item max-tail-merge-iterations
10364 The maximum amount of iterations of the pass over the function. This is used to
10365 limit compilation time in tree tail merging. The default value is 2.
10366
10367 @item store-merging-allow-unaligned
10368 Allow the store merging pass to introduce unaligned stores if it is legal to
10369 do so. The default value is 1.
10370
10371 @item max-stores-to-merge
10372 The maximum number of stores to attempt to merge into wider stores in the store
10373 merging pass. The minimum value is 2 and the default is 64.
10374
10375 @item max-unrolled-insns
10376 The maximum number of instructions that a loop may have to be unrolled.
10377 If a loop is unrolled, this parameter also determines how many times
10378 the loop code is unrolled.
10379
10380 @item max-average-unrolled-insns
10381 The maximum number of instructions biased by probabilities of their execution
10382 that a loop may have to be unrolled. If a loop is unrolled,
10383 this parameter also determines how many times the loop code is unrolled.
10384
10385 @item max-unroll-times
10386 The maximum number of unrollings of a single loop.
10387
10388 @item max-peeled-insns
10389 The maximum number of instructions that a loop may have to be peeled.
10390 If a loop is peeled, this parameter also determines how many times
10391 the loop code is peeled.
10392
10393 @item max-peel-times
10394 The maximum number of peelings of a single loop.
10395
10396 @item max-peel-branches
10397 The maximum number of branches on the hot path through the peeled sequence.
10398
10399 @item max-completely-peeled-insns
10400 The maximum number of insns of a completely peeled loop.
10401
10402 @item max-completely-peel-times
10403 The maximum number of iterations of a loop to be suitable for complete peeling.
10404
10405 @item max-completely-peel-loop-nest-depth
10406 The maximum depth of a loop nest suitable for complete peeling.
10407
10408 @item max-unswitch-insns
10409 The maximum number of insns of an unswitched loop.
10410
10411 @item max-unswitch-level
10412 The maximum number of branches unswitched in a single loop.
10413
10414 @item max-loop-headers-insns
10415 The maximum number of insns in loop header duplicated by the copy loop headers
10416 pass.
10417
10418 @item lim-expensive
10419 The minimum cost of an expensive expression in the loop invariant motion.
10420
10421 @item iv-consider-all-candidates-bound
10422 Bound on number of candidates for induction variables, below which
10423 all candidates are considered for each use in induction variable
10424 optimizations. If there are more candidates than this,
10425 only the most relevant ones are considered to avoid quadratic time complexity.
10426
10427 @item iv-max-considered-uses
10428 The induction variable optimizations give up on loops that contain more
10429 induction variable uses.
10430
10431 @item iv-always-prune-cand-set-bound
10432 If the number of candidates in the set is smaller than this value,
10433 always try to remove unnecessary ivs from the set
10434 when adding a new one.
10435
10436 @item avg-loop-niter
10437 Average number of iterations of a loop.
10438
10439 @item dse-max-object-size
10440 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10441 Larger values may result in larger compilation times.
10442
10443 @item dse-max-alias-queries-per-store
10444 Maximum number of queries into the alias oracle per store.
10445 Larger values result in larger compilation times and may result in more
10446 removed dead stores.
10447
10448 @item scev-max-expr-size
10449 Bound on size of expressions used in the scalar evolutions analyzer.
10450 Large expressions slow the analyzer.
10451
10452 @item scev-max-expr-complexity
10453 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10454 Complex expressions slow the analyzer.
10455
10456 @item max-tree-if-conversion-phi-args
10457 Maximum number of arguments in a PHI supported by TREE if conversion
10458 unless the loop is marked with simd pragma.
10459
10460 @item vect-max-version-for-alignment-checks
10461 The maximum number of run-time checks that can be performed when
10462 doing loop versioning for alignment in the vectorizer.
10463
10464 @item vect-max-version-for-alias-checks
10465 The maximum number of run-time checks that can be performed when
10466 doing loop versioning for alias in the vectorizer.
10467
10468 @item vect-max-peeling-for-alignment
10469 The maximum number of loop peels to enhance access alignment
10470 for vectorizer. Value -1 means no limit.
10471
10472 @item max-iterations-to-track
10473 The maximum number of iterations of a loop the brute-force algorithm
10474 for analysis of the number of iterations of the loop tries to evaluate.
10475
10476 @item hot-bb-count-ws-permille
10477 A basic block profile count is considered hot if it contributes to
10478 the given permillage (i.e. 0...1000) of the entire profiled execution.
10479
10480 @item hot-bb-frequency-fraction
10481 Select fraction of the entry block frequency of executions of basic block in
10482 function given basic block needs to have to be considered hot.
10483
10484 @item max-predicted-iterations
10485 The maximum number of loop iterations we predict statically. This is useful
10486 in cases where a function contains a single loop with known bound and
10487 another loop with unknown bound.
10488 The known number of iterations is predicted correctly, while
10489 the unknown number of iterations average to roughly 10. This means that the
10490 loop without bounds appears artificially cold relative to the other one.
10491
10492 @item builtin-expect-probability
10493 Control the probability of the expression having the specified value. This
10494 parameter takes a percentage (i.e. 0 ... 100) as input.
10495 The default probability of 90 is obtained empirically.
10496
10497 @item align-threshold
10498
10499 Select fraction of the maximal frequency of executions of a basic block in
10500 a function to align the basic block.
10501
10502 @item align-loop-iterations
10503
10504 A loop expected to iterate at least the selected number of iterations is
10505 aligned.
10506
10507 @item tracer-dynamic-coverage
10508 @itemx tracer-dynamic-coverage-feedback
10509
10510 This value is used to limit superblock formation once the given percentage of
10511 executed instructions is covered. This limits unnecessary code size
10512 expansion.
10513
10514 The @option{tracer-dynamic-coverage-feedback} parameter
10515 is used only when profile
10516 feedback is available. The real profiles (as opposed to statically estimated
10517 ones) are much less balanced allowing the threshold to be larger value.
10518
10519 @item tracer-max-code-growth
10520 Stop tail duplication once code growth has reached given percentage. This is
10521 a rather artificial limit, as most of the duplicates are eliminated later in
10522 cross jumping, so it may be set to much higher values than is the desired code
10523 growth.
10524
10525 @item tracer-min-branch-ratio
10526
10527 Stop reverse growth when the reverse probability of best edge is less than this
10528 threshold (in percent).
10529
10530 @item tracer-min-branch-probability
10531 @itemx tracer-min-branch-probability-feedback
10532
10533 Stop forward growth if the best edge has probability lower than this
10534 threshold.
10535
10536 Similarly to @option{tracer-dynamic-coverage} two parameters are
10537 provided. @option{tracer-min-branch-probability-feedback} is used for
10538 compilation with profile feedback and @option{tracer-min-branch-probability}
10539 compilation without. The value for compilation with profile feedback
10540 needs to be more conservative (higher) in order to make tracer
10541 effective.
10542
10543 @item stack-clash-protection-guard-size
10544 Specify the size of the operating system provided stack guard as
10545 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10546 Acceptable values are between 12 and 30. Higher values may reduce the
10547 number of explicit probes, but a value larger than the operating system
10548 provided guard will leave code vulnerable to stack clash style attacks.
10549
10550 @item stack-clash-protection-probe-interval
10551 Stack clash protection involves probing stack space as it is allocated. This
10552 param controls the maximum distance between probes into the stack as 2 raised
10553 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10554 12. Higher values may reduce the number of explicit probes, but a value
10555 larger than the operating system provided guard will leave code vulnerable to
10556 stack clash style attacks.
10557
10558 @item max-cse-path-length
10559
10560 The maximum number of basic blocks on path that CSE considers.
10561 The default is 10.
10562
10563 @item max-cse-insns
10564 The maximum number of instructions CSE processes before flushing.
10565 The default is 1000.
10566
10567 @item ggc-min-expand
10568
10569 GCC uses a garbage collector to manage its own memory allocation. This
10570 parameter specifies the minimum percentage by which the garbage
10571 collector's heap should be allowed to expand between collections.
10572 Tuning this may improve compilation speed; it has no effect on code
10573 generation.
10574
10575 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10576 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10577 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10578 GCC is not able to calculate RAM on a particular platform, the lower
10579 bound of 30% is used. Setting this parameter and
10580 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10581 every opportunity. This is extremely slow, but can be useful for
10582 debugging.
10583
10584 @item ggc-min-heapsize
10585
10586 Minimum size of the garbage collector's heap before it begins bothering
10587 to collect garbage. The first collection occurs after the heap expands
10588 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10589 tuning this may improve compilation speed, and has no effect on code
10590 generation.
10591
10592 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10593 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10594 with a lower bound of 4096 (four megabytes) and an upper bound of
10595 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10596 particular platform, the lower bound is used. Setting this parameter
10597 very large effectively disables garbage collection. Setting this
10598 parameter and @option{ggc-min-expand} to zero causes a full collection
10599 to occur at every opportunity.
10600
10601 @item max-reload-search-insns
10602 The maximum number of instruction reload should look backward for equivalent
10603 register. Increasing values mean more aggressive optimization, making the
10604 compilation time increase with probably slightly better performance.
10605 The default value is 100.
10606
10607 @item max-cselib-memory-locations
10608 The maximum number of memory locations cselib should take into account.
10609 Increasing values mean more aggressive optimization, making the compilation time
10610 increase with probably slightly better performance. The default value is 500.
10611
10612 @item max-sched-ready-insns
10613 The maximum number of instructions ready to be issued the scheduler should
10614 consider at any given time during the first scheduling pass. Increasing
10615 values mean more thorough searches, making the compilation time increase
10616 with probably little benefit. The default value is 100.
10617
10618 @item max-sched-region-blocks
10619 The maximum number of blocks in a region to be considered for
10620 interblock scheduling. The default value is 10.
10621
10622 @item max-pipeline-region-blocks
10623 The maximum number of blocks in a region to be considered for
10624 pipelining in the selective scheduler. The default value is 15.
10625
10626 @item max-sched-region-insns
10627 The maximum number of insns in a region to be considered for
10628 interblock scheduling. The default value is 100.
10629
10630 @item max-pipeline-region-insns
10631 The maximum number of insns in a region to be considered for
10632 pipelining in the selective scheduler. The default value is 200.
10633
10634 @item min-spec-prob
10635 The minimum probability (in percents) of reaching a source block
10636 for interblock speculative scheduling. The default value is 40.
10637
10638 @item max-sched-extend-regions-iters
10639 The maximum number of iterations through CFG to extend regions.
10640 A value of 0 (the default) disables region extensions.
10641
10642 @item max-sched-insn-conflict-delay
10643 The maximum conflict delay for an insn to be considered for speculative motion.
10644 The default value is 3.
10645
10646 @item sched-spec-prob-cutoff
10647 The minimal probability of speculation success (in percents), so that
10648 speculative insns are scheduled.
10649 The default value is 40.
10650
10651 @item sched-state-edge-prob-cutoff
10652 The minimum probability an edge must have for the scheduler to save its
10653 state across it.
10654 The default value is 10.
10655
10656 @item sched-mem-true-dep-cost
10657 Minimal distance (in CPU cycles) between store and load targeting same
10658 memory locations. The default value is 1.
10659
10660 @item selsched-max-lookahead
10661 The maximum size of the lookahead window of selective scheduling. It is a
10662 depth of search for available instructions.
10663 The default value is 50.
10664
10665 @item selsched-max-sched-times
10666 The maximum number of times that an instruction is scheduled during
10667 selective scheduling. This is the limit on the number of iterations
10668 through which the instruction may be pipelined. The default value is 2.
10669
10670 @item selsched-insns-to-rename
10671 The maximum number of best instructions in the ready list that are considered
10672 for renaming in the selective scheduler. The default value is 2.
10673
10674 @item sms-min-sc
10675 The minimum value of stage count that swing modulo scheduler
10676 generates. The default value is 2.
10677
10678 @item max-last-value-rtl
10679 The maximum size measured as number of RTLs that can be recorded in an expression
10680 in combiner for a pseudo register as last known value of that register. The default
10681 is 10000.
10682
10683 @item max-combine-insns
10684 The maximum number of instructions the RTL combiner tries to combine.
10685 The default value is 2 at @option{-Og} and 4 otherwise.
10686
10687 @item integer-share-limit
10688 Small integer constants can use a shared data structure, reducing the
10689 compiler's memory usage and increasing its speed. This sets the maximum
10690 value of a shared integer constant. The default value is 256.
10691
10692 @item ssp-buffer-size
10693 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10694 protection when @option{-fstack-protection} is used.
10695
10696 @item min-size-for-stack-sharing
10697 The minimum size of variables taking part in stack slot sharing when not
10698 optimizing. The default value is 32.
10699
10700 @item max-jump-thread-duplication-stmts
10701 Maximum number of statements allowed in a block that needs to be
10702 duplicated when threading jumps.
10703
10704 @item max-fields-for-field-sensitive
10705 Maximum number of fields in a structure treated in
10706 a field sensitive manner during pointer analysis. The default is zero
10707 for @option{-O0} and @option{-O1},
10708 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10709
10710 @item prefetch-latency
10711 Estimate on average number of instructions that are executed before
10712 prefetch finishes. The distance prefetched ahead is proportional
10713 to this constant. Increasing this number may also lead to less
10714 streams being prefetched (see @option{simultaneous-prefetches}).
10715
10716 @item simultaneous-prefetches
10717 Maximum number of prefetches that can run at the same time.
10718
10719 @item l1-cache-line-size
10720 The size of cache line in L1 cache, in bytes.
10721
10722 @item l1-cache-size
10723 The size of L1 cache, in kilobytes.
10724
10725 @item l2-cache-size
10726 The size of L2 cache, in kilobytes.
10727
10728 @item loop-interchange-max-num-stmts
10729 The maximum number of stmts in a loop to be interchanged.
10730
10731 @item loop-interchange-stride-ratio
10732 The minimum ratio between stride of two loops for interchange to be profitable.
10733
10734 @item min-insn-to-prefetch-ratio
10735 The minimum ratio between the number of instructions and the
10736 number of prefetches to enable prefetching in a loop.
10737
10738 @item prefetch-min-insn-to-mem-ratio
10739 The minimum ratio between the number of instructions and the
10740 number of memory references to enable prefetching in a loop.
10741
10742 @item use-canonical-types
10743 Whether the compiler should use the ``canonical'' type system. By
10744 default, this should always be 1, which uses a more efficient internal
10745 mechanism for comparing types in C++ and Objective-C++. However, if
10746 bugs in the canonical type system are causing compilation failures,
10747 set this value to 0 to disable canonical types.
10748
10749 @item switch-conversion-max-branch-ratio
10750 Switch initialization conversion refuses to create arrays that are
10751 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10752 branches in the switch.
10753
10754 @item max-partial-antic-length
10755 Maximum length of the partial antic set computed during the tree
10756 partial redundancy elimination optimization (@option{-ftree-pre}) when
10757 optimizing at @option{-O3} and above. For some sorts of source code
10758 the enhanced partial redundancy elimination optimization can run away,
10759 consuming all of the memory available on the host machine. This
10760 parameter sets a limit on the length of the sets that are computed,
10761 which prevents the runaway behavior. Setting a value of 0 for
10762 this parameter allows an unlimited set length.
10763
10764 @item sccvn-max-scc-size
10765 Maximum size of a strongly connected component (SCC) during SCCVN
10766 processing. If this limit is hit, SCCVN processing for the whole
10767 function is not done and optimizations depending on it are
10768 disabled. The default maximum SCC size is 10000.
10769
10770 @item sccvn-max-alias-queries-per-access
10771 Maximum number of alias-oracle queries we perform when looking for
10772 redundancies for loads and stores. If this limit is hit the search
10773 is aborted and the load or store is not considered redundant. The
10774 number of queries is algorithmically limited to the number of
10775 stores on all paths from the load to the function entry.
10776 The default maximum number of queries is 1000.
10777
10778 @item ira-max-loops-num
10779 IRA uses regional register allocation by default. If a function
10780 contains more loops than the number given by this parameter, only at most
10781 the given number of the most frequently-executed loops form regions
10782 for regional register allocation. The default value of the
10783 parameter is 100.
10784
10785 @item ira-max-conflict-table-size
10786 Although IRA uses a sophisticated algorithm to compress the conflict
10787 table, the table can still require excessive amounts of memory for
10788 huge functions. If the conflict table for a function could be more
10789 than the size in MB given by this parameter, the register allocator
10790 instead uses a faster, simpler, and lower-quality
10791 algorithm that does not require building a pseudo-register conflict table.
10792 The default value of the parameter is 2000.
10793
10794 @item ira-loop-reserved-regs
10795 IRA can be used to evaluate more accurate register pressure in loops
10796 for decisions to move loop invariants (see @option{-O3}). The number
10797 of available registers reserved for some other purposes is given
10798 by this parameter. The default value of the parameter is 2, which is
10799 the minimal number of registers needed by typical instructions.
10800 This value is the best found from numerous experiments.
10801
10802 @item lra-inheritance-ebb-probability-cutoff
10803 LRA tries to reuse values reloaded in registers in subsequent insns.
10804 This optimization is called inheritance. EBB is used as a region to
10805 do this optimization. The parameter defines a minimal fall-through
10806 edge probability in percentage used to add BB to inheritance EBB in
10807 LRA. The default value of the parameter is 40. The value was chosen
10808 from numerous runs of SPEC2000 on x86-64.
10809
10810 @item loop-invariant-max-bbs-in-loop
10811 Loop invariant motion can be very expensive, both in compilation time and
10812 in amount of needed compile-time memory, with very large loops. Loops
10813 with more basic blocks than this parameter won't have loop invariant
10814 motion optimization performed on them. The default value of the
10815 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10816
10817 @item loop-max-datarefs-for-datadeps
10818 Building data dependencies is expensive for very large loops. This
10819 parameter limits the number of data references in loops that are
10820 considered for data dependence analysis. These large loops are no
10821 handled by the optimizations using loop data dependencies.
10822 The default value is 1000.
10823
10824 @item max-vartrack-size
10825 Sets a maximum number of hash table slots to use during variable
10826 tracking dataflow analysis of any function. If this limit is exceeded
10827 with variable tracking at assignments enabled, analysis for that
10828 function is retried without it, after removing all debug insns from
10829 the function. If the limit is exceeded even without debug insns, var
10830 tracking analysis is completely disabled for the function. Setting
10831 the parameter to zero makes it unlimited.
10832
10833 @item max-vartrack-expr-depth
10834 Sets a maximum number of recursion levels when attempting to map
10835 variable names or debug temporaries to value expressions. This trades
10836 compilation time for more complete debug information. If this is set too
10837 low, value expressions that are available and could be represented in
10838 debug information may end up not being used; setting this higher may
10839 enable the compiler to find more complex debug expressions, but compile
10840 time and memory use may grow. The default is 12.
10841
10842 @item max-debug-marker-count
10843 Sets a threshold on the number of debug markers (e.g. begin stmt
10844 markers) to avoid complexity explosion at inlining or expanding to RTL.
10845 If a function has more such gimple stmts than the set limit, such stmts
10846 will be dropped from the inlined copy of a function, and from its RTL
10847 expansion. The default is 100000.
10848
10849 @item min-nondebug-insn-uid
10850 Use uids starting at this parameter for nondebug insns. The range below
10851 the parameter is reserved exclusively for debug insns created by
10852 @option{-fvar-tracking-assignments}, but debug insns may get
10853 (non-overlapping) uids above it if the reserved range is exhausted.
10854
10855 @item ipa-sra-ptr-growth-factor
10856 IPA-SRA replaces a pointer to an aggregate with one or more new
10857 parameters only when their cumulative size is less or equal to
10858 @option{ipa-sra-ptr-growth-factor} times the size of the original
10859 pointer parameter.
10860
10861 @item sra-max-scalarization-size-Ospeed
10862 @itemx sra-max-scalarization-size-Osize
10863 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10864 replace scalar parts of aggregates with uses of independent scalar
10865 variables. These parameters control the maximum size, in storage units,
10866 of aggregate which is considered for replacement when compiling for
10867 speed
10868 (@option{sra-max-scalarization-size-Ospeed}) or size
10869 (@option{sra-max-scalarization-size-Osize}) respectively.
10870
10871 @item tm-max-aggregate-size
10872 When making copies of thread-local variables in a transaction, this
10873 parameter specifies the size in bytes after which variables are
10874 saved with the logging functions as opposed to save/restore code
10875 sequence pairs. This option only applies when using
10876 @option{-fgnu-tm}.
10877
10878 @item graphite-max-nb-scop-params
10879 To avoid exponential effects in the Graphite loop transforms, the
10880 number of parameters in a Static Control Part (SCoP) is bounded. The
10881 default value is 10 parameters, a value of zero can be used to lift
10882 the bound. A variable whose value is unknown at compilation time and
10883 defined outside a SCoP is a parameter of the SCoP.
10884
10885 @item loop-block-tile-size
10886 Loop blocking or strip mining transforms, enabled with
10887 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10888 loop in the loop nest by a given number of iterations. The strip
10889 length can be changed using the @option{loop-block-tile-size}
10890 parameter. The default value is 51 iterations.
10891
10892 @item loop-unroll-jam-size
10893 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10894 default value is 4.
10895
10896 @item loop-unroll-jam-depth
10897 Specify the dimension to be unrolled (counting from the most inner loop)
10898 for the @option{-floop-unroll-and-jam}. The default value is 2.
10899
10900 @item ipa-cp-value-list-size
10901 IPA-CP attempts to track all possible values and types passed to a function's
10902 parameter in order to propagate them and perform devirtualization.
10903 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10904 stores per one formal parameter of a function.
10905
10906 @item ipa-cp-eval-threshold
10907 IPA-CP calculates its own score of cloning profitability heuristics
10908 and performs those cloning opportunities with scores that exceed
10909 @option{ipa-cp-eval-threshold}.
10910
10911 @item ipa-cp-recursion-penalty
10912 Percentage penalty the recursive functions will receive when they
10913 are evaluated for cloning.
10914
10915 @item ipa-cp-single-call-penalty
10916 Percentage penalty functions containing a single call to another
10917 function will receive when they are evaluated for cloning.
10918
10919
10920 @item ipa-max-agg-items
10921 IPA-CP is also capable to propagate a number of scalar values passed
10922 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10923 number of such values per one parameter.
10924
10925 @item ipa-cp-loop-hint-bonus
10926 When IPA-CP determines that a cloning candidate would make the number
10927 of iterations of a loop known, it adds a bonus of
10928 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10929 the candidate.
10930
10931 @item ipa-cp-array-index-hint-bonus
10932 When IPA-CP determines that a cloning candidate would make the index of
10933 an array access known, it adds a bonus of
10934 @option{ipa-cp-array-index-hint-bonus} to the profitability
10935 score of the candidate.
10936
10937 @item ipa-max-aa-steps
10938 During its analysis of function bodies, IPA-CP employs alias analysis
10939 in order to track values pointed to by function parameters. In order
10940 not spend too much time analyzing huge functions, it gives up and
10941 consider all memory clobbered after examining
10942 @option{ipa-max-aa-steps} statements modifying memory.
10943
10944 @item lto-partitions
10945 Specify desired number of partitions produced during WHOPR compilation.
10946 The number of partitions should exceed the number of CPUs used for compilation.
10947 The default value is 32.
10948
10949 @item lto-min-partition
10950 Size of minimal partition for WHOPR (in estimated instructions).
10951 This prevents expenses of splitting very small programs into too many
10952 partitions.
10953
10954 @item lto-max-partition
10955 Size of max partition for WHOPR (in estimated instructions).
10956 to provide an upper bound for individual size of partition.
10957 Meant to be used only with balanced partitioning.
10958
10959 @item cxx-max-namespaces-for-diagnostic-help
10960 The maximum number of namespaces to consult for suggestions when C++
10961 name lookup fails for an identifier. The default is 1000.
10962
10963 @item sink-frequency-threshold
10964 The maximum relative execution frequency (in percents) of the target block
10965 relative to a statement's original block to allow statement sinking of a
10966 statement. Larger numbers result in more aggressive statement sinking.
10967 The default value is 75. A small positive adjustment is applied for
10968 statements with memory operands as those are even more profitable so sink.
10969
10970 @item max-stores-to-sink
10971 The maximum number of conditional store pairs that can be sunk. Set to 0
10972 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10973 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10974
10975 @item allow-store-data-races
10976 Allow optimizers to introduce new data races on stores.
10977 Set to 1 to allow, otherwise to 0. This option is enabled by default
10978 at optimization level @option{-Ofast}.
10979
10980 @item case-values-threshold
10981 The smallest number of different values for which it is best to use a
10982 jump-table instead of a tree of conditional branches. If the value is
10983 0, use the default for the machine. The default is 0.
10984
10985 @item tree-reassoc-width
10986 Set the maximum number of instructions executed in parallel in
10987 reassociated tree. This parameter overrides target dependent
10988 heuristics used by default if has non zero value.
10989
10990 @item sched-pressure-algorithm
10991 Choose between the two available implementations of
10992 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10993 and is the more likely to prevent instructions from being reordered.
10994 Algorithm 2 was designed to be a compromise between the relatively
10995 conservative approach taken by algorithm 1 and the rather aggressive
10996 approach taken by the default scheduler. It relies more heavily on
10997 having a regular register file and accurate register pressure classes.
10998 See @file{haifa-sched.c} in the GCC sources for more details.
10999
11000 The default choice depends on the target.
11001
11002 @item max-slsr-cand-scan
11003 Set the maximum number of existing candidates that are considered when
11004 seeking a basis for a new straight-line strength reduction candidate.
11005
11006 @item asan-globals
11007 Enable buffer overflow detection for global objects. This kind
11008 of protection is enabled by default if you are using
11009 @option{-fsanitize=address} option.
11010 To disable global objects protection use @option{--param asan-globals=0}.
11011
11012 @item asan-stack
11013 Enable buffer overflow detection for stack objects. This kind of
11014 protection is enabled by default when using @option{-fsanitize=address}.
11015 To disable stack protection use @option{--param asan-stack=0} option.
11016
11017 @item asan-instrument-reads
11018 Enable buffer overflow detection for memory reads. This kind of
11019 protection is enabled by default when using @option{-fsanitize=address}.
11020 To disable memory reads protection use
11021 @option{--param asan-instrument-reads=0}.
11022
11023 @item asan-instrument-writes
11024 Enable buffer overflow detection for memory writes. This kind of
11025 protection is enabled by default when using @option{-fsanitize=address}.
11026 To disable memory writes protection use
11027 @option{--param asan-instrument-writes=0} option.
11028
11029 @item asan-memintrin
11030 Enable detection for built-in functions. This kind of protection
11031 is enabled by default when using @option{-fsanitize=address}.
11032 To disable built-in functions protection use
11033 @option{--param asan-memintrin=0}.
11034
11035 @item asan-use-after-return
11036 Enable detection of use-after-return. This kind of protection
11037 is enabled by default when using the @option{-fsanitize=address} option.
11038 To disable it use @option{--param asan-use-after-return=0}.
11039
11040 Note: By default the check is disabled at run time. To enable it,
11041 add @code{detect_stack_use_after_return=1} to the environment variable
11042 @env{ASAN_OPTIONS}.
11043
11044 @item asan-instrumentation-with-call-threshold
11045 If number of memory accesses in function being instrumented
11046 is greater or equal to this number, use callbacks instead of inline checks.
11047 E.g. to disable inline code use
11048 @option{--param asan-instrumentation-with-call-threshold=0}.
11049
11050 @item use-after-scope-direct-emission-threshold
11051 If the size of a local variable in bytes is smaller or equal to this
11052 number, directly poison (or unpoison) shadow memory instead of using
11053 run-time callbacks. The default value is 256.
11054
11055 @item chkp-max-ctor-size
11056 Static constructors generated by Pointer Bounds Checker may become very
11057 large and significantly increase compile time at optimization level
11058 @option{-O1} and higher. This parameter is a maximum number of statements
11059 in a single generated constructor. Default value is 5000.
11060
11061 @item max-fsm-thread-path-insns
11062 Maximum number of instructions to copy when duplicating blocks on a
11063 finite state automaton jump thread path. The default is 100.
11064
11065 @item max-fsm-thread-length
11066 Maximum number of basic blocks on a finite state automaton jump thread
11067 path. The default is 10.
11068
11069 @item max-fsm-thread-paths
11070 Maximum number of new jump thread paths to create for a finite state
11071 automaton. The default is 50.
11072
11073 @item parloops-chunk-size
11074 Chunk size of omp schedule for loops parallelized by parloops. The default
11075 is 0.
11076
11077 @item parloops-schedule
11078 Schedule type of omp schedule for loops parallelized by parloops (static,
11079 dynamic, guided, auto, runtime). The default is static.
11080
11081 @item parloops-min-per-thread
11082 The minimum number of iterations per thread of an innermost parallelized
11083 loop for which the parallelized variant is prefered over the single threaded
11084 one. The default is 100. Note that for a parallelized loop nest the
11085 minimum number of iterations of the outermost loop per thread is two.
11086
11087 @item max-ssa-name-query-depth
11088 Maximum depth of recursion when querying properties of SSA names in things
11089 like fold routines. One level of recursion corresponds to following a
11090 use-def chain.
11091
11092 @item hsa-gen-debug-stores
11093 Enable emission of special debug stores within HSA kernels which are
11094 then read and reported by libgomp plugin. Generation of these stores
11095 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11096 enable it.
11097
11098 @item max-speculative-devirt-maydefs
11099 The maximum number of may-defs we analyze when looking for a must-def
11100 specifying the dynamic type of an object that invokes a virtual call
11101 we may be able to devirtualize speculatively.
11102
11103 @item max-vrp-switch-assertions
11104 The maximum number of assertions to add along the default edge of a switch
11105 statement during VRP. The default is 10.
11106
11107 @item unroll-jam-min-percent
11108 The minimum percentage of memory references that must be optimized
11109 away for the unroll-and-jam transformation to be considered profitable.
11110
11111 @item unroll-jam-max-unroll
11112 The maximum number of times the outer loop should be unrolled by
11113 the unroll-and-jam transformation.
11114 @end table
11115 @end table
11116
11117 @node Instrumentation Options
11118 @section Program Instrumentation Options
11119 @cindex instrumentation options
11120 @cindex program instrumentation options
11121 @cindex run-time error checking options
11122 @cindex profiling options
11123 @cindex options, program instrumentation
11124 @cindex options, run-time error checking
11125 @cindex options, profiling
11126
11127 GCC supports a number of command-line options that control adding
11128 run-time instrumentation to the code it normally generates.
11129 For example, one purpose of instrumentation is collect profiling
11130 statistics for use in finding program hot spots, code coverage
11131 analysis, or profile-guided optimizations.
11132 Another class of program instrumentation is adding run-time checking
11133 to detect programming errors like invalid pointer
11134 dereferences or out-of-bounds array accesses, as well as deliberately
11135 hostile attacks such as stack smashing or C++ vtable hijacking.
11136 There is also a general hook which can be used to implement other
11137 forms of tracing or function-level instrumentation for debug or
11138 program analysis purposes.
11139
11140 @table @gcctabopt
11141 @cindex @command{prof}
11142 @item -p
11143 @opindex p
11144 Generate extra code to write profile information suitable for the
11145 analysis program @command{prof}. You must use this option when compiling
11146 the source files you want data about, and you must also use it when
11147 linking.
11148
11149 @cindex @command{gprof}
11150 @item -pg
11151 @opindex pg
11152 Generate extra code to write profile information suitable for the
11153 analysis program @command{gprof}. You must use this option when compiling
11154 the source files you want data about, and you must also use it when
11155 linking.
11156
11157 @item -fprofile-arcs
11158 @opindex fprofile-arcs
11159 Add code so that program flow @dfn{arcs} are instrumented. During
11160 execution the program records how many times each branch and call is
11161 executed and how many times it is taken or returns. On targets that support
11162 constructors with priority support, profiling properly handles constructors,
11163 destructors and C++ constructors (and destructors) of classes which are used
11164 as a type of a global variable.
11165
11166 When the compiled
11167 program exits it saves this data to a file called
11168 @file{@var{auxname}.gcda} for each source file. The data may be used for
11169 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11170 test coverage analysis (@option{-ftest-coverage}). Each object file's
11171 @var{auxname} is generated from the name of the output file, if
11172 explicitly specified and it is not the final executable, otherwise it is
11173 the basename of the source file. In both cases any suffix is removed
11174 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11175 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11176 @xref{Cross-profiling}.
11177
11178 @cindex @command{gcov}
11179 @item --coverage
11180 @opindex coverage
11181
11182 This option is used to compile and link code instrumented for coverage
11183 analysis. The option is a synonym for @option{-fprofile-arcs}
11184 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11185 linking). See the documentation for those options for more details.
11186
11187 @itemize
11188
11189 @item
11190 Compile the source files with @option{-fprofile-arcs} plus optimization
11191 and code generation options. For test coverage analysis, use the
11192 additional @option{-ftest-coverage} option. You do not need to profile
11193 every source file in a program.
11194
11195 @item
11196 Compile the source files additionally with @option{-fprofile-abs-path}
11197 to create absolute path names in the @file{.gcno} files. This allows
11198 @command{gcov} to find the correct sources in projects where compilations
11199 occur with different working directories.
11200
11201 @item
11202 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11203 (the latter implies the former).
11204
11205 @item
11206 Run the program on a representative workload to generate the arc profile
11207 information. This may be repeated any number of times. You can run
11208 concurrent instances of your program, and provided that the file system
11209 supports locking, the data files will be correctly updated. Unless
11210 a strict ISO C dialect option is in effect, @code{fork} calls are
11211 detected and correctly handled without double counting.
11212
11213 @item
11214 For profile-directed optimizations, compile the source files again with
11215 the same optimization and code generation options plus
11216 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11217 Control Optimization}).
11218
11219 @item
11220 For test coverage analysis, use @command{gcov} to produce human readable
11221 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11222 @command{gcov} documentation for further information.
11223
11224 @end itemize
11225
11226 With @option{-fprofile-arcs}, for each function of your program GCC
11227 creates a program flow graph, then finds a spanning tree for the graph.
11228 Only arcs that are not on the spanning tree have to be instrumented: the
11229 compiler adds code to count the number of times that these arcs are
11230 executed. When an arc is the only exit or only entrance to a block, the
11231 instrumentation code can be added to the block; otherwise, a new basic
11232 block must be created to hold the instrumentation code.
11233
11234 @need 2000
11235 @item -ftest-coverage
11236 @opindex ftest-coverage
11237 Produce a notes file that the @command{gcov} code-coverage utility
11238 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11239 show program coverage. Each source file's note file is called
11240 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11241 above for a description of @var{auxname} and instructions on how to
11242 generate test coverage data. Coverage data matches the source files
11243 more closely if you do not optimize.
11244
11245 @item -fprofile-abs-path
11246 @opindex fprofile-abs-path
11247 Automatically convert relative source file names to absolute path names
11248 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11249 sources in projects where compilations occur with different working
11250 directories.
11251
11252 @item -fprofile-dir=@var{path}
11253 @opindex fprofile-dir
11254
11255 Set the directory to search for the profile data files in to @var{path}.
11256 This option affects only the profile data generated by
11257 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11258 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11259 and its related options. Both absolute and relative paths can be used.
11260 By default, GCC uses the current directory as @var{path}, thus the
11261 profile data file appears in the same directory as the object file.
11262
11263 @item -fprofile-generate
11264 @itemx -fprofile-generate=@var{path}
11265 @opindex fprofile-generate
11266
11267 Enable options usually used for instrumenting application to produce
11268 profile useful for later recompilation with profile feedback based
11269 optimization. You must use @option{-fprofile-generate} both when
11270 compiling and when linking your program.
11271
11272 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11273
11274 If @var{path} is specified, GCC looks at the @var{path} to find
11275 the profile feedback data files. See @option{-fprofile-dir}.
11276
11277 To optimize the program based on the collected profile information, use
11278 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11279
11280 @item -fprofile-update=@var{method}
11281 @opindex fprofile-update
11282
11283 Alter the update method for an application instrumented for profile
11284 feedback based optimization. The @var{method} argument should be one of
11285 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11286 The first one is useful for single-threaded applications,
11287 while the second one prevents profile corruption by emitting thread-safe code.
11288
11289 @strong{Warning:} When an application does not properly join all threads
11290 (or creates an detached thread), a profile file can be still corrupted.
11291
11292 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11293 when supported by a target, or to @samp{single} otherwise. The GCC driver
11294 automatically selects @samp{prefer-atomic} when @option{-pthread}
11295 is present in the command line.
11296
11297 @item -fsanitize=address
11298 @opindex fsanitize=address
11299 Enable AddressSanitizer, a fast memory error detector.
11300 Memory access instructions are instrumented to detect
11301 out-of-bounds and use-after-free bugs.
11302 The option enables @option{-fsanitize-address-use-after-scope}.
11303 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11304 more details. The run-time behavior can be influenced using the
11305 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11306 the available options are shown at startup of the instrumented program. See
11307 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11308 for a list of supported options.
11309 The option cannot be combined with @option{-fsanitize=thread}
11310 and/or @option{-fcheck-pointer-bounds}.
11311
11312 @item -fsanitize=kernel-address
11313 @opindex fsanitize=kernel-address
11314 Enable AddressSanitizer for Linux kernel.
11315 See @uref{https://github.com/google/kasan/wiki} for more details.
11316 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11317
11318 @item -fsanitize=pointer-compare
11319 @opindex fsanitize=pointer-compare
11320 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11321 The option must be combined with either @option{-fsanitize=kernel-address} or
11322 @option{-fsanitize=address}
11323 The option cannot be combined with @option{-fsanitize=thread}
11324 and/or @option{-fcheck-pointer-bounds}.
11325 Note: By default the check is disabled at run time. To enable it,
11326 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11327 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11328 invalid operation only when both pointers are non-null.
11329
11330 @item -fsanitize=pointer-subtract
11331 @opindex fsanitize=pointer-subtract
11332 Instrument subtraction with pointer operands.
11333 The option must be combined with either @option{-fsanitize=kernel-address} or
11334 @option{-fsanitize=address}
11335 The option cannot be combined with @option{-fsanitize=thread}
11336 and/or @option{-fcheck-pointer-bounds}.
11337 Note: By default the check is disabled at run time. To enable it,
11338 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11339 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11340 invalid operation only when both pointers are non-null.
11341
11342 @item -fsanitize=thread
11343 @opindex fsanitize=thread
11344 Enable ThreadSanitizer, a fast data race detector.
11345 Memory access instructions are instrumented to detect
11346 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11347 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11348 environment variable; see
11349 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11350 supported options.
11351 The option cannot be combined with @option{-fsanitize=address},
11352 @option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}.
11353
11354 Note that sanitized atomic builtins cannot throw exceptions when
11355 operating on invalid memory addresses with non-call exceptions
11356 (@option{-fnon-call-exceptions}).
11357
11358 @item -fsanitize=leak
11359 @opindex fsanitize=leak
11360 Enable LeakSanitizer, a memory leak detector.
11361 This option only matters for linking of executables and
11362 the executable is linked against a library that overrides @code{malloc}
11363 and other allocator functions. See
11364 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11365 details. The run-time behavior can be influenced using the
11366 @env{LSAN_OPTIONS} environment variable.
11367 The option cannot be combined with @option{-fsanitize=thread}.
11368
11369 @item -fsanitize=undefined
11370 @opindex fsanitize=undefined
11371 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11372 Various computations are instrumented to detect undefined behavior
11373 at runtime. Current suboptions are:
11374
11375 @table @gcctabopt
11376
11377 @item -fsanitize=shift
11378 @opindex fsanitize=shift
11379 This option enables checking that the result of a shift operation is
11380 not undefined. Note that what exactly is considered undefined differs
11381 slightly between C and C++, as well as between ISO C90 and C99, etc.
11382 This option has two suboptions, @option{-fsanitize=shift-base} and
11383 @option{-fsanitize=shift-exponent}.
11384
11385 @item -fsanitize=shift-exponent
11386 @opindex fsanitize=shift-exponent
11387 This option enables checking that the second argument of a shift operation
11388 is not negative and is smaller than the precision of the promoted first
11389 argument.
11390
11391 @item -fsanitize=shift-base
11392 @opindex fsanitize=shift-base
11393 If the second argument of a shift operation is within range, check that the
11394 result of a shift operation is not undefined. Note that what exactly is
11395 considered undefined differs slightly between C and C++, as well as between
11396 ISO C90 and C99, etc.
11397
11398 @item -fsanitize=integer-divide-by-zero
11399 @opindex fsanitize=integer-divide-by-zero
11400 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11401
11402 @item -fsanitize=unreachable
11403 @opindex fsanitize=unreachable
11404 With this option, the compiler turns the @code{__builtin_unreachable}
11405 call into a diagnostics message call instead. When reaching the
11406 @code{__builtin_unreachable} call, the behavior is undefined.
11407
11408 @item -fsanitize=vla-bound
11409 @opindex fsanitize=vla-bound
11410 This option instructs the compiler to check that the size of a variable
11411 length array is positive.
11412
11413 @item -fsanitize=null
11414 @opindex fsanitize=null
11415 This option enables pointer checking. Particularly, the application
11416 built with this option turned on will issue an error message when it
11417 tries to dereference a NULL pointer, or if a reference (possibly an
11418 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11419 on an object pointed by a NULL pointer.
11420
11421 @item -fsanitize=return
11422 @opindex fsanitize=return
11423 This option enables return statement checking. Programs
11424 built with this option turned on will issue an error message
11425 when the end of a non-void function is reached without actually
11426 returning a value. This option works in C++ only.
11427
11428 @item -fsanitize=signed-integer-overflow
11429 @opindex fsanitize=signed-integer-overflow
11430 This option enables signed integer overflow checking. We check that
11431 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11432 does not overflow in the signed arithmetics. Note, integer promotion
11433 rules must be taken into account. That is, the following is not an
11434 overflow:
11435 @smallexample
11436 signed char a = SCHAR_MAX;
11437 a++;
11438 @end smallexample
11439
11440 @item -fsanitize=bounds
11441 @opindex fsanitize=bounds
11442 This option enables instrumentation of array bounds. Various out of bounds
11443 accesses are detected. Flexible array members, flexible array member-like
11444 arrays, and initializers of variables with static storage are not instrumented.
11445 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11446
11447 @item -fsanitize=bounds-strict
11448 @opindex fsanitize=bounds-strict
11449 This option enables strict instrumentation of array bounds. Most out of bounds
11450 accesses are detected, including flexible array members and flexible array
11451 member-like arrays. Initializers of variables with static storage are not
11452 instrumented. The option cannot be combined
11453 with @option{-fcheck-pointer-bounds}.
11454
11455 @item -fsanitize=alignment
11456 @opindex fsanitize=alignment
11457
11458 This option enables checking of alignment of pointers when they are
11459 dereferenced, or when a reference is bound to insufficiently aligned target,
11460 or when a method or constructor is invoked on insufficiently aligned object.
11461
11462 @item -fsanitize=object-size
11463 @opindex fsanitize=object-size
11464 This option enables instrumentation of memory references using the
11465 @code{__builtin_object_size} function. Various out of bounds pointer
11466 accesses are detected.
11467
11468 @item -fsanitize=float-divide-by-zero
11469 @opindex fsanitize=float-divide-by-zero
11470 Detect floating-point division by zero. Unlike other similar options,
11471 @option{-fsanitize=float-divide-by-zero} is not enabled by
11472 @option{-fsanitize=undefined}, since floating-point division by zero can
11473 be a legitimate way of obtaining infinities and NaNs.
11474
11475 @item -fsanitize=float-cast-overflow
11476 @opindex fsanitize=float-cast-overflow
11477 This option enables floating-point type to integer conversion checking.
11478 We check that the result of the conversion does not overflow.
11479 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11480 not enabled by @option{-fsanitize=undefined}.
11481 This option does not work well with @code{FE_INVALID} exceptions enabled.
11482
11483 @item -fsanitize=nonnull-attribute
11484 @opindex fsanitize=nonnull-attribute
11485
11486 This option enables instrumentation of calls, checking whether null values
11487 are not passed to arguments marked as requiring a non-null value by the
11488 @code{nonnull} function attribute.
11489
11490 @item -fsanitize=returns-nonnull-attribute
11491 @opindex fsanitize=returns-nonnull-attribute
11492
11493 This option enables instrumentation of return statements in functions
11494 marked with @code{returns_nonnull} function attribute, to detect returning
11495 of null values from such functions.
11496
11497 @item -fsanitize=bool
11498 @opindex fsanitize=bool
11499
11500 This option enables instrumentation of loads from bool. If a value other
11501 than 0/1 is loaded, a run-time error is issued.
11502
11503 @item -fsanitize=enum
11504 @opindex fsanitize=enum
11505
11506 This option enables instrumentation of loads from an enum type. If
11507 a value outside the range of values for the enum type is loaded,
11508 a run-time error is issued.
11509
11510 @item -fsanitize=vptr
11511 @opindex fsanitize=vptr
11512
11513 This option enables instrumentation of C++ member function calls, member
11514 accesses and some conversions between pointers to base and derived classes,
11515 to verify the referenced object has the correct dynamic type.
11516
11517 @item -fsanitize=pointer-overflow
11518 @opindex fsanitize=pointer-overflow
11519
11520 This option enables instrumentation of pointer arithmetics. If the pointer
11521 arithmetics overflows, a run-time error is issued.
11522
11523 @item -fsanitize=builtin
11524 @opindex fsanitize=builtin
11525
11526 This option enables instrumentation of arguments to selected builtin
11527 functions. If an invalid value is passed to such arguments, a run-time
11528 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11529 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11530 by this option.
11531
11532 @end table
11533
11534 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11535 @option{-fsanitize=undefined} gives a diagnostic message.
11536 This currently works only for the C family of languages.
11537
11538 @item -fno-sanitize=all
11539 @opindex fno-sanitize=all
11540
11541 This option disables all previously enabled sanitizers.
11542 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11543 together.
11544
11545 @item -fasan-shadow-offset=@var{number}
11546 @opindex fasan-shadow-offset
11547 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11548 It is useful for experimenting with different shadow memory layouts in
11549 Kernel AddressSanitizer.
11550
11551 @item -fsanitize-sections=@var{s1},@var{s2},...
11552 @opindex fsanitize-sections
11553 Sanitize global variables in selected user-defined sections. @var{si} may
11554 contain wildcards.
11555
11556 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11557 @opindex fsanitize-recover
11558 @opindex fno-sanitize-recover
11559 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11560 mentioned in comma-separated list of @var{opts}. Enabling this option
11561 for a sanitizer component causes it to attempt to continue
11562 running the program as if no error happened. This means multiple
11563 runtime errors can be reported in a single program run, and the exit
11564 code of the program may indicate success even when errors
11565 have been reported. The @option{-fno-sanitize-recover=} option
11566 can be used to alter
11567 this behavior: only the first detected error is reported
11568 and program then exits with a non-zero exit code.
11569
11570 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11571 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11572 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11573 @option{-fsanitize=bounds-strict},
11574 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11575 For these sanitizers error recovery is turned on by default,
11576 except @option{-fsanitize=address}, for which this feature is experimental.
11577 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11578 accepted, the former enables recovery for all sanitizers that support it,
11579 the latter disables recovery for all sanitizers that support it.
11580
11581 Even if a recovery mode is turned on the compiler side, it needs to be also
11582 enabled on the runtime library side, otherwise the failures are still fatal.
11583 The runtime library defaults to @code{halt_on_error=0} for
11584 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11585 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11586 setting the @code{halt_on_error} flag in the corresponding environment variable.
11587
11588 Syntax without an explicit @var{opts} parameter is deprecated. It is
11589 equivalent to specifying an @var{opts} list of:
11590
11591 @smallexample
11592 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11593 @end smallexample
11594
11595 @item -fsanitize-address-use-after-scope
11596 @opindex fsanitize-address-use-after-scope
11597 Enable sanitization of local variables to detect use-after-scope bugs.
11598 The option sets @option{-fstack-reuse} to @samp{none}.
11599
11600 @item -fsanitize-undefined-trap-on-error
11601 @opindex fsanitize-undefined-trap-on-error
11602 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11603 report undefined behavior using @code{__builtin_trap} rather than
11604 a @code{libubsan} library routine. The advantage of this is that the
11605 @code{libubsan} library is not needed and is not linked in, so this
11606 is usable even in freestanding environments.
11607
11608 @item -fsanitize-coverage=trace-pc
11609 @opindex fsanitize-coverage=trace-pc
11610 Enable coverage-guided fuzzing code instrumentation.
11611 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11612
11613 @item -fsanitize-coverage=trace-cmp
11614 @opindex fsanitize-coverage=trace-cmp
11615 Enable dataflow guided fuzzing code instrumentation.
11616 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11617 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11618 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11619 variable or @code{__sanitizer_cov_trace_const_cmp1},
11620 @code{__sanitizer_cov_trace_const_cmp2},
11621 @code{__sanitizer_cov_trace_const_cmp4} or
11622 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11623 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11624 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11625 @code{__sanitizer_cov_trace_switch} for switch statements.
11626
11627 @item -fbounds-check
11628 @opindex fbounds-check
11629 For front ends that support it, generate additional code to check that
11630 indices used to access arrays are within the declared range. This is
11631 currently only supported by the Fortran front end, where this option
11632 defaults to false.
11633
11634 @item -fcheck-pointer-bounds
11635 @opindex fcheck-pointer-bounds
11636 @opindex fno-check-pointer-bounds
11637 @cindex Pointer Bounds Checker options
11638 Enable Pointer Bounds Checker instrumentation. Each memory reference
11639 is instrumented with checks of the pointer used for memory access against
11640 bounds associated with that pointer.
11641
11642 Currently there
11643 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
11644 and @option{-mmpx} are required to enable this feature.
11645 MPX-based instrumentation requires
11646 a runtime library to enable MPX in hardware and handle bounds
11647 violation signals. By default when @option{-fcheck-pointer-bounds}
11648 and @option{-mmpx} options are used to link a program, the GCC driver
11649 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
11650 Bounds checking on calls to dynamic libraries requires a linker
11651 with @option{-z bndplt} support; if GCC was configured with a linker
11652 without support for this option (including the Gold linker and older
11653 versions of ld), a warning is given if you link with @option{-mmpx}
11654 without also specifying @option{-static}, since the overall effectiveness
11655 of the bounds checking protection is reduced.
11656 See also @option{-static-libmpxwrappers}.
11657
11658 MPX-based instrumentation
11659 may be used for debugging and also may be included in production code
11660 to increase program security. Depending on usage, you may
11661 have different requirements for the runtime library. The current version
11662 of the MPX runtime library is more oriented for use as a debugging
11663 tool. MPX runtime library usage implies @option{-lpthread}. See
11664 also @option{-static-libmpx}. The runtime library behavior can be
11665 influenced using various @env{CHKP_RT_*} environment variables. See
11666 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
11667 for more details.
11668
11669 Generated instrumentation may be controlled by various
11670 @option{-fchkp-*} options and by the @code{bnd_variable_size}
11671 structure field attribute (@pxref{Type Attributes}) and
11672 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
11673 (@pxref{Function Attributes}). GCC also provides a number of built-in
11674 functions for controlling the Pointer Bounds Checker. @xref{Pointer
11675 Bounds Checker builtins}, for more information.
11676
11677 @item -fchkp-check-incomplete-type
11678 @opindex fchkp-check-incomplete-type
11679 @opindex fno-chkp-check-incomplete-type
11680 Generate pointer bounds checks for variables with incomplete type.
11681 Enabled by default.
11682
11683 @item -fchkp-narrow-bounds
11684 @opindex fchkp-narrow-bounds
11685 @opindex fno-chkp-narrow-bounds
11686 Controls bounds used by Pointer Bounds Checker for pointers to object
11687 fields. If narrowing is enabled then field bounds are used. Otherwise
11688 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
11689 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
11690
11691 @item -fchkp-first-field-has-own-bounds
11692 @opindex fchkp-first-field-has-own-bounds
11693 @opindex fno-chkp-first-field-has-own-bounds
11694 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
11695 first field in the structure. By default a pointer to the first field has
11696 the same bounds as a pointer to the whole structure.
11697
11698 @item -fchkp-flexible-struct-trailing-arrays
11699 @opindex fchkp-flexible-struct-trailing-arrays
11700 @opindex fno-chkp-flexible-struct-trailing-arrays
11701 Forces Pointer Bounds Checker to treat all trailing arrays in structures as
11702 possibly flexible. By default only array fields with zero length or that are
11703 marked with attribute bnd_variable_size are treated as flexible.
11704
11705 @item -fchkp-narrow-to-innermost-array
11706 @opindex fchkp-narrow-to-innermost-array
11707 @opindex fno-chkp-narrow-to-innermost-array
11708 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
11709 case of nested static array access. By default this option is disabled and
11710 bounds of the outermost array are used.
11711
11712 @item -fchkp-optimize
11713 @opindex fchkp-optimize
11714 @opindex fno-chkp-optimize
11715 Enables Pointer Bounds Checker optimizations. Enabled by default at
11716 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
11717
11718 @item -fchkp-use-fast-string-functions
11719 @opindex fchkp-use-fast-string-functions
11720 @opindex fno-chkp-use-fast-string-functions
11721 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
11722 by Pointer Bounds Checker. Disabled by default.
11723
11724 @item -fchkp-use-nochk-string-functions
11725 @opindex fchkp-use-nochk-string-functions
11726 @opindex fno-chkp-use-nochk-string-functions
11727 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
11728 by Pointer Bounds Checker. Disabled by default.
11729
11730 @item -fchkp-use-static-bounds
11731 @opindex fchkp-use-static-bounds
11732 @opindex fno-chkp-use-static-bounds
11733 Allow Pointer Bounds Checker to generate static bounds holding
11734 bounds of static variables. Enabled by default.
11735
11736 @item -fchkp-use-static-const-bounds
11737 @opindex fchkp-use-static-const-bounds
11738 @opindex fno-chkp-use-static-const-bounds
11739 Use statically-initialized bounds for constant bounds instead of
11740 generating them each time they are required. By default enabled when
11741 @option{-fchkp-use-static-bounds} is enabled.
11742
11743 @item -fchkp-treat-zero-dynamic-size-as-infinite
11744 @opindex fchkp-treat-zero-dynamic-size-as-infinite
11745 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
11746 With this option, objects with incomplete type whose
11747 dynamically-obtained size is zero are treated as having infinite size
11748 instead by Pointer Bounds
11749 Checker. This option may be helpful if a program is linked with a library
11750 missing size information for some symbols. Disabled by default.
11751
11752 @item -fchkp-check-read
11753 @opindex fchkp-check-read
11754 @opindex fno-chkp-check-read
11755 Instructs Pointer Bounds Checker to generate checks for all read
11756 accesses to memory. Enabled by default.
11757
11758 @item -fchkp-check-write
11759 @opindex fchkp-check-write
11760 @opindex fno-chkp-check-write
11761 Instructs Pointer Bounds Checker to generate checks for all write
11762 accesses to memory. Enabled by default.
11763
11764 @item -fchkp-store-bounds
11765 @opindex fchkp-store-bounds
11766 @opindex fno-chkp-store-bounds
11767 Instructs Pointer Bounds Checker to generate bounds stores for
11768 pointer writes. Enabled by default.
11769
11770 @item -fchkp-instrument-calls
11771 @opindex fchkp-instrument-calls
11772 @opindex fno-chkp-instrument-calls
11773 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
11774 Enabled by default.
11775
11776 @item -fchkp-instrument-marked-only
11777 @opindex fchkp-instrument-marked-only
11778 @opindex fno-chkp-instrument-marked-only
11779 Instructs Pointer Bounds Checker to instrument only functions
11780 marked with the @code{bnd_instrument} attribute
11781 (@pxref{Function Attributes}). Disabled by default.
11782
11783 @item -fchkp-use-wrappers
11784 @opindex fchkp-use-wrappers
11785 @opindex fno-chkp-use-wrappers
11786 Allows Pointer Bounds Checker to replace calls to built-in functions
11787 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
11788 is used to link a program, the GCC driver automatically links
11789 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
11790 Enabled by default.
11791
11792 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11793 @opindex fcf-protection
11794 Enable code instrumentation of control-flow transfers to increase
11795 program security by checking that target addresses of control-flow
11796 transfer instructions (such as indirect function call, function return,
11797 indirect jump) are valid. This prevents diverting the flow of control
11798 to an unexpected target. This is intended to protect against such
11799 threats as Return-oriented Programming (ROP), and similarly
11800 call/jmp-oriented programming (COP/JOP).
11801
11802 The value @code{branch} tells the compiler to implement checking of
11803 validity of control-flow transfer at the point of indirect branch
11804 instructions, i.e. call/jmp instructions. The value @code{return}
11805 implements checking of validity at the point of returning from a
11806 function. The value @code{full} is an alias for specifying both
11807 @code{branch} and @code{return}. The value @code{none} turns off
11808 instrumentation.
11809
11810 The macro @code{__CET__} is defined when @option{-fcf-protection} is
11811 used. The first bit of @code{__CET__} is set to 1 for the value
11812 @code{branch} and the second bit of @code{__CET__} is set to 1 for
11813 the @code{return}.
11814
11815 You can also use the @code{nocf_check} attribute to identify
11816 which functions and calls should be skipped from instrumentation
11817 (@pxref{Function Attributes}).
11818
11819 Currently the x86 GNU/Linux target provides an implementation based
11820 on Intel Control-flow Enforcement Technology (CET).
11821
11822 @item -fstack-protector
11823 @opindex fstack-protector
11824 Emit extra code to check for buffer overflows, such as stack smashing
11825 attacks. This is done by adding a guard variable to functions with
11826 vulnerable objects. This includes functions that call @code{alloca}, and
11827 functions with buffers larger than 8 bytes. The guards are initialized
11828 when a function is entered and then checked when the function exits.
11829 If a guard check fails, an error message is printed and the program exits.
11830
11831 @item -fstack-protector-all
11832 @opindex fstack-protector-all
11833 Like @option{-fstack-protector} except that all functions are protected.
11834
11835 @item -fstack-protector-strong
11836 @opindex fstack-protector-strong
11837 Like @option{-fstack-protector} but includes additional functions to
11838 be protected --- those that have local array definitions, or have
11839 references to local frame addresses.
11840
11841 @item -fstack-protector-explicit
11842 @opindex fstack-protector-explicit
11843 Like @option{-fstack-protector} but only protects those functions which
11844 have the @code{stack_protect} attribute.
11845
11846 @item -fstack-check
11847 @opindex fstack-check
11848 Generate code to verify that you do not go beyond the boundary of the
11849 stack. You should specify this flag if you are running in an
11850 environment with multiple threads, but you only rarely need to specify it in
11851 a single-threaded environment since stack overflow is automatically
11852 detected on nearly all systems if there is only one stack.
11853
11854 Note that this switch does not actually cause checking to be done; the
11855 operating system or the language runtime must do that. The switch causes
11856 generation of code to ensure that they see the stack being extended.
11857
11858 You can additionally specify a string parameter: @samp{no} means no
11859 checking, @samp{generic} means force the use of old-style checking,
11860 @samp{specific} means use the best checking method and is equivalent
11861 to bare @option{-fstack-check}.
11862
11863 Old-style checking is a generic mechanism that requires no specific
11864 target support in the compiler but comes with the following drawbacks:
11865
11866 @enumerate
11867 @item
11868 Modified allocation strategy for large objects: they are always
11869 allocated dynamically if their size exceeds a fixed threshold. Note this
11870 may change the semantics of some code.
11871
11872 @item
11873 Fixed limit on the size of the static frame of functions: when it is
11874 topped by a particular function, stack checking is not reliable and
11875 a warning is issued by the compiler.
11876
11877 @item
11878 Inefficiency: because of both the modified allocation strategy and the
11879 generic implementation, code performance is hampered.
11880 @end enumerate
11881
11882 Note that old-style stack checking is also the fallback method for
11883 @samp{specific} if no target support has been added in the compiler.
11884
11885 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
11886 and stack overflows. @samp{specific} is an excellent choice when compiling
11887 Ada code. It is not generally sufficient to protect against stack-clash
11888 attacks. To protect against those you want @samp{-fstack-clash-protection}.
11889
11890 @item -fstack-clash-protection
11891 @opindex fstack-clash-protection
11892 Generate code to prevent stack clash style attacks. When this option is
11893 enabled, the compiler will only allocate one page of stack space at a time
11894 and each page is accessed immediately after allocation. Thus, it prevents
11895 allocations from jumping over any stack guard page provided by the
11896 operating system.
11897
11898 Most targets do not fully support stack clash protection. However, on
11899 those targets @option{-fstack-clash-protection} will protect dynamic stack
11900 allocations. @option{-fstack-clash-protection} may also provide limited
11901 protection for static stack allocations if the target supports
11902 @option{-fstack-check=specific}.
11903
11904 @item -fstack-limit-register=@var{reg}
11905 @itemx -fstack-limit-symbol=@var{sym}
11906 @itemx -fno-stack-limit
11907 @opindex fstack-limit-register
11908 @opindex fstack-limit-symbol
11909 @opindex fno-stack-limit
11910 Generate code to ensure that the stack does not grow beyond a certain value,
11911 either the value of a register or the address of a symbol. If a larger
11912 stack is required, a signal is raised at run time. For most targets,
11913 the signal is raised before the stack overruns the boundary, so
11914 it is possible to catch the signal without taking special precautions.
11915
11916 For instance, if the stack starts at absolute address @samp{0x80000000}
11917 and grows downwards, you can use the flags
11918 @option{-fstack-limit-symbol=__stack_limit} and
11919 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11920 of 128KB@. Note that this may only work with the GNU linker.
11921
11922 You can locally override stack limit checking by using the
11923 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11924
11925 @item -fsplit-stack
11926 @opindex fsplit-stack
11927 Generate code to automatically split the stack before it overflows.
11928 The resulting program has a discontiguous stack which can only
11929 overflow if the program is unable to allocate any more memory. This
11930 is most useful when running threaded programs, as it is no longer
11931 necessary to calculate a good stack size to use for each thread. This
11932 is currently only implemented for the x86 targets running
11933 GNU/Linux.
11934
11935 When code compiled with @option{-fsplit-stack} calls code compiled
11936 without @option{-fsplit-stack}, there may not be much stack space
11937 available for the latter code to run. If compiling all code,
11938 including library code, with @option{-fsplit-stack} is not an option,
11939 then the linker can fix up these calls so that the code compiled
11940 without @option{-fsplit-stack} always has a large stack. Support for
11941 this is implemented in the gold linker in GNU binutils release 2.21
11942 and later.
11943
11944 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11945 @opindex fvtable-verify
11946 This option is only available when compiling C++ code.
11947 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11948 feature that verifies at run time, for every virtual call, that
11949 the vtable pointer through which the call is made is valid for the type of
11950 the object, and has not been corrupted or overwritten. If an invalid vtable
11951 pointer is detected at run time, an error is reported and execution of the
11952 program is immediately halted.
11953
11954 This option causes run-time data structures to be built at program startup,
11955 which are used for verifying the vtable pointers.
11956 The options @samp{std} and @samp{preinit}
11957 control the timing of when these data structures are built. In both cases the
11958 data structures are built before execution reaches @code{main}. Using
11959 @option{-fvtable-verify=std} causes the data structures to be built after
11960 shared libraries have been loaded and initialized.
11961 @option{-fvtable-verify=preinit} causes them to be built before shared
11962 libraries have been loaded and initialized.
11963
11964 If this option appears multiple times in the command line with different
11965 values specified, @samp{none} takes highest priority over both @samp{std} and
11966 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11967
11968 @item -fvtv-debug
11969 @opindex fvtv-debug
11970 When used in conjunction with @option{-fvtable-verify=std} or
11971 @option{-fvtable-verify=preinit}, causes debug versions of the
11972 runtime functions for the vtable verification feature to be called.
11973 This flag also causes the compiler to log information about which
11974 vtable pointers it finds for each class.
11975 This information is written to a file named @file{vtv_set_ptr_data.log}
11976 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11977 if that is defined or the current working directory otherwise.
11978
11979 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11980 file, be sure to delete any existing one.
11981
11982 @item -fvtv-counts
11983 @opindex fvtv-counts
11984 This is a debugging flag. When used in conjunction with
11985 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11986 causes the compiler to keep track of the total number of virtual calls
11987 it encounters and the number of verifications it inserts. It also
11988 counts the number of calls to certain run-time library functions
11989 that it inserts and logs this information for each compilation unit.
11990 The compiler writes this information to a file named
11991 @file{vtv_count_data.log} in the directory named by the environment
11992 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11993 directory otherwise. It also counts the size of the vtable pointer sets
11994 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11995 in the same directory.
11996
11997 Note: This feature @emph{appends} data to the log files. To get fresh log
11998 files, be sure to delete any existing ones.
11999
12000 @item -finstrument-functions
12001 @opindex finstrument-functions
12002 Generate instrumentation calls for entry and exit to functions. Just
12003 after function entry and just before function exit, the following
12004 profiling functions are called with the address of the current
12005 function and its call site. (On some platforms,
12006 @code{__builtin_return_address} does not work beyond the current
12007 function, so the call site information may not be available to the
12008 profiling functions otherwise.)
12009
12010 @smallexample
12011 void __cyg_profile_func_enter (void *this_fn,
12012 void *call_site);
12013 void __cyg_profile_func_exit (void *this_fn,
12014 void *call_site);
12015 @end smallexample
12016
12017 The first argument is the address of the start of the current function,
12018 which may be looked up exactly in the symbol table.
12019
12020 This instrumentation is also done for functions expanded inline in other
12021 functions. The profiling calls indicate where, conceptually, the
12022 inline function is entered and exited. This means that addressable
12023 versions of such functions must be available. If all your uses of a
12024 function are expanded inline, this may mean an additional expansion of
12025 code size. If you use @code{extern inline} in your C code, an
12026 addressable version of such functions must be provided. (This is
12027 normally the case anyway, but if you get lucky and the optimizer always
12028 expands the functions inline, you might have gotten away without
12029 providing static copies.)
12030
12031 A function may be given the attribute @code{no_instrument_function}, in
12032 which case this instrumentation is not done. This can be used, for
12033 example, for the profiling functions listed above, high-priority
12034 interrupt routines, and any functions from which the profiling functions
12035 cannot safely be called (perhaps signal handlers, if the profiling
12036 routines generate output or allocate memory).
12037
12038 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12039 @opindex finstrument-functions-exclude-file-list
12040
12041 Set the list of functions that are excluded from instrumentation (see
12042 the description of @option{-finstrument-functions}). If the file that
12043 contains a function definition matches with one of @var{file}, then
12044 that function is not instrumented. The match is done on substrings:
12045 if the @var{file} parameter is a substring of the file name, it is
12046 considered to be a match.
12047
12048 For example:
12049
12050 @smallexample
12051 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12052 @end smallexample
12053
12054 @noindent
12055 excludes any inline function defined in files whose pathnames
12056 contain @file{/bits/stl} or @file{include/sys}.
12057
12058 If, for some reason, you want to include letter @samp{,} in one of
12059 @var{sym}, write @samp{\,}. For example,
12060 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12061 (note the single quote surrounding the option).
12062
12063 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12064 @opindex finstrument-functions-exclude-function-list
12065
12066 This is similar to @option{-finstrument-functions-exclude-file-list},
12067 but this option sets the list of function names to be excluded from
12068 instrumentation. The function name to be matched is its user-visible
12069 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12070 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12071 match is done on substrings: if the @var{sym} parameter is a substring
12072 of the function name, it is considered to be a match. For C99 and C++
12073 extended identifiers, the function name must be given in UTF-8, not
12074 using universal character names.
12075
12076 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12077 @opindex fpatchable-function-entry
12078 Generate @var{N} NOPs right at the beginning
12079 of each function, with the function entry point before the @var{M}th NOP.
12080 If @var{M} is omitted, it defaults to @code{0} so the
12081 function entry points to the address just at the first NOP.
12082 The NOP instructions reserve extra space which can be used to patch in
12083 any desired instrumentation at run time, provided that the code segment
12084 is writable. The amount of space is controllable indirectly via
12085 the number of NOPs; the NOP instruction used corresponds to the instruction
12086 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12087 is target-specific and may also depend on the architecture variant and/or
12088 other compilation options.
12089
12090 For run-time identification, the starting addresses of these areas,
12091 which correspond to their respective function entries minus @var{M},
12092 are additionally collected in the @code{__patchable_function_entries}
12093 section of the resulting binary.
12094
12095 Note that the value of @code{__attribute__ ((patchable_function_entry
12096 (N,M)))} takes precedence over command-line option
12097 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12098 the area size or to remove it completely on a single function.
12099 If @code{N=0}, no pad location is recorded.
12100
12101 The NOP instructions are inserted at---and maybe before, depending on
12102 @var{M}---the function entry address, even before the prologue.
12103
12104 @end table
12105
12106
12107 @node Preprocessor Options
12108 @section Options Controlling the Preprocessor
12109 @cindex preprocessor options
12110 @cindex options, preprocessor
12111
12112 These options control the C preprocessor, which is run on each C source
12113 file before actual compilation.
12114
12115 If you use the @option{-E} option, nothing is done except preprocessing.
12116 Some of these options make sense only together with @option{-E} because
12117 they cause the preprocessor output to be unsuitable for actual
12118 compilation.
12119
12120 In addition to the options listed here, there are a number of options
12121 to control search paths for include files documented in
12122 @ref{Directory Options}.
12123 Options to control preprocessor diagnostics are listed in
12124 @ref{Warning Options}.
12125
12126 @table @gcctabopt
12127 @include cppopts.texi
12128
12129 @item -Wp,@var{option}
12130 @opindex Wp
12131 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12132 and pass @var{option} directly through to the preprocessor. If
12133 @var{option} contains commas, it is split into multiple options at the
12134 commas. However, many options are modified, translated or interpreted
12135 by the compiler driver before being passed to the preprocessor, and
12136 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12137 interface is undocumented and subject to change, so whenever possible
12138 you should avoid using @option{-Wp} and let the driver handle the
12139 options instead.
12140
12141 @item -Xpreprocessor @var{option}
12142 @opindex Xpreprocessor
12143 Pass @var{option} as an option to the preprocessor. You can use this to
12144 supply system-specific preprocessor options that GCC does not
12145 recognize.
12146
12147 If you want to pass an option that takes an argument, you must use
12148 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12149
12150 @item -no-integrated-cpp
12151 @opindex no-integrated-cpp
12152 Perform preprocessing as a separate pass before compilation.
12153 By default, GCC performs preprocessing as an integrated part of
12154 input tokenization and parsing.
12155 If this option is provided, the appropriate language front end
12156 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12157 and Objective-C, respectively) is instead invoked twice,
12158 once for preprocessing only and once for actual compilation
12159 of the preprocessed input.
12160 This option may be useful in conjunction with the @option{-B} or
12161 @option{-wrapper} options to specify an alternate preprocessor or
12162 perform additional processing of the program source between
12163 normal preprocessing and compilation.
12164
12165 @end table
12166
12167 @node Assembler Options
12168 @section Passing Options to the Assembler
12169
12170 @c prevent bad page break with this line
12171 You can pass options to the assembler.
12172
12173 @table @gcctabopt
12174 @item -Wa,@var{option}
12175 @opindex Wa
12176 Pass @var{option} as an option to the assembler. If @var{option}
12177 contains commas, it is split into multiple options at the commas.
12178
12179 @item -Xassembler @var{option}
12180 @opindex Xassembler
12181 Pass @var{option} as an option to the assembler. You can use this to
12182 supply system-specific assembler options that GCC does not
12183 recognize.
12184
12185 If you want to pass an option that takes an argument, you must use
12186 @option{-Xassembler} twice, once for the option and once for the argument.
12187
12188 @end table
12189
12190 @node Link Options
12191 @section Options for Linking
12192 @cindex link options
12193 @cindex options, linking
12194
12195 These options come into play when the compiler links object files into
12196 an executable output file. They are meaningless if the compiler is
12197 not doing a link step.
12198
12199 @table @gcctabopt
12200 @cindex file names
12201 @item @var{object-file-name}
12202 A file name that does not end in a special recognized suffix is
12203 considered to name an object file or library. (Object files are
12204 distinguished from libraries by the linker according to the file
12205 contents.) If linking is done, these object files are used as input
12206 to the linker.
12207
12208 @item -c
12209 @itemx -S
12210 @itemx -E
12211 @opindex c
12212 @opindex S
12213 @opindex E
12214 If any of these options is used, then the linker is not run, and
12215 object file names should not be used as arguments. @xref{Overall
12216 Options}.
12217
12218 @item -fuse-ld=bfd
12219 @opindex fuse-ld=bfd
12220 Use the @command{bfd} linker instead of the default linker.
12221
12222 @item -fuse-ld=gold
12223 @opindex fuse-ld=gold
12224 Use the @command{gold} linker instead of the default linker.
12225
12226 @cindex Libraries
12227 @item -l@var{library}
12228 @itemx -l @var{library}
12229 @opindex l
12230 Search the library named @var{library} when linking. (The second
12231 alternative with the library as a separate argument is only for
12232 POSIX compliance and is not recommended.)
12233
12234 It makes a difference where in the command you write this option; the
12235 linker searches and processes libraries and object files in the order they
12236 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12237 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12238 to functions in @samp{z}, those functions may not be loaded.
12239
12240 The linker searches a standard list of directories for the library,
12241 which is actually a file named @file{lib@var{library}.a}. The linker
12242 then uses this file as if it had been specified precisely by name.
12243
12244 The directories searched include several standard system directories
12245 plus any that you specify with @option{-L}.
12246
12247 Normally the files found this way are library files---archive files
12248 whose members are object files. The linker handles an archive file by
12249 scanning through it for members which define symbols that have so far
12250 been referenced but not defined. But if the file that is found is an
12251 ordinary object file, it is linked in the usual fashion. The only
12252 difference between using an @option{-l} option and specifying a file name
12253 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12254 and searches several directories.
12255
12256 @item -lobjc
12257 @opindex lobjc
12258 You need this special case of the @option{-l} option in order to
12259 link an Objective-C or Objective-C++ program.
12260
12261 @item -nostartfiles
12262 @opindex nostartfiles
12263 Do not use the standard system startup files when linking.
12264 The standard system libraries are used normally, unless @option{-nostdlib}
12265 or @option{-nodefaultlibs} is used.
12266
12267 @item -nodefaultlibs
12268 @opindex nodefaultlibs
12269 Do not use the standard system libraries when linking.
12270 Only the libraries you specify are passed to the linker, and options
12271 specifying linkage of the system libraries, such as @option{-static-libgcc}
12272 or @option{-shared-libgcc}, are ignored.
12273 The standard startup files are used normally, unless @option{-nostartfiles}
12274 is used.
12275
12276 The compiler may generate calls to @code{memcmp},
12277 @code{memset}, @code{memcpy} and @code{memmove}.
12278 These entries are usually resolved by entries in
12279 libc. These entry points should be supplied through some other
12280 mechanism when this option is specified.
12281
12282 @item -nostdlib
12283 @opindex nostdlib
12284 Do not use the standard system startup files or libraries when linking.
12285 No startup files and only the libraries you specify are passed to
12286 the linker, and options specifying linkage of the system libraries, such as
12287 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12288
12289 The compiler may generate calls to @code{memcmp}, @code{memset},
12290 @code{memcpy} and @code{memmove}.
12291 These entries are usually resolved by entries in
12292 libc. These entry points should be supplied through some other
12293 mechanism when this option is specified.
12294
12295 @cindex @option{-lgcc}, use with @option{-nostdlib}
12296 @cindex @option{-nostdlib} and unresolved references
12297 @cindex unresolved references and @option{-nostdlib}
12298 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12299 @cindex @option{-nodefaultlibs} and unresolved references
12300 @cindex unresolved references and @option{-nodefaultlibs}
12301 One of the standard libraries bypassed by @option{-nostdlib} and
12302 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12303 which GCC uses to overcome shortcomings of particular machines, or special
12304 needs for some languages.
12305 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12306 Collection (GCC) Internals},
12307 for more discussion of @file{libgcc.a}.)
12308 In most cases, you need @file{libgcc.a} even when you want to avoid
12309 other standard libraries. In other words, when you specify @option{-nostdlib}
12310 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12311 This ensures that you have no unresolved references to internal GCC
12312 library subroutines.
12313 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12314 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12315 GNU Compiler Collection (GCC) Internals}.)
12316
12317 @item -pie
12318 @opindex pie
12319 Produce a dynamically linked position independent executable on targets
12320 that support it. For predictable results, you must also specify the same
12321 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12322 or model suboptions) when you specify this linker option.
12323
12324 @item -no-pie
12325 @opindex no-pie
12326 Don't produce a dynamically linked position independent executable.
12327
12328 @item -static-pie
12329 @opindex static-pie
12330 Produce a static position independent executable on targets that support
12331 it. A static position independent executable is similar to a static
12332 executable, but can be loaded at any address without a dynamic linker.
12333 For predictable results, you must also specify the same set of options
12334 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12335 suboptions) when you specify this linker option.
12336
12337 @item -pthread
12338 @opindex pthread
12339 Link with the POSIX threads library. This option is supported on
12340 GNU/Linux targets, most other Unix derivatives, and also on
12341 x86 Cygwin and MinGW targets. On some targets this option also sets
12342 flags for the preprocessor, so it should be used consistently for both
12343 compilation and linking.
12344
12345 @item -rdynamic
12346 @opindex rdynamic
12347 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12348 that support it. This instructs the linker to add all symbols, not
12349 only used ones, to the dynamic symbol table. This option is needed
12350 for some uses of @code{dlopen} or to allow obtaining backtraces
12351 from within a program.
12352
12353 @item -s
12354 @opindex s
12355 Remove all symbol table and relocation information from the executable.
12356
12357 @item -static
12358 @opindex static
12359 On systems that support dynamic linking, this overrides @option{-pie}
12360 and prevents linking with the shared libraries. On other systems, this
12361 option has no effect.
12362
12363 @item -shared
12364 @opindex shared
12365 Produce a shared object which can then be linked with other objects to
12366 form an executable. Not all systems support this option. For predictable
12367 results, you must also specify the same set of options used for compilation
12368 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12369 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12370 needs to build supplementary stub code for constructors to work. On
12371 multi-libbed systems, @samp{gcc -shared} must select the correct support
12372 libraries to link against. Failing to supply the correct flags may lead
12373 to subtle defects. Supplying them in cases where they are not necessary
12374 is innocuous.}
12375
12376 @item -shared-libgcc
12377 @itemx -static-libgcc
12378 @opindex shared-libgcc
12379 @opindex static-libgcc
12380 On systems that provide @file{libgcc} as a shared library, these options
12381 force the use of either the shared or static version, respectively.
12382 If no shared version of @file{libgcc} was built when the compiler was
12383 configured, these options have no effect.
12384
12385 There are several situations in which an application should use the
12386 shared @file{libgcc} instead of the static version. The most common
12387 of these is when the application wishes to throw and catch exceptions
12388 across different shared libraries. In that case, each of the libraries
12389 as well as the application itself should use the shared @file{libgcc}.
12390
12391 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
12392 whenever you build a shared library or a main executable, because C++
12393 programs typically use exceptions, so this is the right thing to do.
12394
12395 If, instead, you use the GCC driver to create shared libraries, you may
12396 find that they are not always linked with the shared @file{libgcc}.
12397 If GCC finds, at its configuration time, that you have a non-GNU linker
12398 or a GNU linker that does not support option @option{--eh-frame-hdr},
12399 it links the shared version of @file{libgcc} into shared libraries
12400 by default. Otherwise, it takes advantage of the linker and optimizes
12401 away the linking with the shared version of @file{libgcc}, linking with
12402 the static version of libgcc by default. This allows exceptions to
12403 propagate through such shared libraries, without incurring relocation
12404 costs at library load time.
12405
12406 However, if a library or main executable is supposed to throw or catch
12407 exceptions, you must link it using the G++ driver, as appropriate
12408 for the languages used in the program, or using the option
12409 @option{-shared-libgcc}, such that it is linked with the shared
12410 @file{libgcc}.
12411
12412 @item -static-libasan
12413 @opindex static-libasan
12414 When the @option{-fsanitize=address} option is used to link a program,
12415 the GCC driver automatically links against @option{libasan}. If
12416 @file{libasan} is available as a shared library, and the @option{-static}
12417 option is not used, then this links against the shared version of
12418 @file{libasan}. The @option{-static-libasan} option directs the GCC
12419 driver to link @file{libasan} statically, without necessarily linking
12420 other libraries statically.
12421
12422 @item -static-libtsan
12423 @opindex static-libtsan
12424 When the @option{-fsanitize=thread} option is used to link a program,
12425 the GCC driver automatically links against @option{libtsan}. If
12426 @file{libtsan} is available as a shared library, and the @option{-static}
12427 option is not used, then this links against the shared version of
12428 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12429 driver to link @file{libtsan} statically, without necessarily linking
12430 other libraries statically.
12431
12432 @item -static-liblsan
12433 @opindex static-liblsan
12434 When the @option{-fsanitize=leak} option is used to link a program,
12435 the GCC driver automatically links against @option{liblsan}. If
12436 @file{liblsan} is available as a shared library, and the @option{-static}
12437 option is not used, then this links against the shared version of
12438 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12439 driver to link @file{liblsan} statically, without necessarily linking
12440 other libraries statically.
12441
12442 @item -static-libubsan
12443 @opindex static-libubsan
12444 When the @option{-fsanitize=undefined} option is used to link a program,
12445 the GCC driver automatically links against @option{libubsan}. If
12446 @file{libubsan} is available as a shared library, and the @option{-static}
12447 option is not used, then this links against the shared version of
12448 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12449 driver to link @file{libubsan} statically, without necessarily linking
12450 other libraries statically.
12451
12452 @item -static-libmpx
12453 @opindex static-libmpx
12454 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
12455 used to link a program, the GCC driver automatically links against
12456 @file{libmpx}. If @file{libmpx} is available as a shared library,
12457 and the @option{-static} option is not used, then this links against
12458 the shared version of @file{libmpx}. The @option{-static-libmpx}
12459 option directs the GCC driver to link @file{libmpx} statically,
12460 without necessarily linking other libraries statically.
12461
12462 @item -static-libmpxwrappers
12463 @opindex static-libmpxwrappers
12464 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
12465 to link a program without also using @option{-fno-chkp-use-wrappers}, the
12466 GCC driver automatically links against @file{libmpxwrappers}. If
12467 @file{libmpxwrappers} is available as a shared library, and the
12468 @option{-static} option is not used, then this links against the shared
12469 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
12470 option directs the GCC driver to link @file{libmpxwrappers} statically,
12471 without necessarily linking other libraries statically.
12472
12473 @item -static-libstdc++
12474 @opindex static-libstdc++
12475 When the @command{g++} program is used to link a C++ program, it
12476 normally automatically links against @option{libstdc++}. If
12477 @file{libstdc++} is available as a shared library, and the
12478 @option{-static} option is not used, then this links against the
12479 shared version of @file{libstdc++}. That is normally fine. However, it
12480 is sometimes useful to freeze the version of @file{libstdc++} used by
12481 the program without going all the way to a fully static link. The
12482 @option{-static-libstdc++} option directs the @command{g++} driver to
12483 link @file{libstdc++} statically, without necessarily linking other
12484 libraries statically.
12485
12486 @item -symbolic
12487 @opindex symbolic
12488 Bind references to global symbols when building a shared object. Warn
12489 about any unresolved references (unless overridden by the link editor
12490 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12491 this option.
12492
12493 @item -T @var{script}
12494 @opindex T
12495 @cindex linker script
12496 Use @var{script} as the linker script. This option is supported by most
12497 systems using the GNU linker. On some targets, such as bare-board
12498 targets without an operating system, the @option{-T} option may be required
12499 when linking to avoid references to undefined symbols.
12500
12501 @item -Xlinker @var{option}
12502 @opindex Xlinker
12503 Pass @var{option} as an option to the linker. You can use this to
12504 supply system-specific linker options that GCC does not recognize.
12505
12506 If you want to pass an option that takes a separate argument, you must use
12507 @option{-Xlinker} twice, once for the option and once for the argument.
12508 For example, to pass @option{-assert definitions}, you must write
12509 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12510 @option{-Xlinker "-assert definitions"}, because this passes the entire
12511 string as a single argument, which is not what the linker expects.
12512
12513 When using the GNU linker, it is usually more convenient to pass
12514 arguments to linker options using the @option{@var{option}=@var{value}}
12515 syntax than as separate arguments. For example, you can specify
12516 @option{-Xlinker -Map=output.map} rather than
12517 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12518 this syntax for command-line options.
12519
12520 @item -Wl,@var{option}
12521 @opindex Wl
12522 Pass @var{option} as an option to the linker. If @var{option} contains
12523 commas, it is split into multiple options at the commas. You can use this
12524 syntax to pass an argument to the option.
12525 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12526 linker. When using the GNU linker, you can also get the same effect with
12527 @option{-Wl,-Map=output.map}.
12528
12529 @item -u @var{symbol}
12530 @opindex u
12531 Pretend the symbol @var{symbol} is undefined, to force linking of
12532 library modules to define it. You can use @option{-u} multiple times with
12533 different symbols to force loading of additional library modules.
12534
12535 @item -z @var{keyword}
12536 @opindex z
12537 @option{-z} is passed directly on to the linker along with the keyword
12538 @var{keyword}. See the section in the documentation of your linker for
12539 permitted values and their meanings.
12540 @end table
12541
12542 @node Directory Options
12543 @section Options for Directory Search
12544 @cindex directory options
12545 @cindex options, directory search
12546 @cindex search path
12547
12548 These options specify directories to search for header files, for
12549 libraries and for parts of the compiler:
12550
12551 @table @gcctabopt
12552 @include cppdiropts.texi
12553
12554 @item -iplugindir=@var{dir}
12555 @opindex iplugindir=
12556 Set the directory to search for plugins that are passed
12557 by @option{-fplugin=@var{name}} instead of
12558 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12559 to be used by the user, but only passed by the driver.
12560
12561 @item -L@var{dir}
12562 @opindex L
12563 Add directory @var{dir} to the list of directories to be searched
12564 for @option{-l}.
12565
12566 @item -B@var{prefix}
12567 @opindex B
12568 This option specifies where to find the executables, libraries,
12569 include files, and data files of the compiler itself.
12570
12571 The compiler driver program runs one or more of the subprograms
12572 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12573 @var{prefix} as a prefix for each program it tries to run, both with and
12574 without @samp{@var{machine}/@var{version}/} for the corresponding target
12575 machine and compiler version.
12576
12577 For each subprogram to be run, the compiler driver first tries the
12578 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12579 is not specified, the driver tries two standard prefixes,
12580 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12581 those results in a file name that is found, the unmodified program
12582 name is searched for using the directories specified in your
12583 @env{PATH} environment variable.
12584
12585 The compiler checks to see if the path provided by @option{-B}
12586 refers to a directory, and if necessary it adds a directory
12587 separator character at the end of the path.
12588
12589 @option{-B} prefixes that effectively specify directory names also apply
12590 to libraries in the linker, because the compiler translates these
12591 options into @option{-L} options for the linker. They also apply to
12592 include files in the preprocessor, because the compiler translates these
12593 options into @option{-isystem} options for the preprocessor. In this case,
12594 the compiler appends @samp{include} to the prefix.
12595
12596 The runtime support file @file{libgcc.a} can also be searched for using
12597 the @option{-B} prefix, if needed. If it is not found there, the two
12598 standard prefixes above are tried, and that is all. The file is left
12599 out of the link if it is not found by those means.
12600
12601 Another way to specify a prefix much like the @option{-B} prefix is to use
12602 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12603 Variables}.
12604
12605 As a special kludge, if the path provided by @option{-B} is
12606 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12607 9, then it is replaced by @file{[dir/]include}. This is to help
12608 with boot-strapping the compiler.
12609
12610 @item -no-canonical-prefixes
12611 @opindex no-canonical-prefixes
12612 Do not expand any symbolic links, resolve references to @samp{/../}
12613 or @samp{/./}, or make the path absolute when generating a relative
12614 prefix.
12615
12616 @item --sysroot=@var{dir}
12617 @opindex sysroot
12618 Use @var{dir} as the logical root directory for headers and libraries.
12619 For example, if the compiler normally searches for headers in
12620 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12621 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12622
12623 If you use both this option and the @option{-isysroot} option, then
12624 the @option{--sysroot} option applies to libraries, but the
12625 @option{-isysroot} option applies to header files.
12626
12627 The GNU linker (beginning with version 2.16) has the necessary support
12628 for this option. If your linker does not support this option, the
12629 header file aspect of @option{--sysroot} still works, but the
12630 library aspect does not.
12631
12632 @item --no-sysroot-suffix
12633 @opindex no-sysroot-suffix
12634 For some targets, a suffix is added to the root directory specified
12635 with @option{--sysroot}, depending on the other options used, so that
12636 headers may for example be found in
12637 @file{@var{dir}/@var{suffix}/usr/include} instead of
12638 @file{@var{dir}/usr/include}. This option disables the addition of
12639 such a suffix.
12640
12641 @end table
12642
12643 @node Code Gen Options
12644 @section Options for Code Generation Conventions
12645 @cindex code generation conventions
12646 @cindex options, code generation
12647 @cindex run-time options
12648
12649 These machine-independent options control the interface conventions
12650 used in code generation.
12651
12652 Most of them have both positive and negative forms; the negative form
12653 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12654 one of the forms is listed---the one that is not the default. You
12655 can figure out the other form by either removing @samp{no-} or adding
12656 it.
12657
12658 @table @gcctabopt
12659 @item -fstack-reuse=@var{reuse-level}
12660 @opindex fstack_reuse
12661 This option controls stack space reuse for user declared local/auto variables
12662 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12663 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12664 local variables and temporaries, @samp{named_vars} enables the reuse only for
12665 user defined local variables with names, and @samp{none} disables stack reuse
12666 completely. The default value is @samp{all}. The option is needed when the
12667 program extends the lifetime of a scoped local variable or a compiler generated
12668 temporary beyond the end point defined by the language. When a lifetime of
12669 a variable ends, and if the variable lives in memory, the optimizing compiler
12670 has the freedom to reuse its stack space with other temporaries or scoped
12671 local variables whose live range does not overlap with it. Legacy code extending
12672 local lifetime is likely to break with the stack reuse optimization.
12673
12674 For example,
12675
12676 @smallexample
12677 int *p;
12678 @{
12679 int local1;
12680
12681 p = &local1;
12682 local1 = 10;
12683 ....
12684 @}
12685 @{
12686 int local2;
12687 local2 = 20;
12688 ...
12689 @}
12690
12691 if (*p == 10) // out of scope use of local1
12692 @{
12693
12694 @}
12695 @end smallexample
12696
12697 Another example:
12698 @smallexample
12699
12700 struct A
12701 @{
12702 A(int k) : i(k), j(k) @{ @}
12703 int i;
12704 int j;
12705 @};
12706
12707 A *ap;
12708
12709 void foo(const A& ar)
12710 @{
12711 ap = &ar;
12712 @}
12713
12714 void bar()
12715 @{
12716 foo(A(10)); // temp object's lifetime ends when foo returns
12717
12718 @{
12719 A a(20);
12720 ....
12721 @}
12722 ap->i+= 10; // ap references out of scope temp whose space
12723 // is reused with a. What is the value of ap->i?
12724 @}
12725
12726 @end smallexample
12727
12728 The lifetime of a compiler generated temporary is well defined by the C++
12729 standard. When a lifetime of a temporary ends, and if the temporary lives
12730 in memory, the optimizing compiler has the freedom to reuse its stack
12731 space with other temporaries or scoped local variables whose live range
12732 does not overlap with it. However some of the legacy code relies on
12733 the behavior of older compilers in which temporaries' stack space is
12734 not reused, the aggressive stack reuse can lead to runtime errors. This
12735 option is used to control the temporary stack reuse optimization.
12736
12737 @item -ftrapv
12738 @opindex ftrapv
12739 This option generates traps for signed overflow on addition, subtraction,
12740 multiplication operations.
12741 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12742 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12743 @option{-fwrapv} being effective. Note that only active options override, so
12744 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12745 results in @option{-ftrapv} being effective.
12746
12747 @item -fwrapv
12748 @opindex fwrapv
12749 This option instructs the compiler to assume that signed arithmetic
12750 overflow of addition, subtraction and multiplication wraps around
12751 using twos-complement representation. This flag enables some optimizations
12752 and disables others.
12753 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12754 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12755 @option{-fwrapv} being effective. Note that only active options override, so
12756 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12757 results in @option{-ftrapv} being effective.
12758
12759 @item -fwrapv-pointer
12760 @opindex fwrapv-pointer
12761 This option instructs the compiler to assume that pointer arithmetic
12762 overflow on addition and subtraction wraps around using twos-complement
12763 representation. This flag disables some optimizations which assume
12764 pointer overflow is invalid.
12765
12766 @item -fstrict-overflow
12767 @opindex fstrict-overflow
12768 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
12769 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
12770
12771 @item -fexceptions
12772 @opindex fexceptions
12773 Enable exception handling. Generates extra code needed to propagate
12774 exceptions. For some targets, this implies GCC generates frame
12775 unwind information for all functions, which can produce significant data
12776 size overhead, although it does not affect execution. If you do not
12777 specify this option, GCC enables it by default for languages like
12778 C++ that normally require exception handling, and disables it for
12779 languages like C that do not normally require it. However, you may need
12780 to enable this option when compiling C code that needs to interoperate
12781 properly with exception handlers written in C++. You may also wish to
12782 disable this option if you are compiling older C++ programs that don't
12783 use exception handling.
12784
12785 @item -fnon-call-exceptions
12786 @opindex fnon-call-exceptions
12787 Generate code that allows trapping instructions to throw exceptions.
12788 Note that this requires platform-specific runtime support that does
12789 not exist everywhere. Moreover, it only allows @emph{trapping}
12790 instructions to throw exceptions, i.e.@: memory references or floating-point
12791 instructions. It does not allow exceptions to be thrown from
12792 arbitrary signal handlers such as @code{SIGALRM}.
12793
12794 @item -fdelete-dead-exceptions
12795 @opindex fdelete-dead-exceptions
12796 Consider that instructions that may throw exceptions but don't otherwise
12797 contribute to the execution of the program can be optimized away.
12798 This option is enabled by default for the Ada front end, as permitted by
12799 the Ada language specification.
12800 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12801
12802 @item -funwind-tables
12803 @opindex funwind-tables
12804 Similar to @option{-fexceptions}, except that it just generates any needed
12805 static data, but does not affect the generated code in any other way.
12806 You normally do not need to enable this option; instead, a language processor
12807 that needs this handling enables it on your behalf.
12808
12809 @item -fasynchronous-unwind-tables
12810 @opindex fasynchronous-unwind-tables
12811 Generate unwind table in DWARF format, if supported by target machine. The
12812 table is exact at each instruction boundary, so it can be used for stack
12813 unwinding from asynchronous events (such as debugger or garbage collector).
12814
12815 @item -fno-gnu-unique
12816 @opindex fno-gnu-unique
12817 On systems with recent GNU assembler and C library, the C++ compiler
12818 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12819 of template static data members and static local variables in inline
12820 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12821 is necessary to avoid problems with a library used by two different
12822 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12823 therefore disagreeing with the other one about the binding of the
12824 symbol. But this causes @code{dlclose} to be ignored for affected
12825 DSOs; if your program relies on reinitialization of a DSO via
12826 @code{dlclose} and @code{dlopen}, you can use
12827 @option{-fno-gnu-unique}.
12828
12829 @item -fpcc-struct-return
12830 @opindex fpcc-struct-return
12831 Return ``short'' @code{struct} and @code{union} values in memory like
12832 longer ones, rather than in registers. This convention is less
12833 efficient, but it has the advantage of allowing intercallability between
12834 GCC-compiled files and files compiled with other compilers, particularly
12835 the Portable C Compiler (pcc).
12836
12837 The precise convention for returning structures in memory depends
12838 on the target configuration macros.
12839
12840 Short structures and unions are those whose size and alignment match
12841 that of some integer type.
12842
12843 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12844 switch is not binary compatible with code compiled with the
12845 @option{-freg-struct-return} switch.
12846 Use it to conform to a non-default application binary interface.
12847
12848 @item -freg-struct-return
12849 @opindex freg-struct-return
12850 Return @code{struct} and @code{union} values in registers when possible.
12851 This is more efficient for small structures than
12852 @option{-fpcc-struct-return}.
12853
12854 If you specify neither @option{-fpcc-struct-return} nor
12855 @option{-freg-struct-return}, GCC defaults to whichever convention is
12856 standard for the target. If there is no standard convention, GCC
12857 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12858 the principal compiler. In those cases, we can choose the standard, and
12859 we chose the more efficient register return alternative.
12860
12861 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12862 switch is not binary compatible with code compiled with the
12863 @option{-fpcc-struct-return} switch.
12864 Use it to conform to a non-default application binary interface.
12865
12866 @item -fshort-enums
12867 @opindex fshort-enums
12868 Allocate to an @code{enum} type only as many bytes as it needs for the
12869 declared range of possible values. Specifically, the @code{enum} type
12870 is equivalent to the smallest integer type that has enough room.
12871
12872 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12873 code that is not binary compatible with code generated without that switch.
12874 Use it to conform to a non-default application binary interface.
12875
12876 @item -fshort-wchar
12877 @opindex fshort-wchar
12878 Override the underlying type for @code{wchar_t} to be @code{short
12879 unsigned int} instead of the default for the target. This option is
12880 useful for building programs to run under WINE@.
12881
12882 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12883 code that is not binary compatible with code generated without that switch.
12884 Use it to conform to a non-default application binary interface.
12885
12886 @item -fno-common
12887 @opindex fno-common
12888 @cindex tentative definitions
12889 In C code, this option controls the placement of global variables
12890 defined without an initializer, known as @dfn{tentative definitions}
12891 in the C standard. Tentative definitions are distinct from declarations
12892 of a variable with the @code{extern} keyword, which do not allocate storage.
12893
12894 Unix C compilers have traditionally allocated storage for
12895 uninitialized global variables in a common block. This allows the
12896 linker to resolve all tentative definitions of the same variable
12897 in different compilation units to the same object, or to a non-tentative
12898 definition.
12899 This is the behavior specified by @option{-fcommon}, and is the default for
12900 GCC on most targets.
12901 On the other hand, this behavior is not required by ISO
12902 C, and on some targets may carry a speed or code size penalty on
12903 variable references.
12904
12905 The @option{-fno-common} option specifies that the compiler should instead
12906 place uninitialized global variables in the data section of the object file.
12907 This inhibits the merging of tentative definitions by the linker so
12908 you get a multiple-definition error if the same
12909 variable is defined in more than one compilation unit.
12910 Compiling with @option{-fno-common} is useful on targets for which
12911 it provides better performance, or if you wish to verify that the
12912 program will work on other systems that always treat uninitialized
12913 variable definitions this way.
12914
12915 @item -fno-ident
12916 @opindex fno-ident
12917 Ignore the @code{#ident} directive.
12918
12919 @item -finhibit-size-directive
12920 @opindex finhibit-size-directive
12921 Don't output a @code{.size} assembler directive, or anything else that
12922 would cause trouble if the function is split in the middle, and the
12923 two halves are placed at locations far apart in memory. This option is
12924 used when compiling @file{crtstuff.c}; you should not need to use it
12925 for anything else.
12926
12927 @item -fverbose-asm
12928 @opindex fverbose-asm
12929 Put extra commentary information in the generated assembly code to
12930 make it more readable. This option is generally only of use to those
12931 who actually need to read the generated assembly code (perhaps while
12932 debugging the compiler itself).
12933
12934 @option{-fno-verbose-asm}, the default, causes the
12935 extra information to be omitted and is useful when comparing two assembler
12936 files.
12937
12938 The added comments include:
12939
12940 @itemize @bullet
12941
12942 @item
12943 information on the compiler version and command-line options,
12944
12945 @item
12946 the source code lines associated with the assembly instructions,
12947 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12948
12949 @item
12950 hints on which high-level expressions correspond to
12951 the various assembly instruction operands.
12952
12953 @end itemize
12954
12955 For example, given this C source file:
12956
12957 @smallexample
12958 int test (int n)
12959 @{
12960 int i;
12961 int total = 0;
12962
12963 for (i = 0; i < n; i++)
12964 total += i * i;
12965
12966 return total;
12967 @}
12968 @end smallexample
12969
12970 compiling to (x86_64) assembly via @option{-S} and emitting the result
12971 direct to stdout via @option{-o} @option{-}
12972
12973 @smallexample
12974 gcc -S test.c -fverbose-asm -Os -o -
12975 @end smallexample
12976
12977 gives output similar to this:
12978
12979 @smallexample
12980 .file "test.c"
12981 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12982 [...snip...]
12983 # options passed:
12984 [...snip...]
12985
12986 .text
12987 .globl test
12988 .type test, @@function
12989 test:
12990 .LFB0:
12991 .cfi_startproc
12992 # test.c:4: int total = 0;
12993 xorl %eax, %eax # <retval>
12994 # test.c:6: for (i = 0; i < n; i++)
12995 xorl %edx, %edx # i
12996 .L2:
12997 # test.c:6: for (i = 0; i < n; i++)
12998 cmpl %edi, %edx # n, i
12999 jge .L5 #,
13000 # test.c:7: total += i * i;
13001 movl %edx, %ecx # i, tmp92
13002 imull %edx, %ecx # i, tmp92
13003 # test.c:6: for (i = 0; i < n; i++)
13004 incl %edx # i
13005 # test.c:7: total += i * i;
13006 addl %ecx, %eax # tmp92, <retval>
13007 jmp .L2 #
13008 .L5:
13009 # test.c:10: @}
13010 ret
13011 .cfi_endproc
13012 .LFE0:
13013 .size test, .-test
13014 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13015 .section .note.GNU-stack,"",@@progbits
13016 @end smallexample
13017
13018 The comments are intended for humans rather than machines and hence the
13019 precise format of the comments is subject to change.
13020
13021 @item -frecord-gcc-switches
13022 @opindex frecord-gcc-switches
13023 This switch causes the command line used to invoke the
13024 compiler to be recorded into the object file that is being created.
13025 This switch is only implemented on some targets and the exact format
13026 of the recording is target and binary file format dependent, but it
13027 usually takes the form of a section containing ASCII text. This
13028 switch is related to the @option{-fverbose-asm} switch, but that
13029 switch only records information in the assembler output file as
13030 comments, so it never reaches the object file.
13031 See also @option{-grecord-gcc-switches} for another
13032 way of storing compiler options into the object file.
13033
13034 @item -fpic
13035 @opindex fpic
13036 @cindex global offset table
13037 @cindex PIC
13038 Generate position-independent code (PIC) suitable for use in a shared
13039 library, if supported for the target machine. Such code accesses all
13040 constant addresses through a global offset table (GOT)@. The dynamic
13041 loader resolves the GOT entries when the program starts (the dynamic
13042 loader is not part of GCC; it is part of the operating system). If
13043 the GOT size for the linked executable exceeds a machine-specific
13044 maximum size, you get an error message from the linker indicating that
13045 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13046 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13047 on the m68k and RS/6000. The x86 has no such limit.)
13048
13049 Position-independent code requires special support, and therefore works
13050 only on certain machines. For the x86, GCC supports PIC for System V
13051 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13052 position-independent.
13053
13054 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13055 are defined to 1.
13056
13057 @item -fPIC
13058 @opindex fPIC
13059 If supported for the target machine, emit position-independent code,
13060 suitable for dynamic linking and avoiding any limit on the size of the
13061 global offset table. This option makes a difference on AArch64, m68k,
13062 PowerPC and SPARC@.
13063
13064 Position-independent code requires special support, and therefore works
13065 only on certain machines.
13066
13067 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13068 are defined to 2.
13069
13070 @item -fpie
13071 @itemx -fPIE
13072 @opindex fpie
13073 @opindex fPIE
13074 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13075 generated position-independent code can be only linked into executables.
13076 Usually these options are used to compile code that will be linked using
13077 the @option{-pie} GCC option.
13078
13079 @option{-fpie} and @option{-fPIE} both define the macros
13080 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13081 for @option{-fpie} and 2 for @option{-fPIE}.
13082
13083 @item -fno-plt
13084 @opindex fno-plt
13085 Do not use the PLT for external function calls in position-independent code.
13086 Instead, load the callee address at call sites from the GOT and branch to it.
13087 This leads to more efficient code by eliminating PLT stubs and exposing
13088 GOT loads to optimizations. On architectures such as 32-bit x86 where
13089 PLT stubs expect the GOT pointer in a specific register, this gives more
13090 register allocation freedom to the compiler.
13091 Lazy binding requires use of the PLT;
13092 with @option{-fno-plt} all external symbols are resolved at load time.
13093
13094 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13095 through the PLT for specific external functions.
13096
13097 In position-dependent code, a few targets also convert calls to
13098 functions that are marked to not use the PLT to use the GOT instead.
13099
13100 @item -fno-jump-tables
13101 @opindex fno-jump-tables
13102 Do not use jump tables for switch statements even where it would be
13103 more efficient than other code generation strategies. This option is
13104 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13105 building code that forms part of a dynamic linker and cannot
13106 reference the address of a jump table. On some targets, jump tables
13107 do not require a GOT and this option is not needed.
13108
13109 @item -ffixed-@var{reg}
13110 @opindex ffixed
13111 Treat the register named @var{reg} as a fixed register; generated code
13112 should never refer to it (except perhaps as a stack pointer, frame
13113 pointer or in some other fixed role).
13114
13115 @var{reg} must be the name of a register. The register names accepted
13116 are machine-specific and are defined in the @code{REGISTER_NAMES}
13117 macro in the machine description macro file.
13118
13119 This flag does not have a negative form, because it specifies a
13120 three-way choice.
13121
13122 @item -fcall-used-@var{reg}
13123 @opindex fcall-used
13124 Treat the register named @var{reg} as an allocable register that is
13125 clobbered by function calls. It may be allocated for temporaries or
13126 variables that do not live across a call. Functions compiled this way
13127 do not save and restore the register @var{reg}.
13128
13129 It is an error to use this flag with the frame pointer or stack pointer.
13130 Use of this flag for other registers that have fixed pervasive roles in
13131 the machine's execution model produces disastrous results.
13132
13133 This flag does not have a negative form, because it specifies a
13134 three-way choice.
13135
13136 @item -fcall-saved-@var{reg}
13137 @opindex fcall-saved
13138 Treat the register named @var{reg} as an allocable register saved by
13139 functions. It may be allocated even for temporaries or variables that
13140 live across a call. Functions compiled this way save and restore
13141 the register @var{reg} if they use it.
13142
13143 It is an error to use this flag with the frame pointer or stack pointer.
13144 Use of this flag for other registers that have fixed pervasive roles in
13145 the machine's execution model produces disastrous results.
13146
13147 A different sort of disaster results from the use of this flag for
13148 a register in which function values may be returned.
13149
13150 This flag does not have a negative form, because it specifies a
13151 three-way choice.
13152
13153 @item -fpack-struct[=@var{n}]
13154 @opindex fpack-struct
13155 Without a value specified, pack all structure members together without
13156 holes. When a value is specified (which must be a small power of two), pack
13157 structure members according to this value, representing the maximum
13158 alignment (that is, objects with default alignment requirements larger than
13159 this are output potentially unaligned at the next fitting location.
13160
13161 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13162 code that is not binary compatible with code generated without that switch.
13163 Additionally, it makes the code suboptimal.
13164 Use it to conform to a non-default application binary interface.
13165
13166 @item -fleading-underscore
13167 @opindex fleading-underscore
13168 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13169 change the way C symbols are represented in the object file. One use
13170 is to help link with legacy assembly code.
13171
13172 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13173 generate code that is not binary compatible with code generated without that
13174 switch. Use it to conform to a non-default application binary interface.
13175 Not all targets provide complete support for this switch.
13176
13177 @item -ftls-model=@var{model}
13178 @opindex ftls-model
13179 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13180 The @var{model} argument should be one of @samp{global-dynamic},
13181 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13182 Note that the choice is subject to optimization: the compiler may use
13183 a more efficient model for symbols not visible outside of the translation
13184 unit, or if @option{-fpic} is not given on the command line.
13185
13186 The default without @option{-fpic} is @samp{initial-exec}; with
13187 @option{-fpic} the default is @samp{global-dynamic}.
13188
13189 @item -ftrampolines
13190 @opindex ftrampolines
13191 For targets that normally need trampolines for nested functions, always
13192 generate them instead of using descriptors. Otherwise, for targets that
13193 do not need them, like for example HP-PA or IA-64, do nothing.
13194
13195 A trampoline is a small piece of code that is created at run time on the
13196 stack when the address of a nested function is taken, and is used to call
13197 the nested function indirectly. Therefore, it requires the stack to be
13198 made executable in order for the program to work properly.
13199
13200 @option{-fno-trampolines} is enabled by default on a language by language
13201 basis to let the compiler avoid generating them, if it computes that this
13202 is safe, and replace them with descriptors. Descriptors are made up of data
13203 only, but the generated code must be prepared to deal with them. As of this
13204 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13205
13206 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13207 @option{-fno-trampolines} are not binary compatible if nested functions are
13208 present. This option must therefore be used on a program-wide basis and be
13209 manipulated with extreme care.
13210
13211 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13212 @opindex fvisibility
13213 Set the default ELF image symbol visibility to the specified option---all
13214 symbols are marked with this unless overridden within the code.
13215 Using this feature can very substantially improve linking and
13216 load times of shared object libraries, produce more optimized
13217 code, provide near-perfect API export and prevent symbol clashes.
13218 It is @strong{strongly} recommended that you use this in any shared objects
13219 you distribute.
13220
13221 Despite the nomenclature, @samp{default} always means public; i.e.,
13222 available to be linked against from outside the shared object.
13223 @samp{protected} and @samp{internal} are pretty useless in real-world
13224 usage so the only other commonly used option is @samp{hidden}.
13225 The default if @option{-fvisibility} isn't specified is
13226 @samp{default}, i.e., make every symbol public.
13227
13228 A good explanation of the benefits offered by ensuring ELF
13229 symbols have the correct visibility is given by ``How To Write
13230 Shared Libraries'' by Ulrich Drepper (which can be found at
13231 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13232 solution made possible by this option to marking things hidden when
13233 the default is public is to make the default hidden and mark things
13234 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13235 and @code{__attribute__ ((visibility("default")))} instead of
13236 @code{__declspec(dllexport)} you get almost identical semantics with
13237 identical syntax. This is a great boon to those working with
13238 cross-platform projects.
13239
13240 For those adding visibility support to existing code, you may find
13241 @code{#pragma GCC visibility} of use. This works by you enclosing
13242 the declarations you wish to set visibility for with (for example)
13243 @code{#pragma GCC visibility push(hidden)} and
13244 @code{#pragma GCC visibility pop}.
13245 Bear in mind that symbol visibility should be viewed @strong{as
13246 part of the API interface contract} and thus all new code should
13247 always specify visibility when it is not the default; i.e., declarations
13248 only for use within the local DSO should @strong{always} be marked explicitly
13249 as hidden as so to avoid PLT indirection overheads---making this
13250 abundantly clear also aids readability and self-documentation of the code.
13251 Note that due to ISO C++ specification requirements, @code{operator new} and
13252 @code{operator delete} must always be of default visibility.
13253
13254 Be aware that headers from outside your project, in particular system
13255 headers and headers from any other library you use, may not be
13256 expecting to be compiled with visibility other than the default. You
13257 may need to explicitly say @code{#pragma GCC visibility push(default)}
13258 before including any such headers.
13259
13260 @code{extern} declarations are not affected by @option{-fvisibility}, so
13261 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13262 no modifications. However, this means that calls to @code{extern}
13263 functions with no explicit visibility use the PLT, so it is more
13264 effective to use @code{__attribute ((visibility))} and/or
13265 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13266 declarations should be treated as hidden.
13267
13268 Note that @option{-fvisibility} does affect C++ vague linkage
13269 entities. This means that, for instance, an exception class that is
13270 be thrown between DSOs must be explicitly marked with default
13271 visibility so that the @samp{type_info} nodes are unified between
13272 the DSOs.
13273
13274 An overview of these techniques, their benefits and how to use them
13275 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13276
13277 @item -fstrict-volatile-bitfields
13278 @opindex fstrict-volatile-bitfields
13279 This option should be used if accesses to volatile bit-fields (or other
13280 structure fields, although the compiler usually honors those types
13281 anyway) should use a single access of the width of the
13282 field's type, aligned to a natural alignment if possible. For
13283 example, targets with memory-mapped peripheral registers might require
13284 all such accesses to be 16 bits wide; with this flag you can
13285 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13286 is 16 bits on these targets) to force GCC to use 16-bit accesses
13287 instead of, perhaps, a more efficient 32-bit access.
13288
13289 If this option is disabled, the compiler uses the most efficient
13290 instruction. In the previous example, that might be a 32-bit load
13291 instruction, even though that accesses bytes that do not contain
13292 any portion of the bit-field, or memory-mapped registers unrelated to
13293 the one being updated.
13294
13295 In some cases, such as when the @code{packed} attribute is applied to a
13296 structure field, it may not be possible to access the field with a single
13297 read or write that is correctly aligned for the target machine. In this
13298 case GCC falls back to generating multiple accesses rather than code that
13299 will fault or truncate the result at run time.
13300
13301 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13302 not allowed to touch non bit-field members. It is therefore recommended
13303 to define all bits of the field's type as bit-field members.
13304
13305 The default value of this option is determined by the application binary
13306 interface for the target processor.
13307
13308 @item -fsync-libcalls
13309 @opindex fsync-libcalls
13310 This option controls whether any out-of-line instance of the @code{__sync}
13311 family of functions may be used to implement the C++11 @code{__atomic}
13312 family of functions.
13313
13314 The default value of this option is enabled, thus the only useful form
13315 of the option is @option{-fno-sync-libcalls}. This option is used in
13316 the implementation of the @file{libatomic} runtime library.
13317
13318 @end table
13319
13320 @node Developer Options
13321 @section GCC Developer Options
13322 @cindex developer options
13323 @cindex debugging GCC
13324 @cindex debug dump options
13325 @cindex dump options
13326 @cindex compilation statistics
13327
13328 This section describes command-line options that are primarily of
13329 interest to GCC developers, including options to support compiler
13330 testing and investigation of compiler bugs and compile-time
13331 performance problems. This includes options that produce debug dumps
13332 at various points in the compilation; that print statistics such as
13333 memory use and execution time; and that print information about GCC's
13334 configuration, such as where it searches for libraries. You should
13335 rarely need to use any of these options for ordinary compilation and
13336 linking tasks.
13337
13338 Many developer options that cause GCC to dump output to a file take an
13339 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13340 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13341 error.
13342
13343 If @samp{=@var{filename}} is omitted, a default dump file name is
13344 constructed by concatenating the base dump file name, a pass number,
13345 phase letter, and pass name. The base dump file name is the name of
13346 output file produced by the compiler if explicitly specified and not
13347 an executable; otherwise it is the source file name.
13348 The pass number is determined by the order passes are registered with
13349 the compiler's pass manager.
13350 This is generally the same as the order of execution, but passes
13351 registered by plugins, target-specific passes, or passes that are
13352 otherwise registered late are numbered higher than the pass named
13353 @samp{final}, even if they are executed earlier. The phase letter is
13354 one of @samp{i} (inter-procedural analysis), @samp{l}
13355 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13356 The files are created in the directory of the output file.
13357
13358 @table @gcctabopt
13359
13360 @item -d@var{letters}
13361 @itemx -fdump-rtl-@var{pass}
13362 @itemx -fdump-rtl-@var{pass}=@var{filename}
13363 @opindex d
13364 @opindex fdump-rtl-@var{pass}
13365 Says to make debugging dumps during compilation at times specified by
13366 @var{letters}. This is used for debugging the RTL-based passes of the
13367 compiler.
13368
13369 Some @option{-d@var{letters}} switches have different meaning when
13370 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13371 for information about preprocessor-specific dump options.
13372
13373 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13374 @option{-d} option @var{letters}. Here are the possible
13375 letters for use in @var{pass} and @var{letters}, and their meanings:
13376
13377 @table @gcctabopt
13378
13379 @item -fdump-rtl-alignments
13380 @opindex fdump-rtl-alignments
13381 Dump after branch alignments have been computed.
13382
13383 @item -fdump-rtl-asmcons
13384 @opindex fdump-rtl-asmcons
13385 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13386
13387 @item -fdump-rtl-auto_inc_dec
13388 @opindex fdump-rtl-auto_inc_dec
13389 Dump after auto-inc-dec discovery. This pass is only run on
13390 architectures that have auto inc or auto dec instructions.
13391
13392 @item -fdump-rtl-barriers
13393 @opindex fdump-rtl-barriers
13394 Dump after cleaning up the barrier instructions.
13395
13396 @item -fdump-rtl-bbpart
13397 @opindex fdump-rtl-bbpart
13398 Dump after partitioning hot and cold basic blocks.
13399
13400 @item -fdump-rtl-bbro
13401 @opindex fdump-rtl-bbro
13402 Dump after block reordering.
13403
13404 @item -fdump-rtl-btl1
13405 @itemx -fdump-rtl-btl2
13406 @opindex fdump-rtl-btl2
13407 @opindex fdump-rtl-btl2
13408 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13409 after the two branch
13410 target load optimization passes.
13411
13412 @item -fdump-rtl-bypass
13413 @opindex fdump-rtl-bypass
13414 Dump after jump bypassing and control flow optimizations.
13415
13416 @item -fdump-rtl-combine
13417 @opindex fdump-rtl-combine
13418 Dump after the RTL instruction combination pass.
13419
13420 @item -fdump-rtl-compgotos
13421 @opindex fdump-rtl-compgotos
13422 Dump after duplicating the computed gotos.
13423
13424 @item -fdump-rtl-ce1
13425 @itemx -fdump-rtl-ce2
13426 @itemx -fdump-rtl-ce3
13427 @opindex fdump-rtl-ce1
13428 @opindex fdump-rtl-ce2
13429 @opindex fdump-rtl-ce3
13430 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13431 @option{-fdump-rtl-ce3} enable dumping after the three
13432 if conversion passes.
13433
13434 @item -fdump-rtl-cprop_hardreg
13435 @opindex fdump-rtl-cprop_hardreg
13436 Dump after hard register copy propagation.
13437
13438 @item -fdump-rtl-csa
13439 @opindex fdump-rtl-csa
13440 Dump after combining stack adjustments.
13441
13442 @item -fdump-rtl-cse1
13443 @itemx -fdump-rtl-cse2
13444 @opindex fdump-rtl-cse1
13445 @opindex fdump-rtl-cse2
13446 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13447 the two common subexpression elimination passes.
13448
13449 @item -fdump-rtl-dce
13450 @opindex fdump-rtl-dce
13451 Dump after the standalone dead code elimination passes.
13452
13453 @item -fdump-rtl-dbr
13454 @opindex fdump-rtl-dbr
13455 Dump after delayed branch scheduling.
13456
13457 @item -fdump-rtl-dce1
13458 @itemx -fdump-rtl-dce2
13459 @opindex fdump-rtl-dce1
13460 @opindex fdump-rtl-dce2
13461 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13462 the two dead store elimination passes.
13463
13464 @item -fdump-rtl-eh
13465 @opindex fdump-rtl-eh
13466 Dump after finalization of EH handling code.
13467
13468 @item -fdump-rtl-eh_ranges
13469 @opindex fdump-rtl-eh_ranges
13470 Dump after conversion of EH handling range regions.
13471
13472 @item -fdump-rtl-expand
13473 @opindex fdump-rtl-expand
13474 Dump after RTL generation.
13475
13476 @item -fdump-rtl-fwprop1
13477 @itemx -fdump-rtl-fwprop2
13478 @opindex fdump-rtl-fwprop1
13479 @opindex fdump-rtl-fwprop2
13480 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13481 dumping after the two forward propagation passes.
13482
13483 @item -fdump-rtl-gcse1
13484 @itemx -fdump-rtl-gcse2
13485 @opindex fdump-rtl-gcse1
13486 @opindex fdump-rtl-gcse2
13487 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13488 after global common subexpression elimination.
13489
13490 @item -fdump-rtl-init-regs
13491 @opindex fdump-rtl-init-regs
13492 Dump after the initialization of the registers.
13493
13494 @item -fdump-rtl-initvals
13495 @opindex fdump-rtl-initvals
13496 Dump after the computation of the initial value sets.
13497
13498 @item -fdump-rtl-into_cfglayout
13499 @opindex fdump-rtl-into_cfglayout
13500 Dump after converting to cfglayout mode.
13501
13502 @item -fdump-rtl-ira
13503 @opindex fdump-rtl-ira
13504 Dump after iterated register allocation.
13505
13506 @item -fdump-rtl-jump
13507 @opindex fdump-rtl-jump
13508 Dump after the second jump optimization.
13509
13510 @item -fdump-rtl-loop2
13511 @opindex fdump-rtl-loop2
13512 @option{-fdump-rtl-loop2} enables dumping after the rtl
13513 loop optimization passes.
13514
13515 @item -fdump-rtl-mach
13516 @opindex fdump-rtl-mach
13517 Dump after performing the machine dependent reorganization pass, if that
13518 pass exists.
13519
13520 @item -fdump-rtl-mode_sw
13521 @opindex fdump-rtl-mode_sw
13522 Dump after removing redundant mode switches.
13523
13524 @item -fdump-rtl-rnreg
13525 @opindex fdump-rtl-rnreg
13526 Dump after register renumbering.
13527
13528 @item -fdump-rtl-outof_cfglayout
13529 @opindex fdump-rtl-outof_cfglayout
13530 Dump after converting from cfglayout mode.
13531
13532 @item -fdump-rtl-peephole2
13533 @opindex fdump-rtl-peephole2
13534 Dump after the peephole pass.
13535
13536 @item -fdump-rtl-postreload
13537 @opindex fdump-rtl-postreload
13538 Dump after post-reload optimizations.
13539
13540 @item -fdump-rtl-pro_and_epilogue
13541 @opindex fdump-rtl-pro_and_epilogue
13542 Dump after generating the function prologues and epilogues.
13543
13544 @item -fdump-rtl-sched1
13545 @itemx -fdump-rtl-sched2
13546 @opindex fdump-rtl-sched1
13547 @opindex fdump-rtl-sched2
13548 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13549 after the basic block scheduling passes.
13550
13551 @item -fdump-rtl-ree
13552 @opindex fdump-rtl-ree
13553 Dump after sign/zero extension elimination.
13554
13555 @item -fdump-rtl-seqabstr
13556 @opindex fdump-rtl-seqabstr
13557 Dump after common sequence discovery.
13558
13559 @item -fdump-rtl-shorten
13560 @opindex fdump-rtl-shorten
13561 Dump after shortening branches.
13562
13563 @item -fdump-rtl-sibling
13564 @opindex fdump-rtl-sibling
13565 Dump after sibling call optimizations.
13566
13567 @item -fdump-rtl-split1
13568 @itemx -fdump-rtl-split2
13569 @itemx -fdump-rtl-split3
13570 @itemx -fdump-rtl-split4
13571 @itemx -fdump-rtl-split5
13572 @opindex fdump-rtl-split1
13573 @opindex fdump-rtl-split2
13574 @opindex fdump-rtl-split3
13575 @opindex fdump-rtl-split4
13576 @opindex fdump-rtl-split5
13577 These options enable dumping after five rounds of
13578 instruction splitting.
13579
13580 @item -fdump-rtl-sms
13581 @opindex fdump-rtl-sms
13582 Dump after modulo scheduling. This pass is only run on some
13583 architectures.
13584
13585 @item -fdump-rtl-stack
13586 @opindex fdump-rtl-stack
13587 Dump after conversion from GCC's ``flat register file'' registers to the
13588 x87's stack-like registers. This pass is only run on x86 variants.
13589
13590 @item -fdump-rtl-subreg1
13591 @itemx -fdump-rtl-subreg2
13592 @opindex fdump-rtl-subreg1
13593 @opindex fdump-rtl-subreg2
13594 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13595 the two subreg expansion passes.
13596
13597 @item -fdump-rtl-unshare
13598 @opindex fdump-rtl-unshare
13599 Dump after all rtl has been unshared.
13600
13601 @item -fdump-rtl-vartrack
13602 @opindex fdump-rtl-vartrack
13603 Dump after variable tracking.
13604
13605 @item -fdump-rtl-vregs
13606 @opindex fdump-rtl-vregs
13607 Dump after converting virtual registers to hard registers.
13608
13609 @item -fdump-rtl-web
13610 @opindex fdump-rtl-web
13611 Dump after live range splitting.
13612
13613 @item -fdump-rtl-regclass
13614 @itemx -fdump-rtl-subregs_of_mode_init
13615 @itemx -fdump-rtl-subregs_of_mode_finish
13616 @itemx -fdump-rtl-dfinit
13617 @itemx -fdump-rtl-dfinish
13618 @opindex fdump-rtl-regclass
13619 @opindex fdump-rtl-subregs_of_mode_init
13620 @opindex fdump-rtl-subregs_of_mode_finish
13621 @opindex fdump-rtl-dfinit
13622 @opindex fdump-rtl-dfinish
13623 These dumps are defined but always produce empty files.
13624
13625 @item -da
13626 @itemx -fdump-rtl-all
13627 @opindex da
13628 @opindex fdump-rtl-all
13629 Produce all the dumps listed above.
13630
13631 @item -dA
13632 @opindex dA
13633 Annotate the assembler output with miscellaneous debugging information.
13634
13635 @item -dD
13636 @opindex dD
13637 Dump all macro definitions, at the end of preprocessing, in addition to
13638 normal output.
13639
13640 @item -dH
13641 @opindex dH
13642 Produce a core dump whenever an error occurs.
13643
13644 @item -dp
13645 @opindex dp
13646 Annotate the assembler output with a comment indicating which
13647 pattern and alternative is used. The length and cost of each instruction are
13648 also printed.
13649
13650 @item -dP
13651 @opindex dP
13652 Dump the RTL in the assembler output as a comment before each instruction.
13653 Also turns on @option{-dp} annotation.
13654
13655 @item -dx
13656 @opindex dx
13657 Just generate RTL for a function instead of compiling it. Usually used
13658 with @option{-fdump-rtl-expand}.
13659 @end table
13660
13661 @item -fdump-noaddr
13662 @opindex fdump-noaddr
13663 When doing debugging dumps, suppress address output. This makes it more
13664 feasible to use diff on debugging dumps for compiler invocations with
13665 different compiler binaries and/or different
13666 text / bss / data / heap / stack / dso start locations.
13667
13668 @item -freport-bug
13669 @opindex freport-bug
13670 Collect and dump debug information into a temporary file if an
13671 internal compiler error (ICE) occurs.
13672
13673 @item -fdump-unnumbered
13674 @opindex fdump-unnumbered
13675 When doing debugging dumps, suppress instruction numbers and address output.
13676 This makes it more feasible to use diff on debugging dumps for compiler
13677 invocations with different options, in particular with and without
13678 @option{-g}.
13679
13680 @item -fdump-unnumbered-links
13681 @opindex fdump-unnumbered-links
13682 When doing debugging dumps (see @option{-d} option above), suppress
13683 instruction numbers for the links to the previous and next instructions
13684 in a sequence.
13685
13686 @item -fdump-ipa-@var{switch}
13687 @opindex fdump-ipa
13688 Control the dumping at various stages of inter-procedural analysis
13689 language tree to a file. The file name is generated by appending a
13690 switch specific suffix to the source file name, and the file is created
13691 in the same directory as the output file. The following dumps are
13692 possible:
13693
13694 @table @samp
13695 @item all
13696 Enables all inter-procedural analysis dumps.
13697
13698 @item cgraph
13699 Dumps information about call-graph optimization, unused function removal,
13700 and inlining decisions.
13701
13702 @item inline
13703 Dump after function inlining.
13704
13705 @end table
13706
13707 @item -fdump-lang-all
13708 @itemx -fdump-lang-@var{switch}
13709 @itemx -fdump-lang-@var{switch}-@var{options}
13710 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13711 @opindex fdump-lang-all
13712 @opindex fdump-lang
13713 Control the dumping of language-specific information. The @var{options}
13714 and @var{filename} portions behave as described in the
13715 @option{-fdump-tree} option. The following @var{switch} values are
13716 accepted:
13717
13718 @table @samp
13719 @item all
13720
13721 Enable all language-specific dumps.
13722
13723 @item class
13724 Dump class hierarchy information. Virtual table information is emitted
13725 unless '@option{slim}' is specified. This option is applicable to C++ only.
13726
13727 @item raw
13728 Dump the raw internal tree data. This option is applicable to C++ only.
13729
13730 @end table
13731
13732 @item -fdump-passes
13733 @opindex fdump-passes
13734 Print on @file{stderr} the list of optimization passes that are turned
13735 on and off by the current command-line options.
13736
13737 @item -fdump-statistics-@var{option}
13738 @opindex fdump-statistics
13739 Enable and control dumping of pass statistics in a separate file. The
13740 file name is generated by appending a suffix ending in
13741 @samp{.statistics} to the source file name, and the file is created in
13742 the same directory as the output file. If the @samp{-@var{option}}
13743 form is used, @samp{-stats} causes counters to be summed over the
13744 whole compilation unit while @samp{-details} dumps every event as
13745 the passes generate them. The default with no option is to sum
13746 counters for each function compiled.
13747
13748 @item -fdump-tree-all
13749 @itemx -fdump-tree-@var{switch}
13750 @itemx -fdump-tree-@var{switch}-@var{options}
13751 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13752 @opindex fdump-tree-all
13753 @opindex fdump-tree
13754 Control the dumping at various stages of processing the intermediate
13755 language tree to a file. If the @samp{-@var{options}}
13756 form is used, @var{options} is a list of @samp{-} separated options
13757 which control the details of the dump. Not all options are applicable
13758 to all dumps; those that are not meaningful are ignored. The
13759 following options are available
13760
13761 @table @samp
13762 @item address
13763 Print the address of each node. Usually this is not meaningful as it
13764 changes according to the environment and source file. Its primary use
13765 is for tying up a dump file with a debug environment.
13766 @item asmname
13767 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13768 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13769 use working backward from mangled names in the assembly file.
13770 @item slim
13771 When dumping front-end intermediate representations, inhibit dumping
13772 of members of a scope or body of a function merely because that scope
13773 has been reached. Only dump such items when they are directly reachable
13774 by some other path.
13775
13776 When dumping pretty-printed trees, this option inhibits dumping the
13777 bodies of control structures.
13778
13779 When dumping RTL, print the RTL in slim (condensed) form instead of
13780 the default LISP-like representation.
13781 @item raw
13782 Print a raw representation of the tree. By default, trees are
13783 pretty-printed into a C-like representation.
13784 @item details
13785 Enable more detailed dumps (not honored by every dump option). Also
13786 include information from the optimization passes.
13787 @item stats
13788 Enable dumping various statistics about the pass (not honored by every dump
13789 option).
13790 @item blocks
13791 Enable showing basic block boundaries (disabled in raw dumps).
13792 @item graph
13793 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13794 dump a representation of the control flow graph suitable for viewing with
13795 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13796 the file is pretty-printed as a subgraph, so that GraphViz can render them
13797 all in a single plot.
13798
13799 This option currently only works for RTL dumps, and the RTL is always
13800 dumped in slim form.
13801 @item vops
13802 Enable showing virtual operands for every statement.
13803 @item lineno
13804 Enable showing line numbers for statements.
13805 @item uid
13806 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13807 @item verbose
13808 Enable showing the tree dump for each statement.
13809 @item eh
13810 Enable showing the EH region number holding each statement.
13811 @item scev
13812 Enable showing scalar evolution analysis details.
13813 @item optimized
13814 Enable showing optimization information (only available in certain
13815 passes).
13816 @item missed
13817 Enable showing missed optimization information (only available in certain
13818 passes).
13819 @item note
13820 Enable other detailed optimization information (only available in
13821 certain passes).
13822 @item all
13823 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13824 and @option{lineno}.
13825 @item optall
13826 Turn on all optimization options, i.e., @option{optimized},
13827 @option{missed}, and @option{note}.
13828 @end table
13829
13830 To determine what tree dumps are available or find the dump for a pass
13831 of interest follow the steps below.
13832
13833 @enumerate
13834 @item
13835 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13836 look for a code that corresponds to the pass you are interested in.
13837 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13838 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13839 The number at the end distinguishes distinct invocations of the same pass.
13840 @item
13841 To enable the creation of the dump file, append the pass code to
13842 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13843 to enable the dump from the Early Value Range Propagation pass, invoke
13844 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13845 specify the name of the dump file. If you don't specify one, GCC
13846 creates as described below.
13847 @item
13848 Find the pass dump in a file whose name is composed of three components
13849 separated by a period: the name of the source file GCC was invoked to
13850 compile, a numeric suffix indicating the pass number followed by the
13851 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13852 and finally the pass code. For example, the Early VRP pass dump might
13853 be in a file named @file{myfile.c.038t.evrp} in the current working
13854 directory. Note that the numeric codes are not stable and may change
13855 from one version of GCC to another.
13856 @end enumerate
13857
13858 @item -fopt-info
13859 @itemx -fopt-info-@var{options}
13860 @itemx -fopt-info-@var{options}=@var{filename}
13861 @opindex fopt-info
13862 Controls optimization dumps from various optimization passes. If the
13863 @samp{-@var{options}} form is used, @var{options} is a list of
13864 @samp{-} separated option keywords to select the dump details and
13865 optimizations.
13866
13867 The @var{options} can be divided into two groups: options describing the
13868 verbosity of the dump, and options describing which optimizations
13869 should be included. The options from both the groups can be freely
13870 mixed as they are non-overlapping. However, in case of any conflicts,
13871 the later options override the earlier options on the command
13872 line.
13873
13874 The following options control the dump verbosity:
13875
13876 @table @samp
13877 @item optimized
13878 Print information when an optimization is successfully applied. It is
13879 up to a pass to decide which information is relevant. For example, the
13880 vectorizer passes print the source location of loops which are
13881 successfully vectorized.
13882 @item missed
13883 Print information about missed optimizations. Individual passes
13884 control which information to include in the output.
13885 @item note
13886 Print verbose information about optimizations, such as certain
13887 transformations, more detailed messages about decisions etc.
13888 @item all
13889 Print detailed optimization information. This includes
13890 @samp{optimized}, @samp{missed}, and @samp{note}.
13891 @end table
13892
13893 One or more of the following option keywords can be used to describe a
13894 group of optimizations:
13895
13896 @table @samp
13897 @item ipa
13898 Enable dumps from all interprocedural optimizations.
13899 @item loop
13900 Enable dumps from all loop optimizations.
13901 @item inline
13902 Enable dumps from all inlining optimizations.
13903 @item omp
13904 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13905 @item vec
13906 Enable dumps from all vectorization optimizations.
13907 @item optall
13908 Enable dumps from all optimizations. This is a superset of
13909 the optimization groups listed above.
13910 @end table
13911
13912 If @var{options} is
13913 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13914 info about successful optimizations from all the passes.
13915
13916 If the @var{filename} is provided, then the dumps from all the
13917 applicable optimizations are concatenated into the @var{filename}.
13918 Otherwise the dump is output onto @file{stderr}. Though multiple
13919 @option{-fopt-info} options are accepted, only one of them can include
13920 a @var{filename}. If other filenames are provided then all but the
13921 first such option are ignored.
13922
13923 Note that the output @var{filename} is overwritten
13924 in case of multiple translation units. If a combined output from
13925 multiple translation units is desired, @file{stderr} should be used
13926 instead.
13927
13928 In the following example, the optimization info is output to
13929 @file{stderr}:
13930
13931 @smallexample
13932 gcc -O3 -fopt-info
13933 @end smallexample
13934
13935 This example:
13936 @smallexample
13937 gcc -O3 -fopt-info-missed=missed.all
13938 @end smallexample
13939
13940 @noindent
13941 outputs missed optimization report from all the passes into
13942 @file{missed.all}, and this one:
13943
13944 @smallexample
13945 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13946 @end smallexample
13947
13948 @noindent
13949 prints information about missed optimization opportunities from
13950 vectorization passes on @file{stderr}.
13951 Note that @option{-fopt-info-vec-missed} is equivalent to
13952 @option{-fopt-info-missed-vec}. The order of the optimization group
13953 names and message types listed after @option{-fopt-info} does not matter.
13954
13955 As another example,
13956 @smallexample
13957 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13958 @end smallexample
13959
13960 @noindent
13961 outputs information about missed optimizations as well as
13962 optimized locations from all the inlining passes into
13963 @file{inline.txt}.
13964
13965 Finally, consider:
13966
13967 @smallexample
13968 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13969 @end smallexample
13970
13971 @noindent
13972 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13973 in conflict since only one output file is allowed. In this case, only
13974 the first option takes effect and the subsequent options are
13975 ignored. Thus only @file{vec.miss} is produced which contains
13976 dumps from the vectorizer about missed opportunities.
13977
13978 @item -fsched-verbose=@var{n}
13979 @opindex fsched-verbose
13980 On targets that use instruction scheduling, this option controls the
13981 amount of debugging output the scheduler prints to the dump files.
13982
13983 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13984 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13985 For @var{n} greater than one, it also output basic block probabilities,
13986 detailed ready list information and unit/insn info. For @var{n} greater
13987 than two, it includes RTL at abort point, control-flow and regions info.
13988 And for @var{n} over four, @option{-fsched-verbose} also includes
13989 dependence info.
13990
13991
13992
13993 @item -fenable-@var{kind}-@var{pass}
13994 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13995 @opindex fdisable-
13996 @opindex fenable-
13997
13998 This is a set of options that are used to explicitly disable/enable
13999 optimization passes. These options are intended for use for debugging GCC.
14000 Compiler users should use regular options for enabling/disabling
14001 passes instead.
14002
14003 @table @gcctabopt
14004
14005 @item -fdisable-ipa-@var{pass}
14006 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14007 statically invoked in the compiler multiple times, the pass name should be
14008 appended with a sequential number starting from 1.
14009
14010 @item -fdisable-rtl-@var{pass}
14011 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14012 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14013 statically invoked in the compiler multiple times, the pass name should be
14014 appended with a sequential number starting from 1. @var{range-list} is a
14015 comma-separated list of function ranges or assembler names. Each range is a number
14016 pair separated by a colon. The range is inclusive in both ends. If the range
14017 is trivial, the number pair can be simplified as a single number. If the
14018 function's call graph node's @var{uid} falls within one of the specified ranges,
14019 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14020 function header of a dump file, and the pass names can be dumped by using
14021 option @option{-fdump-passes}.
14022
14023 @item -fdisable-tree-@var{pass}
14024 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14025 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14026 option arguments.
14027
14028 @item -fenable-ipa-@var{pass}
14029 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14030 statically invoked in the compiler multiple times, the pass name should be
14031 appended with a sequential number starting from 1.
14032
14033 @item -fenable-rtl-@var{pass}
14034 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14035 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14036 description and examples.
14037
14038 @item -fenable-tree-@var{pass}
14039 @itemx -fenable-tree-@var{pass}=@var{range-list}
14040 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14041 of option arguments.
14042
14043 @end table
14044
14045 Here are some examples showing uses of these options.
14046
14047 @smallexample
14048
14049 # disable ccp1 for all functions
14050 -fdisable-tree-ccp1
14051 # disable complete unroll for function whose cgraph node uid is 1
14052 -fenable-tree-cunroll=1
14053 # disable gcse2 for functions at the following ranges [1,1],
14054 # [300,400], and [400,1000]
14055 # disable gcse2 for functions foo and foo2
14056 -fdisable-rtl-gcse2=foo,foo2
14057 # disable early inlining
14058 -fdisable-tree-einline
14059 # disable ipa inlining
14060 -fdisable-ipa-inline
14061 # enable tree full unroll
14062 -fenable-tree-unroll
14063
14064 @end smallexample
14065
14066 @item -fchecking
14067 @itemx -fchecking=@var{n}
14068 @opindex fchecking
14069 @opindex fno-checking
14070 Enable internal consistency checking. The default depends on
14071 the compiler configuration. @option{-fchecking=2} enables further
14072 internal consistency checking that might affect code generation.
14073
14074 @item -frandom-seed=@var{string}
14075 @opindex frandom-seed
14076 This option provides a seed that GCC uses in place of
14077 random numbers in generating certain symbol names
14078 that have to be different in every compiled file. It is also used to
14079 place unique stamps in coverage data files and the object files that
14080 produce them. You can use the @option{-frandom-seed} option to produce
14081 reproducibly identical object files.
14082
14083 The @var{string} can either be a number (decimal, octal or hex) or an
14084 arbitrary string (in which case it's converted to a number by
14085 computing CRC32).
14086
14087 The @var{string} should be different for every file you compile.
14088
14089 @item -save-temps
14090 @itemx -save-temps=cwd
14091 @opindex save-temps
14092 Store the usual ``temporary'' intermediate files permanently; place them
14093 in the current directory and name them based on the source file. Thus,
14094 compiling @file{foo.c} with @option{-c -save-temps} produces files
14095 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14096 preprocessed @file{foo.i} output file even though the compiler now
14097 normally uses an integrated preprocessor.
14098
14099 When used in combination with the @option{-x} command-line option,
14100 @option{-save-temps} is sensible enough to avoid over writing an
14101 input source file with the same extension as an intermediate file.
14102 The corresponding intermediate file may be obtained by renaming the
14103 source file before using @option{-save-temps}.
14104
14105 If you invoke GCC in parallel, compiling several different source
14106 files that share a common base name in different subdirectories or the
14107 same source file compiled for multiple output destinations, it is
14108 likely that the different parallel compilers will interfere with each
14109 other, and overwrite the temporary files. For instance:
14110
14111 @smallexample
14112 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14113 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14114 @end smallexample
14115
14116 may result in @file{foo.i} and @file{foo.o} being written to
14117 simultaneously by both compilers.
14118
14119 @item -save-temps=obj
14120 @opindex save-temps=obj
14121 Store the usual ``temporary'' intermediate files permanently. If the
14122 @option{-o} option is used, the temporary files are based on the
14123 object file. If the @option{-o} option is not used, the
14124 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14125
14126 For example:
14127
14128 @smallexample
14129 gcc -save-temps=obj -c foo.c
14130 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14131 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14132 @end smallexample
14133
14134 @noindent
14135 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14136 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14137 @file{dir2/yfoobar.o}.
14138
14139 @item -time@r{[}=@var{file}@r{]}
14140 @opindex time
14141 Report the CPU time taken by each subprocess in the compilation
14142 sequence. For C source files, this is the compiler proper and assembler
14143 (plus the linker if linking is done).
14144
14145 Without the specification of an output file, the output looks like this:
14146
14147 @smallexample
14148 # cc1 0.12 0.01
14149 # as 0.00 0.01
14150 @end smallexample
14151
14152 The first number on each line is the ``user time'', that is time spent
14153 executing the program itself. The second number is ``system time'',
14154 time spent executing operating system routines on behalf of the program.
14155 Both numbers are in seconds.
14156
14157 With the specification of an output file, the output is appended to the
14158 named file, and it looks like this:
14159
14160 @smallexample
14161 0.12 0.01 cc1 @var{options}
14162 0.00 0.01 as @var{options}
14163 @end smallexample
14164
14165 The ``user time'' and the ``system time'' are moved before the program
14166 name, and the options passed to the program are displayed, so that one
14167 can later tell what file was being compiled, and with which options.
14168
14169 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14170 @opindex fdump-final-insns
14171 Dump the final internal representation (RTL) to @var{file}. If the
14172 optional argument is omitted (or if @var{file} is @code{.}), the name
14173 of the dump file is determined by appending @code{.gkd} to the
14174 compilation output file name.
14175
14176 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14177 @opindex fcompare-debug
14178 @opindex fno-compare-debug
14179 If no error occurs during compilation, run the compiler a second time,
14180 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14181 passed to the second compilation. Dump the final internal
14182 representation in both compilations, and print an error if they differ.
14183
14184 If the equal sign is omitted, the default @option{-gtoggle} is used.
14185
14186 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14187 and nonzero, implicitly enables @option{-fcompare-debug}. If
14188 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14189 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14190 is used.
14191
14192 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14193 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14194 of the final representation and the second compilation, preventing even
14195 @env{GCC_COMPARE_DEBUG} from taking effect.
14196
14197 To verify full coverage during @option{-fcompare-debug} testing, set
14198 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14199 which GCC rejects as an invalid option in any actual compilation
14200 (rather than preprocessing, assembly or linking). To get just a
14201 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14202 not overridden} will do.
14203
14204 @item -fcompare-debug-second
14205 @opindex fcompare-debug-second
14206 This option is implicitly passed to the compiler for the second
14207 compilation requested by @option{-fcompare-debug}, along with options to
14208 silence warnings, and omitting other options that would cause the compiler
14209 to produce output to files or to standard output as a side effect. Dump
14210 files and preserved temporary files are renamed so as to contain the
14211 @code{.gk} additional extension during the second compilation, to avoid
14212 overwriting those generated by the first.
14213
14214 When this option is passed to the compiler driver, it causes the
14215 @emph{first} compilation to be skipped, which makes it useful for little
14216 other than debugging the compiler proper.
14217
14218 @item -gtoggle
14219 @opindex gtoggle
14220 Turn off generation of debug info, if leaving out this option
14221 generates it, or turn it on at level 2 otherwise. The position of this
14222 argument in the command line does not matter; it takes effect after all
14223 other options are processed, and it does so only once, no matter how
14224 many times it is given. This is mainly intended to be used with
14225 @option{-fcompare-debug}.
14226
14227 @item -fvar-tracking-assignments-toggle
14228 @opindex fvar-tracking-assignments-toggle
14229 @opindex fno-var-tracking-assignments-toggle
14230 Toggle @option{-fvar-tracking-assignments}, in the same way that
14231 @option{-gtoggle} toggles @option{-g}.
14232
14233 @item -Q
14234 @opindex Q
14235 Makes the compiler print out each function name as it is compiled, and
14236 print some statistics about each pass when it finishes.
14237
14238 @item -ftime-report
14239 @opindex ftime-report
14240 Makes the compiler print some statistics about the time consumed by each
14241 pass when it finishes.
14242
14243 @item -ftime-report-details
14244 @opindex ftime-report-details
14245 Record the time consumed by infrastructure parts separately for each pass.
14246
14247 @item -fira-verbose=@var{n}
14248 @opindex fira-verbose
14249 Control the verbosity of the dump file for the integrated register allocator.
14250 The default value is 5. If the value @var{n} is greater or equal to 10,
14251 the dump output is sent to stderr using the same format as @var{n} minus 10.
14252
14253 @item -flto-report
14254 @opindex flto-report
14255 Prints a report with internal details on the workings of the link-time
14256 optimizer. The contents of this report vary from version to version.
14257 It is meant to be useful to GCC developers when processing object
14258 files in LTO mode (via @option{-flto}).
14259
14260 Disabled by default.
14261
14262 @item -flto-report-wpa
14263 @opindex flto-report-wpa
14264 Like @option{-flto-report}, but only print for the WPA phase of Link
14265 Time Optimization.
14266
14267 @item -fmem-report
14268 @opindex fmem-report
14269 Makes the compiler print some statistics about permanent memory
14270 allocation when it finishes.
14271
14272 @item -fmem-report-wpa
14273 @opindex fmem-report-wpa
14274 Makes the compiler print some statistics about permanent memory
14275 allocation for the WPA phase only.
14276
14277 @item -fpre-ipa-mem-report
14278 @opindex fpre-ipa-mem-report
14279 @item -fpost-ipa-mem-report
14280 @opindex fpost-ipa-mem-report
14281 Makes the compiler print some statistics about permanent memory
14282 allocation before or after interprocedural optimization.
14283
14284 @item -fprofile-report
14285 @opindex fprofile-report
14286 Makes the compiler print some statistics about consistency of the
14287 (estimated) profile and effect of individual passes.
14288
14289 @item -fstack-usage
14290 @opindex fstack-usage
14291 Makes the compiler output stack usage information for the program, on a
14292 per-function basis. The filename for the dump is made by appending
14293 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14294 the output file, if explicitly specified and it is not an executable,
14295 otherwise it is the basename of the source file. An entry is made up
14296 of three fields:
14297
14298 @itemize
14299 @item
14300 The name of the function.
14301 @item
14302 A number of bytes.
14303 @item
14304 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14305 @end itemize
14306
14307 The qualifier @code{static} means that the function manipulates the stack
14308 statically: a fixed number of bytes are allocated for the frame on function
14309 entry and released on function exit; no stack adjustments are otherwise made
14310 in the function. The second field is this fixed number of bytes.
14311
14312 The qualifier @code{dynamic} means that the function manipulates the stack
14313 dynamically: in addition to the static allocation described above, stack
14314 adjustments are made in the body of the function, for example to push/pop
14315 arguments around function calls. If the qualifier @code{bounded} is also
14316 present, the amount of these adjustments is bounded at compile time and
14317 the second field is an upper bound of the total amount of stack used by
14318 the function. If it is not present, the amount of these adjustments is
14319 not bounded at compile time and the second field only represents the
14320 bounded part.
14321
14322 @item -fstats
14323 @opindex fstats
14324 Emit statistics about front-end processing at the end of the compilation.
14325 This option is supported only by the C++ front end, and
14326 the information is generally only useful to the G++ development team.
14327
14328 @item -fdbg-cnt-list
14329 @opindex fdbg-cnt-list
14330 Print the name and the counter upper bound for all debug counters.
14331
14332
14333 @item -fdbg-cnt=@var{counter-value-list}
14334 @opindex fdbg-cnt
14335 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14336 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14337 tuples which sets the lower and the upper bound of each debug
14338 counter @var{name}. The @var{lower_bound} is optional and is zero
14339 initialized if not set.
14340 All debug counters have the initial upper bound of @code{UINT_MAX};
14341 thus @code{dbg_cnt} returns true always unless the upper bound
14342 is set by this option.
14343 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14344 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14345 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14346
14347 @item -print-file-name=@var{library}
14348 @opindex print-file-name
14349 Print the full absolute name of the library file @var{library} that
14350 would be used when linking---and don't do anything else. With this
14351 option, GCC does not compile or link anything; it just prints the
14352 file name.
14353
14354 @item -print-multi-directory
14355 @opindex print-multi-directory
14356 Print the directory name corresponding to the multilib selected by any
14357 other switches present in the command line. This directory is supposed
14358 to exist in @env{GCC_EXEC_PREFIX}.
14359
14360 @item -print-multi-lib
14361 @opindex print-multi-lib
14362 Print the mapping from multilib directory names to compiler switches
14363 that enable them. The directory name is separated from the switches by
14364 @samp{;}, and each switch starts with an @samp{@@} instead of the
14365 @samp{-}, without spaces between multiple switches. This is supposed to
14366 ease shell processing.
14367
14368 @item -print-multi-os-directory
14369 @opindex print-multi-os-directory
14370 Print the path to OS libraries for the selected
14371 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14372 present in the @file{lib} subdirectory and no multilibs are used, this is
14373 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14374 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14375 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14376 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14377
14378 @item -print-multiarch
14379 @opindex print-multiarch
14380 Print the path to OS libraries for the selected multiarch,
14381 relative to some @file{lib} subdirectory.
14382
14383 @item -print-prog-name=@var{program}
14384 @opindex print-prog-name
14385 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14386
14387 @item -print-libgcc-file-name
14388 @opindex print-libgcc-file-name
14389 Same as @option{-print-file-name=libgcc.a}.
14390
14391 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14392 but you do want to link with @file{libgcc.a}. You can do:
14393
14394 @smallexample
14395 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14396 @end smallexample
14397
14398 @item -print-search-dirs
14399 @opindex print-search-dirs
14400 Print the name of the configured installation directory and a list of
14401 program and library directories @command{gcc} searches---and don't do anything else.
14402
14403 This is useful when @command{gcc} prints the error message
14404 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14405 To resolve this you either need to put @file{cpp0} and the other compiler
14406 components where @command{gcc} expects to find them, or you can set the environment
14407 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14408 Don't forget the trailing @samp{/}.
14409 @xref{Environment Variables}.
14410
14411 @item -print-sysroot
14412 @opindex print-sysroot
14413 Print the target sysroot directory that is used during
14414 compilation. This is the target sysroot specified either at configure
14415 time or using the @option{--sysroot} option, possibly with an extra
14416 suffix that depends on compilation options. If no target sysroot is
14417 specified, the option prints nothing.
14418
14419 @item -print-sysroot-headers-suffix
14420 @opindex print-sysroot-headers-suffix
14421 Print the suffix added to the target sysroot when searching for
14422 headers, or give an error if the compiler is not configured with such
14423 a suffix---and don't do anything else.
14424
14425 @item -dumpmachine
14426 @opindex dumpmachine
14427 Print the compiler's target machine (for example,
14428 @samp{i686-pc-linux-gnu})---and don't do anything else.
14429
14430 @item -dumpversion
14431 @opindex dumpversion
14432 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14433 anything else. This is the compiler version used in filesystem paths,
14434 specs, can be depending on how the compiler has been configured just
14435 a single number (major version), two numbers separated by dot (major and
14436 minor version) or three numbers separated by dots (major, minor and patchlevel
14437 version).
14438
14439 @item -dumpfullversion
14440 @opindex dumpfullversion
14441 Print the full compiler version, always 3 numbers separated by dots,
14442 major, minor and patchlevel version.
14443
14444 @item -dumpspecs
14445 @opindex dumpspecs
14446 Print the compiler's built-in specs---and don't do anything else. (This
14447 is used when GCC itself is being built.) @xref{Spec Files}.
14448 @end table
14449
14450 @node Submodel Options
14451 @section Machine-Dependent Options
14452 @cindex submodel options
14453 @cindex specifying hardware config
14454 @cindex hardware models and configurations, specifying
14455 @cindex target-dependent options
14456 @cindex machine-dependent options
14457
14458 Each target machine supported by GCC can have its own options---for
14459 example, to allow you to compile for a particular processor variant or
14460 ABI, or to control optimizations specific to that machine. By
14461 convention, the names of machine-specific options start with
14462 @samp{-m}.
14463
14464 Some configurations of the compiler also support additional target-specific
14465 options, usually for compatibility with other compilers on the same
14466 platform.
14467
14468 @c This list is ordered alphanumerically by subsection name.
14469 @c It should be the same order and spelling as these options are listed
14470 @c in Machine Dependent Options
14471
14472 @menu
14473 * AArch64 Options::
14474 * Adapteva Epiphany Options::
14475 * ARC Options::
14476 * ARM Options::
14477 * AVR Options::
14478 * Blackfin Options::
14479 * C6X Options::
14480 * CRIS Options::
14481 * CR16 Options::
14482 * Darwin Options::
14483 * DEC Alpha Options::
14484 * FR30 Options::
14485 * FT32 Options::
14486 * FRV Options::
14487 * GNU/Linux Options::
14488 * H8/300 Options::
14489 * HPPA Options::
14490 * IA-64 Options::
14491 * LM32 Options::
14492 * M32C Options::
14493 * M32R/D Options::
14494 * M680x0 Options::
14495 * MCore Options::
14496 * MeP Options::
14497 * MicroBlaze Options::
14498 * MIPS Options::
14499 * MMIX Options::
14500 * MN10300 Options::
14501 * Moxie Options::
14502 * MSP430 Options::
14503 * NDS32 Options::
14504 * Nios II Options::
14505 * Nvidia PTX Options::
14506 * PDP-11 Options::
14507 * picoChip Options::
14508 * PowerPC Options::
14509 * PowerPC SPE Options::
14510 * RISC-V Options::
14511 * RL78 Options::
14512 * RS/6000 and PowerPC Options::
14513 * RX Options::
14514 * S/390 and zSeries Options::
14515 * Score Options::
14516 * SH Options::
14517 * Solaris 2 Options::
14518 * SPARC Options::
14519 * SPU Options::
14520 * System V Options::
14521 * TILE-Gx Options::
14522 * TILEPro Options::
14523 * V850 Options::
14524 * VAX Options::
14525 * Visium Options::
14526 * VMS Options::
14527 * VxWorks Options::
14528 * x86 Options::
14529 * x86 Windows Options::
14530 * Xstormy16 Options::
14531 * Xtensa Options::
14532 * zSeries Options::
14533 @end menu
14534
14535 @node AArch64 Options
14536 @subsection AArch64 Options
14537 @cindex AArch64 Options
14538
14539 These options are defined for AArch64 implementations:
14540
14541 @table @gcctabopt
14542
14543 @item -mabi=@var{name}
14544 @opindex mabi
14545 Generate code for the specified data model. Permissible values
14546 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14547 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14548 but long int and pointers are 64 bits.
14549
14550 The default depends on the specific target configuration. Note that
14551 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14552 entire program with the same ABI, and link with a compatible set of libraries.
14553
14554 @item -mbig-endian
14555 @opindex mbig-endian
14556 Generate big-endian code. This is the default when GCC is configured for an
14557 @samp{aarch64_be-*-*} target.
14558
14559 @item -mgeneral-regs-only
14560 @opindex mgeneral-regs-only
14561 Generate code which uses only the general-purpose registers. This will prevent
14562 the compiler from using floating-point and Advanced SIMD registers but will not
14563 impose any restrictions on the assembler.
14564
14565 @item -mlittle-endian
14566 @opindex mlittle-endian
14567 Generate little-endian code. This is the default when GCC is configured for an
14568 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14569
14570 @item -mcmodel=tiny
14571 @opindex mcmodel=tiny
14572 Generate code for the tiny code model. The program and its statically defined
14573 symbols must be within 1MB of each other. Programs can be statically or
14574 dynamically linked.
14575
14576 @item -mcmodel=small
14577 @opindex mcmodel=small
14578 Generate code for the small code model. The program and its statically defined
14579 symbols must be within 4GB of each other. Programs can be statically or
14580 dynamically linked. This is the default code model.
14581
14582 @item -mcmodel=large
14583 @opindex mcmodel=large
14584 Generate code for the large code model. This makes no assumptions about
14585 addresses and sizes of sections. Programs can be statically linked only.
14586
14587 @item -mstrict-align
14588 @opindex mstrict-align
14589 Avoid generating memory accesses that may not be aligned on a natural object
14590 boundary as described in the architecture specification.
14591
14592 @item -momit-leaf-frame-pointer
14593 @itemx -mno-omit-leaf-frame-pointer
14594 @opindex momit-leaf-frame-pointer
14595 @opindex mno-omit-leaf-frame-pointer
14596 Omit or keep the frame pointer in leaf functions. The former behavior is the
14597 default.
14598
14599 @item -mtls-dialect=desc
14600 @opindex mtls-dialect=desc
14601 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14602 of TLS variables. This is the default.
14603
14604 @item -mtls-dialect=traditional
14605 @opindex mtls-dialect=traditional
14606 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14607 of TLS variables.
14608
14609 @item -mtls-size=@var{size}
14610 @opindex mtls-size
14611 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14612 This option requires binutils 2.26 or newer.
14613
14614 @item -mfix-cortex-a53-835769
14615 @itemx -mno-fix-cortex-a53-835769
14616 @opindex mfix-cortex-a53-835769
14617 @opindex mno-fix-cortex-a53-835769
14618 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14619 This involves inserting a NOP instruction between memory instructions and
14620 64-bit integer multiply-accumulate instructions.
14621
14622 @item -mfix-cortex-a53-843419
14623 @itemx -mno-fix-cortex-a53-843419
14624 @opindex mfix-cortex-a53-843419
14625 @opindex mno-fix-cortex-a53-843419
14626 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14627 This erratum workaround is made at link time and this will only pass the
14628 corresponding flag to the linker.
14629
14630 @item -mlow-precision-recip-sqrt
14631 @itemx -mno-low-precision-recip-sqrt
14632 @opindex mlow-precision-recip-sqrt
14633 @opindex mno-low-precision-recip-sqrt
14634 Enable or disable the reciprocal square root approximation.
14635 This option only has an effect if @option{-ffast-math} or
14636 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14637 precision of reciprocal square root results to about 16 bits for
14638 single precision and to 32 bits for double precision.
14639
14640 @item -mlow-precision-sqrt
14641 @itemx -mno-low-precision-sqrt
14642 @opindex -mlow-precision-sqrt
14643 @opindex -mno-low-precision-sqrt
14644 Enable or disable the square root approximation.
14645 This option only has an effect if @option{-ffast-math} or
14646 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14647 precision of square root results to about 16 bits for
14648 single precision and to 32 bits for double precision.
14649 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14650
14651 @item -mlow-precision-div
14652 @itemx -mno-low-precision-div
14653 @opindex -mlow-precision-div
14654 @opindex -mno-low-precision-div
14655 Enable or disable the division approximation.
14656 This option only has an effect if @option{-ffast-math} or
14657 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14658 precision of division results to about 16 bits for
14659 single precision and to 32 bits for double precision.
14660
14661 @item -march=@var{name}
14662 @opindex march
14663 Specify the name of the target architecture and, optionally, one or
14664 more feature modifiers. This option has the form
14665 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14666
14667 The permissible values for @var{arch} are @samp{armv8-a},
14668 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
14669 or @var{native}.
14670
14671 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
14672 support for the ARMv8.4-A architecture extensions.
14673
14674 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14675 support for the ARMv8.3-A architecture extensions.
14676
14677 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14678 support for the ARMv8.2-A architecture extensions.
14679
14680 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14681 support for the ARMv8.1-A architecture extension. In particular, it
14682 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14683
14684 The value @samp{native} is available on native AArch64 GNU/Linux and
14685 causes the compiler to pick the architecture of the host system. This
14686 option has no effect if the compiler is unable to recognize the
14687 architecture of the host system,
14688
14689 The permissible values for @var{feature} are listed in the sub-section
14690 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14691 Feature Modifiers}. Where conflicting feature modifiers are
14692 specified, the right-most feature is used.
14693
14694 GCC uses @var{name} to determine what kind of instructions it can emit
14695 when generating assembly code. If @option{-march} is specified
14696 without either of @option{-mtune} or @option{-mcpu} also being
14697 specified, the code is tuned to perform well across a range of target
14698 processors implementing the target architecture.
14699
14700 @item -mtune=@var{name}
14701 @opindex mtune
14702 Specify the name of the target processor for which GCC should tune the
14703 performance of the code. Permissible values for this option are:
14704 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14705 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14706 @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx}, @samp{saphira},
14707 @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14708 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14709 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14710 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14711 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14712 @samp{native}.
14713
14714 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14715 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14716 @samp{cortex-a75.cortex-a55} specify that GCC should tune for a
14717 big.LITTLE system.
14718
14719 Additionally on native AArch64 GNU/Linux systems the value
14720 @samp{native} tunes performance to the host system. This option has no effect
14721 if the compiler is unable to recognize the processor of the host system.
14722
14723 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14724 are specified, the code is tuned to perform well across a range
14725 of target processors.
14726
14727 This option cannot be suffixed by feature modifiers.
14728
14729 @item -mcpu=@var{name}
14730 @opindex mcpu
14731 Specify the name of the target processor, optionally suffixed by one
14732 or more feature modifiers. This option has the form
14733 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14734 the permissible values for @var{cpu} are the same as those available
14735 for @option{-mtune}. The permissible values for @var{feature} are
14736 documented in the sub-section on
14737 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14738 Feature Modifiers}. Where conflicting feature modifiers are
14739 specified, the right-most feature is used.
14740
14741 GCC uses @var{name} to determine what kind of instructions it can emit when
14742 generating assembly code (as if by @option{-march}) and to determine
14743 the target processor for which to tune for performance (as if
14744 by @option{-mtune}). Where this option is used in conjunction
14745 with @option{-march} or @option{-mtune}, those options take precedence
14746 over the appropriate part of this option.
14747
14748 @item -moverride=@var{string}
14749 @opindex moverride
14750 Override tuning decisions made by the back-end in response to a
14751 @option{-mtune=} switch. The syntax, semantics, and accepted values
14752 for @var{string} in this option are not guaranteed to be consistent
14753 across releases.
14754
14755 This option is only intended to be useful when developing GCC.
14756
14757 @item -mverbose-cost-dump
14758 @opindex mverbose-cost-dump
14759 Enable verbose cost model dumping in the debug dump files. This option is
14760 provided for use in debugging the compiler.
14761
14762 @item -mpc-relative-literal-loads
14763 @itemx -mno-pc-relative-literal-loads
14764 @opindex mpc-relative-literal-loads
14765 @opindex mno-pc-relative-literal-loads
14766 Enable or disable PC-relative literal loads. With this option literal pools are
14767 accessed using a single instruction and emitted after each function. This
14768 limits the maximum size of functions to 1MB. This is enabled by default for
14769 @option{-mcmodel=tiny}.
14770
14771 @item -msign-return-address=@var{scope}
14772 @opindex msign-return-address
14773 Select the function scope on which return address signing will be applied.
14774 Permissible values are @samp{none}, which disables return address signing,
14775 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14776 functions, and @samp{all}, which enables pointer signing for all functions. The
14777 default value is @samp{none}.
14778
14779 @item -msve-vector-bits=@var{bits}
14780 @opindex msve-vector-bits
14781 Specify the number of bits in an SVE vector register. This option only has
14782 an effect when SVE is enabled.
14783
14784 GCC supports two forms of SVE code generation: ``vector-length
14785 agnostic'' output that works with any size of vector register and
14786 ``vector-length specific'' output that only works when the vector
14787 registers are a particular size. Replacing @var{bits} with
14788 @samp{scalable} selects vector-length agnostic output while
14789 replacing it with a number selects vector-length specific output.
14790 The possible lengths in the latter case are: 128, 256, 512, 1024
14791 and 2048. @samp{scalable} is the default.
14792
14793 At present, @samp{-msve-vector-bits=128} produces the same output
14794 as @samp{-msve-vector-bits=scalable}.
14795
14796 @end table
14797
14798 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14799 @anchor{aarch64-feature-modifiers}
14800 @cindex @option{-march} feature modifiers
14801 @cindex @option{-mcpu} feature modifiers
14802 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14803 the following and their inverses @option{no@var{feature}}:
14804
14805 @table @samp
14806 @item crc
14807 Enable CRC extension. This is on by default for
14808 @option{-march=armv8.1-a}.
14809 @item crypto
14810 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14811 instructions.
14812 @item fp
14813 Enable floating-point instructions. This is on by default for all possible
14814 values for options @option{-march} and @option{-mcpu}.
14815 @item simd
14816 Enable Advanced SIMD instructions. This also enables floating-point
14817 instructions. This is on by default for all possible values for options
14818 @option{-march} and @option{-mcpu}.
14819 @item sve
14820 Enable Scalable Vector Extension instructions. This also enables Advanced
14821 SIMD and floating-point instructions.
14822 @item lse
14823 Enable Large System Extension instructions. This is on by default for
14824 @option{-march=armv8.1-a}.
14825 @item rdma
14826 Enable Round Double Multiply Accumulate instructions. This is on by default
14827 for @option{-march=armv8.1-a}.
14828 @item fp16
14829 Enable FP16 extension. This also enables floating-point instructions.
14830 @item fp16fml
14831 Enable FP16 fmla extension. This also enables FP16 extensions and
14832 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.
14833
14834 @item rcpc
14835 Enable the RcPc extension. This does not change code generation from GCC,
14836 but is passed on to the assembler, enabling inline asm statements to use
14837 instructions from the RcPc extension.
14838 @item dotprod
14839 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
14840 @item aes
14841 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
14842 SIMD instructions.
14843 @item sha2
14844 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
14845 @item sha3
14846 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
14847 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
14848 @item sm4
14849 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
14850 Use of this option with architectures prior to Armv8.2-A is not supported.
14851
14852 @end table
14853
14854 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
14855 which implies @option{fp}.
14856 Conversely, @option{nofp} implies @option{nosimd}, which implies
14857 @option{nocrypto}, @option{noaes} and @option{nosha2}.
14858
14859 @node Adapteva Epiphany Options
14860 @subsection Adapteva Epiphany Options
14861
14862 These @samp{-m} options are defined for Adapteva Epiphany:
14863
14864 @table @gcctabopt
14865 @item -mhalf-reg-file
14866 @opindex mhalf-reg-file
14867 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14868 That allows code to run on hardware variants that lack these registers.
14869
14870 @item -mprefer-short-insn-regs
14871 @opindex mprefer-short-insn-regs
14872 Preferentially allocate registers that allow short instruction generation.
14873 This can result in increased instruction count, so this may either reduce or
14874 increase overall code size.
14875
14876 @item -mbranch-cost=@var{num}
14877 @opindex mbranch-cost
14878 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14879 This cost is only a heuristic and is not guaranteed to produce
14880 consistent results across releases.
14881
14882 @item -mcmove
14883 @opindex mcmove
14884 Enable the generation of conditional moves.
14885
14886 @item -mnops=@var{num}
14887 @opindex mnops
14888 Emit @var{num} NOPs before every other generated instruction.
14889
14890 @item -mno-soft-cmpsf
14891 @opindex mno-soft-cmpsf
14892 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14893 and test the flags. This is faster than a software comparison, but can
14894 get incorrect results in the presence of NaNs, or when two different small
14895 numbers are compared such that their difference is calculated as zero.
14896 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14897 software comparisons.
14898
14899 @item -mstack-offset=@var{num}
14900 @opindex mstack-offset
14901 Set the offset between the top of the stack and the stack pointer.
14902 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14903 can be used by leaf functions without stack allocation.
14904 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14905 Note also that this option changes the ABI; compiling a program with a
14906 different stack offset than the libraries have been compiled with
14907 generally does not work.
14908 This option can be useful if you want to evaluate if a different stack
14909 offset would give you better code, but to actually use a different stack
14910 offset to build working programs, it is recommended to configure the
14911 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14912
14913 @item -mno-round-nearest
14914 @opindex mno-round-nearest
14915 Make the scheduler assume that the rounding mode has been set to
14916 truncating. The default is @option{-mround-nearest}.
14917
14918 @item -mlong-calls
14919 @opindex mlong-calls
14920 If not otherwise specified by an attribute, assume all calls might be beyond
14921 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14922 function address into a register before performing a (otherwise direct) call.
14923 This is the default.
14924
14925 @item -mshort-calls
14926 @opindex short-calls
14927 If not otherwise specified by an attribute, assume all direct calls are
14928 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14929 for direct calls. The default is @option{-mlong-calls}.
14930
14931 @item -msmall16
14932 @opindex msmall16
14933 Assume addresses can be loaded as 16-bit unsigned values. This does not
14934 apply to function addresses for which @option{-mlong-calls} semantics
14935 are in effect.
14936
14937 @item -mfp-mode=@var{mode}
14938 @opindex mfp-mode
14939 Set the prevailing mode of the floating-point unit.
14940 This determines the floating-point mode that is provided and expected
14941 at function call and return time. Making this mode match the mode you
14942 predominantly need at function start can make your programs smaller and
14943 faster by avoiding unnecessary mode switches.
14944
14945 @var{mode} can be set to one the following values:
14946
14947 @table @samp
14948 @item caller
14949 Any mode at function entry is valid, and retained or restored when
14950 the function returns, and when it calls other functions.
14951 This mode is useful for compiling libraries or other compilation units
14952 you might want to incorporate into different programs with different
14953 prevailing FPU modes, and the convenience of being able to use a single
14954 object file outweighs the size and speed overhead for any extra
14955 mode switching that might be needed, compared with what would be needed
14956 with a more specific choice of prevailing FPU mode.
14957
14958 @item truncate
14959 This is the mode used for floating-point calculations with
14960 truncating (i.e.@: round towards zero) rounding mode. That includes
14961 conversion from floating point to integer.
14962
14963 @item round-nearest
14964 This is the mode used for floating-point calculations with
14965 round-to-nearest-or-even rounding mode.
14966
14967 @item int
14968 This is the mode used to perform integer calculations in the FPU, e.g.@:
14969 integer multiply, or integer multiply-and-accumulate.
14970 @end table
14971
14972 The default is @option{-mfp-mode=caller}
14973
14974 @item -mnosplit-lohi
14975 @itemx -mno-postinc
14976 @itemx -mno-postmodify
14977 @opindex mnosplit-lohi
14978 @opindex mno-postinc
14979 @opindex mno-postmodify
14980 Code generation tweaks that disable, respectively, splitting of 32-bit
14981 loads, generation of post-increment addresses, and generation of
14982 post-modify addresses. The defaults are @option{msplit-lohi},
14983 @option{-mpost-inc}, and @option{-mpost-modify}.
14984
14985 @item -mnovect-double
14986 @opindex mno-vect-double
14987 Change the preferred SIMD mode to SImode. The default is
14988 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14989
14990 @item -max-vect-align=@var{num}
14991 @opindex max-vect-align
14992 The maximum alignment for SIMD vector mode types.
14993 @var{num} may be 4 or 8. The default is 8.
14994 Note that this is an ABI change, even though many library function
14995 interfaces are unaffected if they don't use SIMD vector modes
14996 in places that affect size and/or alignment of relevant types.
14997
14998 @item -msplit-vecmove-early
14999 @opindex msplit-vecmove-early
15000 Split vector moves into single word moves before reload. In theory this
15001 can give better register allocation, but so far the reverse seems to be
15002 generally the case.
15003
15004 @item -m1reg-@var{reg}
15005 @opindex m1reg-
15006 Specify a register to hold the constant @minus{}1, which makes loading small negative
15007 constants and certain bitmasks faster.
15008 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15009 which specify use of that register as a fixed register,
15010 and @samp{none}, which means that no register is used for this
15011 purpose. The default is @option{-m1reg-none}.
15012
15013 @end table
15014
15015 @node ARC Options
15016 @subsection ARC Options
15017 @cindex ARC options
15018
15019 The following options control the architecture variant for which code
15020 is being compiled:
15021
15022 @c architecture variants
15023 @table @gcctabopt
15024
15025 @item -mbarrel-shifter
15026 @opindex mbarrel-shifter
15027 Generate instructions supported by barrel shifter. This is the default
15028 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15029
15030 @item -mjli-always
15031 @opindex mjli-alawys
15032 Force to call a function using jli_s instruction. This option is
15033 valid only for ARCv2 architecture.
15034
15035 @item -mcpu=@var{cpu}
15036 @opindex mcpu
15037 Set architecture type, register usage, and instruction scheduling
15038 parameters for @var{cpu}. There are also shortcut alias options
15039 available for backward compatibility and convenience. Supported
15040 values for @var{cpu} are
15041
15042 @table @samp
15043 @opindex mA6
15044 @opindex mARC600
15045 @item arc600
15046 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15047
15048 @item arc601
15049 @opindex mARC601
15050 Compile for ARC601. Alias: @option{-mARC601}.
15051
15052 @item arc700
15053 @opindex mA7
15054 @opindex mARC700
15055 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15056 This is the default when configured with @option{--with-cpu=arc700}@.
15057
15058 @item arcem
15059 Compile for ARC EM.
15060
15061 @item archs
15062 Compile for ARC HS.
15063
15064 @item em
15065 Compile for ARC EM CPU with no hardware extensions.
15066
15067 @item em4
15068 Compile for ARC EM4 CPU.
15069
15070 @item em4_dmips
15071 Compile for ARC EM4 DMIPS CPU.
15072
15073 @item em4_fpus
15074 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15075 extension.
15076
15077 @item em4_fpuda
15078 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15079 double assist instructions.
15080
15081 @item hs
15082 Compile for ARC HS CPU with no hardware extensions except the atomic
15083 instructions.
15084
15085 @item hs34
15086 Compile for ARC HS34 CPU.
15087
15088 @item hs38
15089 Compile for ARC HS38 CPU.
15090
15091 @item hs38_linux
15092 Compile for ARC HS38 CPU with all hardware extensions on.
15093
15094 @item arc600_norm
15095 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15096
15097 @item arc600_mul32x16
15098 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15099 instructions enabled.
15100
15101 @item arc600_mul64
15102 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15103 instructions enabled.
15104
15105 @item arc601_norm
15106 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15107
15108 @item arc601_mul32x16
15109 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15110 instructions enabled.
15111
15112 @item arc601_mul64
15113 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15114 instructions enabled.
15115
15116 @item nps400
15117 Compile for ARC 700 on NPS400 chip.
15118
15119 @item em_mini
15120 Compile for ARC EM minimalist configuration featuring reduced register
15121 set.
15122
15123 @end table
15124
15125 @item -mdpfp
15126 @opindex mdpfp
15127 @itemx -mdpfp-compact
15128 @opindex mdpfp-compact
15129 Generate double-precision FPX instructions, tuned for the compact
15130 implementation.
15131
15132 @item -mdpfp-fast
15133 @opindex mdpfp-fast
15134 Generate double-precision FPX instructions, tuned for the fast
15135 implementation.
15136
15137 @item -mno-dpfp-lrsr
15138 @opindex mno-dpfp-lrsr
15139 Disable @code{lr} and @code{sr} instructions from using FPX extension
15140 aux registers.
15141
15142 @item -mea
15143 @opindex mea
15144 Generate extended arithmetic instructions. Currently only
15145 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15146 supported. This is always enabled for @option{-mcpu=ARC700}.
15147
15148 @item -mno-mpy
15149 @opindex mno-mpy
15150 Do not generate @code{mpy}-family instructions for ARC700. This option is
15151 deprecated.
15152
15153 @item -mmul32x16
15154 @opindex mmul32x16
15155 Generate 32x16-bit multiply and multiply-accumulate instructions.
15156
15157 @item -mmul64
15158 @opindex mmul64
15159 Generate @code{mul64} and @code{mulu64} instructions.
15160 Only valid for @option{-mcpu=ARC600}.
15161
15162 @item -mnorm
15163 @opindex mnorm
15164 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15165 is in effect.
15166
15167 @item -mspfp
15168 @opindex mspfp
15169 @itemx -mspfp-compact
15170 @opindex mspfp-compact
15171 Generate single-precision FPX instructions, tuned for the compact
15172 implementation.
15173
15174 @item -mspfp-fast
15175 @opindex mspfp-fast
15176 Generate single-precision FPX instructions, tuned for the fast
15177 implementation.
15178
15179 @item -msimd
15180 @opindex msimd
15181 Enable generation of ARC SIMD instructions via target-specific
15182 builtins. Only valid for @option{-mcpu=ARC700}.
15183
15184 @item -msoft-float
15185 @opindex msoft-float
15186 This option ignored; it is provided for compatibility purposes only.
15187 Software floating-point code is emitted by default, and this default
15188 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15189 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15190 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15191
15192 @item -mswap
15193 @opindex mswap
15194 Generate @code{swap} instructions.
15195
15196 @item -matomic
15197 @opindex matomic
15198 This enables use of the locked load/store conditional extension to implement
15199 atomic memory built-in functions. Not available for ARC 6xx or ARC
15200 EM cores.
15201
15202 @item -mdiv-rem
15203 @opindex mdiv-rem
15204 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15205
15206 @item -mcode-density
15207 @opindex mcode-density
15208 Enable code density instructions for ARC EM.
15209 This option is on by default for ARC HS.
15210
15211 @item -mll64
15212 @opindex mll64
15213 Enable double load/store operations for ARC HS cores.
15214
15215 @item -mtp-regno=@var{regno}
15216 @opindex mtp-regno
15217 Specify thread pointer register number.
15218
15219 @item -mmpy-option=@var{multo}
15220 @opindex mmpy-option
15221 Compile ARCv2 code with a multiplier design option. You can specify
15222 the option using either a string or numeric value for @var{multo}.
15223 @samp{wlh1} is the default value. The recognized values are:
15224
15225 @table @samp
15226 @item 0
15227 @itemx none
15228 No multiplier available.
15229
15230 @item 1
15231 @itemx w
15232 16x16 multiplier, fully pipelined.
15233 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15234
15235 @item 2
15236 @itemx wlh1
15237 32x32 multiplier, fully
15238 pipelined (1 stage). The following instructions are additionally
15239 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15240
15241 @item 3
15242 @itemx wlh2
15243 32x32 multiplier, fully pipelined
15244 (2 stages). The following instructions are additionally enabled: @code{mpy},
15245 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15246
15247 @item 4
15248 @itemx wlh3
15249 Two 16x16 multipliers, blocking,
15250 sequential. The following instructions are additionally enabled: @code{mpy},
15251 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15252
15253 @item 5
15254 @itemx wlh4
15255 One 16x16 multiplier, blocking,
15256 sequential. The following instructions are additionally enabled: @code{mpy},
15257 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15258
15259 @item 6
15260 @itemx wlh5
15261 One 32x4 multiplier, blocking,
15262 sequential. The following instructions are additionally enabled: @code{mpy},
15263 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15264
15265 @item 7
15266 @itemx plus_dmpy
15267 ARC HS SIMD support.
15268
15269 @item 8
15270 @itemx plus_macd
15271 ARC HS SIMD support.
15272
15273 @item 9
15274 @itemx plus_qmacw
15275 ARC HS SIMD support.
15276
15277 @end table
15278
15279 This option is only available for ARCv2 cores@.
15280
15281 @item -mfpu=@var{fpu}
15282 @opindex mfpu
15283 Enables support for specific floating-point hardware extensions for ARCv2
15284 cores. Supported values for @var{fpu} are:
15285
15286 @table @samp
15287
15288 @item fpus
15289 Enables support for single-precision floating-point hardware
15290 extensions@.
15291
15292 @item fpud
15293 Enables support for double-precision floating-point hardware
15294 extensions. The single-precision floating-point extension is also
15295 enabled. Not available for ARC EM@.
15296
15297 @item fpuda
15298 Enables support for double-precision floating-point hardware
15299 extensions using double-precision assist instructions. The single-precision
15300 floating-point extension is also enabled. This option is
15301 only available for ARC EM@.
15302
15303 @item fpuda_div
15304 Enables support for double-precision floating-point hardware
15305 extensions using double-precision assist instructions.
15306 The single-precision floating-point, square-root, and divide
15307 extensions are also enabled. This option is
15308 only available for ARC EM@.
15309
15310 @item fpuda_fma
15311 Enables support for double-precision floating-point hardware
15312 extensions using double-precision assist instructions.
15313 The single-precision floating-point and fused multiply and add
15314 hardware extensions are also enabled. This option is
15315 only available for ARC EM@.
15316
15317 @item fpuda_all
15318 Enables support for double-precision floating-point hardware
15319 extensions using double-precision assist instructions.
15320 All single-precision floating-point hardware extensions are also
15321 enabled. This option is only available for ARC EM@.
15322
15323 @item fpus_div
15324 Enables support for single-precision floating-point, square-root and divide
15325 hardware extensions@.
15326
15327 @item fpud_div
15328 Enables support for double-precision floating-point, square-root and divide
15329 hardware extensions. This option
15330 includes option @samp{fpus_div}. Not available for ARC EM@.
15331
15332 @item fpus_fma
15333 Enables support for single-precision floating-point and
15334 fused multiply and add hardware extensions@.
15335
15336 @item fpud_fma
15337 Enables support for double-precision floating-point and
15338 fused multiply and add hardware extensions. This option
15339 includes option @samp{fpus_fma}. Not available for ARC EM@.
15340
15341 @item fpus_all
15342 Enables support for all single-precision floating-point hardware
15343 extensions@.
15344
15345 @item fpud_all
15346 Enables support for all single- and double-precision floating-point
15347 hardware extensions. Not available for ARC EM@.
15348
15349 @end table
15350
15351 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15352 @opindex mirq-ctrl-saved
15353 Specifies general-purposes registers that the processor automatically
15354 saves/restores on interrupt entry and exit. @var{register-range} is
15355 specified as two registers separated by a dash. The register range
15356 always starts with @code{r0}, the upper limit is @code{fp} register.
15357 @var{blink} and @var{lp_count} are optional. This option is only
15358 valid for ARC EM and ARC HS cores.
15359
15360 @item -mrgf-banked-regs=@var{number}
15361 @opindex mrgf-banked-regs
15362 Specifies the number of registers replicated in second register bank
15363 on entry to fast interrupt. Fast interrupts are interrupts with the
15364 highest priority level P0. These interrupts save only PC and STATUS32
15365 registers to avoid memory transactions during interrupt entry and exit
15366 sequences. Use this option when you are using fast interrupts in an
15367 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15368
15369 @item -mlpc-width=@var{width}
15370 @opindex mlpc-width
15371 Specify the width of the @code{lp_count} register. Valid values for
15372 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15373 fixed to 32 bits. If the width is less than 32, the compiler does not
15374 attempt to transform loops in your program to use the zero-delay loop
15375 mechanism unless it is known that the @code{lp_count} register can
15376 hold the required loop-counter value. Depending on the width
15377 specified, the compiler and run-time library might continue to use the
15378 loop mechanism for various needs. This option defines macro
15379 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15380
15381 @item -mrf16
15382 @opindex mrf16
15383 This option instructs the compiler to generate code for a 16-entry
15384 register file. This option defines the @code{__ARC_RF16__}
15385 preprocessor macro.
15386
15387 @end table
15388
15389 The following options are passed through to the assembler, and also
15390 define preprocessor macro symbols.
15391
15392 @c Flags used by the assembler, but for which we define preprocessor
15393 @c macro symbols as well.
15394 @table @gcctabopt
15395 @item -mdsp-packa
15396 @opindex mdsp-packa
15397 Passed down to the assembler to enable the DSP Pack A extensions.
15398 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15399 deprecated.
15400
15401 @item -mdvbf
15402 @opindex mdvbf
15403 Passed down to the assembler to enable the dual Viterbi butterfly
15404 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15405 option is deprecated.
15406
15407 @c ARC700 4.10 extension instruction
15408 @item -mlock
15409 @opindex mlock
15410 Passed down to the assembler to enable the locked load/store
15411 conditional extension. Also sets the preprocessor symbol
15412 @code{__Xlock}.
15413
15414 @item -mmac-d16
15415 @opindex mmac-d16
15416 Passed down to the assembler. Also sets the preprocessor symbol
15417 @code{__Xxmac_d16}. This option is deprecated.
15418
15419 @item -mmac-24
15420 @opindex mmac-24
15421 Passed down to the assembler. Also sets the preprocessor symbol
15422 @code{__Xxmac_24}. This option is deprecated.
15423
15424 @c ARC700 4.10 extension instruction
15425 @item -mrtsc
15426 @opindex mrtsc
15427 Passed down to the assembler to enable the 64-bit time-stamp counter
15428 extension instruction. Also sets the preprocessor symbol
15429 @code{__Xrtsc}. This option is deprecated.
15430
15431 @c ARC700 4.10 extension instruction
15432 @item -mswape
15433 @opindex mswape
15434 Passed down to the assembler to enable the swap byte ordering
15435 extension instruction. Also sets the preprocessor symbol
15436 @code{__Xswape}.
15437
15438 @item -mtelephony
15439 @opindex mtelephony
15440 Passed down to the assembler to enable dual- and single-operand
15441 instructions for telephony. Also sets the preprocessor symbol
15442 @code{__Xtelephony}. This option is deprecated.
15443
15444 @item -mxy
15445 @opindex mxy
15446 Passed down to the assembler to enable the XY memory extension. Also
15447 sets the preprocessor symbol @code{__Xxy}.
15448
15449 @end table
15450
15451 The following options control how the assembly code is annotated:
15452
15453 @c Assembly annotation options
15454 @table @gcctabopt
15455 @item -misize
15456 @opindex misize
15457 Annotate assembler instructions with estimated addresses.
15458
15459 @item -mannotate-align
15460 @opindex mannotate-align
15461 Explain what alignment considerations lead to the decision to make an
15462 instruction short or long.
15463
15464 @end table
15465
15466 The following options are passed through to the linker:
15467
15468 @c options passed through to the linker
15469 @table @gcctabopt
15470 @item -marclinux
15471 @opindex marclinux
15472 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15473 This option is enabled by default in tool chains built for
15474 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15475 when profiling is not requested.
15476
15477 @item -marclinux_prof
15478 @opindex marclinux_prof
15479 Passed through to the linker, to specify use of the
15480 @code{arclinux_prof} emulation. This option is enabled by default in
15481 tool chains built for @w{@code{arc-linux-uclibc}} and
15482 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15483
15484 @end table
15485
15486 The following options control the semantics of generated code:
15487
15488 @c semantically relevant code generation options
15489 @table @gcctabopt
15490 @item -mlong-calls
15491 @opindex mlong-calls
15492 Generate calls as register indirect calls, thus providing access
15493 to the full 32-bit address range.
15494
15495 @item -mmedium-calls
15496 @opindex mmedium-calls
15497 Don't use less than 25-bit addressing range for calls, which is the
15498 offset available for an unconditional branch-and-link
15499 instruction. Conditional execution of function calls is suppressed, to
15500 allow use of the 25-bit range, rather than the 21-bit range with
15501 conditional branch-and-link. This is the default for tool chains built
15502 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15503
15504 @item -G @var{num}
15505 @opindex G
15506 Put definitions of externally-visible data in a small data section if
15507 that data is no bigger than @var{num} bytes. The default value of
15508 @var{num} is 4 for any ARC configuration, or 8 when we have double
15509 load/store operations.
15510
15511 @item -mno-sdata
15512 @opindex mno-sdata
15513 Do not generate sdata references. This is the default for tool chains
15514 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15515 targets.
15516
15517 @item -mvolatile-cache
15518 @opindex mvolatile-cache
15519 Use ordinarily cached memory accesses for volatile references. This is the
15520 default.
15521
15522 @item -mno-volatile-cache
15523 @opindex mno-volatile-cache
15524 Enable cache bypass for volatile references.
15525
15526 @end table
15527
15528 The following options fine tune code generation:
15529 @c code generation tuning options
15530 @table @gcctabopt
15531 @item -malign-call
15532 @opindex malign-call
15533 Do alignment optimizations for call instructions.
15534
15535 @item -mauto-modify-reg
15536 @opindex mauto-modify-reg
15537 Enable the use of pre/post modify with register displacement.
15538
15539 @item -mbbit-peephole
15540 @opindex mbbit-peephole
15541 Enable bbit peephole2.
15542
15543 @item -mno-brcc
15544 @opindex mno-brcc
15545 This option disables a target-specific pass in @file{arc_reorg} to
15546 generate compare-and-branch (@code{br@var{cc}}) instructions.
15547 It has no effect on
15548 generation of these instructions driven by the combiner pass.
15549
15550 @item -mcase-vector-pcrel
15551 @opindex mcase-vector-pcrel
15552 Use PC-relative switch case tables to enable case table shortening.
15553 This is the default for @option{-Os}.
15554
15555 @item -mcompact-casesi
15556 @opindex mcompact-casesi
15557 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15558 and only available for ARCv1 cores.
15559
15560 @item -mno-cond-exec
15561 @opindex mno-cond-exec
15562 Disable the ARCompact-specific pass to generate conditional
15563 execution instructions.
15564
15565 Due to delay slot scheduling and interactions between operand numbers,
15566 literal sizes, instruction lengths, and the support for conditional execution,
15567 the target-independent pass to generate conditional execution is often lacking,
15568 so the ARC port has kept a special pass around that tries to find more
15569 conditional execution generation opportunities after register allocation,
15570 branch shortening, and delay slot scheduling have been done. This pass
15571 generally, but not always, improves performance and code size, at the cost of
15572 extra compilation time, which is why there is an option to switch it off.
15573 If you have a problem with call instructions exceeding their allowable
15574 offset range because they are conditionalized, you should consider using
15575 @option{-mmedium-calls} instead.
15576
15577 @item -mearly-cbranchsi
15578 @opindex mearly-cbranchsi
15579 Enable pre-reload use of the @code{cbranchsi} pattern.
15580
15581 @item -mexpand-adddi
15582 @opindex mexpand-adddi
15583 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15584 @code{add.f}, @code{adc} etc. This option is deprecated.
15585
15586 @item -mindexed-loads
15587 @opindex mindexed-loads
15588 Enable the use of indexed loads. This can be problematic because some
15589 optimizers then assume that indexed stores exist, which is not
15590 the case.
15591
15592 @item -mlra
15593 @opindex mlra
15594 Enable Local Register Allocation. This is still experimental for ARC,
15595 so by default the compiler uses standard reload
15596 (i.e. @option{-mno-lra}).
15597
15598 @item -mlra-priority-none
15599 @opindex mlra-priority-none
15600 Don't indicate any priority for target registers.
15601
15602 @item -mlra-priority-compact
15603 @opindex mlra-priority-compact
15604 Indicate target register priority for r0..r3 / r12..r15.
15605
15606 @item -mlra-priority-noncompact
15607 @opindex mlra-priority-noncompact
15608 Reduce target register priority for r0..r3 / r12..r15.
15609
15610 @item -mno-millicode
15611 @opindex mno-millicode
15612 When optimizing for size (using @option{-Os}), prologues and epilogues
15613 that have to save or restore a large number of registers are often
15614 shortened by using call to a special function in libgcc; this is
15615 referred to as a @emph{millicode} call. As these calls can pose
15616 performance issues, and/or cause linking issues when linking in a
15617 nonstandard way, this option is provided to turn off millicode call
15618 generation.
15619
15620 @item -mmixed-code
15621 @opindex mmixed-code
15622 Tweak register allocation to help 16-bit instruction generation.
15623 This generally has the effect of decreasing the average instruction size
15624 while increasing the instruction count.
15625
15626 @item -mq-class
15627 @opindex mq-class
15628 Enable @samp{q} instruction alternatives.
15629 This is the default for @option{-Os}.
15630
15631 @item -mRcq
15632 @opindex mRcq
15633 Enable @samp{Rcq} constraint handling.
15634 Most short code generation depends on this.
15635 This is the default.
15636
15637 @item -mRcw
15638 @opindex mRcw
15639 Enable @samp{Rcw} constraint handling.
15640 Most ccfsm condexec mostly depends on this.
15641 This is the default.
15642
15643 @item -msize-level=@var{level}
15644 @opindex msize-level
15645 Fine-tune size optimization with regards to instruction lengths and alignment.
15646 The recognized values for @var{level} are:
15647 @table @samp
15648 @item 0
15649 No size optimization. This level is deprecated and treated like @samp{1}.
15650
15651 @item 1
15652 Short instructions are used opportunistically.
15653
15654 @item 2
15655 In addition, alignment of loops and of code after barriers are dropped.
15656
15657 @item 3
15658 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15659
15660 @end table
15661
15662 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15663 the behavior when this is not set is equivalent to level @samp{1}.
15664
15665 @item -mtune=@var{cpu}
15666 @opindex mtune
15667 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15668 by @option{-mcpu=}.
15669
15670 Supported values for @var{cpu} are
15671
15672 @table @samp
15673 @item ARC600
15674 Tune for ARC600 CPU.
15675
15676 @item ARC601
15677 Tune for ARC601 CPU.
15678
15679 @item ARC700
15680 Tune for ARC700 CPU with standard multiplier block.
15681
15682 @item ARC700-xmac
15683 Tune for ARC700 CPU with XMAC block.
15684
15685 @item ARC725D
15686 Tune for ARC725D CPU.
15687
15688 @item ARC750D
15689 Tune for ARC750D CPU.
15690
15691 @end table
15692
15693 @item -mmultcost=@var{num}
15694 @opindex mmultcost
15695 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15696 normal instruction.
15697
15698 @item -munalign-prob-threshold=@var{probability}
15699 @opindex munalign-prob-threshold
15700 Set probability threshold for unaligning branches.
15701 When tuning for @samp{ARC700} and optimizing for speed, branches without
15702 filled delay slot are preferably emitted unaligned and long, unless
15703 profiling indicates that the probability for the branch to be taken
15704 is below @var{probability}. @xref{Cross-profiling}.
15705 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15706
15707 @end table
15708
15709 The following options are maintained for backward compatibility, but
15710 are now deprecated and will be removed in a future release:
15711
15712 @c Deprecated options
15713 @table @gcctabopt
15714
15715 @item -margonaut
15716 @opindex margonaut
15717 Obsolete FPX.
15718
15719 @item -mbig-endian
15720 @opindex mbig-endian
15721 @itemx -EB
15722 @opindex EB
15723 Compile code for big-endian targets. Use of these options is now
15724 deprecated. Big-endian code is supported by configuring GCC to build
15725 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15726 for which big endian is the default.
15727
15728 @item -mlittle-endian
15729 @opindex mlittle-endian
15730 @itemx -EL
15731 @opindex EL
15732 Compile code for little-endian targets. Use of these options is now
15733 deprecated. Little-endian code is supported by configuring GCC to build
15734 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15735 for which little endian is the default.
15736
15737 @item -mbarrel_shifter
15738 @opindex mbarrel_shifter
15739 Replaced by @option{-mbarrel-shifter}.
15740
15741 @item -mdpfp_compact
15742 @opindex mdpfp_compact
15743 Replaced by @option{-mdpfp-compact}.
15744
15745 @item -mdpfp_fast
15746 @opindex mdpfp_fast
15747 Replaced by @option{-mdpfp-fast}.
15748
15749 @item -mdsp_packa
15750 @opindex mdsp_packa
15751 Replaced by @option{-mdsp-packa}.
15752
15753 @item -mEA
15754 @opindex mEA
15755 Replaced by @option{-mea}.
15756
15757 @item -mmac_24
15758 @opindex mmac_24
15759 Replaced by @option{-mmac-24}.
15760
15761 @item -mmac_d16
15762 @opindex mmac_d16
15763 Replaced by @option{-mmac-d16}.
15764
15765 @item -mspfp_compact
15766 @opindex mspfp_compact
15767 Replaced by @option{-mspfp-compact}.
15768
15769 @item -mspfp_fast
15770 @opindex mspfp_fast
15771 Replaced by @option{-mspfp-fast}.
15772
15773 @item -mtune=@var{cpu}
15774 @opindex mtune
15775 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15776 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15777 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15778
15779 @item -multcost=@var{num}
15780 @opindex multcost
15781 Replaced by @option{-mmultcost}.
15782
15783 @end table
15784
15785 @node ARM Options
15786 @subsection ARM Options
15787 @cindex ARM options
15788
15789 These @samp{-m} options are defined for the ARM port:
15790
15791 @table @gcctabopt
15792 @item -mabi=@var{name}
15793 @opindex mabi
15794 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15795 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15796
15797 @item -mapcs-frame
15798 @opindex mapcs-frame
15799 Generate a stack frame that is compliant with the ARM Procedure Call
15800 Standard for all functions, even if this is not strictly necessary for
15801 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15802 with this option causes the stack frames not to be generated for
15803 leaf functions. The default is @option{-mno-apcs-frame}.
15804 This option is deprecated.
15805
15806 @item -mapcs
15807 @opindex mapcs
15808 This is a synonym for @option{-mapcs-frame} and is deprecated.
15809
15810 @ignore
15811 @c not currently implemented
15812 @item -mapcs-stack-check
15813 @opindex mapcs-stack-check
15814 Generate code to check the amount of stack space available upon entry to
15815 every function (that actually uses some stack space). If there is
15816 insufficient space available then either the function
15817 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15818 called, depending upon the amount of stack space required. The runtime
15819 system is required to provide these functions. The default is
15820 @option{-mno-apcs-stack-check}, since this produces smaller code.
15821
15822 @c not currently implemented
15823 @item -mapcs-reentrant
15824 @opindex mapcs-reentrant
15825 Generate reentrant, position-independent code. The default is
15826 @option{-mno-apcs-reentrant}.
15827 @end ignore
15828
15829 @item -mthumb-interwork
15830 @opindex mthumb-interwork
15831 Generate code that supports calling between the ARM and Thumb
15832 instruction sets. Without this option, on pre-v5 architectures, the
15833 two instruction sets cannot be reliably used inside one program. The
15834 default is @option{-mno-thumb-interwork}, since slightly larger code
15835 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15836 configurations this option is meaningless.
15837
15838 @item -mno-sched-prolog
15839 @opindex mno-sched-prolog
15840 Prevent the reordering of instructions in the function prologue, or the
15841 merging of those instruction with the instructions in the function's
15842 body. This means that all functions start with a recognizable set
15843 of instructions (or in fact one of a choice from a small set of
15844 different function prologues), and this information can be used to
15845 locate the start of functions inside an executable piece of code. The
15846 default is @option{-msched-prolog}.
15847
15848 @item -mfloat-abi=@var{name}
15849 @opindex mfloat-abi
15850 Specifies which floating-point ABI to use. Permissible values
15851 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15852
15853 Specifying @samp{soft} causes GCC to generate output containing
15854 library calls for floating-point operations.
15855 @samp{softfp} allows the generation of code using hardware floating-point
15856 instructions, but still uses the soft-float calling conventions.
15857 @samp{hard} allows generation of floating-point instructions
15858 and uses FPU-specific calling conventions.
15859
15860 The default depends on the specific target configuration. Note that
15861 the hard-float and soft-float ABIs are not link-compatible; you must
15862 compile your entire program with the same ABI, and link with a
15863 compatible set of libraries.
15864
15865 @item -mlittle-endian
15866 @opindex mlittle-endian
15867 Generate code for a processor running in little-endian mode. This is
15868 the default for all standard configurations.
15869
15870 @item -mbig-endian
15871 @opindex mbig-endian
15872 Generate code for a processor running in big-endian mode; the default is
15873 to compile code for a little-endian processor.
15874
15875 @item -mbe8
15876 @itemx -mbe32
15877 @opindex mbe8
15878 When linking a big-endian image select between BE8 and BE32 formats.
15879 The option has no effect for little-endian images and is ignored. The
15880 default is dependent on the selected target architecture. For ARMv6
15881 and later architectures the default is BE8, for older architectures
15882 the default is BE32. BE32 format has been deprecated by ARM.
15883
15884 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
15885 @opindex march
15886 This specifies the name of the target ARM architecture. GCC uses this
15887 name to determine what kind of instructions it can emit when generating
15888 assembly code. This option can be used in conjunction with or instead
15889 of the @option{-mcpu=} option.
15890
15891 Permissible names are:
15892 @samp{armv4t},
15893 @samp{armv5t}, @samp{armv5te},
15894 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
15895 @samp{armv6z}, @samp{armv6zk},
15896 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
15897 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
15898 @samp{armv8.4-a},
15899 @samp{armv7-r},
15900 @samp{armv8-r},
15901 @samp{armv6-m}, @samp{armv6s-m},
15902 @samp{armv7-m}, @samp{armv7e-m},
15903 @samp{armv8-m.base}, @samp{armv8-m.main},
15904 @samp{iwmmxt} and @samp{iwmmxt2}.
15905
15906 Additionally, the following architectures, which lack support for the
15907 Thumb execution state, are recognized but support is deprecated:
15908 @samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m},
15909 @samp{armv4}.
15910
15911 Many of the architectures support extensions. These can be added by
15912 appending @samp{+@var{extension}} to the architecture name. Extension
15913 options are processed in order and capabilities accumulate. An extension
15914 will also enable any necessary base extensions
15915 upon which it depends. For example, the @samp{+crypto} extension
15916 will always enable the @samp{+simd} extension. The exception to the
15917 additive construction is for extensions that are prefixed with
15918 @samp{+no@dots{}}: these extensions disable the specified option and
15919 any other extensions that may depend on the presence of that
15920 extension.
15921
15922 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
15923 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
15924 entirely disabled by the @samp{+nofp} option that follows it.
15925
15926 Most extension names are generically named, but have an effect that is
15927 dependent upon the architecture to which it is applied. For example,
15928 the @samp{+simd} option can be applied to both @samp{armv7-a} and
15929 @samp{armv8-a} architectures, but will enable the original ARMv7-A
15930 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
15931 variant for @samp{armv8-a}.
15932
15933 The table below lists the supported extensions for each architecture.
15934 Architectures not mentioned do not support any extensions.
15935
15936 @table @samp
15937 @itemx armv5te
15938 @itemx armv6
15939 @itemx armv6j
15940 @itemx armv6k
15941 @itemx armv6kz
15942 @itemx armv6t2
15943 @itemx armv6z
15944 @itemx armv6zk
15945 @table @samp
15946 @item +fp
15947 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
15948 used as an alias for this extension.
15949
15950 @item +nofp
15951 Disable the floating-point instructions.
15952 @end table
15953
15954 @item armv7
15955 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
15956 @table @samp
15957 @item +fp
15958 The VFPv3 floating-point instructions, with 16 double-precision
15959 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15960 for this extension. Note that floating-point is not supported by the
15961 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
15962 ARMv7-R architectures.
15963
15964 @item +nofp
15965 Disable the floating-point instructions.
15966 @end table
15967
15968 @item armv7-a
15969 @table @samp
15970 @item +fp
15971 The VFPv3 floating-point instructions, with 16 double-precision
15972 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15973 for this extension.
15974
15975 @item +simd
15976 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15977 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
15978 for this extension.
15979
15980 @item +vfpv3
15981 The VFPv3 floating-point instructions, with 32 double-precision
15982 registers.
15983
15984 @item +vfpv3-d16-fp16
15985 The VFPv3 floating-point instructions, with 16 double-precision
15986 registers and the half-precision floating-point conversion operations.
15987
15988 @item +vfpv3-fp16
15989 The VFPv3 floating-point instructions, with 32 double-precision
15990 registers and the half-precision floating-point conversion operations.
15991
15992 @item +vfpv4-d16
15993 The VFPv4 floating-point instructions, with 16 double-precision
15994 registers.
15995
15996 @item +vfpv4
15997 The VFPv4 floating-point instructions, with 32 double-precision
15998 registers.
15999
16000 @item +neon-fp16
16001 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16002 the half-precision floating-point conversion operations.
16003
16004 @item +neon-vfpv4
16005 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16006
16007 @item +nosimd
16008 Disable the Advanced SIMD instructions (does not disable floating point).
16009
16010 @item +nofp
16011 Disable the floating-point and Advanced SIMD instructions.
16012 @end table
16013
16014 @item armv7ve
16015 The extended version of the ARMv7-A architecture with support for
16016 virtualization.
16017 @table @samp
16018 @item +fp
16019 The VFPv4 floating-point instructions, with 16 double-precision registers.
16020 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16021
16022 @item +simd
16023 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16024 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16025
16026 @item +vfpv3-d16
16027 The VFPv3 floating-point instructions, with 16 double-precision
16028 registers.
16029
16030 @item +vfpv3
16031 The VFPv3 floating-point instructions, with 32 double-precision
16032 registers.
16033
16034 @item +vfpv3-d16-fp16
16035 The VFPv3 floating-point instructions, with 16 double-precision
16036 registers and the half-precision floating-point conversion operations.
16037
16038 @item +vfpv3-fp16
16039 The VFPv3 floating-point instructions, with 32 double-precision
16040 registers and the half-precision floating-point conversion operations.
16041
16042 @item +vfpv4-d16
16043 The VFPv4 floating-point instructions, with 16 double-precision
16044 registers.
16045
16046 @item +vfpv4
16047 The VFPv4 floating-point instructions, with 32 double-precision
16048 registers.
16049
16050 @item +neon
16051 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16052 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16053
16054 @item +neon-fp16
16055 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16056 the half-precision floating-point conversion operations.
16057
16058 @item +nosimd
16059 Disable the Advanced SIMD instructions (does not disable floating point).
16060
16061 @item +nofp
16062 Disable the floating-point and Advanced SIMD instructions.
16063 @end table
16064
16065 @item armv8-a
16066 @table @samp
16067 @item +crc
16068 The Cyclic Redundancy Check (CRC) instructions.
16069 @item +simd
16070 The ARMv8-A Advanced SIMD and floating-point instructions.
16071 @item +crypto
16072 The cryptographic instructions.
16073 @item +nocrypto
16074 Disable the cryptographic instructions.
16075 @item +nofp
16076 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16077 @end table
16078
16079 @item armv8.1-a
16080 @table @samp
16081 @item +simd
16082 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16083
16084 @item +crypto
16085 The cryptographic instructions. This also enables the Advanced SIMD and
16086 floating-point instructions.
16087
16088 @item +nocrypto
16089 Disable the cryptographic instructions.
16090
16091 @item +nofp
16092 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16093 @end table
16094
16095 @item armv8.2-a
16096 @itemx armv8.3-a
16097 @table @samp
16098 @item +fp16
16099 The half-precision floating-point data processing instructions.
16100 This also enables the Advanced SIMD and floating-point instructions.
16101
16102 @item +fp16fml
16103 The half-precision floating-point fmla extension. This also enables
16104 the half-precision floating-point extension and Advanced SIMD and
16105 floating-point instructions.
16106
16107 @item +simd
16108 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16109
16110 @item +crypto
16111 The cryptographic instructions. This also enables the Advanced SIMD and
16112 floating-point instructions.
16113
16114 @item +dotprod
16115 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16116
16117 @item +nocrypto
16118 Disable the cryptographic extension.
16119
16120 @item +nofp
16121 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16122 @end table
16123
16124 @item armv8.4-a
16125 @table @samp
16126 @item +fp16
16127 The half-precision floating-point data processing instructions.
16128 This also enables the Advanced SIMD and floating-point instructions as well
16129 as the Dot Product extension and the half-precision floating-point fmla
16130 extension.
16131
16132 @item +simd
16133 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16134 Dot Product extension.
16135
16136 @item +crypto
16137 The cryptographic instructions. This also enables the Advanced SIMD and
16138 floating-point instructions as well as the Dot Product extension.
16139
16140 @item +nocrypto
16141 Disable the cryptographic extension.
16142
16143 @item +nofp
16144 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16145 @end table
16146
16147 @item armv7-r
16148 @table @samp
16149 @item +fp.sp
16150 The single-precision VFPv3 floating-point instructions. The extension
16151 @samp{+vfpv3xd} can be used as an alias for this extension.
16152
16153 @item +fp
16154 The VFPv3 floating-point instructions with 16 double-precision registers.
16155 The extension +vfpv3-d16 can be used as an alias for this extension.
16156
16157 @item +nofp
16158 Disable the floating-point extension.
16159
16160 @item +idiv
16161 The ARM-state integer division instructions.
16162
16163 @item +noidiv
16164 Disable the ARM-state integer division extension.
16165 @end table
16166
16167 @item armv7e-m
16168 @table @samp
16169 @item +fp
16170 The single-precision VFPv4 floating-point instructions.
16171
16172 @item +fpv5
16173 The single-precision FPv5 floating-point instructions.
16174
16175 @item +fp.dp
16176 The single- and double-precision FPv5 floating-point instructions.
16177
16178 @item +nofp
16179 Disable the floating-point extensions.
16180 @end table
16181
16182 @item armv8-m.main
16183 @table @samp
16184 @item +dsp
16185 The DSP instructions.
16186
16187 @item +nodsp
16188 Disable the DSP extension.
16189
16190 @item +fp
16191 The single-precision floating-point instructions.
16192
16193 @item +fp.dp
16194 The single- and double-precision floating-point instructions.
16195
16196 @item +nofp
16197 Disable the floating-point extension.
16198 @end table
16199
16200 @item armv8-r
16201 @table @samp
16202 @item +crc
16203 The Cyclic Redundancy Check (CRC) instructions.
16204 @item +fp.sp
16205 The single-precision FPv5 floating-point instructions.
16206 @item +simd
16207 The ARMv8-A Advanced SIMD and floating-point instructions.
16208 @item +crypto
16209 The cryptographic instructions.
16210 @item +nocrypto
16211 Disable the cryptographic instructions.
16212 @item +nofp
16213 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16214 @end table
16215
16216 @end table
16217
16218 @option{-march=native} causes the compiler to auto-detect the architecture
16219 of the build computer. At present, this feature is only supported on
16220 GNU/Linux, and not all architectures are recognized. If the auto-detect
16221 is unsuccessful the option has no effect.
16222
16223 @item -mtune=@var{name}
16224 @opindex mtune
16225 This option specifies the name of the target ARM processor for
16226 which GCC should tune the performance of the code.
16227 For some ARM implementations better performance can be obtained by using
16228 this option.
16229 Permissible names are: @samp{arm2}, @samp{arm250},
16230 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16231 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16232 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16233 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16234 @samp{arm720},
16235 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16236 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16237 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16238 @samp{strongarm1110},
16239 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16240 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16241 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16242 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16243 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16244 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16245 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16246 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16247 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16248 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16249 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16250 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7},
16251 @samp{cortex-r8}, @samp{cortex-r52},
16252 @samp{cortex-m33},
16253 @samp{cortex-m23},
16254 @samp{cortex-m7},
16255 @samp{cortex-m4},
16256 @samp{cortex-m3},
16257 @samp{cortex-m1},
16258 @samp{cortex-m0},
16259 @samp{cortex-m0plus},
16260 @samp{cortex-m1.small-multiply},
16261 @samp{cortex-m0.small-multiply},
16262 @samp{cortex-m0plus.small-multiply},
16263 @samp{exynos-m1},
16264 @samp{marvell-pj4},
16265 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16266 @samp{fa526}, @samp{fa626},
16267 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16268 @samp{xgene1}.
16269
16270 Additionally, this option can specify that GCC should tune the performance
16271 of the code for a big.LITTLE system. Permissible names are:
16272 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16273 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16274 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16275 @samp{cortex-a75.cortex-a55}.
16276
16277 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16278 performance for a blend of processors within architecture @var{arch}.
16279 The aim is to generate code that run well on the current most popular
16280 processors, balancing between optimizations that benefit some CPUs in the
16281 range, and avoiding performance pitfalls of other CPUs. The effects of
16282 this option may change in future GCC versions as CPU models come and go.
16283
16284 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16285 the extension options do not affect the tuning of the generated code.
16286
16287 @option{-mtune=native} causes the compiler to auto-detect the CPU
16288 of the build computer. At present, this feature is only supported on
16289 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16290 unsuccessful the option has no effect.
16291
16292 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16293 @opindex mcpu
16294 This specifies the name of the target ARM processor. GCC uses this name
16295 to derive the name of the target ARM architecture (as if specified
16296 by @option{-march}) and the ARM processor type for which to tune for
16297 performance (as if specified by @option{-mtune}). Where this option
16298 is used in conjunction with @option{-march} or @option{-mtune},
16299 those options take precedence over the appropriate part of this option.
16300
16301 Many of the supported CPUs implement optional architectural
16302 extensions. Where this is so the architectural extensions are
16303 normally enabled by default. If implementations that lack the
16304 extension exist, then the extension syntax can be used to disable
16305 those extensions that have been omitted. For floating-point and
16306 Advanced SIMD (Neon) instructions, the settings of the options
16307 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16308 floating-point and Advanced SIMD instructions will only be used if
16309 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16310 @option{-mfpu} other than @samp{auto} will override the available
16311 floating-point and SIMD extension instructions.
16312
16313 For example, @samp{cortex-a9} can be found in three major
16314 configurations: integer only, with just a floating-point unit or with
16315 floating-point and Advanced SIMD. The default is to enable all the
16316 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16317 be used to disable just the SIMD or both the SIMD and floating-point
16318 instructions respectively.
16319
16320 Permissible names for this option are the same as those for
16321 @option{-mtune}.
16322
16323 The following extension options are common to the listed CPUs:
16324
16325 @table @samp
16326 @item +nodsp
16327 Disable the DSP instructions on @samp{cortex-m33}.
16328
16329 @item +nofp
16330 Disables the floating-point instructions on @samp{arm9e},
16331 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16332 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16333 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16334 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16335 Disables the floating-point and SIMD instructions on
16336 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16337 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16338 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16339 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16340 @samp{cortex-a53} and @samp{cortex-a55}.
16341
16342 @item +nofp.dp
16343 Disables the double-precision component of the floating-point instructions
16344 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16345
16346 @item +nosimd
16347 Disables the SIMD (but not floating-point) instructions on
16348 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16349 and @samp{cortex-a9}.
16350
16351 @item +crypto
16352 Enables the cryptographic instructions on @samp{cortex-a32},
16353 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16354 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16355 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16356 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16357 @samp{cortex-a75.cortex-a55}.
16358 @end table
16359
16360 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16361 VFPv3 with 16 double-precision registers. It supports the following
16362 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16363 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16364 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16365 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16366 @option{-march=armv7-a}.
16367
16368 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16369 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16370 See @option{-mtune} for more information.
16371
16372 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16373 of the build computer. At present, this feature is only supported on
16374 GNU/Linux, and not all architectures are recognized. If the auto-detect
16375 is unsuccessful the option has no effect.
16376
16377 @item -mfpu=@var{name}
16378 @opindex mfpu
16379 This specifies what floating-point hardware (or hardware emulation) is
16380 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16381 @samp{vfpv3},
16382 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16383 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16384 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16385 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16386 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16387 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16388 is an alias for @samp{vfpv2}.
16389
16390 The setting @samp{auto} is the default and is special. It causes the
16391 compiler to select the floating-point and Advanced SIMD instructions
16392 based on the settings of @option{-mcpu} and @option{-march}.
16393
16394 If the selected floating-point hardware includes the NEON extension
16395 (e.g. @option{-mfpu=neon}), note that floating-point
16396 operations are not generated by GCC's auto-vectorization pass unless
16397 @option{-funsafe-math-optimizations} is also specified. This is
16398 because NEON hardware does not fully implement the IEEE 754 standard for
16399 floating-point arithmetic (in particular denormal values are treated as
16400 zero), so the use of NEON instructions may lead to a loss of precision.
16401
16402 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}).
16403
16404 @item -mfp16-format=@var{name}
16405 @opindex mfp16-format
16406 Specify the format of the @code{__fp16} half-precision floating-point type.
16407 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16408 the default is @samp{none}, in which case the @code{__fp16} type is not
16409 defined. @xref{Half-Precision}, for more information.
16410
16411 @item -mstructure-size-boundary=@var{n}
16412 @opindex mstructure-size-boundary
16413 The sizes of all structures and unions are rounded up to a multiple
16414 of the number of bits set by this option. Permissible values are 8, 32
16415 and 64. The default value varies for different toolchains. For the COFF
16416 targeted toolchain the default value is 8. A value of 64 is only allowed
16417 if the underlying ABI supports it.
16418
16419 Specifying a larger number can produce faster, more efficient code, but
16420 can also increase the size of the program. Different values are potentially
16421 incompatible. Code compiled with one value cannot necessarily expect to
16422 work with code or libraries compiled with another value, if they exchange
16423 information using structures or unions.
16424
16425 This option is deprecated.
16426
16427 @item -mabort-on-noreturn
16428 @opindex mabort-on-noreturn
16429 Generate a call to the function @code{abort} at the end of a
16430 @code{noreturn} function. It is executed if the function tries to
16431 return.
16432
16433 @item -mlong-calls
16434 @itemx -mno-long-calls
16435 @opindex mlong-calls
16436 @opindex mno-long-calls
16437 Tells the compiler to perform function calls by first loading the
16438 address of the function into a register and then performing a subroutine
16439 call on this register. This switch is needed if the target function
16440 lies outside of the 64-megabyte addressing range of the offset-based
16441 version of subroutine call instruction.
16442
16443 Even if this switch is enabled, not all function calls are turned
16444 into long calls. The heuristic is that static functions, functions
16445 that have the @code{short_call} attribute, functions that are inside
16446 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16447 definitions have already been compiled within the current compilation
16448 unit are not turned into long calls. The exceptions to this rule are
16449 that weak function definitions, functions with the @code{long_call}
16450 attribute or the @code{section} attribute, and functions that are within
16451 the scope of a @code{#pragma long_calls} directive are always
16452 turned into long calls.
16453
16454 This feature is not enabled by default. Specifying
16455 @option{-mno-long-calls} restores the default behavior, as does
16456 placing the function calls within the scope of a @code{#pragma
16457 long_calls_off} directive. Note these switches have no effect on how
16458 the compiler generates code to handle function calls via function
16459 pointers.
16460
16461 @item -msingle-pic-base
16462 @opindex msingle-pic-base
16463 Treat the register used for PIC addressing as read-only, rather than
16464 loading it in the prologue for each function. The runtime system is
16465 responsible for initializing this register with an appropriate value
16466 before execution begins.
16467
16468 @item -mpic-register=@var{reg}
16469 @opindex mpic-register
16470 Specify the register to be used for PIC addressing.
16471 For standard PIC base case, the default is any suitable register
16472 determined by compiler. For single PIC base case, the default is
16473 @samp{R9} if target is EABI based or stack-checking is enabled,
16474 otherwise the default is @samp{R10}.
16475
16476 @item -mpic-data-is-text-relative
16477 @opindex mpic-data-is-text-relative
16478 Assume that the displacement between the text and data segments is fixed
16479 at static link time. This permits using PC-relative addressing
16480 operations to access data known to be in the data segment. For
16481 non-VxWorks RTP targets, this option is enabled by default. When
16482 disabled on such targets, it will enable @option{-msingle-pic-base} by
16483 default.
16484
16485 @item -mpoke-function-name
16486 @opindex mpoke-function-name
16487 Write the name of each function into the text section, directly
16488 preceding the function prologue. The generated code is similar to this:
16489
16490 @smallexample
16491 t0
16492 .ascii "arm_poke_function_name", 0
16493 .align
16494 t1
16495 .word 0xff000000 + (t1 - t0)
16496 arm_poke_function_name
16497 mov ip, sp
16498 stmfd sp!, @{fp, ip, lr, pc@}
16499 sub fp, ip, #4
16500 @end smallexample
16501
16502 When performing a stack backtrace, code can inspect the value of
16503 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16504 location @code{pc - 12} and the top 8 bits are set, then we know that
16505 there is a function name embedded immediately preceding this location
16506 and has length @code{((pc[-3]) & 0xff000000)}.
16507
16508 @item -mthumb
16509 @itemx -marm
16510 @opindex marm
16511 @opindex mthumb
16512
16513 Select between generating code that executes in ARM and Thumb
16514 states. The default for most configurations is to generate code
16515 that executes in ARM state, but the default can be changed by
16516 configuring GCC with the @option{--with-mode=}@var{state}
16517 configure option.
16518
16519 You can also override the ARM and Thumb mode for each function
16520 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16521 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16522
16523 @item -mflip-thumb
16524 @opindex mflip-thumb
16525 Switch ARM/Thumb modes on alternating functions.
16526 This option is provided for regression testing of mixed Thumb/ARM code
16527 generation, and is not intended for ordinary use in compiling code.
16528
16529 @item -mtpcs-frame
16530 @opindex mtpcs-frame
16531 Generate a stack frame that is compliant with the Thumb Procedure Call
16532 Standard for all non-leaf functions. (A leaf function is one that does
16533 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16534
16535 @item -mtpcs-leaf-frame
16536 @opindex mtpcs-leaf-frame
16537 Generate a stack frame that is compliant with the Thumb Procedure Call
16538 Standard for all leaf functions. (A leaf function is one that does
16539 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16540
16541 @item -mcallee-super-interworking
16542 @opindex mcallee-super-interworking
16543 Gives all externally visible functions in the file being compiled an ARM
16544 instruction set header which switches to Thumb mode before executing the
16545 rest of the function. This allows these functions to be called from
16546 non-interworking code. This option is not valid in AAPCS configurations
16547 because interworking is enabled by default.
16548
16549 @item -mcaller-super-interworking
16550 @opindex mcaller-super-interworking
16551 Allows calls via function pointers (including virtual functions) to
16552 execute correctly regardless of whether the target code has been
16553 compiled for interworking or not. There is a small overhead in the cost
16554 of executing a function pointer if this option is enabled. This option
16555 is not valid in AAPCS configurations because interworking is enabled
16556 by default.
16557
16558 @item -mtp=@var{name}
16559 @opindex mtp
16560 Specify the access model for the thread local storage pointer. The valid
16561 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16562 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16563 (supported in the arm6k architecture), and @samp{auto}, which uses the
16564 best available method for the selected processor. The default setting is
16565 @samp{auto}.
16566
16567 @item -mtls-dialect=@var{dialect}
16568 @opindex mtls-dialect
16569 Specify the dialect to use for accessing thread local storage. Two
16570 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16571 @samp{gnu} dialect selects the original GNU scheme for supporting
16572 local and global dynamic TLS models. The @samp{gnu2} dialect
16573 selects the GNU descriptor scheme, which provides better performance
16574 for shared libraries. The GNU descriptor scheme is compatible with
16575 the original scheme, but does require new assembler, linker and
16576 library support. Initial and local exec TLS models are unaffected by
16577 this option and always use the original scheme.
16578
16579 @item -mword-relocations
16580 @opindex mword-relocations
16581 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16582 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16583 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16584 is specified.
16585
16586 @item -mfix-cortex-m3-ldrd
16587 @opindex mfix-cortex-m3-ldrd
16588 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16589 with overlapping destination and base registers are used. This option avoids
16590 generating these instructions. This option is enabled by default when
16591 @option{-mcpu=cortex-m3} is specified.
16592
16593 @item -munaligned-access
16594 @itemx -mno-unaligned-access
16595 @opindex munaligned-access
16596 @opindex mno-unaligned-access
16597 Enables (or disables) reading and writing of 16- and 32- bit values
16598 from addresses that are not 16- or 32- bit aligned. By default
16599 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16600 ARMv8-M Baseline architectures, and enabled for all other
16601 architectures. If unaligned access is not enabled then words in packed
16602 data structures are accessed a byte at a time.
16603
16604 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16605 generated object file to either true or false, depending upon the
16606 setting of this option. If unaligned access is enabled then the
16607 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16608 defined.
16609
16610 @item -mneon-for-64bits
16611 @opindex mneon-for-64bits
16612 Enables using Neon to handle scalar 64-bits operations. This is
16613 disabled by default since the cost of moving data from core registers
16614 to Neon is high.
16615
16616 @item -mslow-flash-data
16617 @opindex mslow-flash-data
16618 Assume loading data from flash is slower than fetching instruction.
16619 Therefore literal load is minimized for better performance.
16620 This option is only supported when compiling for ARMv7 M-profile and
16621 off by default.
16622
16623 @item -masm-syntax-unified
16624 @opindex masm-syntax-unified
16625 Assume inline assembler is using unified asm syntax. The default is
16626 currently off which implies divided syntax. This option has no impact
16627 on Thumb2. However, this may change in future releases of GCC.
16628 Divided syntax should be considered deprecated.
16629
16630 @item -mrestrict-it
16631 @opindex mrestrict-it
16632 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16633 IT blocks can only contain a single 16-bit instruction from a select
16634 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16635
16636 @item -mprint-tune-info
16637 @opindex mprint-tune-info
16638 Print CPU tuning information as comment in assembler file. This is
16639 an option used only for regression testing of the compiler and not
16640 intended for ordinary use in compiling code. This option is disabled
16641 by default.
16642
16643 @item -mverbose-cost-dump
16644 @opindex mverbose-cost-dump
16645 Enable verbose cost model dumping in the debug dump files. This option is
16646 provided for use in debugging the compiler.
16647
16648 @item -mpure-code
16649 @opindex mpure-code
16650 Do not allow constant data to be placed in code sections.
16651 Additionally, when compiling for ELF object format give all text sections the
16652 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16653 is only available when generating non-pic code for M-profile targets with the
16654 MOVT instruction.
16655
16656 @item -mcmse
16657 @opindex mcmse
16658 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16659 Development Tools Engineering Specification", which can be found on
16660 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16661 @end table
16662
16663 @node AVR Options
16664 @subsection AVR Options
16665 @cindex AVR Options
16666
16667 These options are defined for AVR implementations:
16668
16669 @table @gcctabopt
16670 @item -mmcu=@var{mcu}
16671 @opindex mmcu
16672 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16673
16674 The default for this option is@tie{}@samp{avr2}.
16675
16676 GCC supports the following AVR devices and ISAs:
16677
16678 @include avr-mmcu.texi
16679
16680 @item -mabsdata
16681 @opindex mabsdata
16682
16683 Assume that all data in static storage can be accessed by LDS / STS
16684 instructions. This option has only an effect on reduced Tiny devices like
16685 ATtiny40. See also the @code{absdata}
16686 @ref{AVR Variable Attributes,variable attribute}.
16687
16688 @item -maccumulate-args
16689 @opindex maccumulate-args
16690 Accumulate outgoing function arguments and acquire/release the needed
16691 stack space for outgoing function arguments once in function
16692 prologue/epilogue. Without this option, outgoing arguments are pushed
16693 before calling a function and popped afterwards.
16694
16695 Popping the arguments after the function call can be expensive on
16696 AVR so that accumulating the stack space might lead to smaller
16697 executables because arguments need not be removed from the
16698 stack after such a function call.
16699
16700 This option can lead to reduced code size for functions that perform
16701 several calls to functions that get their arguments on the stack like
16702 calls to printf-like functions.
16703
16704 @item -mbranch-cost=@var{cost}
16705 @opindex mbranch-cost
16706 Set the branch costs for conditional branch instructions to
16707 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16708 integers. The default branch cost is 0.
16709
16710 @item -mcall-prologues
16711 @opindex mcall-prologues
16712 Functions prologues/epilogues are expanded as calls to appropriate
16713 subroutines. Code size is smaller.
16714
16715 @item -mgas-isr-prologues
16716 @opindex mgas-isr-prologues
16717 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16718 instruction supported by GNU Binutils.
16719 If this option is on, the feature can still be disabled for individual
16720 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16721 function attribute. This feature is activated per default
16722 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16723 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16724
16725 @item -mint8
16726 @opindex mint8
16727 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16728 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16729 and @code{long long} is 4 bytes. Please note that this option does not
16730 conform to the C standards, but it results in smaller code
16731 size.
16732
16733 @item -mmain-is-OS_task
16734 @opindex mmain-is-OS_task
16735 Do not save registers in @code{main}. The effect is the same like
16736 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
16737 to @code{main}. It is activated per default if optimization is on.
16738
16739 @item -mn-flash=@var{num}
16740 @opindex mn-flash
16741 Assume that the flash memory has a size of
16742 @var{num} times 64@tie{}KiB.
16743
16744 @item -mno-interrupts
16745 @opindex mno-interrupts
16746 Generated code is not compatible with hardware interrupts.
16747 Code size is smaller.
16748
16749 @item -mrelax
16750 @opindex mrelax
16751 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16752 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16753 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16754 the assembler's command line and the @option{--relax} option to the
16755 linker's command line.
16756
16757 Jump relaxing is performed by the linker because jump offsets are not
16758 known before code is located. Therefore, the assembler code generated by the
16759 compiler is the same, but the instructions in the executable may
16760 differ from instructions in the assembler code.
16761
16762 Relaxing must be turned on if linker stubs are needed, see the
16763 section on @code{EIND} and linker stubs below.
16764
16765 @item -mrmw
16766 @opindex mrmw
16767 Assume that the device supports the Read-Modify-Write
16768 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16769
16770 @item -mshort-calls
16771 @opindex mshort-calls
16772
16773 Assume that @code{RJMP} and @code{RCALL} can target the whole
16774 program memory.
16775
16776 This option is used internally for multilib selection. It is
16777 not an optimization option, and you don't need to set it by hand.
16778
16779 @item -msp8
16780 @opindex msp8
16781 Treat the stack pointer register as an 8-bit register,
16782 i.e.@: assume the high byte of the stack pointer is zero.
16783 In general, you don't need to set this option by hand.
16784
16785 This option is used internally by the compiler to select and
16786 build multilibs for architectures @code{avr2} and @code{avr25}.
16787 These architectures mix devices with and without @code{SPH}.
16788 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16789 the compiler driver adds or removes this option from the compiler
16790 proper's command line, because the compiler then knows if the device
16791 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16792 register or not.
16793
16794 @item -mstrict-X
16795 @opindex mstrict-X
16796 Use address register @code{X} in a way proposed by the hardware. This means
16797 that @code{X} is only used in indirect, post-increment or
16798 pre-decrement addressing.
16799
16800 Without this option, the @code{X} register may be used in the same way
16801 as @code{Y} or @code{Z} which then is emulated by additional
16802 instructions.
16803 For example, loading a value with @code{X+const} addressing with a
16804 small non-negative @code{const < 64} to a register @var{Rn} is
16805 performed as
16806
16807 @example
16808 adiw r26, const ; X += const
16809 ld @var{Rn}, X ; @var{Rn} = *X
16810 sbiw r26, const ; X -= const
16811 @end example
16812
16813 @item -mtiny-stack
16814 @opindex mtiny-stack
16815 Only change the lower 8@tie{}bits of the stack pointer.
16816
16817 @item -mfract-convert-truncate
16818 @opindex mfract-convert-truncate
16819 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16820
16821 @item -nodevicelib
16822 @opindex nodevicelib
16823 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16824
16825 @item -Waddr-space-convert
16826 @opindex Waddr-space-convert
16827 Warn about conversions between address spaces in the case where the
16828 resulting address space is not contained in the incoming address space.
16829
16830 @item -Wmisspelled-isr
16831 @opindex Wmisspelled-isr
16832 Warn if the ISR is misspelled, i.e. without __vector prefix.
16833 Enabled by default.
16834 @end table
16835
16836 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16837 @cindex @code{EIND}
16838 Pointers in the implementation are 16@tie{}bits wide.
16839 The address of a function or label is represented as word address so
16840 that indirect jumps and calls can target any code address in the
16841 range of 64@tie{}Ki words.
16842
16843 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16844 bytes of program memory space, there is a special function register called
16845 @code{EIND} that serves as most significant part of the target address
16846 when @code{EICALL} or @code{EIJMP} instructions are used.
16847
16848 Indirect jumps and calls on these devices are handled as follows by
16849 the compiler and are subject to some limitations:
16850
16851 @itemize @bullet
16852
16853 @item
16854 The compiler never sets @code{EIND}.
16855
16856 @item
16857 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16858 instructions or might read @code{EIND} directly in order to emulate an
16859 indirect call/jump by means of a @code{RET} instruction.
16860
16861 @item
16862 The compiler assumes that @code{EIND} never changes during the startup
16863 code or during the application. In particular, @code{EIND} is not
16864 saved/restored in function or interrupt service routine
16865 prologue/epilogue.
16866
16867 @item
16868 For indirect calls to functions and computed goto, the linker
16869 generates @emph{stubs}. Stubs are jump pads sometimes also called
16870 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16871 The stub contains a direct jump to the desired address.
16872
16873 @item
16874 Linker relaxation must be turned on so that the linker generates
16875 the stubs correctly in all situations. See the compiler option
16876 @option{-mrelax} and the linker option @option{--relax}.
16877 There are corner cases where the linker is supposed to generate stubs
16878 but aborts without relaxation and without a helpful error message.
16879
16880 @item
16881 The default linker script is arranged for code with @code{EIND = 0}.
16882 If code is supposed to work for a setup with @code{EIND != 0}, a custom
16883 linker script has to be used in order to place the sections whose
16884 name start with @code{.trampolines} into the segment where @code{EIND}
16885 points to.
16886
16887 @item
16888 The startup code from libgcc never sets @code{EIND}.
16889 Notice that startup code is a blend of code from libgcc and AVR-LibC.
16890 For the impact of AVR-LibC on @code{EIND}, see the
16891 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
16892
16893 @item
16894 It is legitimate for user-specific startup code to set up @code{EIND}
16895 early, for example by means of initialization code located in
16896 section @code{.init3}. Such code runs prior to general startup code
16897 that initializes RAM and calls constructors, but after the bit
16898 of startup code from AVR-LibC that sets @code{EIND} to the segment
16899 where the vector table is located.
16900 @example
16901 #include <avr/io.h>
16902
16903 static void
16904 __attribute__((section(".init3"),naked,used,no_instrument_function))
16905 init3_set_eind (void)
16906 @{
16907 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
16908 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
16909 @}
16910 @end example
16911
16912 @noindent
16913 The @code{__trampolines_start} symbol is defined in the linker script.
16914
16915 @item
16916 Stubs are generated automatically by the linker if
16917 the following two conditions are met:
16918 @itemize @minus
16919
16920 @item The address of a label is taken by means of the @code{gs} modifier
16921 (short for @emph{generate stubs}) like so:
16922 @example
16923 LDI r24, lo8(gs(@var{func}))
16924 LDI r25, hi8(gs(@var{func}))
16925 @end example
16926 @item The final location of that label is in a code segment
16927 @emph{outside} the segment where the stubs are located.
16928 @end itemize
16929
16930 @item
16931 The compiler emits such @code{gs} modifiers for code labels in the
16932 following situations:
16933 @itemize @minus
16934 @item Taking address of a function or code label.
16935 @item Computed goto.
16936 @item If prologue-save function is used, see @option{-mcall-prologues}
16937 command-line option.
16938 @item Switch/case dispatch tables. If you do not want such dispatch
16939 tables you can specify the @option{-fno-jump-tables} command-line option.
16940 @item C and C++ constructors/destructors called during startup/shutdown.
16941 @item If the tools hit a @code{gs()} modifier explained above.
16942 @end itemize
16943
16944 @item
16945 Jumping to non-symbolic addresses like so is @emph{not} supported:
16946
16947 @example
16948 int main (void)
16949 @{
16950 /* Call function at word address 0x2 */
16951 return ((int(*)(void)) 0x2)();
16952 @}
16953 @end example
16954
16955 Instead, a stub has to be set up, i.e.@: the function has to be called
16956 through a symbol (@code{func_4} in the example):
16957
16958 @example
16959 int main (void)
16960 @{
16961 extern int func_4 (void);
16962
16963 /* Call function at byte address 0x4 */
16964 return func_4();
16965 @}
16966 @end example
16967
16968 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
16969 Alternatively, @code{func_4} can be defined in the linker script.
16970 @end itemize
16971
16972 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
16973 @cindex @code{RAMPD}
16974 @cindex @code{RAMPX}
16975 @cindex @code{RAMPY}
16976 @cindex @code{RAMPZ}
16977 Some AVR devices support memories larger than the 64@tie{}KiB range
16978 that can be accessed with 16-bit pointers. To access memory locations
16979 outside this 64@tie{}KiB range, the content of a @code{RAMP}
16980 register is used as high part of the address:
16981 The @code{X}, @code{Y}, @code{Z} address register is concatenated
16982 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
16983 register, respectively, to get a wide address. Similarly,
16984 @code{RAMPD} is used together with direct addressing.
16985
16986 @itemize
16987 @item
16988 The startup code initializes the @code{RAMP} special function
16989 registers with zero.
16990
16991 @item
16992 If a @ref{AVR Named Address Spaces,named address space} other than
16993 generic or @code{__flash} is used, then @code{RAMPZ} is set
16994 as needed before the operation.
16995
16996 @item
16997 If the device supports RAM larger than 64@tie{}KiB and the compiler
16998 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
16999 is reset to zero after the operation.
17000
17001 @item
17002 If the device comes with a specific @code{RAMP} register, the ISR
17003 prologue/epilogue saves/restores that SFR and initializes it with
17004 zero in case the ISR code might (implicitly) use it.
17005
17006 @item
17007 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17008 If you use inline assembler to read from locations outside the
17009 16-bit address range and change one of the @code{RAMP} registers,
17010 you must reset it to zero after the access.
17011
17012 @end itemize
17013
17014 @subsubsection AVR Built-in Macros
17015
17016 GCC defines several built-in macros so that the user code can test
17017 for the presence or absence of features. Almost any of the following
17018 built-in macros are deduced from device capabilities and thus
17019 triggered by the @option{-mmcu=} command-line option.
17020
17021 For even more AVR-specific built-in macros see
17022 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17023
17024 @table @code
17025
17026 @item __AVR_ARCH__
17027 Build-in macro that resolves to a decimal number that identifies the
17028 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17029 Possible values are:
17030
17031 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17032 @code{4}, @code{5}, @code{51}, @code{6}
17033
17034 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17035 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17036
17037 respectively and
17038
17039 @code{100},
17040 @code{102}, @code{103}, @code{104},
17041 @code{105}, @code{106}, @code{107}
17042
17043 for @var{mcu}=@code{avrtiny},
17044 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17045 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17046 If @var{mcu} specifies a device, this built-in macro is set
17047 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17048 defined to @code{4}.
17049
17050 @item __AVR_@var{Device}__
17051 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17052 the device's name. For example, @option{-mmcu=atmega8} defines the
17053 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17054 @code{__AVR_ATtiny261A__}, etc.
17055
17056 The built-in macros' names follow
17057 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17058 the device name as from the AVR user manual. The difference between
17059 @var{Device} in the built-in macro and @var{device} in
17060 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17061
17062 If @var{device} is not a device but only a core architecture like
17063 @samp{avr51}, this macro is not defined.
17064
17065 @item __AVR_DEVICE_NAME__
17066 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17067 the device's name. For example, with @option{-mmcu=atmega8} the macro
17068 is defined to @code{atmega8}.
17069
17070 If @var{device} is not a device but only a core architecture like
17071 @samp{avr51}, this macro is not defined.
17072
17073 @item __AVR_XMEGA__
17074 The device / architecture belongs to the XMEGA family of devices.
17075
17076 @item __AVR_HAVE_ELPM__
17077 The device has the @code{ELPM} instruction.
17078
17079 @item __AVR_HAVE_ELPMX__
17080 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17081 R@var{n},Z+} instructions.
17082
17083 @item __AVR_HAVE_MOVW__
17084 The device has the @code{MOVW} instruction to perform 16-bit
17085 register-register moves.
17086
17087 @item __AVR_HAVE_LPMX__
17088 The device has the @code{LPM R@var{n},Z} and
17089 @code{LPM R@var{n},Z+} instructions.
17090
17091 @item __AVR_HAVE_MUL__
17092 The device has a hardware multiplier.
17093
17094 @item __AVR_HAVE_JMP_CALL__
17095 The device has the @code{JMP} and @code{CALL} instructions.
17096 This is the case for devices with more than 8@tie{}KiB of program
17097 memory.
17098
17099 @item __AVR_HAVE_EIJMP_EICALL__
17100 @itemx __AVR_3_BYTE_PC__
17101 The device has the @code{EIJMP} and @code{EICALL} instructions.
17102 This is the case for devices with more than 128@tie{}KiB of program memory.
17103 This also means that the program counter
17104 (PC) is 3@tie{}bytes wide.
17105
17106 @item __AVR_2_BYTE_PC__
17107 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17108 with up to 128@tie{}KiB of program memory.
17109
17110 @item __AVR_HAVE_8BIT_SP__
17111 @itemx __AVR_HAVE_16BIT_SP__
17112 The stack pointer (SP) register is treated as 8-bit respectively
17113 16-bit register by the compiler.
17114 The definition of these macros is affected by @option{-mtiny-stack}.
17115
17116 @item __AVR_HAVE_SPH__
17117 @itemx __AVR_SP8__
17118 The device has the SPH (high part of stack pointer) special function
17119 register or has an 8-bit stack pointer, respectively.
17120 The definition of these macros is affected by @option{-mmcu=} and
17121 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17122 by @option{-msp8}.
17123
17124 @item __AVR_HAVE_RAMPD__
17125 @itemx __AVR_HAVE_RAMPX__
17126 @itemx __AVR_HAVE_RAMPY__
17127 @itemx __AVR_HAVE_RAMPZ__
17128 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17129 @code{RAMPZ} special function register, respectively.
17130
17131 @item __NO_INTERRUPTS__
17132 This macro reflects the @option{-mno-interrupts} command-line option.
17133
17134 @item __AVR_ERRATA_SKIP__
17135 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17136 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17137 instructions because of a hardware erratum. Skip instructions are
17138 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17139 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17140 set.
17141
17142 @item __AVR_ISA_RMW__
17143 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17144
17145 @item __AVR_SFR_OFFSET__=@var{offset}
17146 Instructions that can address I/O special function registers directly
17147 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17148 address as if addressed by an instruction to access RAM like @code{LD}
17149 or @code{STS}. This offset depends on the device architecture and has
17150 to be subtracted from the RAM address in order to get the
17151 respective I/O@tie{}address.
17152
17153 @item __AVR_SHORT_CALLS__
17154 The @option{-mshort-calls} command line option is set.
17155
17156 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17157 Some devices support reading from flash memory by means of @code{LD*}
17158 instructions. The flash memory is seen in the data address space
17159 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17160 is not defined, this feature is not available. If defined,
17161 the address space is linear and there is no need to put
17162 @code{.rodata} into RAM. This is handled by the default linker
17163 description file, and is currently available for
17164 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17165 there is no need to use address spaces like @code{__flash} or
17166 features like attribute @code{progmem} and @code{pgm_read_*}.
17167
17168 @item __WITH_AVRLIBC__
17169 The compiler is configured to be used together with AVR-Libc.
17170 See the @option{--with-avrlibc} configure option.
17171
17172 @end table
17173
17174 @node Blackfin Options
17175 @subsection Blackfin Options
17176 @cindex Blackfin Options
17177
17178 @table @gcctabopt
17179 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17180 @opindex mcpu=
17181 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17182 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17183 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17184 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17185 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17186 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17187 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17188 @samp{bf561}, @samp{bf592}.
17189
17190 The optional @var{sirevision} specifies the silicon revision of the target
17191 Blackfin processor. Any workarounds available for the targeted silicon revision
17192 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17193 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17194 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17195 hexadecimal digits representing the major and minor numbers in the silicon
17196 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17197 is not defined. If @var{sirevision} is @samp{any}, the
17198 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17199 If this optional @var{sirevision} is not used, GCC assumes the latest known
17200 silicon revision of the targeted Blackfin processor.
17201
17202 GCC defines a preprocessor macro for the specified @var{cpu}.
17203 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17204 provided by libgloss to be linked in if @option{-msim} is not given.
17205
17206 Without this option, @samp{bf532} is used as the processor by default.
17207
17208 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17209 only the preprocessor macro is defined.
17210
17211 @item -msim
17212 @opindex msim
17213 Specifies that the program will be run on the simulator. This causes
17214 the simulator BSP provided by libgloss to be linked in. This option
17215 has effect only for @samp{bfin-elf} toolchain.
17216 Certain other options, such as @option{-mid-shared-library} and
17217 @option{-mfdpic}, imply @option{-msim}.
17218
17219 @item -momit-leaf-frame-pointer
17220 @opindex momit-leaf-frame-pointer
17221 Don't keep the frame pointer in a register for leaf functions. This
17222 avoids the instructions to save, set up and restore frame pointers and
17223 makes an extra register available in leaf functions.
17224
17225 @item -mspecld-anomaly
17226 @opindex mspecld-anomaly
17227 When enabled, the compiler ensures that the generated code does not
17228 contain speculative loads after jump instructions. If this option is used,
17229 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17230
17231 @item -mno-specld-anomaly
17232 @opindex mno-specld-anomaly
17233 Don't generate extra code to prevent speculative loads from occurring.
17234
17235 @item -mcsync-anomaly
17236 @opindex mcsync-anomaly
17237 When enabled, the compiler ensures that the generated code does not
17238 contain CSYNC or SSYNC instructions too soon after conditional branches.
17239 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17240
17241 @item -mno-csync-anomaly
17242 @opindex mno-csync-anomaly
17243 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17244 occurring too soon after a conditional branch.
17245
17246 @item -mlow-64k
17247 @opindex mlow-64k
17248 When enabled, the compiler is free to take advantage of the knowledge that
17249 the entire program fits into the low 64k of memory.
17250
17251 @item -mno-low-64k
17252 @opindex mno-low-64k
17253 Assume that the program is arbitrarily large. This is the default.
17254
17255 @item -mstack-check-l1
17256 @opindex mstack-check-l1
17257 Do stack checking using information placed into L1 scratchpad memory by the
17258 uClinux kernel.
17259
17260 @item -mid-shared-library
17261 @opindex mid-shared-library
17262 Generate code that supports shared libraries via the library ID method.
17263 This allows for execute in place and shared libraries in an environment
17264 without virtual memory management. This option implies @option{-fPIC}.
17265 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17266
17267 @item -mno-id-shared-library
17268 @opindex mno-id-shared-library
17269 Generate code that doesn't assume ID-based shared libraries are being used.
17270 This is the default.
17271
17272 @item -mleaf-id-shared-library
17273 @opindex mleaf-id-shared-library
17274 Generate code that supports shared libraries via the library ID method,
17275 but assumes that this library or executable won't link against any other
17276 ID shared libraries. That allows the compiler to use faster code for jumps
17277 and calls.
17278
17279 @item -mno-leaf-id-shared-library
17280 @opindex mno-leaf-id-shared-library
17281 Do not assume that the code being compiled won't link against any ID shared
17282 libraries. Slower code is generated for jump and call insns.
17283
17284 @item -mshared-library-id=n
17285 @opindex mshared-library-id
17286 Specifies the identification number of the ID-based shared library being
17287 compiled. Specifying a value of 0 generates more compact code; specifying
17288 other values forces the allocation of that number to the current
17289 library but is no more space- or time-efficient than omitting this option.
17290
17291 @item -msep-data
17292 @opindex msep-data
17293 Generate code that allows the data segment to be located in a different
17294 area of memory from the text segment. This allows for execute in place in
17295 an environment without virtual memory management by eliminating relocations
17296 against the text section.
17297
17298 @item -mno-sep-data
17299 @opindex mno-sep-data
17300 Generate code that assumes that the data segment follows the text segment.
17301 This is the default.
17302
17303 @item -mlong-calls
17304 @itemx -mno-long-calls
17305 @opindex mlong-calls
17306 @opindex mno-long-calls
17307 Tells the compiler to perform function calls by first loading the
17308 address of the function into a register and then performing a subroutine
17309 call on this register. This switch is needed if the target function
17310 lies outside of the 24-bit addressing range of the offset-based
17311 version of subroutine call instruction.
17312
17313 This feature is not enabled by default. Specifying
17314 @option{-mno-long-calls} restores the default behavior. Note these
17315 switches have no effect on how the compiler generates code to handle
17316 function calls via function pointers.
17317
17318 @item -mfast-fp
17319 @opindex mfast-fp
17320 Link with the fast floating-point library. This library relaxes some of
17321 the IEEE floating-point standard's rules for checking inputs against
17322 Not-a-Number (NAN), in the interest of performance.
17323
17324 @item -minline-plt
17325 @opindex minline-plt
17326 Enable inlining of PLT entries in function calls to functions that are
17327 not known to bind locally. It has no effect without @option{-mfdpic}.
17328
17329 @item -mmulticore
17330 @opindex mmulticore
17331 Build a standalone application for multicore Blackfin processors.
17332 This option causes proper start files and link scripts supporting
17333 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17334 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17335
17336 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17337 selects the one-application-per-core programming model. Without
17338 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17339 programming model is used. In this model, the main function of Core B
17340 should be named as @code{coreb_main}.
17341
17342 If this option is not used, the single-core application programming
17343 model is used.
17344
17345 @item -mcorea
17346 @opindex mcorea
17347 Build a standalone application for Core A of BF561 when using
17348 the one-application-per-core programming model. Proper start files
17349 and link scripts are used to support Core A, and the macro
17350 @code{__BFIN_COREA} is defined.
17351 This option can only be used in conjunction with @option{-mmulticore}.
17352
17353 @item -mcoreb
17354 @opindex mcoreb
17355 Build a standalone application for Core B of BF561 when using
17356 the one-application-per-core programming model. Proper start files
17357 and link scripts are used to support Core B, and the macro
17358 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17359 should be used instead of @code{main}.
17360 This option can only be used in conjunction with @option{-mmulticore}.
17361
17362 @item -msdram
17363 @opindex msdram
17364 Build a standalone application for SDRAM. Proper start files and
17365 link scripts are used to put the application into SDRAM, and the macro
17366 @code{__BFIN_SDRAM} is defined.
17367 The loader should initialize SDRAM before loading the application.
17368
17369 @item -micplb
17370 @opindex micplb
17371 Assume that ICPLBs are enabled at run time. This has an effect on certain
17372 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17373 are enabled; for standalone applications the default is off.
17374 @end table
17375
17376 @node C6X Options
17377 @subsection C6X Options
17378 @cindex C6X Options
17379
17380 @table @gcctabopt
17381 @item -march=@var{name}
17382 @opindex march
17383 This specifies the name of the target architecture. GCC uses this
17384 name to determine what kind of instructions it can emit when generating
17385 assembly code. Permissible names are: @samp{c62x},
17386 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17387
17388 @item -mbig-endian
17389 @opindex mbig-endian
17390 Generate code for a big-endian target.
17391
17392 @item -mlittle-endian
17393 @opindex mlittle-endian
17394 Generate code for a little-endian target. This is the default.
17395
17396 @item -msim
17397 @opindex msim
17398 Choose startup files and linker script suitable for the simulator.
17399
17400 @item -msdata=default
17401 @opindex msdata=default
17402 Put small global and static data in the @code{.neardata} section,
17403 which is pointed to by register @code{B14}. Put small uninitialized
17404 global and static data in the @code{.bss} section, which is adjacent
17405 to the @code{.neardata} section. Put small read-only data into the
17406 @code{.rodata} section. The corresponding sections used for large
17407 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17408
17409 @item -msdata=all
17410 @opindex msdata=all
17411 Put all data, not just small objects, into the sections reserved for
17412 small data, and use addressing relative to the @code{B14} register to
17413 access them.
17414
17415 @item -msdata=none
17416 @opindex msdata=none
17417 Make no use of the sections reserved for small data, and use absolute
17418 addresses to access all data. Put all initialized global and static
17419 data in the @code{.fardata} section, and all uninitialized data in the
17420 @code{.far} section. Put all constant data into the @code{.const}
17421 section.
17422 @end table
17423
17424 @node CRIS Options
17425 @subsection CRIS Options
17426 @cindex CRIS Options
17427
17428 These options are defined specifically for the CRIS ports.
17429
17430 @table @gcctabopt
17431 @item -march=@var{architecture-type}
17432 @itemx -mcpu=@var{architecture-type}
17433 @opindex march
17434 @opindex mcpu
17435 Generate code for the specified architecture. The choices for
17436 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17437 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17438 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17439 @samp{v10}.
17440
17441 @item -mtune=@var{architecture-type}
17442 @opindex mtune
17443 Tune to @var{architecture-type} everything applicable about the generated
17444 code, except for the ABI and the set of available instructions. The
17445 choices for @var{architecture-type} are the same as for
17446 @option{-march=@var{architecture-type}}.
17447
17448 @item -mmax-stack-frame=@var{n}
17449 @opindex mmax-stack-frame
17450 Warn when the stack frame of a function exceeds @var{n} bytes.
17451
17452 @item -metrax4
17453 @itemx -metrax100
17454 @opindex metrax4
17455 @opindex metrax100
17456 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17457 @option{-march=v3} and @option{-march=v8} respectively.
17458
17459 @item -mmul-bug-workaround
17460 @itemx -mno-mul-bug-workaround
17461 @opindex mmul-bug-workaround
17462 @opindex mno-mul-bug-workaround
17463 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17464 models where it applies. This option is active by default.
17465
17466 @item -mpdebug
17467 @opindex mpdebug
17468 Enable CRIS-specific verbose debug-related information in the assembly
17469 code. This option also has the effect of turning off the @samp{#NO_APP}
17470 formatted-code indicator to the assembler at the beginning of the
17471 assembly file.
17472
17473 @item -mcc-init
17474 @opindex mcc-init
17475 Do not use condition-code results from previous instruction; always emit
17476 compare and test instructions before use of condition codes.
17477
17478 @item -mno-side-effects
17479 @opindex mno-side-effects
17480 Do not emit instructions with side effects in addressing modes other than
17481 post-increment.
17482
17483 @item -mstack-align
17484 @itemx -mno-stack-align
17485 @itemx -mdata-align
17486 @itemx -mno-data-align
17487 @itemx -mconst-align
17488 @itemx -mno-const-align
17489 @opindex mstack-align
17490 @opindex mno-stack-align
17491 @opindex mdata-align
17492 @opindex mno-data-align
17493 @opindex mconst-align
17494 @opindex mno-const-align
17495 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17496 stack frame, individual data and constants to be aligned for the maximum
17497 single data access size for the chosen CPU model. The default is to
17498 arrange for 32-bit alignment. ABI details such as structure layout are
17499 not affected by these options.
17500
17501 @item -m32-bit
17502 @itemx -m16-bit
17503 @itemx -m8-bit
17504 @opindex m32-bit
17505 @opindex m16-bit
17506 @opindex m8-bit
17507 Similar to the stack- data- and const-align options above, these options
17508 arrange for stack frame, writable data and constants to all be 32-bit,
17509 16-bit or 8-bit aligned. The default is 32-bit alignment.
17510
17511 @item -mno-prologue-epilogue
17512 @itemx -mprologue-epilogue
17513 @opindex mno-prologue-epilogue
17514 @opindex mprologue-epilogue
17515 With @option{-mno-prologue-epilogue}, the normal function prologue and
17516 epilogue which set up the stack frame are omitted and no return
17517 instructions or return sequences are generated in the code. Use this
17518 option only together with visual inspection of the compiled code: no
17519 warnings or errors are generated when call-saved registers must be saved,
17520 or storage for local variables needs to be allocated.
17521
17522 @item -mno-gotplt
17523 @itemx -mgotplt
17524 @opindex mno-gotplt
17525 @opindex mgotplt
17526 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17527 instruction sequences that load addresses for functions from the PLT part
17528 of the GOT rather than (traditional on other architectures) calls to the
17529 PLT@. The default is @option{-mgotplt}.
17530
17531 @item -melf
17532 @opindex melf
17533 Legacy no-op option only recognized with the cris-axis-elf and
17534 cris-axis-linux-gnu targets.
17535
17536 @item -mlinux
17537 @opindex mlinux
17538 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17539
17540 @item -sim
17541 @opindex sim
17542 This option, recognized for the cris-axis-elf, arranges
17543 to link with input-output functions from a simulator library. Code,
17544 initialized data and zero-initialized data are allocated consecutively.
17545
17546 @item -sim2
17547 @opindex sim2
17548 Like @option{-sim}, but pass linker options to locate initialized data at
17549 0x40000000 and zero-initialized data at 0x80000000.
17550 @end table
17551
17552 @node CR16 Options
17553 @subsection CR16 Options
17554 @cindex CR16 Options
17555
17556 These options are defined specifically for the CR16 ports.
17557
17558 @table @gcctabopt
17559
17560 @item -mmac
17561 @opindex mmac
17562 Enable the use of multiply-accumulate instructions. Disabled by default.
17563
17564 @item -mcr16cplus
17565 @itemx -mcr16c
17566 @opindex mcr16cplus
17567 @opindex mcr16c
17568 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17569 is default.
17570
17571 @item -msim
17572 @opindex msim
17573 Links the library libsim.a which is in compatible with simulator. Applicable
17574 to ELF compiler only.
17575
17576 @item -mint32
17577 @opindex mint32
17578 Choose integer type as 32-bit wide.
17579
17580 @item -mbit-ops
17581 @opindex mbit-ops
17582 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17583
17584 @item -mdata-model=@var{model}
17585 @opindex mdata-model
17586 Choose a data model. The choices for @var{model} are @samp{near},
17587 @samp{far} or @samp{medium}. @samp{medium} is default.
17588 However, @samp{far} is not valid with @option{-mcr16c}, as the
17589 CR16C architecture does not support the far data model.
17590 @end table
17591
17592 @node Darwin Options
17593 @subsection Darwin Options
17594 @cindex Darwin options
17595
17596 These options are defined for all architectures running the Darwin operating
17597 system.
17598
17599 FSF GCC on Darwin does not create ``fat'' object files; it creates
17600 an object file for the single architecture that GCC was built to
17601 target. Apple's GCC on Darwin does create ``fat'' files if multiple
17602 @option{-arch} options are used; it does so by running the compiler or
17603 linker multiple times and joining the results together with
17604 @file{lipo}.
17605
17606 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17607 @samp{i686}) is determined by the flags that specify the ISA
17608 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17609 @option{-force_cpusubtype_ALL} option can be used to override this.
17610
17611 The Darwin tools vary in their behavior when presented with an ISA
17612 mismatch. The assembler, @file{as}, only permits instructions to
17613 be used that are valid for the subtype of the file it is generating,
17614 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17615 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17616 and prints an error if asked to create a shared library with a less
17617 restrictive subtype than its input files (for instance, trying to put
17618 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17619 for executables, @command{ld}, quietly gives the executable the most
17620 restrictive subtype of any of its input files.
17621
17622 @table @gcctabopt
17623 @item -F@var{dir}
17624 @opindex F
17625 Add the framework directory @var{dir} to the head of the list of
17626 directories to be searched for header files. These directories are
17627 interleaved with those specified by @option{-I} options and are
17628 scanned in a left-to-right order.
17629
17630 A framework directory is a directory with frameworks in it. A
17631 framework is a directory with a @file{Headers} and/or
17632 @file{PrivateHeaders} directory contained directly in it that ends
17633 in @file{.framework}. The name of a framework is the name of this
17634 directory excluding the @file{.framework}. Headers associated with
17635 the framework are found in one of those two directories, with
17636 @file{Headers} being searched first. A subframework is a framework
17637 directory that is in a framework's @file{Frameworks} directory.
17638 Includes of subframework headers can only appear in a header of a
17639 framework that contains the subframework, or in a sibling subframework
17640 header. Two subframeworks are siblings if they occur in the same
17641 framework. A subframework should not have the same name as a
17642 framework; a warning is issued if this is violated. Currently a
17643 subframework cannot have subframeworks; in the future, the mechanism
17644 may be extended to support this. The standard frameworks can be found
17645 in @file{/System/Library/Frameworks} and
17646 @file{/Library/Frameworks}. An example include looks like
17647 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17648 the name of the framework and @file{header.h} is found in the
17649 @file{PrivateHeaders} or @file{Headers} directory.
17650
17651 @item -iframework@var{dir}
17652 @opindex iframework
17653 Like @option{-F} except the directory is a treated as a system
17654 directory. The main difference between this @option{-iframework} and
17655 @option{-F} is that with @option{-iframework} the compiler does not
17656 warn about constructs contained within header files found via
17657 @var{dir}. This option is valid only for the C family of languages.
17658
17659 @item -gused
17660 @opindex gused
17661 Emit debugging information for symbols that are used. For stabs
17662 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17663 This is by default ON@.
17664
17665 @item -gfull
17666 @opindex gfull
17667 Emit debugging information for all symbols and types.
17668
17669 @item -mmacosx-version-min=@var{version}
17670 The earliest version of MacOS X that this executable will run on
17671 is @var{version}. Typical values of @var{version} include @code{10.1},
17672 @code{10.2}, and @code{10.3.9}.
17673
17674 If the compiler was built to use the system's headers by default,
17675 then the default for this option is the system version on which the
17676 compiler is running, otherwise the default is to make choices that
17677 are compatible with as many systems and code bases as possible.
17678
17679 @item -mkernel
17680 @opindex mkernel
17681 Enable kernel development mode. The @option{-mkernel} option sets
17682 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17683 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17684 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17685 applicable. This mode also sets @option{-mno-altivec},
17686 @option{-msoft-float}, @option{-fno-builtin} and
17687 @option{-mlong-branch} for PowerPC targets.
17688
17689 @item -mone-byte-bool
17690 @opindex mone-byte-bool
17691 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17692 By default @code{sizeof(bool)} is @code{4} when compiling for
17693 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17694 option has no effect on x86.
17695
17696 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17697 to generate code that is not binary compatible with code generated
17698 without that switch. Using this switch may require recompiling all
17699 other modules in a program, including system libraries. Use this
17700 switch to conform to a non-default data model.
17701
17702 @item -mfix-and-continue
17703 @itemx -ffix-and-continue
17704 @itemx -findirect-data
17705 @opindex mfix-and-continue
17706 @opindex ffix-and-continue
17707 @opindex findirect-data
17708 Generate code suitable for fast turnaround development, such as to
17709 allow GDB to dynamically load @file{.o} files into already-running
17710 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17711 are provided for backwards compatibility.
17712
17713 @item -all_load
17714 @opindex all_load
17715 Loads all members of static archive libraries.
17716 See man ld(1) for more information.
17717
17718 @item -arch_errors_fatal
17719 @opindex arch_errors_fatal
17720 Cause the errors having to do with files that have the wrong architecture
17721 to be fatal.
17722
17723 @item -bind_at_load
17724 @opindex bind_at_load
17725 Causes the output file to be marked such that the dynamic linker will
17726 bind all undefined references when the file is loaded or launched.
17727
17728 @item -bundle
17729 @opindex bundle
17730 Produce a Mach-o bundle format file.
17731 See man ld(1) for more information.
17732
17733 @item -bundle_loader @var{executable}
17734 @opindex bundle_loader
17735 This option specifies the @var{executable} that will load the build
17736 output file being linked. See man ld(1) for more information.
17737
17738 @item -dynamiclib
17739 @opindex dynamiclib
17740 When passed this option, GCC produces a dynamic library instead of
17741 an executable when linking, using the Darwin @file{libtool} command.
17742
17743 @item -force_cpusubtype_ALL
17744 @opindex force_cpusubtype_ALL
17745 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17746 one controlled by the @option{-mcpu} or @option{-march} option.
17747
17748 @item -allowable_client @var{client_name}
17749 @itemx -client_name
17750 @itemx -compatibility_version
17751 @itemx -current_version
17752 @itemx -dead_strip
17753 @itemx -dependency-file
17754 @itemx -dylib_file
17755 @itemx -dylinker_install_name
17756 @itemx -dynamic
17757 @itemx -exported_symbols_list
17758 @itemx -filelist
17759 @need 800
17760 @itemx -flat_namespace
17761 @itemx -force_flat_namespace
17762 @itemx -headerpad_max_install_names
17763 @itemx -image_base
17764 @itemx -init
17765 @itemx -install_name
17766 @itemx -keep_private_externs
17767 @itemx -multi_module
17768 @itemx -multiply_defined
17769 @itemx -multiply_defined_unused
17770 @need 800
17771 @itemx -noall_load
17772 @itemx -no_dead_strip_inits_and_terms
17773 @itemx -nofixprebinding
17774 @itemx -nomultidefs
17775 @itemx -noprebind
17776 @itemx -noseglinkedit
17777 @itemx -pagezero_size
17778 @itemx -prebind
17779 @itemx -prebind_all_twolevel_modules
17780 @itemx -private_bundle
17781 @need 800
17782 @itemx -read_only_relocs
17783 @itemx -sectalign
17784 @itemx -sectobjectsymbols
17785 @itemx -whyload
17786 @itemx -seg1addr
17787 @itemx -sectcreate
17788 @itemx -sectobjectsymbols
17789 @itemx -sectorder
17790 @itemx -segaddr
17791 @itemx -segs_read_only_addr
17792 @need 800
17793 @itemx -segs_read_write_addr
17794 @itemx -seg_addr_table
17795 @itemx -seg_addr_table_filename
17796 @itemx -seglinkedit
17797 @itemx -segprot
17798 @itemx -segs_read_only_addr
17799 @itemx -segs_read_write_addr
17800 @itemx -single_module
17801 @itemx -static
17802 @itemx -sub_library
17803 @need 800
17804 @itemx -sub_umbrella
17805 @itemx -twolevel_namespace
17806 @itemx -umbrella
17807 @itemx -undefined
17808 @itemx -unexported_symbols_list
17809 @itemx -weak_reference_mismatches
17810 @itemx -whatsloaded
17811 @opindex allowable_client
17812 @opindex client_name
17813 @opindex compatibility_version
17814 @opindex current_version
17815 @opindex dead_strip
17816 @opindex dependency-file
17817 @opindex dylib_file
17818 @opindex dylinker_install_name
17819 @opindex dynamic
17820 @opindex exported_symbols_list
17821 @opindex filelist
17822 @opindex flat_namespace
17823 @opindex force_flat_namespace
17824 @opindex headerpad_max_install_names
17825 @opindex image_base
17826 @opindex init
17827 @opindex install_name
17828 @opindex keep_private_externs
17829 @opindex multi_module
17830 @opindex multiply_defined
17831 @opindex multiply_defined_unused
17832 @opindex noall_load
17833 @opindex no_dead_strip_inits_and_terms
17834 @opindex nofixprebinding
17835 @opindex nomultidefs
17836 @opindex noprebind
17837 @opindex noseglinkedit
17838 @opindex pagezero_size
17839 @opindex prebind
17840 @opindex prebind_all_twolevel_modules
17841 @opindex private_bundle
17842 @opindex read_only_relocs
17843 @opindex sectalign
17844 @opindex sectobjectsymbols
17845 @opindex whyload
17846 @opindex seg1addr
17847 @opindex sectcreate
17848 @opindex sectobjectsymbols
17849 @opindex sectorder
17850 @opindex segaddr
17851 @opindex segs_read_only_addr
17852 @opindex segs_read_write_addr
17853 @opindex seg_addr_table
17854 @opindex seg_addr_table_filename
17855 @opindex seglinkedit
17856 @opindex segprot
17857 @opindex segs_read_only_addr
17858 @opindex segs_read_write_addr
17859 @opindex single_module
17860 @opindex static
17861 @opindex sub_library
17862 @opindex sub_umbrella
17863 @opindex twolevel_namespace
17864 @opindex umbrella
17865 @opindex undefined
17866 @opindex unexported_symbols_list
17867 @opindex weak_reference_mismatches
17868 @opindex whatsloaded
17869 These options are passed to the Darwin linker. The Darwin linker man page
17870 describes them in detail.
17871 @end table
17872
17873 @node DEC Alpha Options
17874 @subsection DEC Alpha Options
17875
17876 These @samp{-m} options are defined for the DEC Alpha implementations:
17877
17878 @table @gcctabopt
17879 @item -mno-soft-float
17880 @itemx -msoft-float
17881 @opindex mno-soft-float
17882 @opindex msoft-float
17883 Use (do not use) the hardware floating-point instructions for
17884 floating-point operations. When @option{-msoft-float} is specified,
17885 functions in @file{libgcc.a} are used to perform floating-point
17886 operations. Unless they are replaced by routines that emulate the
17887 floating-point operations, or compiled in such a way as to call such
17888 emulations routines, these routines issue floating-point
17889 operations. If you are compiling for an Alpha without floating-point
17890 operations, you must ensure that the library is built so as not to call
17891 them.
17892
17893 Note that Alpha implementations without floating-point operations are
17894 required to have floating-point registers.
17895
17896 @item -mfp-reg
17897 @itemx -mno-fp-regs
17898 @opindex mfp-reg
17899 @opindex mno-fp-regs
17900 Generate code that uses (does not use) the floating-point register set.
17901 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
17902 register set is not used, floating-point operands are passed in integer
17903 registers as if they were integers and floating-point results are passed
17904 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
17905 so any function with a floating-point argument or return value called by code
17906 compiled with @option{-mno-fp-regs} must also be compiled with that
17907 option.
17908
17909 A typical use of this option is building a kernel that does not use,
17910 and hence need not save and restore, any floating-point registers.
17911
17912 @item -mieee
17913 @opindex mieee
17914 The Alpha architecture implements floating-point hardware optimized for
17915 maximum performance. It is mostly compliant with the IEEE floating-point
17916 standard. However, for full compliance, software assistance is
17917 required. This option generates code fully IEEE-compliant code
17918 @emph{except} that the @var{inexact-flag} is not maintained (see below).
17919 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
17920 defined during compilation. The resulting code is less efficient but is
17921 able to correctly support denormalized numbers and exceptional IEEE
17922 values such as not-a-number and plus/minus infinity. Other Alpha
17923 compilers call this option @option{-ieee_with_no_inexact}.
17924
17925 @item -mieee-with-inexact
17926 @opindex mieee-with-inexact
17927 This is like @option{-mieee} except the generated code also maintains
17928 the IEEE @var{inexact-flag}. Turning on this option causes the
17929 generated code to implement fully-compliant IEEE math. In addition to
17930 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
17931 macro. On some Alpha implementations the resulting code may execute
17932 significantly slower than the code generated by default. Since there is
17933 very little code that depends on the @var{inexact-flag}, you should
17934 normally not specify this option. Other Alpha compilers call this
17935 option @option{-ieee_with_inexact}.
17936
17937 @item -mfp-trap-mode=@var{trap-mode}
17938 @opindex mfp-trap-mode
17939 This option controls what floating-point related traps are enabled.
17940 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
17941 The trap mode can be set to one of four values:
17942
17943 @table @samp
17944 @item n
17945 This is the default (normal) setting. The only traps that are enabled
17946 are the ones that cannot be disabled in software (e.g., division by zero
17947 trap).
17948
17949 @item u
17950 In addition to the traps enabled by @samp{n}, underflow traps are enabled
17951 as well.
17952
17953 @item su
17954 Like @samp{u}, but the instructions are marked to be safe for software
17955 completion (see Alpha architecture manual for details).
17956
17957 @item sui
17958 Like @samp{su}, but inexact traps are enabled as well.
17959 @end table
17960
17961 @item -mfp-rounding-mode=@var{rounding-mode}
17962 @opindex mfp-rounding-mode
17963 Selects the IEEE rounding mode. Other Alpha compilers call this option
17964 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
17965 of:
17966
17967 @table @samp
17968 @item n
17969 Normal IEEE rounding mode. Floating-point numbers are rounded towards
17970 the nearest machine number or towards the even machine number in case
17971 of a tie.
17972
17973 @item m
17974 Round towards minus infinity.
17975
17976 @item c
17977 Chopped rounding mode. Floating-point numbers are rounded towards zero.
17978
17979 @item d
17980 Dynamic rounding mode. A field in the floating-point control register
17981 (@var{fpcr}, see Alpha architecture reference manual) controls the
17982 rounding mode in effect. The C library initializes this register for
17983 rounding towards plus infinity. Thus, unless your program modifies the
17984 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
17985 @end table
17986
17987 @item -mtrap-precision=@var{trap-precision}
17988 @opindex mtrap-precision
17989 In the Alpha architecture, floating-point traps are imprecise. This
17990 means without software assistance it is impossible to recover from a
17991 floating trap and program execution normally needs to be terminated.
17992 GCC can generate code that can assist operating system trap handlers
17993 in determining the exact location that caused a floating-point trap.
17994 Depending on the requirements of an application, different levels of
17995 precisions can be selected:
17996
17997 @table @samp
17998 @item p
17999 Program precision. This option is the default and means a trap handler
18000 can only identify which program caused a floating-point exception.
18001
18002 @item f
18003 Function precision. The trap handler can determine the function that
18004 caused a floating-point exception.
18005
18006 @item i
18007 Instruction precision. The trap handler can determine the exact
18008 instruction that caused a floating-point exception.
18009 @end table
18010
18011 Other Alpha compilers provide the equivalent options called
18012 @option{-scope_safe} and @option{-resumption_safe}.
18013
18014 @item -mieee-conformant
18015 @opindex mieee-conformant
18016 This option marks the generated code as IEEE conformant. You must not
18017 use this option unless you also specify @option{-mtrap-precision=i} and either
18018 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18019 is to emit the line @samp{.eflag 48} in the function prologue of the
18020 generated assembly file.
18021
18022 @item -mbuild-constants
18023 @opindex mbuild-constants
18024 Normally GCC examines a 32- or 64-bit integer constant to
18025 see if it can construct it from smaller constants in two or three
18026 instructions. If it cannot, it outputs the constant as a literal and
18027 generates code to load it from the data segment at run time.
18028
18029 Use this option to require GCC to construct @emph{all} integer constants
18030 using code, even if it takes more instructions (the maximum is six).
18031
18032 You typically use this option to build a shared library dynamic
18033 loader. Itself a shared library, it must relocate itself in memory
18034 before it can find the variables and constants in its own data segment.
18035
18036 @item -mbwx
18037 @itemx -mno-bwx
18038 @itemx -mcix
18039 @itemx -mno-cix
18040 @itemx -mfix
18041 @itemx -mno-fix
18042 @itemx -mmax
18043 @itemx -mno-max
18044 @opindex mbwx
18045 @opindex mno-bwx
18046 @opindex mcix
18047 @opindex mno-cix
18048 @opindex mfix
18049 @opindex mno-fix
18050 @opindex mmax
18051 @opindex mno-max
18052 Indicate whether GCC should generate code to use the optional BWX,
18053 CIX, FIX and MAX instruction sets. The default is to use the instruction
18054 sets supported by the CPU type specified via @option{-mcpu=} option or that
18055 of the CPU on which GCC was built if none is specified.
18056
18057 @item -mfloat-vax
18058 @itemx -mfloat-ieee
18059 @opindex mfloat-vax
18060 @opindex mfloat-ieee
18061 Generate code that uses (does not use) VAX F and G floating-point
18062 arithmetic instead of IEEE single and double precision.
18063
18064 @item -mexplicit-relocs
18065 @itemx -mno-explicit-relocs
18066 @opindex mexplicit-relocs
18067 @opindex mno-explicit-relocs
18068 Older Alpha assemblers provided no way to generate symbol relocations
18069 except via assembler macros. Use of these macros does not allow
18070 optimal instruction scheduling. GNU binutils as of version 2.12
18071 supports a new syntax that allows the compiler to explicitly mark
18072 which relocations should apply to which instructions. This option
18073 is mostly useful for debugging, as GCC detects the capabilities of
18074 the assembler when it is built and sets the default accordingly.
18075
18076 @item -msmall-data
18077 @itemx -mlarge-data
18078 @opindex msmall-data
18079 @opindex mlarge-data
18080 When @option{-mexplicit-relocs} is in effect, static data is
18081 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18082 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18083 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18084 16-bit relocations off of the @code{$gp} register. This limits the
18085 size of the small data area to 64KB, but allows the variables to be
18086 directly accessed via a single instruction.
18087
18088 The default is @option{-mlarge-data}. With this option the data area
18089 is limited to just below 2GB@. Programs that require more than 2GB of
18090 data must use @code{malloc} or @code{mmap} to allocate the data in the
18091 heap instead of in the program's data segment.
18092
18093 When generating code for shared libraries, @option{-fpic} implies
18094 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18095
18096 @item -msmall-text
18097 @itemx -mlarge-text
18098 @opindex msmall-text
18099 @opindex mlarge-text
18100 When @option{-msmall-text} is used, the compiler assumes that the
18101 code of the entire program (or shared library) fits in 4MB, and is
18102 thus reachable with a branch instruction. When @option{-msmall-data}
18103 is used, the compiler can assume that all local symbols share the
18104 same @code{$gp} value, and thus reduce the number of instructions
18105 required for a function call from 4 to 1.
18106
18107 The default is @option{-mlarge-text}.
18108
18109 @item -mcpu=@var{cpu_type}
18110 @opindex mcpu
18111 Set the instruction set and instruction scheduling parameters for
18112 machine type @var{cpu_type}. You can specify either the @samp{EV}
18113 style name or the corresponding chip number. GCC supports scheduling
18114 parameters for the EV4, EV5 and EV6 family of processors and
18115 chooses the default values for the instruction set from the processor
18116 you specify. If you do not specify a processor type, GCC defaults
18117 to the processor on which the compiler was built.
18118
18119 Supported values for @var{cpu_type} are
18120
18121 @table @samp
18122 @item ev4
18123 @itemx ev45
18124 @itemx 21064
18125 Schedules as an EV4 and has no instruction set extensions.
18126
18127 @item ev5
18128 @itemx 21164
18129 Schedules as an EV5 and has no instruction set extensions.
18130
18131 @item ev56
18132 @itemx 21164a
18133 Schedules as an EV5 and supports the BWX extension.
18134
18135 @item pca56
18136 @itemx 21164pc
18137 @itemx 21164PC
18138 Schedules as an EV5 and supports the BWX and MAX extensions.
18139
18140 @item ev6
18141 @itemx 21264
18142 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18143
18144 @item ev67
18145 @itemx 21264a
18146 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18147 @end table
18148
18149 Native toolchains also support the value @samp{native},
18150 which selects the best architecture option for the host processor.
18151 @option{-mcpu=native} has no effect if GCC does not recognize
18152 the processor.
18153
18154 @item -mtune=@var{cpu_type}
18155 @opindex mtune
18156 Set only the instruction scheduling parameters for machine type
18157 @var{cpu_type}. The instruction set is not changed.
18158
18159 Native toolchains also support the value @samp{native},
18160 which selects the best architecture option for the host processor.
18161 @option{-mtune=native} has no effect if GCC does not recognize
18162 the processor.
18163
18164 @item -mmemory-latency=@var{time}
18165 @opindex mmemory-latency
18166 Sets the latency the scheduler should assume for typical memory
18167 references as seen by the application. This number is highly
18168 dependent on the memory access patterns used by the application
18169 and the size of the external cache on the machine.
18170
18171 Valid options for @var{time} are
18172
18173 @table @samp
18174 @item @var{number}
18175 A decimal number representing clock cycles.
18176
18177 @item L1
18178 @itemx L2
18179 @itemx L3
18180 @itemx main
18181 The compiler contains estimates of the number of clock cycles for
18182 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18183 (also called Dcache, Scache, and Bcache), as well as to main memory.
18184 Note that L3 is only valid for EV5.
18185
18186 @end table
18187 @end table
18188
18189 @node FR30 Options
18190 @subsection FR30 Options
18191 @cindex FR30 Options
18192
18193 These options are defined specifically for the FR30 port.
18194
18195 @table @gcctabopt
18196
18197 @item -msmall-model
18198 @opindex msmall-model
18199 Use the small address space model. This can produce smaller code, but
18200 it does assume that all symbolic values and addresses fit into a
18201 20-bit range.
18202
18203 @item -mno-lsim
18204 @opindex mno-lsim
18205 Assume that runtime support has been provided and so there is no need
18206 to include the simulator library (@file{libsim.a}) on the linker
18207 command line.
18208
18209 @end table
18210
18211 @node FT32 Options
18212 @subsection FT32 Options
18213 @cindex FT32 Options
18214
18215 These options are defined specifically for the FT32 port.
18216
18217 @table @gcctabopt
18218
18219 @item -msim
18220 @opindex msim
18221 Specifies that the program will be run on the simulator. This causes
18222 an alternate runtime startup and library to be linked.
18223 You must not use this option when generating programs that will run on
18224 real hardware; you must provide your own runtime library for whatever
18225 I/O functions are needed.
18226
18227 @item -mlra
18228 @opindex mlra
18229 Enable Local Register Allocation. This is still experimental for FT32,
18230 so by default the compiler uses standard reload.
18231
18232 @item -mnodiv
18233 @opindex mnodiv
18234 Do not use div and mod instructions.
18235
18236 @item -mft32b
18237 @opindex mft32b
18238 Enable use of the extended instructions of the FT32B processor.
18239
18240 @item -mcompress
18241 @opindex mcompress
18242 Compress all code using the Ft32B code compression scheme.
18243
18244 @item -mnopm
18245 @opindex mnopm
18246 Do not generate code that reads program memory.
18247
18248 @end table
18249
18250 @node FRV Options
18251 @subsection FRV Options
18252 @cindex FRV Options
18253
18254 @table @gcctabopt
18255 @item -mgpr-32
18256 @opindex mgpr-32
18257
18258 Only use the first 32 general-purpose registers.
18259
18260 @item -mgpr-64
18261 @opindex mgpr-64
18262
18263 Use all 64 general-purpose registers.
18264
18265 @item -mfpr-32
18266 @opindex mfpr-32
18267
18268 Use only the first 32 floating-point registers.
18269
18270 @item -mfpr-64
18271 @opindex mfpr-64
18272
18273 Use all 64 floating-point registers.
18274
18275 @item -mhard-float
18276 @opindex mhard-float
18277
18278 Use hardware instructions for floating-point operations.
18279
18280 @item -msoft-float
18281 @opindex msoft-float
18282
18283 Use library routines for floating-point operations.
18284
18285 @item -malloc-cc
18286 @opindex malloc-cc
18287
18288 Dynamically allocate condition code registers.
18289
18290 @item -mfixed-cc
18291 @opindex mfixed-cc
18292
18293 Do not try to dynamically allocate condition code registers, only
18294 use @code{icc0} and @code{fcc0}.
18295
18296 @item -mdword
18297 @opindex mdword
18298
18299 Change ABI to use double word insns.
18300
18301 @item -mno-dword
18302 @opindex mno-dword
18303
18304 Do not use double word instructions.
18305
18306 @item -mdouble
18307 @opindex mdouble
18308
18309 Use floating-point double instructions.
18310
18311 @item -mno-double
18312 @opindex mno-double
18313
18314 Do not use floating-point double instructions.
18315
18316 @item -mmedia
18317 @opindex mmedia
18318
18319 Use media instructions.
18320
18321 @item -mno-media
18322 @opindex mno-media
18323
18324 Do not use media instructions.
18325
18326 @item -mmuladd
18327 @opindex mmuladd
18328
18329 Use multiply and add/subtract instructions.
18330
18331 @item -mno-muladd
18332 @opindex mno-muladd
18333
18334 Do not use multiply and add/subtract instructions.
18335
18336 @item -mfdpic
18337 @opindex mfdpic
18338
18339 Select the FDPIC ABI, which uses function descriptors to represent
18340 pointers to functions. Without any PIC/PIE-related options, it
18341 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18342 assumes GOT entries and small data are within a 12-bit range from the
18343 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18344 are computed with 32 bits.
18345 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18346
18347 @item -minline-plt
18348 @opindex minline-plt
18349
18350 Enable inlining of PLT entries in function calls to functions that are
18351 not known to bind locally. It has no effect without @option{-mfdpic}.
18352 It's enabled by default if optimizing for speed and compiling for
18353 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18354 optimization option such as @option{-O3} or above is present in the
18355 command line.
18356
18357 @item -mTLS
18358 @opindex mTLS
18359
18360 Assume a large TLS segment when generating thread-local code.
18361
18362 @item -mtls
18363 @opindex mtls
18364
18365 Do not assume a large TLS segment when generating thread-local code.
18366
18367 @item -mgprel-ro
18368 @opindex mgprel-ro
18369
18370 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18371 that is known to be in read-only sections. It's enabled by default,
18372 except for @option{-fpic} or @option{-fpie}: even though it may help
18373 make the global offset table smaller, it trades 1 instruction for 4.
18374 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18375 one of which may be shared by multiple symbols, and it avoids the need
18376 for a GOT entry for the referenced symbol, so it's more likely to be a
18377 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18378
18379 @item -multilib-library-pic
18380 @opindex multilib-library-pic
18381
18382 Link with the (library, not FD) pic libraries. It's implied by
18383 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18384 @option{-fpic} without @option{-mfdpic}. You should never have to use
18385 it explicitly.
18386
18387 @item -mlinked-fp
18388 @opindex mlinked-fp
18389
18390 Follow the EABI requirement of always creating a frame pointer whenever
18391 a stack frame is allocated. This option is enabled by default and can
18392 be disabled with @option{-mno-linked-fp}.
18393
18394 @item -mlong-calls
18395 @opindex mlong-calls
18396
18397 Use indirect addressing to call functions outside the current
18398 compilation unit. This allows the functions to be placed anywhere
18399 within the 32-bit address space.
18400
18401 @item -malign-labels
18402 @opindex malign-labels
18403
18404 Try to align labels to an 8-byte boundary by inserting NOPs into the
18405 previous packet. This option only has an effect when VLIW packing
18406 is enabled. It doesn't create new packets; it merely adds NOPs to
18407 existing ones.
18408
18409 @item -mlibrary-pic
18410 @opindex mlibrary-pic
18411
18412 Generate position-independent EABI code.
18413
18414 @item -macc-4
18415 @opindex macc-4
18416
18417 Use only the first four media accumulator registers.
18418
18419 @item -macc-8
18420 @opindex macc-8
18421
18422 Use all eight media accumulator registers.
18423
18424 @item -mpack
18425 @opindex mpack
18426
18427 Pack VLIW instructions.
18428
18429 @item -mno-pack
18430 @opindex mno-pack
18431
18432 Do not pack VLIW instructions.
18433
18434 @item -mno-eflags
18435 @opindex mno-eflags
18436
18437 Do not mark ABI switches in e_flags.
18438
18439 @item -mcond-move
18440 @opindex mcond-move
18441
18442 Enable the use of conditional-move instructions (default).
18443
18444 This switch is mainly for debugging the compiler and will likely be removed
18445 in a future version.
18446
18447 @item -mno-cond-move
18448 @opindex mno-cond-move
18449
18450 Disable the use of conditional-move instructions.
18451
18452 This switch is mainly for debugging the compiler and will likely be removed
18453 in a future version.
18454
18455 @item -mscc
18456 @opindex mscc
18457
18458 Enable the use of conditional set instructions (default).
18459
18460 This switch is mainly for debugging the compiler and will likely be removed
18461 in a future version.
18462
18463 @item -mno-scc
18464 @opindex mno-scc
18465
18466 Disable the use of conditional set instructions.
18467
18468 This switch is mainly for debugging the compiler and will likely be removed
18469 in a future version.
18470
18471 @item -mcond-exec
18472 @opindex mcond-exec
18473
18474 Enable the use of conditional execution (default).
18475
18476 This switch is mainly for debugging the compiler and will likely be removed
18477 in a future version.
18478
18479 @item -mno-cond-exec
18480 @opindex mno-cond-exec
18481
18482 Disable the use of conditional execution.
18483
18484 This switch is mainly for debugging the compiler and will likely be removed
18485 in a future version.
18486
18487 @item -mvliw-branch
18488 @opindex mvliw-branch
18489
18490 Run a pass to pack branches into VLIW instructions (default).
18491
18492 This switch is mainly for debugging the compiler and will likely be removed
18493 in a future version.
18494
18495 @item -mno-vliw-branch
18496 @opindex mno-vliw-branch
18497
18498 Do not run a pass to pack branches into VLIW instructions.
18499
18500 This switch is mainly for debugging the compiler and will likely be removed
18501 in a future version.
18502
18503 @item -mmulti-cond-exec
18504 @opindex mmulti-cond-exec
18505
18506 Enable optimization of @code{&&} and @code{||} in conditional execution
18507 (default).
18508
18509 This switch is mainly for debugging the compiler and will likely be removed
18510 in a future version.
18511
18512 @item -mno-multi-cond-exec
18513 @opindex mno-multi-cond-exec
18514
18515 Disable optimization of @code{&&} and @code{||} in conditional execution.
18516
18517 This switch is mainly for debugging the compiler and will likely be removed
18518 in a future version.
18519
18520 @item -mnested-cond-exec
18521 @opindex mnested-cond-exec
18522
18523 Enable nested conditional execution optimizations (default).
18524
18525 This switch is mainly for debugging the compiler and will likely be removed
18526 in a future version.
18527
18528 @item -mno-nested-cond-exec
18529 @opindex mno-nested-cond-exec
18530
18531 Disable nested conditional execution optimizations.
18532
18533 This switch is mainly for debugging the compiler and will likely be removed
18534 in a future version.
18535
18536 @item -moptimize-membar
18537 @opindex moptimize-membar
18538
18539 This switch removes redundant @code{membar} instructions from the
18540 compiler-generated code. It is enabled by default.
18541
18542 @item -mno-optimize-membar
18543 @opindex mno-optimize-membar
18544
18545 This switch disables the automatic removal of redundant @code{membar}
18546 instructions from the generated code.
18547
18548 @item -mtomcat-stats
18549 @opindex mtomcat-stats
18550
18551 Cause gas to print out tomcat statistics.
18552
18553 @item -mcpu=@var{cpu}
18554 @opindex mcpu
18555
18556 Select the processor type for which to generate code. Possible values are
18557 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
18558 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
18559
18560 @end table
18561
18562 @node GNU/Linux Options
18563 @subsection GNU/Linux Options
18564
18565 These @samp{-m} options are defined for GNU/Linux targets:
18566
18567 @table @gcctabopt
18568 @item -mglibc
18569 @opindex mglibc
18570 Use the GNU C library. This is the default except
18571 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
18572 @samp{*-*-linux-*android*} targets.
18573
18574 @item -muclibc
18575 @opindex muclibc
18576 Use uClibc C library. This is the default on
18577 @samp{*-*-linux-*uclibc*} targets.
18578
18579 @item -mmusl
18580 @opindex mmusl
18581 Use the musl C library. This is the default on
18582 @samp{*-*-linux-*musl*} targets.
18583
18584 @item -mbionic
18585 @opindex mbionic
18586 Use Bionic C library. This is the default on
18587 @samp{*-*-linux-*android*} targets.
18588
18589 @item -mandroid
18590 @opindex mandroid
18591 Compile code compatible with Android platform. This is the default on
18592 @samp{*-*-linux-*android*} targets.
18593
18594 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
18595 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
18596 this option makes the GCC driver pass Android-specific options to the linker.
18597 Finally, this option causes the preprocessor macro @code{__ANDROID__}
18598 to be defined.
18599
18600 @item -tno-android-cc
18601 @opindex tno-android-cc
18602 Disable compilation effects of @option{-mandroid}, i.e., do not enable
18603 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
18604 @option{-fno-rtti} by default.
18605
18606 @item -tno-android-ld
18607 @opindex tno-android-ld
18608 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
18609 linking options to the linker.
18610
18611 @end table
18612
18613 @node H8/300 Options
18614 @subsection H8/300 Options
18615
18616 These @samp{-m} options are defined for the H8/300 implementations:
18617
18618 @table @gcctabopt
18619 @item -mrelax
18620 @opindex mrelax
18621 Shorten some address references at link time, when possible; uses the
18622 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18623 ld, Using ld}, for a fuller description.
18624
18625 @item -mh
18626 @opindex mh
18627 Generate code for the H8/300H@.
18628
18629 @item -ms
18630 @opindex ms
18631 Generate code for the H8S@.
18632
18633 @item -mn
18634 @opindex mn
18635 Generate code for the H8S and H8/300H in the normal mode. This switch
18636 must be used either with @option{-mh} or @option{-ms}.
18637
18638 @item -ms2600
18639 @opindex ms2600
18640 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18641
18642 @item -mexr
18643 @opindex mexr
18644 Extended registers are stored on stack before execution of function
18645 with monitor attribute. Default option is @option{-mexr}.
18646 This option is valid only for H8S targets.
18647
18648 @item -mno-exr
18649 @opindex mno-exr
18650 Extended registers are not stored on stack before execution of function
18651 with monitor attribute. Default option is @option{-mno-exr}.
18652 This option is valid only for H8S targets.
18653
18654 @item -mint32
18655 @opindex mint32
18656 Make @code{int} data 32 bits by default.
18657
18658 @item -malign-300
18659 @opindex malign-300
18660 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18661 The default for the H8/300H and H8S is to align longs and floats on
18662 4-byte boundaries.
18663 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18664 This option has no effect on the H8/300.
18665 @end table
18666
18667 @node HPPA Options
18668 @subsection HPPA Options
18669 @cindex HPPA Options
18670
18671 These @samp{-m} options are defined for the HPPA family of computers:
18672
18673 @table @gcctabopt
18674 @item -march=@var{architecture-type}
18675 @opindex march
18676 Generate code for the specified architecture. The choices for
18677 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18678 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18679 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18680 architecture option for your machine. Code compiled for lower numbered
18681 architectures runs on higher numbered architectures, but not the
18682 other way around.
18683
18684 @item -mpa-risc-1-0
18685 @itemx -mpa-risc-1-1
18686 @itemx -mpa-risc-2-0
18687 @opindex mpa-risc-1-0
18688 @opindex mpa-risc-1-1
18689 @opindex mpa-risc-2-0
18690 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18691
18692 @item -mcaller-copies
18693 @opindex mcaller-copies
18694 The caller copies function arguments passed by hidden reference. This
18695 option should be used with care as it is not compatible with the default
18696 32-bit runtime. However, only aggregates larger than eight bytes are
18697 passed by hidden reference and the option provides better compatibility
18698 with OpenMP.
18699
18700 @item -mjump-in-delay
18701 @opindex mjump-in-delay
18702 This option is ignored and provided for compatibility purposes only.
18703
18704 @item -mdisable-fpregs
18705 @opindex mdisable-fpregs
18706 Prevent floating-point registers from being used in any manner. This is
18707 necessary for compiling kernels that perform lazy context switching of
18708 floating-point registers. If you use this option and attempt to perform
18709 floating-point operations, the compiler aborts.
18710
18711 @item -mdisable-indexing
18712 @opindex mdisable-indexing
18713 Prevent the compiler from using indexing address modes. This avoids some
18714 rather obscure problems when compiling MIG generated code under MACH@.
18715
18716 @item -mno-space-regs
18717 @opindex mno-space-regs
18718 Generate code that assumes the target has no space registers. This allows
18719 GCC to generate faster indirect calls and use unscaled index address modes.
18720
18721 Such code is suitable for level 0 PA systems and kernels.
18722
18723 @item -mfast-indirect-calls
18724 @opindex mfast-indirect-calls
18725 Generate code that assumes calls never cross space boundaries. This
18726 allows GCC to emit code that performs faster indirect calls.
18727
18728 This option does not work in the presence of shared libraries or nested
18729 functions.
18730
18731 @item -mfixed-range=@var{register-range}
18732 @opindex mfixed-range
18733 Generate code treating the given register range as fixed registers.
18734 A fixed register is one that the register allocator cannot use. This is
18735 useful when compiling kernel code. A register range is specified as
18736 two registers separated by a dash. Multiple register ranges can be
18737 specified separated by a comma.
18738
18739 @item -mlong-load-store
18740 @opindex mlong-load-store
18741 Generate 3-instruction load and store sequences as sometimes required by
18742 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18743 the HP compilers.
18744
18745 @item -mportable-runtime
18746 @opindex mportable-runtime
18747 Use the portable calling conventions proposed by HP for ELF systems.
18748
18749 @item -mgas
18750 @opindex mgas
18751 Enable the use of assembler directives only GAS understands.
18752
18753 @item -mschedule=@var{cpu-type}
18754 @opindex mschedule
18755 Schedule code according to the constraints for the machine type
18756 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18757 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18758 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18759 proper scheduling option for your machine. The default scheduling is
18760 @samp{8000}.
18761
18762 @item -mlinker-opt
18763 @opindex mlinker-opt
18764 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18765 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18766 linkers in which they give bogus error messages when linking some programs.
18767
18768 @item -msoft-float
18769 @opindex msoft-float
18770 Generate output containing library calls for floating point.
18771 @strong{Warning:} the requisite libraries are not available for all HPPA
18772 targets. Normally the facilities of the machine's usual C compiler are
18773 used, but this cannot be done directly in cross-compilation. You must make
18774 your own arrangements to provide suitable library functions for
18775 cross-compilation.
18776
18777 @option{-msoft-float} changes the calling convention in the output file;
18778 therefore, it is only useful if you compile @emph{all} of a program with
18779 this option. In particular, you need to compile @file{libgcc.a}, the
18780 library that comes with GCC, with @option{-msoft-float} in order for
18781 this to work.
18782
18783 @item -msio
18784 @opindex msio
18785 Generate the predefine, @code{_SIO}, for server IO@. The default is
18786 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18787 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18788 options are available under HP-UX and HI-UX@.
18789
18790 @item -mgnu-ld
18791 @opindex mgnu-ld
18792 Use options specific to GNU @command{ld}.
18793 This passes @option{-shared} to @command{ld} when
18794 building a shared library. It is the default when GCC is configured,
18795 explicitly or implicitly, with the GNU linker. This option does not
18796 affect which @command{ld} is called; it only changes what parameters
18797 are passed to that @command{ld}.
18798 The @command{ld} that is called is determined by the
18799 @option{--with-ld} configure option, GCC's program search path, and
18800 finally by the user's @env{PATH}. The linker used by GCC can be printed
18801 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18802 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18803
18804 @item -mhp-ld
18805 @opindex mhp-ld
18806 Use options specific to HP @command{ld}.
18807 This passes @option{-b} to @command{ld} when building
18808 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18809 links. It is the default when GCC is configured, explicitly or
18810 implicitly, with the HP linker. This option does not affect
18811 which @command{ld} is called; it only changes what parameters are passed to that
18812 @command{ld}.
18813 The @command{ld} that is called is determined by the @option{--with-ld}
18814 configure option, GCC's program search path, and finally by the user's
18815 @env{PATH}. The linker used by GCC can be printed using @samp{which
18816 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18817 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18818
18819 @item -mlong-calls
18820 @opindex mno-long-calls
18821 Generate code that uses long call sequences. This ensures that a call
18822 is always able to reach linker generated stubs. The default is to generate
18823 long calls only when the distance from the call site to the beginning
18824 of the function or translation unit, as the case may be, exceeds a
18825 predefined limit set by the branch type being used. The limits for
18826 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18827 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18828 240,000 bytes.
18829
18830 Distances are measured from the beginning of functions when using the
18831 @option{-ffunction-sections} option, or when using the @option{-mgas}
18832 and @option{-mno-portable-runtime} options together under HP-UX with
18833 the SOM linker.
18834
18835 It is normally not desirable to use this option as it degrades
18836 performance. However, it may be useful in large applications,
18837 particularly when partial linking is used to build the application.
18838
18839 The types of long calls used depends on the capabilities of the
18840 assembler and linker, and the type of code being generated. The
18841 impact on systems that support long absolute calls, and long pic
18842 symbol-difference or pc-relative calls should be relatively small.
18843 However, an indirect call is used on 32-bit ELF systems in pic code
18844 and it is quite long.
18845
18846 @item -munix=@var{unix-std}
18847 @opindex march
18848 Generate compiler predefines and select a startfile for the specified
18849 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18850 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18851 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18852 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18853 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18854 and later.
18855
18856 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18857 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18858 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18859 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18860 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18861 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18862
18863 It is @emph{important} to note that this option changes the interfaces
18864 for various library routines. It also affects the operational behavior
18865 of the C library. Thus, @emph{extreme} care is needed in using this
18866 option.
18867
18868 Library code that is intended to operate with more than one UNIX
18869 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18870 as appropriate. Most GNU software doesn't provide this capability.
18871
18872 @item -nolibdld
18873 @opindex nolibdld
18874 Suppress the generation of link options to search libdld.sl when the
18875 @option{-static} option is specified on HP-UX 10 and later.
18876
18877 @item -static
18878 @opindex static
18879 The HP-UX implementation of setlocale in libc has a dependency on
18880 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18881 when the @option{-static} option is specified, special link options
18882 are needed to resolve this dependency.
18883
18884 On HP-UX 10 and later, the GCC driver adds the necessary options to
18885 link with libdld.sl when the @option{-static} option is specified.
18886 This causes the resulting binary to be dynamic. On the 64-bit port,
18887 the linkers generate dynamic binaries by default in any case. The
18888 @option{-nolibdld} option can be used to prevent the GCC driver from
18889 adding these link options.
18890
18891 @item -threads
18892 @opindex threads
18893 Add support for multithreading with the @dfn{dce thread} library
18894 under HP-UX@. This option sets flags for both the preprocessor and
18895 linker.
18896 @end table
18897
18898 @node IA-64 Options
18899 @subsection IA-64 Options
18900 @cindex IA-64 Options
18901
18902 These are the @samp{-m} options defined for the Intel IA-64 architecture.
18903
18904 @table @gcctabopt
18905 @item -mbig-endian
18906 @opindex mbig-endian
18907 Generate code for a big-endian target. This is the default for HP-UX@.
18908
18909 @item -mlittle-endian
18910 @opindex mlittle-endian
18911 Generate code for a little-endian target. This is the default for AIX5
18912 and GNU/Linux.
18913
18914 @item -mgnu-as
18915 @itemx -mno-gnu-as
18916 @opindex mgnu-as
18917 @opindex mno-gnu-as
18918 Generate (or don't) code for the GNU assembler. This is the default.
18919 @c Also, this is the default if the configure option @option{--with-gnu-as}
18920 @c is used.
18921
18922 @item -mgnu-ld
18923 @itemx -mno-gnu-ld
18924 @opindex mgnu-ld
18925 @opindex mno-gnu-ld
18926 Generate (or don't) code for the GNU linker. This is the default.
18927 @c Also, this is the default if the configure option @option{--with-gnu-ld}
18928 @c is used.
18929
18930 @item -mno-pic
18931 @opindex mno-pic
18932 Generate code that does not use a global pointer register. The result
18933 is not position independent code, and violates the IA-64 ABI@.
18934
18935 @item -mvolatile-asm-stop
18936 @itemx -mno-volatile-asm-stop
18937 @opindex mvolatile-asm-stop
18938 @opindex mno-volatile-asm-stop
18939 Generate (or don't) a stop bit immediately before and after volatile asm
18940 statements.
18941
18942 @item -mregister-names
18943 @itemx -mno-register-names
18944 @opindex mregister-names
18945 @opindex mno-register-names
18946 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18947 the stacked registers. This may make assembler output more readable.
18948
18949 @item -mno-sdata
18950 @itemx -msdata
18951 @opindex mno-sdata
18952 @opindex msdata
18953 Disable (or enable) optimizations that use the small data section. This may
18954 be useful for working around optimizer bugs.
18955
18956 @item -mconstant-gp
18957 @opindex mconstant-gp
18958 Generate code that uses a single constant global pointer value. This is
18959 useful when compiling kernel code.
18960
18961 @item -mauto-pic
18962 @opindex mauto-pic
18963 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18964 This is useful when compiling firmware code.
18965
18966 @item -minline-float-divide-min-latency
18967 @opindex minline-float-divide-min-latency
18968 Generate code for inline divides of floating-point values
18969 using the minimum latency algorithm.
18970
18971 @item -minline-float-divide-max-throughput
18972 @opindex minline-float-divide-max-throughput
18973 Generate code for inline divides of floating-point values
18974 using the maximum throughput algorithm.
18975
18976 @item -mno-inline-float-divide
18977 @opindex mno-inline-float-divide
18978 Do not generate inline code for divides of floating-point values.
18979
18980 @item -minline-int-divide-min-latency
18981 @opindex minline-int-divide-min-latency
18982 Generate code for inline divides of integer values
18983 using the minimum latency algorithm.
18984
18985 @item -minline-int-divide-max-throughput
18986 @opindex minline-int-divide-max-throughput
18987 Generate code for inline divides of integer values
18988 using the maximum throughput algorithm.
18989
18990 @item -mno-inline-int-divide
18991 @opindex mno-inline-int-divide
18992 Do not generate inline code for divides of integer values.
18993
18994 @item -minline-sqrt-min-latency
18995 @opindex minline-sqrt-min-latency
18996 Generate code for inline square roots
18997 using the minimum latency algorithm.
18998
18999 @item -minline-sqrt-max-throughput
19000 @opindex minline-sqrt-max-throughput
19001 Generate code for inline square roots
19002 using the maximum throughput algorithm.
19003
19004 @item -mno-inline-sqrt
19005 @opindex mno-inline-sqrt
19006 Do not generate inline code for @code{sqrt}.
19007
19008 @item -mfused-madd
19009 @itemx -mno-fused-madd
19010 @opindex mfused-madd
19011 @opindex mno-fused-madd
19012 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19013 instructions. The default is to use these instructions.
19014
19015 @item -mno-dwarf2-asm
19016 @itemx -mdwarf2-asm
19017 @opindex mno-dwarf2-asm
19018 @opindex mdwarf2-asm
19019 Don't (or do) generate assembler code for the DWARF line number debugging
19020 info. This may be useful when not using the GNU assembler.
19021
19022 @item -mearly-stop-bits
19023 @itemx -mno-early-stop-bits
19024 @opindex mearly-stop-bits
19025 @opindex mno-early-stop-bits
19026 Allow stop bits to be placed earlier than immediately preceding the
19027 instruction that triggered the stop bit. This can improve instruction
19028 scheduling, but does not always do so.
19029
19030 @item -mfixed-range=@var{register-range}
19031 @opindex mfixed-range
19032 Generate code treating the given register range as fixed registers.
19033 A fixed register is one that the register allocator cannot use. This is
19034 useful when compiling kernel code. A register range is specified as
19035 two registers separated by a dash. Multiple register ranges can be
19036 specified separated by a comma.
19037
19038 @item -mtls-size=@var{tls-size}
19039 @opindex mtls-size
19040 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19041 64.
19042
19043 @item -mtune=@var{cpu-type}
19044 @opindex mtune
19045 Tune the instruction scheduling for a particular CPU, Valid values are
19046 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19047 and @samp{mckinley}.
19048
19049 @item -milp32
19050 @itemx -mlp64
19051 @opindex milp32
19052 @opindex mlp64
19053 Generate code for a 32-bit or 64-bit environment.
19054 The 32-bit environment sets int, long and pointer to 32 bits.
19055 The 64-bit environment sets int to 32 bits and long and pointer
19056 to 64 bits. These are HP-UX specific flags.
19057
19058 @item -mno-sched-br-data-spec
19059 @itemx -msched-br-data-spec
19060 @opindex mno-sched-br-data-spec
19061 @opindex msched-br-data-spec
19062 (Dis/En)able data speculative scheduling before reload.
19063 This results in generation of @code{ld.a} instructions and
19064 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19065 The default setting is disabled.
19066
19067 @item -msched-ar-data-spec
19068 @itemx -mno-sched-ar-data-spec
19069 @opindex msched-ar-data-spec
19070 @opindex mno-sched-ar-data-spec
19071 (En/Dis)able data speculative scheduling after reload.
19072 This results in generation of @code{ld.a} instructions and
19073 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19074 The default setting is enabled.
19075
19076 @item -mno-sched-control-spec
19077 @itemx -msched-control-spec
19078 @opindex mno-sched-control-spec
19079 @opindex msched-control-spec
19080 (Dis/En)able control speculative scheduling. This feature is
19081 available only during region scheduling (i.e.@: before reload).
19082 This results in generation of the @code{ld.s} instructions and
19083 the corresponding check instructions @code{chk.s}.
19084 The default setting is disabled.
19085
19086 @item -msched-br-in-data-spec
19087 @itemx -mno-sched-br-in-data-spec
19088 @opindex msched-br-in-data-spec
19089 @opindex mno-sched-br-in-data-spec
19090 (En/Dis)able speculative scheduling of the instructions that
19091 are dependent on the data speculative loads before reload.
19092 This is effective only with @option{-msched-br-data-spec} enabled.
19093 The default setting is enabled.
19094
19095 @item -msched-ar-in-data-spec
19096 @itemx -mno-sched-ar-in-data-spec
19097 @opindex msched-ar-in-data-spec
19098 @opindex mno-sched-ar-in-data-spec
19099 (En/Dis)able speculative scheduling of the instructions that
19100 are dependent on the data speculative loads after reload.
19101 This is effective only with @option{-msched-ar-data-spec} enabled.
19102 The default setting is enabled.
19103
19104 @item -msched-in-control-spec
19105 @itemx -mno-sched-in-control-spec
19106 @opindex msched-in-control-spec
19107 @opindex mno-sched-in-control-spec
19108 (En/Dis)able speculative scheduling of the instructions that
19109 are dependent on the control speculative loads.
19110 This is effective only with @option{-msched-control-spec} enabled.
19111 The default setting is enabled.
19112
19113 @item -mno-sched-prefer-non-data-spec-insns
19114 @itemx -msched-prefer-non-data-spec-insns
19115 @opindex mno-sched-prefer-non-data-spec-insns
19116 @opindex msched-prefer-non-data-spec-insns
19117 If enabled, data-speculative instructions are chosen for schedule
19118 only if there are no other choices at the moment. This makes
19119 the use of the data speculation much more conservative.
19120 The default setting is disabled.
19121
19122 @item -mno-sched-prefer-non-control-spec-insns
19123 @itemx -msched-prefer-non-control-spec-insns
19124 @opindex mno-sched-prefer-non-control-spec-insns
19125 @opindex msched-prefer-non-control-spec-insns
19126 If enabled, control-speculative instructions are chosen for schedule
19127 only if there are no other choices at the moment. This makes
19128 the use of the control speculation much more conservative.
19129 The default setting is disabled.
19130
19131 @item -mno-sched-count-spec-in-critical-path
19132 @itemx -msched-count-spec-in-critical-path
19133 @opindex mno-sched-count-spec-in-critical-path
19134 @opindex msched-count-spec-in-critical-path
19135 If enabled, speculative dependencies are considered during
19136 computation of the instructions priorities. This makes the use of the
19137 speculation a bit more conservative.
19138 The default setting is disabled.
19139
19140 @item -msched-spec-ldc
19141 @opindex msched-spec-ldc
19142 Use a simple data speculation check. This option is on by default.
19143
19144 @item -msched-control-spec-ldc
19145 @opindex msched-spec-ldc
19146 Use a simple check for control speculation. This option is on by default.
19147
19148 @item -msched-stop-bits-after-every-cycle
19149 @opindex msched-stop-bits-after-every-cycle
19150 Place a stop bit after every cycle when scheduling. This option is on
19151 by default.
19152
19153 @item -msched-fp-mem-deps-zero-cost
19154 @opindex msched-fp-mem-deps-zero-cost
19155 Assume that floating-point stores and loads are not likely to cause a conflict
19156 when placed into the same instruction group. This option is disabled by
19157 default.
19158
19159 @item -msel-sched-dont-check-control-spec
19160 @opindex msel-sched-dont-check-control-spec
19161 Generate checks for control speculation in selective scheduling.
19162 This flag is disabled by default.
19163
19164 @item -msched-max-memory-insns=@var{max-insns}
19165 @opindex msched-max-memory-insns
19166 Limit on the number of memory insns per instruction group, giving lower
19167 priority to subsequent memory insns attempting to schedule in the same
19168 instruction group. Frequently useful to prevent cache bank conflicts.
19169 The default value is 1.
19170
19171 @item -msched-max-memory-insns-hard-limit
19172 @opindex msched-max-memory-insns-hard-limit
19173 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19174 disallowing more than that number in an instruction group.
19175 Otherwise, the limit is ``soft'', meaning that non-memory operations
19176 are preferred when the limit is reached, but memory operations may still
19177 be scheduled.
19178
19179 @end table
19180
19181 @node LM32 Options
19182 @subsection LM32 Options
19183 @cindex LM32 options
19184
19185 These @option{-m} options are defined for the LatticeMico32 architecture:
19186
19187 @table @gcctabopt
19188 @item -mbarrel-shift-enabled
19189 @opindex mbarrel-shift-enabled
19190 Enable barrel-shift instructions.
19191
19192 @item -mdivide-enabled
19193 @opindex mdivide-enabled
19194 Enable divide and modulus instructions.
19195
19196 @item -mmultiply-enabled
19197 @opindex multiply-enabled
19198 Enable multiply instructions.
19199
19200 @item -msign-extend-enabled
19201 @opindex msign-extend-enabled
19202 Enable sign extend instructions.
19203
19204 @item -muser-enabled
19205 @opindex muser-enabled
19206 Enable user-defined instructions.
19207
19208 @end table
19209
19210 @node M32C Options
19211 @subsection M32C Options
19212 @cindex M32C options
19213
19214 @table @gcctabopt
19215 @item -mcpu=@var{name}
19216 @opindex mcpu=
19217 Select the CPU for which code is generated. @var{name} may be one of
19218 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19219 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19220 the M32C/80 series.
19221
19222 @item -msim
19223 @opindex msim
19224 Specifies that the program will be run on the simulator. This causes
19225 an alternate runtime library to be linked in which supports, for
19226 example, file I/O@. You must not use this option when generating
19227 programs that will run on real hardware; you must provide your own
19228 runtime library for whatever I/O functions are needed.
19229
19230 @item -memregs=@var{number}
19231 @opindex memregs=
19232 Specifies the number of memory-based pseudo-registers GCC uses
19233 during code generation. These pseudo-registers are used like real
19234 registers, so there is a tradeoff between GCC's ability to fit the
19235 code into available registers, and the performance penalty of using
19236 memory instead of registers. Note that all modules in a program must
19237 be compiled with the same value for this option. Because of that, you
19238 must not use this option with GCC's default runtime libraries.
19239
19240 @end table
19241
19242 @node M32R/D Options
19243 @subsection M32R/D Options
19244 @cindex M32R/D options
19245
19246 These @option{-m} options are defined for Renesas M32R/D architectures:
19247
19248 @table @gcctabopt
19249 @item -m32r2
19250 @opindex m32r2
19251 Generate code for the M32R/2@.
19252
19253 @item -m32rx
19254 @opindex m32rx
19255 Generate code for the M32R/X@.
19256
19257 @item -m32r
19258 @opindex m32r
19259 Generate code for the M32R@. This is the default.
19260
19261 @item -mmodel=small
19262 @opindex mmodel=small
19263 Assume all objects live in the lower 16MB of memory (so that their addresses
19264 can be loaded with the @code{ld24} instruction), and assume all subroutines
19265 are reachable with the @code{bl} instruction.
19266 This is the default.
19267
19268 The addressability of a particular object can be set with the
19269 @code{model} attribute.
19270
19271 @item -mmodel=medium
19272 @opindex mmodel=medium
19273 Assume objects may be anywhere in the 32-bit address space (the compiler
19274 generates @code{seth/add3} instructions to load their addresses), and
19275 assume all subroutines are reachable with the @code{bl} instruction.
19276
19277 @item -mmodel=large
19278 @opindex mmodel=large
19279 Assume objects may be anywhere in the 32-bit address space (the compiler
19280 generates @code{seth/add3} instructions to load their addresses), and
19281 assume subroutines may not be reachable with the @code{bl} instruction
19282 (the compiler generates the much slower @code{seth/add3/jl}
19283 instruction sequence).
19284
19285 @item -msdata=none
19286 @opindex msdata=none
19287 Disable use of the small data area. Variables are put into
19288 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19289 @code{section} attribute has been specified).
19290 This is the default.
19291
19292 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19293 Objects may be explicitly put in the small data area with the
19294 @code{section} attribute using one of these sections.
19295
19296 @item -msdata=sdata
19297 @opindex msdata=sdata
19298 Put small global and static data in the small data area, but do not
19299 generate special code to reference them.
19300
19301 @item -msdata=use
19302 @opindex msdata=use
19303 Put small global and static data in the small data area, and generate
19304 special instructions to reference them.
19305
19306 @item -G @var{num}
19307 @opindex G
19308 @cindex smaller data references
19309 Put global and static objects less than or equal to @var{num} bytes
19310 into the small data or BSS sections instead of the normal data or BSS
19311 sections. The default value of @var{num} is 8.
19312 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19313 for this option to have any effect.
19314
19315 All modules should be compiled with the same @option{-G @var{num}} value.
19316 Compiling with different values of @var{num} may or may not work; if it
19317 doesn't the linker gives an error message---incorrect code is not
19318 generated.
19319
19320 @item -mdebug
19321 @opindex mdebug
19322 Makes the M32R-specific code in the compiler display some statistics
19323 that might help in debugging programs.
19324
19325 @item -malign-loops
19326 @opindex malign-loops
19327 Align all loops to a 32-byte boundary.
19328
19329 @item -mno-align-loops
19330 @opindex mno-align-loops
19331 Do not enforce a 32-byte alignment for loops. This is the default.
19332
19333 @item -missue-rate=@var{number}
19334 @opindex missue-rate=@var{number}
19335 Issue @var{number} instructions per cycle. @var{number} can only be 1
19336 or 2.
19337
19338 @item -mbranch-cost=@var{number}
19339 @opindex mbranch-cost=@var{number}
19340 @var{number} can only be 1 or 2. If it is 1 then branches are
19341 preferred over conditional code, if it is 2, then the opposite applies.
19342
19343 @item -mflush-trap=@var{number}
19344 @opindex mflush-trap=@var{number}
19345 Specifies the trap number to use to flush the cache. The default is
19346 12. Valid numbers are between 0 and 15 inclusive.
19347
19348 @item -mno-flush-trap
19349 @opindex mno-flush-trap
19350 Specifies that the cache cannot be flushed by using a trap.
19351
19352 @item -mflush-func=@var{name}
19353 @opindex mflush-func=@var{name}
19354 Specifies the name of the operating system function to call to flush
19355 the cache. The default is @samp{_flush_cache}, but a function call
19356 is only used if a trap is not available.
19357
19358 @item -mno-flush-func
19359 @opindex mno-flush-func
19360 Indicates that there is no OS function for flushing the cache.
19361
19362 @end table
19363
19364 @node M680x0 Options
19365 @subsection M680x0 Options
19366 @cindex M680x0 options
19367
19368 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19369 The default settings depend on which architecture was selected when
19370 the compiler was configured; the defaults for the most common choices
19371 are given below.
19372
19373 @table @gcctabopt
19374 @item -march=@var{arch}
19375 @opindex march
19376 Generate code for a specific M680x0 or ColdFire instruction set
19377 architecture. Permissible values of @var{arch} for M680x0
19378 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19379 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19380 architectures are selected according to Freescale's ISA classification
19381 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19382 @samp{isab} and @samp{isac}.
19383
19384 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19385 code for a ColdFire target. The @var{arch} in this macro is one of the
19386 @option{-march} arguments given above.
19387
19388 When used together, @option{-march} and @option{-mtune} select code
19389 that runs on a family of similar processors but that is optimized
19390 for a particular microarchitecture.
19391
19392 @item -mcpu=@var{cpu}
19393 @opindex mcpu
19394 Generate code for a specific M680x0 or ColdFire processor.
19395 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19396 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19397 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19398 below, which also classifies the CPUs into families:
19399
19400 @multitable @columnfractions 0.20 0.80
19401 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19402 @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}
19403 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19404 @item @samp{5206e} @tab @samp{5206e}
19405 @item @samp{5208} @tab @samp{5207} @samp{5208}
19406 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19407 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19408 @item @samp{5216} @tab @samp{5214} @samp{5216}
19409 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19410 @item @samp{5225} @tab @samp{5224} @samp{5225}
19411 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19412 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19413 @item @samp{5249} @tab @samp{5249}
19414 @item @samp{5250} @tab @samp{5250}
19415 @item @samp{5271} @tab @samp{5270} @samp{5271}
19416 @item @samp{5272} @tab @samp{5272}
19417 @item @samp{5275} @tab @samp{5274} @samp{5275}
19418 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19419 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19420 @item @samp{5307} @tab @samp{5307}
19421 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19422 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19423 @item @samp{5407} @tab @samp{5407}
19424 @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}
19425 @end multitable
19426
19427 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19428 @var{arch} is compatible with @var{cpu}. Other combinations of
19429 @option{-mcpu} and @option{-march} are rejected.
19430
19431 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19432 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19433 where the value of @var{family} is given by the table above.
19434
19435 @item -mtune=@var{tune}
19436 @opindex mtune
19437 Tune the code for a particular microarchitecture within the
19438 constraints set by @option{-march} and @option{-mcpu}.
19439 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19440 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19441 and @samp{cpu32}. The ColdFire microarchitectures
19442 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19443
19444 You can also use @option{-mtune=68020-40} for code that needs
19445 to run relatively well on 68020, 68030 and 68040 targets.
19446 @option{-mtune=68020-60} is similar but includes 68060 targets
19447 as well. These two options select the same tuning decisions as
19448 @option{-m68020-40} and @option{-m68020-60} respectively.
19449
19450 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19451 when tuning for 680x0 architecture @var{arch}. It also defines
19452 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19453 option is used. If GCC is tuning for a range of architectures,
19454 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19455 it defines the macros for every architecture in the range.
19456
19457 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19458 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19459 of the arguments given above.
19460
19461 @item -m68000
19462 @itemx -mc68000
19463 @opindex m68000
19464 @opindex mc68000
19465 Generate output for a 68000. This is the default
19466 when the compiler is configured for 68000-based systems.
19467 It is equivalent to @option{-march=68000}.
19468
19469 Use this option for microcontrollers with a 68000 or EC000 core,
19470 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19471
19472 @item -m68010
19473 @opindex m68010
19474 Generate output for a 68010. This is the default
19475 when the compiler is configured for 68010-based systems.
19476 It is equivalent to @option{-march=68010}.
19477
19478 @item -m68020
19479 @itemx -mc68020
19480 @opindex m68020
19481 @opindex mc68020
19482 Generate output for a 68020. This is the default
19483 when the compiler is configured for 68020-based systems.
19484 It is equivalent to @option{-march=68020}.
19485
19486 @item -m68030
19487 @opindex m68030
19488 Generate output for a 68030. This is the default when the compiler is
19489 configured for 68030-based systems. It is equivalent to
19490 @option{-march=68030}.
19491
19492 @item -m68040
19493 @opindex m68040
19494 Generate output for a 68040. This is the default when the compiler is
19495 configured for 68040-based systems. It is equivalent to
19496 @option{-march=68040}.
19497
19498 This option inhibits the use of 68881/68882 instructions that have to be
19499 emulated by software on the 68040. Use this option if your 68040 does not
19500 have code to emulate those instructions.
19501
19502 @item -m68060
19503 @opindex m68060
19504 Generate output for a 68060. This is the default when the compiler is
19505 configured for 68060-based systems. It is equivalent to
19506 @option{-march=68060}.
19507
19508 This option inhibits the use of 68020 and 68881/68882 instructions that
19509 have to be emulated by software on the 68060. Use this option if your 68060
19510 does not have code to emulate those instructions.
19511
19512 @item -mcpu32
19513 @opindex mcpu32
19514 Generate output for a CPU32. This is the default
19515 when the compiler is configured for CPU32-based systems.
19516 It is equivalent to @option{-march=cpu32}.
19517
19518 Use this option for microcontrollers with a
19519 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
19520 68336, 68340, 68341, 68349 and 68360.
19521
19522 @item -m5200
19523 @opindex m5200
19524 Generate output for a 520X ColdFire CPU@. This is the default
19525 when the compiler is configured for 520X-based systems.
19526 It is equivalent to @option{-mcpu=5206}, and is now deprecated
19527 in favor of that option.
19528
19529 Use this option for microcontroller with a 5200 core, including
19530 the MCF5202, MCF5203, MCF5204 and MCF5206.
19531
19532 @item -m5206e
19533 @opindex m5206e
19534 Generate output for a 5206e ColdFire CPU@. The option is now
19535 deprecated in favor of the equivalent @option{-mcpu=5206e}.
19536
19537 @item -m528x
19538 @opindex m528x
19539 Generate output for a member of the ColdFire 528X family.
19540 The option is now deprecated in favor of the equivalent
19541 @option{-mcpu=528x}.
19542
19543 @item -m5307
19544 @opindex m5307
19545 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
19546 in favor of the equivalent @option{-mcpu=5307}.
19547
19548 @item -m5407
19549 @opindex m5407
19550 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
19551 in favor of the equivalent @option{-mcpu=5407}.
19552
19553 @item -mcfv4e
19554 @opindex mcfv4e
19555 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
19556 This includes use of hardware floating-point instructions.
19557 The option is equivalent to @option{-mcpu=547x}, and is now
19558 deprecated in favor of that option.
19559
19560 @item -m68020-40
19561 @opindex m68020-40
19562 Generate output for a 68040, without using any of the new instructions.
19563 This results in code that can run relatively efficiently on either a
19564 68020/68881 or a 68030 or a 68040. The generated code does use the
19565 68881 instructions that are emulated on the 68040.
19566
19567 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
19568
19569 @item -m68020-60
19570 @opindex m68020-60
19571 Generate output for a 68060, without using any of the new instructions.
19572 This results in code that can run relatively efficiently on either a
19573 68020/68881 or a 68030 or a 68040. The generated code does use the
19574 68881 instructions that are emulated on the 68060.
19575
19576 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
19577
19578 @item -mhard-float
19579 @itemx -m68881
19580 @opindex mhard-float
19581 @opindex m68881
19582 Generate floating-point instructions. This is the default for 68020
19583 and above, and for ColdFire devices that have an FPU@. It defines the
19584 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
19585 on ColdFire targets.
19586
19587 @item -msoft-float
19588 @opindex msoft-float
19589 Do not generate floating-point instructions; use library calls instead.
19590 This is the default for 68000, 68010, and 68832 targets. It is also
19591 the default for ColdFire devices that have no FPU.
19592
19593 @item -mdiv
19594 @itemx -mno-div
19595 @opindex mdiv
19596 @opindex mno-div
19597 Generate (do not generate) ColdFire hardware divide and remainder
19598 instructions. If @option{-march} is used without @option{-mcpu},
19599 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
19600 architectures. Otherwise, the default is taken from the target CPU
19601 (either the default CPU, or the one specified by @option{-mcpu}). For
19602 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
19603 @option{-mcpu=5206e}.
19604
19605 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
19606
19607 @item -mshort
19608 @opindex mshort
19609 Consider type @code{int} to be 16 bits wide, like @code{short int}.
19610 Additionally, parameters passed on the stack are also aligned to a
19611 16-bit boundary even on targets whose API mandates promotion to 32-bit.
19612
19613 @item -mno-short
19614 @opindex mno-short
19615 Do not consider type @code{int} to be 16 bits wide. This is the default.
19616
19617 @item -mnobitfield
19618 @itemx -mno-bitfield
19619 @opindex mnobitfield
19620 @opindex mno-bitfield
19621 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19622 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19623
19624 @item -mbitfield
19625 @opindex mbitfield
19626 Do use the bit-field instructions. The @option{-m68020} option implies
19627 @option{-mbitfield}. This is the default if you use a configuration
19628 designed for a 68020.
19629
19630 @item -mrtd
19631 @opindex mrtd
19632 Use a different function-calling convention, in which functions
19633 that take a fixed number of arguments return with the @code{rtd}
19634 instruction, which pops their arguments while returning. This
19635 saves one instruction in the caller since there is no need to pop
19636 the arguments there.
19637
19638 This calling convention is incompatible with the one normally
19639 used on Unix, so you cannot use it if you need to call libraries
19640 compiled with the Unix compiler.
19641
19642 Also, you must provide function prototypes for all functions that
19643 take variable numbers of arguments (including @code{printf});
19644 otherwise incorrect code is generated for calls to those
19645 functions.
19646
19647 In addition, seriously incorrect code results if you call a
19648 function with too many arguments. (Normally, extra arguments are
19649 harmlessly ignored.)
19650
19651 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19652 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19653
19654 @item -mno-rtd
19655 @opindex mno-rtd
19656 Do not use the calling conventions selected by @option{-mrtd}.
19657 This is the default.
19658
19659 @item -malign-int
19660 @itemx -mno-align-int
19661 @opindex malign-int
19662 @opindex mno-align-int
19663 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19664 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19665 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19666 Aligning variables on 32-bit boundaries produces code that runs somewhat
19667 faster on processors with 32-bit busses at the expense of more memory.
19668
19669 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19670 aligns structures containing the above types differently than
19671 most published application binary interface specifications for the m68k.
19672
19673 @item -mpcrel
19674 @opindex mpcrel
19675 Use the pc-relative addressing mode of the 68000 directly, instead of
19676 using a global offset table. At present, this option implies @option{-fpic},
19677 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19678 not presently supported with @option{-mpcrel}, though this could be supported for
19679 68020 and higher processors.
19680
19681 @item -mno-strict-align
19682 @itemx -mstrict-align
19683 @opindex mno-strict-align
19684 @opindex mstrict-align
19685 Do not (do) assume that unaligned memory references are handled by
19686 the system.
19687
19688 @item -msep-data
19689 Generate code that allows the data segment to be located in a different
19690 area of memory from the text segment. This allows for execute-in-place in
19691 an environment without virtual memory management. This option implies
19692 @option{-fPIC}.
19693
19694 @item -mno-sep-data
19695 Generate code that assumes that the data segment follows the text segment.
19696 This is the default.
19697
19698 @item -mid-shared-library
19699 Generate code that supports shared libraries via the library ID method.
19700 This allows for execute-in-place and shared libraries in an environment
19701 without virtual memory management. This option implies @option{-fPIC}.
19702
19703 @item -mno-id-shared-library
19704 Generate code that doesn't assume ID-based shared libraries are being used.
19705 This is the default.
19706
19707 @item -mshared-library-id=n
19708 Specifies the identification number of the ID-based shared library being
19709 compiled. Specifying a value of 0 generates more compact code; specifying
19710 other values forces the allocation of that number to the current
19711 library, but is no more space- or time-efficient than omitting this option.
19712
19713 @item -mxgot
19714 @itemx -mno-xgot
19715 @opindex mxgot
19716 @opindex mno-xgot
19717 When generating position-independent code for ColdFire, generate code
19718 that works if the GOT has more than 8192 entries. This code is
19719 larger and slower than code generated without this option. On M680x0
19720 processors, this option is not needed; @option{-fPIC} suffices.
19721
19722 GCC normally uses a single instruction to load values from the GOT@.
19723 While this is relatively efficient, it only works if the GOT
19724 is smaller than about 64k. Anything larger causes the linker
19725 to report an error such as:
19726
19727 @cindex relocation truncated to fit (ColdFire)
19728 @smallexample
19729 relocation truncated to fit: R_68K_GOT16O foobar
19730 @end smallexample
19731
19732 If this happens, you should recompile your code with @option{-mxgot}.
19733 It should then work with very large GOTs. However, code generated with
19734 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19735 the value of a global symbol.
19736
19737 Note that some linkers, including newer versions of the GNU linker,
19738 can create multiple GOTs and sort GOT entries. If you have such a linker,
19739 you should only need to use @option{-mxgot} when compiling a single
19740 object file that accesses more than 8192 GOT entries. Very few do.
19741
19742 These options have no effect unless GCC is generating
19743 position-independent code.
19744
19745 @item -mlong-jump-table-offsets
19746 @opindex mlong-jump-table-offsets
19747 Use 32-bit offsets in @code{switch} tables. The default is to use
19748 16-bit offsets.
19749
19750 @end table
19751
19752 @node MCore Options
19753 @subsection MCore Options
19754 @cindex MCore options
19755
19756 These are the @samp{-m} options defined for the Motorola M*Core
19757 processors.
19758
19759 @table @gcctabopt
19760
19761 @item -mhardlit
19762 @itemx -mno-hardlit
19763 @opindex mhardlit
19764 @opindex mno-hardlit
19765 Inline constants into the code stream if it can be done in two
19766 instructions or less.
19767
19768 @item -mdiv
19769 @itemx -mno-div
19770 @opindex mdiv
19771 @opindex mno-div
19772 Use the divide instruction. (Enabled by default).
19773
19774 @item -mrelax-immediate
19775 @itemx -mno-relax-immediate
19776 @opindex mrelax-immediate
19777 @opindex mno-relax-immediate
19778 Allow arbitrary-sized immediates in bit operations.
19779
19780 @item -mwide-bitfields
19781 @itemx -mno-wide-bitfields
19782 @opindex mwide-bitfields
19783 @opindex mno-wide-bitfields
19784 Always treat bit-fields as @code{int}-sized.
19785
19786 @item -m4byte-functions
19787 @itemx -mno-4byte-functions
19788 @opindex m4byte-functions
19789 @opindex mno-4byte-functions
19790 Force all functions to be aligned to a 4-byte boundary.
19791
19792 @item -mcallgraph-data
19793 @itemx -mno-callgraph-data
19794 @opindex mcallgraph-data
19795 @opindex mno-callgraph-data
19796 Emit callgraph information.
19797
19798 @item -mslow-bytes
19799 @itemx -mno-slow-bytes
19800 @opindex mslow-bytes
19801 @opindex mno-slow-bytes
19802 Prefer word access when reading byte quantities.
19803
19804 @item -mlittle-endian
19805 @itemx -mbig-endian
19806 @opindex mlittle-endian
19807 @opindex mbig-endian
19808 Generate code for a little-endian target.
19809
19810 @item -m210
19811 @itemx -m340
19812 @opindex m210
19813 @opindex m340
19814 Generate code for the 210 processor.
19815
19816 @item -mno-lsim
19817 @opindex mno-lsim
19818 Assume that runtime support has been provided and so omit the
19819 simulator library (@file{libsim.a)} from the linker command line.
19820
19821 @item -mstack-increment=@var{size}
19822 @opindex mstack-increment
19823 Set the maximum amount for a single stack increment operation. Large
19824 values can increase the speed of programs that contain functions
19825 that need a large amount of stack space, but they can also trigger a
19826 segmentation fault if the stack is extended too much. The default
19827 value is 0x1000.
19828
19829 @end table
19830
19831 @node MeP Options
19832 @subsection MeP Options
19833 @cindex MeP options
19834
19835 @table @gcctabopt
19836
19837 @item -mabsdiff
19838 @opindex mabsdiff
19839 Enables the @code{abs} instruction, which is the absolute difference
19840 between two registers.
19841
19842 @item -mall-opts
19843 @opindex mall-opts
19844 Enables all the optional instructions---average, multiply, divide, bit
19845 operations, leading zero, absolute difference, min/max, clip, and
19846 saturation.
19847
19848
19849 @item -maverage
19850 @opindex maverage
19851 Enables the @code{ave} instruction, which computes the average of two
19852 registers.
19853
19854 @item -mbased=@var{n}
19855 @opindex mbased=
19856 Variables of size @var{n} bytes or smaller are placed in the
19857 @code{.based} section by default. Based variables use the @code{$tp}
19858 register as a base register, and there is a 128-byte limit to the
19859 @code{.based} section.
19860
19861 @item -mbitops
19862 @opindex mbitops
19863 Enables the bit operation instructions---bit test (@code{btstm}), set
19864 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19865 test-and-set (@code{tas}).
19866
19867 @item -mc=@var{name}
19868 @opindex mc=
19869 Selects which section constant data is placed in. @var{name} may
19870 be @samp{tiny}, @samp{near}, or @samp{far}.
19871
19872 @item -mclip
19873 @opindex mclip
19874 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19875 useful unless you also provide @option{-mminmax}.
19876
19877 @item -mconfig=@var{name}
19878 @opindex mconfig=
19879 Selects one of the built-in core configurations. Each MeP chip has
19880 one or more modules in it; each module has a core CPU and a variety of
19881 coprocessors, optional instructions, and peripherals. The
19882 @code{MeP-Integrator} tool, not part of GCC, provides these
19883 configurations through this option; using this option is the same as
19884 using all the corresponding command-line options. The default
19885 configuration is @samp{default}.
19886
19887 @item -mcop
19888 @opindex mcop
19889 Enables the coprocessor instructions. By default, this is a 32-bit
19890 coprocessor. Note that the coprocessor is normally enabled via the
19891 @option{-mconfig=} option.
19892
19893 @item -mcop32
19894 @opindex mcop32
19895 Enables the 32-bit coprocessor's instructions.
19896
19897 @item -mcop64
19898 @opindex mcop64
19899 Enables the 64-bit coprocessor's instructions.
19900
19901 @item -mivc2
19902 @opindex mivc2
19903 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19904
19905 @item -mdc
19906 @opindex mdc
19907 Causes constant variables to be placed in the @code{.near} section.
19908
19909 @item -mdiv
19910 @opindex mdiv
19911 Enables the @code{div} and @code{divu} instructions.
19912
19913 @item -meb
19914 @opindex meb
19915 Generate big-endian code.
19916
19917 @item -mel
19918 @opindex mel
19919 Generate little-endian code.
19920
19921 @item -mio-volatile
19922 @opindex mio-volatile
19923 Tells the compiler that any variable marked with the @code{io}
19924 attribute is to be considered volatile.
19925
19926 @item -ml
19927 @opindex ml
19928 Causes variables to be assigned to the @code{.far} section by default.
19929
19930 @item -mleadz
19931 @opindex mleadz
19932 Enables the @code{leadz} (leading zero) instruction.
19933
19934 @item -mm
19935 @opindex mm
19936 Causes variables to be assigned to the @code{.near} section by default.
19937
19938 @item -mminmax
19939 @opindex mminmax
19940 Enables the @code{min} and @code{max} instructions.
19941
19942 @item -mmult
19943 @opindex mmult
19944 Enables the multiplication and multiply-accumulate instructions.
19945
19946 @item -mno-opts
19947 @opindex mno-opts
19948 Disables all the optional instructions enabled by @option{-mall-opts}.
19949
19950 @item -mrepeat
19951 @opindex mrepeat
19952 Enables the @code{repeat} and @code{erepeat} instructions, used for
19953 low-overhead looping.
19954
19955 @item -ms
19956 @opindex ms
19957 Causes all variables to default to the @code{.tiny} section. Note
19958 that there is a 65536-byte limit to this section. Accesses to these
19959 variables use the @code{%gp} base register.
19960
19961 @item -msatur
19962 @opindex msatur
19963 Enables the saturation instructions. Note that the compiler does not
19964 currently generate these itself, but this option is included for
19965 compatibility with other tools, like @code{as}.
19966
19967 @item -msdram
19968 @opindex msdram
19969 Link the SDRAM-based runtime instead of the default ROM-based runtime.
19970
19971 @item -msim
19972 @opindex msim
19973 Link the simulator run-time libraries.
19974
19975 @item -msimnovec
19976 @opindex msimnovec
19977 Link the simulator runtime libraries, excluding built-in support
19978 for reset and exception vectors and tables.
19979
19980 @item -mtf
19981 @opindex mtf
19982 Causes all functions to default to the @code{.far} section. Without
19983 this option, functions default to the @code{.near} section.
19984
19985 @item -mtiny=@var{n}
19986 @opindex mtiny=
19987 Variables that are @var{n} bytes or smaller are allocated to the
19988 @code{.tiny} section. These variables use the @code{$gp} base
19989 register. The default for this option is 4, but note that there's a
19990 65536-byte limit to the @code{.tiny} section.
19991
19992 @end table
19993
19994 @node MicroBlaze Options
19995 @subsection MicroBlaze Options
19996 @cindex MicroBlaze Options
19997
19998 @table @gcctabopt
19999
20000 @item -msoft-float
20001 @opindex msoft-float
20002 Use software emulation for floating point (default).
20003
20004 @item -mhard-float
20005 @opindex mhard-float
20006 Use hardware floating-point instructions.
20007
20008 @item -mmemcpy
20009 @opindex mmemcpy
20010 Do not optimize block moves, use @code{memcpy}.
20011
20012 @item -mno-clearbss
20013 @opindex mno-clearbss
20014 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20015
20016 @item -mcpu=@var{cpu-type}
20017 @opindex mcpu=
20018 Use features of, and schedule code for, the given CPU.
20019 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20020 where @var{X} is a major version, @var{YY} is the minor version, and
20021 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20022 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
20023
20024 @item -mxl-soft-mul
20025 @opindex mxl-soft-mul
20026 Use software multiply emulation (default).
20027
20028 @item -mxl-soft-div
20029 @opindex mxl-soft-div
20030 Use software emulation for divides (default).
20031
20032 @item -mxl-barrel-shift
20033 @opindex mxl-barrel-shift
20034 Use the hardware barrel shifter.
20035
20036 @item -mxl-pattern-compare
20037 @opindex mxl-pattern-compare
20038 Use pattern compare instructions.
20039
20040 @item -msmall-divides
20041 @opindex msmall-divides
20042 Use table lookup optimization for small signed integer divisions.
20043
20044 @item -mxl-stack-check
20045 @opindex mxl-stack-check
20046 This option is deprecated. Use @option{-fstack-check} instead.
20047
20048 @item -mxl-gp-opt
20049 @opindex mxl-gp-opt
20050 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20051
20052 @item -mxl-multiply-high
20053 @opindex mxl-multiply-high
20054 Use multiply high instructions for high part of 32x32 multiply.
20055
20056 @item -mxl-float-convert
20057 @opindex mxl-float-convert
20058 Use hardware floating-point conversion instructions.
20059
20060 @item -mxl-float-sqrt
20061 @opindex mxl-float-sqrt
20062 Use hardware floating-point square root instruction.
20063
20064 @item -mbig-endian
20065 @opindex mbig-endian
20066 Generate code for a big-endian target.
20067
20068 @item -mlittle-endian
20069 @opindex mlittle-endian
20070 Generate code for a little-endian target.
20071
20072 @item -mxl-reorder
20073 @opindex mxl-reorder
20074 Use reorder instructions (swap and byte reversed load/store).
20075
20076 @item -mxl-mode-@var{app-model}
20077 Select application model @var{app-model}. Valid models are
20078 @table @samp
20079 @item executable
20080 normal executable (default), uses startup code @file{crt0.o}.
20081
20082 @item -mpic-data-is-text-relative
20083 @opindex mpic-data-is-text-relative
20084 Assume that the displacement between the text and data segments is fixed
20085 at static link time. This allows data to be referenced by offset from start of
20086 text address instead of GOT since PC-relative addressing is not supported.
20087
20088 @item xmdstub
20089 for use with Xilinx Microprocessor Debugger (XMD) based
20090 software intrusive debug agent called xmdstub. This uses startup file
20091 @file{crt1.o} and sets the start address of the program to 0x800.
20092
20093 @item bootstrap
20094 for applications that are loaded using a bootloader.
20095 This model uses startup file @file{crt2.o} which does not contain a processor
20096 reset vector handler. This is suitable for transferring control on a
20097 processor reset to the bootloader rather than the application.
20098
20099 @item novectors
20100 for applications that do not require any of the
20101 MicroBlaze vectors. This option may be useful for applications running
20102 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20103 @end table
20104
20105 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20106 @option{-mxl-mode-@var{app-model}}.
20107
20108 @end table
20109
20110 @node MIPS Options
20111 @subsection MIPS Options
20112 @cindex MIPS options
20113
20114 @table @gcctabopt
20115
20116 @item -EB
20117 @opindex EB
20118 Generate big-endian code.
20119
20120 @item -EL
20121 @opindex EL
20122 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20123 configurations.
20124
20125 @item -march=@var{arch}
20126 @opindex march
20127 Generate code that runs on @var{arch}, which can be the name of a
20128 generic MIPS ISA, or the name of a particular processor.
20129 The ISA names are:
20130 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20131 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20132 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20133 @samp{mips64r5} and @samp{mips64r6}.
20134 The processor names are:
20135 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20136 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20137 @samp{5kc}, @samp{5kf},
20138 @samp{20kc},
20139 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20140 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20141 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20142 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20143 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20144 @samp{i6400},
20145 @samp{interaptiv},
20146 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
20147 @samp{m4k},
20148 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20149 @samp{m5100}, @samp{m5101},
20150 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20151 @samp{orion},
20152 @samp{p5600},
20153 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20154 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20155 @samp{rm7000}, @samp{rm9000},
20156 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20157 @samp{sb1},
20158 @samp{sr71000},
20159 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20160 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20161 @samp{xlr} and @samp{xlp}.
20162 The special value @samp{from-abi} selects the
20163 most compatible architecture for the selected ABI (that is,
20164 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20165
20166 The native Linux/GNU toolchain also supports the value @samp{native},
20167 which selects the best architecture option for the host processor.
20168 @option{-march=native} has no effect if GCC does not recognize
20169 the processor.
20170
20171 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20172 (for example, @option{-march=r2k}). Prefixes are optional, and
20173 @samp{vr} may be written @samp{r}.
20174
20175 Names of the form @samp{@var{n}f2_1} refer to processors with
20176 FPUs clocked at half the rate of the core, names of the form
20177 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20178 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20179 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20180 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20181 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20182 accepted as synonyms for @samp{@var{n}f1_1}.
20183
20184 GCC defines two macros based on the value of this option. The first
20185 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20186 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20187 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20188 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20189 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20190
20191 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20192 above. In other words, it has the full prefix and does not
20193 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20194 the macro names the resolved architecture (either @code{"mips1"} or
20195 @code{"mips3"}). It names the default architecture when no
20196 @option{-march} option is given.
20197
20198 @item -mtune=@var{arch}
20199 @opindex mtune
20200 Optimize for @var{arch}. Among other things, this option controls
20201 the way instructions are scheduled, and the perceived cost of arithmetic
20202 operations. The list of @var{arch} values is the same as for
20203 @option{-march}.
20204
20205 When this option is not used, GCC optimizes for the processor
20206 specified by @option{-march}. By using @option{-march} and
20207 @option{-mtune} together, it is possible to generate code that
20208 runs on a family of processors, but optimize the code for one
20209 particular member of that family.
20210
20211 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20212 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20213 @option{-march} ones described above.
20214
20215 @item -mips1
20216 @opindex mips1
20217 Equivalent to @option{-march=mips1}.
20218
20219 @item -mips2
20220 @opindex mips2
20221 Equivalent to @option{-march=mips2}.
20222
20223 @item -mips3
20224 @opindex mips3
20225 Equivalent to @option{-march=mips3}.
20226
20227 @item -mips4
20228 @opindex mips4
20229 Equivalent to @option{-march=mips4}.
20230
20231 @item -mips32
20232 @opindex mips32
20233 Equivalent to @option{-march=mips32}.
20234
20235 @item -mips32r3
20236 @opindex mips32r3
20237 Equivalent to @option{-march=mips32r3}.
20238
20239 @item -mips32r5
20240 @opindex mips32r5
20241 Equivalent to @option{-march=mips32r5}.
20242
20243 @item -mips32r6
20244 @opindex mips32r6
20245 Equivalent to @option{-march=mips32r6}.
20246
20247 @item -mips64
20248 @opindex mips64
20249 Equivalent to @option{-march=mips64}.
20250
20251 @item -mips64r2
20252 @opindex mips64r2
20253 Equivalent to @option{-march=mips64r2}.
20254
20255 @item -mips64r3
20256 @opindex mips64r3
20257 Equivalent to @option{-march=mips64r3}.
20258
20259 @item -mips64r5
20260 @opindex mips64r5
20261 Equivalent to @option{-march=mips64r5}.
20262
20263 @item -mips64r6
20264 @opindex mips64r6
20265 Equivalent to @option{-march=mips64r6}.
20266
20267 @item -mips16
20268 @itemx -mno-mips16
20269 @opindex mips16
20270 @opindex mno-mips16
20271 Generate (do not generate) MIPS16 code. If GCC is targeting a
20272 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20273
20274 MIPS16 code generation can also be controlled on a per-function basis
20275 by means of @code{mips16} and @code{nomips16} attributes.
20276 @xref{Function Attributes}, for more information.
20277
20278 @item -mflip-mips16
20279 @opindex mflip-mips16
20280 Generate MIPS16 code on alternating functions. This option is provided
20281 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20282 not intended for ordinary use in compiling user code.
20283
20284 @item -minterlink-compressed
20285 @itemx -mno-interlink-compressed
20286 @opindex minterlink-compressed
20287 @opindex mno-interlink-compressed
20288 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20289 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20290
20291 For example, code using the standard ISA encoding cannot jump directly
20292 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20293 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20294 knows that the target of the jump is not compressed.
20295
20296 @item -minterlink-mips16
20297 @itemx -mno-interlink-mips16
20298 @opindex minterlink-mips16
20299 @opindex mno-interlink-mips16
20300 Aliases of @option{-minterlink-compressed} and
20301 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20302 and are retained for backwards compatibility.
20303
20304 @item -mabi=32
20305 @itemx -mabi=o64
20306 @itemx -mabi=n32
20307 @itemx -mabi=64
20308 @itemx -mabi=eabi
20309 @opindex mabi=32
20310 @opindex mabi=o64
20311 @opindex mabi=n32
20312 @opindex mabi=64
20313 @opindex mabi=eabi
20314 Generate code for the given ABI@.
20315
20316 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20317 generates 64-bit code when you select a 64-bit architecture, but you
20318 can use @option{-mgp32} to get 32-bit code instead.
20319
20320 For information about the O64 ABI, see
20321 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20322
20323 GCC supports a variant of the o32 ABI in which floating-point registers
20324 are 64 rather than 32 bits wide. You can select this combination with
20325 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20326 and @code{mfhc1} instructions and is therefore only supported for
20327 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20328
20329 The register assignments for arguments and return values remain the
20330 same, but each scalar value is passed in a single 64-bit register
20331 rather than a pair of 32-bit registers. For example, scalar
20332 floating-point values are returned in @samp{$f0} only, not a
20333 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20334 remains the same in that the even-numbered double-precision registers
20335 are saved.
20336
20337 Two additional variants of the o32 ABI are supported to enable
20338 a transition from 32-bit to 64-bit registers. These are FPXX
20339 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20340 The FPXX extension mandates that all code must execute correctly
20341 when run using 32-bit or 64-bit registers. The code can be interlinked
20342 with either FP32 or FP64, but not both.
20343 The FP64A extension is similar to the FP64 extension but forbids the
20344 use of odd-numbered single-precision registers. This can be used
20345 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20346 processors and allows both FP32 and FP64A code to interlink and
20347 run in the same process without changing FPU modes.
20348
20349 @item -mabicalls
20350 @itemx -mno-abicalls
20351 @opindex mabicalls
20352 @opindex mno-abicalls
20353 Generate (do not generate) code that is suitable for SVR4-style
20354 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20355 systems.
20356
20357 @item -mshared
20358 @itemx -mno-shared
20359 Generate (do not generate) code that is fully position-independent,
20360 and that can therefore be linked into shared libraries. This option
20361 only affects @option{-mabicalls}.
20362
20363 All @option{-mabicalls} code has traditionally been position-independent,
20364 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20365 as an extension, the GNU toolchain allows executables to use absolute
20366 accesses for locally-binding symbols. It can also use shorter GP
20367 initialization sequences and generate direct calls to locally-defined
20368 functions. This mode is selected by @option{-mno-shared}.
20369
20370 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20371 objects that can only be linked by the GNU linker. However, the option
20372 does not affect the ABI of the final executable; it only affects the ABI
20373 of relocatable objects. Using @option{-mno-shared} generally makes
20374 executables both smaller and quicker.
20375
20376 @option{-mshared} is the default.
20377
20378 @item -mplt
20379 @itemx -mno-plt
20380 @opindex mplt
20381 @opindex mno-plt
20382 Assume (do not assume) that the static and dynamic linkers
20383 support PLTs and copy relocations. This option only affects
20384 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20385 has no effect without @option{-msym32}.
20386
20387 You can make @option{-mplt} the default by configuring
20388 GCC with @option{--with-mips-plt}. The default is
20389 @option{-mno-plt} otherwise.
20390
20391 @item -mxgot
20392 @itemx -mno-xgot
20393 @opindex mxgot
20394 @opindex mno-xgot
20395 Lift (do not lift) the usual restrictions on the size of the global
20396 offset table.
20397
20398 GCC normally uses a single instruction to load values from the GOT@.
20399 While this is relatively efficient, it only works if the GOT
20400 is smaller than about 64k. Anything larger causes the linker
20401 to report an error such as:
20402
20403 @cindex relocation truncated to fit (MIPS)
20404 @smallexample
20405 relocation truncated to fit: R_MIPS_GOT16 foobar
20406 @end smallexample
20407
20408 If this happens, you should recompile your code with @option{-mxgot}.
20409 This works with very large GOTs, although the code is also
20410 less efficient, since it takes three instructions to fetch the
20411 value of a global symbol.
20412
20413 Note that some linkers can create multiple GOTs. If you have such a
20414 linker, you should only need to use @option{-mxgot} when a single object
20415 file accesses more than 64k's worth of GOT entries. Very few do.
20416
20417 These options have no effect unless GCC is generating position
20418 independent code.
20419
20420 @item -mgp32
20421 @opindex mgp32
20422 Assume that general-purpose registers are 32 bits wide.
20423
20424 @item -mgp64
20425 @opindex mgp64
20426 Assume that general-purpose registers are 64 bits wide.
20427
20428 @item -mfp32
20429 @opindex mfp32
20430 Assume that floating-point registers are 32 bits wide.
20431
20432 @item -mfp64
20433 @opindex mfp64
20434 Assume that floating-point registers are 64 bits wide.
20435
20436 @item -mfpxx
20437 @opindex mfpxx
20438 Do not assume the width of floating-point registers.
20439
20440 @item -mhard-float
20441 @opindex mhard-float
20442 Use floating-point coprocessor instructions.
20443
20444 @item -msoft-float
20445 @opindex msoft-float
20446 Do not use floating-point coprocessor instructions. Implement
20447 floating-point calculations using library calls instead.
20448
20449 @item -mno-float
20450 @opindex mno-float
20451 Equivalent to @option{-msoft-float}, but additionally asserts that the
20452 program being compiled does not perform any floating-point operations.
20453 This option is presently supported only by some bare-metal MIPS
20454 configurations, where it may select a special set of libraries
20455 that lack all floating-point support (including, for example, the
20456 floating-point @code{printf} formats).
20457 If code compiled with @option{-mno-float} accidentally contains
20458 floating-point operations, it is likely to suffer a link-time
20459 or run-time failure.
20460
20461 @item -msingle-float
20462 @opindex msingle-float
20463 Assume that the floating-point coprocessor only supports single-precision
20464 operations.
20465
20466 @item -mdouble-float
20467 @opindex mdouble-float
20468 Assume that the floating-point coprocessor supports double-precision
20469 operations. This is the default.
20470
20471 @item -modd-spreg
20472 @itemx -mno-odd-spreg
20473 @opindex modd-spreg
20474 @opindex mno-odd-spreg
20475 Enable the use of odd-numbered single-precision floating-point registers
20476 for the o32 ABI. This is the default for processors that are known to
20477 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20478 is set by default.
20479
20480 @item -mabs=2008
20481 @itemx -mabs=legacy
20482 @opindex mabs=2008
20483 @opindex mabs=legacy
20484 These options control the treatment of the special not-a-number (NaN)
20485 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20486 @code{neg.@i{fmt}} machine instructions.
20487
20488 By default or when @option{-mabs=legacy} is used the legacy
20489 treatment is selected. In this case these instructions are considered
20490 arithmetic and avoided where correct operation is required and the
20491 input operand might be a NaN. A longer sequence of instructions that
20492 manipulate the sign bit of floating-point datum manually is used
20493 instead unless the @option{-ffinite-math-only} option has also been
20494 specified.
20495
20496 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20497 this case these instructions are considered non-arithmetic and therefore
20498 operating correctly in all cases, including in particular where the
20499 input operand is a NaN. These instructions are therefore always used
20500 for the respective operations.
20501
20502 @item -mnan=2008
20503 @itemx -mnan=legacy
20504 @opindex mnan=2008
20505 @opindex mnan=legacy
20506 These options control the encoding of the special not-a-number (NaN)
20507 IEEE 754 floating-point data.
20508
20509 The @option{-mnan=legacy} option selects the legacy encoding. In this
20510 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20511 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
20512 by the first bit of their trailing significand field being 1.
20513
20514 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
20515 this case qNaNs are denoted by the first bit of their trailing
20516 significand field being 1, whereas sNaNs are denoted by the first bit of
20517 their trailing significand field being 0.
20518
20519 The default is @option{-mnan=legacy} unless GCC has been configured with
20520 @option{--with-nan=2008}.
20521
20522 @item -mllsc
20523 @itemx -mno-llsc
20524 @opindex mllsc
20525 @opindex mno-llsc
20526 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
20527 implement atomic memory built-in functions. When neither option is
20528 specified, GCC uses the instructions if the target architecture
20529 supports them.
20530
20531 @option{-mllsc} is useful if the runtime environment can emulate the
20532 instructions and @option{-mno-llsc} can be useful when compiling for
20533 nonstandard ISAs. You can make either option the default by
20534 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
20535 respectively. @option{--with-llsc} is the default for some
20536 configurations; see the installation documentation for details.
20537
20538 @item -mdsp
20539 @itemx -mno-dsp
20540 @opindex mdsp
20541 @opindex mno-dsp
20542 Use (do not use) revision 1 of the MIPS DSP ASE@.
20543 @xref{MIPS DSP Built-in Functions}. This option defines the
20544 preprocessor macro @code{__mips_dsp}. It also defines
20545 @code{__mips_dsp_rev} to 1.
20546
20547 @item -mdspr2
20548 @itemx -mno-dspr2
20549 @opindex mdspr2
20550 @opindex mno-dspr2
20551 Use (do not use) revision 2 of the MIPS DSP ASE@.
20552 @xref{MIPS DSP Built-in Functions}. This option defines the
20553 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
20554 It also defines @code{__mips_dsp_rev} to 2.
20555
20556 @item -msmartmips
20557 @itemx -mno-smartmips
20558 @opindex msmartmips
20559 @opindex mno-smartmips
20560 Use (do not use) the MIPS SmartMIPS ASE.
20561
20562 @item -mpaired-single
20563 @itemx -mno-paired-single
20564 @opindex mpaired-single
20565 @opindex mno-paired-single
20566 Use (do not use) paired-single floating-point instructions.
20567 @xref{MIPS Paired-Single Support}. This option requires
20568 hardware floating-point support to be enabled.
20569
20570 @item -mdmx
20571 @itemx -mno-mdmx
20572 @opindex mdmx
20573 @opindex mno-mdmx
20574 Use (do not use) MIPS Digital Media Extension instructions.
20575 This option can only be used when generating 64-bit code and requires
20576 hardware floating-point support to be enabled.
20577
20578 @item -mips3d
20579 @itemx -mno-mips3d
20580 @opindex mips3d
20581 @opindex mno-mips3d
20582 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
20583 The option @option{-mips3d} implies @option{-mpaired-single}.
20584
20585 @item -mmicromips
20586 @itemx -mno-micromips
20587 @opindex mmicromips
20588 @opindex mno-mmicromips
20589 Generate (do not generate) microMIPS code.
20590
20591 MicroMIPS code generation can also be controlled on a per-function basis
20592 by means of @code{micromips} and @code{nomicromips} attributes.
20593 @xref{Function Attributes}, for more information.
20594
20595 @item -mmt
20596 @itemx -mno-mt
20597 @opindex mmt
20598 @opindex mno-mt
20599 Use (do not use) MT Multithreading instructions.
20600
20601 @item -mmcu
20602 @itemx -mno-mcu
20603 @opindex mmcu
20604 @opindex mno-mcu
20605 Use (do not use) the MIPS MCU ASE instructions.
20606
20607 @item -meva
20608 @itemx -mno-eva
20609 @opindex meva
20610 @opindex mno-eva
20611 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20612
20613 @item -mvirt
20614 @itemx -mno-virt
20615 @opindex mvirt
20616 @opindex mno-virt
20617 Use (do not use) the MIPS Virtualization (VZ) instructions.
20618
20619 @item -mxpa
20620 @itemx -mno-xpa
20621 @opindex mxpa
20622 @opindex mno-xpa
20623 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20624
20625 @item -mlong64
20626 @opindex mlong64
20627 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20628 an explanation of the default and the way that the pointer size is
20629 determined.
20630
20631 @item -mlong32
20632 @opindex mlong32
20633 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20634
20635 The default size of @code{int}s, @code{long}s and pointers depends on
20636 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20637 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20638 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20639 or the same size as integer registers, whichever is smaller.
20640
20641 @item -msym32
20642 @itemx -mno-sym32
20643 @opindex msym32
20644 @opindex mno-sym32
20645 Assume (do not assume) that all symbols have 32-bit values, regardless
20646 of the selected ABI@. This option is useful in combination with
20647 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20648 to generate shorter and faster references to symbolic addresses.
20649
20650 @item -G @var{num}
20651 @opindex G
20652 Put definitions of externally-visible data in a small data section
20653 if that data is no bigger than @var{num} bytes. GCC can then generate
20654 more efficient accesses to the data; see @option{-mgpopt} for details.
20655
20656 The default @option{-G} option depends on the configuration.
20657
20658 @item -mlocal-sdata
20659 @itemx -mno-local-sdata
20660 @opindex mlocal-sdata
20661 @opindex mno-local-sdata
20662 Extend (do not extend) the @option{-G} behavior to local data too,
20663 such as to static variables in C@. @option{-mlocal-sdata} is the
20664 default for all configurations.
20665
20666 If the linker complains that an application is using too much small data,
20667 you might want to try rebuilding the less performance-critical parts with
20668 @option{-mno-local-sdata}. You might also want to build large
20669 libraries with @option{-mno-local-sdata}, so that the libraries leave
20670 more room for the main program.
20671
20672 @item -mextern-sdata
20673 @itemx -mno-extern-sdata
20674 @opindex mextern-sdata
20675 @opindex mno-extern-sdata
20676 Assume (do not assume) that externally-defined data is in
20677 a small data section if the size of that data is within the @option{-G} limit.
20678 @option{-mextern-sdata} is the default for all configurations.
20679
20680 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20681 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20682 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20683 is placed in a small data section. If @var{Var} is defined by another
20684 module, you must either compile that module with a high-enough
20685 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20686 definition. If @var{Var} is common, you must link the application
20687 with a high-enough @option{-G} setting.
20688
20689 The easiest way of satisfying these restrictions is to compile
20690 and link every module with the same @option{-G} option. However,
20691 you may wish to build a library that supports several different
20692 small data limits. You can do this by compiling the library with
20693 the highest supported @option{-G} setting and additionally using
20694 @option{-mno-extern-sdata} to stop the library from making assumptions
20695 about externally-defined data.
20696
20697 @item -mgpopt
20698 @itemx -mno-gpopt
20699 @opindex mgpopt
20700 @opindex mno-gpopt
20701 Use (do not use) GP-relative accesses for symbols that are known to be
20702 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20703 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20704 configurations.
20705
20706 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20707 might not hold the value of @code{_gp}. For example, if the code is
20708 part of a library that might be used in a boot monitor, programs that
20709 call boot monitor routines pass an unknown value in @code{$gp}.
20710 (In such situations, the boot monitor itself is usually compiled
20711 with @option{-G0}.)
20712
20713 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20714 @option{-mno-extern-sdata}.
20715
20716 @item -membedded-data
20717 @itemx -mno-embedded-data
20718 @opindex membedded-data
20719 @opindex mno-embedded-data
20720 Allocate variables to the read-only data section first if possible, then
20721 next in the small data section if possible, otherwise in data. This gives
20722 slightly slower code than the default, but reduces the amount of RAM required
20723 when executing, and thus may be preferred for some embedded systems.
20724
20725 @item -muninit-const-in-rodata
20726 @itemx -mno-uninit-const-in-rodata
20727 @opindex muninit-const-in-rodata
20728 @opindex mno-uninit-const-in-rodata
20729 Put uninitialized @code{const} variables in the read-only data section.
20730 This option is only meaningful in conjunction with @option{-membedded-data}.
20731
20732 @item -mcode-readable=@var{setting}
20733 @opindex mcode-readable
20734 Specify whether GCC may generate code that reads from executable sections.
20735 There are three possible settings:
20736
20737 @table @gcctabopt
20738 @item -mcode-readable=yes
20739 Instructions may freely access executable sections. This is the
20740 default setting.
20741
20742 @item -mcode-readable=pcrel
20743 MIPS16 PC-relative load instructions can access executable sections,
20744 but other instructions must not do so. This option is useful on 4KSc
20745 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20746 It is also useful on processors that can be configured to have a dual
20747 instruction/data SRAM interface and that, like the M4K, automatically
20748 redirect PC-relative loads to the instruction RAM.
20749
20750 @item -mcode-readable=no
20751 Instructions must not access executable sections. This option can be
20752 useful on targets that are configured to have a dual instruction/data
20753 SRAM interface but that (unlike the M4K) do not automatically redirect
20754 PC-relative loads to the instruction RAM.
20755 @end table
20756
20757 @item -msplit-addresses
20758 @itemx -mno-split-addresses
20759 @opindex msplit-addresses
20760 @opindex mno-split-addresses
20761 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20762 relocation operators. This option has been superseded by
20763 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20764
20765 @item -mexplicit-relocs
20766 @itemx -mno-explicit-relocs
20767 @opindex mexplicit-relocs
20768 @opindex mno-explicit-relocs
20769 Use (do not use) assembler relocation operators when dealing with symbolic
20770 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20771 is to use assembler macros instead.
20772
20773 @option{-mexplicit-relocs} is the default if GCC was configured
20774 to use an assembler that supports relocation operators.
20775
20776 @item -mcheck-zero-division
20777 @itemx -mno-check-zero-division
20778 @opindex mcheck-zero-division
20779 @opindex mno-check-zero-division
20780 Trap (do not trap) on integer division by zero.
20781
20782 The default is @option{-mcheck-zero-division}.
20783
20784 @item -mdivide-traps
20785 @itemx -mdivide-breaks
20786 @opindex mdivide-traps
20787 @opindex mdivide-breaks
20788 MIPS systems check for division by zero by generating either a
20789 conditional trap or a break instruction. Using traps results in
20790 smaller code, but is only supported on MIPS II and later. Also, some
20791 versions of the Linux kernel have a bug that prevents trap from
20792 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20793 allow conditional traps on architectures that support them and
20794 @option{-mdivide-breaks} to force the use of breaks.
20795
20796 The default is usually @option{-mdivide-traps}, but this can be
20797 overridden at configure time using @option{--with-divide=breaks}.
20798 Divide-by-zero checks can be completely disabled using
20799 @option{-mno-check-zero-division}.
20800
20801 @item -mload-store-pairs
20802 @itemx -mno-load-store-pairs
20803 @opindex mload-store-pairs
20804 @opindex mno-load-store-pairs
20805 Enable (disable) an optimization that pairs consecutive load or store
20806 instructions to enable load/store bonding. This option is enabled by
20807 default but only takes effect when the selected architecture is known
20808 to support bonding.
20809
20810 @item -mmemcpy
20811 @itemx -mno-memcpy
20812 @opindex mmemcpy
20813 @opindex mno-memcpy
20814 Force (do not force) the use of @code{memcpy} for non-trivial block
20815 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20816 most constant-sized copies.
20817
20818 @item -mlong-calls
20819 @itemx -mno-long-calls
20820 @opindex mlong-calls
20821 @opindex mno-long-calls
20822 Disable (do not disable) use of the @code{jal} instruction. Calling
20823 functions using @code{jal} is more efficient but requires the caller
20824 and callee to be in the same 256 megabyte segment.
20825
20826 This option has no effect on abicalls code. The default is
20827 @option{-mno-long-calls}.
20828
20829 @item -mmad
20830 @itemx -mno-mad
20831 @opindex mmad
20832 @opindex mno-mad
20833 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20834 instructions, as provided by the R4650 ISA@.
20835
20836 @item -mimadd
20837 @itemx -mno-imadd
20838 @opindex mimadd
20839 @opindex mno-imadd
20840 Enable (disable) use of the @code{madd} and @code{msub} integer
20841 instructions. The default is @option{-mimadd} on architectures
20842 that support @code{madd} and @code{msub} except for the 74k
20843 architecture where it was found to generate slower code.
20844
20845 @item -mfused-madd
20846 @itemx -mno-fused-madd
20847 @opindex mfused-madd
20848 @opindex mno-fused-madd
20849 Enable (disable) use of the floating-point multiply-accumulate
20850 instructions, when they are available. The default is
20851 @option{-mfused-madd}.
20852
20853 On the R8000 CPU when multiply-accumulate instructions are used,
20854 the intermediate product is calculated to infinite precision
20855 and is not subject to the FCSR Flush to Zero bit. This may be
20856 undesirable in some circumstances. On other processors the result
20857 is numerically identical to the equivalent computation using
20858 separate multiply, add, subtract and negate instructions.
20859
20860 @item -nocpp
20861 @opindex nocpp
20862 Tell the MIPS assembler to not run its preprocessor over user
20863 assembler files (with a @samp{.s} suffix) when assembling them.
20864
20865 @item -mfix-24k
20866 @itemx -mno-fix-24k
20867 @opindex mfix-24k
20868 @opindex mno-fix-24k
20869 Work around the 24K E48 (lost data on stores during refill) errata.
20870 The workarounds are implemented by the assembler rather than by GCC@.
20871
20872 @item -mfix-r4000
20873 @itemx -mno-fix-r4000
20874 @opindex mfix-r4000
20875 @opindex mno-fix-r4000
20876 Work around certain R4000 CPU errata:
20877 @itemize @minus
20878 @item
20879 A double-word or a variable shift may give an incorrect result if executed
20880 immediately after starting an integer division.
20881 @item
20882 A double-word or a variable shift may give an incorrect result if executed
20883 while an integer multiplication is in progress.
20884 @item
20885 An integer division may give an incorrect result if started in a delay slot
20886 of a taken branch or a jump.
20887 @end itemize
20888
20889 @item -mfix-r4400
20890 @itemx -mno-fix-r4400
20891 @opindex mfix-r4400
20892 @opindex mno-fix-r4400
20893 Work around certain R4400 CPU errata:
20894 @itemize @minus
20895 @item
20896 A double-word or a variable shift may give an incorrect result if executed
20897 immediately after starting an integer division.
20898 @end itemize
20899
20900 @item -mfix-r10000
20901 @itemx -mno-fix-r10000
20902 @opindex mfix-r10000
20903 @opindex mno-fix-r10000
20904 Work around certain R10000 errata:
20905 @itemize @minus
20906 @item
20907 @code{ll}/@code{sc} sequences may not behave atomically on revisions
20908 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20909 @end itemize
20910
20911 This option can only be used if the target architecture supports
20912 branch-likely instructions. @option{-mfix-r10000} is the default when
20913 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
20914 otherwise.
20915
20916 @item -mfix-rm7000
20917 @itemx -mno-fix-rm7000
20918 @opindex mfix-rm7000
20919 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
20920 workarounds are implemented by the assembler rather than by GCC@.
20921
20922 @item -mfix-vr4120
20923 @itemx -mno-fix-vr4120
20924 @opindex mfix-vr4120
20925 Work around certain VR4120 errata:
20926 @itemize @minus
20927 @item
20928 @code{dmultu} does not always produce the correct result.
20929 @item
20930 @code{div} and @code{ddiv} do not always produce the correct result if one
20931 of the operands is negative.
20932 @end itemize
20933 The workarounds for the division errata rely on special functions in
20934 @file{libgcc.a}. At present, these functions are only provided by
20935 the @code{mips64vr*-elf} configurations.
20936
20937 Other VR4120 errata require a NOP to be inserted between certain pairs of
20938 instructions. These errata are handled by the assembler, not by GCC itself.
20939
20940 @item -mfix-vr4130
20941 @opindex mfix-vr4130
20942 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
20943 workarounds are implemented by the assembler rather than by GCC,
20944 although GCC avoids using @code{mflo} and @code{mfhi} if the
20945 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
20946 instructions are available instead.
20947
20948 @item -mfix-sb1
20949 @itemx -mno-fix-sb1
20950 @opindex mfix-sb1
20951 Work around certain SB-1 CPU core errata.
20952 (This flag currently works around the SB-1 revision 2
20953 ``F1'' and ``F2'' floating-point errata.)
20954
20955 @item -mr10k-cache-barrier=@var{setting}
20956 @opindex mr10k-cache-barrier
20957 Specify whether GCC should insert cache barriers to avoid the
20958 side effects of speculation on R10K processors.
20959
20960 In common with many processors, the R10K tries to predict the outcome
20961 of a conditional branch and speculatively executes instructions from
20962 the ``taken'' branch. It later aborts these instructions if the
20963 predicted outcome is wrong. However, on the R10K, even aborted
20964 instructions can have side effects.
20965
20966 This problem only affects kernel stores and, depending on the system,
20967 kernel loads. As an example, a speculatively-executed store may load
20968 the target memory into cache and mark the cache line as dirty, even if
20969 the store itself is later aborted. If a DMA operation writes to the
20970 same area of memory before the ``dirty'' line is flushed, the cached
20971 data overwrites the DMA-ed data. See the R10K processor manual
20972 for a full description, including other potential problems.
20973
20974 One workaround is to insert cache barrier instructions before every memory
20975 access that might be speculatively executed and that might have side
20976 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
20977 controls GCC's implementation of this workaround. It assumes that
20978 aborted accesses to any byte in the following regions does not have
20979 side effects:
20980
20981 @enumerate
20982 @item
20983 the memory occupied by the current function's stack frame;
20984
20985 @item
20986 the memory occupied by an incoming stack argument;
20987
20988 @item
20989 the memory occupied by an object with a link-time-constant address.
20990 @end enumerate
20991
20992 It is the kernel's responsibility to ensure that speculative
20993 accesses to these regions are indeed safe.
20994
20995 If the input program contains a function declaration such as:
20996
20997 @smallexample
20998 void foo (void);
20999 @end smallexample
21000
21001 then the implementation of @code{foo} must allow @code{j foo} and
21002 @code{jal foo} to be executed speculatively. GCC honors this
21003 restriction for functions it compiles itself. It expects non-GCC
21004 functions (such as hand-written assembly code) to do the same.
21005
21006 The option has three forms:
21007
21008 @table @gcctabopt
21009 @item -mr10k-cache-barrier=load-store
21010 Insert a cache barrier before a load or store that might be
21011 speculatively executed and that might have side effects even
21012 if aborted.
21013
21014 @item -mr10k-cache-barrier=store
21015 Insert a cache barrier before a store that might be speculatively
21016 executed and that might have side effects even if aborted.
21017
21018 @item -mr10k-cache-barrier=none
21019 Disable the insertion of cache barriers. This is the default setting.
21020 @end table
21021
21022 @item -mflush-func=@var{func}
21023 @itemx -mno-flush-func
21024 @opindex mflush-func
21025 Specifies the function to call to flush the I and D caches, or to not
21026 call any such function. If called, the function must take the same
21027 arguments as the common @code{_flush_func}, that is, the address of the
21028 memory range for which the cache is being flushed, the size of the
21029 memory range, and the number 3 (to flush both caches). The default
21030 depends on the target GCC was configured for, but commonly is either
21031 @code{_flush_func} or @code{__cpu_flush}.
21032
21033 @item mbranch-cost=@var{num}
21034 @opindex mbranch-cost
21035 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21036 This cost is only a heuristic and is not guaranteed to produce
21037 consistent results across releases. A zero cost redundantly selects
21038 the default, which is based on the @option{-mtune} setting.
21039
21040 @item -mbranch-likely
21041 @itemx -mno-branch-likely
21042 @opindex mbranch-likely
21043 @opindex mno-branch-likely
21044 Enable or disable use of Branch Likely instructions, regardless of the
21045 default for the selected architecture. By default, Branch Likely
21046 instructions may be generated if they are supported by the selected
21047 architecture. An exception is for the MIPS32 and MIPS64 architectures
21048 and processors that implement those architectures; for those, Branch
21049 Likely instructions are not be generated by default because the MIPS32
21050 and MIPS64 architectures specifically deprecate their use.
21051
21052 @item -mcompact-branches=never
21053 @itemx -mcompact-branches=optimal
21054 @itemx -mcompact-branches=always
21055 @opindex mcompact-branches=never
21056 @opindex mcompact-branches=optimal
21057 @opindex mcompact-branches=always
21058 These options control which form of branches will be generated. The
21059 default is @option{-mcompact-branches=optimal}.
21060
21061 The @option{-mcompact-branches=never} option ensures that compact branch
21062 instructions will never be generated.
21063
21064 The @option{-mcompact-branches=always} option ensures that a compact
21065 branch instruction will be generated if available. If a compact branch
21066 instruction is not available, a delay slot form of the branch will be
21067 used instead.
21068
21069 This option is supported from MIPS Release 6 onwards.
21070
21071 The @option{-mcompact-branches=optimal} option will cause a delay slot
21072 branch to be used if one is available in the current ISA and the delay
21073 slot is successfully filled. If the delay slot is not filled, a compact
21074 branch will be chosen if one is available.
21075
21076 @item -mfp-exceptions
21077 @itemx -mno-fp-exceptions
21078 @opindex mfp-exceptions
21079 Specifies whether FP exceptions are enabled. This affects how
21080 FP instructions are scheduled for some processors.
21081 The default is that FP exceptions are
21082 enabled.
21083
21084 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21085 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21086 FP pipe.
21087
21088 @item -mvr4130-align
21089 @itemx -mno-vr4130-align
21090 @opindex mvr4130-align
21091 The VR4130 pipeline is two-way superscalar, but can only issue two
21092 instructions together if the first one is 8-byte aligned. When this
21093 option is enabled, GCC aligns pairs of instructions that it
21094 thinks should execute in parallel.
21095
21096 This option only has an effect when optimizing for the VR4130.
21097 It normally makes code faster, but at the expense of making it bigger.
21098 It is enabled by default at optimization level @option{-O3}.
21099
21100 @item -msynci
21101 @itemx -mno-synci
21102 @opindex msynci
21103 Enable (disable) generation of @code{synci} instructions on
21104 architectures that support it. The @code{synci} instructions (if
21105 enabled) are generated when @code{__builtin___clear_cache} is
21106 compiled.
21107
21108 This option defaults to @option{-mno-synci}, but the default can be
21109 overridden by configuring GCC with @option{--with-synci}.
21110
21111 When compiling code for single processor systems, it is generally safe
21112 to use @code{synci}. However, on many multi-core (SMP) systems, it
21113 does not invalidate the instruction caches on all cores and may lead
21114 to undefined behavior.
21115
21116 @item -mrelax-pic-calls
21117 @itemx -mno-relax-pic-calls
21118 @opindex mrelax-pic-calls
21119 Try to turn PIC calls that are normally dispatched via register
21120 @code{$25} into direct calls. This is only possible if the linker can
21121 resolve the destination at link time and if the destination is within
21122 range for a direct call.
21123
21124 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21125 an assembler and a linker that support the @code{.reloc} assembly
21126 directive and @option{-mexplicit-relocs} is in effect. With
21127 @option{-mno-explicit-relocs}, this optimization can be performed by the
21128 assembler and the linker alone without help from the compiler.
21129
21130 @item -mmcount-ra-address
21131 @itemx -mno-mcount-ra-address
21132 @opindex mmcount-ra-address
21133 @opindex mno-mcount-ra-address
21134 Emit (do not emit) code that allows @code{_mcount} to modify the
21135 calling function's return address. When enabled, this option extends
21136 the usual @code{_mcount} interface with a new @var{ra-address}
21137 parameter, which has type @code{intptr_t *} and is passed in register
21138 @code{$12}. @code{_mcount} can then modify the return address by
21139 doing both of the following:
21140 @itemize
21141 @item
21142 Returning the new address in register @code{$31}.
21143 @item
21144 Storing the new address in @code{*@var{ra-address}},
21145 if @var{ra-address} is nonnull.
21146 @end itemize
21147
21148 The default is @option{-mno-mcount-ra-address}.
21149
21150 @item -mframe-header-opt
21151 @itemx -mno-frame-header-opt
21152 @opindex mframe-header-opt
21153 Enable (disable) frame header optimization in the o32 ABI. When using the
21154 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21155 function to write out register arguments. When enabled, this optimization
21156 will suppress the allocation of the frame header if it can be determined that
21157 it is unused.
21158
21159 This optimization is off by default at all optimization levels.
21160
21161 @item -mlxc1-sxc1
21162 @itemx -mno-lxc1-sxc1
21163 @opindex mlxc1-sxc1
21164 When applicable, enable (disable) the generation of @code{lwxc1},
21165 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21166
21167 @item -mmadd4
21168 @itemx -mno-madd4
21169 @opindex mmadd4
21170 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21171 @code{madd.d} and related instructions. Enabled by default.
21172
21173 @end table
21174
21175 @node MMIX Options
21176 @subsection MMIX Options
21177 @cindex MMIX Options
21178
21179 These options are defined for the MMIX:
21180
21181 @table @gcctabopt
21182 @item -mlibfuncs
21183 @itemx -mno-libfuncs
21184 @opindex mlibfuncs
21185 @opindex mno-libfuncs
21186 Specify that intrinsic library functions are being compiled, passing all
21187 values in registers, no matter the size.
21188
21189 @item -mepsilon
21190 @itemx -mno-epsilon
21191 @opindex mepsilon
21192 @opindex mno-epsilon
21193 Generate floating-point comparison instructions that compare with respect
21194 to the @code{rE} epsilon register.
21195
21196 @item -mabi=mmixware
21197 @itemx -mabi=gnu
21198 @opindex mabi=mmixware
21199 @opindex mabi=gnu
21200 Generate code that passes function parameters and return values that (in
21201 the called function) are seen as registers @code{$0} and up, as opposed to
21202 the GNU ABI which uses global registers @code{$231} and up.
21203
21204 @item -mzero-extend
21205 @itemx -mno-zero-extend
21206 @opindex mzero-extend
21207 @opindex mno-zero-extend
21208 When reading data from memory in sizes shorter than 64 bits, use (do not
21209 use) zero-extending load instructions by default, rather than
21210 sign-extending ones.
21211
21212 @item -mknuthdiv
21213 @itemx -mno-knuthdiv
21214 @opindex mknuthdiv
21215 @opindex mno-knuthdiv
21216 Make the result of a division yielding a remainder have the same sign as
21217 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21218 remainder follows the sign of the dividend. Both methods are
21219 arithmetically valid, the latter being almost exclusively used.
21220
21221 @item -mtoplevel-symbols
21222 @itemx -mno-toplevel-symbols
21223 @opindex mtoplevel-symbols
21224 @opindex mno-toplevel-symbols
21225 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21226 code can be used with the @code{PREFIX} assembly directive.
21227
21228 @item -melf
21229 @opindex melf
21230 Generate an executable in the ELF format, rather than the default
21231 @samp{mmo} format used by the @command{mmix} simulator.
21232
21233 @item -mbranch-predict
21234 @itemx -mno-branch-predict
21235 @opindex mbranch-predict
21236 @opindex mno-branch-predict
21237 Use (do not use) the probable-branch instructions, when static branch
21238 prediction indicates a probable branch.
21239
21240 @item -mbase-addresses
21241 @itemx -mno-base-addresses
21242 @opindex mbase-addresses
21243 @opindex mno-base-addresses
21244 Generate (do not generate) code that uses @emph{base addresses}. Using a
21245 base address automatically generates a request (handled by the assembler
21246 and the linker) for a constant to be set up in a global register. The
21247 register is used for one or more base address requests within the range 0
21248 to 255 from the value held in the register. The generally leads to short
21249 and fast code, but the number of different data items that can be
21250 addressed is limited. This means that a program that uses lots of static
21251 data may require @option{-mno-base-addresses}.
21252
21253 @item -msingle-exit
21254 @itemx -mno-single-exit
21255 @opindex msingle-exit
21256 @opindex mno-single-exit
21257 Force (do not force) generated code to have a single exit point in each
21258 function.
21259 @end table
21260
21261 @node MN10300 Options
21262 @subsection MN10300 Options
21263 @cindex MN10300 options
21264
21265 These @option{-m} options are defined for Matsushita MN10300 architectures:
21266
21267 @table @gcctabopt
21268 @item -mmult-bug
21269 @opindex mmult-bug
21270 Generate code to avoid bugs in the multiply instructions for the MN10300
21271 processors. This is the default.
21272
21273 @item -mno-mult-bug
21274 @opindex mno-mult-bug
21275 Do not generate code to avoid bugs in the multiply instructions for the
21276 MN10300 processors.
21277
21278 @item -mam33
21279 @opindex mam33
21280 Generate code using features specific to the AM33 processor.
21281
21282 @item -mno-am33
21283 @opindex mno-am33
21284 Do not generate code using features specific to the AM33 processor. This
21285 is the default.
21286
21287 @item -mam33-2
21288 @opindex mam33-2
21289 Generate code using features specific to the AM33/2.0 processor.
21290
21291 @item -mam34
21292 @opindex mam34
21293 Generate code using features specific to the AM34 processor.
21294
21295 @item -mtune=@var{cpu-type}
21296 @opindex mtune
21297 Use the timing characteristics of the indicated CPU type when
21298 scheduling instructions. This does not change the targeted processor
21299 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21300 @samp{am33-2} or @samp{am34}.
21301
21302 @item -mreturn-pointer-on-d0
21303 @opindex mreturn-pointer-on-d0
21304 When generating a function that returns a pointer, return the pointer
21305 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21306 only in @code{a0}, and attempts to call such functions without a prototype
21307 result in errors. Note that this option is on by default; use
21308 @option{-mno-return-pointer-on-d0} to disable it.
21309
21310 @item -mno-crt0
21311 @opindex mno-crt0
21312 Do not link in the C run-time initialization object file.
21313
21314 @item -mrelax
21315 @opindex mrelax
21316 Indicate to the linker that it should perform a relaxation optimization pass
21317 to shorten branches, calls and absolute memory addresses. This option only
21318 has an effect when used on the command line for the final link step.
21319
21320 This option makes symbolic debugging impossible.
21321
21322 @item -mliw
21323 @opindex mliw
21324 Allow the compiler to generate @emph{Long Instruction Word}
21325 instructions if the target is the @samp{AM33} or later. This is the
21326 default. This option defines the preprocessor macro @code{__LIW__}.
21327
21328 @item -mnoliw
21329 @opindex mnoliw
21330 Do not allow the compiler to generate @emph{Long Instruction Word}
21331 instructions. This option defines the preprocessor macro
21332 @code{__NO_LIW__}.
21333
21334 @item -msetlb
21335 @opindex msetlb
21336 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21337 instructions if the target is the @samp{AM33} or later. This is the
21338 default. This option defines the preprocessor macro @code{__SETLB__}.
21339
21340 @item -mnosetlb
21341 @opindex mnosetlb
21342 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21343 instructions. This option defines the preprocessor macro
21344 @code{__NO_SETLB__}.
21345
21346 @end table
21347
21348 @node Moxie Options
21349 @subsection Moxie Options
21350 @cindex Moxie Options
21351
21352 @table @gcctabopt
21353
21354 @item -meb
21355 @opindex meb
21356 Generate big-endian code. This is the default for @samp{moxie-*-*}
21357 configurations.
21358
21359 @item -mel
21360 @opindex mel
21361 Generate little-endian code.
21362
21363 @item -mmul.x
21364 @opindex mmul.x
21365 Generate mul.x and umul.x instructions. This is the default for
21366 @samp{moxiebox-*-*} configurations.
21367
21368 @item -mno-crt0
21369 @opindex mno-crt0
21370 Do not link in the C run-time initialization object file.
21371
21372 @end table
21373
21374 @node MSP430 Options
21375 @subsection MSP430 Options
21376 @cindex MSP430 Options
21377
21378 These options are defined for the MSP430:
21379
21380 @table @gcctabopt
21381
21382 @item -masm-hex
21383 @opindex masm-hex
21384 Force assembly output to always use hex constants. Normally such
21385 constants are signed decimals, but this option is available for
21386 testsuite and/or aesthetic purposes.
21387
21388 @item -mmcu=
21389 @opindex mmcu=
21390 Select the MCU to target. This is used to create a C preprocessor
21391 symbol based upon the MCU name, converted to upper case and pre- and
21392 post-fixed with @samp{__}. This in turn is used by the
21393 @file{msp430.h} header file to select an MCU-specific supplementary
21394 header file.
21395
21396 The option also sets the ISA to use. If the MCU name is one that is
21397 known to only support the 430 ISA then that is selected, otherwise the
21398 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21399 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21400 name selects the 430X ISA.
21401
21402 In addition an MCU-specific linker script is added to the linker
21403 command line. The script's name is the name of the MCU with
21404 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21405 command line defines the C preprocessor symbol @code{__XXX__} and
21406 cause the linker to search for a script called @file{xxx.ld}.
21407
21408 This option is also passed on to the assembler.
21409
21410 @item -mwarn-mcu
21411 @itemx -mno-warn-mcu
21412 @opindex mwarn-mcu
21413 @opindex mno-warn-mcu
21414 This option enables or disables warnings about conflicts between the
21415 MCU name specified by the @option{-mmcu} option and the ISA set by the
21416 @option{-mcpu} option and/or the hardware multiply support set by the
21417 @option{-mhwmult} option. It also toggles warnings about unrecognized
21418 MCU names. This option is on by default.
21419
21420 @item -mcpu=
21421 @opindex mcpu=
21422 Specifies the ISA to use. Accepted values are @samp{msp430},
21423 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21424 @option{-mmcu=} option should be used to select the ISA.
21425
21426 @item -msim
21427 @opindex msim
21428 Link to the simulator runtime libraries and linker script. Overrides
21429 any scripts that would be selected by the @option{-mmcu=} option.
21430
21431 @item -mlarge
21432 @opindex mlarge
21433 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21434
21435 @item -msmall
21436 @opindex msmall
21437 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21438
21439 @item -mrelax
21440 @opindex mrelax
21441 This option is passed to the assembler and linker, and allows the
21442 linker to perform certain optimizations that cannot be done until
21443 the final link.
21444
21445 @item mhwmult=
21446 @opindex mhwmult=
21447 Describes the type of hardware multiply supported by the target.
21448 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21449 for the original 16-bit-only multiply supported by early MCUs.
21450 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21451 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21452 A value of @samp{auto} can also be given. This tells GCC to deduce
21453 the hardware multiply support based upon the MCU name provided by the
21454 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21455 the MCU name is not recognized then no hardware multiply support is
21456 assumed. @code{auto} is the default setting.
21457
21458 Hardware multiplies are normally performed by calling a library
21459 routine. This saves space in the generated code. When compiling at
21460 @option{-O3} or higher however the hardware multiplier is invoked
21461 inline. This makes for bigger, but faster code.
21462
21463 The hardware multiply routines disable interrupts whilst running and
21464 restore the previous interrupt state when they finish. This makes
21465 them safe to use inside interrupt handlers as well as in normal code.
21466
21467 @item -minrt
21468 @opindex minrt
21469 Enable the use of a minimum runtime environment - no static
21470 initializers or constructors. This is intended for memory-constrained
21471 devices. The compiler includes special symbols in some objects
21472 that tell the linker and runtime which code fragments are required.
21473
21474 @item -mcode-region=
21475 @itemx -mdata-region=
21476 @opindex mcode-region
21477 @opindex mdata-region
21478 These options tell the compiler where to place functions and data that
21479 do not have one of the @code{lower}, @code{upper}, @code{either} or
21480 @code{section} attributes. Possible values are @code{lower},
21481 @code{upper}, @code{either} or @code{any}. The first three behave
21482 like the corresponding attribute. The fourth possible value -
21483 @code{any} - is the default. It leaves placement entirely up to the
21484 linker script and how it assigns the standard sections
21485 (@code{.text}, @code{.data}, etc) to the memory regions.
21486
21487 @item -msilicon-errata=
21488 @opindex msilicon-errata
21489 This option passes on a request to assembler to enable the fixes for
21490 the named silicon errata.
21491
21492 @item -msilicon-errata-warn=
21493 @opindex msilicon-errata-warn
21494 This option passes on a request to the assembler to enable warning
21495 messages when a silicon errata might need to be applied.
21496
21497 @end table
21498
21499 @node NDS32 Options
21500 @subsection NDS32 Options
21501 @cindex NDS32 Options
21502
21503 These options are defined for NDS32 implementations:
21504
21505 @table @gcctabopt
21506
21507 @item -mbig-endian
21508 @opindex mbig-endian
21509 Generate code in big-endian mode.
21510
21511 @item -mlittle-endian
21512 @opindex mlittle-endian
21513 Generate code in little-endian mode.
21514
21515 @item -mreduced-regs
21516 @opindex mreduced-regs
21517 Use reduced-set registers for register allocation.
21518
21519 @item -mfull-regs
21520 @opindex mfull-regs
21521 Use full-set registers for register allocation.
21522
21523 @item -mcmov
21524 @opindex mcmov
21525 Generate conditional move instructions.
21526
21527 @item -mno-cmov
21528 @opindex mno-cmov
21529 Do not generate conditional move instructions.
21530
21531 @item -mext-perf
21532 @opindex mperf-ext
21533 Generate performance extension instructions.
21534
21535 @item -mno-ext-perf
21536 @opindex mno-perf-ext
21537 Do not generate performance extension instructions.
21538
21539 @item -mext-perf2
21540 @opindex mperf-ext
21541 Generate performance extension 2 instructions.
21542
21543 @item -mno-ext-perf2
21544 @opindex mno-perf-ext
21545 Do not generate performance extension 2 instructions.
21546
21547 @item -mext-string
21548 @opindex mperf-ext
21549 Generate string extension instructions.
21550
21551 @item -mno-ext-string
21552 @opindex mno-perf-ext
21553 Do not generate string extension instructions.
21554
21555 @item -mv3push
21556 @opindex mv3push
21557 Generate v3 push25/pop25 instructions.
21558
21559 @item -mno-v3push
21560 @opindex mno-v3push
21561 Do not generate v3 push25/pop25 instructions.
21562
21563 @item -m16-bit
21564 @opindex m16-bit
21565 Generate 16-bit instructions.
21566
21567 @item -mno-16-bit
21568 @opindex mno-16-bit
21569 Do not generate 16-bit instructions.
21570
21571 @item -misr-vector-size=@var{num}
21572 @opindex misr-vector-size
21573 Specify the size of each interrupt vector, which must be 4 or 16.
21574
21575 @item -mcache-block-size=@var{num}
21576 @opindex mcache-block-size
21577 Specify the size of each cache block,
21578 which must be a power of 2 between 4 and 512.
21579
21580 @item -march=@var{arch}
21581 @opindex march
21582 Specify the name of the target architecture.
21583
21584 @item -mcmodel=@var{code-model}
21585 @opindex mcmodel
21586 Set the code model to one of
21587 @table @asis
21588 @item @samp{small}
21589 All the data and read-only data segments must be within 512KB addressing space.
21590 The text segment must be within 16MB addressing space.
21591 @item @samp{medium}
21592 The data segment must be within 512KB while the read-only data segment can be
21593 within 4GB addressing space. The text segment should be still within 16MB
21594 addressing space.
21595 @item @samp{large}
21596 All the text and data segments can be within 4GB addressing space.
21597 @end table
21598
21599 @item -mctor-dtor
21600 @opindex mctor-dtor
21601 Enable constructor/destructor feature.
21602
21603 @item -mrelax
21604 @opindex mrelax
21605 Guide linker to relax instructions.
21606
21607 @end table
21608
21609 @node Nios II Options
21610 @subsection Nios II Options
21611 @cindex Nios II options
21612 @cindex Altera Nios II options
21613
21614 These are the options defined for the Altera Nios II processor.
21615
21616 @table @gcctabopt
21617
21618 @item -G @var{num}
21619 @opindex G
21620 @cindex smaller data references
21621 Put global and static objects less than or equal to @var{num} bytes
21622 into the small data or BSS sections instead of the normal data or BSS
21623 sections. The default value of @var{num} is 8.
21624
21625 @item -mgpopt=@var{option}
21626 @itemx -mgpopt
21627 @itemx -mno-gpopt
21628 @opindex mgpopt
21629 @opindex mno-gpopt
21630 Generate (do not generate) GP-relative accesses. The following
21631 @var{option} names are recognized:
21632
21633 @table @samp
21634
21635 @item none
21636 Do not generate GP-relative accesses.
21637
21638 @item local
21639 Generate GP-relative accesses for small data objects that are not
21640 external, weak, or uninitialized common symbols.
21641 Also use GP-relative addressing for objects that
21642 have been explicitly placed in a small data section via a @code{section}
21643 attribute.
21644
21645 @item global
21646 As for @samp{local}, but also generate GP-relative accesses for
21647 small data objects that are external, weak, or common. If you use this option,
21648 you must ensure that all parts of your program (including libraries) are
21649 compiled with the same @option{-G} setting.
21650
21651 @item data
21652 Generate GP-relative accesses for all data objects in the program. If you
21653 use this option, the entire data and BSS segments
21654 of your program must fit in 64K of memory and you must use an appropriate
21655 linker script to allocate them within the addressable range of the
21656 global pointer.
21657
21658 @item all
21659 Generate GP-relative addresses for function pointers as well as data
21660 pointers. If you use this option, the entire text, data, and BSS segments
21661 of your program must fit in 64K of memory and you must use an appropriate
21662 linker script to allocate them within the addressable range of the
21663 global pointer.
21664
21665 @end table
21666
21667 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21668 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21669
21670 The default is @option{-mgpopt} except when @option{-fpic} or
21671 @option{-fPIC} is specified to generate position-independent code.
21672 Note that the Nios II ABI does not permit GP-relative accesses from
21673 shared libraries.
21674
21675 You may need to specify @option{-mno-gpopt} explicitly when building
21676 programs that include large amounts of small data, including large
21677 GOT data sections. In this case, the 16-bit offset for GP-relative
21678 addressing may not be large enough to allow access to the entire
21679 small data section.
21680
21681 @item -mgprel-sec=@var{regexp}
21682 @opindex mgprel-sec
21683 This option specifies additional section names that can be accessed via
21684 GP-relative addressing. It is most useful in conjunction with
21685 @code{section} attributes on variable declarations
21686 (@pxref{Common Variable Attributes}) and a custom linker script.
21687 The @var{regexp} is a POSIX Extended Regular Expression.
21688
21689 This option does not affect the behavior of the @option{-G} option, and
21690 and the specified sections are in addition to the standard @code{.sdata}
21691 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
21692
21693 @item -mr0rel-sec=@var{regexp}
21694 @opindex mr0rel-sec
21695 This option specifies names of sections that can be accessed via a
21696 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
21697 of the 32-bit address space. It is most useful in conjunction with
21698 @code{section} attributes on variable declarations
21699 (@pxref{Common Variable Attributes}) and a custom linker script.
21700 The @var{regexp} is a POSIX Extended Regular Expression.
21701
21702 In contrast to the use of GP-relative addressing for small data,
21703 zero-based addressing is never generated by default and there are no
21704 conventional section names used in standard linker scripts for sections
21705 in the low or high areas of memory.
21706
21707 @item -mel
21708 @itemx -meb
21709 @opindex mel
21710 @opindex meb
21711 Generate little-endian (default) or big-endian (experimental) code,
21712 respectively.
21713
21714 @item -march=@var{arch}
21715 @opindex march
21716 This specifies the name of the target Nios II architecture. GCC uses this
21717 name to determine what kind of instructions it can emit when generating
21718 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21719
21720 The preprocessor macro @code{__nios2_arch__} is available to programs,
21721 with value 1 or 2, indicating the targeted ISA level.
21722
21723 @item -mbypass-cache
21724 @itemx -mno-bypass-cache
21725 @opindex mno-bypass-cache
21726 @opindex mbypass-cache
21727 Force all load and store instructions to always bypass cache by
21728 using I/O variants of the instructions. The default is not to
21729 bypass the cache.
21730
21731 @item -mno-cache-volatile
21732 @itemx -mcache-volatile
21733 @opindex mcache-volatile
21734 @opindex mno-cache-volatile
21735 Volatile memory access bypass the cache using the I/O variants of
21736 the load and store instructions. The default is not to bypass the cache.
21737
21738 @item -mno-fast-sw-div
21739 @itemx -mfast-sw-div
21740 @opindex mno-fast-sw-div
21741 @opindex mfast-sw-div
21742 Do not use table-based fast divide for small numbers. The default
21743 is to use the fast divide at @option{-O3} and above.
21744
21745 @item -mno-hw-mul
21746 @itemx -mhw-mul
21747 @itemx -mno-hw-mulx
21748 @itemx -mhw-mulx
21749 @itemx -mno-hw-div
21750 @itemx -mhw-div
21751 @opindex mno-hw-mul
21752 @opindex mhw-mul
21753 @opindex mno-hw-mulx
21754 @opindex mhw-mulx
21755 @opindex mno-hw-div
21756 @opindex mhw-div
21757 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21758 instructions by the compiler. The default is to emit @code{mul}
21759 and not emit @code{div} and @code{mulx}.
21760
21761 @item -mbmx
21762 @itemx -mno-bmx
21763 @itemx -mcdx
21764 @itemx -mno-cdx
21765 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21766 CDX (code density) instructions. Enabling these instructions also
21767 requires @option{-march=r2}. Since these instructions are optional
21768 extensions to the R2 architecture, the default is not to emit them.
21769
21770 @item -mcustom-@var{insn}=@var{N}
21771 @itemx -mno-custom-@var{insn}
21772 @opindex mcustom-@var{insn}
21773 @opindex mno-custom-@var{insn}
21774 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21775 custom instruction with encoding @var{N} when generating code that uses
21776 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21777 instruction 253 for single-precision floating-point add operations instead
21778 of the default behavior of using a library call.
21779
21780 The following values of @var{insn} are supported. Except as otherwise
21781 noted, floating-point operations are expected to be implemented with
21782 normal IEEE 754 semantics and correspond directly to the C operators or the
21783 equivalent GCC built-in functions (@pxref{Other Builtins}).
21784
21785 Single-precision floating point:
21786 @table @asis
21787
21788 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21789 Binary arithmetic operations.
21790
21791 @item @samp{fnegs}
21792 Unary negation.
21793
21794 @item @samp{fabss}
21795 Unary absolute value.
21796
21797 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21798 Comparison operations.
21799
21800 @item @samp{fmins}, @samp{fmaxs}
21801 Floating-point minimum and maximum. These instructions are only
21802 generated if @option{-ffinite-math-only} is specified.
21803
21804 @item @samp{fsqrts}
21805 Unary square root operation.
21806
21807 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21808 Floating-point trigonometric and exponential functions. These instructions
21809 are only generated if @option{-funsafe-math-optimizations} is also specified.
21810
21811 @end table
21812
21813 Double-precision floating point:
21814 @table @asis
21815
21816 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21817 Binary arithmetic operations.
21818
21819 @item @samp{fnegd}
21820 Unary negation.
21821
21822 @item @samp{fabsd}
21823 Unary absolute value.
21824
21825 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21826 Comparison operations.
21827
21828 @item @samp{fmind}, @samp{fmaxd}
21829 Double-precision minimum and maximum. These instructions are only
21830 generated if @option{-ffinite-math-only} is specified.
21831
21832 @item @samp{fsqrtd}
21833 Unary square root operation.
21834
21835 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21836 Double-precision trigonometric and exponential functions. These instructions
21837 are only generated if @option{-funsafe-math-optimizations} is also specified.
21838
21839 @end table
21840
21841 Conversions:
21842 @table @asis
21843 @item @samp{fextsd}
21844 Conversion from single precision to double precision.
21845
21846 @item @samp{ftruncds}
21847 Conversion from double precision to single precision.
21848
21849 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21850 Conversion from floating point to signed or unsigned integer types, with
21851 truncation towards zero.
21852
21853 @item @samp{round}
21854 Conversion from single-precision floating point to signed integer,
21855 rounding to the nearest integer and ties away from zero.
21856 This corresponds to the @code{__builtin_lroundf} function when
21857 @option{-fno-math-errno} is used.
21858
21859 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21860 Conversion from signed or unsigned integer types to floating-point types.
21861
21862 @end table
21863
21864 In addition, all of the following transfer instructions for internal
21865 registers X and Y must be provided to use any of the double-precision
21866 floating-point instructions. Custom instructions taking two
21867 double-precision source operands expect the first operand in the
21868 64-bit register X. The other operand (or only operand of a unary
21869 operation) is given to the custom arithmetic instruction with the
21870 least significant half in source register @var{src1} and the most
21871 significant half in @var{src2}. A custom instruction that returns a
21872 double-precision result returns the most significant 32 bits in the
21873 destination register and the other half in 32-bit register Y.
21874 GCC automatically generates the necessary code sequences to write
21875 register X and/or read register Y when double-precision floating-point
21876 instructions are used.
21877
21878 @table @asis
21879
21880 @item @samp{fwrx}
21881 Write @var{src1} into the least significant half of X and @var{src2} into
21882 the most significant half of X.
21883
21884 @item @samp{fwry}
21885 Write @var{src1} into Y.
21886
21887 @item @samp{frdxhi}, @samp{frdxlo}
21888 Read the most or least (respectively) significant half of X and store it in
21889 @var{dest}.
21890
21891 @item @samp{frdy}
21892 Read the value of Y and store it into @var{dest}.
21893 @end table
21894
21895 Note that you can gain more local control over generation of Nios II custom
21896 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
21897 and @code{target("no-custom-@var{insn}")} function attributes
21898 (@pxref{Function Attributes})
21899 or pragmas (@pxref{Function Specific Option Pragmas}).
21900
21901 @item -mcustom-fpu-cfg=@var{name}
21902 @opindex mcustom-fpu-cfg
21903
21904 This option enables a predefined, named set of custom instruction encodings
21905 (see @option{-mcustom-@var{insn}} above).
21906 Currently, the following sets are defined:
21907
21908 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
21909 @gccoptlist{-mcustom-fmuls=252 @gol
21910 -mcustom-fadds=253 @gol
21911 -mcustom-fsubs=254 @gol
21912 -fsingle-precision-constant}
21913
21914 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
21915 @gccoptlist{-mcustom-fmuls=252 @gol
21916 -mcustom-fadds=253 @gol
21917 -mcustom-fsubs=254 @gol
21918 -mcustom-fdivs=255 @gol
21919 -fsingle-precision-constant}
21920
21921 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
21922 @gccoptlist{-mcustom-floatus=243 @gol
21923 -mcustom-fixsi=244 @gol
21924 -mcustom-floatis=245 @gol
21925 -mcustom-fcmpgts=246 @gol
21926 -mcustom-fcmples=249 @gol
21927 -mcustom-fcmpeqs=250 @gol
21928 -mcustom-fcmpnes=251 @gol
21929 -mcustom-fmuls=252 @gol
21930 -mcustom-fadds=253 @gol
21931 -mcustom-fsubs=254 @gol
21932 -mcustom-fdivs=255 @gol
21933 -fsingle-precision-constant}
21934
21935 Custom instruction assignments given by individual
21936 @option{-mcustom-@var{insn}=} options override those given by
21937 @option{-mcustom-fpu-cfg=}, regardless of the
21938 order of the options on the command line.
21939
21940 Note that you can gain more local control over selection of a FPU
21941 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
21942 function attribute (@pxref{Function Attributes})
21943 or pragma (@pxref{Function Specific Option Pragmas}).
21944
21945 @end table
21946
21947 These additional @samp{-m} options are available for the Altera Nios II
21948 ELF (bare-metal) target:
21949
21950 @table @gcctabopt
21951
21952 @item -mhal
21953 @opindex mhal
21954 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
21955 startup and termination code, and is typically used in conjunction with
21956 @option{-msys-crt0=} to specify the location of the alternate startup code
21957 provided by the HAL BSP.
21958
21959 @item -msmallc
21960 @opindex msmallc
21961 Link with a limited version of the C library, @option{-lsmallc}, rather than
21962 Newlib.
21963
21964 @item -msys-crt0=@var{startfile}
21965 @opindex msys-crt0
21966 @var{startfile} is the file name of the startfile (crt0) to use
21967 when linking. This option is only useful in conjunction with @option{-mhal}.
21968
21969 @item -msys-lib=@var{systemlib}
21970 @opindex msys-lib
21971 @var{systemlib} is the library name of the library that provides
21972 low-level system calls required by the C library,
21973 e.g. @code{read} and @code{write}.
21974 This option is typically used to link with a library provided by a HAL BSP.
21975
21976 @end table
21977
21978 @node Nvidia PTX Options
21979 @subsection Nvidia PTX Options
21980 @cindex Nvidia PTX options
21981 @cindex nvptx options
21982
21983 These options are defined for Nvidia PTX:
21984
21985 @table @gcctabopt
21986
21987 @item -m32
21988 @itemx -m64
21989 @opindex m32
21990 @opindex m64
21991 Generate code for 32-bit or 64-bit ABI.
21992
21993 @item -mmainkernel
21994 @opindex mmainkernel
21995 Link in code for a __main kernel. This is for stand-alone instead of
21996 offloading execution.
21997
21998 @item -moptimize
21999 @opindex moptimize
22000 Apply partitioned execution optimizations. This is the default when any
22001 level of optimization is selected.
22002
22003 @item -msoft-stack
22004 @opindex msoft-stack
22005 Generate code that does not use @code{.local} memory
22006 directly for stack storage. Instead, a per-warp stack pointer is
22007 maintained explicitly. This enables variable-length stack allocation (with
22008 variable-length arrays or @code{alloca}), and when global memory is used for
22009 underlying storage, makes it possible to access automatic variables from other
22010 threads, or with atomic instructions. This code generation variant is used
22011 for OpenMP offloading, but the option is exposed on its own for the purpose
22012 of testing the compiler; to generate code suitable for linking into programs
22013 using OpenMP offloading, use option @option{-mgomp}.
22014
22015 @item -muniform-simt
22016 @opindex muniform-simt
22017 Switch to code generation variant that allows to execute all threads in each
22018 warp, while maintaining memory state and side effects as if only one thread
22019 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22020 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22021 current lane index equals the master lane index), and the register being
22022 assigned is copied via a shuffle instruction from the master lane. Outside of
22023 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22024 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22025 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22026 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22027 with current lane index to compute the master lane index.
22028
22029 @item -mgomp
22030 @opindex mgomp
22031 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22032 @option{-muniform-simt} options, and selects corresponding multilib variant.
22033
22034 @end table
22035
22036 @node PDP-11 Options
22037 @subsection PDP-11 Options
22038 @cindex PDP-11 Options
22039
22040 These options are defined for the PDP-11:
22041
22042 @table @gcctabopt
22043 @item -mfpu
22044 @opindex mfpu
22045 Use hardware FPP floating point. This is the default. (FIS floating
22046 point on the PDP-11/40 is not supported.)
22047
22048 @item -msoft-float
22049 @opindex msoft-float
22050 Do not use hardware floating point.
22051
22052 @item -mac0
22053 @opindex mac0
22054 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22055
22056 @item -mno-ac0
22057 @opindex mno-ac0
22058 Return floating-point results in memory. This is the default.
22059
22060 @item -m40
22061 @opindex m40
22062 Generate code for a PDP-11/40.
22063
22064 @item -m45
22065 @opindex m45
22066 Generate code for a PDP-11/45. This is the default.
22067
22068 @item -m10
22069 @opindex m10
22070 Generate code for a PDP-11/10.
22071
22072 @item -mbcopy-builtin
22073 @opindex mbcopy-builtin
22074 Use inline @code{movmemhi} patterns for copying memory. This is the
22075 default.
22076
22077 @item -mbcopy
22078 @opindex mbcopy
22079 Do not use inline @code{movmemhi} patterns for copying memory.
22080
22081 @item -mint16
22082 @itemx -mno-int32
22083 @opindex mint16
22084 @opindex mno-int32
22085 Use 16-bit @code{int}. This is the default.
22086
22087 @item -mint32
22088 @itemx -mno-int16
22089 @opindex mint32
22090 @opindex mno-int16
22091 Use 32-bit @code{int}.
22092
22093 @item -mfloat64
22094 @itemx -mno-float32
22095 @opindex mfloat64
22096 @opindex mno-float32
22097 Use 64-bit @code{float}. This is the default.
22098
22099 @item -mfloat32
22100 @itemx -mno-float64
22101 @opindex mfloat32
22102 @opindex mno-float64
22103 Use 32-bit @code{float}.
22104
22105 @item -mabshi
22106 @opindex mabshi
22107 Use @code{abshi2} pattern. This is the default.
22108
22109 @item -mno-abshi
22110 @opindex mno-abshi
22111 Do not use @code{abshi2} pattern.
22112
22113 @item -mbranch-expensive
22114 @opindex mbranch-expensive
22115 Pretend that branches are expensive. This is for experimenting with
22116 code generation only.
22117
22118 @item -mbranch-cheap
22119 @opindex mbranch-cheap
22120 Do not pretend that branches are expensive. This is the default.
22121
22122 @item -munix-asm
22123 @opindex munix-asm
22124 Use Unix assembler syntax. This is the default when configured for
22125 @samp{pdp11-*-bsd}.
22126
22127 @item -mdec-asm
22128 @opindex mdec-asm
22129 Use DEC assembler syntax. This is the default when configured for any
22130 PDP-11 target other than @samp{pdp11-*-bsd}.
22131 @end table
22132
22133 @node picoChip Options
22134 @subsection picoChip Options
22135 @cindex picoChip options
22136
22137 These @samp{-m} options are defined for picoChip implementations:
22138
22139 @table @gcctabopt
22140
22141 @item -mae=@var{ae_type}
22142 @opindex mcpu
22143 Set the instruction set, register set, and instruction scheduling
22144 parameters for array element type @var{ae_type}. Supported values
22145 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22146
22147 @option{-mae=ANY} selects a completely generic AE type. Code
22148 generated with this option runs on any of the other AE types. The
22149 code is not as efficient as it would be if compiled for a specific
22150 AE type, and some types of operation (e.g., multiplication) do not
22151 work properly on all types of AE.
22152
22153 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22154 for compiled code, and is the default.
22155
22156 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22157 option may suffer from poor performance of byte (char) manipulation,
22158 since the DSP AE does not provide hardware support for byte load/stores.
22159
22160 @item -msymbol-as-address
22161 Enable the compiler to directly use a symbol name as an address in a
22162 load/store instruction, without first loading it into a
22163 register. Typically, the use of this option generates larger
22164 programs, which run faster than when the option isn't used. However, the
22165 results vary from program to program, so it is left as a user option,
22166 rather than being permanently enabled.
22167
22168 @item -mno-inefficient-warnings
22169 Disables warnings about the generation of inefficient code. These
22170 warnings can be generated, for example, when compiling code that
22171 performs byte-level memory operations on the MAC AE type. The MAC AE has
22172 no hardware support for byte-level memory operations, so all byte
22173 load/stores must be synthesized from word load/store operations. This is
22174 inefficient and a warning is generated to indicate
22175 that you should rewrite the code to avoid byte operations, or to target
22176 an AE type that has the necessary hardware support. This option disables
22177 these warnings.
22178
22179 @end table
22180
22181 @node PowerPC Options
22182 @subsection PowerPC Options
22183 @cindex PowerPC options
22184
22185 These are listed under @xref{RS/6000 and PowerPC Options}.
22186
22187 @node PowerPC SPE Options
22188 @subsection PowerPC SPE Options
22189 @cindex PowerPC SPE options
22190
22191 These @samp{-m} options are defined for PowerPC SPE:
22192 @table @gcctabopt
22193 @item -mmfcrf
22194 @itemx -mno-mfcrf
22195 @itemx -mpopcntb
22196 @itemx -mno-popcntb
22197 @opindex mmfcrf
22198 @opindex mno-mfcrf
22199 @opindex mpopcntb
22200 @opindex mno-popcntb
22201 You use these options to specify which instructions are available on the
22202 processor you are using. The default value of these options is
22203 determined when configuring GCC@. Specifying the
22204 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22205 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22206 rather than the options listed above.
22207
22208 The @option{-mmfcrf} option allows GCC to generate the move from
22209 condition register field instruction implemented on the POWER4
22210 processor and other processors that support the PowerPC V2.01
22211 architecture.
22212 The @option{-mpopcntb} option allows GCC to generate the popcount and
22213 double-precision FP reciprocal estimate instruction implemented on the
22214 POWER5 processor and other processors that support the PowerPC V2.02
22215 architecture.
22216
22217 @item -mcpu=@var{cpu_type}
22218 @opindex mcpu
22219 Set architecture type, register usage, and
22220 instruction scheduling parameters for machine type @var{cpu_type}.
22221 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22222 and @samp{native}.
22223
22224 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22225 endian), with an appropriate, generic processor model assumed for
22226 scheduling purposes.
22227
22228 Specifying @samp{native} as cpu type detects and selects the
22229 architecture option that corresponds to the host processor of the
22230 system performing the compilation.
22231 @option{-mcpu=native} has no effect if GCC does not recognize the
22232 processor.
22233
22234 The other options specify a specific processor. Code generated under
22235 those options runs best on that processor, and may not run at all on
22236 others.
22237
22238 The @option{-mcpu} options automatically enable or disable the
22239 following options:
22240
22241 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22242 -mpopcntb -mpopcntd @gol
22243 -msingle-float -mdouble-float @gol
22244 -mfloat128}
22245
22246 The particular options set for any particular CPU varies between
22247 compiler versions, depending on what setting seems to produce optimal
22248 code for that CPU; it doesn't necessarily reflect the actual hardware's
22249 capabilities. If you wish to set an individual option to a particular
22250 value, you may specify it after the @option{-mcpu} option, like
22251 @option{-mcpu=8548}.
22252
22253 @item -mtune=@var{cpu_type}
22254 @opindex mtune
22255 Set the instruction scheduling parameters for machine type
22256 @var{cpu_type}, but do not set the architecture type or register usage,
22257 as @option{-mcpu=@var{cpu_type}} does. The same
22258 values for @var{cpu_type} are used for @option{-mtune} as for
22259 @option{-mcpu}. If both are specified, the code generated uses the
22260 architecture and registers set by @option{-mcpu}, but the
22261 scheduling parameters set by @option{-mtune}.
22262
22263 @item -msecure-plt
22264 @opindex msecure-plt
22265 Generate code that allows @command{ld} and @command{ld.so}
22266 to build executables and shared
22267 libraries with non-executable @code{.plt} and @code{.got} sections.
22268 This is a PowerPC
22269 32-bit SYSV ABI option.
22270
22271 @item -mbss-plt
22272 @opindex mbss-plt
22273 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22274 fills in, and
22275 requires @code{.plt} and @code{.got}
22276 sections that are both writable and executable.
22277 This is a PowerPC 32-bit SYSV ABI option.
22278
22279 @item -misel
22280 @itemx -mno-isel
22281 @opindex misel
22282 @opindex mno-isel
22283 This switch enables or disables the generation of ISEL instructions.
22284
22285 @item -misel=@var{yes/no}
22286 This switch has been deprecated. Use @option{-misel} and
22287 @option{-mno-isel} instead.
22288
22289 @item -mspe
22290 @itemx -mno-spe
22291 @opindex mspe
22292 @opindex mno-spe
22293 This switch enables or disables the generation of SPE simd
22294 instructions.
22295
22296 @item -mspe=@var{yes/no}
22297 This option has been deprecated. Use @option{-mspe} and
22298 @option{-mno-spe} instead.
22299
22300 @item -mfloat128
22301 @itemx -mno-float128
22302 @opindex mfloat128
22303 @opindex mno-float128
22304 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22305 and use either software emulation for IEEE 128-bit floating point or
22306 hardware instructions.
22307
22308 @item -mfloat-gprs=@var{yes/single/double/no}
22309 @itemx -mfloat-gprs
22310 @opindex mfloat-gprs
22311 This switch enables or disables the generation of floating-point
22312 operations on the general-purpose registers for architectures that
22313 support it.
22314
22315 The argument @samp{yes} or @samp{single} enables the use of
22316 single-precision floating-point operations.
22317
22318 The argument @samp{double} enables the use of single and
22319 double-precision floating-point operations.
22320
22321 The argument @samp{no} disables floating-point operations on the
22322 general-purpose registers.
22323
22324 This option is currently only available on the MPC854x.
22325
22326 @item -mfull-toc
22327 @itemx -mno-fp-in-toc
22328 @itemx -mno-sum-in-toc
22329 @itemx -mminimal-toc
22330 @opindex mfull-toc
22331 @opindex mno-fp-in-toc
22332 @opindex mno-sum-in-toc
22333 @opindex mminimal-toc
22334 Modify generation of the TOC (Table Of Contents), which is created for
22335 every executable file. The @option{-mfull-toc} option is selected by
22336 default. In that case, GCC allocates at least one TOC entry for
22337 each unique non-automatic variable reference in your program. GCC
22338 also places floating-point constants in the TOC@. However, only
22339 16,384 entries are available in the TOC@.
22340
22341 If you receive a linker error message that saying you have overflowed
22342 the available TOC space, you can reduce the amount of TOC space used
22343 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22344 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22345 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22346 generate code to calculate the sum of an address and a constant at
22347 run time instead of putting that sum into the TOC@. You may specify one
22348 or both of these options. Each causes GCC to produce very slightly
22349 slower and larger code at the expense of conserving TOC space.
22350
22351 If you still run out of space in the TOC even when you specify both of
22352 these options, specify @option{-mminimal-toc} instead. This option causes
22353 GCC to make only one TOC entry for every file. When you specify this
22354 option, GCC produces code that is slower and larger but which
22355 uses extremely little TOC space. You may wish to use this option
22356 only on files that contain less frequently-executed code.
22357
22358 @item -maix32
22359 @opindex maix32
22360 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
22361
22362 @item -mxl-compat
22363 @itemx -mno-xl-compat
22364 @opindex mxl-compat
22365 @opindex mno-xl-compat
22366 Produce code that conforms more closely to IBM XL compiler semantics
22367 when using AIX-compatible ABI@. Pass floating-point arguments to
22368 prototyped functions beyond the register save area (RSA) on the stack
22369 in addition to argument FPRs. Do not assume that most significant
22370 double in 128-bit long double value is properly rounded when comparing
22371 values and converting to double. Use XL symbol names for long double
22372 support routines.
22373
22374 The AIX calling convention was extended but not initially documented to
22375 handle an obscure K&R C case of calling a function that takes the
22376 address of its arguments with fewer arguments than declared. IBM XL
22377 compilers access floating-point arguments that do not fit in the
22378 RSA from the stack when a subroutine is compiled without
22379 optimization. Because always storing floating-point arguments on the
22380 stack is inefficient and rarely needed, this option is not enabled by
22381 default and only is necessary when calling subroutines compiled by IBM
22382 XL compilers without optimization.
22383
22384 @item -malign-natural
22385 @itemx -malign-power
22386 @opindex malign-natural
22387 @opindex malign-power
22388 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22389 @option{-malign-natural} overrides the ABI-defined alignment of larger
22390 types, such as floating-point doubles, on their natural size-based boundary.
22391 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22392 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22393
22394 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22395 is not supported.
22396
22397 @item -msoft-float
22398 @itemx -mhard-float
22399 @opindex msoft-float
22400 @opindex mhard-float
22401 Generate code that does not use (uses) the floating-point register set.
22402 Software floating-point emulation is provided if you use the
22403 @option{-msoft-float} option, and pass the option to GCC when linking.
22404
22405 @item -msingle-float
22406 @itemx -mdouble-float
22407 @opindex msingle-float
22408 @opindex mdouble-float
22409 Generate code for single- or double-precision floating-point operations.
22410 @option{-mdouble-float} implies @option{-msingle-float}.
22411
22412 @item -mmultiple
22413 @itemx -mno-multiple
22414 @opindex mmultiple
22415 @opindex mno-multiple
22416 Generate code that uses (does not use) the load multiple word
22417 instructions and the store multiple word instructions. These
22418 instructions are generated by default on POWER systems, and not
22419 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22420 PowerPC systems, since those instructions do not work when the
22421 processor is in little-endian mode. The exceptions are PPC740 and
22422 PPC750 which permit these instructions in little-endian mode.
22423
22424 @item -mupdate
22425 @itemx -mno-update
22426 @opindex mupdate
22427 @opindex mno-update
22428 Generate code that uses (does not use) the load or store instructions
22429 that update the base register to the address of the calculated memory
22430 location. These instructions are generated by default. If you use
22431 @option{-mno-update}, there is a small window between the time that the
22432 stack pointer is updated and the address of the previous frame is
22433 stored, which means code that walks the stack frame across interrupts or
22434 signals may get corrupted data.
22435
22436 @item -mavoid-indexed-addresses
22437 @itemx -mno-avoid-indexed-addresses
22438 @opindex mavoid-indexed-addresses
22439 @opindex mno-avoid-indexed-addresses
22440 Generate code that tries to avoid (not avoid) the use of indexed load
22441 or store instructions. These instructions can incur a performance
22442 penalty on Power6 processors in certain situations, such as when
22443 stepping through large arrays that cross a 16M boundary. This option
22444 is enabled by default when targeting Power6 and disabled otherwise.
22445
22446 @item -mfused-madd
22447 @itemx -mno-fused-madd
22448 @opindex mfused-madd
22449 @opindex mno-fused-madd
22450 Generate code that uses (does not use) the floating-point multiply and
22451 accumulate instructions. These instructions are generated by default
22452 if hardware floating point is used. The machine-dependent
22453 @option{-mfused-madd} option is now mapped to the machine-independent
22454 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22455 mapped to @option{-ffp-contract=off}.
22456
22457 @item -mno-strict-align
22458 @itemx -mstrict-align
22459 @opindex mno-strict-align
22460 @opindex mstrict-align
22461 On System V.4 and embedded PowerPC systems do not (do) assume that
22462 unaligned memory references are handled by the system.
22463
22464 @item -mrelocatable
22465 @itemx -mno-relocatable
22466 @opindex mrelocatable
22467 @opindex mno-relocatable
22468 Generate code that allows (does not allow) a static executable to be
22469 relocated to a different address at run time. A simple embedded
22470 PowerPC system loader should relocate the entire contents of
22471 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22472 a table of 32-bit addresses generated by this option. For this to
22473 work, all objects linked together must be compiled with
22474 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22475 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22476
22477 @item -mrelocatable-lib
22478 @itemx -mno-relocatable-lib
22479 @opindex mrelocatable-lib
22480 @opindex mno-relocatable-lib
22481 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22482 @code{.fixup} section to allow static executables to be relocated at
22483 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22484 alignment of @option{-mrelocatable}. Objects compiled with
22485 @option{-mrelocatable-lib} may be linked with objects compiled with
22486 any combination of the @option{-mrelocatable} options.
22487
22488 @item -mno-toc
22489 @itemx -mtoc
22490 @opindex mno-toc
22491 @opindex mtoc
22492 On System V.4 and embedded PowerPC systems do not (do) assume that
22493 register 2 contains a pointer to a global area pointing to the addresses
22494 used in the program.
22495
22496 @item -mlittle
22497 @itemx -mlittle-endian
22498 @opindex mlittle
22499 @opindex mlittle-endian
22500 On System V.4 and embedded PowerPC systems compile code for the
22501 processor in little-endian mode. The @option{-mlittle-endian} option is
22502 the same as @option{-mlittle}.
22503
22504 @item -mbig
22505 @itemx -mbig-endian
22506 @opindex mbig
22507 @opindex mbig-endian
22508 On System V.4 and embedded PowerPC systems compile code for the
22509 processor in big-endian mode. The @option{-mbig-endian} option is
22510 the same as @option{-mbig}.
22511
22512 @item -mdynamic-no-pic
22513 @opindex mdynamic-no-pic
22514 On Darwin and Mac OS X systems, compile code so that it is not
22515 relocatable, but that its external references are relocatable. The
22516 resulting code is suitable for applications, but not shared
22517 libraries.
22518
22519 @item -msingle-pic-base
22520 @opindex msingle-pic-base
22521 Treat the register used for PIC addressing as read-only, rather than
22522 loading it in the prologue for each function. The runtime system is
22523 responsible for initializing this register with an appropriate value
22524 before execution begins.
22525
22526 @item -mprioritize-restricted-insns=@var{priority}
22527 @opindex mprioritize-restricted-insns
22528 This option controls the priority that is assigned to
22529 dispatch-slot restricted instructions during the second scheduling
22530 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22531 or @samp{2} to assign no, highest, or second-highest (respectively)
22532 priority to dispatch-slot restricted
22533 instructions.
22534
22535 @item -msched-costly-dep=@var{dependence_type}
22536 @opindex msched-costly-dep
22537 This option controls which dependences are considered costly
22538 by the target during instruction scheduling. The argument
22539 @var{dependence_type} takes one of the following values:
22540
22541 @table @asis
22542 @item @samp{no}
22543 No dependence is costly.
22544
22545 @item @samp{all}
22546 All dependences are costly.
22547
22548 @item @samp{true_store_to_load}
22549 A true dependence from store to load is costly.
22550
22551 @item @samp{store_to_load}
22552 Any dependence from store to load is costly.
22553
22554 @item @var{number}
22555 Any dependence for which the latency is greater than or equal to
22556 @var{number} is costly.
22557 @end table
22558
22559 @item -minsert-sched-nops=@var{scheme}
22560 @opindex minsert-sched-nops
22561 This option controls which NOP insertion scheme is used during
22562 the second scheduling pass. The argument @var{scheme} takes one of the
22563 following values:
22564
22565 @table @asis
22566 @item @samp{no}
22567 Don't insert NOPs.
22568
22569 @item @samp{pad}
22570 Pad with NOPs any dispatch group that has vacant issue slots,
22571 according to the scheduler's grouping.
22572
22573 @item @samp{regroup_exact}
22574 Insert NOPs to force costly dependent insns into
22575 separate groups. Insert exactly as many NOPs as needed to force an insn
22576 to a new group, according to the estimated processor grouping.
22577
22578 @item @var{number}
22579 Insert NOPs to force costly dependent insns into
22580 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22581 @end table
22582
22583 @item -mcall-sysv
22584 @opindex mcall-sysv
22585 On System V.4 and embedded PowerPC systems compile code using calling
22586 conventions that adhere to the March 1995 draft of the System V
22587 Application Binary Interface, PowerPC processor supplement. This is the
22588 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22589
22590 @item -mcall-sysv-eabi
22591 @itemx -mcall-eabi
22592 @opindex mcall-sysv-eabi
22593 @opindex mcall-eabi
22594 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22595
22596 @item -mcall-sysv-noeabi
22597 @opindex mcall-sysv-noeabi
22598 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22599
22600 @item -mcall-aixdesc
22601 @opindex m
22602 On System V.4 and embedded PowerPC systems compile code for the AIX
22603 operating system.
22604
22605 @item -mcall-linux
22606 @opindex mcall-linux
22607 On System V.4 and embedded PowerPC systems compile code for the
22608 Linux-based GNU system.
22609
22610 @item -mcall-freebsd
22611 @opindex mcall-freebsd
22612 On System V.4 and embedded PowerPC systems compile code for the
22613 FreeBSD operating system.
22614
22615 @item -mcall-netbsd
22616 @opindex mcall-netbsd
22617 On System V.4 and embedded PowerPC systems compile code for the
22618 NetBSD operating system.
22619
22620 @item -mcall-openbsd
22621 @opindex mcall-netbsd
22622 On System V.4 and embedded PowerPC systems compile code for the
22623 OpenBSD operating system.
22624
22625 @item -maix-struct-return
22626 @opindex maix-struct-return
22627 Return all structures in memory (as specified by the AIX ABI)@.
22628
22629 @item -msvr4-struct-return
22630 @opindex msvr4-struct-return
22631 Return structures smaller than 8 bytes in registers (as specified by the
22632 SVR4 ABI)@.
22633
22634 @item -mabi=@var{abi-type}
22635 @opindex mabi
22636 Extend the current ABI with a particular extension, or remove such extension.
22637 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22638 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22639 @samp{elfv1}, @samp{elfv2}@.
22640
22641 @item -mabi=spe
22642 @opindex mabi=spe
22643 Extend the current ABI with SPE ABI extensions. This does not change
22644 the default ABI, instead it adds the SPE ABI extensions to the current
22645 ABI@.
22646
22647 @item -mabi=no-spe
22648 @opindex mabi=no-spe
22649 Disable Book-E SPE ABI extensions for the current ABI@.
22650
22651 @item -mabi=ibmlongdouble
22652 @opindex mabi=ibmlongdouble
22653 Change the current ABI to use IBM extended-precision long double.
22654 This is not likely to work if your system defaults to using IEEE
22655 extended-precision long double. If you change the long double type
22656 from IEEE extended-precision, the compiler will issue a warning unless
22657 you use the @option{-Wno-psabi} option.
22658
22659 @item -mabi=ieeelongdouble
22660 @opindex mabi=ieeelongdouble
22661 Change the current ABI to use IEEE extended-precision long double.
22662 This is not likely to work if your system defaults to using IBM
22663 extended-precision long double. If you change the long double type
22664 from IBM extended-precision, the compiler will issue a warning unless
22665 you use the @option{-Wno-psabi} option.
22666
22667 @item -mabi=elfv1
22668 @opindex mabi=elfv1
22669 Change the current ABI to use the ELFv1 ABI.
22670 This is the default ABI for big-endian PowerPC 64-bit Linux.
22671 Overriding the default ABI requires special system support and is
22672 likely to fail in spectacular ways.
22673
22674 @item -mabi=elfv2
22675 @opindex mabi=elfv2
22676 Change the current ABI to use the ELFv2 ABI.
22677 This is the default ABI for little-endian PowerPC 64-bit Linux.
22678 Overriding the default ABI requires special system support and is
22679 likely to fail in spectacular ways.
22680
22681 @item -mgnu-attribute
22682 @itemx -mno-gnu-attribute
22683 @opindex mgnu-attribute
22684 @opindex mno-gnu-attribute
22685 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22686 .gnu.attributes section that specify ABI variations in function
22687 parameters or return values.
22688
22689 @item -mprototype
22690 @itemx -mno-prototype
22691 @opindex mprototype
22692 @opindex mno-prototype
22693 On System V.4 and embedded PowerPC systems assume that all calls to
22694 variable argument functions are properly prototyped. Otherwise, the
22695 compiler must insert an instruction before every non-prototyped call to
22696 set or clear bit 6 of the condition code register (@code{CR}) to
22697 indicate whether floating-point values are passed in the floating-point
22698 registers in case the function takes variable arguments. With
22699 @option{-mprototype}, only calls to prototyped variable argument functions
22700 set or clear the bit.
22701
22702 @item -msim
22703 @opindex msim
22704 On embedded PowerPC systems, assume that the startup module is called
22705 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22706 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22707 configurations.
22708
22709 @item -mmvme
22710 @opindex mmvme
22711 On embedded PowerPC systems, assume that the startup module is called
22712 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22713 @file{libc.a}.
22714
22715 @item -mads
22716 @opindex mads
22717 On embedded PowerPC systems, assume that the startup module is called
22718 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22719 @file{libc.a}.
22720
22721 @item -myellowknife
22722 @opindex myellowknife
22723 On embedded PowerPC systems, assume that the startup module is called
22724 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22725 @file{libc.a}.
22726
22727 @item -mvxworks
22728 @opindex mvxworks
22729 On System V.4 and embedded PowerPC systems, specify that you are
22730 compiling for a VxWorks system.
22731
22732 @item -memb
22733 @opindex memb
22734 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22735 header to indicate that @samp{eabi} extended relocations are used.
22736
22737 @item -meabi
22738 @itemx -mno-eabi
22739 @opindex meabi
22740 @opindex mno-eabi
22741 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22742 Embedded Applications Binary Interface (EABI), which is a set of
22743 modifications to the System V.4 specifications. Selecting @option{-meabi}
22744 means that the stack is aligned to an 8-byte boundary, a function
22745 @code{__eabi} is called from @code{main} to set up the EABI
22746 environment, and the @option{-msdata} option can use both @code{r2} and
22747 @code{r13} to point to two separate small data areas. Selecting
22748 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22749 no EABI initialization function is called from @code{main}, and the
22750 @option{-msdata} option only uses @code{r13} to point to a single
22751 small data area. The @option{-meabi} option is on by default if you
22752 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22753
22754 @item -msdata=eabi
22755 @opindex msdata=eabi
22756 On System V.4 and embedded PowerPC systems, put small initialized
22757 @code{const} global and static data in the @code{.sdata2} section, which
22758 is pointed to by register @code{r2}. Put small initialized
22759 non-@code{const} global and static data in the @code{.sdata} section,
22760 which is pointed to by register @code{r13}. Put small uninitialized
22761 global and static data in the @code{.sbss} section, which is adjacent to
22762 the @code{.sdata} section. The @option{-msdata=eabi} option is
22763 incompatible with the @option{-mrelocatable} option. The
22764 @option{-msdata=eabi} option also sets the @option{-memb} option.
22765
22766 @item -msdata=sysv
22767 @opindex msdata=sysv
22768 On System V.4 and embedded PowerPC systems, put small global and static
22769 data in the @code{.sdata} section, which is pointed to by register
22770 @code{r13}. Put small uninitialized global and static data in the
22771 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22772 The @option{-msdata=sysv} option is incompatible with the
22773 @option{-mrelocatable} option.
22774
22775 @item -msdata=default
22776 @itemx -msdata
22777 @opindex msdata=default
22778 @opindex msdata
22779 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22780 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22781 same as @option{-msdata=sysv}.
22782
22783 @item -msdata=data
22784 @opindex msdata=data
22785 On System V.4 and embedded PowerPC systems, put small global
22786 data in the @code{.sdata} section. Put small uninitialized global
22787 data in the @code{.sbss} section. Do not use register @code{r13}
22788 to address small data however. This is the default behavior unless
22789 other @option{-msdata} options are used.
22790
22791 @item -msdata=none
22792 @itemx -mno-sdata
22793 @opindex msdata=none
22794 @opindex mno-sdata
22795 On embedded PowerPC systems, put all initialized global and static data
22796 in the @code{.data} section, and all uninitialized data in the
22797 @code{.bss} section.
22798
22799 @item -mblock-move-inline-limit=@var{num}
22800 @opindex mblock-move-inline-limit
22801 Inline all block moves (such as calls to @code{memcpy} or structure
22802 copies) less than or equal to @var{num} bytes. The minimum value for
22803 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22804 targets. The default value is target-specific.
22805
22806 @item -G @var{num}
22807 @opindex G
22808 @cindex smaller data references (PowerPC)
22809 @cindex .sdata/.sdata2 references (PowerPC)
22810 On embedded PowerPC systems, put global and static items less than or
22811 equal to @var{num} bytes into the small data or BSS sections instead of
22812 the normal data or BSS section. By default, @var{num} is 8. The
22813 @option{-G @var{num}} switch is also passed to the linker.
22814 All modules should be compiled with the same @option{-G @var{num}} value.
22815
22816 @item -mregnames
22817 @itemx -mno-regnames
22818 @opindex mregnames
22819 @opindex mno-regnames
22820 On System V.4 and embedded PowerPC systems do (do not) emit register
22821 names in the assembly language output using symbolic forms.
22822
22823 @item -mlongcall
22824 @itemx -mno-longcall
22825 @opindex mlongcall
22826 @opindex mno-longcall
22827 By default assume that all calls are far away so that a longer and more
22828 expensive calling sequence is required. This is required for calls
22829 farther than 32 megabytes (33,554,432 bytes) from the current location.
22830 A short call is generated if the compiler knows
22831 the call cannot be that far away. This setting can be overridden by
22832 the @code{shortcall} function attribute, or by @code{#pragma
22833 longcall(0)}.
22834
22835 Some linkers are capable of detecting out-of-range calls and generating
22836 glue code on the fly. On these systems, long calls are unnecessary and
22837 generate slower code. As of this writing, the AIX linker can do this,
22838 as can the GNU linker for PowerPC/64. It is planned to add this feature
22839 to the GNU linker for 32-bit PowerPC systems as well.
22840
22841 In the future, GCC may ignore all longcall specifications
22842 when the linker is known to generate glue.
22843
22844 @item -mtls-markers
22845 @itemx -mno-tls-markers
22846 @opindex mtls-markers
22847 @opindex mno-tls-markers
22848 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22849 specifying the function argument. The relocation allows the linker to
22850 reliably associate function call with argument setup instructions for
22851 TLS optimization, which in turn allows GCC to better schedule the
22852 sequence.
22853
22854 @item -mrecip
22855 @itemx -mno-recip
22856 @opindex mrecip
22857 This option enables use of the reciprocal estimate and
22858 reciprocal square root estimate instructions with additional
22859 Newton-Raphson steps to increase precision instead of doing a divide or
22860 square root and divide for floating-point arguments. You should use
22861 the @option{-ffast-math} option when using @option{-mrecip} (or at
22862 least @option{-funsafe-math-optimizations},
22863 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22864 @option{-fno-trapping-math}). Note that while the throughput of the
22865 sequence is generally higher than the throughput of the non-reciprocal
22866 instruction, the precision of the sequence can be decreased by up to 2
22867 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22868 roots.
22869
22870 @item -mrecip=@var{opt}
22871 @opindex mrecip=opt
22872 This option controls which reciprocal estimate instructions
22873 may be used. @var{opt} is a comma-separated list of options, which may
22874 be preceded by a @code{!} to invert the option:
22875
22876 @table @samp
22877
22878 @item all
22879 Enable all estimate instructions.
22880
22881 @item default
22882 Enable the default instructions, equivalent to @option{-mrecip}.
22883
22884 @item none
22885 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22886
22887 @item div
22888 Enable the reciprocal approximation instructions for both
22889 single and double precision.
22890
22891 @item divf
22892 Enable the single-precision reciprocal approximation instructions.
22893
22894 @item divd
22895 Enable the double-precision reciprocal approximation instructions.
22896
22897 @item rsqrt
22898 Enable the reciprocal square root approximation instructions for both
22899 single and double precision.
22900
22901 @item rsqrtf
22902 Enable the single-precision reciprocal square root approximation instructions.
22903
22904 @item rsqrtd
22905 Enable the double-precision reciprocal square root approximation instructions.
22906
22907 @end table
22908
22909 So, for example, @option{-mrecip=all,!rsqrtd} enables
22910 all of the reciprocal estimate instructions, except for the
22911 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22912 which handle the double-precision reciprocal square root calculations.
22913
22914 @item -mrecip-precision
22915 @itemx -mno-recip-precision
22916 @opindex mrecip-precision
22917 Assume (do not assume) that the reciprocal estimate instructions
22918 provide higher-precision estimates than is mandated by the PowerPC
22919 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22920 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22921 The double-precision square root estimate instructions are not generated by
22922 default on low-precision machines, since they do not provide an
22923 estimate that converges after three steps.
22924
22925 @item -mpointers-to-nested-functions
22926 @itemx -mno-pointers-to-nested-functions
22927 @opindex mpointers-to-nested-functions
22928 Generate (do not generate) code to load up the static chain register
22929 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22930 systems where a function pointer points to a 3-word descriptor giving
22931 the function address, TOC value to be loaded in register @code{r2}, and
22932 static chain value to be loaded in register @code{r11}. The
22933 @option{-mpointers-to-nested-functions} is on by default. You cannot
22934 call through pointers to nested functions or pointers
22935 to functions compiled in other languages that use the static chain if
22936 you use @option{-mno-pointers-to-nested-functions}.
22937
22938 @item -msave-toc-indirect
22939 @itemx -mno-save-toc-indirect
22940 @opindex msave-toc-indirect
22941 Generate (do not generate) code to save the TOC value in the reserved
22942 stack location in the function prologue if the function calls through
22943 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22944 saved in the prologue, it is saved just before the call through the
22945 pointer. The @option{-mno-save-toc-indirect} option is the default.
22946
22947 @item -mcompat-align-parm
22948 @itemx -mno-compat-align-parm
22949 @opindex mcompat-align-parm
22950 Generate (do not generate) code to pass structure parameters with a
22951 maximum alignment of 64 bits, for compatibility with older versions
22952 of GCC.
22953
22954 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22955 structure parameter on a 128-bit boundary when that structure contained
22956 a member requiring 128-bit alignment. This is corrected in more
22957 recent versions of GCC. This option may be used to generate code
22958 that is compatible with functions compiled with older versions of
22959 GCC.
22960
22961 The @option{-mno-compat-align-parm} option is the default.
22962
22963 @item -mstack-protector-guard=@var{guard}
22964 @itemx -mstack-protector-guard-reg=@var{reg}
22965 @itemx -mstack-protector-guard-offset=@var{offset}
22966 @itemx -mstack-protector-guard-symbol=@var{symbol}
22967 @opindex mstack-protector-guard
22968 @opindex mstack-protector-guard-reg
22969 @opindex mstack-protector-guard-offset
22970 @opindex mstack-protector-guard-symbol
22971 Generate stack protection code using canary at @var{guard}. Supported
22972 locations are @samp{global} for global canary or @samp{tls} for per-thread
22973 canary in the TLS block (the default with GNU libc version 2.4 or later).
22974
22975 With the latter choice the options
22976 @option{-mstack-protector-guard-reg=@var{reg}} and
22977 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
22978 which register to use as base register for reading the canary, and from what
22979 offset from that base register. The default for those is as specified in the
22980 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
22981 the offset with a symbol reference to a canary in the TLS block.
22982 @end table
22983
22984
22985 @node RISC-V Options
22986 @subsection RISC-V Options
22987 @cindex RISC-V Options
22988
22989 These command-line options are defined for RISC-V targets:
22990
22991 @table @gcctabopt
22992 @item -mbranch-cost=@var{n}
22993 @opindex mbranch-cost
22994 Set the cost of branches to roughly @var{n} instructions.
22995
22996 @item -mplt
22997 @itemx -mno-plt
22998 @opindex plt
22999 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23000 non-PIC. The default is @option{-mplt}.
23001
23002 @item -mabi=@var{ABI-string}
23003 @opindex mabi
23004 Specify integer and floating-point calling convention. @var{ABI-string}
23005 contains two parts: the size of integer types and the registers used for
23006 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23007 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23008 32-bit), and that floating-point values up to 64 bits wide are passed in F
23009 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23010 allows the compiler to generate code that uses the F and D extensions but only
23011 allows floating-point values up to 32 bits long to be passed in registers; or
23012 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23013 passed in registers.
23014
23015 The default for this argument is system dependent, users who want a specific
23016 calling convention should specify one explicitly. The valid calling
23017 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23018 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23019 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23020 invalid because the ABI requires 64-bit values be passed in F registers, but F
23021 registers are only 32 bits wide.
23022
23023 @item -mfdiv
23024 @itemx -mno-fdiv
23025 @opindex mfdiv
23026 Do or don't use hardware floating-point divide and square root instructions.
23027 This requires the F or D extensions for floating-point registers. The default
23028 is to use them if the specified architecture has these instructions.
23029
23030 @item -mdiv
23031 @itemx -mno-div
23032 @opindex mdiv
23033 Do or don't use hardware instructions for integer division. This requires the
23034 M extension. The default is to use them if the specified architecture has
23035 these instructions.
23036
23037 @item -march=@var{ISA-string}
23038 @opindex march
23039 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
23040 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}.
23041
23042 @item -mtune=@var{processor-string}
23043 @opindex mtune
23044 Optimize the output for the given processor, specified by microarchitecture
23045 name.
23046
23047 @item -mpreferred-stack-boundary=@var{num}
23048 @opindex mpreferred-stack-boundary
23049 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23050 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23051 the default is 4 (16 bytes or 128-bits).
23052
23053 @strong{Warning:} If you use this switch, then you must build all modules with
23054 the same value, including any libraries. This includes the system libraries
23055 and startup modules.
23056
23057 @item -msmall-data-limit=@var{n}
23058 @opindex msmall-data-limit
23059 Put global and static data smaller than @var{n} bytes into a special section
23060 (on some targets).
23061
23062 @item -msave-restore
23063 @itemx -mno-save-restore
23064 @opindex msave-restore
23065 Do or don't use smaller but slower prologue and epilogue code that uses
23066 library function calls. The default is to use fast inline prologues and
23067 epilogues.
23068
23069 @item -mstrict-align
23070 @itemx -mno-strict-align
23071 @opindex mstrict-align
23072 Do not or do generate unaligned memory accesses. The default is set depending
23073 on whether the processor we are optimizing for supports fast unaligned access
23074 or not.
23075
23076 @item -mcmodel=medlow
23077 @opindex mcmodel=medlow
23078 Generate code for the medium-low code model. The program and its statically
23079 defined symbols must lie within a single 2 GiB address range and must lie
23080 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23081 statically or dynamically linked. This is the default code model.
23082
23083 @item -mcmodel=medany
23084 @opindex mcmodel=medany
23085 Generate code for the medium-any code model. The program and its statically
23086 defined symbols must be within any single 2 GiB address range. Programs can be
23087 statically or dynamically linked.
23088
23089 @item -mexplicit-relocs
23090 @itemx -mno-exlicit-relocs
23091 Use or do not use assembler relocation operators when dealing with symbolic
23092 addresses. The alternative is to use assembler macros instead, which may
23093 limit optimization.
23094
23095 @item -mrelax
23096 @itemx -mno-relax
23097 Take advantage of linker relaxations to reduce the number of instructions
23098 required to materialize symbol addresses. The default is to take advantage of
23099 linker relaxations.
23100
23101 @end table
23102
23103 @node RL78 Options
23104 @subsection RL78 Options
23105 @cindex RL78 Options
23106
23107 @table @gcctabopt
23108
23109 @item -msim
23110 @opindex msim
23111 Links in additional target libraries to support operation within a
23112 simulator.
23113
23114 @item -mmul=none
23115 @itemx -mmul=g10
23116 @itemx -mmul=g13
23117 @itemx -mmul=g14
23118 @itemx -mmul=rl78
23119 @opindex mmul
23120 Specifies the type of hardware multiplication and division support to
23121 be used. The simplest is @code{none}, which uses software for both
23122 multiplication and division. This is the default. The @code{g13}
23123 value is for the hardware multiply/divide peripheral found on the
23124 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23125 the multiplication and division instructions supported by the RL78/G14
23126 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23127 the value @code{mg10} is an alias for @code{none}.
23128
23129 In addition a C preprocessor macro is defined, based upon the setting
23130 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23131 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23132
23133 @item -mcpu=g10
23134 @itemx -mcpu=g13
23135 @itemx -mcpu=g14
23136 @itemx -mcpu=rl78
23137 @opindex mcpu
23138 Specifies the RL78 core to target. The default is the G14 core, also
23139 known as an S3 core or just RL78. The G13 or S2 core does not have
23140 multiply or divide instructions, instead it uses a hardware peripheral
23141 for these operations. The G10 or S1 core does not have register
23142 banks, so it uses a different calling convention.
23143
23144 If this option is set it also selects the type of hardware multiply
23145 support to use, unless this is overridden by an explicit
23146 @option{-mmul=none} option on the command line. Thus specifying
23147 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23148 peripheral and specifying @option{-mcpu=g10} disables the use of
23149 hardware multiplications altogether.
23150
23151 Note, although the RL78/G14 core is the default target, specifying
23152 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23153 change the behavior of the toolchain since it also enables G14
23154 hardware multiply support. If these options are not specified on the
23155 command line then software multiplication routines will be used even
23156 though the code targets the RL78 core. This is for backwards
23157 compatibility with older toolchains which did not have hardware
23158 multiply and divide support.
23159
23160 In addition a C preprocessor macro is defined, based upon the setting
23161 of this option. Possible values are: @code{__RL78_G10__},
23162 @code{__RL78_G13__} or @code{__RL78_G14__}.
23163
23164 @item -mg10
23165 @itemx -mg13
23166 @itemx -mg14
23167 @itemx -mrl78
23168 @opindex mg10
23169 @opindex mg13
23170 @opindex mg14
23171 @opindex mrl78
23172 These are aliases for the corresponding @option{-mcpu=} option. They
23173 are provided for backwards compatibility.
23174
23175 @item -mallregs
23176 @opindex mallregs
23177 Allow the compiler to use all of the available registers. By default
23178 registers @code{r24..r31} are reserved for use in interrupt handlers.
23179 With this option enabled these registers can be used in ordinary
23180 functions as well.
23181
23182 @item -m64bit-doubles
23183 @itemx -m32bit-doubles
23184 @opindex m64bit-doubles
23185 @opindex m32bit-doubles
23186 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23187 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23188 @option{-m32bit-doubles}.
23189
23190 @item -msave-mduc-in-interrupts
23191 @itemx -mno-save-mduc-in-interrupts
23192 @opindex msave-mduc-in-interrupts
23193 @opindex mno-save-mduc-in-interrupts
23194 Specifies that interrupt handler functions should preserve the
23195 MDUC registers. This is only necessary if normal code might use
23196 the MDUC registers, for example because it performs multiplication
23197 and division operations. The default is to ignore the MDUC registers
23198 as this makes the interrupt handlers faster. The target option -mg13
23199 needs to be passed for this to work as this feature is only available
23200 on the G13 target (S2 core). The MDUC registers will only be saved
23201 if the interrupt handler performs a multiplication or division
23202 operation or it calls another function.
23203
23204 @end table
23205
23206 @node RS/6000 and PowerPC Options
23207 @subsection IBM RS/6000 and PowerPC Options
23208 @cindex RS/6000 and PowerPC Options
23209 @cindex IBM RS/6000 and PowerPC Options
23210
23211 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23212 @table @gcctabopt
23213 @item -mpowerpc-gpopt
23214 @itemx -mno-powerpc-gpopt
23215 @itemx -mpowerpc-gfxopt
23216 @itemx -mno-powerpc-gfxopt
23217 @need 800
23218 @itemx -mpowerpc64
23219 @itemx -mno-powerpc64
23220 @itemx -mmfcrf
23221 @itemx -mno-mfcrf
23222 @itemx -mpopcntb
23223 @itemx -mno-popcntb
23224 @itemx -mpopcntd
23225 @itemx -mno-popcntd
23226 @itemx -mfprnd
23227 @itemx -mno-fprnd
23228 @need 800
23229 @itemx -mcmpb
23230 @itemx -mno-cmpb
23231 @itemx -mmfpgpr
23232 @itemx -mno-mfpgpr
23233 @itemx -mhard-dfp
23234 @itemx -mno-hard-dfp
23235 @opindex mpowerpc-gpopt
23236 @opindex mno-powerpc-gpopt
23237 @opindex mpowerpc-gfxopt
23238 @opindex mno-powerpc-gfxopt
23239 @opindex mpowerpc64
23240 @opindex mno-powerpc64
23241 @opindex mmfcrf
23242 @opindex mno-mfcrf
23243 @opindex mpopcntb
23244 @opindex mno-popcntb
23245 @opindex mpopcntd
23246 @opindex mno-popcntd
23247 @opindex mfprnd
23248 @opindex mno-fprnd
23249 @opindex mcmpb
23250 @opindex mno-cmpb
23251 @opindex mmfpgpr
23252 @opindex mno-mfpgpr
23253 @opindex mhard-dfp
23254 @opindex mno-hard-dfp
23255 You use these options to specify which instructions are available on the
23256 processor you are using. The default value of these options is
23257 determined when configuring GCC@. Specifying the
23258 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23259 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23260 rather than the options listed above.
23261
23262 Specifying @option{-mpowerpc-gpopt} allows
23263 GCC to use the optional PowerPC architecture instructions in the
23264 General Purpose group, including floating-point square root. Specifying
23265 @option{-mpowerpc-gfxopt} allows GCC to
23266 use the optional PowerPC architecture instructions in the Graphics
23267 group, including floating-point select.
23268
23269 The @option{-mmfcrf} option allows GCC to generate the move from
23270 condition register field instruction implemented on the POWER4
23271 processor and other processors that support the PowerPC V2.01
23272 architecture.
23273 The @option{-mpopcntb} option allows GCC to generate the popcount and
23274 double-precision FP reciprocal estimate instruction implemented on the
23275 POWER5 processor and other processors that support the PowerPC V2.02
23276 architecture.
23277 The @option{-mpopcntd} option allows GCC to generate the popcount
23278 instruction implemented on the POWER7 processor and other processors
23279 that support the PowerPC V2.06 architecture.
23280 The @option{-mfprnd} option allows GCC to generate the FP round to
23281 integer instructions implemented on the POWER5+ processor and other
23282 processors that support the PowerPC V2.03 architecture.
23283 The @option{-mcmpb} option allows GCC to generate the compare bytes
23284 instruction implemented on the POWER6 processor and other processors
23285 that support the PowerPC V2.05 architecture.
23286 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23287 general-purpose register instructions implemented on the POWER6X
23288 processor and other processors that support the extended PowerPC V2.05
23289 architecture.
23290 The @option{-mhard-dfp} option allows GCC to generate the decimal
23291 floating-point instructions implemented on some POWER processors.
23292
23293 The @option{-mpowerpc64} option allows GCC to generate the additional
23294 64-bit instructions that are found in the full PowerPC64 architecture
23295 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23296 @option{-mno-powerpc64}.
23297
23298 @item -mcpu=@var{cpu_type}
23299 @opindex mcpu
23300 Set architecture type, register usage, and
23301 instruction scheduling parameters for machine type @var{cpu_type}.
23302 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23303 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23304 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23305 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23306 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23307 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23308 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23309 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23310 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23311 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23312 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23313 @samp{rs64}, and @samp{native}.
23314
23315 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23316 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23317 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23318 architecture machine types, with an appropriate, generic processor
23319 model assumed for scheduling purposes.
23320
23321 Specifying @samp{native} as cpu type detects and selects the
23322 architecture option that corresponds to the host processor of the
23323 system performing the compilation.
23324 @option{-mcpu=native} has no effect if GCC does not recognize the
23325 processor.
23326
23327 The other options specify a specific processor. Code generated under
23328 those options runs best on that processor, and may not run at all on
23329 others.
23330
23331 The @option{-mcpu} options automatically enable or disable the
23332 following options:
23333
23334 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23335 -mpopcntb -mpopcntd -mpowerpc64 @gol
23336 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
23337 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23338 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
23339 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23340
23341 The particular options set for any particular CPU varies between
23342 compiler versions, depending on what setting seems to produce optimal
23343 code for that CPU; it doesn't necessarily reflect the actual hardware's
23344 capabilities. If you wish to set an individual option to a particular
23345 value, you may specify it after the @option{-mcpu} option, like
23346 @option{-mcpu=970 -mno-altivec}.
23347
23348 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23349 not enabled or disabled by the @option{-mcpu} option at present because
23350 AIX does not have full support for these options. You may still
23351 enable or disable them individually if you're sure it'll work in your
23352 environment.
23353
23354 @item -mtune=@var{cpu_type}
23355 @opindex mtune
23356 Set the instruction scheduling parameters for machine type
23357 @var{cpu_type}, but do not set the architecture type or register usage,
23358 as @option{-mcpu=@var{cpu_type}} does. The same
23359 values for @var{cpu_type} are used for @option{-mtune} as for
23360 @option{-mcpu}. If both are specified, the code generated uses the
23361 architecture and registers set by @option{-mcpu}, but the
23362 scheduling parameters set by @option{-mtune}.
23363
23364 @item -mcmodel=small
23365 @opindex mcmodel=small
23366 Generate PowerPC64 code for the small model: The TOC is limited to
23367 64k.
23368
23369 @item -mcmodel=medium
23370 @opindex mcmodel=medium
23371 Generate PowerPC64 code for the medium model: The TOC and other static
23372 data may be up to a total of 4G in size. This is the default for 64-bit
23373 Linux.
23374
23375 @item -mcmodel=large
23376 @opindex mcmodel=large
23377 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23378 in size. Other data and code is only limited by the 64-bit address
23379 space.
23380
23381 @item -maltivec
23382 @itemx -mno-altivec
23383 @opindex maltivec
23384 @opindex mno-altivec
23385 Generate code that uses (does not use) AltiVec instructions, and also
23386 enable the use of built-in functions that allow more direct access to
23387 the AltiVec instruction set. You may also need to set
23388 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23389 enhancements.
23390
23391 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23392 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23393 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23394 match array element order corresponding to the endianness of the
23395 target. That is, element zero identifies the leftmost element in a
23396 vector register when targeting a big-endian platform, and identifies
23397 the rightmost element in a vector register when targeting a
23398 little-endian platform.
23399
23400 @item -maltivec=be
23401 @opindex maltivec=be
23402 Generate AltiVec instructions using big-endian element order,
23403 regardless of whether the target is big- or little-endian. This is
23404 the default when targeting a big-endian platform. Using this option
23405 is currently deprecated. Support for this feature will be removed in
23406 GCC 9.
23407
23408 The element order is used to interpret element numbers in AltiVec
23409 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23410 @code{vec_insert}. By default, these match array element order
23411 corresponding to the endianness for the target.
23412
23413 @item -maltivec=le
23414 @opindex maltivec=le
23415 Generate AltiVec instructions using little-endian element order,
23416 regardless of whether the target is big- or little-endian. This is
23417 the default when targeting a little-endian platform. This option is
23418 currently ignored when targeting a big-endian platform.
23419
23420 The element order is used to interpret element numbers in AltiVec
23421 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23422 @code{vec_insert}. By default, these match array element order
23423 corresponding to the endianness for the target.
23424
23425 @item -mvrsave
23426 @itemx -mno-vrsave
23427 @opindex mvrsave
23428 @opindex mno-vrsave
23429 Generate VRSAVE instructions when generating AltiVec code.
23430
23431 @item -msecure-plt
23432 @opindex msecure-plt
23433 Generate code that allows @command{ld} and @command{ld.so}
23434 to build executables and shared
23435 libraries with non-executable @code{.plt} and @code{.got} sections.
23436 This is a PowerPC
23437 32-bit SYSV ABI option.
23438
23439 @item -mbss-plt
23440 @opindex mbss-plt
23441 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23442 fills in, and
23443 requires @code{.plt} and @code{.got}
23444 sections that are both writable and executable.
23445 This is a PowerPC 32-bit SYSV ABI option.
23446
23447 @item -misel
23448 @itemx -mno-isel
23449 @opindex misel
23450 @opindex mno-isel
23451 This switch enables or disables the generation of ISEL instructions.
23452
23453 @item -misel=@var{yes/no}
23454 This switch has been deprecated. Use @option{-misel} and
23455 @option{-mno-isel} instead.
23456
23457 @item -mvsx
23458 @itemx -mno-vsx
23459 @opindex mvsx
23460 @opindex mno-vsx
23461 Generate code that uses (does not use) vector/scalar (VSX)
23462 instructions, and also enable the use of built-in functions that allow
23463 more direct access to the VSX instruction set.
23464
23465 @item -mcrypto
23466 @itemx -mno-crypto
23467 @opindex mcrypto
23468 @opindex mno-crypto
23469 Enable the use (disable) of the built-in functions that allow direct
23470 access to the cryptographic instructions that were added in version
23471 2.07 of the PowerPC ISA.
23472
23473 @item -mhtm
23474 @itemx -mno-htm
23475 @opindex mhtm
23476 @opindex mno-htm
23477 Enable (disable) the use of the built-in functions that allow direct
23478 access to the Hardware Transactional Memory (HTM) instructions that
23479 were added in version 2.07 of the PowerPC ISA.
23480
23481 @item -mpower8-fusion
23482 @itemx -mno-power8-fusion
23483 @opindex mpower8-fusion
23484 @opindex mno-power8-fusion
23485 Generate code that keeps (does not keeps) some integer operations
23486 adjacent so that the instructions can be fused together on power8 and
23487 later processors.
23488
23489 @item -mpower8-vector
23490 @itemx -mno-power8-vector
23491 @opindex mpower8-vector
23492 @opindex mno-power8-vector
23493 Generate code that uses (does not use) the vector and scalar
23494 instructions that were added in version 2.07 of the PowerPC ISA. Also
23495 enable the use of built-in functions that allow more direct access to
23496 the vector instructions.
23497
23498 @item -mquad-memory
23499 @itemx -mno-quad-memory
23500 @opindex mquad-memory
23501 @opindex mno-quad-memory
23502 Generate code that uses (does not use) the non-atomic quad word memory
23503 instructions. The @option{-mquad-memory} option requires use of
23504 64-bit mode.
23505
23506 @item -mquad-memory-atomic
23507 @itemx -mno-quad-memory-atomic
23508 @opindex mquad-memory-atomic
23509 @opindex mno-quad-memory-atomic
23510 Generate code that uses (does not use) the atomic quad word memory
23511 instructions. The @option{-mquad-memory-atomic} option requires use of
23512 64-bit mode.
23513
23514 @item -mfloat128
23515 @itemx -mno-float128
23516 @opindex mfloat128
23517 @opindex mno-float128
23518 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23519 and use either software emulation for IEEE 128-bit floating point or
23520 hardware instructions.
23521
23522 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
23523 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
23524 use the IEEE 128-bit floating point support. The IEEE 128-bit
23525 floating point support only works on PowerPC Linux systems.
23526
23527 The default for @option{-mfloat128} is enabled on PowerPC Linux
23528 systems using the VSX instruction set, and disabled on other systems.
23529
23530 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
23531 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
23532 point support will also enable the generation of ISA 3.0 IEEE 128-bit
23533 floating point instructions. Otherwise, if you do not specify to
23534 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
23535 system, IEEE 128-bit floating point will be done with software
23536 emulation.
23537
23538 @item -mfloat128-hardware
23539 @itemx -mno-float128-hardware
23540 @opindex mfloat128-hardware
23541 @opindex mno-float128-hardware
23542 Enable/disable using ISA 3.0 hardware instructions to support the
23543 @var{__float128} data type.
23544
23545 The default for @option{-mfloat128-hardware} is enabled on PowerPC
23546 Linux systems using the ISA 3.0 instruction set, and disabled on other
23547 systems.
23548
23549 @item -m32
23550 @itemx -m64
23551 @opindex m32
23552 @opindex m64
23553 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23554 targets (including GNU/Linux). The 32-bit environment sets int, long
23555 and pointer to 32 bits and generates code that runs on any PowerPC
23556 variant. The 64-bit environment sets int to 32 bits and long and
23557 pointer to 64 bits, and generates code for PowerPC64, as for
23558 @option{-mpowerpc64}.
23559
23560 @item -mfull-toc
23561 @itemx -mno-fp-in-toc
23562 @itemx -mno-sum-in-toc
23563 @itemx -mminimal-toc
23564 @opindex mfull-toc
23565 @opindex mno-fp-in-toc
23566 @opindex mno-sum-in-toc
23567 @opindex mminimal-toc
23568 Modify generation of the TOC (Table Of Contents), which is created for
23569 every executable file. The @option{-mfull-toc} option is selected by
23570 default. In that case, GCC allocates at least one TOC entry for
23571 each unique non-automatic variable reference in your program. GCC
23572 also places floating-point constants in the TOC@. However, only
23573 16,384 entries are available in the TOC@.
23574
23575 If you receive a linker error message that saying you have overflowed
23576 the available TOC space, you can reduce the amount of TOC space used
23577 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23578 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23579 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23580 generate code to calculate the sum of an address and a constant at
23581 run time instead of putting that sum into the TOC@. You may specify one
23582 or both of these options. Each causes GCC to produce very slightly
23583 slower and larger code at the expense of conserving TOC space.
23584
23585 If you still run out of space in the TOC even when you specify both of
23586 these options, specify @option{-mminimal-toc} instead. This option causes
23587 GCC to make only one TOC entry for every file. When you specify this
23588 option, GCC produces code that is slower and larger but which
23589 uses extremely little TOC space. You may wish to use this option
23590 only on files that contain less frequently-executed code.
23591
23592 @item -maix64
23593 @itemx -maix32
23594 @opindex maix64
23595 @opindex maix32
23596 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
23597 @code{long} type, and the infrastructure needed to support them.
23598 Specifying @option{-maix64} implies @option{-mpowerpc64},
23599 while @option{-maix32} disables the 64-bit ABI and
23600 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
23601
23602 @item -mxl-compat
23603 @itemx -mno-xl-compat
23604 @opindex mxl-compat
23605 @opindex mno-xl-compat
23606 Produce code that conforms more closely to IBM XL compiler semantics
23607 when using AIX-compatible ABI@. Pass floating-point arguments to
23608 prototyped functions beyond the register save area (RSA) on the stack
23609 in addition to argument FPRs. Do not assume that most significant
23610 double in 128-bit long double value is properly rounded when comparing
23611 values and converting to double. Use XL symbol names for long double
23612 support routines.
23613
23614 The AIX calling convention was extended but not initially documented to
23615 handle an obscure K&R C case of calling a function that takes the
23616 address of its arguments with fewer arguments than declared. IBM XL
23617 compilers access floating-point arguments that do not fit in the
23618 RSA from the stack when a subroutine is compiled without
23619 optimization. Because always storing floating-point arguments on the
23620 stack is inefficient and rarely needed, this option is not enabled by
23621 default and only is necessary when calling subroutines compiled by IBM
23622 XL compilers without optimization.
23623
23624 @item -mpe
23625 @opindex mpe
23626 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
23627 application written to use message passing with special startup code to
23628 enable the application to run. The system must have PE installed in the
23629 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
23630 must be overridden with the @option{-specs=} option to specify the
23631 appropriate directory location. The Parallel Environment does not
23632 support threads, so the @option{-mpe} option and the @option{-pthread}
23633 option are incompatible.
23634
23635 @item -malign-natural
23636 @itemx -malign-power
23637 @opindex malign-natural
23638 @opindex malign-power
23639 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23640 @option{-malign-natural} overrides the ABI-defined alignment of larger
23641 types, such as floating-point doubles, on their natural size-based boundary.
23642 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23643 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23644
23645 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23646 is not supported.
23647
23648 @item -msoft-float
23649 @itemx -mhard-float
23650 @opindex msoft-float
23651 @opindex mhard-float
23652 Generate code that does not use (uses) the floating-point register set.
23653 Software floating-point emulation is provided if you use the
23654 @option{-msoft-float} option, and pass the option to GCC when linking.
23655
23656 @item -mmultiple
23657 @itemx -mno-multiple
23658 @opindex mmultiple
23659 @opindex mno-multiple
23660 Generate code that uses (does not use) the load multiple word
23661 instructions and the store multiple word instructions. These
23662 instructions are generated by default on POWER systems, and not
23663 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23664 PowerPC systems, since those instructions do not work when the
23665 processor is in little-endian mode. The exceptions are PPC740 and
23666 PPC750 which permit these instructions in little-endian mode.
23667
23668 @item -mupdate
23669 @itemx -mno-update
23670 @opindex mupdate
23671 @opindex mno-update
23672 Generate code that uses (does not use) the load or store instructions
23673 that update the base register to the address of the calculated memory
23674 location. These instructions are generated by default. If you use
23675 @option{-mno-update}, there is a small window between the time that the
23676 stack pointer is updated and the address of the previous frame is
23677 stored, which means code that walks the stack frame across interrupts or
23678 signals may get corrupted data.
23679
23680 @item -mavoid-indexed-addresses
23681 @itemx -mno-avoid-indexed-addresses
23682 @opindex mavoid-indexed-addresses
23683 @opindex mno-avoid-indexed-addresses
23684 Generate code that tries to avoid (not avoid) the use of indexed load
23685 or store instructions. These instructions can incur a performance
23686 penalty on Power6 processors in certain situations, such as when
23687 stepping through large arrays that cross a 16M boundary. This option
23688 is enabled by default when targeting Power6 and disabled otherwise.
23689
23690 @item -mfused-madd
23691 @itemx -mno-fused-madd
23692 @opindex mfused-madd
23693 @opindex mno-fused-madd
23694 Generate code that uses (does not use) the floating-point multiply and
23695 accumulate instructions. These instructions are generated by default
23696 if hardware floating point is used. The machine-dependent
23697 @option{-mfused-madd} option is now mapped to the machine-independent
23698 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23699 mapped to @option{-ffp-contract=off}.
23700
23701 @item -mmulhw
23702 @itemx -mno-mulhw
23703 @opindex mmulhw
23704 @opindex mno-mulhw
23705 Generate code that uses (does not use) the half-word multiply and
23706 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
23707 These instructions are generated by default when targeting those
23708 processors.
23709
23710 @item -mdlmzb
23711 @itemx -mno-dlmzb
23712 @opindex mdlmzb
23713 @opindex mno-dlmzb
23714 Generate code that uses (does not use) the string-search @samp{dlmzb}
23715 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
23716 generated by default when targeting those processors.
23717
23718 @item -mno-bit-align
23719 @itemx -mbit-align
23720 @opindex mno-bit-align
23721 @opindex mbit-align
23722 On System V.4 and embedded PowerPC systems do not (do) force structures
23723 and unions that contain bit-fields to be aligned to the base type of the
23724 bit-field.
23725
23726 For example, by default a structure containing nothing but 8
23727 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
23728 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
23729 the structure is aligned to a 1-byte boundary and is 1 byte in
23730 size.
23731
23732 @item -mno-strict-align
23733 @itemx -mstrict-align
23734 @opindex mno-strict-align
23735 @opindex mstrict-align
23736 On System V.4 and embedded PowerPC systems do not (do) assume that
23737 unaligned memory references are handled by the system.
23738
23739 @item -mrelocatable
23740 @itemx -mno-relocatable
23741 @opindex mrelocatable
23742 @opindex mno-relocatable
23743 Generate code that allows (does not allow) a static executable to be
23744 relocated to a different address at run time. A simple embedded
23745 PowerPC system loader should relocate the entire contents of
23746 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23747 a table of 32-bit addresses generated by this option. For this to
23748 work, all objects linked together must be compiled with
23749 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23750 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23751
23752 @item -mrelocatable-lib
23753 @itemx -mno-relocatable-lib
23754 @opindex mrelocatable-lib
23755 @opindex mno-relocatable-lib
23756 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23757 @code{.fixup} section to allow static executables to be relocated at
23758 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23759 alignment of @option{-mrelocatable}. Objects compiled with
23760 @option{-mrelocatable-lib} may be linked with objects compiled with
23761 any combination of the @option{-mrelocatable} options.
23762
23763 @item -mno-toc
23764 @itemx -mtoc
23765 @opindex mno-toc
23766 @opindex mtoc
23767 On System V.4 and embedded PowerPC systems do not (do) assume that
23768 register 2 contains a pointer to a global area pointing to the addresses
23769 used in the program.
23770
23771 @item -mlittle
23772 @itemx -mlittle-endian
23773 @opindex mlittle
23774 @opindex mlittle-endian
23775 On System V.4 and embedded PowerPC systems compile code for the
23776 processor in little-endian mode. The @option{-mlittle-endian} option is
23777 the same as @option{-mlittle}.
23778
23779 @item -mbig
23780 @itemx -mbig-endian
23781 @opindex mbig
23782 @opindex mbig-endian
23783 On System V.4 and embedded PowerPC systems compile code for the
23784 processor in big-endian mode. The @option{-mbig-endian} option is
23785 the same as @option{-mbig}.
23786
23787 @item -mdynamic-no-pic
23788 @opindex mdynamic-no-pic
23789 On Darwin and Mac OS X systems, compile code so that it is not
23790 relocatable, but that its external references are relocatable. The
23791 resulting code is suitable for applications, but not shared
23792 libraries.
23793
23794 @item -msingle-pic-base
23795 @opindex msingle-pic-base
23796 Treat the register used for PIC addressing as read-only, rather than
23797 loading it in the prologue for each function. The runtime system is
23798 responsible for initializing this register with an appropriate value
23799 before execution begins.
23800
23801 @item -mprioritize-restricted-insns=@var{priority}
23802 @opindex mprioritize-restricted-insns
23803 This option controls the priority that is assigned to
23804 dispatch-slot restricted instructions during the second scheduling
23805 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23806 or @samp{2} to assign no, highest, or second-highest (respectively)
23807 priority to dispatch-slot restricted
23808 instructions.
23809
23810 @item -msched-costly-dep=@var{dependence_type}
23811 @opindex msched-costly-dep
23812 This option controls which dependences are considered costly
23813 by the target during instruction scheduling. The argument
23814 @var{dependence_type} takes one of the following values:
23815
23816 @table @asis
23817 @item @samp{no}
23818 No dependence is costly.
23819
23820 @item @samp{all}
23821 All dependences are costly.
23822
23823 @item @samp{true_store_to_load}
23824 A true dependence from store to load is costly.
23825
23826 @item @samp{store_to_load}
23827 Any dependence from store to load is costly.
23828
23829 @item @var{number}
23830 Any dependence for which the latency is greater than or equal to
23831 @var{number} is costly.
23832 @end table
23833
23834 @item -minsert-sched-nops=@var{scheme}
23835 @opindex minsert-sched-nops
23836 This option controls which NOP insertion scheme is used during
23837 the second scheduling pass. The argument @var{scheme} takes one of the
23838 following values:
23839
23840 @table @asis
23841 @item @samp{no}
23842 Don't insert NOPs.
23843
23844 @item @samp{pad}
23845 Pad with NOPs any dispatch group that has vacant issue slots,
23846 according to the scheduler's grouping.
23847
23848 @item @samp{regroup_exact}
23849 Insert NOPs to force costly dependent insns into
23850 separate groups. Insert exactly as many NOPs as needed to force an insn
23851 to a new group, according to the estimated processor grouping.
23852
23853 @item @var{number}
23854 Insert NOPs to force costly dependent insns into
23855 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23856 @end table
23857
23858 @item -mcall-sysv
23859 @opindex mcall-sysv
23860 On System V.4 and embedded PowerPC systems compile code using calling
23861 conventions that adhere to the March 1995 draft of the System V
23862 Application Binary Interface, PowerPC processor supplement. This is the
23863 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23864
23865 @item -mcall-sysv-eabi
23866 @itemx -mcall-eabi
23867 @opindex mcall-sysv-eabi
23868 @opindex mcall-eabi
23869 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23870
23871 @item -mcall-sysv-noeabi
23872 @opindex mcall-sysv-noeabi
23873 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23874
23875 @item -mcall-aixdesc
23876 @opindex m
23877 On System V.4 and embedded PowerPC systems compile code for the AIX
23878 operating system.
23879
23880 @item -mcall-linux
23881 @opindex mcall-linux
23882 On System V.4 and embedded PowerPC systems compile code for the
23883 Linux-based GNU system.
23884
23885 @item -mcall-freebsd
23886 @opindex mcall-freebsd
23887 On System V.4 and embedded PowerPC systems compile code for the
23888 FreeBSD operating system.
23889
23890 @item -mcall-netbsd
23891 @opindex mcall-netbsd
23892 On System V.4 and embedded PowerPC systems compile code for the
23893 NetBSD operating system.
23894
23895 @item -mcall-openbsd
23896 @opindex mcall-netbsd
23897 On System V.4 and embedded PowerPC systems compile code for the
23898 OpenBSD operating system.
23899
23900 @item -mtraceback=@var{traceback_type}
23901 @opindex mtraceback
23902 Select the type of traceback table. Valid values for @var{traceback_type}
23903 are @samp{full}, @samp{part}, and @samp{no}.
23904
23905 @item -maix-struct-return
23906 @opindex maix-struct-return
23907 Return all structures in memory (as specified by the AIX ABI)@.
23908
23909 @item -msvr4-struct-return
23910 @opindex msvr4-struct-return
23911 Return structures smaller than 8 bytes in registers (as specified by the
23912 SVR4 ABI)@.
23913
23914 @item -mabi=@var{abi-type}
23915 @opindex mabi
23916 Extend the current ABI with a particular extension, or remove such extension.
23917 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23918 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23919 @samp{elfv1}, @samp{elfv2}@.
23920
23921 @item -mabi=ibmlongdouble
23922 @opindex mabi=ibmlongdouble
23923 Change the current ABI to use IBM extended-precision long double.
23924 This is not likely to work if your system defaults to using IEEE
23925 extended-precision long double. If you change the long double type
23926 from IEEE extended-precision, the compiler will issue a warning unless
23927 you use the @option{-Wno-psabi} option.
23928
23929 @item -mabi=ieeelongdouble
23930 @opindex mabi=ieeelongdouble
23931 Change the current ABI to use IEEE extended-precision long double.
23932 This is not likely to work if your system defaults to using IBM
23933 extended-precision long double. If you change the long double type
23934 from IBM extended-precision, the compiler will issue a warning unless
23935 you use the @option{-Wno-psabi} option.
23936
23937 @item -mabi=elfv1
23938 @opindex mabi=elfv1
23939 Change the current ABI to use the ELFv1 ABI.
23940 This is the default ABI for big-endian PowerPC 64-bit Linux.
23941 Overriding the default ABI requires special system support and is
23942 likely to fail in spectacular ways.
23943
23944 @item -mabi=elfv2
23945 @opindex mabi=elfv2
23946 Change the current ABI to use the ELFv2 ABI.
23947 This is the default ABI for little-endian PowerPC 64-bit Linux.
23948 Overriding the default ABI requires special system support and is
23949 likely to fail in spectacular ways.
23950
23951 @item -mgnu-attribute
23952 @itemx -mno-gnu-attribute
23953 @opindex mgnu-attribute
23954 @opindex mno-gnu-attribute
23955 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23956 .gnu.attributes section that specify ABI variations in function
23957 parameters or return values.
23958
23959 @item -mprototype
23960 @itemx -mno-prototype
23961 @opindex mprototype
23962 @opindex mno-prototype
23963 On System V.4 and embedded PowerPC systems assume that all calls to
23964 variable argument functions are properly prototyped. Otherwise, the
23965 compiler must insert an instruction before every non-prototyped call to
23966 set or clear bit 6 of the condition code register (@code{CR}) to
23967 indicate whether floating-point values are passed in the floating-point
23968 registers in case the function takes variable arguments. With
23969 @option{-mprototype}, only calls to prototyped variable argument functions
23970 set or clear the bit.
23971
23972 @item -msim
23973 @opindex msim
23974 On embedded PowerPC systems, assume that the startup module is called
23975 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23976 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23977 configurations.
23978
23979 @item -mmvme
23980 @opindex mmvme
23981 On embedded PowerPC systems, assume that the startup module is called
23982 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23983 @file{libc.a}.
23984
23985 @item -mads
23986 @opindex mads
23987 On embedded PowerPC systems, assume that the startup module is called
23988 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23989 @file{libc.a}.
23990
23991 @item -myellowknife
23992 @opindex myellowknife
23993 On embedded PowerPC systems, assume that the startup module is called
23994 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23995 @file{libc.a}.
23996
23997 @item -mvxworks
23998 @opindex mvxworks
23999 On System V.4 and embedded PowerPC systems, specify that you are
24000 compiling for a VxWorks system.
24001
24002 @item -memb
24003 @opindex memb
24004 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24005 header to indicate that @samp{eabi} extended relocations are used.
24006
24007 @item -meabi
24008 @itemx -mno-eabi
24009 @opindex meabi
24010 @opindex mno-eabi
24011 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24012 Embedded Applications Binary Interface (EABI), which is a set of
24013 modifications to the System V.4 specifications. Selecting @option{-meabi}
24014 means that the stack is aligned to an 8-byte boundary, a function
24015 @code{__eabi} is called from @code{main} to set up the EABI
24016 environment, and the @option{-msdata} option can use both @code{r2} and
24017 @code{r13} to point to two separate small data areas. Selecting
24018 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24019 no EABI initialization function is called from @code{main}, and the
24020 @option{-msdata} option only uses @code{r13} to point to a single
24021 small data area. The @option{-meabi} option is on by default if you
24022 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24023
24024 @item -msdata=eabi
24025 @opindex msdata=eabi
24026 On System V.4 and embedded PowerPC systems, put small initialized
24027 @code{const} global and static data in the @code{.sdata2} section, which
24028 is pointed to by register @code{r2}. Put small initialized
24029 non-@code{const} global and static data in the @code{.sdata} section,
24030 which is pointed to by register @code{r13}. Put small uninitialized
24031 global and static data in the @code{.sbss} section, which is adjacent to
24032 the @code{.sdata} section. The @option{-msdata=eabi} option is
24033 incompatible with the @option{-mrelocatable} option. The
24034 @option{-msdata=eabi} option also sets the @option{-memb} option.
24035
24036 @item -msdata=sysv
24037 @opindex msdata=sysv
24038 On System V.4 and embedded PowerPC systems, put small global and static
24039 data in the @code{.sdata} section, which is pointed to by register
24040 @code{r13}. Put small uninitialized global and static data in the
24041 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24042 The @option{-msdata=sysv} option is incompatible with the
24043 @option{-mrelocatable} option.
24044
24045 @item -msdata=default
24046 @itemx -msdata
24047 @opindex msdata=default
24048 @opindex msdata
24049 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24050 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24051 same as @option{-msdata=sysv}.
24052
24053 @item -msdata=data
24054 @opindex msdata=data
24055 On System V.4 and embedded PowerPC systems, put small global
24056 data in the @code{.sdata} section. Put small uninitialized global
24057 data in the @code{.sbss} section. Do not use register @code{r13}
24058 to address small data however. This is the default behavior unless
24059 other @option{-msdata} options are used.
24060
24061 @item -msdata=none
24062 @itemx -mno-sdata
24063 @opindex msdata=none
24064 @opindex mno-sdata
24065 On embedded PowerPC systems, put all initialized global and static data
24066 in the @code{.data} section, and all uninitialized data in the
24067 @code{.bss} section.
24068
24069 @item -mreadonly-in-sdata
24070 @opindex mreadonly-in-sdata
24071 @opindex mno-readonly-in-sdata
24072 Put read-only objects in the @code{.sdata} section as well. This is the
24073 default.
24074
24075 @item -mblock-move-inline-limit=@var{num}
24076 @opindex mblock-move-inline-limit
24077 Inline all block moves (such as calls to @code{memcpy} or structure
24078 copies) less than or equal to @var{num} bytes. The minimum value for
24079 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24080 targets. The default value is target-specific.
24081
24082 @item -mblock-compare-inline-limit=@var{num}
24083 @opindex mblock-compare-inline-limit
24084 Generate non-looping inline code for all block compares (such as calls
24085 to @code{memcmp} or structure compares) less than or equal to @var{num}
24086 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24087 block compare is disabled. The default value is target-specific.
24088
24089 @item -mblock-compare-inline-loop-limit=@var{num}
24090 @opindex mblock-compare-inline-loop-limit
24091 Generate an inline expansion using loop code for all block compares that
24092 are less than or equal to @var{num} bytes, but greater than the limit
24093 for non-loop inline block compare expansion. If the block length is not
24094 constant, at most @var{num} bytes will be compared before @code{memcmp}
24095 is called to compare the remainder of the block. The default value is
24096 target-specific.
24097
24098 @item -mstring-compare-inline-limit=@var{num}
24099 @opindex mstring-compare-inline-limit
24100 Generate at most @var{num} pairs of load instructions to compare the
24101 string inline. If the difference or end of string is not found at the
24102 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24103 take care of the rest of the comparison. The default is 8 pairs of
24104 loads, which will compare 64 bytes on a 64-bit target and 32 bytes on a
24105 32-bit target.
24106
24107 @item -G @var{num}
24108 @opindex G
24109 @cindex smaller data references (PowerPC)
24110 @cindex .sdata/.sdata2 references (PowerPC)
24111 On embedded PowerPC systems, put global and static items less than or
24112 equal to @var{num} bytes into the small data or BSS sections instead of
24113 the normal data or BSS section. By default, @var{num} is 8. The
24114 @option{-G @var{num}} switch is also passed to the linker.
24115 All modules should be compiled with the same @option{-G @var{num}} value.
24116
24117 @item -mregnames
24118 @itemx -mno-regnames
24119 @opindex mregnames
24120 @opindex mno-regnames
24121 On System V.4 and embedded PowerPC systems do (do not) emit register
24122 names in the assembly language output using symbolic forms.
24123
24124 @item -mlongcall
24125 @itemx -mno-longcall
24126 @opindex mlongcall
24127 @opindex mno-longcall
24128 By default assume that all calls are far away so that a longer and more
24129 expensive calling sequence is required. This is required for calls
24130 farther than 32 megabytes (33,554,432 bytes) from the current location.
24131 A short call is generated if the compiler knows
24132 the call cannot be that far away. This setting can be overridden by
24133 the @code{shortcall} function attribute, or by @code{#pragma
24134 longcall(0)}.
24135
24136 Some linkers are capable of detecting out-of-range calls and generating
24137 glue code on the fly. On these systems, long calls are unnecessary and
24138 generate slower code. As of this writing, the AIX linker can do this,
24139 as can the GNU linker for PowerPC/64. It is planned to add this feature
24140 to the GNU linker for 32-bit PowerPC systems as well.
24141
24142 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24143 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24144 addresses represent the callee and the branch island. The
24145 Darwin/PPC linker prefers the first address and generates a @code{bl
24146 callee} if the PPC @code{bl} instruction reaches the callee directly;
24147 otherwise, the linker generates @code{bl L42} to call the branch
24148 island. The branch island is appended to the body of the
24149 calling function; it computes the full 32-bit address of the callee
24150 and jumps to it.
24151
24152 On Mach-O (Darwin) systems, this option directs the compiler emit to
24153 the glue for every direct call, and the Darwin linker decides whether
24154 to use or discard it.
24155
24156 In the future, GCC may ignore all longcall specifications
24157 when the linker is known to generate glue.
24158
24159 @item -mtls-markers
24160 @itemx -mno-tls-markers
24161 @opindex mtls-markers
24162 @opindex mno-tls-markers
24163 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24164 specifying the function argument. The relocation allows the linker to
24165 reliably associate function call with argument setup instructions for
24166 TLS optimization, which in turn allows GCC to better schedule the
24167 sequence.
24168
24169 @item -mrecip
24170 @itemx -mno-recip
24171 @opindex mrecip
24172 This option enables use of the reciprocal estimate and
24173 reciprocal square root estimate instructions with additional
24174 Newton-Raphson steps to increase precision instead of doing a divide or
24175 square root and divide for floating-point arguments. You should use
24176 the @option{-ffast-math} option when using @option{-mrecip} (or at
24177 least @option{-funsafe-math-optimizations},
24178 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24179 @option{-fno-trapping-math}). Note that while the throughput of the
24180 sequence is generally higher than the throughput of the non-reciprocal
24181 instruction, the precision of the sequence can be decreased by up to 2
24182 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24183 roots.
24184
24185 @item -mrecip=@var{opt}
24186 @opindex mrecip=opt
24187 This option controls which reciprocal estimate instructions
24188 may be used. @var{opt} is a comma-separated list of options, which may
24189 be preceded by a @code{!} to invert the option:
24190
24191 @table @samp
24192
24193 @item all
24194 Enable all estimate instructions.
24195
24196 @item default
24197 Enable the default instructions, equivalent to @option{-mrecip}.
24198
24199 @item none
24200 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24201
24202 @item div
24203 Enable the reciprocal approximation instructions for both
24204 single and double precision.
24205
24206 @item divf
24207 Enable the single-precision reciprocal approximation instructions.
24208
24209 @item divd
24210 Enable the double-precision reciprocal approximation instructions.
24211
24212 @item rsqrt
24213 Enable the reciprocal square root approximation instructions for both
24214 single and double precision.
24215
24216 @item rsqrtf
24217 Enable the single-precision reciprocal square root approximation instructions.
24218
24219 @item rsqrtd
24220 Enable the double-precision reciprocal square root approximation instructions.
24221
24222 @end table
24223
24224 So, for example, @option{-mrecip=all,!rsqrtd} enables
24225 all of the reciprocal estimate instructions, except for the
24226 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24227 which handle the double-precision reciprocal square root calculations.
24228
24229 @item -mrecip-precision
24230 @itemx -mno-recip-precision
24231 @opindex mrecip-precision
24232 Assume (do not assume) that the reciprocal estimate instructions
24233 provide higher-precision estimates than is mandated by the PowerPC
24234 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24235 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24236 The double-precision square root estimate instructions are not generated by
24237 default on low-precision machines, since they do not provide an
24238 estimate that converges after three steps.
24239
24240 @item -mveclibabi=@var{type}
24241 @opindex mveclibabi
24242 Specifies the ABI type to use for vectorizing intrinsics using an
24243 external library. The only type supported at present is @samp{mass},
24244 which specifies to use IBM's Mathematical Acceleration Subsystem
24245 (MASS) libraries for vectorizing intrinsics using external libraries.
24246 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24247 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24248 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24249 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24250 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24251 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24252 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24253 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24254 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24255 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24256 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24257 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24258 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24259 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24260 for power7. Both @option{-ftree-vectorize} and
24261 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24262 libraries must be specified at link time.
24263
24264 @item -mfriz
24265 @itemx -mno-friz
24266 @opindex mfriz
24267 Generate (do not generate) the @code{friz} instruction when the
24268 @option{-funsafe-math-optimizations} option is used to optimize
24269 rounding of floating-point values to 64-bit integer and back to floating
24270 point. The @code{friz} instruction does not return the same value if
24271 the floating-point number is too large to fit in an integer.
24272
24273 @item -mpointers-to-nested-functions
24274 @itemx -mno-pointers-to-nested-functions
24275 @opindex mpointers-to-nested-functions
24276 Generate (do not generate) code to load up the static chain register
24277 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24278 systems where a function pointer points to a 3-word descriptor giving
24279 the function address, TOC value to be loaded in register @code{r2}, and
24280 static chain value to be loaded in register @code{r11}. The
24281 @option{-mpointers-to-nested-functions} is on by default. You cannot
24282 call through pointers to nested functions or pointers
24283 to functions compiled in other languages that use the static chain if
24284 you use @option{-mno-pointers-to-nested-functions}.
24285
24286 @item -msave-toc-indirect
24287 @itemx -mno-save-toc-indirect
24288 @opindex msave-toc-indirect
24289 Generate (do not generate) code to save the TOC value in the reserved
24290 stack location in the function prologue if the function calls through
24291 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24292 saved in the prologue, it is saved just before the call through the
24293 pointer. The @option{-mno-save-toc-indirect} option is the default.
24294
24295 @item -mcompat-align-parm
24296 @itemx -mno-compat-align-parm
24297 @opindex mcompat-align-parm
24298 Generate (do not generate) code to pass structure parameters with a
24299 maximum alignment of 64 bits, for compatibility with older versions
24300 of GCC.
24301
24302 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24303 structure parameter on a 128-bit boundary when that structure contained
24304 a member requiring 128-bit alignment. This is corrected in more
24305 recent versions of GCC. This option may be used to generate code
24306 that is compatible with functions compiled with older versions of
24307 GCC.
24308
24309 The @option{-mno-compat-align-parm} option is the default.
24310
24311 @item -mstack-protector-guard=@var{guard}
24312 @itemx -mstack-protector-guard-reg=@var{reg}
24313 @itemx -mstack-protector-guard-offset=@var{offset}
24314 @itemx -mstack-protector-guard-symbol=@var{symbol}
24315 @opindex mstack-protector-guard
24316 @opindex mstack-protector-guard-reg
24317 @opindex mstack-protector-guard-offset
24318 @opindex mstack-protector-guard-symbol
24319 Generate stack protection code using canary at @var{guard}. Supported
24320 locations are @samp{global} for global canary or @samp{tls} for per-thread
24321 canary in the TLS block (the default with GNU libc version 2.4 or later).
24322
24323 With the latter choice the options
24324 @option{-mstack-protector-guard-reg=@var{reg}} and
24325 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24326 which register to use as base register for reading the canary, and from what
24327 offset from that base register. The default for those is as specified in the
24328 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24329 the offset with a symbol reference to a canary in the TLS block.
24330 @end table
24331
24332 @node RX Options
24333 @subsection RX Options
24334 @cindex RX Options
24335
24336 These command-line options are defined for RX targets:
24337
24338 @table @gcctabopt
24339 @item -m64bit-doubles
24340 @itemx -m32bit-doubles
24341 @opindex m64bit-doubles
24342 @opindex m32bit-doubles
24343 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24344 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24345 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24346 works on 32-bit values, which is why the default is
24347 @option{-m32bit-doubles}.
24348
24349 @item -fpu
24350 @itemx -nofpu
24351 @opindex fpu
24352 @opindex nofpu
24353 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24354 floating-point hardware. The default is enabled for the RX600
24355 series and disabled for the RX200 series.
24356
24357 Floating-point instructions are only generated for 32-bit floating-point
24358 values, however, so the FPU hardware is not used for doubles if the
24359 @option{-m64bit-doubles} option is used.
24360
24361 @emph{Note} If the @option{-fpu} option is enabled then
24362 @option{-funsafe-math-optimizations} is also enabled automatically.
24363 This is because the RX FPU instructions are themselves unsafe.
24364
24365 @item -mcpu=@var{name}
24366 @opindex mcpu
24367 Selects the type of RX CPU to be targeted. Currently three types are
24368 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24369 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24370
24371 The only difference between @samp{RX600} and @samp{RX610} is that the
24372 @samp{RX610} does not support the @code{MVTIPL} instruction.
24373
24374 The @samp{RX200} series does not have a hardware floating-point unit
24375 and so @option{-nofpu} is enabled by default when this type is
24376 selected.
24377
24378 @item -mbig-endian-data
24379 @itemx -mlittle-endian-data
24380 @opindex mbig-endian-data
24381 @opindex mlittle-endian-data
24382 Store data (but not code) in the big-endian format. The default is
24383 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24384 format.
24385
24386 @item -msmall-data-limit=@var{N}
24387 @opindex msmall-data-limit
24388 Specifies the maximum size in bytes of global and static variables
24389 which can be placed into the small data area. Using the small data
24390 area can lead to smaller and faster code, but the size of area is
24391 limited and it is up to the programmer to ensure that the area does
24392 not overflow. Also when the small data area is used one of the RX's
24393 registers (usually @code{r13}) is reserved for use pointing to this
24394 area, so it is no longer available for use by the compiler. This
24395 could result in slower and/or larger code if variables are pushed onto
24396 the stack instead of being held in this register.
24397
24398 Note, common variables (variables that have not been initialized) and
24399 constants are not placed into the small data area as they are assigned
24400 to other sections in the output executable.
24401
24402 The default value is zero, which disables this feature. Note, this
24403 feature is not enabled by default with higher optimization levels
24404 (@option{-O2} etc) because of the potentially detrimental effects of
24405 reserving a register. It is up to the programmer to experiment and
24406 discover whether this feature is of benefit to their program. See the
24407 description of the @option{-mpid} option for a description of how the
24408 actual register to hold the small data area pointer is chosen.
24409
24410 @item -msim
24411 @itemx -mno-sim
24412 @opindex msim
24413 @opindex mno-sim
24414 Use the simulator runtime. The default is to use the libgloss
24415 board-specific runtime.
24416
24417 @item -mas100-syntax
24418 @itemx -mno-as100-syntax
24419 @opindex mas100-syntax
24420 @opindex mno-as100-syntax
24421 When generating assembler output use a syntax that is compatible with
24422 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24423 assembler, but it has some restrictions so it is not generated by default.
24424
24425 @item -mmax-constant-size=@var{N}
24426 @opindex mmax-constant-size
24427 Specifies the maximum size, in bytes, of a constant that can be used as
24428 an operand in a RX instruction. Although the RX instruction set does
24429 allow constants of up to 4 bytes in length to be used in instructions,
24430 a longer value equates to a longer instruction. Thus in some
24431 circumstances it can be beneficial to restrict the size of constants
24432 that are used in instructions. Constants that are too big are instead
24433 placed into a constant pool and referenced via register indirection.
24434
24435 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24436 or 4 means that constants of any size are allowed.
24437
24438 @item -mrelax
24439 @opindex mrelax
24440 Enable linker relaxation. Linker relaxation is a process whereby the
24441 linker attempts to reduce the size of a program by finding shorter
24442 versions of various instructions. Disabled by default.
24443
24444 @item -mint-register=@var{N}
24445 @opindex mint-register
24446 Specify the number of registers to reserve for fast interrupt handler
24447 functions. The value @var{N} can be between 0 and 4. A value of 1
24448 means that register @code{r13} is reserved for the exclusive use
24449 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24450 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24451 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24452 A value of 0, the default, does not reserve any registers.
24453
24454 @item -msave-acc-in-interrupts
24455 @opindex msave-acc-in-interrupts
24456 Specifies that interrupt handler functions should preserve the
24457 accumulator register. This is only necessary if normal code might use
24458 the accumulator register, for example because it performs 64-bit
24459 multiplications. The default is to ignore the accumulator as this
24460 makes the interrupt handlers faster.
24461
24462 @item -mpid
24463 @itemx -mno-pid
24464 @opindex mpid
24465 @opindex mno-pid
24466 Enables the generation of position independent data. When enabled any
24467 access to constant data is done via an offset from a base address
24468 held in a register. This allows the location of constant data to be
24469 determined at run time without requiring the executable to be
24470 relocated, which is a benefit to embedded applications with tight
24471 memory constraints. Data that can be modified is not affected by this
24472 option.
24473
24474 Note, using this feature reserves a register, usually @code{r13}, for
24475 the constant data base address. This can result in slower and/or
24476 larger code, especially in complicated functions.
24477
24478 The actual register chosen to hold the constant data base address
24479 depends upon whether the @option{-msmall-data-limit} and/or the
24480 @option{-mint-register} command-line options are enabled. Starting
24481 with register @code{r13} and proceeding downwards, registers are
24482 allocated first to satisfy the requirements of @option{-mint-register},
24483 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24484 is possible for the small data area register to be @code{r8} if both
24485 @option{-mint-register=4} and @option{-mpid} are specified on the
24486 command line.
24487
24488 By default this feature is not enabled. The default can be restored
24489 via the @option{-mno-pid} command-line option.
24490
24491 @item -mno-warn-multiple-fast-interrupts
24492 @itemx -mwarn-multiple-fast-interrupts
24493 @opindex mno-warn-multiple-fast-interrupts
24494 @opindex mwarn-multiple-fast-interrupts
24495 Prevents GCC from issuing a warning message if it finds more than one
24496 fast interrupt handler when it is compiling a file. The default is to
24497 issue a warning for each extra fast interrupt handler found, as the RX
24498 only supports one such interrupt.
24499
24500 @item -mallow-string-insns
24501 @itemx -mno-allow-string-insns
24502 @opindex mallow-string-insns
24503 @opindex mno-allow-string-insns
24504 Enables or disables the use of the string manipulation instructions
24505 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24506 @code{SWHILE} and also the @code{RMPA} instruction. These
24507 instructions may prefetch data, which is not safe to do if accessing
24508 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24509 for more information).
24510
24511 The default is to allow these instructions, but it is not possible for
24512 GCC to reliably detect all circumstances where a string instruction
24513 might be used to access an I/O register, so their use cannot be
24514 disabled automatically. Instead it is reliant upon the programmer to
24515 use the @option{-mno-allow-string-insns} option if their program
24516 accesses I/O space.
24517
24518 When the instructions are enabled GCC defines the C preprocessor
24519 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
24520 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
24521
24522 @item -mjsr
24523 @itemx -mno-jsr
24524 @opindex mjsr
24525 @opindex mno-jsr
24526 Use only (or not only) @code{JSR} instructions to access functions.
24527 This option can be used when code size exceeds the range of @code{BSR}
24528 instructions. Note that @option{-mno-jsr} does not mean to not use
24529 @code{JSR} but instead means that any type of branch may be used.
24530 @end table
24531
24532 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
24533 has special significance to the RX port when used with the
24534 @code{interrupt} function attribute. This attribute indicates a
24535 function intended to process fast interrupts. GCC ensures
24536 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
24537 and/or @code{r13} and only provided that the normal use of the
24538 corresponding registers have been restricted via the
24539 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
24540 options.
24541
24542 @node S/390 and zSeries Options
24543 @subsection S/390 and zSeries Options
24544 @cindex S/390 and zSeries Options
24545
24546 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
24547
24548 @table @gcctabopt
24549 @item -mhard-float
24550 @itemx -msoft-float
24551 @opindex mhard-float
24552 @opindex msoft-float
24553 Use (do not use) the hardware floating-point instructions and registers
24554 for floating-point operations. When @option{-msoft-float} is specified,
24555 functions in @file{libgcc.a} are used to perform floating-point
24556 operations. When @option{-mhard-float} is specified, the compiler
24557 generates IEEE floating-point instructions. This is the default.
24558
24559 @item -mhard-dfp
24560 @itemx -mno-hard-dfp
24561 @opindex mhard-dfp
24562 @opindex mno-hard-dfp
24563 Use (do not use) the hardware decimal-floating-point instructions for
24564 decimal-floating-point operations. When @option{-mno-hard-dfp} is
24565 specified, functions in @file{libgcc.a} are used to perform
24566 decimal-floating-point operations. When @option{-mhard-dfp} is
24567 specified, the compiler generates decimal-floating-point hardware
24568 instructions. This is the default for @option{-march=z9-ec} or higher.
24569
24570 @item -mlong-double-64
24571 @itemx -mlong-double-128
24572 @opindex mlong-double-64
24573 @opindex mlong-double-128
24574 These switches control the size of @code{long double} type. A size
24575 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24576 type. This is the default.
24577
24578 @item -mbackchain
24579 @itemx -mno-backchain
24580 @opindex mbackchain
24581 @opindex mno-backchain
24582 Store (do not store) the address of the caller's frame as backchain pointer
24583 into the callee's stack frame.
24584 A backchain may be needed to allow debugging using tools that do not understand
24585 DWARF call frame information.
24586 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
24587 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
24588 the backchain is placed into the topmost word of the 96/160 byte register
24589 save area.
24590
24591 In general, code compiled with @option{-mbackchain} is call-compatible with
24592 code compiled with @option{-mmo-backchain}; however, use of the backchain
24593 for debugging purposes usually requires that the whole binary is built with
24594 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
24595 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24596 to build a linux kernel use @option{-msoft-float}.
24597
24598 The default is to not maintain the backchain.
24599
24600 @item -mpacked-stack
24601 @itemx -mno-packed-stack
24602 @opindex mpacked-stack
24603 @opindex mno-packed-stack
24604 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
24605 specified, the compiler uses the all fields of the 96/160 byte register save
24606 area only for their default purpose; unused fields still take up stack space.
24607 When @option{-mpacked-stack} is specified, register save slots are densely
24608 packed at the top of the register save area; unused space is reused for other
24609 purposes, allowing for more efficient use of the available stack space.
24610 However, when @option{-mbackchain} is also in effect, the topmost word of
24611 the save area is always used to store the backchain, and the return address
24612 register is always saved two words below the backchain.
24613
24614 As long as the stack frame backchain is not used, code generated with
24615 @option{-mpacked-stack} is call-compatible with code generated with
24616 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
24617 S/390 or zSeries generated code that uses the stack frame backchain at run
24618 time, not just for debugging purposes. Such code is not call-compatible
24619 with code compiled with @option{-mpacked-stack}. Also, note that the
24620 combination of @option{-mbackchain},
24621 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24622 to build a linux kernel use @option{-msoft-float}.
24623
24624 The default is to not use the packed stack layout.
24625
24626 @item -msmall-exec
24627 @itemx -mno-small-exec
24628 @opindex msmall-exec
24629 @opindex mno-small-exec
24630 Generate (or do not generate) code using the @code{bras} instruction
24631 to do subroutine calls.
24632 This only works reliably if the total executable size does not
24633 exceed 64k. The default is to use the @code{basr} instruction instead,
24634 which does not have this limitation.
24635
24636 @item -m64
24637 @itemx -m31
24638 @opindex m64
24639 @opindex m31
24640 When @option{-m31} is specified, generate code compliant to the
24641 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
24642 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
24643 particular to generate 64-bit instructions. For the @samp{s390}
24644 targets, the default is @option{-m31}, while the @samp{s390x}
24645 targets default to @option{-m64}.
24646
24647 @item -mzarch
24648 @itemx -mesa
24649 @opindex mzarch
24650 @opindex mesa
24651 When @option{-mzarch} is specified, generate code using the
24652 instructions available on z/Architecture.
24653 When @option{-mesa} is specified, generate code using the
24654 instructions available on ESA/390. Note that @option{-mesa} is
24655 not possible with @option{-m64}.
24656 When generating code compliant to the GNU/Linux for S/390 ABI,
24657 the default is @option{-mesa}. When generating code compliant
24658 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
24659
24660 @item -mhtm
24661 @itemx -mno-htm
24662 @opindex mhtm
24663 @opindex mno-htm
24664 The @option{-mhtm} option enables a set of builtins making use of
24665 instructions available with the transactional execution facility
24666 introduced with the IBM zEnterprise EC12 machine generation
24667 @ref{S/390 System z Built-in Functions}.
24668 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
24669
24670 @item -mvx
24671 @itemx -mno-vx
24672 @opindex mvx
24673 @opindex mno-vx
24674 When @option{-mvx} is specified, generate code using the instructions
24675 available with the vector extension facility introduced with the IBM
24676 z13 machine generation.
24677 This option changes the ABI for some vector type values with regard to
24678 alignment and calling conventions. In case vector type values are
24679 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
24680 command will be added to mark the resulting binary with the ABI used.
24681 @option{-mvx} is enabled by default when using @option{-march=z13}.
24682
24683 @item -mzvector
24684 @itemx -mno-zvector
24685 @opindex mzvector
24686 @opindex mno-zvector
24687 The @option{-mzvector} option enables vector language extensions and
24688 builtins using instructions available with the vector extension
24689 facility introduced with the IBM z13 machine generation.
24690 This option adds support for @samp{vector} to be used as a keyword to
24691 define vector type variables and arguments. @samp{vector} is only
24692 available when GNU extensions are enabled. It will not be expanded
24693 when requesting strict standard compliance e.g. with @option{-std=c99}.
24694 In addition to the GCC low-level builtins @option{-mzvector} enables
24695 a set of builtins added for compatibility with AltiVec-style
24696 implementations like Power and Cell. In order to make use of these
24697 builtins the header file @file{vecintrin.h} needs to be included.
24698 @option{-mzvector} is disabled by default.
24699
24700 @item -mmvcle
24701 @itemx -mno-mvcle
24702 @opindex mmvcle
24703 @opindex mno-mvcle
24704 Generate (or do not generate) code using the @code{mvcle} instruction
24705 to perform block moves. When @option{-mno-mvcle} is specified,
24706 use a @code{mvc} loop instead. This is the default unless optimizing for
24707 size.
24708
24709 @item -mdebug
24710 @itemx -mno-debug
24711 @opindex mdebug
24712 @opindex mno-debug
24713 Print (or do not print) additional debug information when compiling.
24714 The default is to not print debug information.
24715
24716 @item -march=@var{cpu-type}
24717 @opindex march
24718 Generate code that runs on @var{cpu-type}, which is the name of a
24719 system representing a certain processor type. Possible values for
24720 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
24721 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
24722 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
24723 @samp{native}.
24724
24725 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
24726 @samp{g6} are deprecated and will be removed with future releases.
24727
24728 Specifying @samp{native} as cpu type can be used to select the best
24729 architecture option for the host processor.
24730 @option{-march=native} has no effect if GCC does not recognize the
24731 processor.
24732
24733 @item -mtune=@var{cpu-type}
24734 @opindex mtune
24735 Tune to @var{cpu-type} everything applicable about the generated code,
24736 except for the ABI and the set of available instructions.
24737 The list of @var{cpu-type} values is the same as for @option{-march}.
24738 The default is the value used for @option{-march}.
24739
24740 @item -mtpf-trace
24741 @itemx -mno-tpf-trace
24742 @opindex mtpf-trace
24743 @opindex mno-tpf-trace
24744 Generate code that adds (does not add) in TPF OS specific branches to trace
24745 routines in the operating system. This option is off by default, even
24746 when compiling for the TPF OS@.
24747
24748 @item -mfused-madd
24749 @itemx -mno-fused-madd
24750 @opindex mfused-madd
24751 @opindex mno-fused-madd
24752 Generate code that uses (does not use) the floating-point multiply and
24753 accumulate instructions. These instructions are generated by default if
24754 hardware floating point is used.
24755
24756 @item -mwarn-framesize=@var{framesize}
24757 @opindex mwarn-framesize
24758 Emit a warning if the current function exceeds the given frame size. Because
24759 this is a compile-time check it doesn't need to be a real problem when the program
24760 runs. It is intended to identify functions that most probably cause
24761 a stack overflow. It is useful to be used in an environment with limited stack
24762 size e.g.@: the linux kernel.
24763
24764 @item -mwarn-dynamicstack
24765 @opindex mwarn-dynamicstack
24766 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
24767 arrays. This is generally a bad idea with a limited stack size.
24768
24769 @item -mstack-guard=@var{stack-guard}
24770 @itemx -mstack-size=@var{stack-size}
24771 @opindex mstack-guard
24772 @opindex mstack-size
24773 If these options are provided the S/390 back end emits additional instructions in
24774 the function prologue that trigger a trap if the stack size is @var{stack-guard}
24775 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
24776 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
24777 the frame size of the compiled function is chosen.
24778 These options are intended to be used to help debugging stack overflow problems.
24779 The additionally emitted code causes only little overhead and hence can also be
24780 used in production-like systems without greater performance degradation. The given
24781 values have to be exact powers of 2 and @var{stack-size} has to be greater than
24782 @var{stack-guard} without exceeding 64k.
24783 In order to be efficient the extra code makes the assumption that the stack starts
24784 at an address aligned to the value given by @var{stack-size}.
24785 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
24786
24787 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
24788 @opindex mhotpatch
24789 If the hotpatch option is enabled, a ``hot-patching'' function
24790 prologue is generated for all functions in the compilation unit.
24791 The funtion label is prepended with the given number of two-byte
24792 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
24793 the label, 2 * @var{post-halfwords} bytes are appended, using the
24794 largest NOP like instructions the architecture allows (maximum
24795 1000000).
24796
24797 If both arguments are zero, hotpatching is disabled.
24798
24799 This option can be overridden for individual functions with the
24800 @code{hotpatch} attribute.
24801 @end table
24802
24803 @node Score Options
24804 @subsection Score Options
24805 @cindex Score Options
24806
24807 These options are defined for Score implementations:
24808
24809 @table @gcctabopt
24810 @item -meb
24811 @opindex meb
24812 Compile code for big-endian mode. This is the default.
24813
24814 @item -mel
24815 @opindex mel
24816 Compile code for little-endian mode.
24817
24818 @item -mnhwloop
24819 @opindex mnhwloop
24820 Disable generation of @code{bcnz} instructions.
24821
24822 @item -muls
24823 @opindex muls
24824 Enable generation of unaligned load and store instructions.
24825
24826 @item -mmac
24827 @opindex mmac
24828 Enable the use of multiply-accumulate instructions. Disabled by default.
24829
24830 @item -mscore5
24831 @opindex mscore5
24832 Specify the SCORE5 as the target architecture.
24833
24834 @item -mscore5u
24835 @opindex mscore5u
24836 Specify the SCORE5U of the target architecture.
24837
24838 @item -mscore7
24839 @opindex mscore7
24840 Specify the SCORE7 as the target architecture. This is the default.
24841
24842 @item -mscore7d
24843 @opindex mscore7d
24844 Specify the SCORE7D as the target architecture.
24845 @end table
24846
24847 @node SH Options
24848 @subsection SH Options
24849
24850 These @samp{-m} options are defined for the SH implementations:
24851
24852 @table @gcctabopt
24853 @item -m1
24854 @opindex m1
24855 Generate code for the SH1.
24856
24857 @item -m2
24858 @opindex m2
24859 Generate code for the SH2.
24860
24861 @item -m2e
24862 Generate code for the SH2e.
24863
24864 @item -m2a-nofpu
24865 @opindex m2a-nofpu
24866 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
24867 that the floating-point unit is not used.
24868
24869 @item -m2a-single-only
24870 @opindex m2a-single-only
24871 Generate code for the SH2a-FPU, in such a way that no double-precision
24872 floating-point operations are used.
24873
24874 @item -m2a-single
24875 @opindex m2a-single
24876 Generate code for the SH2a-FPU assuming the floating-point unit is in
24877 single-precision mode by default.
24878
24879 @item -m2a
24880 @opindex m2a
24881 Generate code for the SH2a-FPU assuming the floating-point unit is in
24882 double-precision mode by default.
24883
24884 @item -m3
24885 @opindex m3
24886 Generate code for the SH3.
24887
24888 @item -m3e
24889 @opindex m3e
24890 Generate code for the SH3e.
24891
24892 @item -m4-nofpu
24893 @opindex m4-nofpu
24894 Generate code for the SH4 without a floating-point unit.
24895
24896 @item -m4-single-only
24897 @opindex m4-single-only
24898 Generate code for the SH4 with a floating-point unit that only
24899 supports single-precision arithmetic.
24900
24901 @item -m4-single
24902 @opindex m4-single
24903 Generate code for the SH4 assuming the floating-point unit is in
24904 single-precision mode by default.
24905
24906 @item -m4
24907 @opindex m4
24908 Generate code for the SH4.
24909
24910 @item -m4-100
24911 @opindex m4-100
24912 Generate code for SH4-100.
24913
24914 @item -m4-100-nofpu
24915 @opindex m4-100-nofpu
24916 Generate code for SH4-100 in such a way that the
24917 floating-point unit is not used.
24918
24919 @item -m4-100-single
24920 @opindex m4-100-single
24921 Generate code for SH4-100 assuming the floating-point unit is in
24922 single-precision mode by default.
24923
24924 @item -m4-100-single-only
24925 @opindex m4-100-single-only
24926 Generate code for SH4-100 in such a way that no double-precision
24927 floating-point operations are used.
24928
24929 @item -m4-200
24930 @opindex m4-200
24931 Generate code for SH4-200.
24932
24933 @item -m4-200-nofpu
24934 @opindex m4-200-nofpu
24935 Generate code for SH4-200 without in such a way that the
24936 floating-point unit is not used.
24937
24938 @item -m4-200-single
24939 @opindex m4-200-single
24940 Generate code for SH4-200 assuming the floating-point unit is in
24941 single-precision mode by default.
24942
24943 @item -m4-200-single-only
24944 @opindex m4-200-single-only
24945 Generate code for SH4-200 in such a way that no double-precision
24946 floating-point operations are used.
24947
24948 @item -m4-300
24949 @opindex m4-300
24950 Generate code for SH4-300.
24951
24952 @item -m4-300-nofpu
24953 @opindex m4-300-nofpu
24954 Generate code for SH4-300 without in such a way that the
24955 floating-point unit is not used.
24956
24957 @item -m4-300-single
24958 @opindex m4-300-single
24959 Generate code for SH4-300 in such a way that no double-precision
24960 floating-point operations are used.
24961
24962 @item -m4-300-single-only
24963 @opindex m4-300-single-only
24964 Generate code for SH4-300 in such a way that no double-precision
24965 floating-point operations are used.
24966
24967 @item -m4-340
24968 @opindex m4-340
24969 Generate code for SH4-340 (no MMU, no FPU).
24970
24971 @item -m4-500
24972 @opindex m4-500
24973 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
24974 assembler.
24975
24976 @item -m4a-nofpu
24977 @opindex m4a-nofpu
24978 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
24979 floating-point unit is not used.
24980
24981 @item -m4a-single-only
24982 @opindex m4a-single-only
24983 Generate code for the SH4a, in such a way that no double-precision
24984 floating-point operations are used.
24985
24986 @item -m4a-single
24987 @opindex m4a-single
24988 Generate code for the SH4a assuming the floating-point unit is in
24989 single-precision mode by default.
24990
24991 @item -m4a
24992 @opindex m4a
24993 Generate code for the SH4a.
24994
24995 @item -m4al
24996 @opindex m4al
24997 Same as @option{-m4a-nofpu}, except that it implicitly passes
24998 @option{-dsp} to the assembler. GCC doesn't generate any DSP
24999 instructions at the moment.
25000
25001 @item -mb
25002 @opindex mb
25003 Compile code for the processor in big-endian mode.
25004
25005 @item -ml
25006 @opindex ml
25007 Compile code for the processor in little-endian mode.
25008
25009 @item -mdalign
25010 @opindex mdalign
25011 Align doubles at 64-bit boundaries. Note that this changes the calling
25012 conventions, and thus some functions from the standard C library do
25013 not work unless you recompile it first with @option{-mdalign}.
25014
25015 @item -mrelax
25016 @opindex mrelax
25017 Shorten some address references at link time, when possible; uses the
25018 linker option @option{-relax}.
25019
25020 @item -mbigtable
25021 @opindex mbigtable
25022 Use 32-bit offsets in @code{switch} tables. The default is to use
25023 16-bit offsets.
25024
25025 @item -mbitops
25026 @opindex mbitops
25027 Enable the use of bit manipulation instructions on SH2A.
25028
25029 @item -mfmovd
25030 @opindex mfmovd
25031 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25032 alignment constraints.
25033
25034 @item -mrenesas
25035 @opindex mrenesas
25036 Comply with the calling conventions defined by Renesas.
25037
25038 @item -mno-renesas
25039 @opindex mno-renesas
25040 Comply with the calling conventions defined for GCC before the Renesas
25041 conventions were available. This option is the default for all
25042 targets of the SH toolchain.
25043
25044 @item -mnomacsave
25045 @opindex mnomacsave
25046 Mark the @code{MAC} register as call-clobbered, even if
25047 @option{-mrenesas} is given.
25048
25049 @item -mieee
25050 @itemx -mno-ieee
25051 @opindex mieee
25052 @opindex mno-ieee
25053 Control the IEEE compliance of floating-point comparisons, which affects the
25054 handling of cases where the result of a comparison is unordered. By default
25055 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25056 enabled @option{-mno-ieee} is implicitly set, which results in faster
25057 floating-point greater-equal and less-equal comparisons. The implicit settings
25058 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25059
25060 @item -minline-ic_invalidate
25061 @opindex minline-ic_invalidate
25062 Inline code to invalidate instruction cache entries after setting up
25063 nested function trampolines.
25064 This option has no effect if @option{-musermode} is in effect and the selected
25065 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
25066 instruction.
25067 If the selected code generation option does not allow the use of the @code{icbi}
25068 instruction, and @option{-musermode} is not in effect, the inlined code
25069 manipulates the instruction cache address array directly with an associative
25070 write. This not only requires privileged mode at run time, but it also
25071 fails if the cache line had been mapped via the TLB and has become unmapped.
25072
25073 @item -misize
25074 @opindex misize
25075 Dump instruction size and location in the assembly code.
25076
25077 @item -mpadstruct
25078 @opindex mpadstruct
25079 This option is deprecated. It pads structures to multiple of 4 bytes,
25080 which is incompatible with the SH ABI@.
25081
25082 @item -matomic-model=@var{model}
25083 @opindex matomic-model=@var{model}
25084 Sets the model of atomic operations and additional parameters as a comma
25085 separated list. For details on the atomic built-in functions see
25086 @ref{__atomic Builtins}. The following models and parameters are supported:
25087
25088 @table @samp
25089
25090 @item none
25091 Disable compiler generated atomic sequences and emit library calls for atomic
25092 operations. This is the default if the target is not @code{sh*-*-linux*}.
25093
25094 @item soft-gusa
25095 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25096 built-in functions. The generated atomic sequences require additional support
25097 from the interrupt/exception handling code of the system and are only suitable
25098 for SH3* and SH4* single-core systems. This option is enabled by default when
25099 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25100 this option also partially utilizes the hardware atomic instructions
25101 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25102 @samp{strict} is specified.
25103
25104 @item soft-tcb
25105 Generate software atomic sequences that use a variable in the thread control
25106 block. This is a variation of the gUSA sequences which can also be used on
25107 SH1* and SH2* targets. The generated atomic sequences require additional
25108 support from the interrupt/exception handling code of the system and are only
25109 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25110 parameter has to be specified as well.
25111
25112 @item soft-imask
25113 Generate software atomic sequences that temporarily disable interrupts by
25114 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25115 in privileged mode and is only suitable for single-core systems. Additional
25116 support from the interrupt/exception handling code of the system is not
25117 required. This model is enabled by default when the target is
25118 @code{sh*-*-linux*} and SH1* or SH2*.
25119
25120 @item hard-llcs
25121 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25122 instructions only. This is only available on SH4A and is suitable for
25123 multi-core systems. Since the hardware instructions support only 32 bit atomic
25124 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25125 Code compiled with this option is also compatible with other software
25126 atomic model interrupt/exception handling systems if executed on an SH4A
25127 system. Additional support from the interrupt/exception handling code of the
25128 system is not required for this model.
25129
25130 @item gbr-offset=
25131 This parameter specifies the offset in bytes of the variable in the thread
25132 control block structure that should be used by the generated atomic sequences
25133 when the @samp{soft-tcb} model has been selected. For other models this
25134 parameter is ignored. The specified value must be an integer multiple of four
25135 and in the range 0-1020.
25136
25137 @item strict
25138 This parameter prevents mixed usage of multiple atomic models, even if they
25139 are compatible, and makes the compiler generate atomic sequences of the
25140 specified model only.
25141
25142 @end table
25143
25144 @item -mtas
25145 @opindex mtas
25146 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25147 Notice that depending on the particular hardware and software configuration
25148 this can degrade overall performance due to the operand cache line flushes
25149 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25150 processors the @code{tas.b} instruction must be used with caution since it
25151 can result in data corruption for certain cache configurations.
25152
25153 @item -mprefergot
25154 @opindex mprefergot
25155 When generating position-independent code, emit function calls using
25156 the Global Offset Table instead of the Procedure Linkage Table.
25157
25158 @item -musermode
25159 @itemx -mno-usermode
25160 @opindex musermode
25161 @opindex mno-usermode
25162 Don't allow (allow) the compiler generating privileged mode code. Specifying
25163 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25164 inlined code would not work in user mode. @option{-musermode} is the default
25165 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25166 @option{-musermode} has no effect, since there is no user mode.
25167
25168 @item -multcost=@var{number}
25169 @opindex multcost=@var{number}
25170 Set the cost to assume for a multiply insn.
25171
25172 @item -mdiv=@var{strategy}
25173 @opindex mdiv=@var{strategy}
25174 Set the division strategy to be used for integer division operations.
25175 @var{strategy} can be one of:
25176
25177 @table @samp
25178
25179 @item call-div1
25180 Calls a library function that uses the single-step division instruction
25181 @code{div1} to perform the operation. Division by zero calculates an
25182 unspecified result and does not trap. This is the default except for SH4,
25183 SH2A and SHcompact.
25184
25185 @item call-fp
25186 Calls a library function that performs the operation in double precision
25187 floating point. Division by zero causes a floating-point exception. This is
25188 the default for SHcompact with FPU. Specifying this for targets that do not
25189 have a double precision FPU defaults to @code{call-div1}.
25190
25191 @item call-table
25192 Calls a library function that uses a lookup table for small divisors and
25193 the @code{div1} instruction with case distinction for larger divisors. Division
25194 by zero calculates an unspecified result and does not trap. This is the default
25195 for SH4. Specifying this for targets that do not have dynamic shift
25196 instructions defaults to @code{call-div1}.
25197
25198 @end table
25199
25200 When a division strategy has not been specified the default strategy is
25201 selected based on the current target. For SH2A the default strategy is to
25202 use the @code{divs} and @code{divu} instructions instead of library function
25203 calls.
25204
25205 @item -maccumulate-outgoing-args
25206 @opindex maccumulate-outgoing-args
25207 Reserve space once for outgoing arguments in the function prologue rather
25208 than around each call. Generally beneficial for performance and size. Also
25209 needed for unwinding to avoid changing the stack frame around conditional code.
25210
25211 @item -mdivsi3_libfunc=@var{name}
25212 @opindex mdivsi3_libfunc=@var{name}
25213 Set the name of the library function used for 32-bit signed division to
25214 @var{name}.
25215 This only affects the name used in the @samp{call} division strategies, and
25216 the compiler still expects the same sets of input/output/clobbered registers as
25217 if this option were not present.
25218
25219 @item -mfixed-range=@var{register-range}
25220 @opindex mfixed-range
25221 Generate code treating the given register range as fixed registers.
25222 A fixed register is one that the register allocator can not use. This is
25223 useful when compiling kernel code. A register range is specified as
25224 two registers separated by a dash. Multiple register ranges can be
25225 specified separated by a comma.
25226
25227 @item -mbranch-cost=@var{num}
25228 @opindex mbranch-cost=@var{num}
25229 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25230 make the compiler try to generate more branch-free code if possible.
25231 If not specified the value is selected depending on the processor type that
25232 is being compiled for.
25233
25234 @item -mzdcbranch
25235 @itemx -mno-zdcbranch
25236 @opindex mzdcbranch
25237 @opindex mno-zdcbranch
25238 Assume (do not assume) that zero displacement conditional branch instructions
25239 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25240 compiler prefers zero displacement branch code sequences. This is
25241 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25242 disabled by specifying @option{-mno-zdcbranch}.
25243
25244 @item -mcbranch-force-delay-slot
25245 @opindex mcbranch-force-delay-slot
25246 Force the usage of delay slots for conditional branches, which stuffs the delay
25247 slot with a @code{nop} if a suitable instruction cannot be found. By default
25248 this option is disabled. It can be enabled to work around hardware bugs as
25249 found in the original SH7055.
25250
25251 @item -mfused-madd
25252 @itemx -mno-fused-madd
25253 @opindex mfused-madd
25254 @opindex mno-fused-madd
25255 Generate code that uses (does not use) the floating-point multiply and
25256 accumulate instructions. These instructions are generated by default
25257 if hardware floating point is used. The machine-dependent
25258 @option{-mfused-madd} option is now mapped to the machine-independent
25259 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25260 mapped to @option{-ffp-contract=off}.
25261
25262 @item -mfsca
25263 @itemx -mno-fsca
25264 @opindex mfsca
25265 @opindex mno-fsca
25266 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25267 and cosine approximations. The option @option{-mfsca} must be used in
25268 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25269 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25270 approximations even if @option{-funsafe-math-optimizations} is in effect.
25271
25272 @item -mfsrra
25273 @itemx -mno-fsrra
25274 @opindex mfsrra
25275 @opindex mno-fsrra
25276 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25277 reciprocal square root approximations. The option @option{-mfsrra} must be used
25278 in combination with @option{-funsafe-math-optimizations} and
25279 @option{-ffinite-math-only}. It is enabled by default when generating code for
25280 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25281 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25282 in effect.
25283
25284 @item -mpretend-cmove
25285 @opindex mpretend-cmove
25286 Prefer zero-displacement conditional branches for conditional move instruction
25287 patterns. This can result in faster code on the SH4 processor.
25288
25289 @item -mfdpic
25290 @opindex fdpic
25291 Generate code using the FDPIC ABI.
25292
25293 @end table
25294
25295 @node Solaris 2 Options
25296 @subsection Solaris 2 Options
25297 @cindex Solaris 2 options
25298
25299 These @samp{-m} options are supported on Solaris 2:
25300
25301 @table @gcctabopt
25302 @item -mclear-hwcap
25303 @opindex mclear-hwcap
25304 @option{-mclear-hwcap} tells the compiler to remove the hardware
25305 capabilities generated by the Solaris assembler. This is only necessary
25306 when object files use ISA extensions not supported by the current
25307 machine, but check at runtime whether or not to use them.
25308
25309 @item -mimpure-text
25310 @opindex mimpure-text
25311 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25312 the compiler to not pass @option{-z text} to the linker when linking a
25313 shared object. Using this option, you can link position-dependent
25314 code into a shared object.
25315
25316 @option{-mimpure-text} suppresses the ``relocations remain against
25317 allocatable but non-writable sections'' linker error message.
25318 However, the necessary relocations trigger copy-on-write, and the
25319 shared object is not actually shared across processes. Instead of
25320 using @option{-mimpure-text}, you should compile all source code with
25321 @option{-fpic} or @option{-fPIC}.
25322
25323 @end table
25324
25325 These switches are supported in addition to the above on Solaris 2:
25326
25327 @table @gcctabopt
25328 @item -pthreads
25329 @opindex pthreads
25330 This is a synonym for @option{-pthread}.
25331 @end table
25332
25333 @node SPARC Options
25334 @subsection SPARC Options
25335 @cindex SPARC options
25336
25337 These @samp{-m} options are supported on the SPARC:
25338
25339 @table @gcctabopt
25340 @item -mno-app-regs
25341 @itemx -mapp-regs
25342 @opindex mno-app-regs
25343 @opindex mapp-regs
25344 Specify @option{-mapp-regs} to generate output using the global registers
25345 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25346 global register 1, each global register 2 through 4 is then treated as an
25347 allocable register that is clobbered by function calls. This is the default.
25348
25349 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25350 specify @option{-mno-app-regs}. You should compile libraries and system
25351 software with this option.
25352
25353 @item -mflat
25354 @itemx -mno-flat
25355 @opindex mflat
25356 @opindex mno-flat
25357 With @option{-mflat}, the compiler does not generate save/restore instructions
25358 and uses a ``flat'' or single register window model. This model is compatible
25359 with the regular register window model. The local registers and the input
25360 registers (0--5) are still treated as ``call-saved'' registers and are
25361 saved on the stack as needed.
25362
25363 With @option{-mno-flat} (the default), the compiler generates save/restore
25364 instructions (except for leaf functions). This is the normal operating mode.
25365
25366 @item -mfpu
25367 @itemx -mhard-float
25368 @opindex mfpu
25369 @opindex mhard-float
25370 Generate output containing floating-point instructions. This is the
25371 default.
25372
25373 @item -mno-fpu
25374 @itemx -msoft-float
25375 @opindex mno-fpu
25376 @opindex msoft-float
25377 Generate output containing library calls for floating point.
25378 @strong{Warning:} the requisite libraries are not available for all SPARC
25379 targets. Normally the facilities of the machine's usual C compiler are
25380 used, but this cannot be done directly in cross-compilation. You must make
25381 your own arrangements to provide suitable library functions for
25382 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25383 @samp{sparclite-*-*} do provide software floating-point support.
25384
25385 @option{-msoft-float} changes the calling convention in the output file;
25386 therefore, it is only useful if you compile @emph{all} of a program with
25387 this option. In particular, you need to compile @file{libgcc.a}, the
25388 library that comes with GCC, with @option{-msoft-float} in order for
25389 this to work.
25390
25391 @item -mhard-quad-float
25392 @opindex mhard-quad-float
25393 Generate output containing quad-word (long double) floating-point
25394 instructions.
25395
25396 @item -msoft-quad-float
25397 @opindex msoft-quad-float
25398 Generate output containing library calls for quad-word (long double)
25399 floating-point instructions. The functions called are those specified
25400 in the SPARC ABI@. This is the default.
25401
25402 As of this writing, there are no SPARC implementations that have hardware
25403 support for the quad-word floating-point instructions. They all invoke
25404 a trap handler for one of these instructions, and then the trap handler
25405 emulates the effect of the instruction. Because of the trap handler overhead,
25406 this is much slower than calling the ABI library routines. Thus the
25407 @option{-msoft-quad-float} option is the default.
25408
25409 @item -mno-unaligned-doubles
25410 @itemx -munaligned-doubles
25411 @opindex mno-unaligned-doubles
25412 @opindex munaligned-doubles
25413 Assume that doubles have 8-byte alignment. This is the default.
25414
25415 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25416 alignment only if they are contained in another type, or if they have an
25417 absolute address. Otherwise, it assumes they have 4-byte alignment.
25418 Specifying this option avoids some rare compatibility problems with code
25419 generated by other compilers. It is not the default because it results
25420 in a performance loss, especially for floating-point code.
25421
25422 @item -muser-mode
25423 @itemx -mno-user-mode
25424 @opindex muser-mode
25425 @opindex mno-user-mode
25426 Do not generate code that can only run in supervisor mode. This is relevant
25427 only for the @code{casa} instruction emitted for the LEON3 processor. This
25428 is the default.
25429
25430 @item -mfaster-structs
25431 @itemx -mno-faster-structs
25432 @opindex mfaster-structs
25433 @opindex mno-faster-structs
25434 With @option{-mfaster-structs}, the compiler assumes that structures
25435 should have 8-byte alignment. This enables the use of pairs of
25436 @code{ldd} and @code{std} instructions for copies in structure
25437 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25438 However, the use of this changed alignment directly violates the SPARC
25439 ABI@. Thus, it's intended only for use on targets where the developer
25440 acknowledges that their resulting code is not directly in line with
25441 the rules of the ABI@.
25442
25443 @item -mstd-struct-return
25444 @itemx -mno-std-struct-return
25445 @opindex mstd-struct-return
25446 @opindex mno-std-struct-return
25447 With @option{-mstd-struct-return}, the compiler generates checking code
25448 in functions returning structures or unions to detect size mismatches
25449 between the two sides of function calls, as per the 32-bit ABI@.
25450
25451 The default is @option{-mno-std-struct-return}. This option has no effect
25452 in 64-bit mode.
25453
25454 @item -mlra
25455 @itemx -mno-lra
25456 @opindex mlra
25457 @opindex mno-lra
25458 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25459 so @option{-mno-lra} needs to be passed to get old Reload.
25460
25461 @item -mcpu=@var{cpu_type}
25462 @opindex mcpu
25463 Set the instruction set, register set, and instruction scheduling parameters
25464 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25465 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25466 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25467 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25468 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25469 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25470
25471 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25472 which selects the best architecture option for the host processor.
25473 @option{-mcpu=native} has no effect if GCC does not recognize
25474 the processor.
25475
25476 Default instruction scheduling parameters are used for values that select
25477 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25478 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25479
25480 Here is a list of each supported architecture and their supported
25481 implementations.
25482
25483 @table @asis
25484 @item v7
25485 cypress, leon3v7
25486
25487 @item v8
25488 supersparc, hypersparc, leon, leon3
25489
25490 @item sparclite
25491 f930, f934, sparclite86x
25492
25493 @item sparclet
25494 tsc701
25495
25496 @item v9
25497 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25498 niagara7, m8
25499 @end table
25500
25501 By default (unless configured otherwise), GCC generates code for the V7
25502 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25503 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25504 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25505 SPARCStation 1, 2, IPX etc.
25506
25507 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25508 architecture. The only difference from V7 code is that the compiler emits
25509 the integer multiply and integer divide instructions which exist in SPARC-V8
25510 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25511 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25512 2000 series.
25513
25514 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25515 the SPARC architecture. This adds the integer multiply, integer divide step
25516 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
25517 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
25518 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
25519 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
25520 MB86934 chip, which is the more recent SPARClite with FPU@.
25521
25522 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
25523 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
25524 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
25525 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
25526 optimizes it for the TEMIC SPARClet chip.
25527
25528 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
25529 architecture. This adds 64-bit integer and floating-point move instructions,
25530 3 additional floating-point condition code registers and conditional move
25531 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
25532 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
25533 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
25534 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25535 @option{-mcpu=niagara}, the compiler additionally optimizes it for
25536 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
25537 additionally optimizes it for Sun UltraSPARC T2 chips. With
25538 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
25539 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
25540 additionally optimizes it for Sun UltraSPARC T4 chips. With
25541 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
25542 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
25543 additionally optimizes it for Oracle M8 chips.
25544
25545 @item -mtune=@var{cpu_type}
25546 @opindex mtune
25547 Set the instruction scheduling parameters for machine type
25548 @var{cpu_type}, but do not set the instruction set or register set that the
25549 option @option{-mcpu=@var{cpu_type}} does.
25550
25551 The same values for @option{-mcpu=@var{cpu_type}} can be used for
25552 @option{-mtune=@var{cpu_type}}, but the only useful values are those
25553 that select a particular CPU implementation. Those are
25554 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
25555 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
25556 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
25557 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
25558 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
25559 and GNU/Linux toolchains, @samp{native} can also be used.
25560
25561 @item -mv8plus
25562 @itemx -mno-v8plus
25563 @opindex mv8plus
25564 @opindex mno-v8plus
25565 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
25566 difference from the V8 ABI is that the global and out registers are
25567 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
25568 mode for all SPARC-V9 processors.
25569
25570 @item -mvis
25571 @itemx -mno-vis
25572 @opindex mvis
25573 @opindex mno-vis
25574 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
25575 Visual Instruction Set extensions. The default is @option{-mno-vis}.
25576
25577 @item -mvis2
25578 @itemx -mno-vis2
25579 @opindex mvis2
25580 @opindex mno-vis2
25581 With @option{-mvis2}, GCC generates code that takes advantage of
25582 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
25583 default is @option{-mvis2} when targeting a cpu that supports such
25584 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
25585 also sets @option{-mvis}.
25586
25587 @item -mvis3
25588 @itemx -mno-vis3
25589 @opindex mvis3
25590 @opindex mno-vis3
25591 With @option{-mvis3}, GCC generates code that takes advantage of
25592 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
25593 default is @option{-mvis3} when targeting a cpu that supports such
25594 instructions, such as niagara-3 and later. Setting @option{-mvis3}
25595 also sets @option{-mvis2} and @option{-mvis}.
25596
25597 @item -mvis4
25598 @itemx -mno-vis4
25599 @opindex mvis4
25600 @opindex mno-vis4
25601 With @option{-mvis4}, GCC generates code that takes advantage of
25602 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
25603 default is @option{-mvis4} when targeting a cpu that supports such
25604 instructions, such as niagara-7 and later. Setting @option{-mvis4}
25605 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
25606
25607 @item -mvis4b
25608 @itemx -mno-vis4b
25609 @opindex mvis4b
25610 @opindex mno-vis4b
25611 With @option{-mvis4b}, GCC generates code that takes advantage of
25612 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
25613 the additional VIS instructions introduced in the Oracle SPARC
25614 Architecture 2017. The default is @option{-mvis4b} when targeting a
25615 cpu that supports such instructions, such as m8 and later. Setting
25616 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
25617 @option{-mvis2} and @option{-mvis}.
25618
25619 @item -mcbcond
25620 @itemx -mno-cbcond
25621 @opindex mcbcond
25622 @opindex mno-cbcond
25623 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
25624 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
25625 when targeting a CPU that supports such instructions, such as Niagara-4 and
25626 later.
25627
25628 @item -mfmaf
25629 @itemx -mno-fmaf
25630 @opindex mfmaf
25631 @opindex mno-fmaf
25632 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
25633 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
25634 when targeting a CPU that supports such instructions, such as Niagara-3 and
25635 later.
25636
25637 @item -mfsmuld
25638 @itemx -mno-fsmuld
25639 @opindex mfsmuld
25640 @opindex mno-fsmuld
25641 With @option{-mfsmuld}, GCC generates code that takes advantage of the
25642 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
25643 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
25644 or V9 with FPU except @option{-mcpu=leon}.
25645
25646 @item -mpopc
25647 @itemx -mno-popc
25648 @opindex mpopc
25649 @opindex mno-popc
25650 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
25651 Population Count instruction. The default is @option{-mpopc}
25652 when targeting a CPU that supports such an instruction, such as Niagara-2 and
25653 later.
25654
25655 @item -msubxc
25656 @itemx -mno-subxc
25657 @opindex msubxc
25658 @opindex mno-subxc
25659 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
25660 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
25661 when targeting a CPU that supports such an instruction, such as Niagara-7 and
25662 later.
25663
25664 @item -mfix-at697f
25665 @opindex mfix-at697f
25666 Enable the documented workaround for the single erratum of the Atmel AT697F
25667 processor (which corresponds to erratum #13 of the AT697E processor).
25668
25669 @item -mfix-ut699
25670 @opindex mfix-ut699
25671 Enable the documented workarounds for the floating-point errata and the data
25672 cache nullify errata of the UT699 processor.
25673
25674 @item -mfix-ut700
25675 @opindex mfix-ut700
25676 Enable the documented workaround for the back-to-back store errata of
25677 the UT699E/UT700 processor.
25678
25679 @item -mfix-gr712rc
25680 @opindex mfix-gr712rc
25681 Enable the documented workaround for the back-to-back store errata of
25682 the GR712RC processor.
25683 @end table
25684
25685 These @samp{-m} options are supported in addition to the above
25686 on SPARC-V9 processors in 64-bit environments:
25687
25688 @table @gcctabopt
25689 @item -m32
25690 @itemx -m64
25691 @opindex m32
25692 @opindex m64
25693 Generate code for a 32-bit or 64-bit environment.
25694 The 32-bit environment sets int, long and pointer to 32 bits.
25695 The 64-bit environment sets int to 32 bits and long and pointer
25696 to 64 bits.
25697
25698 @item -mcmodel=@var{which}
25699 @opindex mcmodel
25700 Set the code model to one of
25701
25702 @table @samp
25703 @item medlow
25704 The Medium/Low code model: 64-bit addresses, programs
25705 must be linked in the low 32 bits of memory. Programs can be statically
25706 or dynamically linked.
25707
25708 @item medmid
25709 The Medium/Middle code model: 64-bit addresses, programs
25710 must be linked in the low 44 bits of memory, the text and data segments must
25711 be less than 2GB in size and the data segment must be located within 2GB of
25712 the text segment.
25713
25714 @item medany
25715 The Medium/Anywhere code model: 64-bit addresses, programs
25716 may be linked anywhere in memory, the text and data segments must be less
25717 than 2GB in size and the data segment must be located within 2GB of the
25718 text segment.
25719
25720 @item embmedany
25721 The Medium/Anywhere code model for embedded systems:
25722 64-bit addresses, the text and data segments must be less than 2GB in
25723 size, both starting anywhere in memory (determined at link time). The
25724 global register %g4 points to the base of the data segment. Programs
25725 are statically linked and PIC is not supported.
25726 @end table
25727
25728 @item -mmemory-model=@var{mem-model}
25729 @opindex mmemory-model
25730 Set the memory model in force on the processor to one of
25731
25732 @table @samp
25733 @item default
25734 The default memory model for the processor and operating system.
25735
25736 @item rmo
25737 Relaxed Memory Order
25738
25739 @item pso
25740 Partial Store Order
25741
25742 @item tso
25743 Total Store Order
25744
25745 @item sc
25746 Sequential Consistency
25747 @end table
25748
25749 These memory models are formally defined in Appendix D of the SPARC-V9
25750 architecture manual, as set in the processor's @code{PSTATE.MM} field.
25751
25752 @item -mstack-bias
25753 @itemx -mno-stack-bias
25754 @opindex mstack-bias
25755 @opindex mno-stack-bias
25756 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
25757 frame pointer if present, are offset by @minus{}2047 which must be added back
25758 when making stack frame references. This is the default in 64-bit mode.
25759 Otherwise, assume no such offset is present.
25760 @end table
25761
25762 @node SPU Options
25763 @subsection SPU Options
25764 @cindex SPU options
25765
25766 These @samp{-m} options are supported on the SPU:
25767
25768 @table @gcctabopt
25769 @item -mwarn-reloc
25770 @itemx -merror-reloc
25771 @opindex mwarn-reloc
25772 @opindex merror-reloc
25773
25774 The loader for SPU does not handle dynamic relocations. By default, GCC
25775 gives an error when it generates code that requires a dynamic
25776 relocation. @option{-mno-error-reloc} disables the error,
25777 @option{-mwarn-reloc} generates a warning instead.
25778
25779 @item -msafe-dma
25780 @itemx -munsafe-dma
25781 @opindex msafe-dma
25782 @opindex munsafe-dma
25783
25784 Instructions that initiate or test completion of DMA must not be
25785 reordered with respect to loads and stores of the memory that is being
25786 accessed.
25787 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
25788 memory accesses, but that can lead to inefficient code in places where the
25789 memory is known to not change. Rather than mark the memory as volatile,
25790 you can use @option{-msafe-dma} to tell the compiler to treat
25791 the DMA instructions as potentially affecting all memory.
25792
25793 @item -mbranch-hints
25794 @opindex mbranch-hints
25795
25796 By default, GCC generates a branch hint instruction to avoid
25797 pipeline stalls for always-taken or probably-taken branches. A hint
25798 is not generated closer than 8 instructions away from its branch.
25799 There is little reason to disable them, except for debugging purposes,
25800 or to make an object a little bit smaller.
25801
25802 @item -msmall-mem
25803 @itemx -mlarge-mem
25804 @opindex msmall-mem
25805 @opindex mlarge-mem
25806
25807 By default, GCC generates code assuming that addresses are never larger
25808 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
25809 a full 32-bit address.
25810
25811 @item -mstdmain
25812 @opindex mstdmain
25813
25814 By default, GCC links against startup code that assumes the SPU-style
25815 main function interface (which has an unconventional parameter list).
25816 With @option{-mstdmain}, GCC links your program against startup
25817 code that assumes a C99-style interface to @code{main}, including a
25818 local copy of @code{argv} strings.
25819
25820 @item -mfixed-range=@var{register-range}
25821 @opindex mfixed-range
25822 Generate code treating the given register range as fixed registers.
25823 A fixed register is one that the register allocator cannot use. This is
25824 useful when compiling kernel code. A register range is specified as
25825 two registers separated by a dash. Multiple register ranges can be
25826 specified separated by a comma.
25827
25828 @item -mea32
25829 @itemx -mea64
25830 @opindex mea32
25831 @opindex mea64
25832 Compile code assuming that pointers to the PPU address space accessed
25833 via the @code{__ea} named address space qualifier are either 32 or 64
25834 bits wide. The default is 32 bits. As this is an ABI-changing option,
25835 all object code in an executable must be compiled with the same setting.
25836
25837 @item -maddress-space-conversion
25838 @itemx -mno-address-space-conversion
25839 @opindex maddress-space-conversion
25840 @opindex mno-address-space-conversion
25841 Allow/disallow treating the @code{__ea} address space as superset
25842 of the generic address space. This enables explicit type casts
25843 between @code{__ea} and generic pointer as well as implicit
25844 conversions of generic pointers to @code{__ea} pointers. The
25845 default is to allow address space pointer conversions.
25846
25847 @item -mcache-size=@var{cache-size}
25848 @opindex mcache-size
25849 This option controls the version of libgcc that the compiler links to an
25850 executable and selects a software-managed cache for accessing variables
25851 in the @code{__ea} address space with a particular cache size. Possible
25852 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
25853 and @samp{128}. The default cache size is 64KB.
25854
25855 @item -matomic-updates
25856 @itemx -mno-atomic-updates
25857 @opindex matomic-updates
25858 @opindex mno-atomic-updates
25859 This option controls the version of libgcc that the compiler links to an
25860 executable and selects whether atomic updates to the software-managed
25861 cache of PPU-side variables are used. If you use atomic updates, changes
25862 to a PPU variable from SPU code using the @code{__ea} named address space
25863 qualifier do not interfere with changes to other PPU variables residing
25864 in the same cache line from PPU code. If you do not use atomic updates,
25865 such interference may occur; however, writing back cache lines is
25866 more efficient. The default behavior is to use atomic updates.
25867
25868 @item -mdual-nops
25869 @itemx -mdual-nops=@var{n}
25870 @opindex mdual-nops
25871 By default, GCC inserts NOPs to increase dual issue when it expects
25872 it to increase performance. @var{n} can be a value from 0 to 10. A
25873 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
25874 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
25875
25876 @item -mhint-max-nops=@var{n}
25877 @opindex mhint-max-nops
25878 Maximum number of NOPs to insert for a branch hint. A branch hint must
25879 be at least 8 instructions away from the branch it is affecting. GCC
25880 inserts up to @var{n} NOPs to enforce this, otherwise it does not
25881 generate the branch hint.
25882
25883 @item -mhint-max-distance=@var{n}
25884 @opindex mhint-max-distance
25885 The encoding of the branch hint instruction limits the hint to be within
25886 256 instructions of the branch it is affecting. By default, GCC makes
25887 sure it is within 125.
25888
25889 @item -msafe-hints
25890 @opindex msafe-hints
25891 Work around a hardware bug that causes the SPU to stall indefinitely.
25892 By default, GCC inserts the @code{hbrp} instruction to make sure
25893 this stall won't happen.
25894
25895 @end table
25896
25897 @node System V Options
25898 @subsection Options for System V
25899
25900 These additional options are available on System V Release 4 for
25901 compatibility with other compilers on those systems:
25902
25903 @table @gcctabopt
25904 @item -G
25905 @opindex G
25906 Create a shared object.
25907 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
25908
25909 @item -Qy
25910 @opindex Qy
25911 Identify the versions of each tool used by the compiler, in a
25912 @code{.ident} assembler directive in the output.
25913
25914 @item -Qn
25915 @opindex Qn
25916 Refrain from adding @code{.ident} directives to the output file (this is
25917 the default).
25918
25919 @item -YP,@var{dirs}
25920 @opindex YP
25921 Search the directories @var{dirs}, and no others, for libraries
25922 specified with @option{-l}.
25923
25924 @item -Ym,@var{dir}
25925 @opindex Ym
25926 Look in the directory @var{dir} to find the M4 preprocessor.
25927 The assembler uses this option.
25928 @c This is supposed to go with a -Yd for predefined M4 macro files, but
25929 @c the generic assembler that comes with Solaris takes just -Ym.
25930 @end table
25931
25932 @node TILE-Gx Options
25933 @subsection TILE-Gx Options
25934 @cindex TILE-Gx options
25935
25936 These @samp{-m} options are supported on the TILE-Gx:
25937
25938 @table @gcctabopt
25939 @item -mcmodel=small
25940 @opindex mcmodel=small
25941 Generate code for the small model. The distance for direct calls is
25942 limited to 500M in either direction. PC-relative addresses are 32
25943 bits. Absolute addresses support the full address range.
25944
25945 @item -mcmodel=large
25946 @opindex mcmodel=large
25947 Generate code for the large model. There is no limitation on call
25948 distance, pc-relative addresses, or absolute addresses.
25949
25950 @item -mcpu=@var{name}
25951 @opindex mcpu
25952 Selects the type of CPU to be targeted. Currently the only supported
25953 type is @samp{tilegx}.
25954
25955 @item -m32
25956 @itemx -m64
25957 @opindex m32
25958 @opindex m64
25959 Generate code for a 32-bit or 64-bit environment. The 32-bit
25960 environment sets int, long, and pointer to 32 bits. The 64-bit
25961 environment sets int to 32 bits and long and pointer to 64 bits.
25962
25963 @item -mbig-endian
25964 @itemx -mlittle-endian
25965 @opindex mbig-endian
25966 @opindex mlittle-endian
25967 Generate code in big/little endian mode, respectively.
25968 @end table
25969
25970 @node TILEPro Options
25971 @subsection TILEPro Options
25972 @cindex TILEPro options
25973
25974 These @samp{-m} options are supported on the TILEPro:
25975
25976 @table @gcctabopt
25977 @item -mcpu=@var{name}
25978 @opindex mcpu
25979 Selects the type of CPU to be targeted. Currently the only supported
25980 type is @samp{tilepro}.
25981
25982 @item -m32
25983 @opindex m32
25984 Generate code for a 32-bit environment, which sets int, long, and
25985 pointer to 32 bits. This is the only supported behavior so the flag
25986 is essentially ignored.
25987 @end table
25988
25989 @node V850 Options
25990 @subsection V850 Options
25991 @cindex V850 Options
25992
25993 These @samp{-m} options are defined for V850 implementations:
25994
25995 @table @gcctabopt
25996 @item -mlong-calls
25997 @itemx -mno-long-calls
25998 @opindex mlong-calls
25999 @opindex mno-long-calls
26000 Treat all calls as being far away (near). If calls are assumed to be
26001 far away, the compiler always loads the function's address into a
26002 register, and calls indirect through the pointer.
26003
26004 @item -mno-ep
26005 @itemx -mep
26006 @opindex mno-ep
26007 @opindex mep
26008 Do not optimize (do optimize) basic blocks that use the same index
26009 pointer 4 or more times to copy pointer into the @code{ep} register, and
26010 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26011 option is on by default if you optimize.
26012
26013 @item -mno-prolog-function
26014 @itemx -mprolog-function
26015 @opindex mno-prolog-function
26016 @opindex mprolog-function
26017 Do not use (do use) external functions to save and restore registers
26018 at the prologue and epilogue of a function. The external functions
26019 are slower, but use less code space if more than one function saves
26020 the same number of registers. The @option{-mprolog-function} option
26021 is on by default if you optimize.
26022
26023 @item -mspace
26024 @opindex mspace
26025 Try to make the code as small as possible. At present, this just turns
26026 on the @option{-mep} and @option{-mprolog-function} options.
26027
26028 @item -mtda=@var{n}
26029 @opindex mtda
26030 Put static or global variables whose size is @var{n} bytes or less into
26031 the tiny data area that register @code{ep} points to. The tiny data
26032 area can hold up to 256 bytes in total (128 bytes for byte references).
26033
26034 @item -msda=@var{n}
26035 @opindex msda
26036 Put static or global variables whose size is @var{n} bytes or less into
26037 the small data area that register @code{gp} points to. The small data
26038 area can hold up to 64 kilobytes.
26039
26040 @item -mzda=@var{n}
26041 @opindex mzda
26042 Put static or global variables whose size is @var{n} bytes or less into
26043 the first 32 kilobytes of memory.
26044
26045 @item -mv850
26046 @opindex mv850
26047 Specify that the target processor is the V850.
26048
26049 @item -mv850e3v5
26050 @opindex mv850e3v5
26051 Specify that the target processor is the V850E3V5. The preprocessor
26052 constant @code{__v850e3v5__} is defined if this option is used.
26053
26054 @item -mv850e2v4
26055 @opindex mv850e2v4
26056 Specify that the target processor is the V850E3V5. This is an alias for
26057 the @option{-mv850e3v5} option.
26058
26059 @item -mv850e2v3
26060 @opindex mv850e2v3
26061 Specify that the target processor is the V850E2V3. The preprocessor
26062 constant @code{__v850e2v3__} is defined if this option is used.
26063
26064 @item -mv850e2
26065 @opindex mv850e2
26066 Specify that the target processor is the V850E2. The preprocessor
26067 constant @code{__v850e2__} is defined if this option is used.
26068
26069 @item -mv850e1
26070 @opindex mv850e1
26071 Specify that the target processor is the V850E1. The preprocessor
26072 constants @code{__v850e1__} and @code{__v850e__} are defined if
26073 this option is used.
26074
26075 @item -mv850es
26076 @opindex mv850es
26077 Specify that the target processor is the V850ES. This is an alias for
26078 the @option{-mv850e1} option.
26079
26080 @item -mv850e
26081 @opindex mv850e
26082 Specify that the target processor is the V850E@. The preprocessor
26083 constant @code{__v850e__} is defined if this option is used.
26084
26085 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26086 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26087 are defined then a default target processor is chosen and the
26088 relevant @samp{__v850*__} preprocessor constant is defined.
26089
26090 The preprocessor constants @code{__v850} and @code{__v851__} are always
26091 defined, regardless of which processor variant is the target.
26092
26093 @item -mdisable-callt
26094 @itemx -mno-disable-callt
26095 @opindex mdisable-callt
26096 @opindex mno-disable-callt
26097 This option suppresses generation of the @code{CALLT} instruction for the
26098 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26099 architecture.
26100
26101 This option is enabled by default when the RH850 ABI is
26102 in use (see @option{-mrh850-abi}), and disabled by default when the
26103 GCC ABI is in use. If @code{CALLT} instructions are being generated
26104 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26105
26106 @item -mrelax
26107 @itemx -mno-relax
26108 @opindex mrelax
26109 @opindex mno-relax
26110 Pass on (or do not pass on) the @option{-mrelax} command-line option
26111 to the assembler.
26112
26113 @item -mlong-jumps
26114 @itemx -mno-long-jumps
26115 @opindex mlong-jumps
26116 @opindex mno-long-jumps
26117 Disable (or re-enable) the generation of PC-relative jump instructions.
26118
26119 @item -msoft-float
26120 @itemx -mhard-float
26121 @opindex msoft-float
26122 @opindex mhard-float
26123 Disable (or re-enable) the generation of hardware floating point
26124 instructions. This option is only significant when the target
26125 architecture is @samp{V850E2V3} or higher. If hardware floating point
26126 instructions are being generated then the C preprocessor symbol
26127 @code{__FPU_OK__} is defined, otherwise the symbol
26128 @code{__NO_FPU__} is defined.
26129
26130 @item -mloop
26131 @opindex mloop
26132 Enables the use of the e3v5 LOOP instruction. The use of this
26133 instruction is not enabled by default when the e3v5 architecture is
26134 selected because its use is still experimental.
26135
26136 @item -mrh850-abi
26137 @itemx -mghs
26138 @opindex mrh850-abi
26139 @opindex mghs
26140 Enables support for the RH850 version of the V850 ABI. This is the
26141 default. With this version of the ABI the following rules apply:
26142
26143 @itemize
26144 @item
26145 Integer sized structures and unions are returned via a memory pointer
26146 rather than a register.
26147
26148 @item
26149 Large structures and unions (more than 8 bytes in size) are passed by
26150 value.
26151
26152 @item
26153 Functions are aligned to 16-bit boundaries.
26154
26155 @item
26156 The @option{-m8byte-align} command-line option is supported.
26157
26158 @item
26159 The @option{-mdisable-callt} command-line option is enabled by
26160 default. The @option{-mno-disable-callt} command-line option is not
26161 supported.
26162 @end itemize
26163
26164 When this version of the ABI is enabled the C preprocessor symbol
26165 @code{__V850_RH850_ABI__} is defined.
26166
26167 @item -mgcc-abi
26168 @opindex mgcc-abi
26169 Enables support for the old GCC version of the V850 ABI. With this
26170 version of the ABI the following rules apply:
26171
26172 @itemize
26173 @item
26174 Integer sized structures and unions are returned in register @code{r10}.
26175
26176 @item
26177 Large structures and unions (more than 8 bytes in size) are passed by
26178 reference.
26179
26180 @item
26181 Functions are aligned to 32-bit boundaries, unless optimizing for
26182 size.
26183
26184 @item
26185 The @option{-m8byte-align} command-line option is not supported.
26186
26187 @item
26188 The @option{-mdisable-callt} command-line option is supported but not
26189 enabled by default.
26190 @end itemize
26191
26192 When this version of the ABI is enabled the C preprocessor symbol
26193 @code{__V850_GCC_ABI__} is defined.
26194
26195 @item -m8byte-align
26196 @itemx -mno-8byte-align
26197 @opindex m8byte-align
26198 @opindex mno-8byte-align
26199 Enables support for @code{double} and @code{long long} types to be
26200 aligned on 8-byte boundaries. The default is to restrict the
26201 alignment of all objects to at most 4-bytes. When
26202 @option{-m8byte-align} is in effect the C preprocessor symbol
26203 @code{__V850_8BYTE_ALIGN__} is defined.
26204
26205 @item -mbig-switch
26206 @opindex mbig-switch
26207 Generate code suitable for big switch tables. Use this option only if
26208 the assembler/linker complain about out of range branches within a switch
26209 table.
26210
26211 @item -mapp-regs
26212 @opindex mapp-regs
26213 This option causes r2 and r5 to be used in the code generated by
26214 the compiler. This setting is the default.
26215
26216 @item -mno-app-regs
26217 @opindex mno-app-regs
26218 This option causes r2 and r5 to be treated as fixed registers.
26219
26220 @end table
26221
26222 @node VAX Options
26223 @subsection VAX Options
26224 @cindex VAX options
26225
26226 These @samp{-m} options are defined for the VAX:
26227
26228 @table @gcctabopt
26229 @item -munix
26230 @opindex munix
26231 Do not output certain jump instructions (@code{aobleq} and so on)
26232 that the Unix assembler for the VAX cannot handle across long
26233 ranges.
26234
26235 @item -mgnu
26236 @opindex mgnu
26237 Do output those jump instructions, on the assumption that the
26238 GNU assembler is being used.
26239
26240 @item -mg
26241 @opindex mg
26242 Output code for G-format floating-point numbers instead of D-format.
26243 @end table
26244
26245 @node Visium Options
26246 @subsection Visium Options
26247 @cindex Visium options
26248
26249 @table @gcctabopt
26250
26251 @item -mdebug
26252 @opindex mdebug
26253 A program which performs file I/O and is destined to run on an MCM target
26254 should be linked with this option. It causes the libraries libc.a and
26255 libdebug.a to be linked. The program should be run on the target under
26256 the control of the GDB remote debugging stub.
26257
26258 @item -msim
26259 @opindex msim
26260 A program which performs file I/O and is destined to run on the simulator
26261 should be linked with option. This causes libraries libc.a and libsim.a to
26262 be linked.
26263
26264 @item -mfpu
26265 @itemx -mhard-float
26266 @opindex mfpu
26267 @opindex mhard-float
26268 Generate code containing floating-point instructions. This is the
26269 default.
26270
26271 @item -mno-fpu
26272 @itemx -msoft-float
26273 @opindex mno-fpu
26274 @opindex msoft-float
26275 Generate code containing library calls for floating-point.
26276
26277 @option{-msoft-float} changes the calling convention in the output file;
26278 therefore, it is only useful if you compile @emph{all} of a program with
26279 this option. In particular, you need to compile @file{libgcc.a}, the
26280 library that comes with GCC, with @option{-msoft-float} in order for
26281 this to work.
26282
26283 @item -mcpu=@var{cpu_type}
26284 @opindex mcpu
26285 Set the instruction set, register set, and instruction scheduling parameters
26286 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26287 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26288
26289 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26290
26291 By default (unless configured otherwise), GCC generates code for the GR5
26292 variant of the Visium architecture.
26293
26294 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26295 architecture. The only difference from GR5 code is that the compiler will
26296 generate block move instructions.
26297
26298 @item -mtune=@var{cpu_type}
26299 @opindex mtune
26300 Set the instruction scheduling parameters for machine type @var{cpu_type},
26301 but do not set the instruction set or register set that the option
26302 @option{-mcpu=@var{cpu_type}} would.
26303
26304 @item -msv-mode
26305 @opindex msv-mode
26306 Generate code for the supervisor mode, where there are no restrictions on
26307 the access to general registers. This is the default.
26308
26309 @item -muser-mode
26310 @opindex muser-mode
26311 Generate code for the user mode, where the access to some general registers
26312 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26313 mode; on the GR6, only registers r29 to r31 are affected.
26314 @end table
26315
26316 @node VMS Options
26317 @subsection VMS Options
26318
26319 These @samp{-m} options are defined for the VMS implementations:
26320
26321 @table @gcctabopt
26322 @item -mvms-return-codes
26323 @opindex mvms-return-codes
26324 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26325 condition (e.g.@ error) codes.
26326
26327 @item -mdebug-main=@var{prefix}
26328 @opindex mdebug-main=@var{prefix}
26329 Flag the first routine whose name starts with @var{prefix} as the main
26330 routine for the debugger.
26331
26332 @item -mmalloc64
26333 @opindex mmalloc64
26334 Default to 64-bit memory allocation routines.
26335
26336 @item -mpointer-size=@var{size}
26337 @opindex mpointer-size=@var{size}
26338 Set the default size of pointers. Possible options for @var{size} are
26339 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26340 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26341 The later option disables @code{pragma pointer_size}.
26342 @end table
26343
26344 @node VxWorks Options
26345 @subsection VxWorks Options
26346 @cindex VxWorks Options
26347
26348 The options in this section are defined for all VxWorks targets.
26349 Options specific to the target hardware are listed with the other
26350 options for that target.
26351
26352 @table @gcctabopt
26353 @item -mrtp
26354 @opindex mrtp
26355 GCC can generate code for both VxWorks kernels and real time processes
26356 (RTPs). This option switches from the former to the latter. It also
26357 defines the preprocessor macro @code{__RTP__}.
26358
26359 @item -non-static
26360 @opindex non-static
26361 Link an RTP executable against shared libraries rather than static
26362 libraries. The options @option{-static} and @option{-shared} can
26363 also be used for RTPs (@pxref{Link Options}); @option{-static}
26364 is the default.
26365
26366 @item -Bstatic
26367 @itemx -Bdynamic
26368 @opindex Bstatic
26369 @opindex Bdynamic
26370 These options are passed down to the linker. They are defined for
26371 compatibility with Diab.
26372
26373 @item -Xbind-lazy
26374 @opindex Xbind-lazy
26375 Enable lazy binding of function calls. This option is equivalent to
26376 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26377
26378 @item -Xbind-now
26379 @opindex Xbind-now
26380 Disable lazy binding of function calls. This option is the default and
26381 is defined for compatibility with Diab.
26382 @end table
26383
26384 @node x86 Options
26385 @subsection x86 Options
26386 @cindex x86 Options
26387
26388 These @samp{-m} options are defined for the x86 family of computers.
26389
26390 @table @gcctabopt
26391
26392 @item -march=@var{cpu-type}
26393 @opindex march
26394 Generate instructions for the machine type @var{cpu-type}. In contrast to
26395 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26396 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26397 to generate code that may not run at all on processors other than the one
26398 indicated. Specifying @option{-march=@var{cpu-type}} implies
26399 @option{-mtune=@var{cpu-type}}.
26400
26401 The choices for @var{cpu-type} are:
26402
26403 @table @samp
26404 @item native
26405 This selects the CPU to generate code for at compilation time by determining
26406 the processor type of the compiling machine. Using @option{-march=native}
26407 enables all instruction subsets supported by the local machine (hence
26408 the result might not run on different machines). Using @option{-mtune=native}
26409 produces code optimized for the local machine under the constraints
26410 of the selected instruction set.
26411
26412 @item x86-64
26413 A generic CPU with 64-bit extensions.
26414
26415 @item i386
26416 Original Intel i386 CPU@.
26417
26418 @item i486
26419 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26420
26421 @item i586
26422 @itemx pentium
26423 Intel Pentium CPU with no MMX support.
26424
26425 @item lakemont
26426 Intel Lakemont MCU, based on Intel Pentium CPU.
26427
26428 @item pentium-mmx
26429 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26430
26431 @item pentiumpro
26432 Intel Pentium Pro CPU@.
26433
26434 @item i686
26435 When used with @option{-march}, the Pentium Pro
26436 instruction set is used, so the code runs on all i686 family chips.
26437 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26438
26439 @item pentium2
26440 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26441 support.
26442
26443 @item pentium3
26444 @itemx pentium3m
26445 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26446 set support.
26447
26448 @item pentium-m
26449 Intel Pentium M; low-power version of Intel Pentium III CPU
26450 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26451
26452 @item pentium4
26453 @itemx pentium4m
26454 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26455
26456 @item prescott
26457 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26458 set support.
26459
26460 @item nocona
26461 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26462 SSE2 and SSE3 instruction set support.
26463
26464 @item core2
26465 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26466 instruction set support.
26467
26468 @item nehalem
26469 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26470 SSE4.1, SSE4.2 and POPCNT instruction set support.
26471
26472 @item westmere
26473 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26474 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26475
26476 @item sandybridge
26477 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26478 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26479
26480 @item ivybridge
26481 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26482 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26483 instruction set support.
26484
26485 @item haswell
26486 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26487 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26488 BMI, BMI2 and F16C instruction set support.
26489
26490 @item broadwell
26491 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26492 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26493 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26494
26495 @item skylake
26496 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26497 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26498 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26499 XSAVES instruction set support.
26500
26501 @item bonnell
26502 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26503 instruction set support.
26504
26505 @item silvermont
26506 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26507 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26508
26509 @item goldmont
26510 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26511 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
26512 instruction set support.
26513
26514 @item goldmont-plus
26515 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26516 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
26517 PTWRITE, RDPID, SGX and UMIP instruction set support.
26518
26519 @item knl
26520 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26521 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26522 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
26523 AVX512CD instruction set support.
26524
26525 @item knm
26526 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26527 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26528 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
26529 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26530
26531 @item skylake-avx512
26532 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26533 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26534 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
26535 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
26536
26537 @item cannonlake
26538 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26539 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26540 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26541 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26542 AVX512IFMA, SHA and UMIP instruction set support.
26543
26544 @item icelake-client
26545 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26546 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26547 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26548 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26549 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26550 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
26551
26552 @item icelake-server
26553 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26554 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26555 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26556 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26557 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26558 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
26559 set support.
26560
26561 @item k6
26562 AMD K6 CPU with MMX instruction set support.
26563
26564 @item k6-2
26565 @itemx k6-3
26566 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
26567
26568 @item athlon
26569 @itemx athlon-tbird
26570 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
26571 support.
26572
26573 @item athlon-4
26574 @itemx athlon-xp
26575 @itemx athlon-mp
26576 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
26577 instruction set support.
26578
26579 @item k8
26580 @itemx opteron
26581 @itemx athlon64
26582 @itemx athlon-fx
26583 Processors based on the AMD K8 core with x86-64 instruction set support,
26584 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
26585 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
26586 instruction set extensions.)
26587
26588 @item k8-sse3
26589 @itemx opteron-sse3
26590 @itemx athlon64-sse3
26591 Improved versions of AMD K8 cores with SSE3 instruction set support.
26592
26593 @item amdfam10
26594 @itemx barcelona
26595 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
26596 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
26597 instruction set extensions.)
26598
26599 @item bdver1
26600 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
26601 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
26602 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
26603 @item bdver2
26604 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26605 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
26606 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
26607 extensions.)
26608 @item bdver3
26609 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26610 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
26611 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
26612 64-bit instruction set extensions.
26613 @item bdver4
26614 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26615 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
26616 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
26617 SSE4.2, ABM and 64-bit instruction set extensions.
26618
26619 @item znver1
26620 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
26621 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
26622 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
26623 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
26624 instruction set extensions.
26625
26626 @item btver1
26627 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
26628 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
26629 instruction set extensions.)
26630
26631 @item btver2
26632 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
26633 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
26634 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
26635
26636 @item winchip-c6
26637 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
26638 set support.
26639
26640 @item winchip2
26641 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
26642 instruction set support.
26643
26644 @item c3
26645 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
26646 (No scheduling is implemented for this chip.)
26647
26648 @item c3-2
26649 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
26650 (No scheduling is implemented for this chip.)
26651
26652 @item c7
26653 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26654 (No scheduling is implemented for this chip.)
26655
26656 @item samuel-2
26657 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
26658 (No scheduling is implemented for this chip.)
26659
26660 @item nehemiah
26661 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
26662 (No scheduling is implemented for this chip.)
26663
26664 @item esther
26665 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26666 (No scheduling is implemented for this chip.)
26667
26668 @item eden-x2
26669 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
26670 (No scheduling is implemented for this chip.)
26671
26672 @item eden-x4
26673 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
26674 AVX and AVX2 instruction set support.
26675 (No scheduling is implemented for this chip.)
26676
26677 @item nano
26678 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26679 instruction set support.
26680 (No scheduling is implemented for this chip.)
26681
26682 @item nano-1000
26683 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26684 instruction set support.
26685 (No scheduling is implemented for this chip.)
26686
26687 @item nano-2000
26688 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26689 instruction set support.
26690 (No scheduling is implemented for this chip.)
26691
26692 @item nano-3000
26693 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26694 instruction set support.
26695 (No scheduling is implemented for this chip.)
26696
26697 @item nano-x2
26698 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26699 instruction set support.
26700 (No scheduling is implemented for this chip.)
26701
26702 @item nano-x4
26703 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26704 instruction set support.
26705 (No scheduling is implemented for this chip.)
26706
26707 @item geode
26708 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
26709 @end table
26710
26711 @item -mtune=@var{cpu-type}
26712 @opindex mtune
26713 Tune to @var{cpu-type} everything applicable about the generated code, except
26714 for the ABI and the set of available instructions.
26715 While picking a specific @var{cpu-type} schedules things appropriately
26716 for that particular chip, the compiler does not generate any code that
26717 cannot run on the default machine type unless you use a
26718 @option{-march=@var{cpu-type}} option.
26719 For example, if GCC is configured for i686-pc-linux-gnu
26720 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
26721 but still runs on i686 machines.
26722
26723 The choices for @var{cpu-type} are the same as for @option{-march}.
26724 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
26725
26726 @table @samp
26727 @item generic
26728 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
26729 If you know the CPU on which your code will run, then you should use
26730 the corresponding @option{-mtune} or @option{-march} option instead of
26731 @option{-mtune=generic}. But, if you do not know exactly what CPU users
26732 of your application will have, then you should use this option.
26733
26734 As new processors are deployed in the marketplace, the behavior of this
26735 option will change. Therefore, if you upgrade to a newer version of
26736 GCC, code generation controlled by this option will change to reflect
26737 the processors
26738 that are most common at the time that version of GCC is released.
26739
26740 There is no @option{-march=generic} option because @option{-march}
26741 indicates the instruction set the compiler can use, and there is no
26742 generic instruction set applicable to all processors. In contrast,
26743 @option{-mtune} indicates the processor (or, in this case, collection of
26744 processors) for which the code is optimized.
26745
26746 @item intel
26747 Produce code optimized for the most current Intel processors, which are
26748 Haswell and Silvermont for this version of GCC. If you know the CPU
26749 on which your code will run, then you should use the corresponding
26750 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
26751 But, if you want your application performs better on both Haswell and
26752 Silvermont, then you should use this option.
26753
26754 As new Intel processors are deployed in the marketplace, the behavior of
26755 this option will change. Therefore, if you upgrade to a newer version of
26756 GCC, code generation controlled by this option will change to reflect
26757 the most current Intel processors at the time that version of GCC is
26758 released.
26759
26760 There is no @option{-march=intel} option because @option{-march} indicates
26761 the instruction set the compiler can use, and there is no common
26762 instruction set applicable to all processors. In contrast,
26763 @option{-mtune} indicates the processor (or, in this case, collection of
26764 processors) for which the code is optimized.
26765 @end table
26766
26767 @item -mcpu=@var{cpu-type}
26768 @opindex mcpu
26769 A deprecated synonym for @option{-mtune}.
26770
26771 @item -mfpmath=@var{unit}
26772 @opindex mfpmath
26773 Generate floating-point arithmetic for selected unit @var{unit}. The choices
26774 for @var{unit} are:
26775
26776 @table @samp
26777 @item 387
26778 Use the standard 387 floating-point coprocessor present on the majority of chips and
26779 emulated otherwise. Code compiled with this option runs almost everywhere.
26780 The temporary results are computed in 80-bit precision instead of the precision
26781 specified by the type, resulting in slightly different results compared to most
26782 of other chips. See @option{-ffloat-store} for more detailed description.
26783
26784 This is the default choice for non-Darwin x86-32 targets.
26785
26786 @item sse
26787 Use scalar floating-point instructions present in the SSE instruction set.
26788 This instruction set is supported by Pentium III and newer chips,
26789 and in the AMD line
26790 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
26791 instruction set supports only single-precision arithmetic, thus the double and
26792 extended-precision arithmetic are still done using 387. A later version, present
26793 only in Pentium 4 and AMD x86-64 chips, supports double-precision
26794 arithmetic too.
26795
26796 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
26797 or @option{-msse2} switches to enable SSE extensions and make this option
26798 effective. For the x86-64 compiler, these extensions are enabled by default.
26799
26800 The resulting code should be considerably faster in the majority of cases and avoid
26801 the numerical instability problems of 387 code, but may break some existing
26802 code that expects temporaries to be 80 bits.
26803
26804 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
26805 and the default choice for x86-32 targets with the SSE2 instruction set
26806 when @option{-ffast-math} is enabled.
26807
26808 @item sse,387
26809 @itemx sse+387
26810 @itemx both
26811 Attempt to utilize both instruction sets at once. This effectively doubles the
26812 amount of available registers, and on chips with separate execution units for
26813 387 and SSE the execution resources too. Use this option with care, as it is
26814 still experimental, because the GCC register allocator does not model separate
26815 functional units well, resulting in unstable performance.
26816 @end table
26817
26818 @item -masm=@var{dialect}
26819 @opindex masm=@var{dialect}
26820 Output assembly instructions using selected @var{dialect}. Also affects
26821 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
26822 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
26823 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
26824 not support @samp{intel}.
26825
26826 @item -mieee-fp
26827 @itemx -mno-ieee-fp
26828 @opindex mieee-fp
26829 @opindex mno-ieee-fp
26830 Control whether or not the compiler uses IEEE floating-point
26831 comparisons. These correctly handle the case where the result of a
26832 comparison is unordered.
26833
26834 @item -m80387
26835 @itemx -mhard-float
26836 @opindex 80387
26837 @opindex mhard-float
26838 Generate output containing 80387 instructions for floating point.
26839
26840 @item -mno-80387
26841 @itemx -msoft-float
26842 @opindex no-80387
26843 @opindex msoft-float
26844 Generate output containing library calls for floating point.
26845
26846 @strong{Warning:} the requisite libraries are not part of GCC@.
26847 Normally the facilities of the machine's usual C compiler are used, but
26848 this cannot be done directly in cross-compilation. You must make your
26849 own arrangements to provide suitable library functions for
26850 cross-compilation.
26851
26852 On machines where a function returns floating-point results in the 80387
26853 register stack, some floating-point opcodes may be emitted even if
26854 @option{-msoft-float} is used.
26855
26856 @item -mno-fp-ret-in-387
26857 @opindex mno-fp-ret-in-387
26858 Do not use the FPU registers for return values of functions.
26859
26860 The usual calling convention has functions return values of types
26861 @code{float} and @code{double} in an FPU register, even if there
26862 is no FPU@. The idea is that the operating system should emulate
26863 an FPU@.
26864
26865 The option @option{-mno-fp-ret-in-387} causes such values to be returned
26866 in ordinary CPU registers instead.
26867
26868 @item -mno-fancy-math-387
26869 @opindex mno-fancy-math-387
26870 Some 387 emulators do not support the @code{sin}, @code{cos} and
26871 @code{sqrt} instructions for the 387. Specify this option to avoid
26872 generating those instructions. This option is the default on
26873 OpenBSD and NetBSD@. This option is overridden when @option{-march}
26874 indicates that the target CPU always has an FPU and so the
26875 instruction does not need emulation. These
26876 instructions are not generated unless you also use the
26877 @option{-funsafe-math-optimizations} switch.
26878
26879 @item -malign-double
26880 @itemx -mno-align-double
26881 @opindex malign-double
26882 @opindex mno-align-double
26883 Control whether GCC aligns @code{double}, @code{long double}, and
26884 @code{long long} variables on a two-word boundary or a one-word
26885 boundary. Aligning @code{double} variables on a two-word boundary
26886 produces code that runs somewhat faster on a Pentium at the
26887 expense of more memory.
26888
26889 On x86-64, @option{-malign-double} is enabled by default.
26890
26891 @strong{Warning:} if you use the @option{-malign-double} switch,
26892 structures containing the above types are aligned differently than
26893 the published application binary interface specifications for the x86-32
26894 and are not binary compatible with structures in code compiled
26895 without that switch.
26896
26897 @item -m96bit-long-double
26898 @itemx -m128bit-long-double
26899 @opindex m96bit-long-double
26900 @opindex m128bit-long-double
26901 These switches control the size of @code{long double} type. The x86-32
26902 application binary interface specifies the size to be 96 bits,
26903 so @option{-m96bit-long-double} is the default in 32-bit mode.
26904
26905 Modern architectures (Pentium and newer) prefer @code{long double}
26906 to be aligned to an 8- or 16-byte boundary. In arrays or structures
26907 conforming to the ABI, this is not possible. So specifying
26908 @option{-m128bit-long-double} aligns @code{long double}
26909 to a 16-byte boundary by padding the @code{long double} with an additional
26910 32-bit zero.
26911
26912 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
26913 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
26914
26915 Notice that neither of these options enable any extra precision over the x87
26916 standard of 80 bits for a @code{long double}.
26917
26918 @strong{Warning:} if you override the default value for your target ABI, this
26919 changes the size of
26920 structures and arrays containing @code{long double} variables,
26921 as well as modifying the function calling convention for functions taking
26922 @code{long double}. Hence they are not binary-compatible
26923 with code compiled without that switch.
26924
26925 @item -mlong-double-64
26926 @itemx -mlong-double-80
26927 @itemx -mlong-double-128
26928 @opindex mlong-double-64
26929 @opindex mlong-double-80
26930 @opindex mlong-double-128
26931 These switches control the size of @code{long double} type. A size
26932 of 64 bits makes the @code{long double} type equivalent to the @code{double}
26933 type. This is the default for 32-bit Bionic C library. A size
26934 of 128 bits makes the @code{long double} type equivalent to the
26935 @code{__float128} type. This is the default for 64-bit Bionic C library.
26936
26937 @strong{Warning:} if you override the default value for your target ABI, this
26938 changes the size of
26939 structures and arrays containing @code{long double} variables,
26940 as well as modifying the function calling convention for functions taking
26941 @code{long double}. Hence they are not binary-compatible
26942 with code compiled without that switch.
26943
26944 @item -malign-data=@var{type}
26945 @opindex malign-data
26946 Control how GCC aligns variables. Supported values for @var{type} are
26947 @samp{compat} uses increased alignment value compatible uses GCC 4.8
26948 and earlier, @samp{abi} uses alignment value as specified by the
26949 psABI, and @samp{cacheline} uses increased alignment value to match
26950 the cache line size. @samp{compat} is the default.
26951
26952 @item -mlarge-data-threshold=@var{threshold}
26953 @opindex mlarge-data-threshold
26954 When @option{-mcmodel=medium} is specified, data objects larger than
26955 @var{threshold} are placed in the large data section. This value must be the
26956 same across all objects linked into the binary, and defaults to 65535.
26957
26958 @item -mrtd
26959 @opindex mrtd
26960 Use a different function-calling convention, in which functions that
26961 take a fixed number of arguments return with the @code{ret @var{num}}
26962 instruction, which pops their arguments while returning. This saves one
26963 instruction in the caller since there is no need to pop the arguments
26964 there.
26965
26966 You can specify that an individual function is called with this calling
26967 sequence with the function attribute @code{stdcall}. You can also
26968 override the @option{-mrtd} option by using the function attribute
26969 @code{cdecl}. @xref{Function Attributes}.
26970
26971 @strong{Warning:} this calling convention is incompatible with the one
26972 normally used on Unix, so you cannot use it if you need to call
26973 libraries compiled with the Unix compiler.
26974
26975 Also, you must provide function prototypes for all functions that
26976 take variable numbers of arguments (including @code{printf});
26977 otherwise incorrect code is generated for calls to those
26978 functions.
26979
26980 In addition, seriously incorrect code results if you call a
26981 function with too many arguments. (Normally, extra arguments are
26982 harmlessly ignored.)
26983
26984 @item -mregparm=@var{num}
26985 @opindex mregparm
26986 Control how many registers are used to pass integer arguments. By
26987 default, no registers are used to pass arguments, and at most 3
26988 registers can be used. You can control this behavior for a specific
26989 function by using the function attribute @code{regparm}.
26990 @xref{Function Attributes}.
26991
26992 @strong{Warning:} if you use this switch, and
26993 @var{num} is nonzero, then you must build all modules with the same
26994 value, including any libraries. This includes the system libraries and
26995 startup modules.
26996
26997 @item -msseregparm
26998 @opindex msseregparm
26999 Use SSE register passing conventions for float and double arguments
27000 and return values. You can control this behavior for a specific
27001 function by using the function attribute @code{sseregparm}.
27002 @xref{Function Attributes}.
27003
27004 @strong{Warning:} if you use this switch then you must build all
27005 modules with the same value, including any libraries. This includes
27006 the system libraries and startup modules.
27007
27008 @item -mvect8-ret-in-mem
27009 @opindex mvect8-ret-in-mem
27010 Return 8-byte vectors in memory instead of MMX registers. This is the
27011 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27012 Studio compilers until version 12. Later compiler versions (starting
27013 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27014 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27015 you need to remain compatible with existing code produced by those
27016 previous compiler versions or older versions of GCC@.
27017
27018 @item -mpc32
27019 @itemx -mpc64
27020 @itemx -mpc80
27021 @opindex mpc32
27022 @opindex mpc64
27023 @opindex mpc80
27024
27025 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27026 is specified, the significands of results of floating-point operations are
27027 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27028 significands of results of floating-point operations to 53 bits (double
27029 precision) and @option{-mpc80} rounds the significands of results of
27030 floating-point operations to 64 bits (extended double precision), which is
27031 the default. When this option is used, floating-point operations in higher
27032 precisions are not available to the programmer without setting the FPU
27033 control word explicitly.
27034
27035 Setting the rounding of floating-point operations to less than the default
27036 80 bits can speed some programs by 2% or more. Note that some mathematical
27037 libraries assume that extended-precision (80-bit) floating-point operations
27038 are enabled by default; routines in such libraries could suffer significant
27039 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27040 when this option is used to set the precision to less than extended precision.
27041
27042 @item -mstackrealign
27043 @opindex mstackrealign
27044 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27045 option generates an alternate prologue and epilogue that realigns the
27046 run-time stack if necessary. This supports mixing legacy codes that keep
27047 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27048 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27049 applicable to individual functions.
27050
27051 @item -mpreferred-stack-boundary=@var{num}
27052 @opindex mpreferred-stack-boundary
27053 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27054 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27055 the default is 4 (16 bytes or 128 bits).
27056
27057 @strong{Warning:} When generating code for the x86-64 architecture with
27058 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27059 used to keep the stack boundary aligned to 8 byte boundary. Since
27060 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27061 intended to be used in controlled environment where stack space is
27062 important limitation. This option leads to wrong code when functions
27063 compiled with 16 byte stack alignment (such as functions from a standard
27064 library) are called with misaligned stack. In this case, SSE
27065 instructions may lead to misaligned memory access traps. In addition,
27066 variable arguments are handled incorrectly for 16 byte aligned
27067 objects (including x87 long double and __int128), leading to wrong
27068 results. You must build all modules with
27069 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27070 includes the system libraries and startup modules.
27071
27072 @item -mincoming-stack-boundary=@var{num}
27073 @opindex mincoming-stack-boundary
27074 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27075 boundary. If @option{-mincoming-stack-boundary} is not specified,
27076 the one specified by @option{-mpreferred-stack-boundary} is used.
27077
27078 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27079 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27080 suffer significant run time performance penalties. On Pentium III, the
27081 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27082 properly if it is not 16-byte aligned.
27083
27084 To ensure proper alignment of this values on the stack, the stack boundary
27085 must be as aligned as that required by any value stored on the stack.
27086 Further, every function must be generated such that it keeps the stack
27087 aligned. Thus calling a function compiled with a higher preferred
27088 stack boundary from a function compiled with a lower preferred stack
27089 boundary most likely misaligns the stack. It is recommended that
27090 libraries that use callbacks always use the default setting.
27091
27092 This extra alignment does consume extra stack space, and generally
27093 increases code size. Code that is sensitive to stack space usage, such
27094 as embedded systems and operating system kernels, may want to reduce the
27095 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27096
27097 @need 200
27098 @item -mmmx
27099 @opindex mmmx
27100 @need 200
27101 @itemx -msse
27102 @opindex msse
27103 @need 200
27104 @itemx -msse2
27105 @opindex msse2
27106 @need 200
27107 @itemx -msse3
27108 @opindex msse3
27109 @need 200
27110 @itemx -mssse3
27111 @opindex mssse3
27112 @need 200
27113 @itemx -msse4
27114 @opindex msse4
27115 @need 200
27116 @itemx -msse4a
27117 @opindex msse4a
27118 @need 200
27119 @itemx -msse4.1
27120 @opindex msse4.1
27121 @need 200
27122 @itemx -msse4.2
27123 @opindex msse4.2
27124 @need 200
27125 @itemx -mavx
27126 @opindex mavx
27127 @need 200
27128 @itemx -mavx2
27129 @opindex mavx2
27130 @need 200
27131 @itemx -mavx512f
27132 @opindex mavx512f
27133 @need 200
27134 @itemx -mavx512pf
27135 @opindex mavx512pf
27136 @need 200
27137 @itemx -mavx512er
27138 @opindex mavx512er
27139 @need 200
27140 @itemx -mavx512cd
27141 @opindex mavx512cd
27142 @need 200
27143 @itemx -mavx512vl
27144 @opindex mavx512vl
27145 @need 200
27146 @itemx -mavx512bw
27147 @opindex mavx512bw
27148 @need 200
27149 @itemx -mavx512dq
27150 @opindex mavx512dq
27151 @need 200
27152 @itemx -mavx512ifma
27153 @opindex mavx512ifma
27154 @need 200
27155 @itemx -mavx512vbmi
27156 @opindex mavx512vbmi
27157 @need 200
27158 @itemx -msha
27159 @opindex msha
27160 @need 200
27161 @itemx -maes
27162 @opindex maes
27163 @need 200
27164 @itemx -mpclmul
27165 @opindex mpclmul
27166 @need 200
27167 @itemx -mclflushopt
27168 @opindex mclflushopt
27169 @need 200
27170 @itemx -mfsgsbase
27171 @opindex mfsgsbase
27172 @need 200
27173 @itemx -mrdrnd
27174 @opindex mrdrnd
27175 @need 200
27176 @itemx -mf16c
27177 @opindex mf16c
27178 @need 200
27179 @itemx -mfma
27180 @opindex mfma
27181 @need 200
27182 @itemx -mpconfig
27183 @opindex mpconfig
27184 @need 200
27185 @itemx -mwbnoinvd
27186 @opindex mwbnoinvd
27187 @need 200
27188 @itemx -mfma4
27189 @opindex mfma4
27190 @need 200
27191 @itemx -mprefetchwt1
27192 @opindex mprefetchwt1
27193 @need 200
27194 @itemx -mxop
27195 @opindex mxop
27196 @need 200
27197 @itemx -mlwp
27198 @opindex mlwp
27199 @need 200
27200 @itemx -m3dnow
27201 @opindex m3dnow
27202 @need 200
27203 @itemx -m3dnowa
27204 @opindex m3dnowa
27205 @need 200
27206 @itemx -mpopcnt
27207 @opindex mpopcnt
27208 @need 200
27209 @itemx -mabm
27210 @opindex mabm
27211 @need 200
27212 @itemx -mbmi
27213 @opindex mbmi
27214 @need 200
27215 @itemx -mbmi2
27216 @need 200
27217 @itemx -mlzcnt
27218 @opindex mlzcnt
27219 @need 200
27220 @itemx -mfxsr
27221 @opindex mfxsr
27222 @need 200
27223 @itemx -mxsave
27224 @opindex mxsave
27225 @need 200
27226 @itemx -mxsaveopt
27227 @opindex mxsaveopt
27228 @need 200
27229 @itemx -mxsavec
27230 @opindex mxsavec
27231 @need 200
27232 @itemx -mxsaves
27233 @opindex mxsaves
27234 @need 200
27235 @itemx -mrtm
27236 @opindex mrtm
27237 @need 200
27238 @itemx -mtbm
27239 @opindex mtbm
27240 @need 200
27241 @itemx -mmpx
27242 @opindex mmpx
27243 @need 200
27244 @itemx -mmwaitx
27245 @opindex mmwaitx
27246 @need 200
27247 @itemx -mclzero
27248 @opindex mclzero
27249 @need 200
27250 @itemx -mpku
27251 @opindex mpku
27252 @need 200
27253 @itemx -mavx512vbmi2
27254 @opindex mavx512vbmi2
27255 @need 200
27256 @itemx -mgfni
27257 @opindex mgfni
27258 @need 200
27259 @itemx -mvaes
27260 @opindex mvaes
27261 @need 200
27262 @itemx -mwaitpkg
27263 @opindex -mwaitpkg
27264 @need 200
27265 @itemx -mvpclmulqdq
27266 @opindex mvpclmulqdq
27267 @need 200
27268 @itemx -mavx512bitalg
27269 @opindex mavx512bitalg
27270 @need 200
27271 @itemx -mmovdiri
27272 @opindex mmovdiri
27273 @need 200
27274 @itemx -mmovdir64b
27275 @opindex mmovdir64b
27276 @need 200
27277 @itemx -mavx512vpopcntdq
27278 @opindex mavx512vpopcntdq
27279 @need 200
27280 @itemx -mcldemote
27281 @opindex mcldemote
27282 These switches enable the use of instructions in the MMX, SSE,
27283 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27284 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27285 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27286 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27287 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27288 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27289 sets. Each has a corresponding @option{-mno-} option to disable use of these
27290 instructions.
27291
27292 These extensions are also available as built-in functions: see
27293 @ref{x86 Built-in Functions}, for details of the functions enabled and
27294 disabled by these switches.
27295
27296 To generate SSE/SSE2 instructions automatically from floating-point
27297 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27298
27299 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27300 generates new AVX instructions or AVX equivalence for all SSEx instructions
27301 when needed.
27302
27303 These options enable GCC to use these extended instructions in
27304 generated code, even without @option{-mfpmath=sse}. Applications that
27305 perform run-time CPU detection must compile separate files for each
27306 supported architecture, using the appropriate flags. In particular,
27307 the file containing the CPU detection code should be compiled without
27308 these options.
27309
27310 @item -mdump-tune-features
27311 @opindex mdump-tune-features
27312 This option instructs GCC to dump the names of the x86 performance
27313 tuning features and default settings. The names can be used in
27314 @option{-mtune-ctrl=@var{feature-list}}.
27315
27316 @item -mtune-ctrl=@var{feature-list}
27317 @opindex mtune-ctrl=@var{feature-list}
27318 This option is used to do fine grain control of x86 code generation features.
27319 @var{feature-list} is a comma separated list of @var{feature} names. See also
27320 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27321 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27322 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27323 developers. Using it may lead to code paths not covered by testing and can
27324 potentially result in compiler ICEs or runtime errors.
27325
27326 @item -mno-default
27327 @opindex mno-default
27328 This option instructs GCC to turn off all tunable features. See also
27329 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27330
27331 @item -mcld
27332 @opindex mcld
27333 This option instructs GCC to emit a @code{cld} instruction in the prologue
27334 of functions that use string instructions. String instructions depend on
27335 the DF flag to select between autoincrement or autodecrement mode. While the
27336 ABI specifies the DF flag to be cleared on function entry, some operating
27337 systems violate this specification by not clearing the DF flag in their
27338 exception dispatchers. The exception handler can be invoked with the DF flag
27339 set, which leads to wrong direction mode when string instructions are used.
27340 This option can be enabled by default on 32-bit x86 targets by configuring
27341 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27342 instructions can be suppressed with the @option{-mno-cld} compiler option
27343 in this case.
27344
27345 @item -mvzeroupper
27346 @opindex mvzeroupper
27347 This option instructs GCC to emit a @code{vzeroupper} instruction
27348 before a transfer of control flow out of the function to minimize
27349 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27350 intrinsics.
27351
27352 @item -mprefer-avx128
27353 @opindex mprefer-avx128
27354 This option instructs GCC to use 128-bit AVX instructions instead of
27355 256-bit AVX instructions in the auto-vectorizer.
27356
27357 @item -mprefer-vector-width=@var{opt}
27358 @opindex mprefer-vector-width
27359 This option instructs GCC to use @var{opt}-bit vector width in instructions
27360 instead of default on the selected platform.
27361
27362 @table @samp
27363 @item none
27364 No extra limitations applied to GCC other than defined by the selected platform.
27365
27366 @item 128
27367 Prefer 128-bit vector width for instructions.
27368
27369 @item 256
27370 Prefer 256-bit vector width for instructions.
27371
27372 @item 512
27373 Prefer 512-bit vector width for instructions.
27374 @end table
27375
27376 @item -mcx16
27377 @opindex mcx16
27378 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27379 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27380 objects. This is useful for atomic updates of data structures exceeding one
27381 machine word in size. The compiler uses this instruction to implement
27382 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27383 128-bit integers, a library call is always used.
27384
27385 @item -msahf
27386 @opindex msahf
27387 This option enables generation of @code{SAHF} instructions in 64-bit code.
27388 Early Intel Pentium 4 CPUs with Intel 64 support,
27389 prior to the introduction of Pentium 4 G1 step in December 2005,
27390 lacked the @code{LAHF} and @code{SAHF} instructions
27391 which are supported by AMD64.
27392 These are load and store instructions, respectively, for certain status flags.
27393 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27394 @code{drem}, and @code{remainder} built-in functions;
27395 see @ref{Other Builtins} for details.
27396
27397 @item -mmovbe
27398 @opindex mmovbe
27399 This option enables use of the @code{movbe} instruction to implement
27400 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27401
27402 @item -mshstk
27403 @opindex mshstk
27404 The @option{-mshstk} option enables shadow stack built-in functions
27405 from x86 Control-flow Enforcement Technology (CET).
27406
27407 @item -mcrc32
27408 @opindex mcrc32
27409 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27410 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27411 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27412
27413 @item -mrecip
27414 @opindex mrecip
27415 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27416 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27417 with an additional Newton-Raphson step
27418 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27419 (and their vectorized
27420 variants) for single-precision floating-point arguments. These instructions
27421 are generated only when @option{-funsafe-math-optimizations} is enabled
27422 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27423 Note that while the throughput of the sequence is higher than the throughput
27424 of the non-reciprocal instruction, the precision of the sequence can be
27425 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27426
27427 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27428 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27429 combination), and doesn't need @option{-mrecip}.
27430
27431 Also note that GCC emits the above sequence with additional Newton-Raphson step
27432 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27433 already with @option{-ffast-math} (or the above option combination), and
27434 doesn't need @option{-mrecip}.
27435
27436 @item -mrecip=@var{opt}
27437 @opindex mrecip=opt
27438 This option controls which reciprocal estimate instructions
27439 may be used. @var{opt} is a comma-separated list of options, which may
27440 be preceded by a @samp{!} to invert the option:
27441
27442 @table @samp
27443 @item all
27444 Enable all estimate instructions.
27445
27446 @item default
27447 Enable the default instructions, equivalent to @option{-mrecip}.
27448
27449 @item none
27450 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27451
27452 @item div
27453 Enable the approximation for scalar division.
27454
27455 @item vec-div
27456 Enable the approximation for vectorized division.
27457
27458 @item sqrt
27459 Enable the approximation for scalar square root.
27460
27461 @item vec-sqrt
27462 Enable the approximation for vectorized square root.
27463 @end table
27464
27465 So, for example, @option{-mrecip=all,!sqrt} enables
27466 all of the reciprocal approximations, except for square root.
27467
27468 @item -mveclibabi=@var{type}
27469 @opindex mveclibabi
27470 Specifies the ABI type to use for vectorizing intrinsics using an
27471 external library. Supported values for @var{type} are @samp{svml}
27472 for the Intel short
27473 vector math library and @samp{acml} for the AMD math core library.
27474 To use this option, both @option{-ftree-vectorize} and
27475 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27476 ABI-compatible library must be specified at link time.
27477
27478 GCC currently emits calls to @code{vmldExp2},
27479 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
27480 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27481 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27482 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27483 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
27484 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27485 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27486 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27487 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27488 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27489 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27490 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27491 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27492 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27493 when @option{-mveclibabi=acml} is used.
27494
27495 @item -mabi=@var{name}
27496 @opindex mabi
27497 Generate code for the specified calling convention. Permissible values
27498 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
27499 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
27500 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
27501 You can control this behavior for specific functions by
27502 using the function attributes @code{ms_abi} and @code{sysv_abi}.
27503 @xref{Function Attributes}.
27504
27505 @item -mforce-indirect-call
27506 @opindex mforce-indirect-call
27507 Force all calls to functions to be indirect. This is useful
27508 when using Intel Processor Trace where it generates more precise timing
27509 information for function calls.
27510
27511 @item -mcall-ms2sysv-xlogues
27512 @opindex mcall-ms2sysv-xlogues
27513 @opindex mno-call-ms2sysv-xlogues
27514 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
27515 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
27516 default, the code for saving and restoring these registers is emitted inline,
27517 resulting in fairly lengthy prologues and epilogues. Using
27518 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
27519 use stubs in the static portion of libgcc to perform these saves and restores,
27520 thus reducing function size at the cost of a few extra instructions.
27521
27522 @item -mtls-dialect=@var{type}
27523 @opindex mtls-dialect
27524 Generate code to access thread-local storage using the @samp{gnu} or
27525 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
27526 @samp{gnu2} is more efficient, but it may add compile- and run-time
27527 requirements that cannot be satisfied on all systems.
27528
27529 @item -mpush-args
27530 @itemx -mno-push-args
27531 @opindex mpush-args
27532 @opindex mno-push-args
27533 Use PUSH operations to store outgoing parameters. This method is shorter
27534 and usually equally fast as method using SUB/MOV operations and is enabled
27535 by default. In some cases disabling it may improve performance because of
27536 improved scheduling and reduced dependencies.
27537
27538 @item -maccumulate-outgoing-args
27539 @opindex maccumulate-outgoing-args
27540 If enabled, the maximum amount of space required for outgoing arguments is
27541 computed in the function prologue. This is faster on most modern CPUs
27542 because of reduced dependencies, improved scheduling and reduced stack usage
27543 when the preferred stack boundary is not equal to 2. The drawback is a notable
27544 increase in code size. This switch implies @option{-mno-push-args}.
27545
27546 @item -mthreads
27547 @opindex mthreads
27548 Support thread-safe exception handling on MinGW. Programs that rely
27549 on thread-safe exception handling must compile and link all code with the
27550 @option{-mthreads} option. When compiling, @option{-mthreads} defines
27551 @option{-D_MT}; when linking, it links in a special thread helper library
27552 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
27553
27554 @item -mms-bitfields
27555 @itemx -mno-ms-bitfields
27556 @opindex mms-bitfields
27557 @opindex mno-ms-bitfields
27558
27559 Enable/disable bit-field layout compatible with the native Microsoft
27560 Windows compiler.
27561
27562 If @code{packed} is used on a structure, or if bit-fields are used,
27563 it may be that the Microsoft ABI lays out the structure differently
27564 than the way GCC normally does. Particularly when moving packed
27565 data between functions compiled with GCC and the native Microsoft compiler
27566 (either via function call or as data in a file), it may be necessary to access
27567 either format.
27568
27569 This option is enabled by default for Microsoft Windows
27570 targets. This behavior can also be controlled locally by use of variable
27571 or type attributes. For more information, see @ref{x86 Variable Attributes}
27572 and @ref{x86 Type Attributes}.
27573
27574 The Microsoft structure layout algorithm is fairly simple with the exception
27575 of the bit-field packing.
27576 The padding and alignment of members of structures and whether a bit-field
27577 can straddle a storage-unit boundary are determine by these rules:
27578
27579 @enumerate
27580 @item Structure members are stored sequentially in the order in which they are
27581 declared: the first member has the lowest memory address and the last member
27582 the highest.
27583
27584 @item Every data object has an alignment requirement. The alignment requirement
27585 for all data except structures, unions, and arrays is either the size of the
27586 object or the current packing size (specified with either the
27587 @code{aligned} attribute or the @code{pack} pragma),
27588 whichever is less. For structures, unions, and arrays,
27589 the alignment requirement is the largest alignment requirement of its members.
27590 Every object is allocated an offset so that:
27591
27592 @smallexample
27593 offset % alignment_requirement == 0
27594 @end smallexample
27595
27596 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
27597 unit if the integral types are the same size and if the next bit-field fits
27598 into the current allocation unit without crossing the boundary imposed by the
27599 common alignment requirements of the bit-fields.
27600 @end enumerate
27601
27602 MSVC interprets zero-length bit-fields in the following ways:
27603
27604 @enumerate
27605 @item If a zero-length bit-field is inserted between two bit-fields that
27606 are normally coalesced, the bit-fields are not coalesced.
27607
27608 For example:
27609
27610 @smallexample
27611 struct
27612 @{
27613 unsigned long bf_1 : 12;
27614 unsigned long : 0;
27615 unsigned long bf_2 : 12;
27616 @} t1;
27617 @end smallexample
27618
27619 @noindent
27620 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
27621 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
27622
27623 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
27624 alignment of the zero-length bit-field is greater than the member that follows it,
27625 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
27626
27627 For example:
27628
27629 @smallexample
27630 struct
27631 @{
27632 char foo : 4;
27633 short : 0;
27634 char bar;
27635 @} t2;
27636
27637 struct
27638 @{
27639 char foo : 4;
27640 short : 0;
27641 double bar;
27642 @} t3;
27643 @end smallexample
27644
27645 @noindent
27646 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
27647 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
27648 bit-field does not affect the alignment of @code{bar} or, as a result, the size
27649 of the structure.
27650
27651 Taking this into account, it is important to note the following:
27652
27653 @enumerate
27654 @item If a zero-length bit-field follows a normal bit-field, the type of the
27655 zero-length bit-field may affect the alignment of the structure as whole. For
27656 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
27657 normal bit-field, and is of type short.
27658
27659 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
27660 still affect the alignment of the structure:
27661
27662 @smallexample
27663 struct
27664 @{
27665 char foo : 6;
27666 long : 0;
27667 @} t4;
27668 @end smallexample
27669
27670 @noindent
27671 Here, @code{t4} takes up 4 bytes.
27672 @end enumerate
27673
27674 @item Zero-length bit-fields following non-bit-field members are ignored:
27675
27676 @smallexample
27677 struct
27678 @{
27679 char foo;
27680 long : 0;
27681 char bar;
27682 @} t5;
27683 @end smallexample
27684
27685 @noindent
27686 Here, @code{t5} takes up 2 bytes.
27687 @end enumerate
27688
27689
27690 @item -mno-align-stringops
27691 @opindex mno-align-stringops
27692 Do not align the destination of inlined string operations. This switch reduces
27693 code size and improves performance in case the destination is already aligned,
27694 but GCC doesn't know about it.
27695
27696 @item -minline-all-stringops
27697 @opindex minline-all-stringops
27698 By default GCC inlines string operations only when the destination is
27699 known to be aligned to least a 4-byte boundary.
27700 This enables more inlining and increases code
27701 size, but may improve performance of code that depends on fast
27702 @code{memcpy}, @code{strlen},
27703 and @code{memset} for short lengths.
27704
27705 @item -minline-stringops-dynamically
27706 @opindex minline-stringops-dynamically
27707 For string operations of unknown size, use run-time checks with
27708 inline code for small blocks and a library call for large blocks.
27709
27710 @item -mstringop-strategy=@var{alg}
27711 @opindex mstringop-strategy=@var{alg}
27712 Override the internal decision heuristic for the particular algorithm to use
27713 for inlining string operations. The allowed values for @var{alg} are:
27714
27715 @table @samp
27716 @item rep_byte
27717 @itemx rep_4byte
27718 @itemx rep_8byte
27719 Expand using i386 @code{rep} prefix of the specified size.
27720
27721 @item byte_loop
27722 @itemx loop
27723 @itemx unrolled_loop
27724 Expand into an inline loop.
27725
27726 @item libcall
27727 Always use a library call.
27728 @end table
27729
27730 @item -mmemcpy-strategy=@var{strategy}
27731 @opindex mmemcpy-strategy=@var{strategy}
27732 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
27733 should be inlined and what inline algorithm to use when the expected size
27734 of the copy operation is known. @var{strategy}
27735 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
27736 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
27737 the max byte size with which inline algorithm @var{alg} is allowed. For the last
27738 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
27739 in the list must be specified in increasing order. The minimal byte size for
27740 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
27741 preceding range.
27742
27743 @item -mmemset-strategy=@var{strategy}
27744 @opindex mmemset-strategy=@var{strategy}
27745 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
27746 @code{__builtin_memset} expansion.
27747
27748 @item -momit-leaf-frame-pointer
27749 @opindex momit-leaf-frame-pointer
27750 Don't keep the frame pointer in a register for leaf functions. This
27751 avoids the instructions to save, set up, and restore frame pointers and
27752 makes an extra register available in leaf functions. The option
27753 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
27754 which might make debugging harder.
27755
27756 @item -mtls-direct-seg-refs
27757 @itemx -mno-tls-direct-seg-refs
27758 @opindex mtls-direct-seg-refs
27759 Controls whether TLS variables may be accessed with offsets from the
27760 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
27761 or whether the thread base pointer must be added. Whether or not this
27762 is valid depends on the operating system, and whether it maps the
27763 segment to cover the entire TLS area.
27764
27765 For systems that use the GNU C Library, the default is on.
27766
27767 @item -msse2avx
27768 @itemx -mno-sse2avx
27769 @opindex msse2avx
27770 Specify that the assembler should encode SSE instructions with VEX
27771 prefix. The option @option{-mavx} turns this on by default.
27772
27773 @item -mfentry
27774 @itemx -mno-fentry
27775 @opindex mfentry
27776 If profiling is active (@option{-pg}), put the profiling
27777 counter call before the prologue.
27778 Note: On x86 architectures the attribute @code{ms_hook_prologue}
27779 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
27780
27781 @item -mrecord-mcount
27782 @itemx -mno-record-mcount
27783 @opindex mrecord-mcount
27784 If profiling is active (@option{-pg}), generate a __mcount_loc section
27785 that contains pointers to each profiling call. This is useful for
27786 automatically patching and out calls.
27787
27788 @item -mnop-mcount
27789 @itemx -mno-nop-mcount
27790 @opindex mnop-mcount
27791 If profiling is active (@option{-pg}), generate the calls to
27792 the profiling functions as NOPs. This is useful when they
27793 should be patched in later dynamically. This is likely only
27794 useful together with @option{-mrecord-mcount}.
27795
27796 @item -mskip-rax-setup
27797 @itemx -mno-skip-rax-setup
27798 @opindex mskip-rax-setup
27799 When generating code for the x86-64 architecture with SSE extensions
27800 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
27801 register when there are no variable arguments passed in vector registers.
27802
27803 @strong{Warning:} Since RAX register is used to avoid unnecessarily
27804 saving vector registers on stack when passing variable arguments, the
27805 impacts of this option are callees may waste some stack space,
27806 misbehave or jump to a random location. GCC 4.4 or newer don't have
27807 those issues, regardless the RAX register value.
27808
27809 @item -m8bit-idiv
27810 @itemx -mno-8bit-idiv
27811 @opindex m8bit-idiv
27812 On some processors, like Intel Atom, 8-bit unsigned integer divide is
27813 much faster than 32-bit/64-bit integer divide. This option generates a
27814 run-time check. If both dividend and divisor are within range of 0
27815 to 255, 8-bit unsigned integer divide is used instead of
27816 32-bit/64-bit integer divide.
27817
27818 @item -mavx256-split-unaligned-load
27819 @itemx -mavx256-split-unaligned-store
27820 @opindex mavx256-split-unaligned-load
27821 @opindex mavx256-split-unaligned-store
27822 Split 32-byte AVX unaligned load and store.
27823
27824 @item -mstack-protector-guard=@var{guard}
27825 @itemx -mstack-protector-guard-reg=@var{reg}
27826 @itemx -mstack-protector-guard-offset=@var{offset}
27827 @opindex mstack-protector-guard
27828 @opindex mstack-protector-guard-reg
27829 @opindex mstack-protector-guard-offset
27830 Generate stack protection code using canary at @var{guard}. Supported
27831 locations are @samp{global} for global canary or @samp{tls} for per-thread
27832 canary in the TLS block (the default). This option has effect only when
27833 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
27834
27835 With the latter choice the options
27836 @option{-mstack-protector-guard-reg=@var{reg}} and
27837 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27838 which segment register (@code{%fs} or @code{%gs}) to use as base register
27839 for reading the canary, and from what offset from that base register.
27840 The default for those is as specified in the relevant ABI.
27841
27842 @item -mmitigate-rop
27843 @opindex mmitigate-rop
27844 Try to avoid generating code sequences that contain unintended return
27845 opcodes, to mitigate against certain forms of attack. At the moment,
27846 this option is limited in what it can do and should not be relied
27847 on to provide serious protection.
27848
27849 @item -mgeneral-regs-only
27850 @opindex mgeneral-regs-only
27851 Generate code that uses only the general-purpose registers. This
27852 prevents the compiler from using floating-point, vector, mask and bound
27853 registers.
27854
27855 @item -mindirect-branch=@var{choice}
27856 @opindex -mindirect-branch
27857 Convert indirect call and jump with @var{choice}. The default is
27858 @samp{keep}, which keeps indirect call and jump unmodified.
27859 @samp{thunk} converts indirect call and jump to call and return thunk.
27860 @samp{thunk-inline} converts indirect call and jump to inlined call
27861 and return thunk. @samp{thunk-extern} converts indirect call and jump
27862 to external call and return thunk provided in a separate object file.
27863 You can control this behavior for a specific function by using the
27864 function attribute @code{indirect_branch}. @xref{Function Attributes}.
27865
27866 Note that @option{-mcmodel=large} is incompatible with
27867 @option{-mindirect-branch=thunk} and
27868 @option{-mindirect-branch=thunk-extern} since the thunk function may
27869 not be reachable in the large code model.
27870
27871 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
27872 @option{-fcf-protection=branch} and @option{-fcheck-pointer-bounds}
27873 since the external thunk can not be modified to disable control-flow
27874 check.
27875
27876 @item -mfunction-return=@var{choice}
27877 @opindex -mfunction-return
27878 Convert function return with @var{choice}. The default is @samp{keep},
27879 which keeps function return unmodified. @samp{thunk} converts function
27880 return to call and return thunk. @samp{thunk-inline} converts function
27881 return to inlined call and return thunk. @samp{thunk-extern} converts
27882 function return to external call and return thunk provided in a separate
27883 object file. You can control this behavior for a specific function by
27884 using the function attribute @code{function_return}.
27885 @xref{Function Attributes}.
27886
27887 Note that @option{-mcmodel=large} is incompatible with
27888 @option{-mfunction-return=thunk} and
27889 @option{-mfunction-return=thunk-extern} since the thunk function may
27890 not be reachable in the large code model.
27891
27892
27893 @item -mindirect-branch-register
27894 @opindex -mindirect-branch-register
27895 Force indirect call and jump via register.
27896
27897 @end table
27898
27899 These @samp{-m} switches are supported in addition to the above
27900 on x86-64 processors in 64-bit environments.
27901
27902 @table @gcctabopt
27903 @item -m32
27904 @itemx -m64
27905 @itemx -mx32
27906 @itemx -m16
27907 @itemx -miamcu
27908 @opindex m32
27909 @opindex m64
27910 @opindex mx32
27911 @opindex m16
27912 @opindex miamcu
27913 Generate code for a 16-bit, 32-bit or 64-bit environment.
27914 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
27915 to 32 bits, and
27916 generates code that runs on any i386 system.
27917
27918 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
27919 types to 64 bits, and generates code for the x86-64 architecture.
27920 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
27921 and @option{-mdynamic-no-pic} options.
27922
27923 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
27924 to 32 bits, and
27925 generates code for the x86-64 architecture.
27926
27927 The @option{-m16} option is the same as @option{-m32}, except for that
27928 it outputs the @code{.code16gcc} assembly directive at the beginning of
27929 the assembly output so that the binary can run in 16-bit mode.
27930
27931 The @option{-miamcu} option generates code which conforms to Intel MCU
27932 psABI. It requires the @option{-m32} option to be turned on.
27933
27934 @item -mno-red-zone
27935 @opindex mno-red-zone
27936 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
27937 by the x86-64 ABI; it is a 128-byte area beyond the location of the
27938 stack pointer that is not modified by signal or interrupt handlers
27939 and therefore can be used for temporary data without adjusting the stack
27940 pointer. The flag @option{-mno-red-zone} disables this red zone.
27941
27942 @item -mcmodel=small
27943 @opindex mcmodel=small
27944 Generate code for the small code model: the program and its symbols must
27945 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
27946 Programs can be statically or dynamically linked. This is the default
27947 code model.
27948
27949 @item -mcmodel=kernel
27950 @opindex mcmodel=kernel
27951 Generate code for the kernel code model. The kernel runs in the
27952 negative 2 GB of the address space.
27953 This model has to be used for Linux kernel code.
27954
27955 @item -mcmodel=medium
27956 @opindex mcmodel=medium
27957 Generate code for the medium model: the program is linked in the lower 2
27958 GB of the address space. Small symbols are also placed there. Symbols
27959 with sizes larger than @option{-mlarge-data-threshold} are put into
27960 large data or BSS sections and can be located above 2GB. Programs can
27961 be statically or dynamically linked.
27962
27963 @item -mcmodel=large
27964 @opindex mcmodel=large
27965 Generate code for the large model. This model makes no assumptions
27966 about addresses and sizes of sections.
27967
27968 @item -maddress-mode=long
27969 @opindex maddress-mode=long
27970 Generate code for long address mode. This is only supported for 64-bit
27971 and x32 environments. It is the default address mode for 64-bit
27972 environments.
27973
27974 @item -maddress-mode=short
27975 @opindex maddress-mode=short
27976 Generate code for short address mode. This is only supported for 32-bit
27977 and x32 environments. It is the default address mode for 32-bit and
27978 x32 environments.
27979 @end table
27980
27981 @node x86 Windows Options
27982 @subsection x86 Windows Options
27983 @cindex x86 Windows Options
27984 @cindex Windows Options for x86
27985
27986 These additional options are available for Microsoft Windows targets:
27987
27988 @table @gcctabopt
27989 @item -mconsole
27990 @opindex mconsole
27991 This option
27992 specifies that a console application is to be generated, by
27993 instructing the linker to set the PE header subsystem type
27994 required for console applications.
27995 This option is available for Cygwin and MinGW targets and is
27996 enabled by default on those targets.
27997
27998 @item -mdll
27999 @opindex mdll
28000 This option is available for Cygwin and MinGW targets. It
28001 specifies that a DLL---a dynamic link library---is to be
28002 generated, enabling the selection of the required runtime
28003 startup object and entry point.
28004
28005 @item -mnop-fun-dllimport
28006 @opindex mnop-fun-dllimport
28007 This option is available for Cygwin and MinGW targets. It
28008 specifies that the @code{dllimport} attribute should be ignored.
28009
28010 @item -mthread
28011 @opindex mthread
28012 This option is available for MinGW targets. It specifies
28013 that MinGW-specific thread support is to be used.
28014
28015 @item -municode
28016 @opindex municode
28017 This option is available for MinGW-w64 targets. It causes
28018 the @code{UNICODE} preprocessor macro to be predefined, and
28019 chooses Unicode-capable runtime startup code.
28020
28021 @item -mwin32
28022 @opindex mwin32
28023 This option is available for Cygwin and MinGW targets. It
28024 specifies that the typical Microsoft Windows predefined macros are to
28025 be set in the pre-processor, but does not influence the choice
28026 of runtime library/startup code.
28027
28028 @item -mwindows
28029 @opindex mwindows
28030 This option is available for Cygwin and MinGW targets. It
28031 specifies that a GUI application is to be generated by
28032 instructing the linker to set the PE header subsystem type
28033 appropriately.
28034
28035 @item -fno-set-stack-executable
28036 @opindex fno-set-stack-executable
28037 This option is available for MinGW targets. It specifies that
28038 the executable flag for the stack used by nested functions isn't
28039 set. This is necessary for binaries running in kernel mode of
28040 Microsoft Windows, as there the User32 API, which is used to set executable
28041 privileges, isn't available.
28042
28043 @item -fwritable-relocated-rdata
28044 @opindex fno-writable-relocated-rdata
28045 This option is available for MinGW and Cygwin targets. It specifies
28046 that relocated-data in read-only section is put into the @code{.data}
28047 section. This is a necessary for older runtimes not supporting
28048 modification of @code{.rdata} sections for pseudo-relocation.
28049
28050 @item -mpe-aligned-commons
28051 @opindex mpe-aligned-commons
28052 This option is available for Cygwin and MinGW targets. It
28053 specifies that the GNU extension to the PE file format that
28054 permits the correct alignment of COMMON variables should be
28055 used when generating code. It is enabled by default if
28056 GCC detects that the target assembler found during configuration
28057 supports the feature.
28058 @end table
28059
28060 See also under @ref{x86 Options} for standard options.
28061
28062 @node Xstormy16 Options
28063 @subsection Xstormy16 Options
28064 @cindex Xstormy16 Options
28065
28066 These options are defined for Xstormy16:
28067
28068 @table @gcctabopt
28069 @item -msim
28070 @opindex msim
28071 Choose startup files and linker script suitable for the simulator.
28072 @end table
28073
28074 @node Xtensa Options
28075 @subsection Xtensa Options
28076 @cindex Xtensa Options
28077
28078 These options are supported for Xtensa targets:
28079
28080 @table @gcctabopt
28081 @item -mconst16
28082 @itemx -mno-const16
28083 @opindex mconst16
28084 @opindex mno-const16
28085 Enable or disable use of @code{CONST16} instructions for loading
28086 constant values. The @code{CONST16} instruction is currently not a
28087 standard option from Tensilica. When enabled, @code{CONST16}
28088 instructions are always used in place of the standard @code{L32R}
28089 instructions. The use of @code{CONST16} is enabled by default only if
28090 the @code{L32R} instruction is not available.
28091
28092 @item -mfused-madd
28093 @itemx -mno-fused-madd
28094 @opindex mfused-madd
28095 @opindex mno-fused-madd
28096 Enable or disable use of fused multiply/add and multiply/subtract
28097 instructions in the floating-point option. This has no effect if the
28098 floating-point option is not also enabled. Disabling fused multiply/add
28099 and multiply/subtract instructions forces the compiler to use separate
28100 instructions for the multiply and add/subtract operations. This may be
28101 desirable in some cases where strict IEEE 754-compliant results are
28102 required: the fused multiply add/subtract instructions do not round the
28103 intermediate result, thereby producing results with @emph{more} bits of
28104 precision than specified by the IEEE standard. Disabling fused multiply
28105 add/subtract instructions also ensures that the program output is not
28106 sensitive to the compiler's ability to combine multiply and add/subtract
28107 operations.
28108
28109 @item -mserialize-volatile
28110 @itemx -mno-serialize-volatile
28111 @opindex mserialize-volatile
28112 @opindex mno-serialize-volatile
28113 When this option is enabled, GCC inserts @code{MEMW} instructions before
28114 @code{volatile} memory references to guarantee sequential consistency.
28115 The default is @option{-mserialize-volatile}. Use
28116 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28117
28118 @item -mforce-no-pic
28119 @opindex mforce-no-pic
28120 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28121 position-independent code (PIC), this option disables PIC for compiling
28122 kernel code.
28123
28124 @item -mtext-section-literals
28125 @itemx -mno-text-section-literals
28126 @opindex mtext-section-literals
28127 @opindex mno-text-section-literals
28128 These options control the treatment of literal pools. The default is
28129 @option{-mno-text-section-literals}, which places literals in a separate
28130 section in the output file. This allows the literal pool to be placed
28131 in a data RAM/ROM, and it also allows the linker to combine literal
28132 pools from separate object files to remove redundant literals and
28133 improve code size. With @option{-mtext-section-literals}, the literals
28134 are interspersed in the text section in order to keep them as close as
28135 possible to their references. This may be necessary for large assembly
28136 files. Literals for each function are placed right before that function.
28137
28138 @item -mauto-litpools
28139 @itemx -mno-auto-litpools
28140 @opindex mauto-litpools
28141 @opindex mno-auto-litpools
28142 These options control the treatment of literal pools. The default is
28143 @option{-mno-auto-litpools}, which places literals in a separate
28144 section in the output file unless @option{-mtext-section-literals} is
28145 used. With @option{-mauto-litpools} the literals are interspersed in
28146 the text section by the assembler. Compiler does not produce explicit
28147 @code{.literal} directives and loads literals into registers with
28148 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28149 do relaxation and place literals as necessary. This option allows
28150 assembler to create several literal pools per function and assemble
28151 very big functions, which may not be possible with
28152 @option{-mtext-section-literals}.
28153
28154 @item -mtarget-align
28155 @itemx -mno-target-align
28156 @opindex mtarget-align
28157 @opindex mno-target-align
28158 When this option is enabled, GCC instructs the assembler to
28159 automatically align instructions to reduce branch penalties at the
28160 expense of some code density. The assembler attempts to widen density
28161 instructions to align branch targets and the instructions following call
28162 instructions. If there are not enough preceding safe density
28163 instructions to align a target, no widening is performed. The
28164 default is @option{-mtarget-align}. These options do not affect the
28165 treatment of auto-aligned instructions like @code{LOOP}, which the
28166 assembler always aligns, either by widening density instructions or
28167 by inserting NOP instructions.
28168
28169 @item -mlongcalls
28170 @itemx -mno-longcalls
28171 @opindex mlongcalls
28172 @opindex mno-longcalls
28173 When this option is enabled, GCC instructs the assembler to translate
28174 direct calls to indirect calls unless it can determine that the target
28175 of a direct call is in the range allowed by the call instruction. This
28176 translation typically occurs for calls to functions in other source
28177 files. Specifically, the assembler translates a direct @code{CALL}
28178 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28179 The default is @option{-mno-longcalls}. This option should be used in
28180 programs where the call target can potentially be out of range. This
28181 option is implemented in the assembler, not the compiler, so the
28182 assembly code generated by GCC still shows direct call
28183 instructions---look at the disassembled object code to see the actual
28184 instructions. Note that the assembler uses an indirect call for
28185 every cross-file call, not just those that really are out of range.
28186 @end table
28187
28188 @node zSeries Options
28189 @subsection zSeries Options
28190 @cindex zSeries options
28191
28192 These are listed under @xref{S/390 and zSeries Options}.
28193
28194
28195 @c man end
28196
28197 @node Spec Files
28198 @section Specifying Subprocesses and the Switches to Pass to Them
28199 @cindex Spec Files
28200
28201 @command{gcc} is a driver program. It performs its job by invoking a
28202 sequence of other programs to do the work of compiling, assembling and
28203 linking. GCC interprets its command-line parameters and uses these to
28204 deduce which programs it should invoke, and which command-line options
28205 it ought to place on their command lines. This behavior is controlled
28206 by @dfn{spec strings}. In most cases there is one spec string for each
28207 program that GCC can invoke, but a few programs have multiple spec
28208 strings to control their behavior. The spec strings built into GCC can
28209 be overridden by using the @option{-specs=} command-line switch to specify
28210 a spec file.
28211
28212 @dfn{Spec files} are plain-text files that are used to construct spec
28213 strings. They consist of a sequence of directives separated by blank
28214 lines. The type of directive is determined by the first non-whitespace
28215 character on the line, which can be one of the following:
28216
28217 @table @code
28218 @item %@var{command}
28219 Issues a @var{command} to the spec file processor. The commands that can
28220 appear here are:
28221
28222 @table @code
28223 @item %include <@var{file}>
28224 @cindex @code{%include}
28225 Search for @var{file} and insert its text at the current point in the
28226 specs file.
28227
28228 @item %include_noerr <@var{file}>
28229 @cindex @code{%include_noerr}
28230 Just like @samp{%include}, but do not generate an error message if the include
28231 file cannot be found.
28232
28233 @item %rename @var{old_name} @var{new_name}
28234 @cindex @code{%rename}
28235 Rename the spec string @var{old_name} to @var{new_name}.
28236
28237 @end table
28238
28239 @item *[@var{spec_name}]:
28240 This tells the compiler to create, override or delete the named spec
28241 string. All lines after this directive up to the next directive or
28242 blank line are considered to be the text for the spec string. If this
28243 results in an empty string then the spec is deleted. (Or, if the
28244 spec did not exist, then nothing happens.) Otherwise, if the spec
28245 does not currently exist a new spec is created. If the spec does
28246 exist then its contents are overridden by the text of this
28247 directive, unless the first character of that text is the @samp{+}
28248 character, in which case the text is appended to the spec.
28249
28250 @item [@var{suffix}]:
28251 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28252 and up to the next directive or blank line are considered to make up the
28253 spec string for the indicated suffix. When the compiler encounters an
28254 input file with the named suffix, it processes the spec string in
28255 order to work out how to compile that file. For example:
28256
28257 @smallexample
28258 .ZZ:
28259 z-compile -input %i
28260 @end smallexample
28261
28262 This says that any input file whose name ends in @samp{.ZZ} should be
28263 passed to the program @samp{z-compile}, which should be invoked with the
28264 command-line switch @option{-input} and with the result of performing the
28265 @samp{%i} substitution. (See below.)
28266
28267 As an alternative to providing a spec string, the text following a
28268 suffix directive can be one of the following:
28269
28270 @table @code
28271 @item @@@var{language}
28272 This says that the suffix is an alias for a known @var{language}. This is
28273 similar to using the @option{-x} command-line switch to GCC to specify a
28274 language explicitly. For example:
28275
28276 @smallexample
28277 .ZZ:
28278 @@c++
28279 @end smallexample
28280
28281 Says that .ZZ files are, in fact, C++ source files.
28282
28283 @item #@var{name}
28284 This causes an error messages saying:
28285
28286 @smallexample
28287 @var{name} compiler not installed on this system.
28288 @end smallexample
28289 @end table
28290
28291 GCC already has an extensive list of suffixes built into it.
28292 This directive adds an entry to the end of the list of suffixes, but
28293 since the list is searched from the end backwards, it is effectively
28294 possible to override earlier entries using this technique.
28295
28296 @end table
28297
28298 GCC has the following spec strings built into it. Spec files can
28299 override these strings or create their own. Note that individual
28300 targets can also add their own spec strings to this list.
28301
28302 @smallexample
28303 asm Options to pass to the assembler
28304 asm_final Options to pass to the assembler post-processor
28305 cpp Options to pass to the C preprocessor
28306 cc1 Options to pass to the C compiler
28307 cc1plus Options to pass to the C++ compiler
28308 endfile Object files to include at the end of the link
28309 link Options to pass to the linker
28310 lib Libraries to include on the command line to the linker
28311 libgcc Decides which GCC support library to pass to the linker
28312 linker Sets the name of the linker
28313 predefines Defines to be passed to the C preprocessor
28314 signed_char Defines to pass to CPP to say whether @code{char} is signed
28315 by default
28316 startfile Object files to include at the start of the link
28317 @end smallexample
28318
28319 Here is a small example of a spec file:
28320
28321 @smallexample
28322 %rename lib old_lib
28323
28324 *lib:
28325 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28326 @end smallexample
28327
28328 This example renames the spec called @samp{lib} to @samp{old_lib} and
28329 then overrides the previous definition of @samp{lib} with a new one.
28330 The new definition adds in some extra command-line options before
28331 including the text of the old definition.
28332
28333 @dfn{Spec strings} are a list of command-line options to be passed to their
28334 corresponding program. In addition, the spec strings can contain
28335 @samp{%}-prefixed sequences to substitute variable text or to
28336 conditionally insert text into the command line. Using these constructs
28337 it is possible to generate quite complex command lines.
28338
28339 Here is a table of all defined @samp{%}-sequences for spec
28340 strings. Note that spaces are not generated automatically around the
28341 results of expanding these sequences. Therefore you can concatenate them
28342 together or combine them with constant text in a single argument.
28343
28344 @table @code
28345 @item %%
28346 Substitute one @samp{%} into the program name or argument.
28347
28348 @item %i
28349 Substitute the name of the input file being processed.
28350
28351 @item %b
28352 Substitute the basename of the input file being processed.
28353 This is the substring up to (and not including) the last period
28354 and not including the directory.
28355
28356 @item %B
28357 This is the same as @samp{%b}, but include the file suffix (text after
28358 the last period).
28359
28360 @item %d
28361 Marks the argument containing or following the @samp{%d} as a
28362 temporary file name, so that that file is deleted if GCC exits
28363 successfully. Unlike @samp{%g}, this contributes no text to the
28364 argument.
28365
28366 @item %g@var{suffix}
28367 Substitute a file name that has suffix @var{suffix} and is chosen
28368 once per compilation, and mark the argument in the same way as
28369 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28370 name is now chosen in a way that is hard to predict even when previously
28371 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28372 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28373 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28374 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28375 was simply substituted with a file name chosen once per compilation,
28376 without regard to any appended suffix (which was therefore treated
28377 just like ordinary text), making such attacks more likely to succeed.
28378
28379 @item %u@var{suffix}
28380 Like @samp{%g}, but generates a new temporary file name
28381 each time it appears instead of once per compilation.
28382
28383 @item %U@var{suffix}
28384 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28385 new one if there is no such last file name. In the absence of any
28386 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28387 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28388 involves the generation of two distinct file names, one
28389 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28390 simply substituted with a file name chosen for the previous @samp{%u},
28391 without regard to any appended suffix.
28392
28393 @item %j@var{suffix}
28394 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28395 writable, and if @option{-save-temps} is not used;
28396 otherwise, substitute the name
28397 of a temporary file, just like @samp{%u}. This temporary file is not
28398 meant for communication between processes, but rather as a junk
28399 disposal mechanism.
28400
28401 @item %|@var{suffix}
28402 @itemx %m@var{suffix}
28403 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28404 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28405 all. These are the two most common ways to instruct a program that it
28406 should read from standard input or write to standard output. If you
28407 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28408 construct: see for example @file{f/lang-specs.h}.
28409
28410 @item %.@var{SUFFIX}
28411 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28412 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28413 terminated by the next space or %.
28414
28415 @item %w
28416 Marks the argument containing or following the @samp{%w} as the
28417 designated output file of this compilation. This puts the argument
28418 into the sequence of arguments that @samp{%o} substitutes.
28419
28420 @item %o
28421 Substitutes the names of all the output files, with spaces
28422 automatically placed around them. You should write spaces
28423 around the @samp{%o} as well or the results are undefined.
28424 @samp{%o} is for use in the specs for running the linker.
28425 Input files whose names have no recognized suffix are not compiled
28426 at all, but they are included among the output files, so they are
28427 linked.
28428
28429 @item %O
28430 Substitutes the suffix for object files. Note that this is
28431 handled specially when it immediately follows @samp{%g, %u, or %U},
28432 because of the need for those to form complete file names. The
28433 handling is such that @samp{%O} is treated exactly as if it had already
28434 been substituted, except that @samp{%g, %u, and %U} do not currently
28435 support additional @var{suffix} characters following @samp{%O} as they do
28436 following, for example, @samp{.o}.
28437
28438 @item %p
28439 Substitutes the standard macro predefinitions for the
28440 current target machine. Use this when running @command{cpp}.
28441
28442 @item %P
28443 Like @samp{%p}, but puts @samp{__} before and after the name of each
28444 predefined macro, except for macros that start with @samp{__} or with
28445 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28446 C@.
28447
28448 @item %I
28449 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28450 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28451 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28452 and @option{-imultilib} as necessary.
28453
28454 @item %s
28455 Current argument is the name of a library or startup file of some sort.
28456 Search for that file in a standard list of directories and substitute
28457 the full name found. The current working directory is included in the
28458 list of directories scanned.
28459
28460 @item %T
28461 Current argument is the name of a linker script. Search for that file
28462 in the current list of directories to scan for libraries. If the file
28463 is located insert a @option{--script} option into the command line
28464 followed by the full path name found. If the file is not found then
28465 generate an error message. Note: the current working directory is not
28466 searched.
28467
28468 @item %e@var{str}
28469 Print @var{str} as an error message. @var{str} is terminated by a newline.
28470 Use this when inconsistent options are detected.
28471
28472 @item %(@var{name})
28473 Substitute the contents of spec string @var{name} at this point.
28474
28475 @item %x@{@var{option}@}
28476 Accumulate an option for @samp{%X}.
28477
28478 @item %X
28479 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
28480 spec string.
28481
28482 @item %Y
28483 Output the accumulated assembler options specified by @option{-Wa}.
28484
28485 @item %Z
28486 Output the accumulated preprocessor options specified by @option{-Wp}.
28487
28488 @item %a
28489 Process the @code{asm} spec. This is used to compute the
28490 switches to be passed to the assembler.
28491
28492 @item %A
28493 Process the @code{asm_final} spec. This is a spec string for
28494 passing switches to an assembler post-processor, if such a program is
28495 needed.
28496
28497 @item %l
28498 Process the @code{link} spec. This is the spec for computing the
28499 command line passed to the linker. Typically it makes use of the
28500 @samp{%L %G %S %D and %E} sequences.
28501
28502 @item %D
28503 Dump out a @option{-L} option for each directory that GCC believes might
28504 contain startup files. If the target supports multilibs then the
28505 current multilib directory is prepended to each of these paths.
28506
28507 @item %L
28508 Process the @code{lib} spec. This is a spec string for deciding which
28509 libraries are included on the command line to the linker.
28510
28511 @item %G
28512 Process the @code{libgcc} spec. This is a spec string for deciding
28513 which GCC support library is included on the command line to the linker.
28514
28515 @item %S
28516 Process the @code{startfile} spec. This is a spec for deciding which
28517 object files are the first ones passed to the linker. Typically
28518 this might be a file named @file{crt0.o}.
28519
28520 @item %E
28521 Process the @code{endfile} spec. This is a spec string that specifies
28522 the last object files that are passed to the linker.
28523
28524 @item %C
28525 Process the @code{cpp} spec. This is used to construct the arguments
28526 to be passed to the C preprocessor.
28527
28528 @item %1
28529 Process the @code{cc1} spec. This is used to construct the options to be
28530 passed to the actual C compiler (@command{cc1}).
28531
28532 @item %2
28533 Process the @code{cc1plus} spec. This is used to construct the options to be
28534 passed to the actual C++ compiler (@command{cc1plus}).
28535
28536 @item %*
28537 Substitute the variable part of a matched option. See below.
28538 Note that each comma in the substituted string is replaced by
28539 a single space.
28540
28541 @item %<S
28542 Remove all occurrences of @code{-S} from the command line. Note---this
28543 command is position dependent. @samp{%} commands in the spec string
28544 before this one see @code{-S}, @samp{%} commands in the spec string
28545 after this one do not.
28546
28547 @item %:@var{function}(@var{args})
28548 Call the named function @var{function}, passing it @var{args}.
28549 @var{args} is first processed as a nested spec string, then split
28550 into an argument vector in the usual fashion. The function returns
28551 a string which is processed as if it had appeared literally as part
28552 of the current spec.
28553
28554 The following built-in spec functions are provided:
28555
28556 @table @code
28557 @item @code{getenv}
28558 The @code{getenv} spec function takes two arguments: an environment
28559 variable name and a string. If the environment variable is not
28560 defined, a fatal error is issued. Otherwise, the return value is the
28561 value of the environment variable concatenated with the string. For
28562 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
28563
28564 @smallexample
28565 %:getenv(TOPDIR /include)
28566 @end smallexample
28567
28568 expands to @file{/path/to/top/include}.
28569
28570 @item @code{if-exists}
28571 The @code{if-exists} spec function takes one argument, an absolute
28572 pathname to a file. If the file exists, @code{if-exists} returns the
28573 pathname. Here is a small example of its usage:
28574
28575 @smallexample
28576 *startfile:
28577 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
28578 @end smallexample
28579
28580 @item @code{if-exists-else}
28581 The @code{if-exists-else} spec function is similar to the @code{if-exists}
28582 spec function, except that it takes two arguments. The first argument is
28583 an absolute pathname to a file. If the file exists, @code{if-exists-else}
28584 returns the pathname. If it does not exist, it returns the second argument.
28585 This way, @code{if-exists-else} can be used to select one file or another,
28586 based on the existence of the first. Here is a small example of its usage:
28587
28588 @smallexample
28589 *startfile:
28590 crt0%O%s %:if-exists(crti%O%s) \
28591 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
28592 @end smallexample
28593
28594 @item @code{replace-outfile}
28595 The @code{replace-outfile} spec function takes two arguments. It looks for the
28596 first argument in the outfiles array and replaces it with the second argument. Here
28597 is a small example of its usage:
28598
28599 @smallexample
28600 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
28601 @end smallexample
28602
28603 @item @code{remove-outfile}
28604 The @code{remove-outfile} spec function takes one argument. It looks for the
28605 first argument in the outfiles array and removes it. Here is a small example
28606 its usage:
28607
28608 @smallexample
28609 %:remove-outfile(-lm)
28610 @end smallexample
28611
28612 @item @code{pass-through-libs}
28613 The @code{pass-through-libs} spec function takes any number of arguments. It
28614 finds any @option{-l} options and any non-options ending in @file{.a} (which it
28615 assumes are the names of linker input library archive files) and returns a
28616 result containing all the found arguments each prepended by
28617 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
28618 intended to be passed to the LTO linker plugin.
28619
28620 @smallexample
28621 %:pass-through-libs(%G %L %G)
28622 @end smallexample
28623
28624 @item @code{print-asm-header}
28625 The @code{print-asm-header} function takes no arguments and simply
28626 prints a banner like:
28627
28628 @smallexample
28629 Assembler options
28630 =================
28631
28632 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
28633 @end smallexample
28634
28635 It is used to separate compiler options from assembler options
28636 in the @option{--target-help} output.
28637 @end table
28638
28639 @item %@{S@}
28640 Substitutes the @code{-S} switch, if that switch is given to GCC@.
28641 If that switch is not specified, this substitutes nothing. Note that
28642 the leading dash is omitted when specifying this option, and it is
28643 automatically inserted if the substitution is performed. Thus the spec
28644 string @samp{%@{foo@}} matches the command-line option @option{-foo}
28645 and outputs the command-line option @option{-foo}.
28646
28647 @item %W@{S@}
28648 Like %@{@code{S}@} but mark last argument supplied within as a file to be
28649 deleted on failure.
28650
28651 @item %@{S*@}
28652 Substitutes all the switches specified to GCC whose names start
28653 with @code{-S}, but which also take an argument. This is used for
28654 switches like @option{-o}, @option{-D}, @option{-I}, etc.
28655 GCC considers @option{-o foo} as being
28656 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
28657 text, including the space. Thus two arguments are generated.
28658
28659 @item %@{S*&T*@}
28660 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
28661 (the order of @code{S} and @code{T} in the spec is not significant).
28662 There can be any number of ampersand-separated variables; for each the
28663 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
28664
28665 @item %@{S:X@}
28666 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
28667
28668 @item %@{!S:X@}
28669 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
28670
28671 @item %@{S*:X@}
28672 Substitutes @code{X} if one or more switches whose names start with
28673 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
28674 once, no matter how many such switches appeared. However, if @code{%*}
28675 appears somewhere in @code{X}, then @code{X} is substituted once
28676 for each matching switch, with the @code{%*} replaced by the part of
28677 that switch matching the @code{*}.
28678
28679 If @code{%*} appears as the last part of a spec sequence then a space
28680 is added after the end of the last substitution. If there is more
28681 text in the sequence, however, then a space is not generated. This
28682 allows the @code{%*} substitution to be used as part of a larger
28683 string. For example, a spec string like this:
28684
28685 @smallexample
28686 %@{mcu=*:--script=%*/memory.ld@}
28687 @end smallexample
28688
28689 @noindent
28690 when matching an option like @option{-mcu=newchip} produces:
28691
28692 @smallexample
28693 --script=newchip/memory.ld
28694 @end smallexample
28695
28696 @item %@{.S:X@}
28697 Substitutes @code{X}, if processing a file with suffix @code{S}.
28698
28699 @item %@{!.S:X@}
28700 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
28701
28702 @item %@{,S:X@}
28703 Substitutes @code{X}, if processing a file for language @code{S}.
28704
28705 @item %@{!,S:X@}
28706 Substitutes @code{X}, if not processing a file for language @code{S}.
28707
28708 @item %@{S|P:X@}
28709 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
28710 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
28711 @code{*} sequences as well, although they have a stronger binding than
28712 the @samp{|}. If @code{%*} appears in @code{X}, all of the
28713 alternatives must be starred, and only the first matching alternative
28714 is substituted.
28715
28716 For example, a spec string like this:
28717
28718 @smallexample
28719 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
28720 @end smallexample
28721
28722 @noindent
28723 outputs the following command-line options from the following input
28724 command-line options:
28725
28726 @smallexample
28727 fred.c -foo -baz
28728 jim.d -bar -boggle
28729 -d fred.c -foo -baz -boggle
28730 -d jim.d -bar -baz -boggle
28731 @end smallexample
28732
28733 @item %@{S:X; T:Y; :D@}
28734
28735 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
28736 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
28737 be as many clauses as you need. This may be combined with @code{.},
28738 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
28739
28740
28741 @end table
28742
28743 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
28744 or similar construct can use a backslash to ignore the special meaning
28745 of the character following it, thus allowing literal matching of a
28746 character that is otherwise specially treated. For example,
28747 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
28748 @option{-std=iso9899:1999} option is given.
28749
28750 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
28751 construct may contain other nested @samp{%} constructs or spaces, or
28752 even newlines. They are processed as usual, as described above.
28753 Trailing white space in @code{X} is ignored. White space may also
28754 appear anywhere on the left side of the colon in these constructs,
28755 except between @code{.} or @code{*} and the corresponding word.
28756
28757 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
28758 handled specifically in these constructs. If another value of
28759 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
28760 @option{-W} switch is found later in the command line, the earlier
28761 switch value is ignored, except with @{@code{S}*@} where @code{S} is
28762 just one letter, which passes all matching options.
28763
28764 The character @samp{|} at the beginning of the predicate text is used to
28765 indicate that a command should be piped to the following command, but
28766 only if @option{-pipe} is specified.
28767
28768 It is built into GCC which switches take arguments and which do not.
28769 (You might think it would be useful to generalize this to allow each
28770 compiler's spec to say which switches take arguments. But this cannot
28771 be done in a consistent fashion. GCC cannot even decide which input
28772 files have been specified without knowing which switches take arguments,
28773 and it must know which input files to compile in order to tell which
28774 compilers to run).
28775
28776 GCC also knows implicitly that arguments starting in @option{-l} are to be
28777 treated as compiler output files, and passed to the linker in their
28778 proper position among the other output files.
28779
28780 @node Environment Variables
28781 @section Environment Variables Affecting GCC
28782 @cindex environment variables
28783
28784 @c man begin ENVIRONMENT
28785 This section describes several environment variables that affect how GCC
28786 operates. Some of them work by specifying directories or prefixes to use
28787 when searching for various kinds of files. Some are used to specify other
28788 aspects of the compilation environment.
28789
28790 Note that you can also specify places to search using options such as
28791 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
28792 take precedence over places specified using environment variables, which
28793 in turn take precedence over those specified by the configuration of GCC@.
28794 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
28795 GNU Compiler Collection (GCC) Internals}.
28796
28797 @table @env
28798 @item LANG
28799 @itemx LC_CTYPE
28800 @c @itemx LC_COLLATE
28801 @itemx LC_MESSAGES
28802 @c @itemx LC_MONETARY
28803 @c @itemx LC_NUMERIC
28804 @c @itemx LC_TIME
28805 @itemx LC_ALL
28806 @findex LANG
28807 @findex LC_CTYPE
28808 @c @findex LC_COLLATE
28809 @findex LC_MESSAGES
28810 @c @findex LC_MONETARY
28811 @c @findex LC_NUMERIC
28812 @c @findex LC_TIME
28813 @findex LC_ALL
28814 @cindex locale
28815 These environment variables control the way that GCC uses
28816 localization information which allows GCC to work with different
28817 national conventions. GCC inspects the locale categories
28818 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
28819 so. These locale categories can be set to any value supported by your
28820 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
28821 Kingdom encoded in UTF-8.
28822
28823 The @env{LC_CTYPE} environment variable specifies character
28824 classification. GCC uses it to determine the character boundaries in
28825 a string; this is needed for some multibyte encodings that contain quote
28826 and escape characters that are otherwise interpreted as a string
28827 end or escape.
28828
28829 The @env{LC_MESSAGES} environment variable specifies the language to
28830 use in diagnostic messages.
28831
28832 If the @env{LC_ALL} environment variable is set, it overrides the value
28833 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
28834 and @env{LC_MESSAGES} default to the value of the @env{LANG}
28835 environment variable. If none of these variables are set, GCC
28836 defaults to traditional C English behavior.
28837
28838 @item TMPDIR
28839 @findex TMPDIR
28840 If @env{TMPDIR} is set, it specifies the directory to use for temporary
28841 files. GCC uses temporary files to hold the output of one stage of
28842 compilation which is to be used as input to the next stage: for example,
28843 the output of the preprocessor, which is the input to the compiler
28844 proper.
28845
28846 @item GCC_COMPARE_DEBUG
28847 @findex GCC_COMPARE_DEBUG
28848 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
28849 @option{-fcompare-debug} to the compiler driver. See the documentation
28850 of this option for more details.
28851
28852 @item GCC_EXEC_PREFIX
28853 @findex GCC_EXEC_PREFIX
28854 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
28855 names of the subprograms executed by the compiler. No slash is added
28856 when this prefix is combined with the name of a subprogram, but you can
28857 specify a prefix that ends with a slash if you wish.
28858
28859 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
28860 an appropriate prefix to use based on the pathname it is invoked with.
28861
28862 If GCC cannot find the subprogram using the specified prefix, it
28863 tries looking in the usual places for the subprogram.
28864
28865 The default value of @env{GCC_EXEC_PREFIX} is
28866 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
28867 the installed compiler. In many cases @var{prefix} is the value
28868 of @code{prefix} when you ran the @file{configure} script.
28869
28870 Other prefixes specified with @option{-B} take precedence over this prefix.
28871
28872 This prefix is also used for finding files such as @file{crt0.o} that are
28873 used for linking.
28874
28875 In addition, the prefix is used in an unusual way in finding the
28876 directories to search for header files. For each of the standard
28877 directories whose name normally begins with @samp{/usr/local/lib/gcc}
28878 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
28879 replacing that beginning with the specified prefix to produce an
28880 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
28881 @file{foo/bar} just before it searches the standard directory
28882 @file{/usr/local/lib/bar}.
28883 If a standard directory begins with the configured
28884 @var{prefix} then the value of @var{prefix} is replaced by
28885 @env{GCC_EXEC_PREFIX} when looking for header files.
28886
28887 @item COMPILER_PATH
28888 @findex COMPILER_PATH
28889 The value of @env{COMPILER_PATH} is a colon-separated list of
28890 directories, much like @env{PATH}. GCC tries the directories thus
28891 specified when searching for subprograms, if it cannot find the
28892 subprograms using @env{GCC_EXEC_PREFIX}.
28893
28894 @item LIBRARY_PATH
28895 @findex LIBRARY_PATH
28896 The value of @env{LIBRARY_PATH} is a colon-separated list of
28897 directories, much like @env{PATH}. When configured as a native compiler,
28898 GCC tries the directories thus specified when searching for special
28899 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
28900 using GCC also uses these directories when searching for ordinary
28901 libraries for the @option{-l} option (but directories specified with
28902 @option{-L} come first).
28903
28904 @item LANG
28905 @findex LANG
28906 @cindex locale definition
28907 This variable is used to pass locale information to the compiler. One way in
28908 which this information is used is to determine the character set to be used
28909 when character literals, string literals and comments are parsed in C and C++.
28910 When the compiler is configured to allow multibyte characters,
28911 the following values for @env{LANG} are recognized:
28912
28913 @table @samp
28914 @item C-JIS
28915 Recognize JIS characters.
28916 @item C-SJIS
28917 Recognize SJIS characters.
28918 @item C-EUCJP
28919 Recognize EUCJP characters.
28920 @end table
28921
28922 If @env{LANG} is not defined, or if it has some other value, then the
28923 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
28924 recognize and translate multibyte characters.
28925 @end table
28926
28927 @noindent
28928 Some additional environment variables affect the behavior of the
28929 preprocessor.
28930
28931 @include cppenv.texi
28932
28933 @c man end
28934
28935 @node Precompiled Headers
28936 @section Using Precompiled Headers
28937 @cindex precompiled headers
28938 @cindex speed of compilation
28939
28940 Often large projects have many header files that are included in every
28941 source file. The time the compiler takes to process these header files
28942 over and over again can account for nearly all of the time required to
28943 build the project. To make builds faster, GCC allows you to
28944 @dfn{precompile} a header file.
28945
28946 To create a precompiled header file, simply compile it as you would any
28947 other file, if necessary using the @option{-x} option to make the driver
28948 treat it as a C or C++ header file. You may want to use a
28949 tool like @command{make} to keep the precompiled header up-to-date when
28950 the headers it contains change.
28951
28952 A precompiled header file is searched for when @code{#include} is
28953 seen in the compilation. As it searches for the included file
28954 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
28955 compiler looks for a precompiled header in each directory just before it
28956 looks for the include file in that directory. The name searched for is
28957 the name specified in the @code{#include} with @samp{.gch} appended. If
28958 the precompiled header file cannot be used, it is ignored.
28959
28960 For instance, if you have @code{#include "all.h"}, and you have
28961 @file{all.h.gch} in the same directory as @file{all.h}, then the
28962 precompiled header file is used if possible, and the original
28963 header is used otherwise.
28964
28965 Alternatively, you might decide to put the precompiled header file in a
28966 directory and use @option{-I} to ensure that directory is searched
28967 before (or instead of) the directory containing the original header.
28968 Then, if you want to check that the precompiled header file is always
28969 used, you can put a file of the same name as the original header in this
28970 directory containing an @code{#error} command.
28971
28972 This also works with @option{-include}. So yet another way to use
28973 precompiled headers, good for projects not designed with precompiled
28974 header files in mind, is to simply take most of the header files used by
28975 a project, include them from another header file, precompile that header
28976 file, and @option{-include} the precompiled header. If the header files
28977 have guards against multiple inclusion, they are skipped because
28978 they've already been included (in the precompiled header).
28979
28980 If you need to precompile the same header file for different
28981 languages, targets, or compiler options, you can instead make a
28982 @emph{directory} named like @file{all.h.gch}, and put each precompiled
28983 header in the directory, perhaps using @option{-o}. It doesn't matter
28984 what you call the files in the directory; every precompiled header in
28985 the directory is considered. The first precompiled header
28986 encountered in the directory that is valid for this compilation is
28987 used; they're searched in no particular order.
28988
28989 There are many other possibilities, limited only by your imagination,
28990 good sense, and the constraints of your build system.
28991
28992 A precompiled header file can be used only when these conditions apply:
28993
28994 @itemize
28995 @item
28996 Only one precompiled header can be used in a particular compilation.
28997
28998 @item
28999 A precompiled header cannot be used once the first C token is seen. You
29000 can have preprocessor directives before a precompiled header; you cannot
29001 include a precompiled header from inside another header.
29002
29003 @item
29004 The precompiled header file must be produced for the same language as
29005 the current compilation. You cannot use a C precompiled header for a C++
29006 compilation.
29007
29008 @item
29009 The precompiled header file must have been produced by the same compiler
29010 binary as the current compilation is using.
29011
29012 @item
29013 Any macros defined before the precompiled header is included must
29014 either be defined in the same way as when the precompiled header was
29015 generated, or must not affect the precompiled header, which usually
29016 means that they don't appear in the precompiled header at all.
29017
29018 The @option{-D} option is one way to define a macro before a
29019 precompiled header is included; using a @code{#define} can also do it.
29020 There are also some options that define macros implicitly, like
29021 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29022 defined this way.
29023
29024 @item If debugging information is output when using the precompiled
29025 header, using @option{-g} or similar, the same kind of debugging information
29026 must have been output when building the precompiled header. However,
29027 a precompiled header built using @option{-g} can be used in a compilation
29028 when no debugging information is being output.
29029
29030 @item The same @option{-m} options must generally be used when building
29031 and using the precompiled header. @xref{Submodel Options},
29032 for any cases where this rule is relaxed.
29033
29034 @item Each of the following options must be the same when building and using
29035 the precompiled header:
29036
29037 @gccoptlist{-fexceptions}
29038
29039 @item
29040 Some other command-line options starting with @option{-f},
29041 @option{-p}, or @option{-O} must be defined in the same way as when
29042 the precompiled header was generated. At present, it's not clear
29043 which options are safe to change and which are not; the safest choice
29044 is to use exactly the same options when generating and using the
29045 precompiled header. The following are known to be safe:
29046
29047 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29048 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29049 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29050 -pedantic-errors}
29051
29052 @end itemize
29053
29054 For all of these except the last, the compiler automatically
29055 ignores the precompiled header if the conditions aren't met. If you
29056 find an option combination that doesn't work and doesn't cause the
29057 precompiled header to be ignored, please consider filing a bug report,
29058 see @ref{Bugs}.
29059
29060 If you do use differing options when generating and using the
29061 precompiled header, the actual behavior is a mixture of the
29062 behavior for the options. For instance, if you use @option{-g} to
29063 generate the precompiled header but not when using it, you may or may
29064 not get debugging information for routines in the precompiled header.